diff --git a/driver/xf86-video-geode/COPYING b/driver/xf86-video-geode/COPYING new file mode 100644 index 000000000..6c05f4fe4 --- /dev/null +++ b/driver/xf86-video-geode/COPYING @@ -0,0 +1,23 @@ +Copyright (c) 2005 Advanced Micro Devices, Inc. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to +deal in the Software without restriction, including without limitation the +rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +sell copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +IN THE SOFTWARE. + +Neither the name of the Advanced Micro Devices, Inc. nor the names of its +contributors may be used to endorse or promote products derived from this +software without specific prior written permission. diff --git a/driver/xf86-video-geode/ChangeLog b/driver/xf86-video-geode/ChangeLog new file mode 100644 index 000000000..52a811be8 --- /dev/null +++ b/driver/xf86-video-geode/ChangeLog @@ -0,0 +1,1053 @@ +commit e98927f2c60acd9262cfb6fca2491fe0decc7aa5 +Author: Jordan Crouse +Date: Fri Jun 13 15:59:44 2008 -0600 + + Bump to version 2.10.0 + +commit 2fc546c0d129fe7d3edee6b0cbfd530de33e2209 +Author: Jordan Crouse +Date: Tue Jun 10 12:08:53 2008 -0600 + + geode: Bring over the DCON detection code from the OLPC tree + +commit 489546dfd2dd295db63f31e123b0073a6fa330a9 +Author: Jordan Crouse +Date: Tue Jun 10 12:08:52 2008 -0600 + + geode: Unmap the PCI memory when we close the screen + +commit 739eb15da7bb0d2ca681eeb9a308b1297ee4eca7 +Author: Peter Hutterer +Date: Wed May 28 11:13:54 2008 +0930 + + Fix build for git-master (missing device pointers). + + We don't have an updated Video ABI yet, so use the XINPUT ABI as check for + when to use which call. + + Note that the check is not optimal. We only check for the position of the VCP, + not of any other device to adjust the viewpoint. This needs to be fixed. + +commit 5186a2b736e30b7d68a75f861f51047491182e57 +Author: Peter Hutterer +Date: Wed May 28 10:54:09 2008 +0930 + + Revert "Fix build (missing device pointers)." + + Silly me, this breaks the build for non-git-master servers. + + This reverts commit 3005e9c7eb10e212c956e87b3631548e268c794e. + +commit 3005e9c7eb10e212c956e87b3631548e268c794e +Author: Peter Hutterer +Date: Wed May 28 09:25:06 2008 +0930 + + Fix build (missing device pointers). + + miPointerGetScreen, miPointerGetPosition and pScreen->SetCursorPosition all + require a device argument now. For lack of other choices, just pass in the + VCP. + +commit 94b9029e335ddbe7c22a8fe4bf69858b75179219 +Author: Martin-Éric Racine +Date: Wed May 7 22:35:23 2008 +0300 + + Making libDDC support the 2.9.0 release. + +commit 61663593475f61567466c105ca19d5009a4e9c41 +Author: Jordan Crouse +Date: Tue Apr 15 14:54:57 2008 -0600 + + geode: Add "native" DDC parsing to the Geode driver + + Teach libDDC to access the DDC pins on the Geode natively, instead + of using the BIOS which has proven to be broken time and time again. + +commit 401a7ed390beca4d37121575e64b72969d55fa7c +Author: Jordan Crouse +Date: Tue Apr 1 13:41:48 2008 -0600 + + geode: Bump to new version and replace two instances of the old amd name + +commit e93660928499f963d477720b628a05e8d14ea197 +Author: Jordan Crouse +Date: Fri Mar 14 16:38:21 2008 -0600 + + amd: Missed a merge artifact - kick me in the head for breaking tinderbox + +commit c42454a5d1fba9dc0ef4d671cb839108ef827ec9 +Author: Jordan Crouse +Date: Fri Mar 14 13:57:14 2008 -0600 + + amd: fix compile and warning issues from the merge + +commit 5e1f6e925bd92c389169c971502b1fd17c625056 +Author: Jordan Crouse +Date: Fri Mar 14 13:55:23 2008 -0600 + + amd: fix up the versioning and naming of the new driver + +commit 1fd63467e3fa71f289f80dba013046d0065ff3f3 +Author: Jordan Crouse +Date: Tue Mar 11 16:21:58 2008 -0600 + + Massive coding style fixup - move to X coding style, + remove trailing whitespace, zap unused files and + remove blocks of ifdefed out code. + +commit ec8edd1393f482ca42b401463f0f09580aa263a0 +Author: Jordan Crouse +Date: Tue Mar 11 15:43:00 2008 -0600 + + First stage of the rename process - get rid of all amd_ prefixes - + change either to geode_ or just to lx_ or gx_ depending on the processor. + Change the name in the Makefiles and other collateral + +commit a7bc1a7f6b439419fc27b669d9d7f99f882d83fe +Author: Jordan Crouse +Date: Thu Mar 13 17:30:03 2008 -0600 + + amd: release version 2.7.7.7 + + xf86-video-amd is now dead - long live xf86-video-geode! + +commit 248a1f24c9f232cb9d5218faee5d4f7f014ef9c5 +Author: Jordan Crouse +Date: Thu Mar 13 16:01:21 2008 -0600 + + amd: fix panel and DDC interation with GX + +commit d8f8277c89752286da329c50b769986a19b521de +Author: Jordan Crouse +Date: Thu Mar 13 15:00:36 2008 -0600 + + amd: Fix a compile error in < 1.5 builds + +commit 95159125cb19acdfb23ee5042acf9d8b9d776c7a +Author: Jordan Crouse +Date: Wed Mar 12 14:14:45 2008 -0600 + + amd: Add the 'geode' name in preparation for the renaming + +commit b884e17eb74f6b7f11f4bba71ce0421cd0d28855 +Author: Stefano Fedrigo +Date: Wed Mar 12 14:13:55 2008 -0600 + + amd: Add libpciaccess probe function + +commit 01a23f48f4777c705eb4345b3d5e27b6a4f73254 +Author: Dave Airlie +Date: Mon Mar 10 19:21:07 2008 +1000 + + amd: fix distcheck + +commit 0464e1e6b7587aaf87b818fabd93e484f9bc8288 +Author: Dave Airlie +Date: Mon Mar 10 18:56:22 2008 +1000 + + amd: fixup pciaccess compile + +commit eec3a36983867611c9ee401079a8c3a81181d941 +Author: Dave Airlie +Date: Mon Mar 10 18:56:08 2008 +1000 + + fix devprivates properly + +commit 68e3f6c80c1db7c84e176ef298c700ce5bedd501 +Author: Dave Airlie +Date: Mon Mar 10 18:38:49 2008 +1000 + + old privates v2 + +commit 497a081b8fc5d22890b3555589dfc4d2f9c9b6f6 +Author: Dave Airlie +Date: Mon Mar 10 17:09:18 2008 +1000 + + amd: move to new devprivates + +commit da6ca8ff17373428844f904bbc3a1d0e55c8e5c2 +Author: Dave Airlie +Date: Mon Mar 10 16:54:25 2008 +1000 + + pciaccess: fix name of struct + +commit 0899664b9f9dc7a9a7fafab008e145f5e3340ac9 +Author: Dave Airlie +Date: Mon Mar 10 16:47:53 2008 +1000 + + pciaccess: forgot some commas + +commit 0e655a383d3fa8d6757b6b785451468ed1550443 +Author: Dave Airlie +Date: Mon Mar 10 16:25:09 2008 +1000 + + oops I did it again.. forgot the damn include + +commit 2b7d32a60ffa6c87fa7a89eb206ed8916a682d93 +Author: Dave Airlie +Date: Mon Mar 10 16:22:57 2008 +1000 + + amd: initial pciaccess conversion + +commit 1e763626aaefa1ae0cf4d4896c0b7192955e5993 +Author: Bart Trojanowski +Date: Sun Mar 2 11:52:01 2008 +0200 + + Implement support for wide and non-standard screen resolutions. + + Works fine on the VGA output, but requires further testing to + ensure that it doesn't disturb operation on the TFT output. + +commit 2a7240e845ba27a9d2f485fda0bb5f8175234454 +Author: Martin-Éric Racine +Date: Sun Feb 10 01:55:06 2008 +0200 + + Erm... That would be pScrni, of course. + +commit ae448a3beafe001c2bbc60f9fa09ebcfb00e828f +Author: Martin-Éric Racine +Date: Sun Feb 10 01:50:26 2008 +0200 + + Added trivial fix for Gamma initialization. + +commit 4670abb6036379245995f000dcb7d3e33f39570f +Author: Martin-Éric Racine +Date: Sat Jan 26 01:51:39 2008 +0200 + + [GX/LX] Bump the default pixel depth up to 16-bit. + + This is a reasonable compromise between memory consumption + and picture readability. This also gives the driver usable + defaults for X server >= 1.3 when used with -configure. + +commit 2ac6c6e3764f4e6ae014af23db6b5211bb034424 +Author: Bernardo Innocenti +Date: Sat Jan 26 01:46:24 2008 +0200 + + Constify a few huge tables to reduce data section size. + + This driver is still unusually big compared to the other X.org + drivers. The biggest offender is cimarron.o as demonstrated by: + + nm -S -t d cimarron.o | sort -k 2 -n + +commit db25e615f81ea94e1c3e82a408c09d915389d3b7 +Author: Bernardo Innocenti +Date: Mon Jan 14 01:43:16 2008 +0100 + + amd_drv: Remove a few (harmless) warnings + + Signed-off-by: Bernardo Innocenti + +commit ba2880433912cd63c68cd81682d8e48c3cf77a09 +Author: Martin-Éric Racine +Date: Mon Jan 14 12:32:13 2008 +0200 + + Expanded the bug reporting URL in configure.ac to specify the Driver/AMD component. + +commit cf5e5d2b37de2504b76d96e1f26a5450550b8320 +Author: Martin-Éric Racine +Date: Mon Jan 14 03:05:48 2008 +0200 + + Basic OLPC support from Bernardo Innocenti and Jordan Crouse. + +commit 471f96cf85c6db9952ff4443f84a3c8d701927e7 +Author: Martin-Éric Racine +Date: Tue Jan 8 13:57:25 2008 -0700 + + Trivial patch to fix the ZTV module + +commit 407f403583f901bbb38d267b9194835d5255d41c +Author: Martin-Éric Racine +Date: Sat Jan 5 06:29:59 2008 +0200 + + [GX][LX] Push PreInit fixes to avoid segfauls on X -configure. + + This is known to work on products with GeodeROM and Insyde BIOSes. + + On products with a General Software BIOS, a freeze occurs while X + is probing VBE. The same issue occurs with LinuxBIOS and VGAROM, + but not with LinuxBIOS omitting VGAROM. + + Both issues appear to be caused by X server core upgrading from + vm86 to x86emu since X server release 1.3, which requires fixing + x86emu, or the concerned BIOSes, or both. + +commit cc570675d97af7b0f4f6a70af0e7e01c89690aa1 +Author: Jordan Crouse +Date: Mon Dec 24 13:00:48 2007 -0700 + + [GX] Fix the autoconfigure segfault for GX too + +commit f1482feb5b210095c564e2cad5bfd6d6e4e2cd78 +Author: Jordan Crouse +Date: Mon Dec 24 11:56:19 2007 -0700 + + [LX] Re-arrange PreInit to avoid segfaults in Xorg -configure + + Re-arrange the early part of PreInit so that Xorg -configure can run + cleanly. + +commit d4cd5d91a015088d548736831edd31760bcda88d +Author: Martin-Éric Racine +Date: Mon Oct 15 16:32:56 2007 +0300 + + Bumped package version to 2.7.7.3. + +commit 5833df9f71af8253f02a360c1b0e5e36ba2e4910 +Author: Jordan Crouse +Date: Fri Sep 28 09:05:56 2007 -0600 + + [XORG] Fix video downscaling + + When downscaling the window, apparently the clip region doesn't + change (not sure why), so we didn't get the message to re-init + the video. This will make the re-init process happen on both + the clip region changing and the width/height changing. + +commit dfe2ab1ea3c1a66952b6d38e436a064d677e5fba +Author: Jordan Crouse +Date: Tue Sep 18 13:45:10 2007 -0600 + + [XORG] Remove the upload function for LX + + Remove the upload function for LX. The default function is going to be + faster for all 0xCC BLTs; which just so happens to be what all the + uploads will be. + +commit b795643e860548eff6f1a458391e56098c490f64 +Author: Martin-Éric Racine +Date: Mon Sep 17 14:57:22 2007 +0300 + + Update the package version in configure.ac + +commit 65a629fb9861f51f7591bfc1d80068194e7f840e +Author: Martin-Éric Racine +Date: Mon Sep 17 14:55:49 2007 +0300 + + ChangeLog DOES need to be cleaned, but in MAINTIANERCLEANFILES. + +commit 5179095e4e9ba4e699f6965b752df932d2808155 +Author: Martin-Éric Racine +Date: Wed Sep 12 10:53:34 2007 +0300 + + Creating a release of course requires updating the package version... + +commit 39be7f612783fcc6e51ee0a502e4630661fab702 +Author: Martin-Éric Racine +Date: Wed Sep 12 09:04:08 2007 +0300 + + We no longer delete the ChangeLog in the clean target. We will simply overwrite it instead. + +commit 48b20f8c1424e953485149b707318386339e2953 +Author: Martin-Éric Racine +Date: Sun Sep 2 13:28:57 2007 +0300 + + Erm... actually, the ChangeLog needs ot be removed, since it's generated at release time. + +commit 4ade6759760b52ed3b84a846f9c4f5f421a70ef8 +Author: Martin-Éric Racine +Date: Sun Sep 2 13:18:28 2007 +0300 + + Commit the clean 2.7.7.0 ChangeLog to GIT. + +commit 1d1b3005a741b04331fecb1453a0c5c6381518a7 +Author: Martin-Éric Racine +Date: Sun Sep 2 12:54:30 2007 +0300 + + Added the standard X.org ChangeLog generation target to Makefile.am + +commit f159ec89c2e1fd33a52d8f0375233c5fb06bc6f0 +Author: Martin-Éric Racine +Date: Sun Sep 2 12:46:40 2007 +0300 + + Reverted autogen.sh changes too, since the 'dist' target does what we need. + +commit bae63fbe0871229ecd9fca75043065c15a8ea9dc +Author: Martin-Éric Racine +Date: Sun Sep 2 12:39:06 2007 +0300 + + Reverted the autotool file generation from the GIT tree. + +commit 1afba2099aaefead9e87827c60dea146d6e264f3 +Author: Martin-Éric Racine +Date: Sun Sep 2 10:18:49 2007 +0300 + + Regenerated configure based on new package version. + +commit e525ca0d68faed9ede9f55df6d0d4a3099d3ad49 +Author: Martin-Éric Racine +Date: Sun Sep 2 10:05:49 2007 +0300 + + Bumped the package version to 2.7.7.0 and calling it a release. + +commit 47c1bc40e2a06ac84953f4a8b62031fb978ab316 +Author: Martin-Eric Racine +Date: Wed Aug 29 22:02:23 2007 +0300 + + Updated the ChangeLog. + +commit b29cce202abb0c6afb30ec1f06c98d7f84e8d2e4 +Author: Martin-Eric Racine +Date: Wed Aug 29 22:01:28 2007 +0300 + + Regenerated ChangeLog and autotool files. + +commit a6192811e21c9f8d17b409018f945adc2eea3594 +Author: Jordan Crouse +Date: Thu Aug 2 10:45:14 2007 -0600 + + Fix the upload / composite mask race + + We fix a race with the upload function when using a composite mask + by using the exa core function exaGetPixmapFirstPixel, which does + the right thing in X 1.4 and newer. For older versions, the fix is + to stall the pipeine to ensure the upload is complete, so thats what + we do. + +commit 8ce4c5cc9650ddc81d9243bc416522800bce3afc +Author: Martin-Éric Racine +Date: Wed Jul 25 09:55:25 2007 -0600 + + Add the all-important if/then loop to avoid + squashing the ChangeLog if autogen.sh is executed outside of a git + tree. + +commit bb0f0afc6c5cf849081a007af0c2d3485e87e9c4 +Author: Martin-Éric Racine +Date: Fri Jul 13 12:34:45 2007 -0600 + + This autogen.sh implements ChangeLog generation from the git commit + log. It also calls the correct Makefile macro to clean up after + maintainer configuration, instead of cleaning up by hand. + +commit 08c26f1bda66b8ffd91e345cdd2cb29171b615b3 +Author: Jordan Crouse +Date: Tue Jul 10 15:16:12 2007 -0600 + + Fix "old-school" MSR accesses + + This fixes the "old" way of reading MSRs (through virtual registers) - + we had swapped arguments in one of the macros, which does very bad + things to the poor systems it was running on. + +commit 9f8ea76662733cec5ee6289727c143bf057aee57 +Author: Jordan Crouse +Date: Tue Jul 10 10:06:01 2007 -0600 + + Change _X_INLINE to just inline - the define probably isn't needed + for us unless we go to a system that doesn't support it. We'll cross + that bridge when we get to it. + +commit 47b5a249e7ae877d7816504fec4f987442d07931 +Author: Martin-Éric Racine +Date: Fri Jul 6 16:59:51 2007 -0600 + + An improved autogen.sh script + +commit f42add8948e2cee3d9f2edf580f260c42718fc0c +Author: Jordan Crouse +Date: Fri Jul 6 16:13:14 2007 -0600 + + Remove the DCON sleep code + + The DCON sleep code was introduced by a previous commit - for now that + will only live in the OLPC tree. + +commit bff92101bd22fcb6a5c0e9da9be58105f7655be4 +Author: Jordan Crouse +Date: Fri Jul 6 13:22:02 2007 -0600 + + Use the right bit depth when doing EXA copies on the GX. + + This fixes the image corruption problem on OLPC. + +commit 247faeeb1d1c429800f187e08cfaa31407c660ff +Author: Jordan Crouse +Date: Tue Jul 3 15:53:56 2007 -0600 + + Make sure we turn on the video palette when video starts, and turn it off + when video ends. + +commit 610f9a6b443afa8e40637a62b2b377a992f5eb05 +Author: Dan Williams +Date: Mon Jun 25 15:30:02 2007 -0400 + + Fix LX video downscaling + + The GX video downscaling logic apparently isn't appropriate for the LX + +commit fd870f7acd4654ea1b440925e78df2afc5bf7259 +Author: Adam Jackson +Date: Mon Jun 25 11:06:39 2007 -0400 + + uint32_t -> CARD32 + +commit 54ac7918b53a999a25185ff140cda001255596b3 +Author: Jordan Crouse +Date: Fri Jun 22 17:09:28 2007 -0600 + + Multiple fixes for the LX driver + + * Fix VGA detection + * Restrict EXA implementations older then 2.0 + * Fix crash when VT is switched while rotated + * Turn the shadow framebuffer into a true exa offscreen component + * Shut off video when we are rotated + + Conflicts: + + src/amd_lx_driver.c + src/amd_lx_rotate.c + +commit ea11d99bc29086a8fa92c01dd22f195d626b33d2 +Author: Jordan Crouse +Date: Fri Jun 15 18:08:56 2007 -0600 + + Two fixes for compositing for Cairo 1.4.4 and X server 1.3+ + +commit 7bf0627cd001325affbe16118a2f27225179eabd +Author: Zephaniah E. Hull +Date: Wed Jun 13 12:28:36 2007 -0400 + + From Bernardo Innocenti. + + - enable a few GCC warnings + + - make a few globals const and static + + - move MGP_RASTER_MODE writes before writes to color registers + + - compute BPP dynamically in the SolidFill EXA hook + + Conflicts: + + configure.ac + +commit dc23a3168df78424108e8609b250e88c3dd16775 +Author: Jordan Crouse +Date: Fri Jun 1 18:32:28 2007 -0600 + + Fix A8 masks + + We were using the wrong operation for A8 masks, resulting in badness. + Also, clean up the mask blt to be much simpler. + +commit 167d9dcfe6c13f37590b26bd544ae225cb7934ac +Author: Jordan Crouse +Date: Fri Jun 1 09:31:52 2007 -0600 + + Use the correct pitch for composite mask operations + + We need to specify the correct pitch for composite mask operations - this + fixes the stride problem. Also, correctly set up the source color and + some other minor issues, this helps us pass caps-join in the cairo test + suite. + +commit 802282679447f2be6d815a6aa196d764a33bb07d +Author: Jordan Crouse +Date: Thu May 17 17:07:17 2007 -0600 + + Swizzle the sync when the panel is enabled to account for Cimarron being + silly. + +commit 0a138f4a36ff2b474705bb542b446fe340be324d +Author: Adam Jackson +Date: Thu May 31 15:10:59 2007 -0400 + + Add DCON detection to LX. + +commit 6350e6e2bdc42aa7220d3101111a3bcc0a9b864a +Author: Adam Jackson +Date: Thu May 31 15:07:29 2007 -0400 + + DCON detection cleanup and generification. + +commit 506a23c3618905cbcc1c767b9e388ca86706bc73 +Author: Adam Jackson +Date: Thu May 31 14:34:07 2007 -0400 + + Un-libcwrap. + +commit c37fc13ea909a7a1315d3723ccac0e4146b3a0b2 +Author: Adam Jackson +Date: Thu May 31 14:30:10 2007 -0400 + + Add extra GCC warning fu. -Wall cleanup. + +commit 0953a855c7d20186a8efb6db4842eb777f6e0e56 +Author: Adam Jackson +Date: Thu May 31 13:58:59 2007 -0400 + + Rename: amd_gx_dcon.c -> amd_dcon.c + +commit 0da247099df93a9774e8a638170f2142615ed5df +Author: Adam Jackson +Date: Wed May 16 13:05:46 2007 -0400 + + Remove 'man' directory references from configure.ac. + +commit 217eeed3c1659cc9e0f13ba6932d1342c0255df4 +Merge: 6d1942f... 022a106... +Author: Jordan Crouse +Date: Thu May 10 10:39:08 2007 -0600 + + Merge Geode GX and LX development from OLPC + + Conflicts: + + man/amd.man + +commit 022a106b38693d2d705e8c15ad84c18832fa2e8c +Author: Jordan Crouse +Date: Wed May 9 17:17:25 2007 -0600 + + Documentation cleanups + + Rework the readme, and delete the now woefully out of date man pages. + Also update the TODO file with more interesting information. + +commit 37719011a020eafc9a6848025f3e07219c2f5444 +Author: Jordan Crouse +Date: Wed May 9 17:17:16 2007 -0600 + + Fix warnings discovered by Dan Williams and -Wall + +commit da653c761c9a275cf2b5ff4e087cb0239421c72d +Author: Dan Williams +Date: Wed May 9 13:32:42 2007 -0600 + + More -Wall warnings fixed + +commit 8fa5d1e3653f91c0c1409147f7292463554dd9f9 +Author: Dan Williams +Date: Wed May 9 13:31:15 2007 -0600 + + Eliminate the first round of warnings discovered with -Wall + +commit 0af46deb156c1d4bdc7c3378c70bb9ef696a4886 +Author: Jordan Crouse +Date: Fri May 4 11:43:09 2007 -0600 + + Completely eliminate the rotation pitch + + Chris Ball is still getting segfalts - completely eliminate the + call. + +commit c35f7fe15a5a872606f18c84c097f3b5b1cada74 +Author: Jordan Crouse +Date: Fri May 4 11:30:55 2007 -0600 + + Fix a segfault in RandR + +commit 1ddbc60536d6e2b7a4654dd9019a3872c1a54de2 +Author: Jordan Crouse +Date: Fri May 4 09:03:26 2007 -0600 + + Use the same stride for all rotations + + This avoids problems copying pixmaps from EXA space. + +commit 69501cb09955741a3bb93a0992085cf4f64c70d7 +Author: Jordan Crouse +Date: Fri May 4 09:03:22 2007 -0600 + + Cimarron wants to use CF8/CFC + + Avoid using the PCI access routines in Cimarron + +commit 460c5b55d30086b013e35c76fd406e8826e6a814 +Author: Jordan Crouse +Date: Fri May 4 08:53:40 2007 -0600 + + Handle out of memory situations more gracefully + +commit 501f1b6d11ce35d5e53de798a364b7712c754e7b +Author: Dan Williams +Date: Thu May 3 10:05:17 2007 -0400 + + commit 5f7979e990c5eafb44aa0fa9779a7ed3904d25ce + + include string.h for memset + +commit 89bb73e915a8aca7a04d2ab0818f9b21c88d59c3 +Author: Dan Williams +Date: Thu May 3 09:56:42 2007 -0400 + + commit 7125fcab372b24f7045bbdaa6d4f6e435b1f7a83 + + Fix missed GXQueryImageAttributes->GeodeQueryImageAttributes + +commit 4dfae85222779694e162c8bb942b7587c2600592 +Author: Jordan Crouse +Date: Wed May 2 14:38:24 2007 -0600 + + Solve several vexing issues with RandR: + + * Incorrect rendering while rotated + * Mouse was incorrectly drawn for 90 and 270 + * subsequent RandR commands were killing the rotated stride + +commit dc5db7c4d68268377cd99f7c8e4bc54556923ed1 +Author: Jordan Crouse +Date: Tue May 1 17:08:42 2007 -0600 + + Fix video and VGA bugs + + Fix two small bugs: The VGA dection code wasn't working, and the video + engine was not using color keying. + +commit 59eac173349afa24c126ec670bedb68643dd5a84 +Author: Jordan Crouse +Date: Thu Apr 26 15:34:11 2007 -0600 + + Use a secret bit to ensure we use channel A alpha *before* color conversion + +commit 46b29acf1f239dd89adabf1cb2c138cf8a2b1700 +Author: Jordan Crouse +Date: Fri Apr 20 11:17:16 2007 -0600 + + Several fixes to support OLPC LX turnon + + These are fixes discovered during the OLPC LX turn on. The compression + was incorrectly being configured, resulting in bad drawing, that has + bee repaired. Assume by default that we're going to use a panel and the + CRT, no longer read the straps MSR because it is unreliable. Finally, + fix the MSR hooks by moving the hook definitions where they will do some + good and disabling the VSA method. + +commit 8bfed84a1f972325cdf61876d7f7dfd0e8f0d4d5 +Author: Jordan Crouse +Date: Wed Apr 11 13:37:02 2007 -0600 + + Add Linux MSR suport for LX + + Extend the GX MSR support to LX - this is to support the VSAless + OFW, and share code. + +commit 2d7689990c19fd74d5fad11bcf6317a7874a6057 +Author: Jordan Crouse +Date: Thu Mar 8 18:06:11 2007 -0700 + + Fix a couple of scary bugs - including one that seemed to be causing + corruption. + +commit b959509bb37e6ef269088ecbe92f49c7dc971fb6 +Author: Jordan Crouse +Date: Wed Mar 7 18:27:52 2007 -0700 + + Add a TODO file filled with many bugs and enhancements + +commit b59bfdde9341ca9014e00795e344ac64b5b91b8c +Author: Jordan Crouse +Date: Wed Mar 7 18:14:34 2007 -0700 + + [MAJOR UPDATE] Geode LX driver + + This is a major re-vamping of the Geode LX driver to support EXA, RandR, + and advanced xserver features. The GX and LX drivers now share the similar + streamlined infrastructure, and acceleration. The LX driver also adds + features the GX does not have, such as accelerated rotations and + far better composite support. + + This provides the basis for the rotation and acceleration enhancements. + +commit 6d1942fb5e9a1e37baae3ec8559f9567ddeb2f67 +Author: Alan Coopersmith +Date: Thu Mar 1 10:38:08 2007 -0800 + + Replace references to XFree86/XF86Config in man page + +commit d2f53b7c576c91f07f55b62b0020be1d0ab358dc +Author: Jordan Crouse +Date: Wed Jan 31 13:50:19 2007 -0700 + + Fix an unfortunate segfault when NoAccel is selected + +commit 610e65d49c3060b9512be785ab78de0824583155 +Author: Jordan Crouse +Date: Mon Jan 15 22:03:00 2007 -0700 + + Fixed broken EXA - things actually move faster now. + +commit 7f3e76af1675dc071769cdd68fa0ae4f1290b7b4 +Author: Dan Williams +Date: Mon Jan 15 16:49:09 2007 -0500 + + Fix distcheck + +commit edbd744b31eb7996b521eca4a42e0e20700ffa78 +Author: Jordan Crouse +Date: Fri Jan 12 10:30:19 2007 -0700 + + Correctly program the sync polarity taking into account the GX wierdness + +commit 461c5fb1ed00101e9832b4a0236bbb51d092ddb6 +Author: Jordan Crouse +Date: Thu Jan 11 17:30:45 2007 -0700 + + Broken logic on the previous Xv fix - should work now + +commit a212981da0147a5f277b43b801de6d2454005c17 +Author: Jordan Crouse +Date: Wed Jan 10 17:51:23 2007 -0700 + + Add Xv hardware support for a RGB565 source. + +commit acc4421ac55d021ef917967ecd09b650e8dd9699 +Author: Jordan Crouse +Date: Wed Jan 10 14:23:02 2007 -0700 + + Fix a segfault when no valid modes are found + Also - be smart about allocating memory in the RandR part. + +commit 888dab329bb66c8e4317d0b6a9736fa70c9686a6 +Author: Jordan Crouse +Date: Wed Jan 10 14:21:43 2007 -0700 + + I missed a few updates of the new driver structure in the video code + +commit cb69ce0f54569c68c79173e144c3c90e46e64f8b +Author: Adam Jackson +Date: Mon Jan 8 15:23:59 2007 -0500 + + Minor DCON fixes. + + Wire up the DCON init to GXPreInit, and set the panel geometry appropriately + if found. + +commit c4f21aaaaf6d101e7c8828e246e06be3ff0591c3 +Author: Adam Jackson +Date: Mon Jan 8 15:22:28 2007 -0500 + + Fix RANDR support to be dlloader-friendly. + +commit d4d16bf29802549b501a00e32195162ed5e8ab93 +Author: Adam Jackson +Date: Mon Jan 8 15:21:33 2007 -0500 + + Build fix. + +commit f762b456b98063860e38e9541f4be2fb1302e3c2 +Author: Adam Jackson +Date: Mon Jan 8 15:20:44 2007 -0500 + + Add --enable-visibility. + + Allow the driver to be built with the default symbol visbility set to hidden, + for smaller better code. + +commit cf77a1fe9ec232cbb0d99685f34d0acb91ee5d88 +Author: Jordan Crouse +Date: Fri Dec 29 10:58:35 2006 -0700 + + Remove direct PCI accesses from Durango + + Accessing PCI through X is one thing, accessing it directly is quite + another. + +commit fb92319afde24b91c64314e4f2d8725fa2cd61fe +Author: Jordan Crouse +Date: Wed Dec 20 17:30:44 2006 -0700 + + Replace the VSA MSR interface with something more sane + +commit e34f70fc46b36a0ea26636045ce9f9bf24ec89cd +Author: Jordan Crouse +Date: Mon Dec 18 11:01:34 2006 -0700 + + Correctly rotate the HW cursor data so that it matches the rest of the screen + +commit 2e558b7cf6c508a1f745d922d911d612eba7d2c4 +Author: Jordan Crouse +Date: Fri Dec 15 16:37:35 2006 -0700 + + A few fixes for the panel - the mode should be set correctly now, and + segfaults have gone away. + +commit 243edb93e131734f23d9c5f39f1cd614ecc6a1f8 +Author: Jordan Crouse +Date: Fri Dec 15 13:23:49 2006 -0700 + + Remove debugging messages and other cleanups + +commit 8cd3fa16e377119452d8575198a7f1f1a77e44fc +Author: Jordan Crouse +Date: Fri Dec 15 13:23:48 2006 -0700 + + Default the GX driver to use EXA for acceleration + +commit 04e5aa4e6e9ec4ddc8ebeaf9f7004cb832c194c8 +Author: Jordan Crouse +Date: Fri Dec 15 13:23:48 2006 -0700 + + Allow the user to specify an initial rotation + +commit dc2244b398d68bb340e97c723615e3b52ecd47ae +Author: Jordan Crouse +Date: Fri Dec 15 13:23:45 2006 -0700 + + Clean up the VGA init + +commit 5b66b41b1d91345700e8f18569fa984c6ce53aca +Author: Jordan Crouse +Date: Fri Dec 15 08:46:42 2006 -0700 + + Remove unneeded GX options + +commit d901348441642fadbd71ed2e37e74b3b2a7af97c +Author: Jordan Crouse +Date: Thu Dec 14 17:28:48 2006 -0700 + + Fix the memory mapping so its more sane, and disable XAA pixmap caches + during rotation. + +commit 73dc69c6597d5f0f6023c067f7b1c2d7709b604b +Author: Jordan Crouse +Date: Thu Dec 14 17:26:59 2006 -0700 + + PATCH: Automatically probe to see if VGA exists + +commit a38f40687c00f35d2e6529c3cfb894ee29cdea66 +Author: Jordan Crouse +Date: Wed Dec 13 16:03:36 2006 -0700 + + Clean up whitespace and other code style issues + +commit edd326cc9ba5b9f46ca7a4516806a5b7fd3605f0 +Author: Jordan Crouse +Date: Tue Dec 12 17:31:48 2006 -0700 + + First attempt at adding dynamic rotation (just RandR 1.1 for now) + +commit 98aad0c298e59b6336e9219cc37294644d2d9e95 +Author: Jordan Crouse +Date: Thu Nov 9 15:31:07 2006 -0700 + + PATCH: Add special support for the OLPC DCON + +commit e18f0a7efe7bbc7655a9fdcd3b74ec8c799a86a2 +Author: Jordan Crouse +Date: Wed Nov 8 16:41:44 2006 -0700 + + PATCH: More gamma fixes + + Be smarter about how gamma is saved and restored by checking the bits. + +commit 881c2aac50af3265d98daa4be5ccf49cabe2f5d6 +Author: Jordan Crouse +Date: Wed Nov 8 11:24:26 2006 -0700 + + PATCH: Avoid incorrectly killing the gamma RAM when the driver starts up + + The Xv driver requires color adjustment by programming the gamma LUT. The + driver was incorectly programming the LUT at startup, which is damaging + for any previous applications that may have graphics gamma information in + the LUT. Change only applies the video adjustment when video is enabled. + +commit 57921b0fffbd1a4bf36dbef69badb9b71918a3b8 +Author: Jordan Crouse +Date: Mon Oct 16 16:54:15 2006 -0600 + + Fixed stupid buglet that I introduced + +commit 1c2fdaa4bc0df076f2d15184cfba74b2df82c6e4 +Author: Jordan Crouse +Date: Mon Oct 16 16:27:01 2006 -0600 + + Missed a place where I needed to clear the EXA memory + +commit 8d9986ffa3d678469901d595c80770696bd866d8 +Author: Jordan Crouse +Date: Wed Oct 11 17:42:30 2006 -0600 + + Xv needs to understand how to allocate offscreen code from EXA too + + When EXA is enabled, it takes enough of the offscreen memory for itself, + so that Xv cannot query memory with xf86AllocateOffscreen. + +commit 2979196dae5615f2a78ace891d4ad6dd98c8fe6e +Author: Jordan Crouse +Date: Thu Sep 28 09:09:27 2006 -0600 + + Update for 7.2 - fix config.h and other include problems. + + This closes bug 8290 by applying the patch from Andres Salomon. + +commit 45eeb43888e92e2736d9b678ce6d67fb99449800 +Author: Jordan Crouse +Date: Mon Aug 21 11:24:42 2006 -0600 + + PATCH: Clean ups some of the log messages + + Remove the useless DDC probe message and only warn when MSR reads don't + work. + +commit 1665bf4ae01b88bd2d981ebacc306568715ee927 +Author: Jordan Crouse +Date: Mon Aug 21 11:24:41 2006 -0600 + + PATCH: Move the check for EXA version + + The check for the EXA version occurs before the EXA_VERSION is defined. + This results in EXA being permanently turned off. This makes sure exa.h + is defined before checking the version. + +commit 38f3d21beba13daba4844a129f3c268b5f291fb1 +Author: Jordan Crouse +Date: Tue Aug 15 13:14:01 2006 -0600 + + PATCH: When compression is off, adjust the pitch to be linear, saving memory + +commit 9d8d08c6a7449faf9c52d728eeb5793180eaf98e +Author: Jordan Crouse +Date: Mon Aug 7 17:46:56 2006 -0600 + + PATCH: Fixup Xv + + Xv was still stuck in the 6.8.1 days. + +commit 4a29b63925ea8ffa4e220925dd8aca280fd887a7 +Author: Jordan Crouse +Date: Fri Aug 4 14:23:52 2006 -0600 + + PATCH: Add specific support for the OLPC dcon panel + + The OLPC dcon panel operates differently then the other panels in the + GX universe. + +commit 7a49bf6205d77a22b07c785f2cb589abd8671667 +Author: Jordan Crouse +Date: Fri Aug 4 14:23:40 2006 -0600 + + PATCH: Remove the build files that shouldn't be in the repository + +commit d67ec33ef47086469446f0bd692ec15581124424 +Author: Zephaniah E. Hull +Date: Thu Aug 3 10:41:41 2006 -0400 + + Make EXA support on EXA_VERSION_MAJOR >= 2. + + Catch the two places where we tried to use EXA stuff when it wasn't available. + +commit 3718e9e2639d0f6313c3ec9ab32d277d2224f8cf +Author: Jordan Crouse +Date: Fri Jul 7 17:18:06 2006 -0600 + + PATCH: Fix some VGA issues + + Fix some issues from the recent NoVGA refactoring + +commit 726d46c8da96b2a0168b39d36be32467d54a9de3 +Author: Jordan Crouse +Date: Fri Jul 7 13:05:19 2006 -0600 + + Update with cleanup and other fixes + + Final commit of cleanup fixes prior to pushing + +commit c3ab9f1a60afe1f5e86db1cf2635acda14fae2f5 +Author: Jordan Crouse +Date: Thu Jul 6 14:56:42 2006 -0600 + + Initial commit of the xf86-video-amd tree diff --git a/driver/xf86-video-geode/Makefile.am b/driver/xf86-video-geode/Makefile.am new file mode 100644 index 000000000..e5d6028cd --- /dev/null +++ b/driver/xf86-video-geode/Makefile.am @@ -0,0 +1,33 @@ +# Copyright 2005 Adam Jackson. +# +# Permission is hereby granted, free of charge, to any person obtaining a +# copy of this software and associated documentation files (the "Software"), +# to deal in the Software without restriction, including without limitation +# on the rights to use, copy, modify, merge, publish, distribute, sub +# license, and/or sell copies of the Software, and to permit persons to whom +# the Software is furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice (including the next +# paragraph) shall be included in all copies or substantial portions of the +# Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL +# ADAM JACKSON BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +# IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +AUTOMAKE_OPTIONS = foreign +SUBDIRS = src + +EXTRA_DIST = autogen.sh ChangeLog + +MAINTAINERCLEANFILES = ChangeLog + +.PHONY: ChangeLog + +ChangeLog: + (GIT_DIR=$(top_srcdir)/.git git-log > .changelog.tmp && mv .changelog.tmp ChangeLog; rm -f .changelog.tmp) || (touch ChangeLog; echo 'git directory not found: installing possibly empty changelog.' >&2) + +dist-hook: ChangeLog diff --git a/driver/xf86-video-geode/Makefile.in b/driver/xf86-video-geode/Makefile.in new file mode 100644 index 000000000..71da41ab4 --- /dev/null +++ b/driver/xf86-video-geode/Makefile.in @@ -0,0 +1,683 @@ +# Makefile.in generated by automake 1.10 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +# Copyright 2005 Adam Jackson. +# +# Permission is hereby granted, free of charge, to any person obtaining a +# copy of this software and associated documentation files (the "Software"), +# to deal in the Software without restriction, including without limitation +# on the rights to use, copy, modify, merge, publish, distribute, sub +# license, and/or sell copies of the Software, and to permit persons to whom +# the Software is furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice (including the next +# paragraph) shall be included in all copies or substantial portions of the +# Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL +# ADAM JACKSON BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +# IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +subdir = . +DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \ + $(srcdir)/Makefile.in $(srcdir)/config.h.in \ + $(top_srcdir)/configure COPYING ChangeLog TODO config.guess \ + config.sub depcomp install-sh ltmain.sh missing +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ + configure.lineno config.status.lineno +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = config.h +CONFIG_CLEAN_FILES = +SOURCES = +DIST_SOURCES = +RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ + html-recursive info-recursive install-data-recursive \ + install-dvi-recursive install-exec-recursive \ + install-html-recursive install-info-recursive \ + install-pdf-recursive install-ps-recursive install-recursive \ + installcheck-recursive installdirs-recursive pdf-recursive \ + ps-recursive uninstall-recursive +RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ + distclean-recursive maintainer-clean-recursive +ETAGS = etags +CTAGS = ctags +DIST_SUBDIRS = $(SUBDIRS) +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +distdir = $(PACKAGE)-$(VERSION) +top_distdir = $(distdir) +am__remove_distdir = \ + { test ! -d $(distdir) \ + || { find $(distdir) -type d ! -perm -200 -exec chmod u+w {} ';' \ + && rm -fr $(distdir); }; } +DIST_ARCHIVES = $(distdir).tar.gz $(distdir).tar.bz2 +GZIP_ENV = --best +distuninstallcheck_listfiles = find . -type f -print +distcleancheck_listfiles = find . -type f -print +ACLOCAL = @ACLOCAL@ +ADMIN_MAN_DIR = @ADMIN_MAN_DIR@ +ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@ +AMD_CFLAGS = @AMD_CFLAGS@ +AMTAR = @AMTAR@ +APP_MAN_DIR = @APP_MAN_DIR@ +APP_MAN_SUFFIX = @APP_MAN_SUFFIX@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCAS = @CCAS@ +CCASDEPMODE = @CCASDEPMODE@ +CCASFLAGS = @CCASFLAGS@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DRIVER_MAN_DIR = @DRIVER_MAN_DIR@ +DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@ +DRIVER_NAME = @DRIVER_NAME@ +ECHO = @ECHO@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +F77 = @F77@ +FFLAGS = @FFLAGS@ +FILE_MAN_DIR = @FILE_MAN_DIR@ +FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ +GREP = @GREP@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LDFLAGS = @LDFLAGS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIB_MAN_DIR = @LIB_MAN_DIR@ +LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +MISC_MAN_DIR = @MISC_MAN_DIR@ +MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@ +MKDIR_P = @MKDIR_P@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PCIACCESS_CFLAGS = @PCIACCESS_CFLAGS@ +PCIACCESS_LIBS = @PCIACCESS_LIBS@ +PKG_CONFIG = @PKG_CONFIG@ +RANLIB = @RANLIB@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +VERSION = @VERSION@ +XORG_CFLAGS = @XORG_CFLAGS@ +XORG_LIBS = @XORG_LIBS@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_F77 = @ac_ct_F77@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +moduledir = @moduledir@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +AUTOMAKE_OPTIONS = foreign +SUBDIRS = src +EXTRA_DIST = autogen.sh ChangeLog +MAINTAINERCLEANFILES = ChangeLog +all: config.h + $(MAKE) $(AM_MAKEFLAGS) all-recursive + +.SUFFIXES: +am--refresh: + @: +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + echo ' cd $(srcdir) && $(AUTOMAKE) --foreign '; \ + cd $(srcdir) && $(AUTOMAKE) --foreign \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --foreign Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + echo ' $(SHELL) ./config.status'; \ + $(SHELL) ./config.status;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + $(SHELL) ./config.status --recheck + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(srcdir) && $(AUTOCONF) +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) + +config.h: stamp-h1 + @if test ! -f $@; then \ + rm -f stamp-h1; \ + $(MAKE) $(AM_MAKEFLAGS) stamp-h1; \ + else :; fi + +stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status + @rm -f stamp-h1 + cd $(top_builddir) && $(SHELL) ./config.status config.h +$(srcdir)/config.h.in: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_srcdir) && $(AUTOHEADER) + rm -f stamp-h1 + touch $@ + +distclean-hdr: + -rm -f config.h stamp-h1 + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +distclean-libtool: + -rm -f libtool + +# This directory's subdirectories are mostly independent; you can cd +# into them and run `make' without going through this Makefile. +# To change the values of `make' variables: instead of editing Makefiles, +# (1) if the variable is set in `config.status', edit `config.status' +# (which will cause the Makefiles to be regenerated when you run `make'); +# (2) otherwise, pass the desired values on the `make' command line. +$(RECURSIVE_TARGETS): + @failcom='exit 1'; \ + for f in x $$MAKEFLAGS; do \ + case $$f in \ + *=* | --[!k]*);; \ + *k*) failcom='fail=yes';; \ + esac; \ + done; \ + dot_seen=no; \ + target=`echo $@ | sed s/-recursive//`; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + dot_seen=yes; \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done; \ + if test "$$dot_seen" = "no"; then \ + $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ + fi; test -z "$$fail" + +$(RECURSIVE_CLEAN_TARGETS): + @failcom='exit 1'; \ + for f in x $$MAKEFLAGS; do \ + case $$f in \ + *=* | --[!k]*);; \ + *k*) failcom='fail=yes';; \ + esac; \ + done; \ + dot_seen=no; \ + case "$@" in \ + distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ + *) list='$(SUBDIRS)' ;; \ + esac; \ + rev=''; for subdir in $$list; do \ + if test "$$subdir" = "."; then :; else \ + rev="$$subdir $$rev"; \ + fi; \ + done; \ + rev="$$rev ."; \ + target=`echo $@ | sed s/-recursive//`; \ + for subdir in $$rev; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done && test -z "$$fail" +tags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ + done +ctags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ + done + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: tags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ + include_option=--etags-include; \ + empty_fix=.; \ + else \ + include_option=--include; \ + empty_fix=; \ + fi; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test ! -f $$subdir/TAGS || \ + tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \ + fi; \ + done; \ + list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique; \ + fi +ctags: CTAGS +CTAGS: ctags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + $(am__remove_distdir) + test -d $(distdir) || mkdir $(distdir) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done + list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test -d "$(distdir)/$$subdir" \ + || $(MKDIR_P) "$(distdir)/$$subdir" \ + || exit 1; \ + distdir=`$(am__cd) $(distdir) && pwd`; \ + top_distdir=`$(am__cd) $(top_distdir) && pwd`; \ + (cd $$subdir && \ + $(MAKE) $(AM_MAKEFLAGS) \ + top_distdir="$$top_distdir" \ + distdir="$$distdir/$$subdir" \ + am__remove_distdir=: \ + am__skip_length_check=: \ + distdir) \ + || exit 1; \ + fi; \ + done + $(MAKE) $(AM_MAKEFLAGS) \ + top_distdir="$(top_distdir)" distdir="$(distdir)" \ + dist-hook + -find $(distdir) -type d ! -perm -777 -exec chmod a+rwx {} \; -o \ + ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \ + ! -type d ! -perm -400 -exec chmod a+r {} \; -o \ + ! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \ + || chmod -R a+r $(distdir) +dist-gzip: distdir + tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz + $(am__remove_distdir) +dist-bzip2: distdir + tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2 + $(am__remove_distdir) + +dist-tarZ: distdir + tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z + $(am__remove_distdir) + +dist-shar: distdir + shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz + $(am__remove_distdir) + +dist-zip: distdir + -rm -f $(distdir).zip + zip -rq $(distdir).zip $(distdir) + $(am__remove_distdir) + +dist dist-all: distdir + tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz + tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2 + $(am__remove_distdir) + +# This target untars the dist file and tries a VPATH configuration. Then +# it guarantees that the distribution is self-contained by making another +# tarfile. +distcheck: dist + case '$(DIST_ARCHIVES)' in \ + *.tar.gz*) \ + GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(am__untar) ;;\ + *.tar.bz2*) \ + bunzip2 -c $(distdir).tar.bz2 | $(am__untar) ;;\ + *.tar.Z*) \ + uncompress -c $(distdir).tar.Z | $(am__untar) ;;\ + *.shar.gz*) \ + GZIP=$(GZIP_ENV) gunzip -c $(distdir).shar.gz | unshar ;;\ + *.zip*) \ + unzip $(distdir).zip ;;\ + esac + chmod -R a-w $(distdir); chmod a+w $(distdir) + mkdir $(distdir)/_build + mkdir $(distdir)/_inst + chmod a-w $(distdir) + dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \ + && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \ + && cd $(distdir)/_build \ + && ../configure --srcdir=.. --prefix="$$dc_install_base" \ + $(DISTCHECK_CONFIGURE_FLAGS) \ + && $(MAKE) $(AM_MAKEFLAGS) \ + && $(MAKE) $(AM_MAKEFLAGS) dvi \ + && $(MAKE) $(AM_MAKEFLAGS) check \ + && $(MAKE) $(AM_MAKEFLAGS) install \ + && $(MAKE) $(AM_MAKEFLAGS) installcheck \ + && $(MAKE) $(AM_MAKEFLAGS) uninstall \ + && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \ + distuninstallcheck \ + && chmod -R a-w "$$dc_install_base" \ + && ({ \ + (cd ../.. && umask 077 && mkdir "$$dc_destdir") \ + && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \ + && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \ + && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \ + distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \ + } || { rm -rf "$$dc_destdir"; exit 1; }) \ + && rm -rf "$$dc_destdir" \ + && $(MAKE) $(AM_MAKEFLAGS) dist \ + && rm -rf $(DIST_ARCHIVES) \ + && $(MAKE) $(AM_MAKEFLAGS) distcleancheck + $(am__remove_distdir) + @(echo "$(distdir) archives ready for distribution: "; \ + list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \ + sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x' +distuninstallcheck: + @cd $(distuninstallcheck_dir) \ + && test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \ + || { echo "ERROR: files left after uninstall:" ; \ + if test -n "$(DESTDIR)"; then \ + echo " (check DESTDIR support)"; \ + fi ; \ + $(distuninstallcheck_listfiles) ; \ + exit 1; } >&2 +distcleancheck: distclean + @if test '$(srcdir)' = . ; then \ + echo "ERROR: distcleancheck can only run from a VPATH build" ; \ + exit 1 ; \ + fi + @test `$(distcleancheck_listfiles) | wc -l` -eq 0 \ + || { echo "ERROR: files left in build directory after distclean:" ; \ + $(distcleancheck_listfiles) ; \ + exit 1; } >&2 +check-am: all-am +check: check-recursive +all-am: Makefile config.h +installdirs: installdirs-recursive +installdirs-am: +install: install-recursive +install-exec: install-exec-recursive +install-data: install-data-recursive +uninstall: uninstall-recursive + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-recursive +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." + -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) +clean: clean-recursive + +clean-am: clean-generic clean-libtool mostlyclean-am + +distclean: distclean-recursive + -rm -f $(am__CONFIG_DISTCLEAN_FILES) + -rm -f Makefile +distclean-am: clean-am distclean-generic distclean-hdr \ + distclean-libtool distclean-tags + +dvi: dvi-recursive + +dvi-am: + +html: html-recursive + +info: info-recursive + +info-am: + +install-data-am: + +install-dvi: install-dvi-recursive + +install-exec-am: + +install-html: install-html-recursive + +install-info: install-info-recursive + +install-man: + +install-pdf: install-pdf-recursive + +install-ps: install-ps-recursive + +installcheck-am: + +maintainer-clean: maintainer-clean-recursive + -rm -f $(am__CONFIG_DISTCLEAN_FILES) + -rm -rf $(top_srcdir)/autom4te.cache + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-recursive + +mostlyclean-am: mostlyclean-generic mostlyclean-libtool + +pdf: pdf-recursive + +pdf-am: + +ps: ps-recursive + +ps-am: + +uninstall-am: + +.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) install-am \ + install-strip + +.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \ + all all-am am--refresh check check-am clean clean-generic \ + clean-libtool ctags ctags-recursive dist dist-all dist-bzip2 \ + dist-gzip dist-hook dist-shar dist-tarZ dist-zip distcheck \ + distclean distclean-generic distclean-hdr distclean-libtool \ + distclean-tags distcleancheck distdir distuninstallcheck dvi \ + dvi-am html html-am info info-am install install-am \ + install-data install-data-am install-dvi install-dvi-am \ + install-exec install-exec-am install-html install-html-am \ + install-info install-info-am install-man install-pdf \ + install-pdf-am install-ps install-ps-am install-strip \ + installcheck installcheck-am installdirs installdirs-am \ + maintainer-clean maintainer-clean-generic mostlyclean \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + tags tags-recursive uninstall uninstall-am + + +.PHONY: ChangeLog + +ChangeLog: + (GIT_DIR=$(top_srcdir)/.git git-log > .changelog.tmp && mv .changelog.tmp ChangeLog; rm -f .changelog.tmp) || (touch ChangeLog; echo 'git directory not found: installing possibly empty changelog.' >&2) + +dist-hook: ChangeLog +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/driver/xf86-video-geode/README b/driver/xf86-video-geode/README new file mode 100644 index 000000000..31ab8cb5a --- /dev/null +++ b/driver/xf86-video-geode/README @@ -0,0 +1,51 @@ +AMD Geode GX and LX Xorg graphics Driver +May 9, 2007 +======================================== + += Introduction = + +This is the X graphics driver for the AMD Geode GX and LX processors. +The GX driver features XAA and EXA support for graphics acceleration, +and the LX driver supports EXA (including compositing). Both drivers +suppport dynamic rotation with XRandR, and Xv overlay support. + += Configuration options = + +You can specify the Geode driver in the normal fashion: + +Section "Device" + Identifier "AMD Geode" + Driver "geode" + Option "blah" "blah" + ... +EndSection + +The following options may be added to the section: + +== GX == + +SWCursor: Enable software cursors (essentially disabling HW cursor support) +NoCompression: Disable video bandwidth compression +NoAccel: Disable hardware assisted acceleration +AccelMethod: "EXA" (default) or "XAA" +Rotate: Select a orientation to start with - LEFT, INVERT, CCW +NoPanel: Disable panel support +OSMImageBuffers: Set the number of image buffers (XAA only) +OSMColorExpBuffers: Set the number of color expansion buffers (XAA only) +FBSize: Specify the size of the video space (in bytes) +PanelGeometry: Specify the geometry of the attached panel ("x") + +== LX == + +SWCursor: Enable software cursors (essentially disabling HW cursor support) +NoCompression: Disable video bandwidth compression +NoAccel: Disable hardware assisted acceleration +Rotate: Select a orientation to start with - LEFT, INVERT, CCW +NoPanel: Disable panel support +ExaScratch: Specify the amount of extra EXA scratch buffer (in bytes) +FBSize: Specify the size of the video space (in bytes) +PanelGeometry: Specify the geometry of the attached panel ("x") + + + + diff --git a/driver/xf86-video-geode/TODO b/driver/xf86-video-geode/TODO new file mode 100644 index 000000000..534aafc29 --- /dev/null +++ b/driver/xf86-video-geode/TODO @@ -0,0 +1,19 @@ +General: + +* Add automagic probing of the fb driver (for memory size) +* Write the man page + +GX: + +* Fix the options so they are sane (i.e eliminate one of SWCursor or HWCursor) +* TV support +* Fix the rotate text strings (CCW?) +* Whitespace / indenting +* Don't crash when rotating when playing video + +LX: + +* Fix the options so they are sane +* TV support (VOP) +* Rotated video +* ARGB cursor diff --git a/driver/xf86-video-geode/aclocal.m4 b/driver/xf86-video-geode/aclocal.m4 new file mode 100644 index 000000000..81cde0ac5 --- /dev/null +++ b/driver/xf86-video-geode/aclocal.m4 @@ -0,0 +1,8197 @@ +# generated automatically by aclocal 1.10 -*- Autoconf -*- + +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, +# 2005, 2006 Free Software Foundation, Inc. +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +m4_if(m4_PACKAGE_VERSION, [2.61],, +[m4_fatal([this file was generated for autoconf 2.61. +You have another version of autoconf. If you want to use that, +you should regenerate the build system entirely.], [63])]) + +# libtool.m4 - Configure libtool for the host system. -*-Autoconf-*- + +# serial 51 Debian 1.5.24-1ubuntu1 AC_PROG_LIBTOOL + + +# AC_PROVIDE_IFELSE(MACRO-NAME, IF-PROVIDED, IF-NOT-PROVIDED) +# ----------------------------------------------------------- +# If this macro is not defined by Autoconf, define it here. +m4_ifdef([AC_PROVIDE_IFELSE], + [], + [m4_define([AC_PROVIDE_IFELSE], + [m4_ifdef([AC_PROVIDE_$1], + [$2], [$3])])]) + + +# AC_PROG_LIBTOOL +# --------------- +AC_DEFUN([AC_PROG_LIBTOOL], +[AC_REQUIRE([_AC_PROG_LIBTOOL])dnl +dnl If AC_PROG_CXX has already been expanded, run AC_LIBTOOL_CXX +dnl immediately, otherwise, hook it in at the end of AC_PROG_CXX. + AC_PROVIDE_IFELSE([AC_PROG_CXX], + [AC_LIBTOOL_CXX], + [define([AC_PROG_CXX], defn([AC_PROG_CXX])[AC_LIBTOOL_CXX + ])]) +dnl And a similar setup for Fortran 77 support + AC_PROVIDE_IFELSE([AC_PROG_F77], + [AC_LIBTOOL_F77], + [define([AC_PROG_F77], defn([AC_PROG_F77])[AC_LIBTOOL_F77 +])]) + +dnl Quote A][M_PROG_GCJ so that aclocal doesn't bring it in needlessly. +dnl If either AC_PROG_GCJ or A][M_PROG_GCJ have already been expanded, run +dnl AC_LIBTOOL_GCJ immediately, otherwise, hook it in at the end of both. + AC_PROVIDE_IFELSE([AC_PROG_GCJ], + [AC_LIBTOOL_GCJ], + [AC_PROVIDE_IFELSE([A][M_PROG_GCJ], + [AC_LIBTOOL_GCJ], + [AC_PROVIDE_IFELSE([LT_AC_PROG_GCJ], + [AC_LIBTOOL_GCJ], + [ifdef([AC_PROG_GCJ], + [define([AC_PROG_GCJ], defn([AC_PROG_GCJ])[AC_LIBTOOL_GCJ])]) + ifdef([A][M_PROG_GCJ], + [define([A][M_PROG_GCJ], defn([A][M_PROG_GCJ])[AC_LIBTOOL_GCJ])]) + ifdef([LT_AC_PROG_GCJ], + [define([LT_AC_PROG_GCJ], + defn([LT_AC_PROG_GCJ])[AC_LIBTOOL_GCJ])])])]) +])])# AC_PROG_LIBTOOL + + +# _AC_PROG_LIBTOOL +# ---------------- +AC_DEFUN([_AC_PROG_LIBTOOL], +[AC_REQUIRE([AC_LIBTOOL_SETUP])dnl +AC_BEFORE([$0],[AC_LIBTOOL_CXX])dnl +AC_BEFORE([$0],[AC_LIBTOOL_F77])dnl +AC_BEFORE([$0],[AC_LIBTOOL_GCJ])dnl + +# This can be used to rebuild libtool when needed +LIBTOOL_DEPS="$ac_aux_dir/ltmain.sh" + +# Always use our own libtool. +LIBTOOL='$(SHELL) $(top_builddir)/libtool' +AC_SUBST(LIBTOOL)dnl + +# Prevent multiple expansion +define([AC_PROG_LIBTOOL], []) +])# _AC_PROG_LIBTOOL + + +# AC_LIBTOOL_SETUP +# ---------------- +AC_DEFUN([AC_LIBTOOL_SETUP], +[AC_PREREQ(2.50)dnl +AC_REQUIRE([AC_ENABLE_SHARED])dnl +AC_REQUIRE([AC_ENABLE_STATIC])dnl +AC_REQUIRE([AC_ENABLE_FAST_INSTALL])dnl +AC_REQUIRE([AC_CANONICAL_HOST])dnl +AC_REQUIRE([AC_CANONICAL_BUILD])dnl +AC_REQUIRE([AC_PROG_CC])dnl +AC_REQUIRE([AC_PROG_LD])dnl +AC_REQUIRE([AC_PROG_LD_RELOAD_FLAG])dnl +AC_REQUIRE([AC_PROG_NM])dnl + +AC_REQUIRE([AC_PROG_LN_S])dnl +AC_REQUIRE([AC_DEPLIBS_CHECK_METHOD])dnl +# Autoconf 2.13's AC_OBJEXT and AC_EXEEXT macros only works for C compilers! +AC_REQUIRE([AC_OBJEXT])dnl +AC_REQUIRE([AC_EXEEXT])dnl +dnl + +AC_LIBTOOL_SYS_MAX_CMD_LEN +AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE +AC_LIBTOOL_OBJDIR + +AC_REQUIRE([_LT_AC_SYS_COMPILER])dnl +_LT_AC_PROG_ECHO_BACKSLASH + +case $host_os in +aix3*) + # AIX sometimes has problems with the GCC collect2 program. For some + # reason, if we set the COLLECT_NAMES environment variable, the problems + # vanish in a puff of smoke. + if test "X${COLLECT_NAMES+set}" != Xset; then + COLLECT_NAMES= + export COLLECT_NAMES + fi + ;; +esac + +# Sed substitution that helps us do robust quoting. It backslashifies +# metacharacters that are still active within double-quoted strings. +Xsed='sed -e 1s/^X//' +[sed_quote_subst='s/\([\\"\\`$\\\\]\)/\\\1/g'] + +# Same as above, but do not quote variable references. +[double_quote_subst='s/\([\\"\\`\\\\]\)/\\\1/g'] + +# Sed substitution to delay expansion of an escaped shell variable in a +# double_quote_subst'ed string. +delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' + +# Sed substitution to avoid accidental globbing in evaled expressions +no_glob_subst='s/\*/\\\*/g' + +# Constants: +rm="rm -f" + +# Global variables: +default_ofile=libtool +can_build_shared=yes + +# All known linkers require a `.a' archive for static linking (except MSVC, +# which needs '.lib'). +libext=a +ltmain="$ac_aux_dir/ltmain.sh" +ofile="$default_ofile" +with_gnu_ld="$lt_cv_prog_gnu_ld" + +AC_CHECK_TOOL(AR, ar, false) +AC_CHECK_TOOL(RANLIB, ranlib, :) +AC_CHECK_TOOL(STRIP, strip, :) + +old_CC="$CC" +old_CFLAGS="$CFLAGS" + +# Set sane defaults for various variables +test -z "$AR" && AR=ar +test -z "$AR_FLAGS" && AR_FLAGS=cru +test -z "$AS" && AS=as +test -z "$CC" && CC=cc +test -z "$LTCC" && LTCC=$CC +test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS +test -z "$DLLTOOL" && DLLTOOL=dlltool +test -z "$LD" && LD=ld +test -z "$LN_S" && LN_S="ln -s" +test -z "$MAGIC_CMD" && MAGIC_CMD=file +test -z "$NM" && NM=nm +test -z "$SED" && SED=sed +test -z "$OBJDUMP" && OBJDUMP=objdump +test -z "$RANLIB" && RANLIB=: +test -z "$STRIP" && STRIP=: +test -z "$ac_objext" && ac_objext=o + +# Determine commands to create old-style static archives. +old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs' +old_postinstall_cmds='chmod 644 $oldlib' +old_postuninstall_cmds= + +if test -n "$RANLIB"; then + case $host_os in + openbsd*) + old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$oldlib" + ;; + *) + old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$oldlib" + ;; + esac + old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib" +fi + +_LT_CC_BASENAME([$compiler]) + +# Only perform the check for file, if the check method requires it +case $deplibs_check_method in +file_magic*) + if test "$file_magic_cmd" = '$MAGIC_CMD'; then + AC_PATH_MAGIC + fi + ;; +esac + +AC_PROVIDE_IFELSE([AC_LIBTOOL_DLOPEN], enable_dlopen=yes, enable_dlopen=no) +AC_PROVIDE_IFELSE([AC_LIBTOOL_WIN32_DLL], +enable_win32_dll=yes, enable_win32_dll=no) + +AC_ARG_ENABLE([libtool-lock], + [AC_HELP_STRING([--disable-libtool-lock], + [avoid locking (might break parallel builds)])]) +test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes + +AC_ARG_WITH([pic], + [AC_HELP_STRING([--with-pic], + [try to use only PIC/non-PIC objects @<:@default=use both@:>@])], + [pic_mode="$withval"], + [pic_mode=default]) +test -z "$pic_mode" && pic_mode=default + +# Use C for the default configuration in the libtool script +tagname= +AC_LIBTOOL_LANG_C_CONFIG +_LT_AC_TAGCONFIG +])# AC_LIBTOOL_SETUP + + +# _LT_AC_SYS_COMPILER +# ------------------- +AC_DEFUN([_LT_AC_SYS_COMPILER], +[AC_REQUIRE([AC_PROG_CC])dnl + +# If no C compiler was specified, use CC. +LTCC=${LTCC-"$CC"} + +# If no C compiler flags were specified, use CFLAGS. +LTCFLAGS=${LTCFLAGS-"$CFLAGS"} + +# Allow CC to be a program name with arguments. +compiler=$CC +])# _LT_AC_SYS_COMPILER + + +# _LT_CC_BASENAME(CC) +# ------------------- +# Calculate cc_basename. Skip known compiler wrappers and cross-prefix. +AC_DEFUN([_LT_CC_BASENAME], +[for cc_temp in $1""; do + case $cc_temp in + compile | *[[\\/]]compile | ccache | *[[\\/]]ccache ) ;; + distcc | *[[\\/]]distcc | purify | *[[\\/]]purify ) ;; + \-*) ;; + *) break;; + esac +done +cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` +]) + + +# _LT_COMPILER_BOILERPLATE +# ------------------------ +# Check for compiler boilerplate output or warnings with +# the simple compiler test code. +AC_DEFUN([_LT_COMPILER_BOILERPLATE], +[AC_REQUIRE([LT_AC_PROG_SED])dnl +ac_outfile=conftest.$ac_objext +echo "$lt_simple_compile_test_code" >conftest.$ac_ext +eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err +_lt_compiler_boilerplate=`cat conftest.err` +$rm conftest* +])# _LT_COMPILER_BOILERPLATE + + +# _LT_LINKER_BOILERPLATE +# ---------------------- +# Check for linker boilerplate output or warnings with +# the simple link test code. +AC_DEFUN([_LT_LINKER_BOILERPLATE], +[AC_REQUIRE([LT_AC_PROG_SED])dnl +ac_outfile=conftest.$ac_objext +echo "$lt_simple_link_test_code" >conftest.$ac_ext +eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err +_lt_linker_boilerplate=`cat conftest.err` +$rm conftest* +])# _LT_LINKER_BOILERPLATE + + +# _LT_AC_SYS_LIBPATH_AIX +# ---------------------- +# Links a minimal program and checks the executable +# for the system default hardcoded library path. In most cases, +# this is /usr/lib:/lib, but when the MPI compilers are used +# the location of the communication and MPI libs are included too. +# If we don't find anything, use the default library path according +# to the aix ld manual. +AC_DEFUN([_LT_AC_SYS_LIBPATH_AIX], +[AC_REQUIRE([LT_AC_PROG_SED])dnl +AC_LINK_IFELSE(AC_LANG_PROGRAM,[ +lt_aix_libpath_sed=' + /Import File Strings/,/^$/ { + /^0/ { + s/^0 *\(.*\)$/\1/ + p + } + }' +aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` +# Check for a 64-bit object if we didn't find anything. +if test -z "$aix_libpath"; then + aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` +fi],[]) +if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi +])# _LT_AC_SYS_LIBPATH_AIX + + +# _LT_AC_SHELL_INIT(ARG) +# ---------------------- +AC_DEFUN([_LT_AC_SHELL_INIT], +[ifdef([AC_DIVERSION_NOTICE], + [AC_DIVERT_PUSH(AC_DIVERSION_NOTICE)], + [AC_DIVERT_PUSH(NOTICE)]) +$1 +AC_DIVERT_POP +])# _LT_AC_SHELL_INIT + + +# _LT_AC_PROG_ECHO_BACKSLASH +# -------------------------- +# Add some code to the start of the generated configure script which +# will find an echo command which doesn't interpret backslashes. +AC_DEFUN([_LT_AC_PROG_ECHO_BACKSLASH], +[_LT_AC_SHELL_INIT([ +# Check that we are running under the correct shell. +SHELL=${CONFIG_SHELL-/bin/sh} + +case X$ECHO in +X*--fallback-echo) + # Remove one level of quotation (which was required for Make). + ECHO=`echo "$ECHO" | sed 's,\\\\\[$]\\[$]0,'[$]0','` + ;; +esac + +echo=${ECHO-echo} +if test "X[$]1" = X--no-reexec; then + # Discard the --no-reexec flag, and continue. + shift +elif test "X[$]1" = X--fallback-echo; then + # Avoid inline document here, it may be left over + : +elif test "X`($echo '\t') 2>/dev/null`" = 'X\t' ; then + # Yippee, $echo works! + : +else + # Restart under the correct shell. + exec $SHELL "[$]0" --no-reexec ${1+"[$]@"} +fi + +if test "X[$]1" = X--fallback-echo; then + # used as fallback echo + shift + cat </dev/null 2>&1 && unset CDPATH + +if test -z "$ECHO"; then +if test "X${echo_test_string+set}" != Xset; then +# find a string as large as possible, as long as the shell can cope with it + for cmd in 'sed 50q "[$]0"' 'sed 20q "[$]0"' 'sed 10q "[$]0"' 'sed 2q "[$]0"' 'echo test'; do + # expected sizes: less than 2Kb, 1Kb, 512 bytes, 16 bytes, ... + if (echo_test_string=`eval $cmd`) 2>/dev/null && + echo_test_string=`eval $cmd` && + (test "X$echo_test_string" = "X$echo_test_string") 2>/dev/null + then + break + fi + done +fi + +if test "X`($echo '\t') 2>/dev/null`" = 'X\t' && + echo_testing_string=`($echo "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + : +else + # The Solaris, AIX, and Digital Unix default echo programs unquote + # backslashes. This makes it impossible to quote backslashes using + # echo "$something" | sed 's/\\/\\\\/g' + # + # So, first we look for a working echo in the user's PATH. + + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + for dir in $PATH /usr/ucb; do + IFS="$lt_save_ifs" + if (test -f $dir/echo || test -f $dir/echo$ac_exeext) && + test "X`($dir/echo '\t') 2>/dev/null`" = 'X\t' && + echo_testing_string=`($dir/echo "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + echo="$dir/echo" + break + fi + done + IFS="$lt_save_ifs" + + if test "X$echo" = Xecho; then + # We didn't find a better echo, so look for alternatives. + if test "X`(print -r '\t') 2>/dev/null`" = 'X\t' && + echo_testing_string=`(print -r "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + # This shell has a builtin print -r that does the trick. + echo='print -r' + elif (test -f /bin/ksh || test -f /bin/ksh$ac_exeext) && + test "X$CONFIG_SHELL" != X/bin/ksh; then + # If we have ksh, try running configure again with it. + ORIGINAL_CONFIG_SHELL=${CONFIG_SHELL-/bin/sh} + export ORIGINAL_CONFIG_SHELL + CONFIG_SHELL=/bin/ksh + export CONFIG_SHELL + exec $CONFIG_SHELL "[$]0" --no-reexec ${1+"[$]@"} + else + # Try using printf. + echo='printf %s\n' + if test "X`($echo '\t') 2>/dev/null`" = 'X\t' && + echo_testing_string=`($echo "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + # Cool, printf works + : + elif echo_testing_string=`($ORIGINAL_CONFIG_SHELL "[$]0" --fallback-echo '\t') 2>/dev/null` && + test "X$echo_testing_string" = 'X\t' && + echo_testing_string=`($ORIGINAL_CONFIG_SHELL "[$]0" --fallback-echo "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + CONFIG_SHELL=$ORIGINAL_CONFIG_SHELL + export CONFIG_SHELL + SHELL="$CONFIG_SHELL" + export SHELL + echo="$CONFIG_SHELL [$]0 --fallback-echo" + elif echo_testing_string=`($CONFIG_SHELL "[$]0" --fallback-echo '\t') 2>/dev/null` && + test "X$echo_testing_string" = 'X\t' && + echo_testing_string=`($CONFIG_SHELL "[$]0" --fallback-echo "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + echo="$CONFIG_SHELL [$]0 --fallback-echo" + else + # maybe with a smaller string... + prev=: + + for cmd in 'echo test' 'sed 2q "[$]0"' 'sed 10q "[$]0"' 'sed 20q "[$]0"' 'sed 50q "[$]0"'; do + if (test "X$echo_test_string" = "X`eval $cmd`") 2>/dev/null + then + break + fi + prev="$cmd" + done + + if test "$prev" != 'sed 50q "[$]0"'; then + echo_test_string=`eval $prev` + export echo_test_string + exec ${ORIGINAL_CONFIG_SHELL-${CONFIG_SHELL-/bin/sh}} "[$]0" ${1+"[$]@"} + else + # Oops. We lost completely, so just stick with echo. + echo=echo + fi + fi + fi + fi +fi +fi + +# Copy echo and quote the copy suitably for passing to libtool from +# the Makefile, instead of quoting the original, which is used later. +ECHO=$echo +if test "X$ECHO" = "X$CONFIG_SHELL [$]0 --fallback-echo"; then + ECHO="$CONFIG_SHELL \\\$\[$]0 --fallback-echo" +fi + +AC_SUBST(ECHO) +])])# _LT_AC_PROG_ECHO_BACKSLASH + + +# _LT_AC_LOCK +# ----------- +AC_DEFUN([_LT_AC_LOCK], +[AC_ARG_ENABLE([libtool-lock], + [AC_HELP_STRING([--disable-libtool-lock], + [avoid locking (might break parallel builds)])]) +test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes + +# Some flags need to be propagated to the compiler or linker for good +# libtool support. +case $host in +ia64-*-hpux*) + # Find out which ABI we are using. + echo 'int i;' > conftest.$ac_ext + if AC_TRY_EVAL(ac_compile); then + case `/usr/bin/file conftest.$ac_objext` in + *ELF-32*) + HPUX_IA64_MODE="32" + ;; + *ELF-64*) + HPUX_IA64_MODE="64" + ;; + esac + fi + rm -rf conftest* + ;; +*-*-irix6*) + # Find out which ABI we are using. + echo '[#]line __oline__ "configure"' > conftest.$ac_ext + if AC_TRY_EVAL(ac_compile); then + if test "$lt_cv_prog_gnu_ld" = yes; then + case `/usr/bin/file conftest.$ac_objext` in + *32-bit*) + LD="${LD-ld} -melf32bsmip" + ;; + *N32*) + LD="${LD-ld} -melf32bmipn32" + ;; + *64-bit*) + LD="${LD-ld} -melf64bmip" + ;; + esac + else + case `/usr/bin/file conftest.$ac_objext` in + *32-bit*) + LD="${LD-ld} -32" + ;; + *N32*) + LD="${LD-ld} -n32" + ;; + *64-bit*) + LD="${LD-ld} -64" + ;; + esac + fi + fi + rm -rf conftest* + ;; + +x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \ +s390*-*linux*|sparc*-*linux*) + # Find out which ABI we are using. + echo 'int i;' > conftest.$ac_ext + if AC_TRY_EVAL(ac_compile); then + case `/usr/bin/file conftest.o` in + *32-bit*) + case $host in + x86_64-*kfreebsd*-gnu) + LD="${LD-ld} -m elf_i386_fbsd" + ;; + x86_64-*linux*) + LD="${LD-ld} -m elf_i386" + ;; + ppc64-*linux*|powerpc64-*linux*) + LD="${LD-ld} -m elf32ppclinux" + ;; + s390x-*linux*) + LD="${LD-ld} -m elf_s390" + ;; + sparc64-*linux*) + LD="${LD-ld} -m elf32_sparc" + ;; + esac + ;; + *64-bit*) + case $host in + x86_64-*kfreebsd*-gnu) + LD="${LD-ld} -m elf_x86_64_fbsd" + ;; + x86_64-*linux*) + LD="${LD-ld} -m elf_x86_64" + ;; + ppc*-*linux*|powerpc*-*linux*) + LD="${LD-ld} -m elf64ppc" + ;; + s390*-*linux*) + LD="${LD-ld} -m elf64_s390" + ;; + sparc*-*linux*) + LD="${LD-ld} -m elf64_sparc" + ;; + esac + ;; + esac + fi + rm -rf conftest* + ;; + +*-*-sco3.2v5*) + # On SCO OpenServer 5, we need -belf to get full-featured binaries. + SAVE_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -belf" + AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf, + [AC_LANG_PUSH(C) + AC_TRY_LINK([],[],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no]) + AC_LANG_POP]) + if test x"$lt_cv_cc_needs_belf" != x"yes"; then + # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf + CFLAGS="$SAVE_CFLAGS" + fi + ;; +sparc*-*solaris*) + # Find out which ABI we are using. + echo 'int i;' > conftest.$ac_ext + if AC_TRY_EVAL(ac_compile); then + case `/usr/bin/file conftest.o` in + *64-bit*) + case $lt_cv_prog_gnu_ld in + yes*) LD="${LD-ld} -m elf64_sparc" ;; + *) LD="${LD-ld} -64" ;; + esac + ;; + esac + fi + rm -rf conftest* + ;; + +AC_PROVIDE_IFELSE([AC_LIBTOOL_WIN32_DLL], +[*-*-cygwin* | *-*-mingw* | *-*-pw32*) + AC_CHECK_TOOL(DLLTOOL, dlltool, false) + AC_CHECK_TOOL(AS, as, false) + AC_CHECK_TOOL(OBJDUMP, objdump, false) + ;; + ]) +esac + +need_locks="$enable_libtool_lock" + +])# _LT_AC_LOCK + + +# AC_LIBTOOL_COMPILER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS, +# [OUTPUT-FILE], [ACTION-SUCCESS], [ACTION-FAILURE]) +# ---------------------------------------------------------------- +# Check whether the given compiler option works +AC_DEFUN([AC_LIBTOOL_COMPILER_OPTION], +[AC_REQUIRE([LT_AC_PROG_SED]) +AC_CACHE_CHECK([$1], [$2], + [$2=no + ifelse([$4], , [ac_outfile=conftest.$ac_objext], [ac_outfile=$4]) + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + lt_compiler_flag="$3" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + # The option is referenced via a variable to avoid confusing sed. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ + -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:__oline__: $lt_compile\"" >&AS_MESSAGE_LOG_FD) + (eval "$lt_compile" 2>conftest.err) + ac_status=$? + cat conftest.err >&AS_MESSAGE_LOG_FD + echo "$as_me:__oline__: \$? = $ac_status" >&AS_MESSAGE_LOG_FD + if (exit $ac_status) && test -s "$ac_outfile"; then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings other than the usual output. + $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp + $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 + if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then + $2=yes + fi + fi + $rm conftest* +]) + +if test x"[$]$2" = xyes; then + ifelse([$5], , :, [$5]) +else + ifelse([$6], , :, [$6]) +fi +])# AC_LIBTOOL_COMPILER_OPTION + + +# AC_LIBTOOL_LINKER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS, +# [ACTION-SUCCESS], [ACTION-FAILURE]) +# ------------------------------------------------------------ +# Check whether the given compiler option works +AC_DEFUN([AC_LIBTOOL_LINKER_OPTION], +[AC_REQUIRE([LT_AC_PROG_SED])dnl +AC_CACHE_CHECK([$1], [$2], + [$2=no + save_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS $3" + echo "$lt_simple_link_test_code" > conftest.$ac_ext + if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then + # The linker can only warn and ignore the option if not recognized + # So say no if there are warnings + if test -s conftest.err; then + # Append any errors to the config.log. + cat conftest.err 1>&AS_MESSAGE_LOG_FD + $echo "X$_lt_linker_boilerplate" | $Xsed -e '/^$/d' > conftest.exp + $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 + if diff conftest.exp conftest.er2 >/dev/null; then + $2=yes + fi + else + $2=yes + fi + fi + $rm conftest* + LDFLAGS="$save_LDFLAGS" +]) + +if test x"[$]$2" = xyes; then + ifelse([$4], , :, [$4]) +else + ifelse([$5], , :, [$5]) +fi +])# AC_LIBTOOL_LINKER_OPTION + + +# AC_LIBTOOL_SYS_MAX_CMD_LEN +# -------------------------- +AC_DEFUN([AC_LIBTOOL_SYS_MAX_CMD_LEN], +[# find the maximum length of command line arguments +AC_MSG_CHECKING([the maximum length of command line arguments]) +AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl + i=0 + teststring="ABCD" + + case $build_os in + msdosdjgpp*) + # On DJGPP, this test can blow up pretty badly due to problems in libc + # (any single argument exceeding 2000 bytes causes a buffer overrun + # during glob expansion). Even if it were fixed, the result of this + # check would be larger than it should be. + lt_cv_sys_max_cmd_len=12288; # 12K is about right + ;; + + gnu*) + # Under GNU Hurd, this test is not required because there is + # no limit to the length of command line arguments. + # Libtool will interpret -1 as no limit whatsoever + lt_cv_sys_max_cmd_len=-1; + ;; + + cygwin* | mingw*) + # On Win9x/ME, this test blows up -- it succeeds, but takes + # about 5 minutes as the teststring grows exponentially. + # Worse, since 9x/ME are not pre-emptively multitasking, + # you end up with a "frozen" computer, even though with patience + # the test eventually succeeds (with a max line length of 256k). + # Instead, let's just punt: use the minimum linelength reported by + # all of the supported platforms: 8192 (on NT/2K/XP). + lt_cv_sys_max_cmd_len=8192; + ;; + + amigaos*) + # On AmigaOS with pdksh, this test takes hours, literally. + # So we just punt and use a minimum line length of 8192. + lt_cv_sys_max_cmd_len=8192; + ;; + + netbsd* | freebsd* | openbsd* | darwin* | dragonfly*) + # This has been around since 386BSD, at least. Likely further. + if test -x /sbin/sysctl; then + lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax` + elif test -x /usr/sbin/sysctl; then + lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax` + else + lt_cv_sys_max_cmd_len=65536 # usable default for all BSDs + fi + # And add a safety zone + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` + ;; + + interix*) + # We know the value 262144 and hardcode it with a safety zone (like BSD) + lt_cv_sys_max_cmd_len=196608 + ;; + + osf*) + # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure + # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not + # nice to cause kernel panics so lets avoid the loop below. + # First set a reasonable default. + lt_cv_sys_max_cmd_len=16384 + # + if test -x /sbin/sysconfig; then + case `/sbin/sysconfig -q proc exec_disable_arg_limit` in + *1*) lt_cv_sys_max_cmd_len=-1 ;; + esac + fi + ;; + sco3.2v5*) + lt_cv_sys_max_cmd_len=102400 + ;; + sysv5* | sco5v6* | sysv4.2uw2*) + kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null` + if test -n "$kargmax"; then + lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[[ ]]//'` + else + lt_cv_sys_max_cmd_len=32768 + fi + ;; + *) + lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null` + if test -n "$lt_cv_sys_max_cmd_len"; then + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` + else + SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}} + while (test "X"`$SHELL [$]0 --fallback-echo "X$teststring" 2>/dev/null` \ + = "XX$teststring") >/dev/null 2>&1 && + new_result=`expr "X$teststring" : ".*" 2>&1` && + lt_cv_sys_max_cmd_len=$new_result && + test $i != 17 # 1/2 MB should be enough + do + i=`expr $i + 1` + teststring=$teststring$teststring + done + teststring= + # Add a significant safety factor because C++ compilers can tack on massive + # amounts of additional arguments before passing them to the linker. + # It appears as though 1/2 is a usable value. + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2` + fi + ;; + esac +]) +if test -n $lt_cv_sys_max_cmd_len ; then + AC_MSG_RESULT($lt_cv_sys_max_cmd_len) +else + AC_MSG_RESULT(none) +fi +])# AC_LIBTOOL_SYS_MAX_CMD_LEN + + +# _LT_AC_CHECK_DLFCN +# ------------------ +AC_DEFUN([_LT_AC_CHECK_DLFCN], +[AC_CHECK_HEADERS(dlfcn.h)dnl +])# _LT_AC_CHECK_DLFCN + + +# _LT_AC_TRY_DLOPEN_SELF (ACTION-IF-TRUE, ACTION-IF-TRUE-W-USCORE, +# ACTION-IF-FALSE, ACTION-IF-CROSS-COMPILING) +# --------------------------------------------------------------------- +AC_DEFUN([_LT_AC_TRY_DLOPEN_SELF], +[AC_REQUIRE([_LT_AC_CHECK_DLFCN])dnl +if test "$cross_compiling" = yes; then : + [$4] +else + lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 + lt_status=$lt_dlunknown + cat > conftest.$ac_ext < +#endif + +#include + +#ifdef RTLD_GLOBAL +# define LT_DLGLOBAL RTLD_GLOBAL +#else +# ifdef DL_GLOBAL +# define LT_DLGLOBAL DL_GLOBAL +# else +# define LT_DLGLOBAL 0 +# endif +#endif + +/* We may have to define LT_DLLAZY_OR_NOW in the command line if we + find out it does not work in some platform. */ +#ifndef LT_DLLAZY_OR_NOW +# ifdef RTLD_LAZY +# define LT_DLLAZY_OR_NOW RTLD_LAZY +# else +# ifdef DL_LAZY +# define LT_DLLAZY_OR_NOW DL_LAZY +# else +# ifdef RTLD_NOW +# define LT_DLLAZY_OR_NOW RTLD_NOW +# else +# ifdef DL_NOW +# define LT_DLLAZY_OR_NOW DL_NOW +# else +# define LT_DLLAZY_OR_NOW 0 +# endif +# endif +# endif +# endif +#endif + +#ifdef __cplusplus +extern "C" void exit (int); +#endif + +void fnord() { int i=42;} +int main () +{ + void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); + int status = $lt_dlunknown; + + if (self) + { + if (dlsym (self,"fnord")) status = $lt_dlno_uscore; + else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; + /* dlclose (self); */ + } + else + puts (dlerror ()); + + exit (status); +}] +EOF + if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext} 2>/dev/null; then + (./conftest; exit; ) >&AS_MESSAGE_LOG_FD 2>/dev/null + lt_status=$? + case x$lt_status in + x$lt_dlno_uscore) $1 ;; + x$lt_dlneed_uscore) $2 ;; + x$lt_dlunknown|x*) $3 ;; + esac + else : + # compilation failed + $3 + fi +fi +rm -fr conftest* +])# _LT_AC_TRY_DLOPEN_SELF + + +# AC_LIBTOOL_DLOPEN_SELF +# ---------------------- +AC_DEFUN([AC_LIBTOOL_DLOPEN_SELF], +[AC_REQUIRE([_LT_AC_CHECK_DLFCN])dnl +if test "x$enable_dlopen" != xyes; then + enable_dlopen=unknown + enable_dlopen_self=unknown + enable_dlopen_self_static=unknown +else + lt_cv_dlopen=no + lt_cv_dlopen_libs= + + case $host_os in + beos*) + lt_cv_dlopen="load_add_on" + lt_cv_dlopen_libs= + lt_cv_dlopen_self=yes + ;; + + mingw* | pw32*) + lt_cv_dlopen="LoadLibrary" + lt_cv_dlopen_libs= + ;; + + cygwin*) + lt_cv_dlopen="dlopen" + lt_cv_dlopen_libs= + ;; + + darwin*) + # if libdl is installed we need to link against it + AC_CHECK_LIB([dl], [dlopen], + [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"],[ + lt_cv_dlopen="dyld" + lt_cv_dlopen_libs= + lt_cv_dlopen_self=yes + ]) + ;; + + *) + AC_CHECK_FUNC([shl_load], + [lt_cv_dlopen="shl_load"], + [AC_CHECK_LIB([dld], [shl_load], + [lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-dld"], + [AC_CHECK_FUNC([dlopen], + [lt_cv_dlopen="dlopen"], + [AC_CHECK_LIB([dl], [dlopen], + [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"], + [AC_CHECK_LIB([svld], [dlopen], + [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"], + [AC_CHECK_LIB([dld], [dld_link], + [lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-dld"]) + ]) + ]) + ]) + ]) + ]) + ;; + esac + + if test "x$lt_cv_dlopen" != xno; then + enable_dlopen=yes + else + enable_dlopen=no + fi + + case $lt_cv_dlopen in + dlopen) + save_CPPFLAGS="$CPPFLAGS" + test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" + + save_LDFLAGS="$LDFLAGS" + wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" + + save_LIBS="$LIBS" + LIBS="$lt_cv_dlopen_libs $LIBS" + + AC_CACHE_CHECK([whether a program can dlopen itself], + lt_cv_dlopen_self, [dnl + _LT_AC_TRY_DLOPEN_SELF( + lt_cv_dlopen_self=yes, lt_cv_dlopen_self=yes, + lt_cv_dlopen_self=no, lt_cv_dlopen_self=cross) + ]) + + if test "x$lt_cv_dlopen_self" = xyes; then + wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\" + AC_CACHE_CHECK([whether a statically linked program can dlopen itself], + lt_cv_dlopen_self_static, [dnl + _LT_AC_TRY_DLOPEN_SELF( + lt_cv_dlopen_self_static=yes, lt_cv_dlopen_self_static=yes, + lt_cv_dlopen_self_static=no, lt_cv_dlopen_self_static=cross) + ]) + fi + + CPPFLAGS="$save_CPPFLAGS" + LDFLAGS="$save_LDFLAGS" + LIBS="$save_LIBS" + ;; + esac + + case $lt_cv_dlopen_self in + yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; + *) enable_dlopen_self=unknown ;; + esac + + case $lt_cv_dlopen_self_static in + yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; + *) enable_dlopen_self_static=unknown ;; + esac +fi +])# AC_LIBTOOL_DLOPEN_SELF + + +# AC_LIBTOOL_PROG_CC_C_O([TAGNAME]) +# --------------------------------- +# Check to see if options -c and -o are simultaneously supported by compiler +AC_DEFUN([AC_LIBTOOL_PROG_CC_C_O], +[AC_REQUIRE([LT_AC_PROG_SED])dnl +AC_REQUIRE([_LT_AC_SYS_COMPILER])dnl +AC_CACHE_CHECK([if $compiler supports -c -o file.$ac_objext], + [_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)], + [_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)=no + $rm -r conftest 2>/dev/null + mkdir conftest + cd conftest + mkdir out + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + + lt_compiler_flag="-o out/conftest2.$ac_objext" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ + -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:__oline__: $lt_compile\"" >&AS_MESSAGE_LOG_FD) + (eval "$lt_compile" 2>out/conftest.err) + ac_status=$? + cat out/conftest.err >&AS_MESSAGE_LOG_FD + echo "$as_me:__oline__: \$? = $ac_status" >&AS_MESSAGE_LOG_FD + if (exit $ac_status) && test -s out/conftest2.$ac_objext + then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' > out/conftest.exp + $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 + if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then + _LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes + fi + fi + chmod u+w . 2>&AS_MESSAGE_LOG_FD + $rm conftest* + # SGI C++ compiler will create directory out/ii_files/ for + # template instantiation + test -d out/ii_files && $rm out/ii_files/* && rmdir out/ii_files + $rm out/* && rmdir out + cd .. + rmdir conftest + $rm conftest* +]) +])# AC_LIBTOOL_PROG_CC_C_O + + +# AC_LIBTOOL_SYS_HARD_LINK_LOCKS([TAGNAME]) +# ----------------------------------------- +# Check to see if we can do hard links to lock some files if needed +AC_DEFUN([AC_LIBTOOL_SYS_HARD_LINK_LOCKS], +[AC_REQUIRE([_LT_AC_LOCK])dnl + +hard_links="nottested" +if test "$_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)" = no && test "$need_locks" != no; then + # do not overwrite the value of need_locks provided by the user + AC_MSG_CHECKING([if we can lock with hard links]) + hard_links=yes + $rm conftest* + ln conftest.a conftest.b 2>/dev/null && hard_links=no + touch conftest.a + ln conftest.a conftest.b 2>&5 || hard_links=no + ln conftest.a conftest.b 2>/dev/null && hard_links=no + AC_MSG_RESULT([$hard_links]) + if test "$hard_links" = no; then + AC_MSG_WARN([`$CC' does not support `-c -o', so `make -j' may be unsafe]) + need_locks=warn + fi +else + need_locks=no +fi +])# AC_LIBTOOL_SYS_HARD_LINK_LOCKS + + +# AC_LIBTOOL_OBJDIR +# ----------------- +AC_DEFUN([AC_LIBTOOL_OBJDIR], +[AC_CACHE_CHECK([for objdir], [lt_cv_objdir], +[rm -f .libs 2>/dev/null +mkdir .libs 2>/dev/null +if test -d .libs; then + lt_cv_objdir=.libs +else + # MS-DOS does not allow filenames that begin with a dot. + lt_cv_objdir=_libs +fi +rmdir .libs 2>/dev/null]) +objdir=$lt_cv_objdir +])# AC_LIBTOOL_OBJDIR + + +# AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH([TAGNAME]) +# ---------------------------------------------- +# Check hardcoding attributes. +AC_DEFUN([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH], +[AC_MSG_CHECKING([how to hardcode library paths into programs]) +_LT_AC_TAGVAR(hardcode_action, $1)= +if test -n "$_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)" || \ + test -n "$_LT_AC_TAGVAR(runpath_var, $1)" || \ + test "X$_LT_AC_TAGVAR(hardcode_automatic, $1)" = "Xyes" ; then + + # We can hardcode non-existant directories. + if test "$_LT_AC_TAGVAR(hardcode_direct, $1)" != no && + # If the only mechanism to avoid hardcoding is shlibpath_var, we + # have to relink, otherwise we might link with an installed library + # when we should be linking with a yet-to-be-installed one + ## test "$_LT_AC_TAGVAR(hardcode_shlibpath_var, $1)" != no && + test "$_LT_AC_TAGVAR(hardcode_minus_L, $1)" != no; then + # Linking always hardcodes the temporary library directory. + _LT_AC_TAGVAR(hardcode_action, $1)=relink + else + # We can link without hardcoding, and we can hardcode nonexisting dirs. + _LT_AC_TAGVAR(hardcode_action, $1)=immediate + fi +else + # We cannot hardcode anything, or else we can only hardcode existing + # directories. + _LT_AC_TAGVAR(hardcode_action, $1)=unsupported +fi +AC_MSG_RESULT([$_LT_AC_TAGVAR(hardcode_action, $1)]) + +if test "$_LT_AC_TAGVAR(hardcode_action, $1)" = relink; then + # Fast installation is not supported + enable_fast_install=no +elif test "$shlibpath_overrides_runpath" = yes || + test "$enable_shared" = no; then + # Fast installation is not necessary + enable_fast_install=needless +fi +])# AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH + + +# AC_LIBTOOL_SYS_LIB_STRIP +# ------------------------ +AC_DEFUN([AC_LIBTOOL_SYS_LIB_STRIP], +[striplib= +old_striplib= +AC_MSG_CHECKING([whether stripping libraries is possible]) +if test -n "$STRIP" && $STRIP -V 2>&1 | grep "GNU strip" >/dev/null; then + test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" + test -z "$striplib" && striplib="$STRIP --strip-unneeded" + AC_MSG_RESULT([yes]) +else +# FIXME - insert some real tests, host_os isn't really good enough + case $host_os in + darwin*) + if test -n "$STRIP" ; then + striplib="$STRIP -x" + old_striplib="$STRIP -S" + AC_MSG_RESULT([yes]) + else + AC_MSG_RESULT([no]) +fi + ;; + *) + AC_MSG_RESULT([no]) + ;; + esac +fi +])# AC_LIBTOOL_SYS_LIB_STRIP + + +# AC_LIBTOOL_SYS_DYNAMIC_LINKER +# ----------------------------- +# PORTME Fill in your ld.so characteristics +AC_DEFUN([AC_LIBTOOL_SYS_DYNAMIC_LINKER], +[AC_REQUIRE([LT_AC_PROG_SED])dnl +AC_MSG_CHECKING([dynamic linker characteristics]) +library_names_spec= +libname_spec='lib$name' +soname_spec= +shrext_cmds=".so" +postinstall_cmds= +postuninstall_cmds= +finish_cmds= +finish_eval= +shlibpath_var= +shlibpath_overrides_runpath=unknown +version_type=none +dynamic_linker="$host_os ld.so" +sys_lib_dlsearch_path_spec="/lib /usr/lib" +m4_if($1,[],[ +if test "$GCC" = yes; then + case $host_os in + darwin*) lt_awk_arg="/^libraries:/,/LR/" ;; + *) lt_awk_arg="/^libraries:/" ;; + esac + lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e "s,=/,/,g"` + if echo "$lt_search_path_spec" | grep ';' >/dev/null ; then + # if the path contains ";" then we assume it to be the separator + # otherwise default to the standard path separator (i.e. ":") - it is + # assumed that no part of a normal pathname contains ";" but that should + # okay in the real world where ";" in dirpaths is itself problematic. + lt_search_path_spec=`echo "$lt_search_path_spec" | $SED -e 's/;/ /g'` + else + lt_search_path_spec=`echo "$lt_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + fi + # Ok, now we have the path, separated by spaces, we can step through it + # and add multilib dir if necessary. + lt_tmp_lt_search_path_spec= + lt_multi_os_dir=`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null` + for lt_sys_path in $lt_search_path_spec; do + if test -d "$lt_sys_path/$lt_multi_os_dir"; then + lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path/$lt_multi_os_dir" + else + test -d "$lt_sys_path" && \ + lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path" + fi + done + lt_search_path_spec=`echo $lt_tmp_lt_search_path_spec | awk ' +BEGIN {RS=" "; FS="/|\n";} { + lt_foo=""; + lt_count=0; + for (lt_i = NF; lt_i > 0; lt_i--) { + if ($lt_i != "" && $lt_i != ".") { + if ($lt_i == "..") { + lt_count++; + } else { + if (lt_count == 0) { + lt_foo="/" $lt_i lt_foo; + } else { + lt_count--; + } + } + } + } + if (lt_foo != "") { lt_freq[[lt_foo]]++; } + if (lt_freq[[lt_foo]] == 1) { print lt_foo; } +}'` + sys_lib_search_path_spec=`echo $lt_search_path_spec` +else + sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" +fi]) +need_lib_prefix=unknown +hardcode_into_libs=no + +# when you set need_version to no, make sure it does not cause -set_version +# flags to be left without arguments +need_version=unknown + +case $host_os in +aix3*) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' + shlibpath_var=LIBPATH + + # AIX 3 has no versioning support, so we append a major version to the name. + soname_spec='${libname}${release}${shared_ext}$major' + ;; + +aix4* | aix5*) + version_type=linux + need_lib_prefix=no + need_version=no + hardcode_into_libs=yes + if test "$host_cpu" = ia64; then + # AIX 5 supports IA64 + library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + else + # With GCC up to 2.95.x, collect2 would create an import file + # for dependence libraries. The import file would start with + # the line `#! .'. This would cause the generated library to + # depend on `.', always an invalid library. This was fixed in + # development snapshots of GCC prior to 3.0. + case $host_os in + aix4 | aix4.[[01]] | aix4.[[01]].*) + if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' + echo ' yes ' + echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then + : + else + can_build_shared=no + fi + ;; + esac + # AIX (on Power*) has no versioning support, so currently we can not hardcode correct + # soname into executable. Probably we can add versioning support to + # collect2, so additional links can be useful in future. + if test "$aix_use_runtimelinking" = yes; then + # If using run time linking (on AIX 4.2 or later) use lib.so + # instead of lib.a to let people know that these are not + # typical AIX shared libraries. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + else + # We preserve .a as extension for shared libraries through AIX4.2 + # and later when we are not doing run time linking. + library_names_spec='${libname}${release}.a $libname.a' + soname_spec='${libname}${release}${shared_ext}$major' + fi + shlibpath_var=LIBPATH + fi + ;; + +amigaos*) + library_names_spec='$libname.ixlibrary $libname.a' + # Create ${libname}_ixlibrary.a entries in /sys/libs. + finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([[^/]]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' + ;; + +beos*) + library_names_spec='${libname}${shared_ext}' + dynamic_linker="$host_os ld.so" + shlibpath_var=LIBRARY_PATH + ;; + +bsdi[[45]]*) + version_type=linux + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' + shlibpath_var=LD_LIBRARY_PATH + sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" + sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" + # the default ld.so.conf also contains /usr/contrib/lib and + # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow + # libtool to hard-code these into programs + ;; + +cygwin* | mingw* | pw32*) + version_type=windows + shrext_cmds=".dll" + need_version=no + need_lib_prefix=no + + case $GCC,$host_os in + yes,cygwin* | yes,mingw* | yes,pw32*) + library_names_spec='$libname.dll.a' + # DLL is installed to $(libdir)/../bin by postinstall_cmds + postinstall_cmds='base_file=`basename \${file}`~ + dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i;echo \$dlname'\''`~ + dldir=$destdir/`dirname \$dlpath`~ + test -d \$dldir || mkdir -p \$dldir~ + $install_prog $dir/$dlname \$dldir/$dlname~ + chmod a+x \$dldir/$dlname' + postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ + dlpath=$dir/\$dldll~ + $rm \$dlpath' + shlibpath_overrides_runpath=yes + + case $host_os in + cygwin*) + # Cygwin DLLs use 'cyg' prefix rather than 'lib' + soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' + sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib" + ;; + mingw*) + # MinGW DLLs use traditional 'lib' prefix + soname_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' + sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` + if echo "$sys_lib_search_path_spec" | [grep ';[c-zC-Z]:/' >/dev/null]; then + # It is most probably a Windows format PATH printed by + # mingw gcc, but we are running on Cygwin. Gcc prints its search + # path with ; separators, and with drive letters. We can handle the + # drive letters (cygwin fileutils understands them), so leave them, + # especially as we might pass files found there to a mingw objdump, + # which wouldn't understand a cygwinified path. Ahh. + sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` + else + sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + fi + ;; + pw32*) + # pw32 DLLs use 'pw' prefix rather than 'lib' + library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' + ;; + esac + ;; + + *) + library_names_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext} $libname.lib' + ;; + esac + dynamic_linker='Win32 ld.exe' + # FIXME: first we should search . and the directory the executable is in + shlibpath_var=PATH + ;; + +darwin* | rhapsody*) + dynamic_linker="$host_os dyld" + version_type=darwin + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${versuffix}$shared_ext ${libname}${release}${major}$shared_ext ${libname}$shared_ext' + soname_spec='${libname}${release}${major}$shared_ext' + shlibpath_overrides_runpath=yes + shlibpath_var=DYLD_LIBRARY_PATH + shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' + m4_if([$1], [],[ + sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib"]) + sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' + ;; + +dgux*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +freebsd1*) + dynamic_linker=no + ;; + +freebsd* | dragonfly*) + # DragonFly does not have aout. When/if they implement a new + # versioning mechanism, adjust this. + if test -x /usr/bin/objformat; then + objformat=`/usr/bin/objformat` + else + case $host_os in + freebsd[[123]]*) objformat=aout ;; + *) objformat=elf ;; + esac + fi + version_type=freebsd-$objformat + case $version_type in + freebsd-elf*) + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' + need_version=no + need_lib_prefix=no + ;; + freebsd-*) + library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' + need_version=yes + ;; + esac + shlibpath_var=LD_LIBRARY_PATH + case $host_os in + freebsd2*) + shlibpath_overrides_runpath=yes + ;; + freebsd3.[[01]]* | freebsdelf3.[[01]]*) + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + freebsd3.[[2-9]]* | freebsdelf3.[[2-9]]* | \ + freebsd4.[[0-5]] | freebsdelf4.[[0-5]] | freebsd4.1.1 | freebsdelf4.1.1) + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + *) # from 4.6 on, and DragonFly + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + esac + ;; + +gnu*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + hardcode_into_libs=yes + ;; + +hpux9* | hpux10* | hpux11*) + # Give a soname corresponding to the major version so that dld.sl refuses to + # link against other versions. + version_type=sunos + need_lib_prefix=no + need_version=no + case $host_cpu in + ia64*) + shrext_cmds='.so' + hardcode_into_libs=yes + dynamic_linker="$host_os dld.so" + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + if test "X$HPUX_IA64_MODE" = X32; then + sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" + else + sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" + fi + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + ;; + hppa*64*) + shrext_cmds='.sl' + hardcode_into_libs=yes + dynamic_linker="$host_os dld.sl" + shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH + shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + ;; + *) + shrext_cmds='.sl' + dynamic_linker="$host_os dld.sl" + shlibpath_var=SHLIB_PATH + shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + ;; + esac + # HP-UX runs *really* slowly unless shared libraries are mode 555. + postinstall_cmds='chmod 555 $lib' + ;; + +interix[[3-9]]*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + +irix5* | irix6* | nonstopux*) + case $host_os in + nonstopux*) version_type=nonstopux ;; + *) + if test "$lt_cv_prog_gnu_ld" = yes; then + version_type=linux + else + version_type=irix + fi ;; + esac + need_lib_prefix=no + need_version=no + soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' + case $host_os in + irix5* | nonstopux*) + libsuff= shlibsuff= + ;; + *) + case $LD in # libtool.m4 will add one of these switches to LD + *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") + libsuff= shlibsuff= libmagic=32-bit;; + *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") + libsuff=32 shlibsuff=N32 libmagic=N32;; + *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") + libsuff=64 shlibsuff=64 libmagic=64-bit;; + *) libsuff= shlibsuff= libmagic=never-match;; + esac + ;; + esac + shlibpath_var=LD_LIBRARY${shlibsuff}_PATH + shlibpath_overrides_runpath=no + sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" + sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" + hardcode_into_libs=yes + ;; + +# No shared lib support for Linux oldld, aout, or coff. +linux*oldld* | linux*aout* | linux*coff*) + dynamic_linker=no + ;; + +# This must be Linux ELF. +linux* | k*bsd*-gnu) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + # This implies no fast_install, which is unacceptable. + # Some rework will be needed to allow for fast_install + # before this can be enabled. + hardcode_into_libs=yes + + # Append ld.so.conf contents to the search path + if test -f /etc/ld.so.conf; then + lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \[$]2)); skip = 1; } { if (!skip) print \[$]0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` + sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" + fi + + # We used to test for /lib/ld.so.1 and disable shared libraries on + # powerpc, because MkLinux only supported shared libraries with the + # GNU dynamic linker. Since this was broken with cross compilers, + # most powerpc-linux boxes support dynamic linking these days and + # people can always --disable-shared, the test was removed, and we + # assume the GNU/Linux dynamic linker is in use. + dynamic_linker='GNU/Linux ld.so' + ;; + +netbsdelf*-gnu) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + dynamic_linker='NetBSD ld.elf_so' + ;; + +netbsd*) + version_type=sunos + need_lib_prefix=no + need_version=no + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + dynamic_linker='NetBSD (a.out) ld.so' + else + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + dynamic_linker='NetBSD ld.elf_so' + fi + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + +newsos6) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + ;; + +nto-qnx*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + ;; + +openbsd*) + version_type=sunos + sys_lib_dlsearch_path_spec="/usr/lib" + need_lib_prefix=no + # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. + case $host_os in + openbsd3.3 | openbsd3.3.*) need_version=yes ;; + *) need_version=no ;; + esac + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + shlibpath_var=LD_LIBRARY_PATH + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + case $host_os in + openbsd2.[[89]] | openbsd2.[[89]].*) + shlibpath_overrides_runpath=no + ;; + *) + shlibpath_overrides_runpath=yes + ;; + esac + else + shlibpath_overrides_runpath=yes + fi + ;; + +os2*) + libname_spec='$name' + shrext_cmds=".dll" + need_lib_prefix=no + library_names_spec='$libname${shared_ext} $libname.a' + dynamic_linker='OS/2 ld.exe' + shlibpath_var=LIBPATH + ;; + +osf3* | osf4* | osf5*) + version_type=osf + need_lib_prefix=no + need_version=no + soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" + sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" + ;; + +rdos*) + dynamic_linker=no + ;; + +solaris*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + # ldd complains unless libraries are executable + postinstall_cmds='chmod +x $lib' + ;; + +sunos4*) + version_type=sunos + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + if test "$with_gnu_ld" = yes; then + need_lib_prefix=no + fi + need_version=yes + ;; + +sysv4 | sysv4.3*) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + case $host_vendor in + sni) + shlibpath_overrides_runpath=no + need_lib_prefix=no + export_dynamic_flag_spec='${wl}-Blargedynsym' + runpath_var=LD_RUN_PATH + ;; + siemens) + need_lib_prefix=no + ;; + motorola) + need_lib_prefix=no + need_version=no + shlibpath_overrides_runpath=no + sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' + ;; + esac + ;; + +sysv4*MP*) + if test -d /usr/nec ;then + version_type=linux + library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' + soname_spec='$libname${shared_ext}.$major' + shlibpath_var=LD_LIBRARY_PATH + fi + ;; + +sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) + version_type=freebsd-elf + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + hardcode_into_libs=yes + if test "$with_gnu_ld" = yes; then + sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' + shlibpath_overrides_runpath=no + else + sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' + shlibpath_overrides_runpath=yes + case $host_os in + sco3.2v5*) + sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" + ;; + esac + fi + sys_lib_dlsearch_path_spec='/usr/lib' + ;; + +uts4*) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +*) + dynamic_linker=no + ;; +esac +AC_MSG_RESULT([$dynamic_linker]) +test "$dynamic_linker" = no && can_build_shared=no + +variables_saved_for_relink="PATH $shlibpath_var $runpath_var" +if test "$GCC" = yes; then + variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" +fi +])# AC_LIBTOOL_SYS_DYNAMIC_LINKER + + +# _LT_AC_TAGCONFIG +# ---------------- +AC_DEFUN([_LT_AC_TAGCONFIG], +[AC_REQUIRE([LT_AC_PROG_SED])dnl +AC_ARG_WITH([tags], + [AC_HELP_STRING([--with-tags@<:@=TAGS@:>@], + [include additional configurations @<:@automatic@:>@])], + [tagnames="$withval"]) + +if test -f "$ltmain" && test -n "$tagnames"; then + if test ! -f "${ofile}"; then + AC_MSG_WARN([output file `$ofile' does not exist]) + fi + + if test -z "$LTCC"; then + eval "`$SHELL ${ofile} --config | grep '^LTCC='`" + if test -z "$LTCC"; then + AC_MSG_WARN([output file `$ofile' does not look like a libtool script]) + else + AC_MSG_WARN([using `LTCC=$LTCC', extracted from `$ofile']) + fi + fi + if test -z "$LTCFLAGS"; then + eval "`$SHELL ${ofile} --config | grep '^LTCFLAGS='`" + fi + + # Extract list of available tagged configurations in $ofile. + # Note that this assumes the entire list is on one line. + available_tags=`grep "^available_tags=" "${ofile}" | $SED -e 's/available_tags=\(.*$\)/\1/' -e 's/\"//g'` + + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for tagname in $tagnames; do + IFS="$lt_save_ifs" + # Check whether tagname contains only valid characters + case `$echo "X$tagname" | $Xsed -e 's:[[-_ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890,/]]::g'` in + "") ;; + *) AC_MSG_ERROR([invalid tag name: $tagname]) + ;; + esac + + if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "${ofile}" > /dev/null + then + AC_MSG_ERROR([tag name \"$tagname\" already exists]) + fi + + # Update the list of available tags. + if test -n "$tagname"; then + echo appending configuration tag \"$tagname\" to $ofile + + case $tagname in + CXX) + if test -n "$CXX" && ( test "X$CXX" != "Xno" && + ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) || + (test "X$CXX" != "Xg++"))) ; then + AC_LIBTOOL_LANG_CXX_CONFIG + else + tagname="" + fi + ;; + + F77) + if test -n "$F77" && test "X$F77" != "Xno"; then + AC_LIBTOOL_LANG_F77_CONFIG + else + tagname="" + fi + ;; + + GCJ) + if test -n "$GCJ" && test "X$GCJ" != "Xno"; then + AC_LIBTOOL_LANG_GCJ_CONFIG + else + tagname="" + fi + ;; + + RC) + AC_LIBTOOL_LANG_RC_CONFIG + ;; + + *) + AC_MSG_ERROR([Unsupported tag name: $tagname]) + ;; + esac + + # Append the new tag name to the list of available tags. + if test -n "$tagname" ; then + available_tags="$available_tags $tagname" + fi + fi + done + IFS="$lt_save_ifs" + + # Now substitute the updated list of available tags. + if eval "sed -e 's/^available_tags=.*\$/available_tags=\"$available_tags\"/' \"$ofile\" > \"${ofile}T\""; then + mv "${ofile}T" "$ofile" + chmod +x "$ofile" + else + rm -f "${ofile}T" + AC_MSG_ERROR([unable to update list of available tagged configurations.]) + fi +fi +])# _LT_AC_TAGCONFIG + + +# AC_LIBTOOL_DLOPEN +# ----------------- +# enable checks for dlopen support +AC_DEFUN([AC_LIBTOOL_DLOPEN], + [AC_BEFORE([$0],[AC_LIBTOOL_SETUP]) +])# AC_LIBTOOL_DLOPEN + + +# AC_LIBTOOL_WIN32_DLL +# -------------------- +# declare package support for building win32 DLLs +AC_DEFUN([AC_LIBTOOL_WIN32_DLL], +[AC_BEFORE([$0], [AC_LIBTOOL_SETUP]) +])# AC_LIBTOOL_WIN32_DLL + + +# AC_ENABLE_SHARED([DEFAULT]) +# --------------------------- +# implement the --enable-shared flag +# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. +AC_DEFUN([AC_ENABLE_SHARED], +[define([AC_ENABLE_SHARED_DEFAULT], ifelse($1, no, no, yes))dnl +AC_ARG_ENABLE([shared], + [AC_HELP_STRING([--enable-shared@<:@=PKGS@:>@], + [build shared libraries @<:@default=]AC_ENABLE_SHARED_DEFAULT[@:>@])], + [p=${PACKAGE-default} + case $enableval in + yes) enable_shared=yes ;; + no) enable_shared=no ;; + *) + enable_shared=no + # Look at the argument we got. We use all the common list separators. + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for pkg in $enableval; do + IFS="$lt_save_ifs" + if test "X$pkg" = "X$p"; then + enable_shared=yes + fi + done + IFS="$lt_save_ifs" + ;; + esac], + [enable_shared=]AC_ENABLE_SHARED_DEFAULT) +])# AC_ENABLE_SHARED + + +# AC_DISABLE_SHARED +# ----------------- +# set the default shared flag to --disable-shared +AC_DEFUN([AC_DISABLE_SHARED], +[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl +AC_ENABLE_SHARED(no) +])# AC_DISABLE_SHARED + + +# AC_ENABLE_STATIC([DEFAULT]) +# --------------------------- +# implement the --enable-static flag +# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. +AC_DEFUN([AC_ENABLE_STATIC], +[define([AC_ENABLE_STATIC_DEFAULT], ifelse($1, no, no, yes))dnl +AC_ARG_ENABLE([static], + [AC_HELP_STRING([--enable-static@<:@=PKGS@:>@], + [build static libraries @<:@default=]AC_ENABLE_STATIC_DEFAULT[@:>@])], + [p=${PACKAGE-default} + case $enableval in + yes) enable_static=yes ;; + no) enable_static=no ;; + *) + enable_static=no + # Look at the argument we got. We use all the common list separators. + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for pkg in $enableval; do + IFS="$lt_save_ifs" + if test "X$pkg" = "X$p"; then + enable_static=yes + fi + done + IFS="$lt_save_ifs" + ;; + esac], + [enable_static=]AC_ENABLE_STATIC_DEFAULT) +])# AC_ENABLE_STATIC + + +# AC_DISABLE_STATIC +# ----------------- +# set the default static flag to --disable-static +AC_DEFUN([AC_DISABLE_STATIC], +[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl +AC_ENABLE_STATIC(no) +])# AC_DISABLE_STATIC + + +# AC_ENABLE_FAST_INSTALL([DEFAULT]) +# --------------------------------- +# implement the --enable-fast-install flag +# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. +AC_DEFUN([AC_ENABLE_FAST_INSTALL], +[define([AC_ENABLE_FAST_INSTALL_DEFAULT], ifelse($1, no, no, yes))dnl +AC_ARG_ENABLE([fast-install], + [AC_HELP_STRING([--enable-fast-install@<:@=PKGS@:>@], + [optimize for fast installation @<:@default=]AC_ENABLE_FAST_INSTALL_DEFAULT[@:>@])], + [p=${PACKAGE-default} + case $enableval in + yes) enable_fast_install=yes ;; + no) enable_fast_install=no ;; + *) + enable_fast_install=no + # Look at the argument we got. We use all the common list separators. + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for pkg in $enableval; do + IFS="$lt_save_ifs" + if test "X$pkg" = "X$p"; then + enable_fast_install=yes + fi + done + IFS="$lt_save_ifs" + ;; + esac], + [enable_fast_install=]AC_ENABLE_FAST_INSTALL_DEFAULT) +])# AC_ENABLE_FAST_INSTALL + + +# AC_DISABLE_FAST_INSTALL +# ----------------------- +# set the default to --disable-fast-install +AC_DEFUN([AC_DISABLE_FAST_INSTALL], +[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl +AC_ENABLE_FAST_INSTALL(no) +])# AC_DISABLE_FAST_INSTALL + + +# AC_LIBTOOL_PICMODE([MODE]) +# -------------------------- +# implement the --with-pic flag +# MODE is either `yes' or `no'. If omitted, it defaults to `both'. +AC_DEFUN([AC_LIBTOOL_PICMODE], +[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl +pic_mode=ifelse($#,1,$1,default) +])# AC_LIBTOOL_PICMODE + + +# AC_PROG_EGREP +# ------------- +# This is predefined starting with Autoconf 2.54, so this conditional +# definition can be removed once we require Autoconf 2.54 or later. +m4_ifndef([AC_PROG_EGREP], [AC_DEFUN([AC_PROG_EGREP], +[AC_CACHE_CHECK([for egrep], [ac_cv_prog_egrep], + [if echo a | (grep -E '(a|b)') >/dev/null 2>&1 + then ac_cv_prog_egrep='grep -E' + else ac_cv_prog_egrep='egrep' + fi]) + EGREP=$ac_cv_prog_egrep + AC_SUBST([EGREP]) +])]) + + +# AC_PATH_TOOL_PREFIX +# ------------------- +# find a file program which can recognize shared library +AC_DEFUN([AC_PATH_TOOL_PREFIX], +[AC_REQUIRE([AC_PROG_EGREP])dnl +AC_MSG_CHECKING([for $1]) +AC_CACHE_VAL(lt_cv_path_MAGIC_CMD, +[case $MAGIC_CMD in +[[\\/*] | ?:[\\/]*]) + lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. + ;; +*) + lt_save_MAGIC_CMD="$MAGIC_CMD" + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR +dnl $ac_dummy forces splitting on constant user-supplied paths. +dnl POSIX.2 word splitting is done only on the output of word expansions, +dnl not every word. This closes a longstanding sh security hole. + ac_dummy="ifelse([$2], , $PATH, [$2])" + for ac_dir in $ac_dummy; do + IFS="$lt_save_ifs" + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$1; then + lt_cv_path_MAGIC_CMD="$ac_dir/$1" + if test -n "$file_magic_test_file"; then + case $deplibs_check_method in + "file_magic "*) + file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` + MAGIC_CMD="$lt_cv_path_MAGIC_CMD" + if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | + $EGREP "$file_magic_regex" > /dev/null; then + : + else + cat <&2 + +*** Warning: the command libtool uses to detect shared libraries, +*** $file_magic_cmd, produces output that libtool cannot recognize. +*** The result is that libtool may fail to recognize shared libraries +*** as such. This will affect the creation of libtool libraries that +*** depend on shared libraries, but programs linked with such libtool +*** libraries will work regardless of this problem. Nevertheless, you +*** may want to report the problem to your system manager and/or to +*** bug-libtool@gnu.org + +EOF + fi ;; + esac + fi + break + fi + done + IFS="$lt_save_ifs" + MAGIC_CMD="$lt_save_MAGIC_CMD" + ;; +esac]) +MAGIC_CMD="$lt_cv_path_MAGIC_CMD" +if test -n "$MAGIC_CMD"; then + AC_MSG_RESULT($MAGIC_CMD) +else + AC_MSG_RESULT(no) +fi +])# AC_PATH_TOOL_PREFIX + + +# AC_PATH_MAGIC +# ------------- +# find a file program which can recognize a shared library +AC_DEFUN([AC_PATH_MAGIC], +[AC_PATH_TOOL_PREFIX(${ac_tool_prefix}file, /usr/bin$PATH_SEPARATOR$PATH) +if test -z "$lt_cv_path_MAGIC_CMD"; then + if test -n "$ac_tool_prefix"; then + AC_PATH_TOOL_PREFIX(file, /usr/bin$PATH_SEPARATOR$PATH) + else + MAGIC_CMD=: + fi +fi +])# AC_PATH_MAGIC + + +# AC_PROG_LD +# ---------- +# find the pathname to the GNU or non-GNU linker +AC_DEFUN([AC_PROG_LD], +[AC_ARG_WITH([gnu-ld], + [AC_HELP_STRING([--with-gnu-ld], + [assume the C compiler uses GNU ld @<:@default=no@:>@])], + [test "$withval" = no || with_gnu_ld=yes], + [with_gnu_ld=no]) +AC_REQUIRE([LT_AC_PROG_SED])dnl +AC_REQUIRE([AC_PROG_CC])dnl +AC_REQUIRE([AC_CANONICAL_HOST])dnl +AC_REQUIRE([AC_CANONICAL_BUILD])dnl +ac_prog=ld +if test "$GCC" = yes; then + # Check if gcc -print-prog-name=ld gives a path. + AC_MSG_CHECKING([for ld used by $CC]) + case $host in + *-*-mingw*) + # gcc leaves a trailing carriage return which upsets mingw + ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; + *) + ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; + esac + case $ac_prog in + # Accept absolute paths. + [[\\/]]* | ?:[[\\/]]*) + re_direlt='/[[^/]][[^/]]*/\.\./' + # Canonicalize the pathname of ld + ac_prog=`echo $ac_prog| $SED 's%\\\\%/%g'` + while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do + ac_prog=`echo $ac_prog| $SED "s%$re_direlt%/%"` + done + test -z "$LD" && LD="$ac_prog" + ;; + "") + # If it fails, then pretend we aren't using GCC. + ac_prog=ld + ;; + *) + # If it is relative, then search for the first ld in PATH. + with_gnu_ld=unknown + ;; + esac +elif test "$with_gnu_ld" = yes; then + AC_MSG_CHECKING([for GNU ld]) +else + AC_MSG_CHECKING([for non-GNU ld]) +fi +AC_CACHE_VAL(lt_cv_path_LD, +[if test -z "$LD"; then + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + for ac_dir in $PATH; do + IFS="$lt_save_ifs" + test -z "$ac_dir" && ac_dir=. + if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then + lt_cv_path_LD="$ac_dir/$ac_prog" + # Check to see if the program is GNU ld. I'd rather use --version, + # but apparently some variants of GNU ld only accept -v. + # Break only if it was the GNU/non-GNU ld that we prefer. + case `"$lt_cv_path_LD" -v 2>&1 &1 /dev/null 2>&1; then + lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' + lt_cv_file_magic_cmd='func_win32_libid' + else + lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?' + lt_cv_file_magic_cmd='$OBJDUMP -f' + fi + ;; + +darwin* | rhapsody*) + lt_cv_deplibs_check_method=pass_all + ;; + +freebsd* | dragonfly*) + if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then + case $host_cpu in + i*86 ) + # Not sure whether the presence of OpenBSD here was a mistake. + # Let's accept both of them until this is cleared up. + lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[[3-9]]86 (compact )?demand paged shared library' + lt_cv_file_magic_cmd=/usr/bin/file + lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` + ;; + esac + else + lt_cv_deplibs_check_method=pass_all + fi + ;; + +gnu*) + lt_cv_deplibs_check_method=pass_all + ;; + +hpux10.20* | hpux11*) + lt_cv_file_magic_cmd=/usr/bin/file + case $host_cpu in + ia64*) + lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|ELF-[[0-9]][[0-9]]) shared object file - IA64' + lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so + ;; + hppa*64*) + [lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - PA-RISC [0-9].[0-9]'] + lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl + ;; + *) + lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|PA-RISC[[0-9]].[[0-9]]) shared library' + lt_cv_file_magic_test_file=/usr/lib/libc.sl + ;; + esac + ;; + +interix[[3-9]]*) + # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here + lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|\.a)$' + ;; + +irix5* | irix6* | nonstopux*) + case $LD in + *-32|*"-32 ") libmagic=32-bit;; + *-n32|*"-n32 ") libmagic=N32;; + *-64|*"-64 ") libmagic=64-bit;; + *) libmagic=never-match;; + esac + lt_cv_deplibs_check_method=pass_all + ;; + +# This must be Linux ELF. +linux* | k*bsd*-gnu) + lt_cv_deplibs_check_method=pass_all + ;; + +netbsd* | netbsdelf*-gnu) + if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then + lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$' + else + lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|_pic\.a)$' + fi + ;; + +newos6*) + lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (executable|dynamic lib)' + lt_cv_file_magic_cmd=/usr/bin/file + lt_cv_file_magic_test_file=/usr/lib/libnls.so + ;; + +nto-qnx*) + lt_cv_deplibs_check_method=unknown + ;; + +openbsd*) + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|\.so|_pic\.a)$' + else + lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$' + fi + ;; + +osf3* | osf4* | osf5*) + lt_cv_deplibs_check_method=pass_all + ;; + +rdos*) + lt_cv_deplibs_check_method=pass_all + ;; + +solaris*) + lt_cv_deplibs_check_method=pass_all + ;; + +sysv4 | sysv4.3*) + case $host_vendor in + motorola) + lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib) M[[0-9]][[0-9]]* Version [[0-9]]' + lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*` + ;; + ncr) + lt_cv_deplibs_check_method=pass_all + ;; + sequent) + lt_cv_file_magic_cmd='/bin/file' + lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB (shared object|dynamic lib )' + ;; + sni) + lt_cv_file_magic_cmd='/bin/file' + lt_cv_deplibs_check_method="file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB dynamic lib" + lt_cv_file_magic_test_file=/lib/libc.so + ;; + siemens) + lt_cv_deplibs_check_method=pass_all + ;; + pc) + lt_cv_deplibs_check_method=pass_all + ;; + esac + ;; + +sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) + lt_cv_deplibs_check_method=pass_all + ;; +esac +]) +file_magic_cmd=$lt_cv_file_magic_cmd +deplibs_check_method=$lt_cv_deplibs_check_method +test -z "$deplibs_check_method" && deplibs_check_method=unknown +])# AC_DEPLIBS_CHECK_METHOD + + +# AC_PROG_NM +# ---------- +# find the pathname to a BSD-compatible name lister +AC_DEFUN([AC_PROG_NM], +[AC_CACHE_CHECK([for BSD-compatible nm], lt_cv_path_NM, +[if test -n "$NM"; then + # Let the user override the test. + lt_cv_path_NM="$NM" +else + lt_nm_to_check="${ac_tool_prefix}nm" + if test -n "$ac_tool_prefix" && test "$build" = "$host"; then + lt_nm_to_check="$lt_nm_to_check nm" + fi + for lt_tmp_nm in $lt_nm_to_check; do + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do + IFS="$lt_save_ifs" + test -z "$ac_dir" && ac_dir=. + tmp_nm="$ac_dir/$lt_tmp_nm" + if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then + # Check to see if the nm accepts a BSD-compat flag. + # Adding the `sed 1q' prevents false positives on HP-UX, which says: + # nm: unknown option "B" ignored + # Tru64's nm complains that /dev/null is an invalid object file + case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in + */dev/null* | *'Invalid file or object type'*) + lt_cv_path_NM="$tmp_nm -B" + break + ;; + *) + case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in + */dev/null*) + lt_cv_path_NM="$tmp_nm -p" + break + ;; + *) + lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but + continue # so that we can try to find one that supports BSD flags + ;; + esac + ;; + esac + fi + done + IFS="$lt_save_ifs" + done + test -z "$lt_cv_path_NM" && lt_cv_path_NM=nm +fi]) +NM="$lt_cv_path_NM" +])# AC_PROG_NM + + +# AC_CHECK_LIBM +# ------------- +# check for math library +AC_DEFUN([AC_CHECK_LIBM], +[AC_REQUIRE([AC_CANONICAL_HOST])dnl +LIBM= +case $host in +*-*-beos* | *-*-cygwin* | *-*-pw32* | *-*-darwin*) + # These system don't have libm, or don't need it + ;; +*-ncr-sysv4.3*) + AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw") + AC_CHECK_LIB(m, cos, LIBM="$LIBM -lm") + ;; +*) + AC_CHECK_LIB(m, cos, LIBM="-lm") + ;; +esac +])# AC_CHECK_LIBM + + +# AC_LIBLTDL_CONVENIENCE([DIRECTORY]) +# ----------------------------------- +# sets LIBLTDL to the link flags for the libltdl convenience library and +# LTDLINCL to the include flags for the libltdl header and adds +# --enable-ltdl-convenience to the configure arguments. Note that +# AC_CONFIG_SUBDIRS is not called here. If DIRECTORY is not provided, +# it is assumed to be `libltdl'. LIBLTDL will be prefixed with +# '${top_builddir}/' and LTDLINCL will be prefixed with '${top_srcdir}/' +# (note the single quotes!). If your package is not flat and you're not +# using automake, define top_builddir and top_srcdir appropriately in +# the Makefiles. +AC_DEFUN([AC_LIBLTDL_CONVENIENCE], +[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl + case $enable_ltdl_convenience in + no) AC_MSG_ERROR([this package needs a convenience libltdl]) ;; + "") enable_ltdl_convenience=yes + ac_configure_args="$ac_configure_args --enable-ltdl-convenience" ;; + esac + LIBLTDL='${top_builddir}/'ifelse($#,1,[$1],['libltdl'])/libltdlc.la + LTDLINCL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl']) + # For backwards non-gettext consistent compatibility... + INCLTDL="$LTDLINCL" +])# AC_LIBLTDL_CONVENIENCE + + +# AC_LIBLTDL_INSTALLABLE([DIRECTORY]) +# ----------------------------------- +# sets LIBLTDL to the link flags for the libltdl installable library and +# LTDLINCL to the include flags for the libltdl header and adds +# --enable-ltdl-install to the configure arguments. Note that +# AC_CONFIG_SUBDIRS is not called here. If DIRECTORY is not provided, +# and an installed libltdl is not found, it is assumed to be `libltdl'. +# LIBLTDL will be prefixed with '${top_builddir}/'# and LTDLINCL with +# '${top_srcdir}/' (note the single quotes!). If your package is not +# flat and you're not using automake, define top_builddir and top_srcdir +# appropriately in the Makefiles. +# In the future, this macro may have to be called after AC_PROG_LIBTOOL. +AC_DEFUN([AC_LIBLTDL_INSTALLABLE], +[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl + AC_CHECK_LIB(ltdl, lt_dlinit, + [test x"$enable_ltdl_install" != xyes && enable_ltdl_install=no], + [if test x"$enable_ltdl_install" = xno; then + AC_MSG_WARN([libltdl not installed, but installation disabled]) + else + enable_ltdl_install=yes + fi + ]) + if test x"$enable_ltdl_install" = x"yes"; then + ac_configure_args="$ac_configure_args --enable-ltdl-install" + LIBLTDL='${top_builddir}/'ifelse($#,1,[$1],['libltdl'])/libltdl.la + LTDLINCL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl']) + else + ac_configure_args="$ac_configure_args --enable-ltdl-install=no" + LIBLTDL="-lltdl" + LTDLINCL= + fi + # For backwards non-gettext consistent compatibility... + INCLTDL="$LTDLINCL" +])# AC_LIBLTDL_INSTALLABLE + + +# AC_LIBTOOL_CXX +# -------------- +# enable support for C++ libraries +AC_DEFUN([AC_LIBTOOL_CXX], +[AC_REQUIRE([_LT_AC_LANG_CXX]) +])# AC_LIBTOOL_CXX + + +# _LT_AC_LANG_CXX +# --------------- +AC_DEFUN([_LT_AC_LANG_CXX], +[AC_REQUIRE([AC_PROG_CXX]) +AC_REQUIRE([_LT_AC_PROG_CXXCPP]) +_LT_AC_SHELL_INIT([tagnames=${tagnames+${tagnames},}CXX]) +])# _LT_AC_LANG_CXX + +# _LT_AC_PROG_CXXCPP +# ------------------ +AC_DEFUN([_LT_AC_PROG_CXXCPP], +[ +AC_REQUIRE([AC_PROG_CXX]) +if test -n "$CXX" && ( test "X$CXX" != "Xno" && + ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) || + (test "X$CXX" != "Xg++"))) ; then + AC_PROG_CXXCPP +fi +])# _LT_AC_PROG_CXXCPP + +# AC_LIBTOOL_F77 +# -------------- +# enable support for Fortran 77 libraries +AC_DEFUN([AC_LIBTOOL_F77], +[AC_REQUIRE([_LT_AC_LANG_F77]) +])# AC_LIBTOOL_F77 + + +# _LT_AC_LANG_F77 +# --------------- +AC_DEFUN([_LT_AC_LANG_F77], +[AC_REQUIRE([AC_PROG_F77]) +_LT_AC_SHELL_INIT([tagnames=${tagnames+${tagnames},}F77]) +])# _LT_AC_LANG_F77 + + +# AC_LIBTOOL_GCJ +# -------------- +# enable support for GCJ libraries +AC_DEFUN([AC_LIBTOOL_GCJ], +[AC_REQUIRE([_LT_AC_LANG_GCJ]) +])# AC_LIBTOOL_GCJ + + +# _LT_AC_LANG_GCJ +# --------------- +AC_DEFUN([_LT_AC_LANG_GCJ], +[AC_PROVIDE_IFELSE([AC_PROG_GCJ],[], + [AC_PROVIDE_IFELSE([A][M_PROG_GCJ],[], + [AC_PROVIDE_IFELSE([LT_AC_PROG_GCJ],[], + [ifdef([AC_PROG_GCJ],[AC_REQUIRE([AC_PROG_GCJ])], + [ifdef([A][M_PROG_GCJ],[AC_REQUIRE([A][M_PROG_GCJ])], + [AC_REQUIRE([A][C_PROG_GCJ_OR_A][M_PROG_GCJ])])])])])]) +_LT_AC_SHELL_INIT([tagnames=${tagnames+${tagnames},}GCJ]) +])# _LT_AC_LANG_GCJ + + +# AC_LIBTOOL_RC +# ------------- +# enable support for Windows resource files +AC_DEFUN([AC_LIBTOOL_RC], +[AC_REQUIRE([LT_AC_PROG_RC]) +_LT_AC_SHELL_INIT([tagnames=${tagnames+${tagnames},}RC]) +])# AC_LIBTOOL_RC + + +# AC_LIBTOOL_LANG_C_CONFIG +# ------------------------ +# Ensure that the configuration vars for the C compiler are +# suitably defined. Those variables are subsequently used by +# AC_LIBTOOL_CONFIG to write the compiler configuration to `libtool'. +AC_DEFUN([AC_LIBTOOL_LANG_C_CONFIG], [_LT_AC_LANG_C_CONFIG]) +AC_DEFUN([_LT_AC_LANG_C_CONFIG], +[lt_save_CC="$CC" +AC_LANG_PUSH(C) + +# Source file extension for C test sources. +ac_ext=c + +# Object file extension for compiled C test sources. +objext=o +_LT_AC_TAGVAR(objext, $1)=$objext + +# Code to be used in simple compile tests +lt_simple_compile_test_code="int some_variable = 0;" + +# Code to be used in simple link tests +lt_simple_link_test_code='int main(){return(0);}' + +_LT_AC_SYS_COMPILER + +# save warnings/boilerplate of simple test code +_LT_COMPILER_BOILERPLATE +_LT_LINKER_BOILERPLATE + +AC_LIBTOOL_PROG_COMPILER_NO_RTTI($1) +AC_LIBTOOL_PROG_COMPILER_PIC($1) +AC_LIBTOOL_PROG_CC_C_O($1) +AC_LIBTOOL_SYS_HARD_LINK_LOCKS($1) +AC_LIBTOOL_PROG_LD_SHLIBS($1) +AC_LIBTOOL_SYS_DYNAMIC_LINKER($1) +AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH($1) +AC_LIBTOOL_SYS_LIB_STRIP +AC_LIBTOOL_DLOPEN_SELF + +# Report which library types will actually be built +AC_MSG_CHECKING([if libtool supports shared libraries]) +AC_MSG_RESULT([$can_build_shared]) + +AC_MSG_CHECKING([whether to build shared libraries]) +test "$can_build_shared" = "no" && enable_shared=no + +# On AIX, shared libraries and static libraries use the same namespace, and +# are all built from PIC. +case $host_os in +aix3*) + test "$enable_shared" = yes && enable_static=no + if test -n "$RANLIB"; then + archive_cmds="$archive_cmds~\$RANLIB \$lib" + postinstall_cmds='$RANLIB $lib' + fi + ;; + +aix4* | aix5*) + if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then + test "$enable_shared" = yes && enable_static=no + fi + ;; +esac +AC_MSG_RESULT([$enable_shared]) + +AC_MSG_CHECKING([whether to build static libraries]) +# Make sure either enable_shared or enable_static is yes. +test "$enable_shared" = yes || enable_static=yes +AC_MSG_RESULT([$enable_static]) + +AC_LIBTOOL_CONFIG($1) + +AC_LANG_POP +CC="$lt_save_CC" +])# AC_LIBTOOL_LANG_C_CONFIG + + +# AC_LIBTOOL_LANG_CXX_CONFIG +# -------------------------- +# Ensure that the configuration vars for the C compiler are +# suitably defined. Those variables are subsequently used by +# AC_LIBTOOL_CONFIG to write the compiler configuration to `libtool'. +AC_DEFUN([AC_LIBTOOL_LANG_CXX_CONFIG], [_LT_AC_LANG_CXX_CONFIG(CXX)]) +AC_DEFUN([_LT_AC_LANG_CXX_CONFIG], +[AC_LANG_PUSH(C++) +AC_REQUIRE([AC_PROG_CXX]) +AC_REQUIRE([_LT_AC_PROG_CXXCPP]) + +_LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no +_LT_AC_TAGVAR(allow_undefined_flag, $1)= +_LT_AC_TAGVAR(always_export_symbols, $1)=no +_LT_AC_TAGVAR(archive_expsym_cmds, $1)= +_LT_AC_TAGVAR(export_dynamic_flag_spec, $1)= +_LT_AC_TAGVAR(hardcode_direct, $1)=no +_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)= +_LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)= +_LT_AC_TAGVAR(hardcode_libdir_separator, $1)= +_LT_AC_TAGVAR(hardcode_minus_L, $1)=no +_LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported +_LT_AC_TAGVAR(hardcode_automatic, $1)=no +_LT_AC_TAGVAR(module_cmds, $1)= +_LT_AC_TAGVAR(module_expsym_cmds, $1)= +_LT_AC_TAGVAR(link_all_deplibs, $1)=unknown +_LT_AC_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds +_LT_AC_TAGVAR(no_undefined_flag, $1)= +_LT_AC_TAGVAR(whole_archive_flag_spec, $1)= +_LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=no + +# Dependencies to place before and after the object being linked: +_LT_AC_TAGVAR(predep_objects, $1)= +_LT_AC_TAGVAR(postdep_objects, $1)= +_LT_AC_TAGVAR(predeps, $1)= +_LT_AC_TAGVAR(postdeps, $1)= +_LT_AC_TAGVAR(compiler_lib_search_path, $1)= + +# Source file extension for C++ test sources. +ac_ext=cpp + +# Object file extension for compiled C++ test sources. +objext=o +_LT_AC_TAGVAR(objext, $1)=$objext + +# Code to be used in simple compile tests +lt_simple_compile_test_code="int some_variable = 0;" + +# Code to be used in simple link tests +lt_simple_link_test_code='int main(int, char *[[]]) { return(0); }' + +# ltmain only uses $CC for tagged configurations so make sure $CC is set. +_LT_AC_SYS_COMPILER + +# save warnings/boilerplate of simple test code +_LT_COMPILER_BOILERPLATE +_LT_LINKER_BOILERPLATE + +# Allow CC to be a program name with arguments. +lt_save_CC=$CC +lt_save_LD=$LD +lt_save_GCC=$GCC +GCC=$GXX +lt_save_with_gnu_ld=$with_gnu_ld +lt_save_path_LD=$lt_cv_path_LD +if test -n "${lt_cv_prog_gnu_ldcxx+set}"; then + lt_cv_prog_gnu_ld=$lt_cv_prog_gnu_ldcxx +else + $as_unset lt_cv_prog_gnu_ld +fi +if test -n "${lt_cv_path_LDCXX+set}"; then + lt_cv_path_LD=$lt_cv_path_LDCXX +else + $as_unset lt_cv_path_LD +fi +test -z "${LDCXX+set}" || LD=$LDCXX +CC=${CXX-"c++"} +compiler=$CC +_LT_AC_TAGVAR(compiler, $1)=$CC +_LT_CC_BASENAME([$compiler]) + +# We don't want -fno-exception wen compiling C++ code, so set the +# no_builtin_flag separately +if test "$GXX" = yes; then + _LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' +else + _LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)= +fi + +if test "$GXX" = yes; then + # Set up default GNU C++ configuration + + AC_PROG_LD + + # Check if GNU C++ uses GNU ld as the underlying linker, since the + # archiving commands below assume that GNU ld is being used. + if test "$with_gnu_ld" = yes; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir' + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' + + # If archive_cmds runs LD, not CC, wlarc should be empty + # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to + # investigate it a little bit more. (MM) + wlarc='${wl}' + + # ancient GNU ld didn't support --whole-archive et. al. + if eval "`$CC -print-prog-name=ld` --help 2>&1" | \ + grep 'no-whole-archive' > /dev/null; then + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + else + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)= + fi + else + with_gnu_ld=no + wlarc= + + # A generic and very simple default shared library creation + # command for GNU C++ for the case where it uses the native + # linker, instead of GNU ld. If possible, this setting should + # overridden to take advantage of the native linker features on + # the platform it is being used on. + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' + fi + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"' + +else + GXX=no + with_gnu_ld=no + wlarc= +fi + +# PORTME: fill in a description of your system's C++ link characteristics +AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries]) +_LT_AC_TAGVAR(ld_shlibs, $1)=yes +case $host_os in + aix3*) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + aix4* | aix5*) + if test "$host_cpu" = ia64; then + # On IA64, the linker does run time linking by default, so we don't + # have to do anything special. + aix_use_runtimelinking=no + exp_sym_flag='-Bexport' + no_entry_flag="" + else + aix_use_runtimelinking=no + + # Test if we are trying to use run time linking or normal + # AIX style linking. If -brtl is somewhere in LDFLAGS, we + # need to do runtime linking. + case $host_os in aix4.[[23]]|aix4.[[23]].*|aix5*) + for ld_flag in $LDFLAGS; do + case $ld_flag in + *-brtl*) + aix_use_runtimelinking=yes + break + ;; + esac + done + ;; + esac + + exp_sym_flag='-bexport' + no_entry_flag='-bnoentry' + fi + + # When large executables or shared objects are built, AIX ld can + # have problems creating the table of contents. If linking a library + # or program results in "error TOC overflow" add -mminimal-toc to + # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not + # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. + + _LT_AC_TAGVAR(archive_cmds, $1)='' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=':' + _LT_AC_TAGVAR(link_all_deplibs, $1)=yes + + if test "$GXX" = yes; then + case $host_os in aix4.[[012]]|aix4.[[012]].*) + # We only want to do this on AIX 4.2 and lower, the check + # below for broken collect2 doesn't work under 4.3+ + collect2name=`${CC} -print-prog-name=collect2` + if test -f "$collect2name" && \ + strings "$collect2name" | grep resolve_lib_name >/dev/null + then + # We have reworked collect2 + : + else + # We have old collect2 + _LT_AC_TAGVAR(hardcode_direct, $1)=unsupported + # It fails to find uninstalled libraries when the uninstalled + # path is not listed in the libpath. Setting hardcode_minus_L + # to unsupported forces relinking + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)= + fi + ;; + esac + shared_flag='-shared' + if test "$aix_use_runtimelinking" = yes; then + shared_flag="$shared_flag "'${wl}-G' + fi + else + # not using gcc + if test "$host_cpu" = ia64; then + # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release + # chokes on -Wl,-G. The following line is correct: + shared_flag='-G' + else + if test "$aix_use_runtimelinking" = yes; then + shared_flag='${wl}-G' + else + shared_flag='${wl}-bM:SRE' + fi + fi + fi + + # It seems that -bexpall does not export symbols beginning with + # underscore (_), so it is better to generate a list of symbols to export. + _LT_AC_TAGVAR(always_export_symbols, $1)=yes + if test "$aix_use_runtimelinking" = yes; then + # Warning - without using the other runtime loading flags (-brtl), + # -berok will link without error, but may produce a broken library. + _LT_AC_TAGVAR(allow_undefined_flag, $1)='-berok' + # Determine the default libpath from the value encoded in an empty executable. + _LT_AC_SYS_LIBPATH_AIX + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" + + _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" + else + if test "$host_cpu" = ia64; then + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib' + _LT_AC_TAGVAR(allow_undefined_flag, $1)="-z nodefs" + _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" + else + # Determine the default libpath from the value encoded in an empty executable. + _LT_AC_SYS_LIBPATH_AIX + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" + # Warning - without using the other run time loading flags, + # -berok will link without error, but may produce a broken library. + _LT_AC_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok' + _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok' + # Exported symbols can be pulled into shared objects from archives + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='$convenience' + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes + # This is similar to how AIX traditionally builds its shared libraries. + _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' + fi + fi + ;; + + beos*) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported + # Joseph Beckenbach says some releases of gcc + # support --undefined. This deserves some investigation. FIXME + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + else + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; + + chorus*) + case $cc_basename in + *) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + esac + ;; + + cygwin* | mingw* | pw32*) + # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, + # as there is no search path for DLLs. + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported + _LT_AC_TAGVAR(always_export_symbols, $1)=no + _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=yes + + if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' + # If the export-symbols file already is a .def file (1st line + # is EXPORTS), use it as is; otherwise, prepend... + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then + cp $export_symbols $output_objdir/$soname.def; + else + echo EXPORTS > $output_objdir/$soname.def; + cat $export_symbols >> $output_objdir/$soname.def; + fi~ + $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' + else + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; + darwin* | rhapsody*) + case $host_os in + rhapsody* | darwin1.[[012]]) + _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-undefined ${wl}suppress' + ;; + *) # Darwin 1.3 on + if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then + _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' + else + case ${MACOSX_DEPLOYMENT_TARGET} in + 10.[[012]]) + _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' + ;; + 10.*) + _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-undefined ${wl}dynamic_lookup' + ;; + esac + fi + ;; + esac + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no + _LT_AC_TAGVAR(hardcode_direct, $1)=no + _LT_AC_TAGVAR(hardcode_automatic, $1)=yes + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='' + _LT_AC_TAGVAR(link_all_deplibs, $1)=yes + + if test "$GXX" = yes ; then + lt_int_apple_cc_single_mod=no + output_verbose_link_cmd='echo' + if $CC -dumpspecs 2>&1 | $EGREP 'single_module' >/dev/null ; then + lt_int_apple_cc_single_mod=yes + fi + if test "X$lt_int_apple_cc_single_mod" = Xyes ; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring' + else + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -r -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring' + fi + _LT_AC_TAGVAR(module_cmds, $1)='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' + # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds + if test "X$lt_int_apple_cc_single_mod" = Xyes ; then + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + else + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -r -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + fi + _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + else + case $cc_basename in + xlc*) + output_verbose_link_cmd='echo' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -qmkshrobj ${wl}-single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $xlcverstring' + _LT_AC_TAGVAR(module_cmds, $1)='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' + # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj ${wl}-single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $xlcverstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + ;; + *) + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + esac + fi + ;; + + dgux*) + case $cc_basename in + ec++*) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + ghcx*) + # Green Hills C++ Compiler + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + *) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + esac + ;; + freebsd[[12]]*) + # C++ shared libraries reported to be fairly broken before switch to ELF + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + freebsd-elf*) + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no + ;; + freebsd* | dragonfly*) + # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF + # conventions + _LT_AC_TAGVAR(ld_shlibs, $1)=yes + ;; + gnu*) + ;; + hpux9*) + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, + # but as the default + # location of the library. + + case $cc_basename in + CC*) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + aCC*) + _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$CC -b ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | grep "[[-]]L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' + ;; + *) + if test "$GXX" = yes; then + _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$CC -shared -nostdlib -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + else + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; + esac + ;; + hpux10*|hpux11*) + if test $with_gnu_ld = no; then + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + + case $host_cpu in + hppa*64*|ia64*) ;; + *) + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' + ;; + esac + fi + case $host_cpu in + hppa*64*|ia64*) + _LT_AC_TAGVAR(hardcode_direct, $1)=no + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + *) + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, + # but as the default + # location of the library. + ;; + esac + + case $cc_basename in + CC*) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + aCC*) + case $host_cpu in + hppa*64*) + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + ia64*) + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + *) + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + esac + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | grep "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' + ;; + *) + if test "$GXX" = yes; then + if test $with_gnu_ld = no; then + case $host_cpu in + hppa*64*) + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + ia64*) + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + *) + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + esac + fi + else + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; + esac + ;; + interix[[3-9]]*) + _LT_AC_TAGVAR(hardcode_direct, $1)=no + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' + # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. + # Instead, shared libraries are loaded at an image base (0x10000000 by + # default) and relocated if they conflict, which is a slow very memory + # consuming and fragmenting process. To avoid this, we pick a random, + # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link + # time. Moving up from 0x10000000 also allows more sbrk(2) space. + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' + ;; + irix5* | irix6*) + case $cc_basename in + CC*) + # SGI C++ + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + + # Archives containing C++ object files must be created using + # "CC -ar", where "CC" is the IRIX C++ compiler. This is + # necessary to make sure instantiated templates are included + # in the archive. + _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -ar -WR,-u -o $oldlib $oldobjs' + ;; + *) + if test "$GXX" = yes; then + if test "$with_gnu_ld" = no; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + else + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` -o $lib' + fi + fi + _LT_AC_TAGVAR(link_all_deplibs, $1)=yes + ;; + esac + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + ;; + linux* | k*bsd*-gnu) + case $cc_basename in + KCC*) + # Kuck and Associates, Inc. (KAI) C++ Compiler + + # KCC will only create a shared library if the output file + # ends with ".so" (or ".sl" for HP-UX), so rename the library + # to its proper name (with version) after linking. + _LT_AC_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib ${wl}-retain-symbols-file,$export_symbols; mv \$templib $lib' + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | grep "ld"`; rm -f libconftest$shared_ext; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' + + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath,$libdir' + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' + + # Archives containing C++ object files must be created using + # "CC -Bstatic", where "CC" is the KAI C++ compiler. + _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' + ;; + icpc*) + # Intel C++ + with_gnu_ld=yes + # version 8.0 and above of icpc choke on multiply defined symbols + # if we add $predep_objects and $postdep_objects, however 7.1 and + # earlier do not add the objects themselves. + case `$CC -V 2>&1` in + *"Version 7."*) + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + ;; + *) # Version 8.0 or newer + tmp_idyn= + case $host_cpu in + ia64*) tmp_idyn=' -i_dynamic';; + esac + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + ;; + esac + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive' + ;; + pgCC*) + # Portland Group C++ compiler + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib' + + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir' + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' + ;; + cxx*) + # Compaq C++ + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib ${wl}-retain-symbols-file $wl$export_symbols' + + runpath_var=LD_RUN_PATH + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' + ;; + *) + case `$CC -V 2>&1 | sed 5q` in + *Sun\ C*) + # Sun C++ 5.9 + _LT_AC_TAGVAR(no_undefined_flag, $1)=' -zdefs' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file ${wl}$export_symbols' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' + + # Not sure whether something based on + # $CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 + # would be better. + output_verbose_link_cmd='echo' + + # Archives containing C++ object files must be created using + # "CC -xar", where "CC" is the Sun C++ compiler. This is + # necessary to make sure instantiated templates are included + # in the archive. + _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs' + ;; + esac + ;; + esac + ;; + lynxos*) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + m88k*) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + mvs*) + case $cc_basename in + cxx*) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + *) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + esac + ;; + netbsd* | netbsdelf*-gnu) + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags' + wlarc= + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + fi + # Workaround some broken pre-1.5 toolchains + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep conftest.$objext | $SED -e "s:-lgcc -lc -lgcc::"' + ;; + openbsd2*) + # C++ shared libraries are fairly broken + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + openbsd*) + if test -f /usr/libexec/ld.so; then + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file,$export_symbols -o $lib' + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + fi + output_verbose_link_cmd='echo' + else + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; + osf3*) + case $cc_basename in + KCC*) + # Kuck and Associates, Inc. (KAI) C++ Compiler + + # KCC will only create a shared library if the output file + # ends with ".so" (or ".sl" for HP-UX), so rename the library + # to its proper name (with version) after linking. + _LT_AC_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' + + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + + # Archives containing C++ object files must be created using + # "CC -Bstatic", where "CC" is the KAI C++ compiler. + _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' + + ;; + RCC*) + # Rational C++ 2.4.1 + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + cxx*) + _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && echo ${wl}-set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld" | grep -v "ld:"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' + ;; + *) + if test "$GXX" = yes && test "$with_gnu_ld" = no; then + _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"' + + else + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; + esac + ;; + osf4* | osf5*) + case $cc_basename in + KCC*) + # Kuck and Associates, Inc. (KAI) C++ Compiler + + # KCC will only create a shared library if the output file + # ends with ".so" (or ".sl" for HP-UX), so rename the library + # to its proper name (with version) after linking. + _LT_AC_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' + + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + + # Archives containing C++ object files must be created using + # the KAI C++ compiler. + _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -o $oldlib $oldobjs' + ;; + RCC*) + # Rational C++ 2.4.1 + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + cxx*) + _LT_AC_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~ + echo "-hidden">> $lib.exp~ + $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname -Wl,-input -Wl,$lib.exp `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib~ + $rm $lib.exp' + + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld" | grep -v "ld:"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' + ;; + *) + if test "$GXX" = yes && test "$with_gnu_ld" = no; then + _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"' + + else + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; + esac + ;; + psos*) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + sunos4*) + case $cc_basename in + CC*) + # Sun C++ 4.x + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + lcc*) + # Lucid + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + *) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + esac + ;; + solaris*) + case $cc_basename in + CC*) + # Sun C++ 4.2, 5.x and Centerline C++ + _LT_AC_TAGVAR(archive_cmds_need_lc,$1)=yes + _LT_AC_TAGVAR(no_undefined_flag, $1)=' -zdefs' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $CC -G${allow_undefined_flag} ${wl}-M ${wl}$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp' + + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + case $host_os in + solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; + *) + # The compiler driver will combine and reorder linker options, + # but understands `-z linker_flag'. + # Supported since Solaris 2.6 (maybe 2.5.1?) + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract' + ;; + esac + _LT_AC_TAGVAR(link_all_deplibs, $1)=yes + + output_verbose_link_cmd='echo' + + # Archives containing C++ object files must be created using + # "CC -xar", where "CC" is the Sun C++ compiler. This is + # necessary to make sure instantiated templates are included + # in the archive. + _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs' + ;; + gcx*) + # Green Hills C++ Compiler + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' + + # The C++ compiler must be used to create the archive. + _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC $LDFLAGS -archive -o $oldlib $oldobjs' + ;; + *) + # GNU C++ compiler with Solaris linker + if test "$GXX" = yes && test "$with_gnu_ld" = no; then + _LT_AC_TAGVAR(no_undefined_flag, $1)=' ${wl}-z ${wl}defs' + if $CC --version | grep -v '^2\.7' > /dev/null; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $CC -shared -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp' + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd="$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep \"\-L\"" + else + # g++ 2.7 appears to require `-G' NOT `-shared' on this + # platform. + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $CC -G -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp' + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd="$CC -G $CFLAGS -v conftest.$objext 2>&1 | grep \"\-L\"" + fi + + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $wl$libdir' + case $host_os in + solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; + *) + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' + ;; + esac + fi + ;; + esac + ;; + sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*) + _LT_AC_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + runpath_var='LD_RUN_PATH' + + case $cc_basename in + CC*) + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + *) + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + esac + ;; + sysv5* | sco3.2v5* | sco5v6*) + # Note: We can NOT use -z defs as we might desire, because we do not + # link with -lc, and that would cause any symbols used from libc to + # always be unresolved, which means just about no library would + # ever link correctly. If we're not using GNU ld we use -z text + # though, which does catch some bad symbols but isn't as heavy-handed + # as -z defs. + # For security reasons, it is highly recommended that you always + # use absolute paths for naming shared libraries, and exclude the + # DT_RUNPATH tag from executables and libraries. But doing so + # requires that you compile everything twice, which is a pain. + # So that behaviour is only enabled if SCOABSPATH is set to a + # non-empty value in the environment. Most likely only useful for + # creating official distributions of packages. + # This is a hack until libtool officially supports absolute path + # names for shared libraries. + _LT_AC_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' + _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-z,nodefs' + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='`test -z "$SCOABSPATH" && echo ${wl}-R,$libdir`' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=':' + _LT_AC_TAGVAR(link_all_deplibs, $1)=yes + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport' + runpath_var='LD_RUN_PATH' + + case $cc_basename in + CC*) + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + *) + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + esac + ;; + tandem*) + case $cc_basename in + NCC*) + # NonStop-UX NCC 3.20 + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + *) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + esac + ;; + vxworks*) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + *) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; +esac +AC_MSG_RESULT([$_LT_AC_TAGVAR(ld_shlibs, $1)]) +test "$_LT_AC_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no + +_LT_AC_TAGVAR(GCC, $1)="$GXX" +_LT_AC_TAGVAR(LD, $1)="$LD" + +AC_LIBTOOL_POSTDEP_PREDEP($1) +AC_LIBTOOL_PROG_COMPILER_PIC($1) +AC_LIBTOOL_PROG_CC_C_O($1) +AC_LIBTOOL_SYS_HARD_LINK_LOCKS($1) +AC_LIBTOOL_PROG_LD_SHLIBS($1) +AC_LIBTOOL_SYS_DYNAMIC_LINKER($1) +AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH($1) + +AC_LIBTOOL_CONFIG($1) + +AC_LANG_POP +CC=$lt_save_CC +LDCXX=$LD +LD=$lt_save_LD +GCC=$lt_save_GCC +with_gnu_ldcxx=$with_gnu_ld +with_gnu_ld=$lt_save_with_gnu_ld +lt_cv_path_LDCXX=$lt_cv_path_LD +lt_cv_path_LD=$lt_save_path_LD +lt_cv_prog_gnu_ldcxx=$lt_cv_prog_gnu_ld +lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld +])# AC_LIBTOOL_LANG_CXX_CONFIG + +# AC_LIBTOOL_POSTDEP_PREDEP([TAGNAME]) +# ------------------------------------ +# Figure out "hidden" library dependencies from verbose +# compiler output when linking a shared library. +# Parse the compiler output and extract the necessary +# objects, libraries and library flags. +AC_DEFUN([AC_LIBTOOL_POSTDEP_PREDEP],[ +dnl we can't use the lt_simple_compile_test_code here, +dnl because it contains code intended for an executable, +dnl not a library. It's possible we should let each +dnl tag define a new lt_????_link_test_code variable, +dnl but it's only used here... +ifelse([$1],[],[cat > conftest.$ac_ext < conftest.$ac_ext < conftest.$ac_ext < conftest.$ac_ext <&1 | sed 5q` in + *Sun\ C*) + # Sun C++ 5.9 + # + # The more standards-conforming stlport4 library is + # incompatible with the Cstd library. Avoid specifying + # it if it's in CXXFLAGS. Ignore libCrun as + # -library=stlport4 depends on it. + case " $CXX $CXXFLAGS " in + *" -library=stlport4 "*) + solaris_use_stlport4=yes + ;; + esac + if test "$solaris_use_stlport4" != yes; then + _LT_AC_TAGVAR(postdeps,$1)='-library=Cstd -library=Crun' + fi + ;; + esac + ;; + +solaris*) + case $cc_basename in + CC*) + # The more standards-conforming stlport4 library is + # incompatible with the Cstd library. Avoid specifying + # it if it's in CXXFLAGS. Ignore libCrun as + # -library=stlport4 depends on it. + case " $CXX $CXXFLAGS " in + *" -library=stlport4 "*) + solaris_use_stlport4=yes + ;; + esac + + # Adding this requires a known-good setup of shared libraries for + # Sun compiler versions before 5.6, else PIC objects from an old + # archive will be linked into the output, leading to subtle bugs. + if test "$solaris_use_stlport4" != yes; then + _LT_AC_TAGVAR(postdeps,$1)='-library=Cstd -library=Crun' + fi + ;; + esac + ;; +esac +]) + +case " $_LT_AC_TAGVAR(postdeps, $1) " in +*" -lc "*) _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no ;; +esac +])# AC_LIBTOOL_POSTDEP_PREDEP + +# AC_LIBTOOL_LANG_F77_CONFIG +# -------------------------- +# Ensure that the configuration vars for the C compiler are +# suitably defined. Those variables are subsequently used by +# AC_LIBTOOL_CONFIG to write the compiler configuration to `libtool'. +AC_DEFUN([AC_LIBTOOL_LANG_F77_CONFIG], [_LT_AC_LANG_F77_CONFIG(F77)]) +AC_DEFUN([_LT_AC_LANG_F77_CONFIG], +[AC_REQUIRE([AC_PROG_F77]) +AC_LANG_PUSH(Fortran 77) + +_LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no +_LT_AC_TAGVAR(allow_undefined_flag, $1)= +_LT_AC_TAGVAR(always_export_symbols, $1)=no +_LT_AC_TAGVAR(archive_expsym_cmds, $1)= +_LT_AC_TAGVAR(export_dynamic_flag_spec, $1)= +_LT_AC_TAGVAR(hardcode_direct, $1)=no +_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)= +_LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)= +_LT_AC_TAGVAR(hardcode_libdir_separator, $1)= +_LT_AC_TAGVAR(hardcode_minus_L, $1)=no +_LT_AC_TAGVAR(hardcode_automatic, $1)=no +_LT_AC_TAGVAR(module_cmds, $1)= +_LT_AC_TAGVAR(module_expsym_cmds, $1)= +_LT_AC_TAGVAR(link_all_deplibs, $1)=unknown +_LT_AC_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds +_LT_AC_TAGVAR(no_undefined_flag, $1)= +_LT_AC_TAGVAR(whole_archive_flag_spec, $1)= +_LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=no + +# Source file extension for f77 test sources. +ac_ext=f + +# Object file extension for compiled f77 test sources. +objext=o +_LT_AC_TAGVAR(objext, $1)=$objext + +# Code to be used in simple compile tests +lt_simple_compile_test_code="\ + subroutine t + return + end +" + +# Code to be used in simple link tests +lt_simple_link_test_code="\ + program t + end +" + +# ltmain only uses $CC for tagged configurations so make sure $CC is set. +_LT_AC_SYS_COMPILER + +# save warnings/boilerplate of simple test code +_LT_COMPILER_BOILERPLATE +_LT_LINKER_BOILERPLATE + +# Allow CC to be a program name with arguments. +lt_save_CC="$CC" +CC=${F77-"f77"} +compiler=$CC +_LT_AC_TAGVAR(compiler, $1)=$CC +_LT_CC_BASENAME([$compiler]) + +AC_MSG_CHECKING([if libtool supports shared libraries]) +AC_MSG_RESULT([$can_build_shared]) + +AC_MSG_CHECKING([whether to build shared libraries]) +test "$can_build_shared" = "no" && enable_shared=no + +# On AIX, shared libraries and static libraries use the same namespace, and +# are all built from PIC. +case $host_os in +aix3*) + test "$enable_shared" = yes && enable_static=no + if test -n "$RANLIB"; then + archive_cmds="$archive_cmds~\$RANLIB \$lib" + postinstall_cmds='$RANLIB $lib' + fi + ;; +aix4* | aix5*) + if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then + test "$enable_shared" = yes && enable_static=no + fi + ;; +esac +AC_MSG_RESULT([$enable_shared]) + +AC_MSG_CHECKING([whether to build static libraries]) +# Make sure either enable_shared or enable_static is yes. +test "$enable_shared" = yes || enable_static=yes +AC_MSG_RESULT([$enable_static]) + +_LT_AC_TAGVAR(GCC, $1)="$G77" +_LT_AC_TAGVAR(LD, $1)="$LD" + +AC_LIBTOOL_PROG_COMPILER_PIC($1) +AC_LIBTOOL_PROG_CC_C_O($1) +AC_LIBTOOL_SYS_HARD_LINK_LOCKS($1) +AC_LIBTOOL_PROG_LD_SHLIBS($1) +AC_LIBTOOL_SYS_DYNAMIC_LINKER($1) +AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH($1) + +AC_LIBTOOL_CONFIG($1) + +AC_LANG_POP +CC="$lt_save_CC" +])# AC_LIBTOOL_LANG_F77_CONFIG + + +# AC_LIBTOOL_LANG_GCJ_CONFIG +# -------------------------- +# Ensure that the configuration vars for the C compiler are +# suitably defined. Those variables are subsequently used by +# AC_LIBTOOL_CONFIG to write the compiler configuration to `libtool'. +AC_DEFUN([AC_LIBTOOL_LANG_GCJ_CONFIG], [_LT_AC_LANG_GCJ_CONFIG(GCJ)]) +AC_DEFUN([_LT_AC_LANG_GCJ_CONFIG], +[AC_LANG_SAVE + +# Source file extension for Java test sources. +ac_ext=java + +# Object file extension for compiled Java test sources. +objext=o +_LT_AC_TAGVAR(objext, $1)=$objext + +# Code to be used in simple compile tests +lt_simple_compile_test_code="class foo {}" + +# Code to be used in simple link tests +lt_simple_link_test_code='public class conftest { public static void main(String[[]] argv) {}; }' + +# ltmain only uses $CC for tagged configurations so make sure $CC is set. +_LT_AC_SYS_COMPILER + +# save warnings/boilerplate of simple test code +_LT_COMPILER_BOILERPLATE +_LT_LINKER_BOILERPLATE + +# Allow CC to be a program name with arguments. +lt_save_CC="$CC" +CC=${GCJ-"gcj"} +compiler=$CC +_LT_AC_TAGVAR(compiler, $1)=$CC +_LT_CC_BASENAME([$compiler]) + +# GCJ did not exist at the time GCC didn't implicitly link libc in. +_LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no + +_LT_AC_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds + +AC_LIBTOOL_PROG_COMPILER_NO_RTTI($1) +AC_LIBTOOL_PROG_COMPILER_PIC($1) +AC_LIBTOOL_PROG_CC_C_O($1) +AC_LIBTOOL_SYS_HARD_LINK_LOCKS($1) +AC_LIBTOOL_PROG_LD_SHLIBS($1) +AC_LIBTOOL_SYS_DYNAMIC_LINKER($1) +AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH($1) + +AC_LIBTOOL_CONFIG($1) + +AC_LANG_RESTORE +CC="$lt_save_CC" +])# AC_LIBTOOL_LANG_GCJ_CONFIG + + +# AC_LIBTOOL_LANG_RC_CONFIG +# ------------------------- +# Ensure that the configuration vars for the Windows resource compiler are +# suitably defined. Those variables are subsequently used by +# AC_LIBTOOL_CONFIG to write the compiler configuration to `libtool'. +AC_DEFUN([AC_LIBTOOL_LANG_RC_CONFIG], [_LT_AC_LANG_RC_CONFIG(RC)]) +AC_DEFUN([_LT_AC_LANG_RC_CONFIG], +[AC_LANG_SAVE + +# Source file extension for RC test sources. +ac_ext=rc + +# Object file extension for compiled RC test sources. +objext=o +_LT_AC_TAGVAR(objext, $1)=$objext + +# Code to be used in simple compile tests +lt_simple_compile_test_code='sample MENU { MENUITEM "&Soup", 100, CHECKED }' + +# Code to be used in simple link tests +lt_simple_link_test_code="$lt_simple_compile_test_code" + +# ltmain only uses $CC for tagged configurations so make sure $CC is set. +_LT_AC_SYS_COMPILER + +# save warnings/boilerplate of simple test code +_LT_COMPILER_BOILERPLATE +_LT_LINKER_BOILERPLATE + +# Allow CC to be a program name with arguments. +lt_save_CC="$CC" +CC=${RC-"windres"} +compiler=$CC +_LT_AC_TAGVAR(compiler, $1)=$CC +_LT_CC_BASENAME([$compiler]) +_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes + +AC_LIBTOOL_CONFIG($1) + +AC_LANG_RESTORE +CC="$lt_save_CC" +])# AC_LIBTOOL_LANG_RC_CONFIG + + +# AC_LIBTOOL_CONFIG([TAGNAME]) +# ---------------------------- +# If TAGNAME is not passed, then create an initial libtool script +# with a default configuration from the untagged config vars. Otherwise +# add code to config.status for appending the configuration named by +# TAGNAME from the matching tagged config vars. +AC_DEFUN([AC_LIBTOOL_CONFIG], +[# The else clause should only fire when bootstrapping the +# libtool distribution, otherwise you forgot to ship ltmain.sh +# with your package, and you will get complaints that there are +# no rules to generate ltmain.sh. +if test -f "$ltmain"; then + # See if we are running on zsh, and set the options which allow our commands through + # without removal of \ escapes. + if test -n "${ZSH_VERSION+set}" ; then + setopt NO_GLOB_SUBST + fi + # Now quote all the things that may contain metacharacters while being + # careful not to overquote the AC_SUBSTed values. We take copies of the + # variables and quote the copies for generation of the libtool script. + for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC LTCFLAGS NM \ + SED SHELL STRIP \ + libname_spec library_names_spec soname_spec extract_expsyms_cmds \ + old_striplib striplib file_magic_cmd finish_cmds finish_eval \ + deplibs_check_method reload_flag reload_cmds need_locks \ + lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \ + lt_cv_sys_global_symbol_to_c_name_address \ + sys_lib_search_path_spec sys_lib_dlsearch_path_spec \ + old_postinstall_cmds old_postuninstall_cmds \ + _LT_AC_TAGVAR(compiler, $1) \ + _LT_AC_TAGVAR(CC, $1) \ + _LT_AC_TAGVAR(LD, $1) \ + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1) \ + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1) \ + _LT_AC_TAGVAR(lt_prog_compiler_static, $1) \ + _LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) \ + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1) \ + _LT_AC_TAGVAR(thread_safe_flag_spec, $1) \ + _LT_AC_TAGVAR(whole_archive_flag_spec, $1) \ + _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1) \ + _LT_AC_TAGVAR(old_archive_cmds, $1) \ + _LT_AC_TAGVAR(old_archive_from_new_cmds, $1) \ + _LT_AC_TAGVAR(predep_objects, $1) \ + _LT_AC_TAGVAR(postdep_objects, $1) \ + _LT_AC_TAGVAR(predeps, $1) \ + _LT_AC_TAGVAR(postdeps, $1) \ + _LT_AC_TAGVAR(compiler_lib_search_path, $1) \ + _LT_AC_TAGVAR(archive_cmds, $1) \ + _LT_AC_TAGVAR(archive_expsym_cmds, $1) \ + _LT_AC_TAGVAR(postinstall_cmds, $1) \ + _LT_AC_TAGVAR(postuninstall_cmds, $1) \ + _LT_AC_TAGVAR(old_archive_from_expsyms_cmds, $1) \ + _LT_AC_TAGVAR(allow_undefined_flag, $1) \ + _LT_AC_TAGVAR(no_undefined_flag, $1) \ + _LT_AC_TAGVAR(export_symbols_cmds, $1) \ + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1) \ + _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1) \ + _LT_AC_TAGVAR(hardcode_libdir_separator, $1) \ + _LT_AC_TAGVAR(hardcode_automatic, $1) \ + _LT_AC_TAGVAR(module_cmds, $1) \ + _LT_AC_TAGVAR(module_expsym_cmds, $1) \ + _LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1) \ + _LT_AC_TAGVAR(fix_srcfile_path, $1) \ + _LT_AC_TAGVAR(exclude_expsyms, $1) \ + _LT_AC_TAGVAR(include_expsyms, $1); do + + case $var in + _LT_AC_TAGVAR(old_archive_cmds, $1) | \ + _LT_AC_TAGVAR(old_archive_from_new_cmds, $1) | \ + _LT_AC_TAGVAR(archive_cmds, $1) | \ + _LT_AC_TAGVAR(archive_expsym_cmds, $1) | \ + _LT_AC_TAGVAR(module_cmds, $1) | \ + _LT_AC_TAGVAR(module_expsym_cmds, $1) | \ + _LT_AC_TAGVAR(old_archive_from_expsyms_cmds, $1) | \ + _LT_AC_TAGVAR(export_symbols_cmds, $1) | \ + extract_expsyms_cmds | reload_cmds | finish_cmds | \ + postinstall_cmds | postuninstall_cmds | \ + old_postinstall_cmds | old_postuninstall_cmds | \ + sys_lib_search_path_spec | sys_lib_dlsearch_path_spec) + # Double-quote double-evaled strings. + eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\"" + ;; + *) + eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\"" + ;; + esac + done + + case $lt_echo in + *'\[$]0 --fallback-echo"') + lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\[$]0 --fallback-echo"[$]/[$]0 --fallback-echo"/'` + ;; + esac + +ifelse([$1], [], + [cfgfile="${ofile}T" + trap "$rm \"$cfgfile\"; exit 1" 1 2 15 + $rm -f "$cfgfile" + AC_MSG_NOTICE([creating $ofile])], + [cfgfile="$ofile"]) + + cat <<__EOF__ >> "$cfgfile" +ifelse([$1], [], +[#! $SHELL + +# `$echo "$cfgfile" | sed 's%^.*/%%'` - Provide generalized library-building support services. +# Generated automatically by $PROGRAM (GNU $PACKAGE $VERSION$TIMESTAMP) +# NOTE: Changes made to this file will be lost: look at ltmain.sh. +# +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 +# Free Software Foundation, Inc. +# +# This file is part of GNU Libtool: +# Originally by Gordon Matzigkeit , 1996 +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# A sed program that does not truncate output. +SED=$lt_SED + +# Sed that helps us avoid accidentally triggering echo(1) options like -n. +Xsed="$SED -e 1s/^X//" + +# The HP-UX ksh and POSIX shell print the target directory to stdout +# if CDPATH is set. +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH + +# The names of the tagged configurations supported by this script. +available_tags= + +# ### BEGIN LIBTOOL CONFIG], +[# ### BEGIN LIBTOOL TAG CONFIG: $tagname]) + +# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: + +# Shell to use when invoking shell scripts. +SHELL=$lt_SHELL + +# Whether or not to build shared libraries. +build_libtool_libs=$enable_shared + +# Whether or not to build static libraries. +build_old_libs=$enable_static + +# Whether or not to add -lc for building shared libraries. +build_libtool_need_lc=$_LT_AC_TAGVAR(archive_cmds_need_lc, $1) + +# Whether or not to disallow shared libs when runtime libs are static +allow_libtool_libs_with_static_runtimes=$_LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1) + +# Whether or not to optimize for fast installation. +fast_install=$enable_fast_install + +# The host system. +host_alias=$host_alias +host=$host +host_os=$host_os + +# The build system. +build_alias=$build_alias +build=$build +build_os=$build_os + +# An echo program that does not interpret backslashes. +echo=$lt_echo + +# The archiver. +AR=$lt_AR +AR_FLAGS=$lt_AR_FLAGS + +# A C compiler. +LTCC=$lt_LTCC + +# LTCC compiler flags. +LTCFLAGS=$lt_LTCFLAGS + +# A language-specific compiler. +CC=$lt_[]_LT_AC_TAGVAR(compiler, $1) + +# Is the compiler the GNU C compiler? +with_gcc=$_LT_AC_TAGVAR(GCC, $1) + +# An ERE matcher. +EGREP=$lt_EGREP + +# The linker used to build libraries. +LD=$lt_[]_LT_AC_TAGVAR(LD, $1) + +# Whether we need hard or soft links. +LN_S=$lt_LN_S + +# A BSD-compatible nm program. +NM=$lt_NM + +# A symbol stripping program +STRIP=$lt_STRIP + +# Used to examine libraries when file_magic_cmd begins "file" +MAGIC_CMD=$MAGIC_CMD + +# Used on cygwin: DLL creation program. +DLLTOOL="$DLLTOOL" + +# Used on cygwin: object dumper. +OBJDUMP="$OBJDUMP" + +# Used on cygwin: assembler. +AS="$AS" + +# The name of the directory that contains temporary libtool files. +objdir=$objdir + +# How to create reloadable object files. +reload_flag=$lt_reload_flag +reload_cmds=$lt_reload_cmds + +# How to pass a linker flag through the compiler. +wl=$lt_[]_LT_AC_TAGVAR(lt_prog_compiler_wl, $1) + +# Object file suffix (normally "o"). +objext="$ac_objext" + +# Old archive suffix (normally "a"). +libext="$libext" + +# Shared library suffix (normally ".so"). +shrext_cmds='$shrext_cmds' + +# Executable file suffix (normally ""). +exeext="$exeext" + +# Additional compiler flags for building library objects. +pic_flag=$lt_[]_LT_AC_TAGVAR(lt_prog_compiler_pic, $1) +pic_mode=$pic_mode + +# What is the maximum length of a command? +max_cmd_len=$lt_cv_sys_max_cmd_len + +# Does compiler simultaneously support -c and -o options? +compiler_c_o=$lt_[]_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1) + +# Must we lock files when doing compilation? +need_locks=$lt_need_locks + +# Do we need the lib prefix for modules? +need_lib_prefix=$need_lib_prefix + +# Do we need a version for libraries? +need_version=$need_version + +# Whether dlopen is supported. +dlopen_support=$enable_dlopen + +# Whether dlopen of programs is supported. +dlopen_self=$enable_dlopen_self + +# Whether dlopen of statically linked programs is supported. +dlopen_self_static=$enable_dlopen_self_static + +# Compiler flag to prevent dynamic linking. +link_static_flag=$lt_[]_LT_AC_TAGVAR(lt_prog_compiler_static, $1) + +# Compiler flag to turn off builtin functions. +no_builtin_flag=$lt_[]_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) + +# Compiler flag to allow reflexive dlopens. +export_dynamic_flag_spec=$lt_[]_LT_AC_TAGVAR(export_dynamic_flag_spec, $1) + +# Compiler flag to generate shared objects directly from archives. +whole_archive_flag_spec=$lt_[]_LT_AC_TAGVAR(whole_archive_flag_spec, $1) + +# Compiler flag to generate thread-safe objects. +thread_safe_flag_spec=$lt_[]_LT_AC_TAGVAR(thread_safe_flag_spec, $1) + +# Library versioning type. +version_type=$version_type + +# Format of library name prefix. +libname_spec=$lt_libname_spec + +# List of archive names. First name is the real one, the rest are links. +# The last name is the one that the linker finds with -lNAME. +library_names_spec=$lt_library_names_spec + +# The coded name of the library, if different from the real name. +soname_spec=$lt_soname_spec + +# Commands used to build and install an old-style archive. +RANLIB=$lt_RANLIB +old_archive_cmds=$lt_[]_LT_AC_TAGVAR(old_archive_cmds, $1) +old_postinstall_cmds=$lt_old_postinstall_cmds +old_postuninstall_cmds=$lt_old_postuninstall_cmds + +# Create an old-style archive from a shared archive. +old_archive_from_new_cmds=$lt_[]_LT_AC_TAGVAR(old_archive_from_new_cmds, $1) + +# Create a temporary old-style archive to link instead of a shared archive. +old_archive_from_expsyms_cmds=$lt_[]_LT_AC_TAGVAR(old_archive_from_expsyms_cmds, $1) + +# Commands used to build and install a shared archive. +archive_cmds=$lt_[]_LT_AC_TAGVAR(archive_cmds, $1) +archive_expsym_cmds=$lt_[]_LT_AC_TAGVAR(archive_expsym_cmds, $1) +postinstall_cmds=$lt_postinstall_cmds +postuninstall_cmds=$lt_postuninstall_cmds + +# Commands used to build a loadable module (assumed same as above if empty) +module_cmds=$lt_[]_LT_AC_TAGVAR(module_cmds, $1) +module_expsym_cmds=$lt_[]_LT_AC_TAGVAR(module_expsym_cmds, $1) + +# Commands to strip libraries. +old_striplib=$lt_old_striplib +striplib=$lt_striplib + +# Dependencies to place before the objects being linked to create a +# shared library. +predep_objects=$lt_[]_LT_AC_TAGVAR(predep_objects, $1) + +# Dependencies to place after the objects being linked to create a +# shared library. +postdep_objects=$lt_[]_LT_AC_TAGVAR(postdep_objects, $1) + +# Dependencies to place before the objects being linked to create a +# shared library. +predeps=$lt_[]_LT_AC_TAGVAR(predeps, $1) + +# Dependencies to place after the objects being linked to create a +# shared library. +postdeps=$lt_[]_LT_AC_TAGVAR(postdeps, $1) + +# The library search path used internally by the compiler when linking +# a shared library. +compiler_lib_search_path=$lt_[]_LT_AC_TAGVAR(compiler_lib_search_path, $1) + +# Method to check whether dependent libraries are shared objects. +deplibs_check_method=$lt_deplibs_check_method + +# Command to use when deplibs_check_method == file_magic. +file_magic_cmd=$lt_file_magic_cmd + +# Flag that allows shared libraries with undefined symbols to be built. +allow_undefined_flag=$lt_[]_LT_AC_TAGVAR(allow_undefined_flag, $1) + +# Flag that forces no undefined symbols. +no_undefined_flag=$lt_[]_LT_AC_TAGVAR(no_undefined_flag, $1) + +# Commands used to finish a libtool library installation in a directory. +finish_cmds=$lt_finish_cmds + +# Same as above, but a single script fragment to be evaled but not shown. +finish_eval=$lt_finish_eval + +# Take the output of nm and produce a listing of raw symbols and C names. +global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe + +# Transform the output of nm in a proper C declaration +global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl + +# Transform the output of nm in a C name address pair +global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address + +# This is the shared library runtime path variable. +runpath_var=$runpath_var + +# This is the shared library path variable. +shlibpath_var=$shlibpath_var + +# Is shlibpath searched before the hard-coded library search path? +shlibpath_overrides_runpath=$shlibpath_overrides_runpath + +# How to hardcode a shared library path into an executable. +hardcode_action=$_LT_AC_TAGVAR(hardcode_action, $1) + +# Whether we should hardcode library paths into libraries. +hardcode_into_libs=$hardcode_into_libs + +# Flag to hardcode \$libdir into a binary during linking. +# This must work even if \$libdir does not exist. +hardcode_libdir_flag_spec=$lt_[]_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1) + +# If ld is used when linking, flag to hardcode \$libdir into +# a binary during linking. This must work even if \$libdir does +# not exist. +hardcode_libdir_flag_spec_ld=$lt_[]_LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1) + +# Whether we need a single -rpath flag with a separated argument. +hardcode_libdir_separator=$lt_[]_LT_AC_TAGVAR(hardcode_libdir_separator, $1) + +# Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the +# resulting binary. +hardcode_direct=$_LT_AC_TAGVAR(hardcode_direct, $1) + +# Set to yes if using the -LDIR flag during linking hardcodes DIR into the +# resulting binary. +hardcode_minus_L=$_LT_AC_TAGVAR(hardcode_minus_L, $1) + +# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into +# the resulting binary. +hardcode_shlibpath_var=$_LT_AC_TAGVAR(hardcode_shlibpath_var, $1) + +# Set to yes if building a shared library automatically hardcodes DIR into the library +# and all subsequent libraries and executables linked against it. +hardcode_automatic=$_LT_AC_TAGVAR(hardcode_automatic, $1) + +# Variables whose values should be saved in libtool wrapper scripts and +# restored at relink time. +variables_saved_for_relink="$variables_saved_for_relink" + +# Whether libtool must link a program against all its dependency libraries. +link_all_deplibs=$_LT_AC_TAGVAR(link_all_deplibs, $1) + +# Compile-time system search path for libraries +sys_lib_search_path_spec=$lt_sys_lib_search_path_spec + +# Run-time system search path for libraries +sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec + +# Fix the shell variable \$srcfile for the compiler. +fix_srcfile_path=$lt_fix_srcfile_path + +# Set to yes if exported symbols are required. +always_export_symbols=$_LT_AC_TAGVAR(always_export_symbols, $1) + +# The commands to list exported symbols. +export_symbols_cmds=$lt_[]_LT_AC_TAGVAR(export_symbols_cmds, $1) + +# The commands to extract the exported symbol list from a shared archive. +extract_expsyms_cmds=$lt_extract_expsyms_cmds + +# Symbols that should not be listed in the preloaded symbols. +exclude_expsyms=$lt_[]_LT_AC_TAGVAR(exclude_expsyms, $1) + +# Symbols that must always be exported. +include_expsyms=$lt_[]_LT_AC_TAGVAR(include_expsyms, $1) + +ifelse([$1],[], +[# ### END LIBTOOL CONFIG], +[# ### END LIBTOOL TAG CONFIG: $tagname]) + +__EOF__ + +ifelse([$1],[], [ + case $host_os in + aix3*) + cat <<\EOF >> "$cfgfile" + +# AIX sometimes has problems with the GCC collect2 program. For some +# reason, if we set the COLLECT_NAMES environment variable, the problems +# vanish in a puff of smoke. +if test "X${COLLECT_NAMES+set}" != Xset; then + COLLECT_NAMES= + export COLLECT_NAMES +fi +EOF + ;; + esac + + # We use sed instead of cat because bash on DJGPP gets confused if + # if finds mixed CR/LF and LF-only lines. Since sed operates in + # text mode, it properly converts lines to CR/LF. This bash problem + # is reportedly fixed, but why not run on old versions too? + sed '$q' "$ltmain" >> "$cfgfile" || (rm -f "$cfgfile"; exit 1) + + mv -f "$cfgfile" "$ofile" || \ + (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") + chmod +x "$ofile" +]) +else + # If there is no Makefile yet, we rely on a make rule to execute + # `config.status --recheck' to rerun these tests and create the + # libtool script then. + ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'` + if test -f "$ltmain_in"; then + test -f Makefile && make "$ltmain" + fi +fi +])# AC_LIBTOOL_CONFIG + + +# AC_LIBTOOL_PROG_COMPILER_NO_RTTI([TAGNAME]) +# ------------------------------------------- +AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_NO_RTTI], +[AC_REQUIRE([_LT_AC_SYS_COMPILER])dnl + +_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)= + +if test "$GCC" = yes; then + _LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' + + AC_LIBTOOL_COMPILER_OPTION([if $compiler supports -fno-rtti -fno-exceptions], + lt_cv_prog_compiler_rtti_exceptions, + [-fno-rtti -fno-exceptions], [], + [_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)="$_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) -fno-rtti -fno-exceptions"]) +fi +])# AC_LIBTOOL_PROG_COMPILER_NO_RTTI + + +# AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE +# --------------------------------- +AC_DEFUN([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE], +[AC_REQUIRE([AC_CANONICAL_HOST]) +AC_REQUIRE([LT_AC_PROG_SED]) +AC_REQUIRE([AC_PROG_NM]) +AC_REQUIRE([AC_OBJEXT]) +# Check for command to grab the raw symbol name followed by C symbol from nm. +AC_MSG_CHECKING([command to parse $NM output from $compiler object]) +AC_CACHE_VAL([lt_cv_sys_global_symbol_pipe], +[ +# These are sane defaults that work on at least a few old systems. +# [They come from Ultrix. What could be older than Ultrix?!! ;)] + +# Character class describing NM global symbol codes. +symcode='[[BCDEGRST]]' + +# Regexp to match symbols that can be accessed directly from C. +sympat='\([[_A-Za-z]][[_A-Za-z0-9]]*\)' + +# Transform an extracted symbol line into a proper C declaration +lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^. .* \(.*\)$/extern int \1;/p'" + +# Transform an extracted symbol line into symbol name and symbol address +lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" + +# Define system-specific variables. +case $host_os in +aix*) + symcode='[[BCDT]]' + ;; +cygwin* | mingw* | pw32*) + symcode='[[ABCDGISTW]]' + ;; +hpux*) # Its linker distinguishes data from code symbols + if test "$host_cpu" = ia64; then + symcode='[[ABCDEGRST]]' + fi + lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" + lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" + ;; +linux* | k*bsd*-gnu) + if test "$host_cpu" = ia64; then + symcode='[[ABCDGIRSTW]]' + lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" + lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" + fi + ;; +irix* | nonstopux*) + symcode='[[BCDEGRST]]' + ;; +osf*) + symcode='[[BCDEGQRST]]' + ;; +solaris*) + symcode='[[BDRT]]' + ;; +sco3.2v5*) + symcode='[[DT]]' + ;; +sysv4.2uw2*) + symcode='[[DT]]' + ;; +sysv5* | sco5v6* | unixware* | OpenUNIX*) + symcode='[[ABDT]]' + ;; +sysv4) + symcode='[[DFNSTU]]' + ;; +esac + +# Handle CRLF in mingw tool chain +opt_cr= +case $build_os in +mingw*) + opt_cr=`echo 'x\{0,1\}' | tr x '\015'` # option cr in regexp + ;; +esac + +# If we're using GNU nm, then use its standard symbol codes. +case `$NM -V 2>&1` in +*GNU* | *'with BFD'*) + symcode='[[ABCDGIRSTW]]' ;; +esac + +# Try without a prefix undercore, then with it. +for ac_symprfx in "" "_"; do + + # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol. + symxfrm="\\1 $ac_symprfx\\2 \\2" + + # Write the raw and C identifiers. + lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[[ ]]\($symcode$symcode*\)[[ ]][[ ]]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'" + + # Check to see that the pipe works correctly. + pipe_works=no + + rm -f conftest* + cat > conftest.$ac_ext < $nlist) && test -s "$nlist"; then + # Try sorting and uniquifying the output. + if sort "$nlist" | uniq > "$nlist"T; then + mv -f "$nlist"T "$nlist" + else + rm -f "$nlist"T + fi + + # Make sure that we snagged all the symbols we need. + if grep ' nm_test_var$' "$nlist" >/dev/null; then + if grep ' nm_test_func$' "$nlist" >/dev/null; then + cat < conftest.$ac_ext +#ifdef __cplusplus +extern "C" { +#endif + +EOF + # Now generate the symbol file. + eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | grep -v main >> conftest.$ac_ext' + + cat <> conftest.$ac_ext +#if defined (__STDC__) && __STDC__ +# define lt_ptr_t void * +#else +# define lt_ptr_t char * +# define const +#endif + +/* The mapping between symbol names and symbols. */ +const struct { + const char *name; + lt_ptr_t address; +} +lt_preloaded_symbols[[]] = +{ +EOF + $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (lt_ptr_t) \&\2},/" < "$nlist" | grep -v main >> conftest.$ac_ext + cat <<\EOF >> conftest.$ac_ext + {0, (lt_ptr_t) 0} +}; + +#ifdef __cplusplus +} +#endif +EOF + # Now try linking the two files. + mv conftest.$ac_objext conftstm.$ac_objext + lt_save_LIBS="$LIBS" + lt_save_CFLAGS="$CFLAGS" + LIBS="conftstm.$ac_objext" + CFLAGS="$CFLAGS$_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)" + if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext}; then + pipe_works=yes + fi + LIBS="$lt_save_LIBS" + CFLAGS="$lt_save_CFLAGS" + else + echo "cannot find nm_test_func in $nlist" >&AS_MESSAGE_LOG_FD + fi + else + echo "cannot find nm_test_var in $nlist" >&AS_MESSAGE_LOG_FD + fi + else + echo "cannot run $lt_cv_sys_global_symbol_pipe" >&AS_MESSAGE_LOG_FD + fi + else + echo "$progname: failed program was:" >&AS_MESSAGE_LOG_FD + cat conftest.$ac_ext >&5 + fi + rm -f conftest* conftst* + + # Do not use the global_symbol_pipe unless it works. + if test "$pipe_works" = yes; then + break + else + lt_cv_sys_global_symbol_pipe= + fi +done +]) +if test -z "$lt_cv_sys_global_symbol_pipe"; then + lt_cv_sys_global_symbol_to_cdecl= +fi +if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then + AC_MSG_RESULT(failed) +else + AC_MSG_RESULT(ok) +fi +]) # AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE + + +# AC_LIBTOOL_PROG_COMPILER_PIC([TAGNAME]) +# --------------------------------------- +AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_PIC], +[_LT_AC_TAGVAR(lt_prog_compiler_wl, $1)= +_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= +_LT_AC_TAGVAR(lt_prog_compiler_static, $1)= + +AC_MSG_CHECKING([for $compiler option to produce PIC]) + ifelse([$1],[CXX],[ + # C++ specific cases for pic, static, wl, etc. + if test "$GXX" = yes; then + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static' + + case $host_os in + aix*) + # All AIX code is PIC. + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + fi + ;; + amigaos*) + # FIXME: we need at least 68020 code to build shared libraries, but + # adding the `-m68020' flag to GCC prevents building anything better, + # like `-m68040'. + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4' + ;; + beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) + # PIC is the default for these OSes. + ;; + mingw* | cygwin* | os2* | pw32*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + # Although the cygwin gcc ignores -fPIC, still need this for old-style + # (--disable-auto-import) libraries + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT' + ;; + darwin* | rhapsody*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' + ;; + *djgpp*) + # DJGPP does not support shared libraries at all + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= + ;; + interix[[3-9]]*) + # Interix 3.x gcc -fpic/-fPIC options generate broken code. + # Instead, we relocate shared libraries at runtime. + ;; + sysv4*MP*) + if test -d /usr/nec; then + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic + fi + ;; + hpux*) + # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but + # not for PA HP-UX. + case $host_cpu in + hppa*64*|ia64*) + ;; + *) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + esac + ;; + *) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + esac + else + case $host_os in + aix4* | aix5*) + # All AIX code is PIC. + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + else + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp' + fi + ;; + chorus*) + case $cc_basename in + cxch68*) + # Green Hills C++ Compiler + # _LT_AC_TAGVAR(lt_prog_compiler_static, $1)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a" + ;; + esac + ;; + darwin*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + case $cc_basename in + xlc*) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-qnocommon' + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + ;; + esac + ;; + dgux*) + case $cc_basename in + ec++*) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + ;; + ghcx*) + # Green Hills C++ Compiler + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' + ;; + *) + ;; + esac + ;; + freebsd* | dragonfly*) + # FreeBSD uses GNU C++ + ;; + hpux9* | hpux10* | hpux11*) + case $cc_basename in + CC*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive' + if test "$host_cpu" != ia64; then + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='+Z' + fi + ;; + aCC*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive' + case $host_cpu in + hppa*64*|ia64*) + # +Z the default + ;; + *) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='+Z' + ;; + esac + ;; + *) + ;; + esac + ;; + interix*) + # This is c89, which is MS Visual C++ (no shared libs) + # Anyone wants to do a port? + ;; + irix5* | irix6* | nonstopux*) + case $cc_basename in + CC*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + # CC pic flag -KPIC is the default. + ;; + *) + ;; + esac + ;; + linux* | k*bsd*-gnu) + case $cc_basename in + KCC*) + # KAI C++ Compiler + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + icpc* | ecpc*) + # Intel C++ + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static' + ;; + pgCC*) + # Portland Group C++ compiler. + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fpic' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + cxx*) + # Compaq C++ + # Make sure the PIC flag is empty. It appears that all Alpha + # Linux and Compaq Tru64 Unix objects are PIC. + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + ;; + *) + case `$CC -V 2>&1 | sed 5q` in + *Sun\ C*) + # Sun C++ 5.9 + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' + ;; + esac + ;; + esac + ;; + lynxos*) + ;; + m88k*) + ;; + mvs*) + case $cc_basename in + cxx*) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-W c,exportall' + ;; + *) + ;; + esac + ;; + netbsd* | netbsdelf*-gnu) + ;; + osf3* | osf4* | osf5*) + case $cc_basename in + KCC*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' + ;; + RCC*) + # Rational C++ 2.4.1 + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' + ;; + cxx*) + # Digital/Compaq C++ + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + # Make sure the PIC flag is empty. It appears that all Alpha + # Linux and Compaq Tru64 Unix objects are PIC. + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + ;; + *) + ;; + esac + ;; + psos*) + ;; + solaris*) + case $cc_basename in + CC*) + # Sun C++ 4.2, 5.x and Centerline C++ + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' + ;; + gcx*) + # Green Hills C++ Compiler + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' + ;; + *) + ;; + esac + ;; + sunos4*) + case $cc_basename in + CC*) + # Sun C++ 4.x + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + lcc*) + # Lucid + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' + ;; + *) + ;; + esac + ;; + tandem*) + case $cc_basename in + NCC*) + # NonStop-UX NCC 3.20 + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + ;; + *) + ;; + esac + ;; + sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) + case $cc_basename in + CC*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + esac + ;; + vxworks*) + ;; + *) + _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no + ;; + esac + fi +], +[ + if test "$GCC" = yes; then + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static' + + case $host_os in + aix*) + # All AIX code is PIC. + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + fi + ;; + + amigaos*) + # FIXME: we need at least 68020 code to build shared libraries, but + # adding the `-m68020' flag to GCC prevents building anything better, + # like `-m68040'. + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4' + ;; + + beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) + # PIC is the default for these OSes. + ;; + + mingw* | cygwin* | pw32* | os2*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + # Although the cygwin gcc ignores -fPIC, still need this for old-style + # (--disable-auto-import) libraries + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT' + ;; + + darwin* | rhapsody*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' + ;; + + interix[[3-9]]*) + # Interix 3.x gcc -fpic/-fPIC options generate broken code. + # Instead, we relocate shared libraries at runtime. + ;; + + msdosdjgpp*) + # Just because we use GCC doesn't mean we suddenly get shared libraries + # on systems that don't support them. + _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no + enable_shared=no + ;; + + sysv4*MP*) + if test -d /usr/nec; then + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic + fi + ;; + + hpux*) + # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but + # not for PA HP-UX. + case $host_cpu in + hppa*64*|ia64*) + # +Z the default + ;; + *) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + esac + ;; + + *) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + esac + else + # PORTME Check for flag to pass linker flags through the system compiler. + case $host_os in + aix*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + else + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp' + fi + ;; + darwin*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + case $cc_basename in + xlc*) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-qnocommon' + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + ;; + esac + ;; + + mingw* | cygwin* | pw32* | os2*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT' + ;; + + hpux9* | hpux10* | hpux11*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but + # not for PA HP-UX. + case $host_cpu in + hppa*64*|ia64*) + # +Z the default + ;; + *) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='+Z' + ;; + esac + # Is there a better lt_prog_compiler_static that works with the bundled CC? + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive' + ;; + + irix5* | irix6* | nonstopux*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + # PIC (with -KPIC) is the default. + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + ;; + + newsos6) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + + linux* | k*bsd*-gnu) + case $cc_basename in + icc* | ecc*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static' + ;; + pgcc* | pgf77* | pgf90* | pgf95*) + # Portland Group compilers (*not* the Pentium gcc compiler, + # which looks to be a dead project) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fpic' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + ccc*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + # All Alpha code is PIC. + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + ;; + *) + case `$CC -V 2>&1 | sed 5q` in + *Sun\ C*) + # Sun C 5.9 + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + ;; + *Sun\ F*) + # Sun Fortran 8.3 passes all unrecognized flags to the linker + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='' + ;; + esac + ;; + esac + ;; + + osf3* | osf4* | osf5*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + # All OSF/1 code is PIC. + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + ;; + + rdos*) + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + ;; + + solaris*) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + case $cc_basename in + f77* | f90* | f95*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ';; + *) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,';; + esac + ;; + + sunos4*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + + sysv4 | sysv4.2uw2* | sysv4.3*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + + sysv4*MP*) + if test -d /usr/nec ;then + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-Kconform_pic' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + fi + ;; + + sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + + unicos*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no + ;; + + uts4*) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + + *) + _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no + ;; + esac + fi +]) +AC_MSG_RESULT([$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)]) + +# +# Check to make sure the PIC flag actually works. +# +if test -n "$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)"; then + AC_LIBTOOL_COMPILER_OPTION([if $compiler PIC flag $_LT_AC_TAGVAR(lt_prog_compiler_pic, $1) works], + _LT_AC_TAGVAR(lt_prog_compiler_pic_works, $1), + [$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)ifelse([$1],[],[ -DPIC],[ifelse([$1],[CXX],[ -DPIC],[])])], [], + [case $_LT_AC_TAGVAR(lt_prog_compiler_pic, $1) in + "" | " "*) ;; + *) _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=" $_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)" ;; + esac], + [_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= + _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no]) +fi +case $host_os in + # For platforms which do not support PIC, -DPIC is meaningless: + *djgpp*) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= + ;; + *) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)="$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)ifelse([$1],[],[ -DPIC],[ifelse([$1],[CXX],[ -DPIC],[])])" + ;; +esac + +# +# Check to make sure the static flag actually works. +# +wl=$_LT_AC_TAGVAR(lt_prog_compiler_wl, $1) eval lt_tmp_static_flag=\"$_LT_AC_TAGVAR(lt_prog_compiler_static, $1)\" +AC_LIBTOOL_LINKER_OPTION([if $compiler static flag $lt_tmp_static_flag works], + _LT_AC_TAGVAR(lt_prog_compiler_static_works, $1), + $lt_tmp_static_flag, + [], + [_LT_AC_TAGVAR(lt_prog_compiler_static, $1)=]) +]) + + +# AC_LIBTOOL_PROG_LD_SHLIBS([TAGNAME]) +# ------------------------------------ +# See if the linker supports building shared libraries. +AC_DEFUN([AC_LIBTOOL_PROG_LD_SHLIBS], +[AC_REQUIRE([LT_AC_PROG_SED])dnl +AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries]) +ifelse([$1],[CXX],[ + _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' + case $host_os in + aix4* | aix5*) + # If we're using GNU nm, then we don't want the "-C" option. + # -C means demangle to AIX nm, but means don't demangle with GNU nm + if $NM -V 2>&1 | grep 'GNU' > /dev/null; then + _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols' + else + _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols' + fi + ;; + pw32*) + _LT_AC_TAGVAR(export_symbols_cmds, $1)="$ltdll_cmds" + ;; + cygwin* | mingw*) + _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;/^.*[[ ]]__nm__/s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.*[[ ]]//'\'' | sort | uniq > $export_symbols' + ;; + linux* | k*bsd*-gnu) + _LT_AC_TAGVAR(link_all_deplibs, $1)=no + ;; + *) + _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' + ;; + esac +],[ + runpath_var= + _LT_AC_TAGVAR(allow_undefined_flag, $1)= + _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=no + _LT_AC_TAGVAR(archive_cmds, $1)= + _LT_AC_TAGVAR(archive_expsym_cmds, $1)= + _LT_AC_TAGVAR(old_archive_From_new_cmds, $1)= + _LT_AC_TAGVAR(old_archive_from_expsyms_cmds, $1)= + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)= + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)= + _LT_AC_TAGVAR(thread_safe_flag_spec, $1)= + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)= + _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)= + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)= + _LT_AC_TAGVAR(hardcode_direct, $1)=no + _LT_AC_TAGVAR(hardcode_minus_L, $1)=no + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported + _LT_AC_TAGVAR(link_all_deplibs, $1)=unknown + _LT_AC_TAGVAR(hardcode_automatic, $1)=no + _LT_AC_TAGVAR(module_cmds, $1)= + _LT_AC_TAGVAR(module_expsym_cmds, $1)= + _LT_AC_TAGVAR(always_export_symbols, $1)=no + _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' + # include_expsyms should be a list of space-separated symbols to be *always* + # included in the symbol list + _LT_AC_TAGVAR(include_expsyms, $1)= + # exclude_expsyms can be an extended regexp of symbols to exclude + # it will be wrapped by ` (' and `)$', so one must not match beginning or + # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', + # as well as any symbol that contains `d'. + _LT_AC_TAGVAR(exclude_expsyms, $1)="_GLOBAL_OFFSET_TABLE_" + # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out + # platforms (ab)use it in PIC code, but their linkers get confused if + # the symbol is explicitly referenced. Since portable code cannot + # rely on this symbol name, it's probably fine to never include it in + # preloaded symbol tables. + extract_expsyms_cmds= + # Just being paranoid about ensuring that cc_basename is set. + _LT_CC_BASENAME([$compiler]) + case $host_os in + cygwin* | mingw* | pw32*) + # FIXME: the MSVC++ port hasn't been tested in a loooong time + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + if test "$GCC" != yes; then + with_gnu_ld=no + fi + ;; + interix*) + # we just hope/assume this is gcc and not c89 (= MSVC++) + with_gnu_ld=yes + ;; + openbsd*) + with_gnu_ld=no + ;; + esac + + _LT_AC_TAGVAR(ld_shlibs, $1)=yes + if test "$with_gnu_ld" = yes; then + # If archive_cmds runs LD, not CC, wlarc should be empty + wlarc='${wl}' + + # Set some defaults for GNU ld with shared library support. These + # are reset later if shared libraries are not supported. Putting them + # here allows them to be overridden if necessary. + runpath_var=LD_RUN_PATH + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir' + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' + # ancient GNU ld didn't support --whole-archive et. al. + if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + else + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)= + fi + supports_anon_versioning=no + case `$LD -v 2>/dev/null` in + *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.10.*) ;; # catch versions < 2.11 + *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... + *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... + *\ 2.11.*) ;; # other 2.11 versions + *) supports_anon_versioning=yes ;; + esac + + # See if GNU ld supports shared libraries. + case $host_os in + aix3* | aix4* | aix5*) + # On AIX/PPC, the GNU linker is very broken + if test "$host_cpu" != ia64; then + _LT_AC_TAGVAR(ld_shlibs, $1)=no + cat <&2 + +*** Warning: the GNU linker, at least up to release 2.9.1, is reported +*** to be unable to reliably create shared libraries on AIX. +*** Therefore, libtool is disabling shared libraries support. If you +*** really care for shared libraries, you may want to modify your PATH +*** so that a non-GNU linker is found, and then restart. + +EOF + fi + ;; + + amigaos*) + _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes + + # Samuel A. Falvo II reports + # that the semantics of dynamic libraries on AmigaOS, at least up + # to version 4, is to share data among multiple programs linked + # with the same dynamic library. Since this doesn't match the + # behavior of shared libraries on other platforms, we can't use + # them. + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + + beos*) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported + # Joseph Beckenbach says some releases of gcc + # support --undefined. This deserves some investigation. FIXME + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + else + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; + + cygwin* | mingw* | pw32*) + # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, + # as there is no search path for DLLs. + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported + _LT_AC_TAGVAR(always_export_symbols, $1)=no + _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=yes + _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/'\'' -e '\''/^[[AITW]][[ ]]/s/.*[[ ]]//'\'' | sort | uniq > $export_symbols' + + if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' + # If the export-symbols file already is a .def file (1st line + # is EXPORTS), use it as is; otherwise, prepend... + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then + cp $export_symbols $output_objdir/$soname.def; + else + echo EXPORTS > $output_objdir/$soname.def; + cat $export_symbols >> $output_objdir/$soname.def; + fi~ + $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' + else + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; + + interix[[3-9]]*) + _LT_AC_TAGVAR(hardcode_direct, $1)=no + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' + # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. + # Instead, shared libraries are loaded at an image base (0x10000000 by + # default) and relocated if they conflict, which is a slow very memory + # consuming and fragmenting process. To avoid this, we pick a random, + # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link + # time. Moving up from 0x10000000 also allows more sbrk(2) space. + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' + ;; + + gnu* | linux* | k*bsd*-gnu) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + tmp_addflag= + case $cc_basename,$host_cpu in + pgcc*) # Portland Group C compiler + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' + tmp_addflag=' $pic_flag' + ;; + pgf77* | pgf90* | pgf95*) # Portland Group f77 and f90 compilers + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' + tmp_addflag=' $pic_flag -Mnomain' ;; + ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 + tmp_addflag=' -i_dynamic' ;; + efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 + tmp_addflag=' -i_dynamic -nofor_main' ;; + ifc* | ifort*) # Intel Fortran compiler + tmp_addflag=' -nofor_main' ;; + esac + case `$CC -V 2>&1 | sed 5q` in + *Sun\ C*) # Sun C 5.9 + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' + tmp_sharedflag='-G' ;; + *Sun\ F*) # Sun Fortran 8.3 + tmp_sharedflag='-G' ;; + *) + tmp_sharedflag='-shared' ;; + esac + _LT_AC_TAGVAR(archive_cmds, $1)='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + + if test $supports_anon_versioning = yes; then + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $output_objdir/$libname.ver~ + cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ + $echo "local: *; };" >> $output_objdir/$libname.ver~ + $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' + fi + _LT_AC_TAGVAR(link_all_deplibs, $1)=no + else + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; + + netbsd* | netbsdelf*-gnu) + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' + wlarc= + else + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + fi + ;; + + solaris*) + if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then + _LT_AC_TAGVAR(ld_shlibs, $1)=no + cat <&2 + +*** Warning: The releases 2.8.* of the GNU linker cannot reliably +*** create shared libraries on Solaris systems. Therefore, libtool +*** is disabling shared libraries support. We urge you to upgrade GNU +*** binutils to release 2.9.1 or newer. Another option is to modify +*** your PATH or compiler configuration so that the native linker is +*** used, and then restart. + +EOF + elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; + + sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*) + case `$LD -v 2>&1` in + *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.1[[0-5]].*) + _LT_AC_TAGVAR(ld_shlibs, $1)=no + cat <<_LT_EOF 1>&2 + +*** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not +*** reliably create shared libraries on SCO systems. Therefore, libtool +*** is disabling shared libraries support. We urge you to upgrade GNU +*** binutils to release 2.16.91.0.3 or newer. Another option is to modify +*** your PATH or compiler configuration so that the native linker is +*** used, and then restart. + +_LT_EOF + ;; + *) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='`test -z "$SCOABSPATH" && echo ${wl}-rpath,$libdir`' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname,\${SCOABSPATH:+${install_libdir}/}$soname,-retain-symbols-file,$export_symbols -o $lib' + else + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; + esac + ;; + + sunos4*) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' + wlarc= + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + *) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; + esac + + if test "$_LT_AC_TAGVAR(ld_shlibs, $1)" = no; then + runpath_var= + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)= + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)= + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)= + fi + else + # PORTME fill in a description of your system's linker (not GNU ld) + case $host_os in + aix3*) + _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported + _LT_AC_TAGVAR(always_export_symbols, $1)=yes + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' + # Note: this linker hardcodes the directories in LIBPATH if there + # are no directories specified by -L. + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes + if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then + # Neither direct hardcoding nor static linking is supported with a + # broken collect2. + _LT_AC_TAGVAR(hardcode_direct, $1)=unsupported + fi + ;; + + aix4* | aix5*) + if test "$host_cpu" = ia64; then + # On IA64, the linker does run time linking by default, so we don't + # have to do anything special. + aix_use_runtimelinking=no + exp_sym_flag='-Bexport' + no_entry_flag="" + else + # If we're using GNU nm, then we don't want the "-C" option. + # -C means demangle to AIX nm, but means don't demangle with GNU nm + if $NM -V 2>&1 | grep 'GNU' > /dev/null; then + _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols' + else + _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols' + fi + aix_use_runtimelinking=no + + # Test if we are trying to use run time linking or normal + # AIX style linking. If -brtl is somewhere in LDFLAGS, we + # need to do runtime linking. + case $host_os in aix4.[[23]]|aix4.[[23]].*|aix5*) + for ld_flag in $LDFLAGS; do + if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then + aix_use_runtimelinking=yes + break + fi + done + ;; + esac + + exp_sym_flag='-bexport' + no_entry_flag='-bnoentry' + fi + + # When large executables or shared objects are built, AIX ld can + # have problems creating the table of contents. If linking a library + # or program results in "error TOC overflow" add -mminimal-toc to + # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not + # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. + + _LT_AC_TAGVAR(archive_cmds, $1)='' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=':' + _LT_AC_TAGVAR(link_all_deplibs, $1)=yes + + if test "$GCC" = yes; then + case $host_os in aix4.[[012]]|aix4.[[012]].*) + # We only want to do this on AIX 4.2 and lower, the check + # below for broken collect2 doesn't work under 4.3+ + collect2name=`${CC} -print-prog-name=collect2` + if test -f "$collect2name" && \ + strings "$collect2name" | grep resolve_lib_name >/dev/null + then + # We have reworked collect2 + : + else + # We have old collect2 + _LT_AC_TAGVAR(hardcode_direct, $1)=unsupported + # It fails to find uninstalled libraries when the uninstalled + # path is not listed in the libpath. Setting hardcode_minus_L + # to unsupported forces relinking + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)= + fi + ;; + esac + shared_flag='-shared' + if test "$aix_use_runtimelinking" = yes; then + shared_flag="$shared_flag "'${wl}-G' + fi + else + # not using gcc + if test "$host_cpu" = ia64; then + # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release + # chokes on -Wl,-G. The following line is correct: + shared_flag='-G' + else + if test "$aix_use_runtimelinking" = yes; then + shared_flag='${wl}-G' + else + shared_flag='${wl}-bM:SRE' + fi + fi + fi + + # It seems that -bexpall does not export symbols beginning with + # underscore (_), so it is better to generate a list of symbols to export. + _LT_AC_TAGVAR(always_export_symbols, $1)=yes + if test "$aix_use_runtimelinking" = yes; then + # Warning - without using the other runtime loading flags (-brtl), + # -berok will link without error, but may produce a broken library. + _LT_AC_TAGVAR(allow_undefined_flag, $1)='-berok' + # Determine the default libpath from the value encoded in an empty executable. + _LT_AC_SYS_LIBPATH_AIX + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" + _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" + else + if test "$host_cpu" = ia64; then + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib' + _LT_AC_TAGVAR(allow_undefined_flag, $1)="-z nodefs" + _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" + else + # Determine the default libpath from the value encoded in an empty executable. + _LT_AC_SYS_LIBPATH_AIX + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" + # Warning - without using the other run time loading flags, + # -berok will link without error, but may produce a broken library. + _LT_AC_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok' + _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok' + # Exported symbols can be pulled into shared objects from archives + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='$convenience' + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes + # This is similar to how AIX traditionally builds its shared libraries. + _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' + fi + fi + ;; + + amigaos*) + _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes + # see comment about different semantics on the GNU ld section + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + + bsdi[[45]]*) + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)=-rdynamic + ;; + + cygwin* | mingw* | pw32*) + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + # hardcode_libdir_flag_spec is actually meaningless, as there is + # no search path for DLLs. + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' + _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported + # Tell ltmain to make .lib files, not .a files. + libext=lib + # Tell ltmain to make .dll files, not .so files. + shrext_cmds=".dll" + # FIXME: Setting linknames here is a bad hack. + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | $SED -e '\''s/ -lc$//'\''` -link -dll~linknames=' + # The linker will automatically build a .lib file if we build a DLL. + _LT_AC_TAGVAR(old_archive_From_new_cmds, $1)='true' + # FIXME: Should let the user specify the lib program. + _LT_AC_TAGVAR(old_archive_cmds, $1)='lib -OUT:$oldlib$oldobjs$old_deplibs' + _LT_AC_TAGVAR(fix_srcfile_path, $1)='`cygpath -w "$srcfile"`' + _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=yes + ;; + + darwin* | rhapsody*) + case $host_os in + rhapsody* | darwin1.[[012]]) + _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-undefined ${wl}suppress' + ;; + *) # Darwin 1.3 on + if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then + _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' + else + case ${MACOSX_DEPLOYMENT_TARGET} in + 10.[[012]]) + _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' + ;; + 10.*) + _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-undefined ${wl}dynamic_lookup' + ;; + esac + fi + ;; + esac + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no + _LT_AC_TAGVAR(hardcode_direct, $1)=no + _LT_AC_TAGVAR(hardcode_automatic, $1)=yes + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='' + _LT_AC_TAGVAR(link_all_deplibs, $1)=yes + if test "$GCC" = yes ; then + output_verbose_link_cmd='echo' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring' + _LT_AC_TAGVAR(module_cmds, $1)='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' + # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + else + case $cc_basename in + xlc*) + output_verbose_link_cmd='echo' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $xlcverstring' + _LT_AC_TAGVAR(module_cmds, $1)='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' + # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $xlcverstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + ;; + *) + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + esac + fi + ;; + + dgux*) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + freebsd1*) + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + + # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor + # support. Future versions do this automatically, but an explicit c++rt0.o + # does not break anything, and helps significantly (at the cost of a little + # extra space). + freebsd2.2*) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + # Unfortunately, older versions of FreeBSD 2 do not have this feature. + freebsd2*) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + # FreeBSD 3 and greater uses gcc -shared to do shared libraries. + freebsd* | dragonfly*) + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -o $lib $libobjs $deplibs $compiler_flags' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + hpux9*) + if test "$GCC" = yes; then + _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + else + _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + fi + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' + ;; + + hpux10*) + if test "$GCC" = yes -a "$with_gnu_ld" = no; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' + else + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' + fi + if test "$with_gnu_ld" = no; then + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' + + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes + fi + ;; + + hpux11*) + if test "$GCC" = yes -a "$with_gnu_ld" = no; then + case $host_cpu in + hppa*64*) + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + ia64*) + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' + ;; + *) + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' + ;; + esac + else + case $host_cpu in + hppa*64*) + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + ia64*) + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' + ;; + *) + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' + ;; + esac + fi + if test "$with_gnu_ld" = no; then + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + + case $host_cpu in + hppa*64*|ia64*) + _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='+b $libdir' + _LT_AC_TAGVAR(hardcode_direct, $1)=no + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + *) + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' + + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes + ;; + esac + fi + ;; + + irix5* | irix6* | nonstopux*) + if test "$GCC" = yes; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + else + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='-rpath $libdir' + fi + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + _LT_AC_TAGVAR(link_all_deplibs, $1)=yes + ;; + + netbsd* | netbsdelf*-gnu) + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out + else + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF + fi + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + newsos6) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + openbsd*) + if test -f /usr/libexec/ld.so; then + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' + else + case $host_os in + openbsd[[01]].* | openbsd2.[[0-7]] | openbsd2.[[0-7]].*) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + ;; + *) + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' + ;; + esac + fi + else + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; + + os2*) + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes + _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported + _LT_AC_TAGVAR(archive_cmds, $1)='$echo "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$echo DATA >> $output_objdir/$libname.def~$echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~$echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' + _LT_AC_TAGVAR(old_archive_From_new_cmds, $1)='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' + ;; + + osf3*) + if test "$GCC" = yes; then + _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + else + _LT_AC_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + fi + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + ;; + + osf4* | osf5*) # as osf3* with the addition of -msym flag + if test "$GCC" = yes; then + _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + else + _LT_AC_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~ + $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib~$rm $lib.exp' + + # Both c and cxx compiler support -rpath directly + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' + fi + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + ;; + + solaris*) + _LT_AC_TAGVAR(no_undefined_flag, $1)=' -z text' + if test "$GCC" = yes; then + wlarc='${wl}' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $CC -shared ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$rm $lib.exp' + else + wlarc='' + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' + fi + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + case $host_os in + solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; + *) + # The compiler driver will combine and reorder linker options, + # but understands `-z linker_flag'. GCC discards it without `$wl', + # but is careful enough not to reorder. + # Supported since Solaris 2.6 (maybe 2.5.1?) + if test "$GCC" = yes; then + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' + else + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract' + fi + ;; + esac + _LT_AC_TAGVAR(link_all_deplibs, $1)=yes + ;; + + sunos4*) + if test "x$host_vendor" = xsequent; then + # Use $CC to link under sequent, because it throws in some extra .o + # files that make .init and .fini sections work. + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' + else + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' + fi + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + sysv4) + case $host_vendor in + sni) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes # is this really true??? + ;; + siemens) + ## LD is ld it makes a PLAMLIB + ## CC just makes a GrossModule. + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(reload_cmds, $1)='$CC -r -o $output$reload_objs' + _LT_AC_TAGVAR(hardcode_direct, $1)=no + ;; + motorola) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(hardcode_direct, $1)=no #Motorola manual says yes, but my tests say they lie + ;; + esac + runpath_var='LD_RUN_PATH' + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + sysv4.3*) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='-Bexport' + ;; + + sysv4*MP*) + if test -d /usr/nec; then + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + runpath_var=LD_RUN_PATH + hardcode_runpath_var=yes + _LT_AC_TAGVAR(ld_shlibs, $1)=yes + fi + ;; + + sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*) + _LT_AC_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + runpath_var='LD_RUN_PATH' + + if test "$GCC" = yes; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + else + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + fi + ;; + + sysv5* | sco3.2v5* | sco5v6*) + # Note: We can NOT use -z defs as we might desire, because we do not + # link with -lc, and that would cause any symbols used from libc to + # always be unresolved, which means just about no library would + # ever link correctly. If we're not using GNU ld we use -z text + # though, which does catch some bad symbols but isn't as heavy-handed + # as -z defs. + _LT_AC_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' + _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-z,nodefs' + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='`test -z "$SCOABSPATH" && echo ${wl}-R,$libdir`' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=':' + _LT_AC_TAGVAR(link_all_deplibs, $1)=yes + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport' + runpath_var='LD_RUN_PATH' + + if test "$GCC" = yes; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' + else + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' + fi + ;; + + uts4*) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + *) + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + esac + fi +]) +AC_MSG_RESULT([$_LT_AC_TAGVAR(ld_shlibs, $1)]) +test "$_LT_AC_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no + +# +# Do we need to explicitly link libc? +# +case "x$_LT_AC_TAGVAR(archive_cmds_need_lc, $1)" in +x|xyes) + # Assume -lc should be added + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes + + if test "$enable_shared" = yes && test "$GCC" = yes; then + case $_LT_AC_TAGVAR(archive_cmds, $1) in + *'~'*) + # FIXME: we may have to deal with multi-command sequences. + ;; + '$CC '*) + # Test whether the compiler implicitly links with -lc since on some + # systems, -lgcc has to come before -lc. If gcc already passes -lc + # to ld, don't add -lc before -lgcc. + AC_MSG_CHECKING([whether -lc should be explicitly linked in]) + $rm conftest* + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + + if AC_TRY_EVAL(ac_compile) 2>conftest.err; then + soname=conftest + lib=conftest + libobjs=conftest.$ac_objext + deplibs= + wl=$_LT_AC_TAGVAR(lt_prog_compiler_wl, $1) + pic_flag=$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1) + compiler_flags=-v + linker_flags=-v + verstring= + output_objdir=. + libname=conftest + lt_save_allow_undefined_flag=$_LT_AC_TAGVAR(allow_undefined_flag, $1) + _LT_AC_TAGVAR(allow_undefined_flag, $1)= + if AC_TRY_EVAL(_LT_AC_TAGVAR(archive_cmds, $1) 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) + then + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no + else + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes + fi + _LT_AC_TAGVAR(allow_undefined_flag, $1)=$lt_save_allow_undefined_flag + else + cat conftest.err 1>&5 + fi + $rm conftest* + AC_MSG_RESULT([$_LT_AC_TAGVAR(archive_cmds_need_lc, $1)]) + ;; + esac + fi + ;; +esac +])# AC_LIBTOOL_PROG_LD_SHLIBS + + +# _LT_AC_FILE_LTDLL_C +# ------------------- +# Be careful that the start marker always follows a newline. +AC_DEFUN([_LT_AC_FILE_LTDLL_C], [ +# /* ltdll.c starts here */ +# #define WIN32_LEAN_AND_MEAN +# #include +# #undef WIN32_LEAN_AND_MEAN +# #include +# +# #ifndef __CYGWIN__ +# # ifdef __CYGWIN32__ +# # define __CYGWIN__ __CYGWIN32__ +# # endif +# #endif +# +# #ifdef __cplusplus +# extern "C" { +# #endif +# BOOL APIENTRY DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved); +# #ifdef __cplusplus +# } +# #endif +# +# #ifdef __CYGWIN__ +# #include +# DECLARE_CYGWIN_DLL( DllMain ); +# #endif +# HINSTANCE __hDllInstance_base; +# +# BOOL APIENTRY +# DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved) +# { +# __hDllInstance_base = hInst; +# return TRUE; +# } +# /* ltdll.c ends here */ +])# _LT_AC_FILE_LTDLL_C + + +# _LT_AC_TAGVAR(VARNAME, [TAGNAME]) +# --------------------------------- +AC_DEFUN([_LT_AC_TAGVAR], [ifelse([$2], [], [$1], [$1_$2])]) + + +# old names +AC_DEFUN([AM_PROG_LIBTOOL], [AC_PROG_LIBTOOL]) +AC_DEFUN([AM_ENABLE_SHARED], [AC_ENABLE_SHARED($@)]) +AC_DEFUN([AM_ENABLE_STATIC], [AC_ENABLE_STATIC($@)]) +AC_DEFUN([AM_DISABLE_SHARED], [AC_DISABLE_SHARED($@)]) +AC_DEFUN([AM_DISABLE_STATIC], [AC_DISABLE_STATIC($@)]) +AC_DEFUN([AM_PROG_LD], [AC_PROG_LD]) +AC_DEFUN([AM_PROG_NM], [AC_PROG_NM]) + +# This is just to silence aclocal about the macro not being used +ifelse([AC_DISABLE_FAST_INSTALL]) + +AC_DEFUN([LT_AC_PROG_GCJ], +[AC_CHECK_TOOL(GCJ, gcj, no) + test "x${GCJFLAGS+set}" = xset || GCJFLAGS="-g -O2" + AC_SUBST(GCJFLAGS) +]) + +AC_DEFUN([LT_AC_PROG_RC], +[AC_CHECK_TOOL(RC, windres, no) +]) + + +# Cheap backport of AS_EXECUTABLE_P and required macros +# from Autoconf 2.59; we should not use $as_executable_p directly. + +# _AS_TEST_PREPARE +# ---------------- +m4_ifndef([_AS_TEST_PREPARE], +[m4_defun([_AS_TEST_PREPARE], +[if test -x / >/dev/null 2>&1; then + as_executable_p='test -x' +else + as_executable_p='test -f' +fi +])])# _AS_TEST_PREPARE + +# AS_EXECUTABLE_P +# --------------- +# Check whether a file is executable. +m4_ifndef([AS_EXECUTABLE_P], +[m4_defun([AS_EXECUTABLE_P], +[AS_REQUIRE([_AS_TEST_PREPARE])dnl +$as_executable_p $1[]dnl +])])# AS_EXECUTABLE_P + +# NOTE: This macro has been submitted for inclusion into # +# GNU Autoconf as AC_PROG_SED. When it is available in # +# a released version of Autoconf we should remove this # +# macro and use it instead. # +# LT_AC_PROG_SED +# -------------- +# Check for a fully-functional sed program, that truncates +# as few characters as possible. Prefer GNU sed if found. +AC_DEFUN([LT_AC_PROG_SED], +[AC_MSG_CHECKING([for a sed that does not truncate output]) +AC_CACHE_VAL(lt_cv_path_SED, +[# Loop through the user's path and test for sed and gsed. +# Then use that list of sed's as ones to test for truncation. +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for lt_ac_prog in sed gsed; do + for ac_exec_ext in '' $ac_executable_extensions; do + if AS_EXECUTABLE_P(["$as_dir/$lt_ac_prog$ac_exec_ext"]); then + lt_ac_sed_list="$lt_ac_sed_list $as_dir/$lt_ac_prog$ac_exec_ext" + fi + done + done +done +IFS=$as_save_IFS +lt_ac_max=0 +lt_ac_count=0 +# Add /usr/xpg4/bin/sed as it is typically found on Solaris +# along with /bin/sed that truncates output. +for lt_ac_sed in $lt_ac_sed_list /usr/xpg4/bin/sed; do + test ! -f $lt_ac_sed && continue + cat /dev/null > conftest.in + lt_ac_count=0 + echo $ECHO_N "0123456789$ECHO_C" >conftest.in + # Check for GNU sed and select it if it is found. + if "$lt_ac_sed" --version 2>&1 < /dev/null | grep 'GNU' > /dev/null; then + lt_cv_path_SED=$lt_ac_sed + break + fi + while true; do + cat conftest.in conftest.in >conftest.tmp + mv conftest.tmp conftest.in + cp conftest.in conftest.nl + echo >>conftest.nl + $lt_ac_sed -e 's/a$//' < conftest.nl >conftest.out || break + cmp -s conftest.out conftest.nl || break + # 10000 chars as input seems more than enough + test $lt_ac_count -gt 10 && break + lt_ac_count=`expr $lt_ac_count + 1` + if test $lt_ac_count -gt $lt_ac_max; then + lt_ac_max=$lt_ac_count + lt_cv_path_SED=$lt_ac_sed + fi + done +done +]) +SED=$lt_cv_path_SED +AC_SUBST([SED]) +AC_MSG_RESULT([$SED]) +]) + +# pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*- +# +# Copyright © 2004 Scott James Remnant . +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# PKG_PROG_PKG_CONFIG([MIN-VERSION]) +# ---------------------------------- +AC_DEFUN([PKG_PROG_PKG_CONFIG], +[m4_pattern_forbid([^_?PKG_[A-Z_]+$]) +m4_pattern_allow([^PKG_CONFIG(_PATH)?$]) +AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])dnl +if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then + AC_PATH_TOOL([PKG_CONFIG], [pkg-config]) +fi +if test -n "$PKG_CONFIG"; then + _pkg_min_version=m4_default([$1], [0.9.0]) + AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version]) + if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then + AC_MSG_RESULT([yes]) + else + AC_MSG_RESULT([no]) + PKG_CONFIG="" + fi + +fi[]dnl +])# PKG_PROG_PKG_CONFIG + +# PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) +# +# Check to see whether a particular set of modules exists. Similar +# to PKG_CHECK_MODULES(), but does not set variables or print errors. +# +# +# Similar to PKG_CHECK_MODULES, make sure that the first instance of +# this or PKG_CHECK_MODULES is called, or make sure to call +# PKG_CHECK_EXISTS manually +# -------------------------------------------------------------- +AC_DEFUN([PKG_CHECK_EXISTS], +[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl +if test -n "$PKG_CONFIG" && \ + AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then + m4_ifval([$2], [$2], [:]) +m4_ifvaln([$3], [else + $3])dnl +fi]) + + +# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES]) +# --------------------------------------------- +m4_define([_PKG_CONFIG], +[if test -n "$PKG_CONFIG"; then + if test -n "$$1"; then + pkg_cv_[]$1="$$1" + else + PKG_CHECK_EXISTS([$3], + [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`], + [pkg_failed=yes]) + fi +else + pkg_failed=untried +fi[]dnl +])# _PKG_CONFIG + +# _PKG_SHORT_ERRORS_SUPPORTED +# ----------------------------- +AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED], +[AC_REQUIRE([PKG_PROG_PKG_CONFIG]) +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi[]dnl +])# _PKG_SHORT_ERRORS_SUPPORTED + + +# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND], +# [ACTION-IF-NOT-FOUND]) +# +# +# Note that if there is a possibility the first call to +# PKG_CHECK_MODULES might not happen, you should be sure to include an +# explicit call to PKG_PROG_PKG_CONFIG in your configure.ac +# +# +# -------------------------------------------------------------- +AC_DEFUN([PKG_CHECK_MODULES], +[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl +AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl +AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl + +pkg_failed=no +AC_MSG_CHECKING([for $1]) + +_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2]) +_PKG_CONFIG([$1][_LIBS], [libs], [$2]) + +m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS +and $1[]_LIBS to avoid the need to call pkg-config. +See the pkg-config man page for more details.]) + +if test $pkg_failed = yes; then + _PKG_SHORT_ERRORS_SUPPORTED + if test $_pkg_short_errors_supported = yes; then + $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --errors-to-stdout --print-errors "$2"` + else + $1[]_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "$2"` + fi + # Put the nasty error message in config.log where it belongs + echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD + + ifelse([$4], , [AC_MSG_ERROR(dnl +[Package requirements ($2) were not met: + +$$1_PKG_ERRORS + +Consider adjusting the PKG_CONFIG_PATH environment variable if you +installed software in a non-standard prefix. + +_PKG_TEXT +])], + [AC_MSG_RESULT([no]) + $4]) +elif test $pkg_failed = untried; then + ifelse([$4], , [AC_MSG_FAILURE(dnl +[The pkg-config script could not be found or is too old. Make sure it +is in your PATH or set the PKG_CONFIG environment variable to the full +path to pkg-config. + +_PKG_TEXT + +To get pkg-config, see .])], + [$4]) +else + $1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS + $1[]_LIBS=$pkg_cv_[]$1[]_LIBS + AC_MSG_RESULT([yes]) + ifelse([$3], , :, [$3]) +fi[]dnl +])# PKG_CHECK_MODULES + +dnl +dnl Copyright 2005-2006 Sun Microsystems, Inc. All rights reserved. +dnl +dnl Permission is hereby granted, free of charge, to any person obtaining a +dnl copy of this software and associated documentation files (the +dnl "Software"), to deal in the Software without restriction, including +dnl without limitation the rights to use, copy, modify, merge, publish, +dnl distribute, and/or sell copies of the Software, and to permit persons +dnl to whom the Software is furnished to do so, provided that the above +dnl copyright notice(s) and this permission notice appear in all copies of +dnl the Software and that both the above copyright notice(s) and this +dnl permission notice appear in supporting documentation. +dnl +dnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +dnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +dnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT +dnl OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +dnl HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL +dnl INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING +dnl FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, +dnl NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION +dnl WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +dnl +dnl Except as contained in this notice, the name of a copyright holder +dnl shall not be used in advertising or otherwise to promote the sale, use +dnl or other dealings in this Software without prior written authorization +dnl of the copyright holder. + +# XORG_MACROS_VERSION(required-version) +# ------------------------------------- +# Minimum version: 1.1.0 +# +# If you're using a macro added in Version 1.1 or newer, include this in +# your configure.ac with the minimum required version, such as: +# XORG_MACROS_VERSION(1.1) +# +# To force at least a version with this macro defined, also add: +# m4_ifndef([XORG_MACROS_VERSION], [AC_FATAL([must install xorg-macros 1.1 or later before running autoconf/autogen])]) +# +# +# See the "minimum version" comment for each macro you use to see what +# version you require. +AC_DEFUN([XORG_MACROS_VERSION],[ + [XORG_MACROS_needed_version=$1 + XORG_MACROS_needed_major=`echo $XORG_MACROS_needed_version | sed 's/\..*$//'` + XORG_MACROS_needed_minor=`echo $XORG_MACROS_needed_version | sed -e 's/^[0-9]*\.//' -e 's/\..*$//'`] + AC_MSG_CHECKING([if xorg-macros used to generate configure is at least ${XORG_MACROS_needed_major}.${XORG_MACROS_needed_minor}]) + [XORG_MACROS_version=1.1.5 + XORG_MACROS_major=`echo $XORG_MACROS_version | sed 's/\..*$//'` + XORG_MACROS_minor=`echo $XORG_MACROS_version | sed -e 's/^[0-9]*\.//' -e 's/\..*$//'`] + if test $XORG_MACROS_major -ne $XORG_MACROS_needed_major ; then + AC_MSG_ERROR([configure built with incompatible version of xorg-macros.m4 - requires version ${XORG_MACROS_major}.x]) + fi + if test $XORG_MACROS_minor -lt $XORG_MACROS_needed_minor ; then + AC_MSG_ERROR([configure built with too old of a version of xorg-macros.m4 - requires version ${XORG_MACROS_major}.${XORG_MACROS_minor}.0 or newer]) + fi + AC_MSG_RESULT([yes, $XORG_MACROS_version]) +]) # XORG_MACROS_VERSION + +# XORG_PROG_RAWCPP() +# ------------------ +# Minimum version: 1.0.0 +# +# Find cpp program and necessary flags for use in pre-processing text files +# such as man pages and config files +AC_DEFUN([XORG_PROG_RAWCPP],[ +AC_REQUIRE([AC_PROG_CPP]) +AC_PATH_PROGS(RAWCPP, [cpp], [${CPP}], + [$PATH:/bin:/usr/bin:/usr/lib:/usr/libexec:/usr/ccs/lib:/usr/ccs/lbin:/lib]) + +# Check for flag to avoid builtin definitions - assumes unix is predefined, +# which is not the best choice for supporting other OS'es, but covers most +# of the ones we need for now. +AC_MSG_CHECKING([if $RAWCPP requires -undef]) +AC_LANG_CONFTEST([Does cpp redefine unix ?]) +if test `${RAWCPP} < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then + AC_MSG_RESULT([no]) +else + if test `${RAWCPP} -undef < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then + RAWCPPFLAGS=-undef + AC_MSG_RESULT([yes]) + else + AC_MSG_ERROR([${RAWCPP} defines unix with or without -undef. I don't know what to do.]) + fi +fi +rm -f conftest.$ac_ext + +AC_MSG_CHECKING([if $RAWCPP requires -traditional]) +AC_LANG_CONFTEST([Does cpp preserve "whitespace"?]) +if test `${RAWCPP} < conftest.$ac_ext | grep -c 'preserve \"'` -eq 1 ; then + AC_MSG_RESULT([no]) +else + if test `${RAWCPP} -traditional < conftest.$ac_ext | grep -c 'preserve \"'` -eq 1 ; then + RAWCPPFLAGS="${RAWCPPFLAGS} -traditional" + AC_MSG_RESULT([yes]) + else + AC_MSG_ERROR([${RAWCPP} does not preserve whitespace with or without -traditional. I don't know what to do.]) + fi +fi +rm -f conftest.$ac_ext +AC_SUBST(RAWCPPFLAGS) +]) # XORG_PROG_RAWCPP + +# XORG_MANPAGE_SECTIONS() +# ----------------------- +# Minimum version: 1.0.0 +# +# Determine which sections man pages go in for the different man page types +# on this OS - replaces *ManSuffix settings in old Imake *.cf per-os files. +# Not sure if there's any better way than just hardcoding by OS name. +# Override default settings by setting environment variables + +AC_DEFUN([XORG_MANPAGE_SECTIONS],[ +AC_REQUIRE([AC_CANONICAL_HOST]) + +if test x$APP_MAN_SUFFIX = x ; then + APP_MAN_SUFFIX=1 +fi +if test x$APP_MAN_DIR = x ; then + APP_MAN_DIR='$(mandir)/man$(APP_MAN_SUFFIX)' +fi + +if test x$LIB_MAN_SUFFIX = x ; then + LIB_MAN_SUFFIX=3 +fi +if test x$LIB_MAN_DIR = x ; then + LIB_MAN_DIR='$(mandir)/man$(LIB_MAN_SUFFIX)' +fi + +if test x$FILE_MAN_SUFFIX = x ; then + case $host_os in + solaris*) FILE_MAN_SUFFIX=4 ;; + *) FILE_MAN_SUFFIX=5 ;; + esac +fi +if test x$FILE_MAN_DIR = x ; then + FILE_MAN_DIR='$(mandir)/man$(FILE_MAN_SUFFIX)' +fi + +if test x$MISC_MAN_SUFFIX = x ; then + case $host_os in + solaris*) MISC_MAN_SUFFIX=5 ;; + *) MISC_MAN_SUFFIX=7 ;; + esac +fi +if test x$MISC_MAN_DIR = x ; then + MISC_MAN_DIR='$(mandir)/man$(MISC_MAN_SUFFIX)' +fi + +if test x$DRIVER_MAN_SUFFIX = x ; then + case $host_os in + solaris*) DRIVER_MAN_SUFFIX=7 ;; + *) DRIVER_MAN_SUFFIX=4 ;; + esac +fi +if test x$DRIVER_MAN_DIR = x ; then + DRIVER_MAN_DIR='$(mandir)/man$(DRIVER_MAN_SUFFIX)' +fi + +if test x$ADMIN_MAN_SUFFIX = x ; then + case $host_os in + solaris*) ADMIN_MAN_SUFFIX=1m ;; + *) ADMIN_MAN_SUFFIX=8 ;; + esac +fi +if test x$ADMIN_MAN_DIR = x ; then + ADMIN_MAN_DIR='$(mandir)/man$(ADMIN_MAN_SUFFIX)' +fi + + +AC_SUBST([APP_MAN_SUFFIX]) +AC_SUBST([LIB_MAN_SUFFIX]) +AC_SUBST([FILE_MAN_SUFFIX]) +AC_SUBST([MISC_MAN_SUFFIX]) +AC_SUBST([DRIVER_MAN_SUFFIX]) +AC_SUBST([ADMIN_MAN_SUFFIX]) +AC_SUBST([APP_MAN_DIR]) +AC_SUBST([LIB_MAN_DIR]) +AC_SUBST([FILE_MAN_DIR]) +AC_SUBST([MISC_MAN_DIR]) +AC_SUBST([DRIVER_MAN_DIR]) +AC_SUBST([ADMIN_MAN_DIR]) +]) # XORG_MANPAGE_SECTIONS + +# XORG_CHECK_LINUXDOC +# ------------------- +# Minimum version: 1.0.0 +# +# Defines the variable MAKE_TEXT if the necessary tools and +# files are found. $(MAKE_TEXT) blah.sgml will then produce blah.txt. +# Whether or not the necessary tools and files are found can be checked +# with the AM_CONDITIONAL "BUILD_LINUXDOC" +AC_DEFUN([XORG_CHECK_LINUXDOC],[ +XORG_SGML_PATH=$prefix/share/sgml +HAVE_DEFS_ENT= + +AC_CHECK_FILE([$XORG_SGML_PATH/X11/defs.ent], [HAVE_DEFS_ENT=yes]) + +AC_PATH_PROG(LINUXDOC, linuxdoc) +AC_PATH_PROG(PS2PDF, ps2pdf) + +AC_MSG_CHECKING([Whether to build documentation]) + +if test x$HAVE_DEFS_ENT != x && test x$LINUXDOC != x ; then + BUILDDOC=yes +else + BUILDDOC=no +fi + +AM_CONDITIONAL(BUILD_LINUXDOC, [test x$BUILDDOC = xyes]) + +AC_MSG_RESULT([$BUILDDOC]) + +AC_MSG_CHECKING([Whether to build pdf documentation]) + +if test x$PS2PDF != x && test x$BUILD_PDFDOC != xno; then + BUILDPDFDOC=yes +else + BUILDPDFDOC=no +fi + +AM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes]) + +AC_MSG_RESULT([$BUILDPDFDOC]) + +MAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH GROFF_NO_SGR=y $LINUXDOC -B txt" +MAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC -B latex --papersize=letter --output=ps" +MAKE_PDF="$PS2PDF" +MAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC -B html --split=0" + +AC_SUBST(MAKE_TEXT) +AC_SUBST(MAKE_PS) +AC_SUBST(MAKE_PDF) +AC_SUBST(MAKE_HTML) +]) # XORG_CHECK_LINUXDOC + +# XORG_CHECK_DOCBOOK +# ------------------- +# Minimum version: 1.0.0 +# +# Checks for the ability to build output formats from SGML DocBook source. +# For XXX in {TXT, PDF, PS, HTML}, the AM_CONDITIONAL "BUILD_XXXDOC" +# indicates whether the necessary tools and files are found and, if set, +# $(MAKE_XXX) blah.sgml will produce blah.xxx. +AC_DEFUN([XORG_CHECK_DOCBOOK],[ +XORG_SGML_PATH=$prefix/share/sgml +HAVE_DEFS_ENT= +BUILDTXTDOC=no +BUILDPDFDOC=no +BUILDPSDOC=no +BUILDHTMLDOC=no + +AC_CHECK_FILE([$XORG_SGML_PATH/X11/defs.ent], [HAVE_DEFS_ENT=yes]) + +AC_PATH_PROG(DOCBOOKPS, docbook2ps) +AC_PATH_PROG(DOCBOOKPDF, docbook2pdf) +AC_PATH_PROG(DOCBOOKHTML, docbook2html) +AC_PATH_PROG(DOCBOOKTXT, docbook2txt) + +AC_MSG_CHECKING([Whether to build text documentation]) +if test x$HAVE_DEFS_ENT != x && test x$DOCBOOKTXT != x && + test x$BUILD_TXTDOC != xno; then + BUILDTXTDOC=yes +fi +AM_CONDITIONAL(BUILD_TXTDOC, [test x$BUILDTXTDOC = xyes]) +AC_MSG_RESULT([$BUILDTXTDOC]) + +AC_MSG_CHECKING([Whether to build PDF documentation]) +if test x$HAVE_DEFS_ENT != x && test x$DOCBOOKPDF != x && + test x$BUILD_PDFDOC != xno; then + BUILDPDFDOC=yes +fi +AM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes]) +AC_MSG_RESULT([$BUILDPDFDOC]) + +AC_MSG_CHECKING([Whether to build PostScript documentation]) +if test x$HAVE_DEFS_ENT != x && test x$DOCBOOKPS != x && + test x$BUILD_PSDOC != xno; then + BUILDPSDOC=yes +fi +AM_CONDITIONAL(BUILD_PSDOC, [test x$BUILDPSDOC = xyes]) +AC_MSG_RESULT([$BUILDPSDOC]) + +AC_MSG_CHECKING([Whether to build HTML documentation]) +if test x$HAVE_DEFS_ENT != x && test x$DOCBOOKHTML != x && + test x$BUILD_HTMLDOC != xno; then + BUILDHTMLDOC=yes +fi +AM_CONDITIONAL(BUILD_HTMLDOC, [test x$BUILDHTMLDOC = xyes]) +AC_MSG_RESULT([$BUILDHTMLDOC]) + +MAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKTXT" +MAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPS" +MAKE_PDF="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPDF" +MAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKHTML" + +AC_SUBST(MAKE_TEXT) +AC_SUBST(MAKE_PS) +AC_SUBST(MAKE_PDF) +AC_SUBST(MAKE_HTML) +]) # XORG_CHECK_DOCBOOK + +# XORG_CHECK_MALLOC_ZERO +# ---------------------- +# Minimum version: 1.0.0 +# +# Defines {MALLOC,XMALLOC,XTMALLOC}_ZERO_CFLAGS appropriately if +# malloc(0) returns NULL. Packages should add one of these cflags to +# their AM_CFLAGS (or other appropriate *_CFLAGS) to use them. +AC_DEFUN([XORG_CHECK_MALLOC_ZERO],[ +AC_ARG_ENABLE(malloc0returnsnull, + AC_HELP_STRING([--enable-malloc0returnsnull], + [malloc(0) returns NULL (default: auto)]), + [MALLOC_ZERO_RETURNS_NULL=$enableval], + [MALLOC_ZERO_RETURNS_NULL=auto]) + +AC_MSG_CHECKING([whether malloc(0) returns NULL]) +if test "x$MALLOC_ZERO_RETURNS_NULL" = xauto; then + AC_RUN_IFELSE([ +char *malloc(); +char *realloc(); +char *calloc(); +main() { + char *m0, *r0, *c0, *p; + m0 = malloc(0); + p = malloc(10); + r0 = realloc(p,0); + c0 = calloc(0); + exit(m0 == 0 || r0 == 0 || c0 == 0 ? 0 : 1); +}], + [MALLOC_ZERO_RETURNS_NULL=yes], + [MALLOC_ZERO_RETURNS_NULL=no]) +fi +AC_MSG_RESULT([$MALLOC_ZERO_RETURNS_NULL]) + +if test "x$MALLOC_ZERO_RETURNS_NULL" = xyes; then + MALLOC_ZERO_CFLAGS="-DMALLOC_0_RETURNS_NULL" + XMALLOC_ZERO_CFLAGS=$MALLOC_ZERO_CFLAGS + XTMALLOC_ZERO_CFLAGS="$MALLOC_ZERO_CFLAGS -DXTMALLOC_BC" +else + MALLOC_ZERO_CFLAGS="" + XMALLOC_ZERO_CFLAGS="" + XTMALLOC_ZERO_CFLAGS="" +fi + +AC_SUBST([MALLOC_ZERO_CFLAGS]) +AC_SUBST([XMALLOC_ZERO_CFLAGS]) +AC_SUBST([XTMALLOC_ZERO_CFLAGS]) +]) # XORG_CHECK_MALLOC_ZERO + +# XORG_WITH_LINT() +# ---------------- +# Minimum version: 1.1.0 +# +# Sets up flags for source checkers such as lint and sparse if --with-lint +# is specified. (Use --with-lint=sparse for sparse.) +# Sets $LINT to name of source checker passed with --with-lint (default: lint) +# Sets $LINT_FLAGS to flags to pass to source checker +# Sets LINT automake conditional if enabled (default: disabled) +# +AC_DEFUN([XORG_WITH_LINT],[ + +# Allow checking code with lint, sparse, etc. +AC_ARG_WITH(lint, [AC_HELP_STRING([--with-lint], + [Use a lint-style source code checker (default: disabled)])], + [use_lint=$withval], [use_lint=no]) +if test "x$use_lint" = "xyes" ; then + LINT="lint" +else + LINT="$use_lint" +fi +if test "x$LINT_FLAGS" = "x" -a "x$LINT" != "xno" ; then + case $LINT in + lint|*/lint) + case $host_os in + solaris*) + LINT_FLAGS="-u -b -h -erroff=E_INDISTING_FROM_TRUNC2" + ;; + esac + ;; + esac +fi + +AC_SUBST(LINT) +AC_SUBST(LINT_FLAGS) +AM_CONDITIONAL(LINT, [test x$LINT != xno]) + +]) # XORG_WITH_LINT + +# XORG_LINT_LIBRARY(LIBNAME) +# -------------------------- +# Minimum version: 1.1.0 +# +# Sets up flags for building lint libraries for checking programs that call +# functions in the library. +# Disabled by default, enable with --enable-lint-library +# Sets: +# @LINTLIB@ - name of lint library file to make +# MAKE_LINT_LIB - automake conditional +# + +AC_DEFUN([XORG_LINT_LIBRARY],[ +AC_REQUIRE([XORG_WITH_LINT]) +# Build lint "library" for more indepth checks of programs calling this library +AC_ARG_ENABLE(lint-library, [AC_HELP_STRING([--enable-lint-library], + [Create lint library (default: disabled)])], + [make_lint_lib=$enableval], [make_lint_lib=no]) +if test "x$make_lint_lib" != "xno" ; then + if test "x$LINT" = "xno" ; then + AC_MSG_ERROR([Cannot make lint library without --with-lint]) + fi + if test "x$make_lint_lib" = "xyes" ; then + LINTLIB=llib-l$1.ln + else + LINTLIB=$make_lint_lib + fi +fi +AC_SUBST(LINTLIB) +AM_CONDITIONAL(MAKE_LINT_LIB, [test x$make_lint_lib != xno]) + +]) # XORG_LINT_LIBRARY + +dnl Copyright 2005 Red Hat, Inc +dnl +dnl Permission to use, copy, modify, distribute, and sell this software and its +dnl documentation for any purpose is hereby granted without fee, provided that +dnl the above copyright notice appear in all copies and that both that +dnl copyright notice and this permission notice appear in supporting +dnl documentation. +dnl +dnl The above copyright notice and this permission notice shall be included +dnl in all copies or substantial portions of the Software. +dnl +dnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +dnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +dnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +dnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR +dnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +dnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +dnl OTHER DEALINGS IN THE SOFTWARE. +dnl +dnl Except as contained in this notice, the name of the copyright holders shall +dnl not be used in advertising or otherwise to promote the sale, use or +dnl other dealings in this Software without prior written authorization +dnl from the copyright holders. +dnl + +# XORG_DRIVER_CHECK_EXT() +# -------------------------- +# Checks for the $1 define in xorg-server.h (from the sdk). If it +# is defined, then add $1 to $REQUIRED_MODULES. + +AC_DEFUN([XORG_DRIVER_CHECK_EXT],[ + SAVE_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -I`pkg-config --variable=sdkdir xorg-server`" + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ +#include "xorg-server.h" +#if !defined $1 +#error $1 not defined +#endif + ]])], + [_EXT_CHECK=yes], + [_EXT_CHECK=no]) + CFLAGS="$SAVE_CFLAGS" + AC_MSG_CHECKING([if $1 is defined]) + AC_MSG_RESULT([$_EXT_CHECK]) + if test "$_EXT_CHECK" != no; then + REQUIRED_MODULES="$REQUIRED_MODULES $2" + fi +]) + +dnl Copyright 2005 Red Hat, Inc +dnl +dnl Permission to use, copy, modify, distribute, and sell this software and its +dnl documentation for any purpose is hereby granted without fee, provided that +dnl the above copyright notice appear in all copies and that both that +dnl copyright notice and this permission notice appear in supporting +dnl documentation. +dnl +dnl The above copyright notice and this permission notice shall be included +dnl in all copies or substantial portions of the Software. +dnl +dnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +dnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +dnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +dnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR +dnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +dnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +dnl OTHER DEALINGS IN THE SOFTWARE. +dnl +dnl Except as contained in this notice, the name of the copyright holders shall +dnl not be used in advertising or otherwise to promote the sale, use or +dnl other dealings in this Software without prior written authorization +dnl from the copyright holders. +dnl + +# XORG_RELEASE_VERSION +# -------------------- +# Adds --with/without-release-string and changes the PACKAGE and +# PACKAGE_TARNAME to use "$PACKAGE{_TARNAME}-$RELEASE_VERSION". If +# no option is given, PACKAGE and PACKAGE_TARNAME are unchanged. Also +# defines PACKAGE_VERSION_{MAJOR,MINOR,PATCHLEVEL} for modules to use. + +AC_DEFUN([XORG_RELEASE_VERSION],[ + AC_ARG_WITH(release-version, + AC_HELP_STRING([--with-release-version=STRING], + [Use release version string in package name]), + [RELEASE_VERSION="$withval"], + [RELEASE_VERSION=""]) + if test "x$RELEASE_VERSION" != "x"; then + PACKAGE="$PACKAGE-$RELEASE_VERSION" + PACKAGE_TARNAME="$PACKAGE_TARNAME-$RELEASE_VERSION" + AC_MSG_NOTICE([Building with package name set to $PACKAGE]) + fi + AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MAJOR], + [`echo $PACKAGE_VERSION | cut -d . -f 1`], + [Major version of this package]) + PVM=`echo $PACKAGE_VERSION | cut -d . -f 2` + if test "x$PVM" = "x"; then + PVM="0" + fi + AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MINOR], + [$PVM], + [Minor version of this package]) + PVP=`echo $PACKAGE_VERSION | cut -d . -f 3` + if test "x$PVP" = "x"; then + PVP="0" + fi + AC_DEFINE_UNQUOTED([PACKAGE_VERSION_PATCHLEVEL], + [$PVP], + [Patch version of this package]) +]) + +# Copyright (C) 2002, 2003, 2005, 2006 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# AM_AUTOMAKE_VERSION(VERSION) +# ---------------------------- +# Automake X.Y traces this macro to ensure aclocal.m4 has been +# generated from the m4 files accompanying Automake X.Y. +# (This private macro should not be called outside this file.) +AC_DEFUN([AM_AUTOMAKE_VERSION], +[am__api_version='1.10' +dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to +dnl require some minimum version. Point them to the right macro. +m4_if([$1], [1.10], [], + [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl +]) + +# _AM_AUTOCONF_VERSION(VERSION) +# ----------------------------- +# aclocal traces this macro to find the Autoconf version. +# This is a private macro too. Using m4_define simplifies +# the logic in aclocal, which can simply ignore this definition. +m4_define([_AM_AUTOCONF_VERSION], []) + +# AM_SET_CURRENT_AUTOMAKE_VERSION +# ------------------------------- +# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced. +# This function is AC_REQUIREd by AC_INIT_AUTOMAKE. +AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], +[AM_AUTOMAKE_VERSION([1.10])dnl +_AM_AUTOCONF_VERSION(m4_PACKAGE_VERSION)]) + +# Figure out how to run the assembler. -*- Autoconf -*- + +# Copyright (C) 2001, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 5 + +# AM_PROG_AS +# ---------- +AC_DEFUN([AM_PROG_AS], +[# By default we simply use the C compiler to build assembly code. +AC_REQUIRE([AC_PROG_CC]) +test "${CCAS+set}" = set || CCAS=$CC +test "${CCASFLAGS+set}" = set || CCASFLAGS=$CFLAGS +AC_ARG_VAR([CCAS], [assembler compiler command (defaults to CC)]) +AC_ARG_VAR([CCASFLAGS], [assembler compiler flags (defaults to CFLAGS)]) +_AM_IF_OPTION([no-dependencies],, [_AM_DEPENDENCIES([CCAS])])dnl +]) + +# AM_AUX_DIR_EXPAND -*- Autoconf -*- + +# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets +# $ac_aux_dir to `$srcdir/foo'. In other projects, it is set to +# `$srcdir', `$srcdir/..', or `$srcdir/../..'. +# +# Of course, Automake must honor this variable whenever it calls a +# tool from the auxiliary directory. The problem is that $srcdir (and +# therefore $ac_aux_dir as well) can be either absolute or relative, +# depending on how configure is run. This is pretty annoying, since +# it makes $ac_aux_dir quite unusable in subdirectories: in the top +# source directory, any form will work fine, but in subdirectories a +# relative path needs to be adjusted first. +# +# $ac_aux_dir/missing +# fails when called from a subdirectory if $ac_aux_dir is relative +# $top_srcdir/$ac_aux_dir/missing +# fails if $ac_aux_dir is absolute, +# fails when called from a subdirectory in a VPATH build with +# a relative $ac_aux_dir +# +# The reason of the latter failure is that $top_srcdir and $ac_aux_dir +# are both prefixed by $srcdir. In an in-source build this is usually +# harmless because $srcdir is `.', but things will broke when you +# start a VPATH build or use an absolute $srcdir. +# +# So we could use something similar to $top_srcdir/$ac_aux_dir/missing, +# iff we strip the leading $srcdir from $ac_aux_dir. That would be: +# am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"` +# and then we would define $MISSING as +# MISSING="\${SHELL} $am_aux_dir/missing" +# This will work as long as MISSING is not called from configure, because +# unfortunately $(top_srcdir) has no meaning in configure. +# However there are other variables, like CC, which are often used in +# configure, and could therefore not use this "fixed" $ac_aux_dir. +# +# Another solution, used here, is to always expand $ac_aux_dir to an +# absolute PATH. The drawback is that using absolute paths prevent a +# configured tree to be moved without reconfiguration. + +AC_DEFUN([AM_AUX_DIR_EXPAND], +[dnl Rely on autoconf to set up CDPATH properly. +AC_PREREQ([2.50])dnl +# expand $ac_aux_dir to an absolute path +am_aux_dir=`cd $ac_aux_dir && pwd` +]) + +# AM_CONDITIONAL -*- Autoconf -*- + +# Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005, 2006 +# Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 8 + +# AM_CONDITIONAL(NAME, SHELL-CONDITION) +# ------------------------------------- +# Define a conditional. +AC_DEFUN([AM_CONDITIONAL], +[AC_PREREQ(2.52)dnl + ifelse([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])], + [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl +AC_SUBST([$1_TRUE])dnl +AC_SUBST([$1_FALSE])dnl +_AM_SUBST_NOTMAKE([$1_TRUE])dnl +_AM_SUBST_NOTMAKE([$1_FALSE])dnl +if $2; then + $1_TRUE= + $1_FALSE='#' +else + $1_TRUE='#' + $1_FALSE= +fi +AC_CONFIG_COMMANDS_PRE( +[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then + AC_MSG_ERROR([[conditional "$1" was never defined. +Usually this means the macro was only invoked conditionally.]]) +fi])]) + +# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 +# Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 9 + +# There are a few dirty hacks below to avoid letting `AC_PROG_CC' be +# written in clear, in which case automake, when reading aclocal.m4, +# will think it sees a *use*, and therefore will trigger all it's +# C support machinery. Also note that it means that autoscan, seeing +# CC etc. in the Makefile, will ask for an AC_PROG_CC use... + + +# _AM_DEPENDENCIES(NAME) +# ---------------------- +# See how the compiler implements dependency checking. +# NAME is "CC", "CXX", "GCJ", or "OBJC". +# We try a few techniques and use that to set a single cache variable. +# +# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was +# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular +# dependency, and given that the user is not expected to run this macro, +# just rely on AC_PROG_CC. +AC_DEFUN([_AM_DEPENDENCIES], +[AC_REQUIRE([AM_SET_DEPDIR])dnl +AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl +AC_REQUIRE([AM_MAKE_INCLUDE])dnl +AC_REQUIRE([AM_DEP_TRACK])dnl + +ifelse([$1], CC, [depcc="$CC" am_compiler_list=], + [$1], CXX, [depcc="$CXX" am_compiler_list=], + [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'], + [$1], UPC, [depcc="$UPC" am_compiler_list=], + [$1], GCJ, [depcc="$GCJ" am_compiler_list='gcc3 gcc'], + [depcc="$$1" am_compiler_list=]) + +AC_CACHE_CHECK([dependency style of $depcc], + [am_cv_$1_dependencies_compiler_type], +[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then + # We make a subdir and do the tests there. Otherwise we can end up + # making bogus files that we don't know about and never remove. For + # instance it was reported that on HP-UX the gcc test will end up + # making a dummy file named `D' -- because `-MD' means `put the output + # in D'. + mkdir conftest.dir + # Copy depcomp to subdir because otherwise we won't find it if we're + # using a relative directory. + cp "$am_depcomp" conftest.dir + cd conftest.dir + # We will build objects and dependencies in a subdirectory because + # it helps to detect inapplicable dependency modes. For instance + # both Tru64's cc and ICC support -MD to output dependencies as a + # side effect of compilation, but ICC will put the dependencies in + # the current directory while Tru64 will put them in the object + # directory. + mkdir sub + + am_cv_$1_dependencies_compiler_type=none + if test "$am_compiler_list" = ""; then + am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp` + fi + for depmode in $am_compiler_list; do + # Setup a source with many dependencies, because some compilers + # like to wrap large dependency lists on column 80 (with \), and + # we should not choose a depcomp mode which is confused by this. + # + # We need to recreate these files for each test, as the compiler may + # overwrite some of them when testing with obscure command lines. + # This happens at least with the AIX C compiler. + : > sub/conftest.c + for i in 1 2 3 4 5 6; do + echo '#include "conftst'$i'.h"' >> sub/conftest.c + # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with + # Solaris 8's {/usr,}/bin/sh. + touch sub/conftst$i.h + done + echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf + + case $depmode in + nosideeffect) + # after this tag, mechanisms are not by side-effect, so they'll + # only be used when explicitly requested + if test "x$enable_dependency_tracking" = xyes; then + continue + else + break + fi + ;; + none) break ;; + esac + # We check with `-c' and `-o' for the sake of the "dashmstdout" + # mode. It turns out that the SunPro C++ compiler does not properly + # handle `-M -o', and we need to detect this. + if depmode=$depmode \ + source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \ + depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ + $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \ + >/dev/null 2>conftest.err && + grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && + grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && + grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 && + ${MAKE-make} -s -f confmf > /dev/null 2>&1; then + # icc doesn't choke on unknown options, it will just issue warnings + # or remarks (even with -Werror). So we grep stderr for any message + # that says an option was ignored or not supported. + # When given -MP, icc 7.0 and 7.1 complain thusly: + # icc: Command line warning: ignoring option '-M'; no argument required + # The diagnosis changed in icc 8.0: + # icc: Command line remark: option '-MP' not supported + if (grep 'ignoring option' conftest.err || + grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else + am_cv_$1_dependencies_compiler_type=$depmode + break + fi + fi + done + + cd .. + rm -rf conftest.dir +else + am_cv_$1_dependencies_compiler_type=none +fi +]) +AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type]) +AM_CONDITIONAL([am__fastdep$1], [ + test "x$enable_dependency_tracking" != xno \ + && test "$am_cv_$1_dependencies_compiler_type" = gcc3]) +]) + + +# AM_SET_DEPDIR +# ------------- +# Choose a directory name for dependency files. +# This macro is AC_REQUIREd in _AM_DEPENDENCIES +AC_DEFUN([AM_SET_DEPDIR], +[AC_REQUIRE([AM_SET_LEADING_DOT])dnl +AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl +]) + + +# AM_DEP_TRACK +# ------------ +AC_DEFUN([AM_DEP_TRACK], +[AC_ARG_ENABLE(dependency-tracking, +[ --disable-dependency-tracking speeds up one-time build + --enable-dependency-tracking do not reject slow dependency extractors]) +if test "x$enable_dependency_tracking" != xno; then + am_depcomp="$ac_aux_dir/depcomp" + AMDEPBACKSLASH='\' +fi +AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno]) +AC_SUBST([AMDEPBACKSLASH])dnl +_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl +]) + +# Generate code to set up dependency tracking. -*- Autoconf -*- + +# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005 +# Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +#serial 3 + +# _AM_OUTPUT_DEPENDENCY_COMMANDS +# ------------------------------ +AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS], +[for mf in $CONFIG_FILES; do + # Strip MF so we end up with the name of the file. + mf=`echo "$mf" | sed -e 's/:.*$//'` + # Check whether this is an Automake generated Makefile or not. + # We used to match only the files named `Makefile.in', but + # some people rename them; so instead we look at the file content. + # Grep'ing the first line is not enough: some people post-process + # each Makefile.in and add a new line on top of each file to say so. + # Grep'ing the whole file is not good either: AIX grep has a line + # limit of 2048, but all sed's we know have understand at least 4000. + if sed 10q "$mf" | grep '^#.*generated by automake' > /dev/null 2>&1; then + dirpart=`AS_DIRNAME("$mf")` + else + continue + fi + # Extract the definition of DEPDIR, am__include, and am__quote + # from the Makefile without running `make'. + DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` + test -z "$DEPDIR" && continue + am__include=`sed -n 's/^am__include = //p' < "$mf"` + test -z "am__include" && continue + am__quote=`sed -n 's/^am__quote = //p' < "$mf"` + # When using ansi2knr, U may be empty or an underscore; expand it + U=`sed -n 's/^U = //p' < "$mf"` + # Find all dependency output files, they are included files with + # $(DEPDIR) in their names. We invoke sed twice because it is the + # simplest approach to changing $(DEPDIR) to its actual value in the + # expansion. + for file in `sed -n " + s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ + sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do + # Make sure the directory exists. + test -f "$dirpart/$file" && continue + fdir=`AS_DIRNAME(["$file"])` + AS_MKDIR_P([$dirpart/$fdir]) + # echo "creating $dirpart/$file" + echo '# dummy' > "$dirpart/$file" + done +done +])# _AM_OUTPUT_DEPENDENCY_COMMANDS + + +# AM_OUTPUT_DEPENDENCY_COMMANDS +# ----------------------------- +# This macro should only be invoked once -- use via AC_REQUIRE. +# +# This code is only required when automatic dependency tracking +# is enabled. FIXME. This creates each `.P' file that we will +# need in order to bootstrap the dependency handling code. +AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS], +[AC_CONFIG_COMMANDS([depfiles], + [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS], + [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"]) +]) + +# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005 +# Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 8 + +# AM_CONFIG_HEADER is obsolete. It has been replaced by AC_CONFIG_HEADERS. +AU_DEFUN([AM_CONFIG_HEADER], [AC_CONFIG_HEADERS($@)]) + +# Do all the work for Automake. -*- Autoconf -*- + +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, +# 2005, 2006 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 12 + +# This macro actually does too much. Some checks are only needed if +# your package does certain things. But this isn't really a big deal. + +# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE]) +# AM_INIT_AUTOMAKE([OPTIONS]) +# ----------------------------------------------- +# The call with PACKAGE and VERSION arguments is the old style +# call (pre autoconf-2.50), which is being phased out. PACKAGE +# and VERSION should now be passed to AC_INIT and removed from +# the call to AM_INIT_AUTOMAKE. +# We support both call styles for the transition. After +# the next Automake release, Autoconf can make the AC_INIT +# arguments mandatory, and then we can depend on a new Autoconf +# release and drop the old call support. +AC_DEFUN([AM_INIT_AUTOMAKE], +[AC_PREREQ([2.60])dnl +dnl Autoconf wants to disallow AM_ names. We explicitly allow +dnl the ones we care about. +m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl +AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl +AC_REQUIRE([AC_PROG_INSTALL])dnl +if test "`cd $srcdir && pwd`" != "`pwd`"; then + # Use -I$(srcdir) only when $(srcdir) != ., so that make's output + # is not polluted with repeated "-I." + AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl + # test to see if srcdir already configured + if test -f $srcdir/config.status; then + AC_MSG_ERROR([source directory already configured; run "make distclean" there first]) + fi +fi + +# test whether we have cygpath +if test -z "$CYGPATH_W"; then + if (cygpath --version) >/dev/null 2>/dev/null; then + CYGPATH_W='cygpath -w' + else + CYGPATH_W=echo + fi +fi +AC_SUBST([CYGPATH_W]) + +# Define the identity of the package. +dnl Distinguish between old-style and new-style calls. +m4_ifval([$2], +[m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl + AC_SUBST([PACKAGE], [$1])dnl + AC_SUBST([VERSION], [$2])], +[_AM_SET_OPTIONS([$1])dnl +dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT. +m4_if(m4_ifdef([AC_PACKAGE_NAME], 1)m4_ifdef([AC_PACKAGE_VERSION], 1), 11,, + [m4_fatal([AC_INIT should be called with package and version arguments])])dnl + AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl + AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl + +_AM_IF_OPTION([no-define],, +[AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package]) + AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl + +# Some tools Automake needs. +AC_REQUIRE([AM_SANITY_CHECK])dnl +AC_REQUIRE([AC_ARG_PROGRAM])dnl +AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version}) +AM_MISSING_PROG(AUTOCONF, autoconf) +AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version}) +AM_MISSING_PROG(AUTOHEADER, autoheader) +AM_MISSING_PROG(MAKEINFO, makeinfo) +AM_PROG_INSTALL_SH +AM_PROG_INSTALL_STRIP +AC_REQUIRE([AM_PROG_MKDIR_P])dnl +# We need awk for the "check" target. The system "awk" is bad on +# some platforms. +AC_REQUIRE([AC_PROG_AWK])dnl +AC_REQUIRE([AC_PROG_MAKE_SET])dnl +AC_REQUIRE([AM_SET_LEADING_DOT])dnl +_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])], + [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])], + [_AM_PROG_TAR([v7])])]) +_AM_IF_OPTION([no-dependencies],, +[AC_PROVIDE_IFELSE([AC_PROG_CC], + [_AM_DEPENDENCIES(CC)], + [define([AC_PROG_CC], + defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl +AC_PROVIDE_IFELSE([AC_PROG_CXX], + [_AM_DEPENDENCIES(CXX)], + [define([AC_PROG_CXX], + defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl +AC_PROVIDE_IFELSE([AC_PROG_OBJC], + [_AM_DEPENDENCIES(OBJC)], + [define([AC_PROG_OBJC], + defn([AC_PROG_OBJC])[_AM_DEPENDENCIES(OBJC)])])dnl +]) +]) + + +# When config.status generates a header, we must update the stamp-h file. +# This file resides in the same directory as the config header +# that is generated. The stamp files are numbered to have different names. + +# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the +# loop where config.status creates the headers, so we can generate +# our stamp files there. +AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK], +[# Compute $1's index in $config_headers. +_am_stamp_count=1 +for _am_header in $config_headers :; do + case $_am_header in + $1 | $1:* ) + break ;; + * ) + _am_stamp_count=`expr $_am_stamp_count + 1` ;; + esac +done +echo "timestamp for $1" >`AS_DIRNAME([$1])`/stamp-h[]$_am_stamp_count]) + +# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# AM_PROG_INSTALL_SH +# ------------------ +# Define $install_sh. +AC_DEFUN([AM_PROG_INSTALL_SH], +[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl +install_sh=${install_sh-"\$(SHELL) $am_aux_dir/install-sh"} +AC_SUBST(install_sh)]) + +# Copyright (C) 2003, 2005 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 2 + +# Check whether the underlying file-system supports filenames +# with a leading dot. For instance MS-DOS doesn't. +AC_DEFUN([AM_SET_LEADING_DOT], +[rm -rf .tst 2>/dev/null +mkdir .tst 2>/dev/null +if test -d .tst; then + am__leading_dot=. +else + am__leading_dot=_ +fi +rmdir .tst 2>/dev/null +AC_SUBST([am__leading_dot])]) + +# Add --enable-maintainer-mode option to configure. -*- Autoconf -*- +# From Jim Meyering + +# Copyright (C) 1996, 1998, 2000, 2001, 2002, 2003, 2004, 2005 +# Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 4 + +AC_DEFUN([AM_MAINTAINER_MODE], +[AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles]) + dnl maintainer-mode is disabled by default + AC_ARG_ENABLE(maintainer-mode, +[ --enable-maintainer-mode enable make rules and dependencies not useful + (and sometimes confusing) to the casual installer], + USE_MAINTAINER_MODE=$enableval, + USE_MAINTAINER_MODE=no) + AC_MSG_RESULT([$USE_MAINTAINER_MODE]) + AM_CONDITIONAL(MAINTAINER_MODE, [test $USE_MAINTAINER_MODE = yes]) + MAINT=$MAINTAINER_MODE_TRUE + AC_SUBST(MAINT)dnl +] +) + +AU_DEFUN([jm_MAINTAINER_MODE], [AM_MAINTAINER_MODE]) + +# Check to see how 'make' treats includes. -*- Autoconf -*- + +# Copyright (C) 2001, 2002, 2003, 2005 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 3 + +# AM_MAKE_INCLUDE() +# ----------------- +# Check to see how make treats includes. +AC_DEFUN([AM_MAKE_INCLUDE], +[am_make=${MAKE-make} +cat > confinc << 'END' +am__doit: + @echo done +.PHONY: am__doit +END +# If we don't find an include directive, just comment out the code. +AC_MSG_CHECKING([for style of include used by $am_make]) +am__include="#" +am__quote= +_am_result=none +# First try GNU make style include. +echo "include confinc" > confmf +# We grep out `Entering directory' and `Leaving directory' +# messages which can occur if `w' ends up in MAKEFLAGS. +# In particular we don't look at `^make:' because GNU make might +# be invoked under some other name (usually "gmake"), in which +# case it prints its new name instead of `make'. +if test "`$am_make -s -f confmf 2> /dev/null | grep -v 'ing directory'`" = "done"; then + am__include=include + am__quote= + _am_result=GNU +fi +# Now try BSD make style include. +if test "$am__include" = "#"; then + echo '.include "confinc"' > confmf + if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then + am__include=.include + am__quote="\"" + _am_result=BSD + fi +fi +AC_SUBST([am__include]) +AC_SUBST([am__quote]) +AC_MSG_RESULT([$_am_result]) +rm -f confinc confmf +]) + +# Fake the existence of programs that GNU maintainers use. -*- Autoconf -*- + +# Copyright (C) 1997, 1999, 2000, 2001, 2003, 2004, 2005 +# Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 5 + +# AM_MISSING_PROG(NAME, PROGRAM) +# ------------------------------ +AC_DEFUN([AM_MISSING_PROG], +[AC_REQUIRE([AM_MISSING_HAS_RUN]) +$1=${$1-"${am_missing_run}$2"} +AC_SUBST($1)]) + + +# AM_MISSING_HAS_RUN +# ------------------ +# Define MISSING if not defined so far and test if it supports --run. +# If it does, set am_missing_run to use it, otherwise, to nothing. +AC_DEFUN([AM_MISSING_HAS_RUN], +[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl +AC_REQUIRE_AUX_FILE([missing])dnl +test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing" +# Use eval to expand $SHELL +if eval "$MISSING --run true"; then + am_missing_run="$MISSING --run " +else + am_missing_run= + AC_MSG_WARN([`missing' script is too old or missing]) +fi +]) + +# Copyright (C) 2003, 2004, 2005, 2006 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# AM_PROG_MKDIR_P +# --------------- +# Check for `mkdir -p'. +AC_DEFUN([AM_PROG_MKDIR_P], +[AC_PREREQ([2.60])dnl +AC_REQUIRE([AC_PROG_MKDIR_P])dnl +dnl Automake 1.8 to 1.9.6 used to define mkdir_p. We now use MKDIR_P, +dnl while keeping a definition of mkdir_p for backward compatibility. +dnl @MKDIR_P@ is magic: AC_OUTPUT adjusts its value for each Makefile. +dnl However we cannot define mkdir_p as $(MKDIR_P) for the sake of +dnl Makefile.ins that do not define MKDIR_P, so we do our own +dnl adjustment using top_builddir (which is defined more often than +dnl MKDIR_P). +AC_SUBST([mkdir_p], ["$MKDIR_P"])dnl +case $mkdir_p in + [[\\/$]]* | ?:[[\\/]]*) ;; + */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;; +esac +]) + +# Helper functions for option handling. -*- Autoconf -*- + +# Copyright (C) 2001, 2002, 2003, 2005 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 3 + +# _AM_MANGLE_OPTION(NAME) +# ----------------------- +AC_DEFUN([_AM_MANGLE_OPTION], +[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])]) + +# _AM_SET_OPTION(NAME) +# ------------------------------ +# Set option NAME. Presently that only means defining a flag for this option. +AC_DEFUN([_AM_SET_OPTION], +[m4_define(_AM_MANGLE_OPTION([$1]), 1)]) + +# _AM_SET_OPTIONS(OPTIONS) +# ---------------------------------- +# OPTIONS is a space-separated list of Automake options. +AC_DEFUN([_AM_SET_OPTIONS], +[AC_FOREACH([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])]) + +# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET]) +# ------------------------------------------- +# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. +AC_DEFUN([_AM_IF_OPTION], +[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])]) + +# Check to make sure that the build environment is sane. -*- Autoconf -*- + +# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005 +# Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 4 + +# AM_SANITY_CHECK +# --------------- +AC_DEFUN([AM_SANITY_CHECK], +[AC_MSG_CHECKING([whether build environment is sane]) +# Just in case +sleep 1 +echo timestamp > conftest.file +# Do `set' in a subshell so we don't clobber the current shell's +# arguments. Must try -L first in case configure is actually a +# symlink; some systems play weird games with the mod time of symlinks +# (eg FreeBSD returns the mod time of the symlink's containing +# directory). +if ( + set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null` + if test "$[*]" = "X"; then + # -L didn't work. + set X `ls -t $srcdir/configure conftest.file` + fi + rm -f conftest.file + if test "$[*]" != "X $srcdir/configure conftest.file" \ + && test "$[*]" != "X conftest.file $srcdir/configure"; then + + # If neither matched, then we have a broken ls. This can happen + # if, for instance, CONFIG_SHELL is bash and it inherits a + # broken ls alias from the environment. This has actually + # happened. Such a system could not be considered "sane". + AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken +alias in your environment]) + fi + + test "$[2]" = conftest.file + ) +then + # Ok. + : +else + AC_MSG_ERROR([newly created file is older than distributed files! +Check your system clock]) +fi +AC_MSG_RESULT(yes)]) + +# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# AM_PROG_INSTALL_STRIP +# --------------------- +# One issue with vendor `install' (even GNU) is that you can't +# specify the program used to strip binaries. This is especially +# annoying in cross-compiling environments, where the build's strip +# is unlikely to handle the host's binaries. +# Fortunately install-sh will honor a STRIPPROG variable, so we +# always use install-sh in `make install-strip', and initialize +# STRIPPROG with the value of the STRIP variable (set by the user). +AC_DEFUN([AM_PROG_INSTALL_STRIP], +[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl +# Installed binaries are usually stripped using `strip' when the user +# run `make install-strip'. However `strip' might not be the right +# tool to use in cross-compilation environments, therefore Automake +# will honor the `STRIP' environment variable to overrule this program. +dnl Don't test for $cross_compiling = yes, because it might be `maybe'. +if test "$cross_compiling" != no; then + AC_CHECK_TOOL([STRIP], [strip], :) +fi +INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" +AC_SUBST([INSTALL_STRIP_PROGRAM])]) + +# Copyright (C) 2006 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# _AM_SUBST_NOTMAKE(VARIABLE) +# --------------------------- +# Prevent Automake from outputing VARIABLE = @VARIABLE@ in Makefile.in. +# This macro is traced by Automake. +AC_DEFUN([_AM_SUBST_NOTMAKE]) + +# Check how to create a tarball. -*- Autoconf -*- + +# Copyright (C) 2004, 2005 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 2 + +# _AM_PROG_TAR(FORMAT) +# -------------------- +# Check how to create a tarball in format FORMAT. +# FORMAT should be one of `v7', `ustar', or `pax'. +# +# Substitute a variable $(am__tar) that is a command +# writing to stdout a FORMAT-tarball containing the directory +# $tardir. +# tardir=directory && $(am__tar) > result.tar +# +# Substitute a variable $(am__untar) that extract such +# a tarball read from stdin. +# $(am__untar) < result.tar +AC_DEFUN([_AM_PROG_TAR], +[# Always define AMTAR for backward compatibility. +AM_MISSING_PROG([AMTAR], [tar]) +m4_if([$1], [v7], + [am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'], + [m4_case([$1], [ustar],, [pax],, + [m4_fatal([Unknown tar format])]) +AC_MSG_CHECKING([how to create a $1 tar archive]) +# Loop over all known methods to create a tar archive until one works. +_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none' +_am_tools=${am_cv_prog_tar_$1-$_am_tools} +# Do not fold the above two line into one, because Tru64 sh and +# Solaris sh will not grok spaces in the rhs of `-'. +for _am_tool in $_am_tools +do + case $_am_tool in + gnutar) + for _am_tar in tar gnutar gtar; + do + AM_RUN_LOG([$_am_tar --version]) && break + done + am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"' + am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"' + am__untar="$_am_tar -xf -" + ;; + plaintar) + # Must skip GNU tar: if it does not support --format= it doesn't create + # ustar tarball either. + (tar --version) >/dev/null 2>&1 && continue + am__tar='tar chf - "$$tardir"' + am__tar_='tar chf - "$tardir"' + am__untar='tar xf -' + ;; + pax) + am__tar='pax -L -x $1 -w "$$tardir"' + am__tar_='pax -L -x $1 -w "$tardir"' + am__untar='pax -r' + ;; + cpio) + am__tar='find "$$tardir" -print | cpio -o -H $1 -L' + am__tar_='find "$tardir" -print | cpio -o -H $1 -L' + am__untar='cpio -i -H $1 -d' + ;; + none) + am__tar=false + am__tar_=false + am__untar=false + ;; + esac + + # If the value was cached, stop now. We just wanted to have am__tar + # and am__untar set. + test -n "${am_cv_prog_tar_$1}" && break + + # tar/untar a dummy directory, and stop if the command works + rm -rf conftest.dir + mkdir conftest.dir + echo GrepMe > conftest.dir/file + AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar]) + rm -rf conftest.dir + if test -s conftest.tar; then + AM_RUN_LOG([$am__untar /dev/null 2>&1 && break + fi +done +rm -rf conftest.dir + +AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool]) +AC_MSG_RESULT([$am_cv_prog_tar_$1])]) +AC_SUBST([am__tar]) +AC_SUBST([am__untar]) +]) # _AM_PROG_TAR + diff --git a/driver/xf86-video-geode/autogen.sh b/driver/xf86-video-geode/autogen.sh new file mode 100755 index 000000000..904cd6746 --- /dev/null +++ b/driver/xf86-video-geode/autogen.sh @@ -0,0 +1,12 @@ +#! /bin/sh + +srcdir=`dirname $0` +test -z "$srcdir" && srcdir=. + +ORIGDIR=`pwd` +cd $srcdir + +autoreconf -v --install || exit 1 +cd $ORIGDIR || exit $? + +$srcdir/configure --enable-maintainer-mode "$@" diff --git a/driver/xf86-video-geode/config.guess b/driver/xf86-video-geode/config.guess new file mode 100755 index 000000000..0f0fe712a --- /dev/null +++ b/driver/xf86-video-geode/config.guess @@ -0,0 +1,1516 @@ +#! /bin/sh +# Attempt to guess a canonical system name. +# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, +# 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, +# Inc. + +timestamp='2007-03-06' + +# This file is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA +# 02110-1301, USA. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + + +# Originally written by Per Bothner . +# Please send patches to . Submit a context +# diff and a properly formatted ChangeLog entry. +# +# This script attempts to guess a canonical system name similar to +# config.sub. If it succeeds, it prints the system name on stdout, and +# exits with 0. Otherwise, it exits with 1. +# +# The plan is that this can be called by configure scripts if you +# don't specify an explicit build system type. + +me=`echo "$0" | sed -e 's,.*/,,'` + +usage="\ +Usage: $0 [OPTION] + +Output the configuration name of the system \`$me' is run on. + +Operation modes: + -h, --help print this help, then exit + -t, --time-stamp print date of last modification, then exit + -v, --version print version number, then exit + +Report bugs and patches to ." + +version="\ +GNU config.guess ($timestamp) + +Originally written by Per Bothner. +Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 +Free Software Foundation, Inc. + +This is free software; see the source for copying conditions. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." + +help=" +Try \`$me --help' for more information." + +# Parse command line +while test $# -gt 0 ; do + case $1 in + --time-stamp | --time* | -t ) + echo "$timestamp" ; exit ;; + --version | -v ) + echo "$version" ; exit ;; + --help | --h* | -h ) + echo "$usage"; exit ;; + -- ) # Stop option processing + shift; break ;; + - ) # Use stdin as input. + break ;; + -* ) + echo "$me: invalid option $1$help" >&2 + exit 1 ;; + * ) + break ;; + esac +done + +if test $# != 0; then + echo "$me: too many arguments$help" >&2 + exit 1 +fi + +trap 'exit 1' 1 2 15 + +# CC_FOR_BUILD -- compiler used by this script. Note that the use of a +# compiler to aid in system detection is discouraged as it requires +# temporary files to be created and, as you can see below, it is a +# headache to deal with in a portable fashion. + +# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still +# use `HOST_CC' if defined, but it is deprecated. + +# Portable tmp directory creation inspired by the Autoconf team. + +set_cc_for_build=' +trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ; +trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ; +: ${TMPDIR=/tmp} ; + { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || + { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || + { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } || + { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ; +dummy=$tmp/dummy ; +tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ; +case $CC_FOR_BUILD,$HOST_CC,$CC in + ,,) echo "int x;" > $dummy.c ; + for c in cc gcc c89 c99 ; do + if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then + CC_FOR_BUILD="$c"; break ; + fi ; + done ; + if test x"$CC_FOR_BUILD" = x ; then + CC_FOR_BUILD=no_compiler_found ; + fi + ;; + ,,*) CC_FOR_BUILD=$CC ;; + ,*,*) CC_FOR_BUILD=$HOST_CC ;; +esac ; set_cc_for_build= ;' + +# This is needed to find uname on a Pyramid OSx when run in the BSD universe. +# (ghazi@noc.rutgers.edu 1994-08-24) +if (test -f /.attbin/uname) >/dev/null 2>&1 ; then + PATH=$PATH:/.attbin ; export PATH +fi + +UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown +UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown +UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown +UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown + +# Note: order is significant - the case branches are not exclusive. + +case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in + *:NetBSD:*:*) + # NetBSD (nbsd) targets should (where applicable) match one or + # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*, + # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently + # switched to ELF, *-*-netbsd* would select the old + # object file format. This provides both forward + # compatibility and a consistent mechanism for selecting the + # object file format. + # + # Note: NetBSD doesn't particularly care about the vendor + # portion of the name. We always set it to "unknown". + sysctl="sysctl -n hw.machine_arch" + UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \ + /usr/sbin/$sysctl 2>/dev/null || echo unknown)` + case "${UNAME_MACHINE_ARCH}" in + armeb) machine=armeb-unknown ;; + arm*) machine=arm-unknown ;; + sh3el) machine=shl-unknown ;; + sh3eb) machine=sh-unknown ;; + sh5el) machine=sh5le-unknown ;; + *) machine=${UNAME_MACHINE_ARCH}-unknown ;; + esac + # The Operating System including object format, if it has switched + # to ELF recently, or will in the future. + case "${UNAME_MACHINE_ARCH}" in + arm*|i386|m68k|ns32k|sh3*|sparc|vax) + eval $set_cc_for_build + if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ + | grep __ELF__ >/dev/null + then + # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). + # Return netbsd for either. FIX? + os=netbsd + else + os=netbsdelf + fi + ;; + *) + os=netbsd + ;; + esac + # The OS release + # Debian GNU/NetBSD machines have a different userland, and + # thus, need a distinct triplet. However, they do not need + # kernel version information, so it can be replaced with a + # suitable tag, in the style of linux-gnu. + case "${UNAME_VERSION}" in + Debian*) + release='-gnu' + ;; + *) + release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` + ;; + esac + # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: + # contains redundant information, the shorter form: + # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. + echo "${machine}-${os}${release}" + exit ;; + *:OpenBSD:*:*) + UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` + echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE} + exit ;; + *:ekkoBSD:*:*) + echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE} + exit ;; + *:SolidBSD:*:*) + echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE} + exit ;; + macppc:MirBSD:*:*) + echo powerpc-unknown-mirbsd${UNAME_RELEASE} + exit ;; + *:MirBSD:*:*) + echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE} + exit ;; + alpha:OSF1:*:*) + case $UNAME_RELEASE in + *4.0) + UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` + ;; + *5.*) + UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` + ;; + esac + # According to Compaq, /usr/sbin/psrinfo has been available on + # OSF/1 and Tru64 systems produced since 1995. I hope that + # covers most systems running today. This code pipes the CPU + # types through head -n 1, so we only detect the type of CPU 0. + ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` + case "$ALPHA_CPU_TYPE" in + "EV4 (21064)") + UNAME_MACHINE="alpha" ;; + "EV4.5 (21064)") + UNAME_MACHINE="alpha" ;; + "LCA4 (21066/21068)") + UNAME_MACHINE="alpha" ;; + "EV5 (21164)") + UNAME_MACHINE="alphaev5" ;; + "EV5.6 (21164A)") + UNAME_MACHINE="alphaev56" ;; + "EV5.6 (21164PC)") + UNAME_MACHINE="alphapca56" ;; + "EV5.7 (21164PC)") + UNAME_MACHINE="alphapca57" ;; + "EV6 (21264)") + UNAME_MACHINE="alphaev6" ;; + "EV6.7 (21264A)") + UNAME_MACHINE="alphaev67" ;; + "EV6.8CB (21264C)") + UNAME_MACHINE="alphaev68" ;; + "EV6.8AL (21264B)") + UNAME_MACHINE="alphaev68" ;; + "EV6.8CX (21264D)") + UNAME_MACHINE="alphaev68" ;; + "EV6.9A (21264/EV69A)") + UNAME_MACHINE="alphaev69" ;; + "EV7 (21364)") + UNAME_MACHINE="alphaev7" ;; + "EV7.9 (21364A)") + UNAME_MACHINE="alphaev79" ;; + esac + # A Pn.n version is a patched version. + # A Vn.n version is a released version. + # A Tn.n version is a released field test version. + # A Xn.n version is an unreleased experimental baselevel. + # 1.2 uses "1.2" for uname -r. + echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` + exit ;; + Alpha\ *:Windows_NT*:*) + # How do we know it's Interix rather than the generic POSIX subsystem? + # Should we change UNAME_MACHINE based on the output of uname instead + # of the specific Alpha model? + echo alpha-pc-interix + exit ;; + 21064:Windows_NT:50:3) + echo alpha-dec-winnt3.5 + exit ;; + Amiga*:UNIX_System_V:4.0:*) + echo m68k-unknown-sysv4 + exit ;; + *:[Aa]miga[Oo][Ss]:*:*) + echo ${UNAME_MACHINE}-unknown-amigaos + exit ;; + *:[Mm]orph[Oo][Ss]:*:*) + echo ${UNAME_MACHINE}-unknown-morphos + exit ;; + *:OS/390:*:*) + echo i370-ibm-openedition + exit ;; + *:z/VM:*:*) + echo s390-ibm-zvmoe + exit ;; + *:OS400:*:*) + echo powerpc-ibm-os400 + exit ;; + arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) + echo arm-acorn-riscix${UNAME_RELEASE} + exit ;; + arm:riscos:*:*|arm:RISCOS:*:*) + echo arm-unknown-riscos + exit ;; + SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) + echo hppa1.1-hitachi-hiuxmpp + exit ;; + Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) + # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. + if test "`(/bin/universe) 2>/dev/null`" = att ; then + echo pyramid-pyramid-sysv3 + else + echo pyramid-pyramid-bsd + fi + exit ;; + NILE*:*:*:dcosx) + echo pyramid-pyramid-svr4 + exit ;; + DRS?6000:unix:4.0:6*) + echo sparc-icl-nx6 + exit ;; + DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) + case `/usr/bin/uname -p` in + sparc) echo sparc-icl-nx7; exit ;; + esac ;; + sun4H:SunOS:5.*:*) + echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit ;; + sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) + echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit ;; + i86pc:SunOS:5.*:*) + echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit ;; + sun4*:SunOS:6*:*) + # According to config.sub, this is the proper way to canonicalize + # SunOS6. Hard to guess exactly what SunOS6 will be like, but + # it's likely to be more like Solaris than SunOS4. + echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit ;; + sun4*:SunOS:*:*) + case "`/usr/bin/arch -k`" in + Series*|S4*) + UNAME_RELEASE=`uname -v` + ;; + esac + # Japanese Language versions have a version number like `4.1.3-JL'. + echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` + exit ;; + sun3*:SunOS:*:*) + echo m68k-sun-sunos${UNAME_RELEASE} + exit ;; + sun*:*:4.2BSD:*) + UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` + test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 + case "`/bin/arch`" in + sun3) + echo m68k-sun-sunos${UNAME_RELEASE} + ;; + sun4) + echo sparc-sun-sunos${UNAME_RELEASE} + ;; + esac + exit ;; + aushp:SunOS:*:*) + echo sparc-auspex-sunos${UNAME_RELEASE} + exit ;; + # The situation for MiNT is a little confusing. The machine name + # can be virtually everything (everything which is not + # "atarist" or "atariste" at least should have a processor + # > m68000). The system name ranges from "MiNT" over "FreeMiNT" + # to the lowercase version "mint" (or "freemint"). Finally + # the system name "TOS" denotes a system which is actually not + # MiNT. But MiNT is downward compatible to TOS, so this should + # be no problem. + atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} + exit ;; + atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} + exit ;; + *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} + exit ;; + milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) + echo m68k-milan-mint${UNAME_RELEASE} + exit ;; + hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) + echo m68k-hades-mint${UNAME_RELEASE} + exit ;; + *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) + echo m68k-unknown-mint${UNAME_RELEASE} + exit ;; + m68k:machten:*:*) + echo m68k-apple-machten${UNAME_RELEASE} + exit ;; + powerpc:machten:*:*) + echo powerpc-apple-machten${UNAME_RELEASE} + exit ;; + RISC*:Mach:*:*) + echo mips-dec-mach_bsd4.3 + exit ;; + RISC*:ULTRIX:*:*) + echo mips-dec-ultrix${UNAME_RELEASE} + exit ;; + VAX*:ULTRIX*:*:*) + echo vax-dec-ultrix${UNAME_RELEASE} + exit ;; + 2020:CLIX:*:* | 2430:CLIX:*:*) + echo clipper-intergraph-clix${UNAME_RELEASE} + exit ;; + mips:*:*:UMIPS | mips:*:*:RISCos) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c +#ifdef __cplusplus +#include /* for printf() prototype */ + int main (int argc, char *argv[]) { +#else + int main (argc, argv) int argc; char *argv[]; { +#endif + #if defined (host_mips) && defined (MIPSEB) + #if defined (SYSTYPE_SYSV) + printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); + #endif + #if defined (SYSTYPE_SVR4) + printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); + #endif + #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) + printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); + #endif + #endif + exit (-1); + } +EOF + $CC_FOR_BUILD -o $dummy $dummy.c && + dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` && + SYSTEM_NAME=`$dummy $dummyarg` && + { echo "$SYSTEM_NAME"; exit; } + echo mips-mips-riscos${UNAME_RELEASE} + exit ;; + Motorola:PowerMAX_OS:*:*) + echo powerpc-motorola-powermax + exit ;; + Motorola:*:4.3:PL8-*) + echo powerpc-harris-powermax + exit ;; + Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) + echo powerpc-harris-powermax + exit ;; + Night_Hawk:Power_UNIX:*:*) + echo powerpc-harris-powerunix + exit ;; + m88k:CX/UX:7*:*) + echo m88k-harris-cxux7 + exit ;; + m88k:*:4*:R4*) + echo m88k-motorola-sysv4 + exit ;; + m88k:*:3*:R3*) + echo m88k-motorola-sysv3 + exit ;; + AViiON:dgux:*:*) + # DG/UX returns AViiON for all architectures + UNAME_PROCESSOR=`/usr/bin/uname -p` + if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] + then + if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ + [ ${TARGET_BINARY_INTERFACE}x = x ] + then + echo m88k-dg-dgux${UNAME_RELEASE} + else + echo m88k-dg-dguxbcs${UNAME_RELEASE} + fi + else + echo i586-dg-dgux${UNAME_RELEASE} + fi + exit ;; + M88*:DolphinOS:*:*) # DolphinOS (SVR3) + echo m88k-dolphin-sysv3 + exit ;; + M88*:*:R3*:*) + # Delta 88k system running SVR3 + echo m88k-motorola-sysv3 + exit ;; + XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) + echo m88k-tektronix-sysv3 + exit ;; + Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) + echo m68k-tektronix-bsd + exit ;; + *:IRIX*:*:*) + echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` + exit ;; + ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. + echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id + exit ;; # Note that: echo "'`uname -s`'" gives 'AIX ' + i*86:AIX:*:*) + echo i386-ibm-aix + exit ;; + ia64:AIX:*:*) + if [ -x /usr/bin/oslevel ] ; then + IBM_REV=`/usr/bin/oslevel` + else + IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} + fi + echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} + exit ;; + *:AIX:2:3) + if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #include + + main() + { + if (!__power_pc()) + exit(1); + puts("powerpc-ibm-aix3.2.5"); + exit(0); + } +EOF + if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` + then + echo "$SYSTEM_NAME" + else + echo rs6000-ibm-aix3.2.5 + fi + elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then + echo rs6000-ibm-aix3.2.4 + else + echo rs6000-ibm-aix3.2 + fi + exit ;; + *:AIX:*:[45]) + IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` + if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then + IBM_ARCH=rs6000 + else + IBM_ARCH=powerpc + fi + if [ -x /usr/bin/oslevel ] ; then + IBM_REV=`/usr/bin/oslevel` + else + IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} + fi + echo ${IBM_ARCH}-ibm-aix${IBM_REV} + exit ;; + *:AIX:*:*) + echo rs6000-ibm-aix + exit ;; + ibmrt:4.4BSD:*|romp-ibm:BSD:*) + echo romp-ibm-bsd4.4 + exit ;; + ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and + echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to + exit ;; # report: romp-ibm BSD 4.3 + *:BOSX:*:*) + echo rs6000-bull-bosx + exit ;; + DPX/2?00:B.O.S.:*:*) + echo m68k-bull-sysv3 + exit ;; + 9000/[34]??:4.3bsd:1.*:*) + echo m68k-hp-bsd + exit ;; + hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) + echo m68k-hp-bsd4.4 + exit ;; + 9000/[34678]??:HP-UX:*:*) + HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` + case "${UNAME_MACHINE}" in + 9000/31? ) HP_ARCH=m68000 ;; + 9000/[34]?? ) HP_ARCH=m68k ;; + 9000/[678][0-9][0-9]) + if [ -x /usr/bin/getconf ]; then + sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` + sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` + case "${sc_cpu_version}" in + 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 + 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 + 532) # CPU_PA_RISC2_0 + case "${sc_kernel_bits}" in + 32) HP_ARCH="hppa2.0n" ;; + 64) HP_ARCH="hppa2.0w" ;; + '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 + esac ;; + esac + fi + if [ "${HP_ARCH}" = "" ]; then + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + + #define _HPUX_SOURCE + #include + #include + + int main () + { + #if defined(_SC_KERNEL_BITS) + long bits = sysconf(_SC_KERNEL_BITS); + #endif + long cpu = sysconf (_SC_CPU_VERSION); + + switch (cpu) + { + case CPU_PA_RISC1_0: puts ("hppa1.0"); break; + case CPU_PA_RISC1_1: puts ("hppa1.1"); break; + case CPU_PA_RISC2_0: + #if defined(_SC_KERNEL_BITS) + switch (bits) + { + case 64: puts ("hppa2.0w"); break; + case 32: puts ("hppa2.0n"); break; + default: puts ("hppa2.0"); break; + } break; + #else /* !defined(_SC_KERNEL_BITS) */ + puts ("hppa2.0"); break; + #endif + default: puts ("hppa1.0"); break; + } + exit (0); + } +EOF + (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` + test -z "$HP_ARCH" && HP_ARCH=hppa + fi ;; + esac + if [ ${HP_ARCH} = "hppa2.0w" ] + then + eval $set_cc_for_build + + # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating + # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler + # generating 64-bit code. GNU and HP use different nomenclature: + # + # $ CC_FOR_BUILD=cc ./config.guess + # => hppa2.0w-hp-hpux11.23 + # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess + # => hppa64-hp-hpux11.23 + + if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | + grep __LP64__ >/dev/null + then + HP_ARCH="hppa2.0w" + else + HP_ARCH="hppa64" + fi + fi + echo ${HP_ARCH}-hp-hpux${HPUX_REV} + exit ;; + ia64:HP-UX:*:*) + HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` + echo ia64-hp-hpux${HPUX_REV} + exit ;; + 3050*:HI-UX:*:*) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #include + int + main () + { + long cpu = sysconf (_SC_CPU_VERSION); + /* The order matters, because CPU_IS_HP_MC68K erroneously returns + true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct + results, however. */ + if (CPU_IS_PA_RISC (cpu)) + { + switch (cpu) + { + case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; + case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; + case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; + default: puts ("hppa-hitachi-hiuxwe2"); break; + } + } + else if (CPU_IS_HP_MC68K (cpu)) + puts ("m68k-hitachi-hiuxwe2"); + else puts ("unknown-hitachi-hiuxwe2"); + exit (0); + } +EOF + $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` && + { echo "$SYSTEM_NAME"; exit; } + echo unknown-hitachi-hiuxwe2 + exit ;; + 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) + echo hppa1.1-hp-bsd + exit ;; + 9000/8??:4.3bsd:*:*) + echo hppa1.0-hp-bsd + exit ;; + *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) + echo hppa1.0-hp-mpeix + exit ;; + hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) + echo hppa1.1-hp-osf + exit ;; + hp8??:OSF1:*:*) + echo hppa1.0-hp-osf + exit ;; + i*86:OSF1:*:*) + if [ -x /usr/sbin/sysversion ] ; then + echo ${UNAME_MACHINE}-unknown-osf1mk + else + echo ${UNAME_MACHINE}-unknown-osf1 + fi + exit ;; + parisc*:Lites*:*:*) + echo hppa1.1-hp-lites + exit ;; + C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) + echo c1-convex-bsd + exit ;; + C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) + if getsysinfo -f scalar_acc + then echo c32-convex-bsd + else echo c2-convex-bsd + fi + exit ;; + C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) + echo c34-convex-bsd + exit ;; + C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) + echo c38-convex-bsd + exit ;; + C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) + echo c4-convex-bsd + exit ;; + CRAY*Y-MP:*:*:*) + echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit ;; + CRAY*[A-Z]90:*:*:*) + echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ + | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ + -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ + -e 's/\.[^.]*$/.X/' + exit ;; + CRAY*TS:*:*:*) + echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit ;; + CRAY*T3E:*:*:*) + echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit ;; + CRAY*SV1:*:*:*) + echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit ;; + *:UNICOS/mp:*:*) + echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit ;; + F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) + FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` + FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` + FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` + echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" + exit ;; + 5000:UNIX_System_V:4.*:*) + FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` + FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'` + echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" + exit ;; + i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) + echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} + exit ;; + sparc*:BSD/OS:*:*) + echo sparc-unknown-bsdi${UNAME_RELEASE} + exit ;; + *:BSD/OS:*:*) + echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} + exit ;; + *:FreeBSD:*:*) + case ${UNAME_MACHINE} in + pc98) + echo i386-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; + amd64) + echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; + *) + echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; + esac + exit ;; + i*:CYGWIN*:*) + echo ${UNAME_MACHINE}-pc-cygwin + exit ;; + *:MINGW*:*) + echo ${UNAME_MACHINE}-pc-mingw32 + exit ;; + i*:windows32*:*) + # uname -m includes "-pc" on this system. + echo ${UNAME_MACHINE}-mingw32 + exit ;; + i*:PW*:*) + echo ${UNAME_MACHINE}-pc-pw32 + exit ;; + *:Interix*:[3456]*) + case ${UNAME_MACHINE} in + x86) + echo i586-pc-interix${UNAME_RELEASE} + exit ;; + EM64T | authenticamd) + echo x86_64-unknown-interix${UNAME_RELEASE} + exit ;; + esac ;; + [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) + echo i${UNAME_MACHINE}-pc-mks + exit ;; + i*:Windows_NT*:* | Pentium*:Windows_NT*:*) + # How do we know it's Interix rather than the generic POSIX subsystem? + # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we + # UNAME_MACHINE based on the output of uname instead of i386? + echo i586-pc-interix + exit ;; + i*:UWIN*:*) + echo ${UNAME_MACHINE}-pc-uwin + exit ;; + amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) + echo x86_64-unknown-cygwin + exit ;; + p*:CYGWIN*:*) + echo powerpcle-unknown-cygwin + exit ;; + prep*:SunOS:5.*:*) + echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit ;; + *:GNU:*:*) + # the GNU system + echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` + exit ;; + *:GNU/*:*:*) + # other systems with GNU libc and userland + echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu + exit ;; + i*86:Minix:*:*) + echo ${UNAME_MACHINE}-pc-minix + exit ;; + arm*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + avr32*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + cris:Linux:*:*) + echo cris-axis-linux-gnu + exit ;; + crisv32:Linux:*:*) + echo crisv32-axis-linux-gnu + exit ;; + frv:Linux:*:*) + echo frv-unknown-linux-gnu + exit ;; + ia64:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + m32r*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + m68*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + mips:Linux:*:*) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #undef CPU + #undef mips + #undef mipsel + #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) + CPU=mipsel + #else + #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) + CPU=mips + #else + CPU= + #endif + #endif +EOF + eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' + /^CPU/{ + s: ::g + p + }'`" + test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } + ;; + mips64:Linux:*:*) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #undef CPU + #undef mips64 + #undef mips64el + #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) + CPU=mips64el + #else + #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) + CPU=mips64 + #else + CPU= + #endif + #endif +EOF + eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' + /^CPU/{ + s: ::g + p + }'`" + test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } + ;; + or32:Linux:*:*) + echo or32-unknown-linux-gnu + exit ;; + ppc:Linux:*:*) + echo powerpc-unknown-linux-gnu + exit ;; + ppc64:Linux:*:*) + echo powerpc64-unknown-linux-gnu + exit ;; + alpha:Linux:*:*) + case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in + EV5) UNAME_MACHINE=alphaev5 ;; + EV56) UNAME_MACHINE=alphaev56 ;; + PCA56) UNAME_MACHINE=alphapca56 ;; + PCA57) UNAME_MACHINE=alphapca56 ;; + EV6) UNAME_MACHINE=alphaev6 ;; + EV67) UNAME_MACHINE=alphaev67 ;; + EV68*) UNAME_MACHINE=alphaev68 ;; + esac + objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null + if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi + echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} + exit ;; + parisc:Linux:*:* | hppa:Linux:*:*) + # Look for CPU level + case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in + PA7*) echo hppa1.1-unknown-linux-gnu ;; + PA8*) echo hppa2.0-unknown-linux-gnu ;; + *) echo hppa-unknown-linux-gnu ;; + esac + exit ;; + parisc64:Linux:*:* | hppa64:Linux:*:*) + echo hppa64-unknown-linux-gnu + exit ;; + s390:Linux:*:* | s390x:Linux:*:*) + echo ${UNAME_MACHINE}-ibm-linux + exit ;; + sh64*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + sh*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + sparc:Linux:*:* | sparc64:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + vax:Linux:*:*) + echo ${UNAME_MACHINE}-dec-linux-gnu + exit ;; + x86_64:Linux:*:*) + echo x86_64-unknown-linux-gnu + exit ;; + xtensa:Linux:*:*) + echo xtensa-unknown-linux-gnu + exit ;; + i*86:Linux:*:*) + # The BFD linker knows what the default object file format is, so + # first see if it will tell us. cd to the root directory to prevent + # problems with other programs or directories called `ld' in the path. + # Set LC_ALL=C to ensure ld outputs messages in English. + ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \ + | sed -ne '/supported targets:/!d + s/[ ][ ]*/ /g + s/.*supported targets: *// + s/ .*// + p'` + case "$ld_supported_targets" in + elf32-i386) + TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu" + ;; + a.out-i386-linux) + echo "${UNAME_MACHINE}-pc-linux-gnuaout" + exit ;; + coff-i386) + echo "${UNAME_MACHINE}-pc-linux-gnucoff" + exit ;; + "") + # Either a pre-BFD a.out linker (linux-gnuoldld) or + # one that does not give us useful --help. + echo "${UNAME_MACHINE}-pc-linux-gnuoldld" + exit ;; + esac + # Determine whether the default compiler is a.out or elf + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #include + #ifdef __ELF__ + # ifdef __GLIBC__ + # if __GLIBC__ >= 2 + LIBC=gnu + # else + LIBC=gnulibc1 + # endif + # else + LIBC=gnulibc1 + # endif + #else + #if defined(__INTEL_COMPILER) || defined(__PGI) || defined(__SUNPRO_C) || defined(__SUNPRO_CC) + LIBC=gnu + #else + LIBC=gnuaout + #endif + #endif + #ifdef __dietlibc__ + LIBC=dietlibc + #endif +EOF + eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' + /^LIBC/{ + s: ::g + p + }'`" + test x"${LIBC}" != x && { + echo "${UNAME_MACHINE}-pc-linux-${LIBC}" + exit + } + test x"${TENTATIVE}" != x && { echo "${TENTATIVE}"; exit; } + ;; + i*86:DYNIX/ptx:4*:*) + # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. + # earlier versions are messed up and put the nodename in both + # sysname and nodename. + echo i386-sequent-sysv4 + exit ;; + i*86:UNIX_SV:4.2MP:2.*) + # Unixware is an offshoot of SVR4, but it has its own version + # number series starting with 2... + # I am not positive that other SVR4 systems won't match this, + # I just have to hope. -- rms. + # Use sysv4.2uw... so that sysv4* matches it. + echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} + exit ;; + i*86:OS/2:*:*) + # If we were able to find `uname', then EMX Unix compatibility + # is probably installed. + echo ${UNAME_MACHINE}-pc-os2-emx + exit ;; + i*86:XTS-300:*:STOP) + echo ${UNAME_MACHINE}-unknown-stop + exit ;; + i*86:atheos:*:*) + echo ${UNAME_MACHINE}-unknown-atheos + exit ;; + i*86:syllable:*:*) + echo ${UNAME_MACHINE}-pc-syllable + exit ;; + i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*) + echo i386-unknown-lynxos${UNAME_RELEASE} + exit ;; + i*86:*DOS:*:*) + echo ${UNAME_MACHINE}-pc-msdosdjgpp + exit ;; + i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) + UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` + if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then + echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL} + else + echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} + fi + exit ;; + i*86:*:5:[678]*) + # UnixWare 7.x, OpenUNIX and OpenServer 6. + case `/bin/uname -X | grep "^Machine"` in + *486*) UNAME_MACHINE=i486 ;; + *Pentium) UNAME_MACHINE=i586 ;; + *Pent*|*Celeron) UNAME_MACHINE=i686 ;; + esac + echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} + exit ;; + i*86:*:3.2:*) + if test -f /usr/options/cb.name; then + UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then + UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` + (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 + (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ + && UNAME_MACHINE=i586 + (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ + && UNAME_MACHINE=i686 + (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ + && UNAME_MACHINE=i686 + echo ${UNAME_MACHINE}-pc-sco$UNAME_REL + else + echo ${UNAME_MACHINE}-pc-sysv32 + fi + exit ;; + pc:*:*:*) + # Left here for compatibility: + # uname -m prints for DJGPP always 'pc', but it prints nothing about + # the processor, so we play safe by assuming i386. + echo i386-pc-msdosdjgpp + exit ;; + Intel:Mach:3*:*) + echo i386-pc-mach3 + exit ;; + paragon:*:*:*) + echo i860-intel-osf1 + exit ;; + i860:*:4.*:*) # i860-SVR4 + if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then + echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 + else # Add other i860-SVR4 vendors below as they are discovered. + echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 + fi + exit ;; + mini*:CTIX:SYS*5:*) + # "miniframe" + echo m68010-convergent-sysv + exit ;; + mc68k:UNIX:SYSTEM5:3.51m) + echo m68k-convergent-sysv + exit ;; + M680?0:D-NIX:5.3:*) + echo m68k-diab-dnix + exit ;; + M68*:*:R3V[5678]*:*) + test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;; + 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0) + OS_REL='' + test -r /etc/.relid \ + && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ + && { echo i486-ncr-sysv4.3${OS_REL}; exit; } + /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ + && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; + 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ + && { echo i486-ncr-sysv4; exit; } ;; + m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) + echo m68k-unknown-lynxos${UNAME_RELEASE} + exit ;; + mc68030:UNIX_System_V:4.*:*) + echo m68k-atari-sysv4 + exit ;; + TSUNAMI:LynxOS:2.*:*) + echo sparc-unknown-lynxos${UNAME_RELEASE} + exit ;; + rs6000:LynxOS:2.*:*) + echo rs6000-unknown-lynxos${UNAME_RELEASE} + exit ;; + PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*) + echo powerpc-unknown-lynxos${UNAME_RELEASE} + exit ;; + SM[BE]S:UNIX_SV:*:*) + echo mips-dde-sysv${UNAME_RELEASE} + exit ;; + RM*:ReliantUNIX-*:*:*) + echo mips-sni-sysv4 + exit ;; + RM*:SINIX-*:*:*) + echo mips-sni-sysv4 + exit ;; + *:SINIX-*:*:*) + if uname -p 2>/dev/null >/dev/null ; then + UNAME_MACHINE=`(uname -p) 2>/dev/null` + echo ${UNAME_MACHINE}-sni-sysv4 + else + echo ns32k-sni-sysv + fi + exit ;; + PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort + # says + echo i586-unisys-sysv4 + exit ;; + *:UNIX_System_V:4*:FTX*) + # From Gerald Hewes . + # How about differentiating between stratus architectures? -djm + echo hppa1.1-stratus-sysv4 + exit ;; + *:*:*:FTX*) + # From seanf@swdc.stratus.com. + echo i860-stratus-sysv4 + exit ;; + i*86:VOS:*:*) + # From Paul.Green@stratus.com. + echo ${UNAME_MACHINE}-stratus-vos + exit ;; + *:VOS:*:*) + # From Paul.Green@stratus.com. + echo hppa1.1-stratus-vos + exit ;; + mc68*:A/UX:*:*) + echo m68k-apple-aux${UNAME_RELEASE} + exit ;; + news*:NEWS-OS:6*:*) + echo mips-sony-newsos6 + exit ;; + R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) + if [ -d /usr/nec ]; then + echo mips-nec-sysv${UNAME_RELEASE} + else + echo mips-unknown-sysv${UNAME_RELEASE} + fi + exit ;; + BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. + echo powerpc-be-beos + exit ;; + BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. + echo powerpc-apple-beos + exit ;; + BePC:BeOS:*:*) # BeOS running on Intel PC compatible. + echo i586-pc-beos + exit ;; + SX-4:SUPER-UX:*:*) + echo sx4-nec-superux${UNAME_RELEASE} + exit ;; + SX-5:SUPER-UX:*:*) + echo sx5-nec-superux${UNAME_RELEASE} + exit ;; + SX-6:SUPER-UX:*:*) + echo sx6-nec-superux${UNAME_RELEASE} + exit ;; + SX-7:SUPER-UX:*:*) + echo sx7-nec-superux${UNAME_RELEASE} + exit ;; + SX-8:SUPER-UX:*:*) + echo sx8-nec-superux${UNAME_RELEASE} + exit ;; + SX-8R:SUPER-UX:*:*) + echo sx8r-nec-superux${UNAME_RELEASE} + exit ;; + Power*:Rhapsody:*:*) + echo powerpc-apple-rhapsody${UNAME_RELEASE} + exit ;; + *:Rhapsody:*:*) + echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} + exit ;; + *:Darwin:*:*) + UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown + case $UNAME_PROCESSOR in + unknown) UNAME_PROCESSOR=powerpc ;; + esac + echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} + exit ;; + *:procnto*:*:* | *:QNX:[0123456789]*:*) + UNAME_PROCESSOR=`uname -p` + if test "$UNAME_PROCESSOR" = "x86"; then + UNAME_PROCESSOR=i386 + UNAME_MACHINE=pc + fi + echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE} + exit ;; + *:QNX:*:4*) + echo i386-pc-qnx + exit ;; + NSE-?:NONSTOP_KERNEL:*:*) + echo nse-tandem-nsk${UNAME_RELEASE} + exit ;; + NSR-?:NONSTOP_KERNEL:*:*) + echo nsr-tandem-nsk${UNAME_RELEASE} + exit ;; + *:NonStop-UX:*:*) + echo mips-compaq-nonstopux + exit ;; + BS2000:POSIX*:*:*) + echo bs2000-siemens-sysv + exit ;; + DS/*:UNIX_System_V:*:*) + echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} + exit ;; + *:Plan9:*:*) + # "uname -m" is not consistent, so use $cputype instead. 386 + # is converted to i386 for consistency with other x86 + # operating systems. + if test "$cputype" = "386"; then + UNAME_MACHINE=i386 + else + UNAME_MACHINE="$cputype" + fi + echo ${UNAME_MACHINE}-unknown-plan9 + exit ;; + *:TOPS-10:*:*) + echo pdp10-unknown-tops10 + exit ;; + *:TENEX:*:*) + echo pdp10-unknown-tenex + exit ;; + KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) + echo pdp10-dec-tops20 + exit ;; + XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) + echo pdp10-xkl-tops20 + exit ;; + *:TOPS-20:*:*) + echo pdp10-unknown-tops20 + exit ;; + *:ITS:*:*) + echo pdp10-unknown-its + exit ;; + SEI:*:*:SEIUX) + echo mips-sei-seiux${UNAME_RELEASE} + exit ;; + *:DragonFly:*:*) + echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` + exit ;; + *:*VMS:*:*) + UNAME_MACHINE=`(uname -p) 2>/dev/null` + case "${UNAME_MACHINE}" in + A*) echo alpha-dec-vms ; exit ;; + I*) echo ia64-dec-vms ; exit ;; + V*) echo vax-dec-vms ; exit ;; + esac ;; + *:XENIX:*:SysV) + echo i386-pc-xenix + exit ;; + i*86:skyos:*:*) + echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//' + exit ;; + i*86:rdos:*:*) + echo ${UNAME_MACHINE}-pc-rdos + exit ;; +esac + +#echo '(No uname command or uname output not recognized.)' 1>&2 +#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 + +eval $set_cc_for_build +cat >$dummy.c < +# include +#endif +main () +{ +#if defined (sony) +#if defined (MIPSEB) + /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, + I don't know.... */ + printf ("mips-sony-bsd\n"); exit (0); +#else +#include + printf ("m68k-sony-newsos%s\n", +#ifdef NEWSOS4 + "4" +#else + "" +#endif + ); exit (0); +#endif +#endif + +#if defined (__arm) && defined (__acorn) && defined (__unix) + printf ("arm-acorn-riscix\n"); exit (0); +#endif + +#if defined (hp300) && !defined (hpux) + printf ("m68k-hp-bsd\n"); exit (0); +#endif + +#if defined (NeXT) +#if !defined (__ARCHITECTURE__) +#define __ARCHITECTURE__ "m68k" +#endif + int version; + version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; + if (version < 4) + printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); + else + printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); + exit (0); +#endif + +#if defined (MULTIMAX) || defined (n16) +#if defined (UMAXV) + printf ("ns32k-encore-sysv\n"); exit (0); +#else +#if defined (CMU) + printf ("ns32k-encore-mach\n"); exit (0); +#else + printf ("ns32k-encore-bsd\n"); exit (0); +#endif +#endif +#endif + +#if defined (__386BSD__) + printf ("i386-pc-bsd\n"); exit (0); +#endif + +#if defined (sequent) +#if defined (i386) + printf ("i386-sequent-dynix\n"); exit (0); +#endif +#if defined (ns32000) + printf ("ns32k-sequent-dynix\n"); exit (0); +#endif +#endif + +#if defined (_SEQUENT_) + struct utsname un; + + uname(&un); + + if (strncmp(un.version, "V2", 2) == 0) { + printf ("i386-sequent-ptx2\n"); exit (0); + } + if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ + printf ("i386-sequent-ptx1\n"); exit (0); + } + printf ("i386-sequent-ptx\n"); exit (0); + +#endif + +#if defined (vax) +# if !defined (ultrix) +# include +# if defined (BSD) +# if BSD == 43 + printf ("vax-dec-bsd4.3\n"); exit (0); +# else +# if BSD == 199006 + printf ("vax-dec-bsd4.3reno\n"); exit (0); +# else + printf ("vax-dec-bsd\n"); exit (0); +# endif +# endif +# else + printf ("vax-dec-bsd\n"); exit (0); +# endif +# else + printf ("vax-dec-ultrix\n"); exit (0); +# endif +#endif + +#if defined (alliant) && defined (i860) + printf ("i860-alliant-bsd\n"); exit (0); +#endif + + exit (1); +} +EOF + +$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` && + { echo "$SYSTEM_NAME"; exit; } + +# Apollos put the system type in the environment. + +test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; } + +# Convex versions that predate uname can use getsysinfo(1) + +if [ -x /usr/convex/getsysinfo ] +then + case `getsysinfo -f cpu_type` in + c1*) + echo c1-convex-bsd + exit ;; + c2*) + if getsysinfo -f scalar_acc + then echo c32-convex-bsd + else echo c2-convex-bsd + fi + exit ;; + c34*) + echo c34-convex-bsd + exit ;; + c38*) + echo c38-convex-bsd + exit ;; + c4*) + echo c4-convex-bsd + exit ;; + esac +fi + +cat >&2 < in order to provide the needed +information to handle your system. + +config.guess timestamp = $timestamp + +uname -m = `(uname -m) 2>/dev/null || echo unknown` +uname -r = `(uname -r) 2>/dev/null || echo unknown` +uname -s = `(uname -s) 2>/dev/null || echo unknown` +uname -v = `(uname -v) 2>/dev/null || echo unknown` + +/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null` +/bin/uname -X = `(/bin/uname -X) 2>/dev/null` + +hostinfo = `(hostinfo) 2>/dev/null` +/bin/universe = `(/bin/universe) 2>/dev/null` +/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` +/bin/arch = `(/bin/arch) 2>/dev/null` +/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` +/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` + +UNAME_MACHINE = ${UNAME_MACHINE} +UNAME_RELEASE = ${UNAME_RELEASE} +UNAME_SYSTEM = ${UNAME_SYSTEM} +UNAME_VERSION = ${UNAME_VERSION} +EOF + +exit 1 + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "timestamp='" +# time-stamp-format: "%:y-%02m-%02d" +# time-stamp-end: "'" +# End: diff --git a/driver/xf86-video-geode/config.h.in b/driver/xf86-video-geode/config.h.in new file mode 100644 index 000000000..f746bbe5e --- /dev/null +++ b/driver/xf86-video-geode/config.h.in @@ -0,0 +1,78 @@ +/* config.h.in. Generated from configure.ac by autoheader. */ + +#include "xorg-server.h" + +/* Define to 1 if you have the declaration of `amd64', and to 0 if you don't. + */ +#undef HAVE_DECL_AMD64 + +/* Define to 1 if you have the declaration of `_LP64', and to 0 if you don't. + */ +#undef HAVE_DECL__LP64 + +/* Define to 1 if you have the declaration of `__amd64__', and to 0 if you + don't. */ +#undef HAVE_DECL___AMD64__ + +/* Define to 1 if you have the header file. */ +#undef HAVE_DLFCN_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_INTTYPES_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_MEMORY_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDINT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDLIB_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STRINGS_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STRING_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_STAT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_TYPES_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_UNISTD_H + +/* Name of package */ +#undef PACKAGE + +/* Define to the address where bug reports for this package should be sent. */ +#undef PACKAGE_BUGREPORT + +/* Define to the full name of this package. */ +#undef PACKAGE_NAME + +/* Define to the full name and version of this package. */ +#undef PACKAGE_STRING + +/* Define to the one symbol short name of this package. */ +#undef PACKAGE_TARNAME + +/* Define to the version of this package. */ +#undef PACKAGE_VERSION + +/* Major version of this package */ +#undef PACKAGE_VERSION_MAJOR + +/* Minor version of this package */ +#undef PACKAGE_VERSION_MINOR + +/* Patch version of this package */ +#undef PACKAGE_VERSION_PATCHLEVEL + +/* Define to 1 if you have the ANSI C header files. */ +#undef STDC_HEADERS + +/* Version number of package */ +#undef VERSION diff --git a/driver/xf86-video-geode/config.sub b/driver/xf86-video-geode/config.sub new file mode 100755 index 000000000..5defff65a --- /dev/null +++ b/driver/xf86-video-geode/config.sub @@ -0,0 +1,1622 @@ +#! /bin/sh +# Configuration validation subroutine script. +# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, +# 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, +# Inc. + +timestamp='2007-01-18' + +# This file is (in principle) common to ALL GNU software. +# The presence of a machine in this file suggests that SOME GNU software +# can handle that machine. It does not imply ALL GNU software can. +# +# This file is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA +# 02110-1301, USA. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + + +# Please send patches to . Submit a context +# diff and a properly formatted ChangeLog entry. +# +# Configuration subroutine to validate and canonicalize a configuration type. +# Supply the specified configuration type as an argument. +# If it is invalid, we print an error message on stderr and exit with code 1. +# Otherwise, we print the canonical config type on stdout and succeed. + +# This file is supposed to be the same for all GNU packages +# and recognize all the CPU types, system types and aliases +# that are meaningful with *any* GNU software. +# Each package is responsible for reporting which valid configurations +# it does not support. The user should be able to distinguish +# a failure to support a valid configuration from a meaningless +# configuration. + +# The goal of this file is to map all the various variations of a given +# machine specification into a single specification in the form: +# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM +# or in some cases, the newer four-part form: +# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM +# It is wrong to echo any other type of specification. + +me=`echo "$0" | sed -e 's,.*/,,'` + +usage="\ +Usage: $0 [OPTION] CPU-MFR-OPSYS + $0 [OPTION] ALIAS + +Canonicalize a configuration name. + +Operation modes: + -h, --help print this help, then exit + -t, --time-stamp print date of last modification, then exit + -v, --version print version number, then exit + +Report bugs and patches to ." + +version="\ +GNU config.sub ($timestamp) + +Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 +Free Software Foundation, Inc. + +This is free software; see the source for copying conditions. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." + +help=" +Try \`$me --help' for more information." + +# Parse command line +while test $# -gt 0 ; do + case $1 in + --time-stamp | --time* | -t ) + echo "$timestamp" ; exit ;; + --version | -v ) + echo "$version" ; exit ;; + --help | --h* | -h ) + echo "$usage"; exit ;; + -- ) # Stop option processing + shift; break ;; + - ) # Use stdin as input. + break ;; + -* ) + echo "$me: invalid option $1$help" + exit 1 ;; + + *local*) + # First pass through any local machine types. + echo $1 + exit ;; + + * ) + break ;; + esac +done + +case $# in + 0) echo "$me: missing argument$help" >&2 + exit 1;; + 1) ;; + *) echo "$me: too many arguments$help" >&2 + exit 1;; +esac + +# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). +# Here we must recognize all the valid KERNEL-OS combinations. +maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` +case $maybe_os in + nto-qnx* | linux-gnu* | linux-dietlibc | linux-newlib* | linux-uclibc* | \ + uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | \ + storm-chaos* | os2-emx* | rtmk-nova*) + os=-$maybe_os + basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` + ;; + *) + basic_machine=`echo $1 | sed 's/-[^-]*$//'` + if [ $basic_machine != $1 ] + then os=`echo $1 | sed 's/.*-/-/'` + else os=; fi + ;; +esac + +### Let's recognize common machines as not being operating systems so +### that things like config.sub decstation-3100 work. We also +### recognize some manufacturers as not being operating systems, so we +### can provide default operating systems below. +case $os in + -sun*os*) + # Prevent following clause from handling this invalid input. + ;; + -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ + -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ + -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ + -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ + -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ + -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ + -apple | -axis | -knuth | -cray) + os= + basic_machine=$1 + ;; + -sim | -cisco | -oki | -wec | -winbond) + os= + basic_machine=$1 + ;; + -scout) + ;; + -wrs) + os=-vxworks + basic_machine=$1 + ;; + -chorusos*) + os=-chorusos + basic_machine=$1 + ;; + -chorusrdb) + os=-chorusrdb + basic_machine=$1 + ;; + -hiux*) + os=-hiuxwe2 + ;; + -sco6) + os=-sco5v6 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco5) + os=-sco3.2v5 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco4) + os=-sco3.2v4 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco3.2.[4-9]*) + os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco3.2v[4-9]*) + # Don't forget version if it is 3.2v4 or newer. + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco5v6*) + # Don't forget version if it is 3.2v4 or newer. + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco*) + os=-sco3.2v2 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -udk*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -isc) + os=-isc2.2 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -clix*) + basic_machine=clipper-intergraph + ;; + -isc*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -lynx*) + os=-lynxos + ;; + -ptx*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` + ;; + -windowsnt*) + os=`echo $os | sed -e 's/windowsnt/winnt/'` + ;; + -psos*) + os=-psos + ;; + -mint | -mint[0-9]*) + basic_machine=m68k-atari + os=-mint + ;; +esac + +# Decode aliases for certain CPU-COMPANY combinations. +case $basic_machine in + # Recognize the basic CPU types without company name. + # Some are omitted here because they have special meanings below. + 1750a | 580 \ + | a29k \ + | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ + | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ + | am33_2.0 \ + | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \ + | bfin \ + | c4x | clipper \ + | d10v | d30v | dlx | dsp16xx \ + | fido | fr30 | frv \ + | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ + | i370 | i860 | i960 | ia64 \ + | ip2k | iq2000 \ + | m32c | m32r | m32rle | m68000 | m68k | m88k \ + | maxq | mb | microblaze | mcore | mep \ + | mips | mipsbe | mipseb | mipsel | mipsle \ + | mips16 \ + | mips64 | mips64el \ + | mips64vr | mips64vrel \ + | mips64orion | mips64orionel \ + | mips64vr4100 | mips64vr4100el \ + | mips64vr4300 | mips64vr4300el \ + | mips64vr5000 | mips64vr5000el \ + | mips64vr5900 | mips64vr5900el \ + | mipsisa32 | mipsisa32el \ + | mipsisa32r2 | mipsisa32r2el \ + | mipsisa64 | mipsisa64el \ + | mipsisa64r2 | mipsisa64r2el \ + | mipsisa64sb1 | mipsisa64sb1el \ + | mipsisa64sr71k | mipsisa64sr71kel \ + | mipstx39 | mipstx39el \ + | mn10200 | mn10300 \ + | mt \ + | msp430 \ + | nios | nios2 \ + | ns16k | ns32k \ + | or32 \ + | pdp10 | pdp11 | pj | pjl \ + | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \ + | pyramid \ + | score \ + | sh | sh[1234] | sh[24]a | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ + | sh64 | sh64le \ + | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \ + | sparcv8 | sparcv9 | sparcv9b | sparcv9v \ + | spu | strongarm \ + | tahoe | thumb | tic4x | tic80 | tron \ + | v850 | v850e \ + | we32k \ + | x86 | xc16x | xscale | xscalee[bl] | xstormy16 | xtensa \ + | z8k) + basic_machine=$basic_machine-unknown + ;; + m6811 | m68hc11 | m6812 | m68hc12) + # Motorola 68HC11/12. + basic_machine=$basic_machine-unknown + os=-none + ;; + m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) + ;; + ms1) + basic_machine=mt-unknown + ;; + + # We use `pc' rather than `unknown' + # because (1) that's what they normally are, and + # (2) the word "unknown" tends to confuse beginning users. + i*86 | x86_64) + basic_machine=$basic_machine-pc + ;; + # Object if more than one company name word. + *-*-*) + echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 + exit 1 + ;; + # Recognize the basic CPU types with company name. + 580-* \ + | a29k-* \ + | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ + | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ + | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \ + | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ + | avr-* | avr32-* \ + | bfin-* | bs2000-* \ + | c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \ + | clipper-* | craynv-* | cydra-* \ + | d10v-* | d30v-* | dlx-* \ + | elxsi-* \ + | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \ + | h8300-* | h8500-* \ + | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ + | i*86-* | i860-* | i960-* | ia64-* \ + | ip2k-* | iq2000-* \ + | m32c-* | m32r-* | m32rle-* \ + | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ + | m88110-* | m88k-* | maxq-* | mcore-* \ + | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ + | mips16-* \ + | mips64-* | mips64el-* \ + | mips64vr-* | mips64vrel-* \ + | mips64orion-* | mips64orionel-* \ + | mips64vr4100-* | mips64vr4100el-* \ + | mips64vr4300-* | mips64vr4300el-* \ + | mips64vr5000-* | mips64vr5000el-* \ + | mips64vr5900-* | mips64vr5900el-* \ + | mipsisa32-* | mipsisa32el-* \ + | mipsisa32r2-* | mipsisa32r2el-* \ + | mipsisa64-* | mipsisa64el-* \ + | mipsisa64r2-* | mipsisa64r2el-* \ + | mipsisa64sb1-* | mipsisa64sb1el-* \ + | mipsisa64sr71k-* | mipsisa64sr71kel-* \ + | mipstx39-* | mipstx39el-* \ + | mmix-* \ + | mt-* \ + | msp430-* \ + | nios-* | nios2-* \ + | none-* | np1-* | ns16k-* | ns32k-* \ + | orion-* \ + | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ + | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \ + | pyramid-* \ + | romp-* | rs6000-* \ + | sh-* | sh[1234]-* | sh[24]a-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ + | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ + | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ + | sparclite-* \ + | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | strongarm-* | sv1-* | sx?-* \ + | tahoe-* | thumb-* \ + | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ + | tron-* \ + | v850-* | v850e-* | vax-* \ + | we32k-* \ + | x86-* | x86_64-* | xc16x-* | xps100-* | xscale-* | xscalee[bl]-* \ + | xstormy16-* | xtensa-* \ + | ymp-* \ + | z8k-*) + ;; + # Recognize the various machine names and aliases which stand + # for a CPU type and a company and sometimes even an OS. + 386bsd) + basic_machine=i386-unknown + os=-bsd + ;; + 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) + basic_machine=m68000-att + ;; + 3b*) + basic_machine=we32k-att + ;; + a29khif) + basic_machine=a29k-amd + os=-udi + ;; + abacus) + basic_machine=abacus-unknown + ;; + adobe68k) + basic_machine=m68010-adobe + os=-scout + ;; + alliant | fx80) + basic_machine=fx80-alliant + ;; + altos | altos3068) + basic_machine=m68k-altos + ;; + am29k) + basic_machine=a29k-none + os=-bsd + ;; + amd64) + basic_machine=x86_64-pc + ;; + amd64-*) + basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + amdahl) + basic_machine=580-amdahl + os=-sysv + ;; + amiga | amiga-*) + basic_machine=m68k-unknown + ;; + amigaos | amigados) + basic_machine=m68k-unknown + os=-amigaos + ;; + amigaunix | amix) + basic_machine=m68k-unknown + os=-sysv4 + ;; + apollo68) + basic_machine=m68k-apollo + os=-sysv + ;; + apollo68bsd) + basic_machine=m68k-apollo + os=-bsd + ;; + aux) + basic_machine=m68k-apple + os=-aux + ;; + balance) + basic_machine=ns32k-sequent + os=-dynix + ;; + c90) + basic_machine=c90-cray + os=-unicos + ;; + convex-c1) + basic_machine=c1-convex + os=-bsd + ;; + convex-c2) + basic_machine=c2-convex + os=-bsd + ;; + convex-c32) + basic_machine=c32-convex + os=-bsd + ;; + convex-c34) + basic_machine=c34-convex + os=-bsd + ;; + convex-c38) + basic_machine=c38-convex + os=-bsd + ;; + cray | j90) + basic_machine=j90-cray + os=-unicos + ;; + craynv) + basic_machine=craynv-cray + os=-unicosmp + ;; + cr16c) + basic_machine=cr16c-unknown + os=-elf + ;; + crds | unos) + basic_machine=m68k-crds + ;; + crisv32 | crisv32-* | etraxfs*) + basic_machine=crisv32-axis + ;; + cris | cris-* | etrax*) + basic_machine=cris-axis + ;; + crx) + basic_machine=crx-unknown + os=-elf + ;; + da30 | da30-*) + basic_machine=m68k-da30 + ;; + decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) + basic_machine=mips-dec + ;; + decsystem10* | dec10*) + basic_machine=pdp10-dec + os=-tops10 + ;; + decsystem20* | dec20*) + basic_machine=pdp10-dec + os=-tops20 + ;; + delta | 3300 | motorola-3300 | motorola-delta \ + | 3300-motorola | delta-motorola) + basic_machine=m68k-motorola + ;; + delta88) + basic_machine=m88k-motorola + os=-sysv3 + ;; + djgpp) + basic_machine=i586-pc + os=-msdosdjgpp + ;; + dpx20 | dpx20-*) + basic_machine=rs6000-bull + os=-bosx + ;; + dpx2* | dpx2*-bull) + basic_machine=m68k-bull + os=-sysv3 + ;; + ebmon29k) + basic_machine=a29k-amd + os=-ebmon + ;; + elxsi) + basic_machine=elxsi-elxsi + os=-bsd + ;; + encore | umax | mmax) + basic_machine=ns32k-encore + ;; + es1800 | OSE68k | ose68k | ose | OSE) + basic_machine=m68k-ericsson + os=-ose + ;; + fx2800) + basic_machine=i860-alliant + ;; + genix) + basic_machine=ns32k-ns + ;; + gmicro) + basic_machine=tron-gmicro + os=-sysv + ;; + go32) + basic_machine=i386-pc + os=-go32 + ;; + h3050r* | hiux*) + basic_machine=hppa1.1-hitachi + os=-hiuxwe2 + ;; + h8300hms) + basic_machine=h8300-hitachi + os=-hms + ;; + h8300xray) + basic_machine=h8300-hitachi + os=-xray + ;; + h8500hms) + basic_machine=h8500-hitachi + os=-hms + ;; + harris) + basic_machine=m88k-harris + os=-sysv3 + ;; + hp300-*) + basic_machine=m68k-hp + ;; + hp300bsd) + basic_machine=m68k-hp + os=-bsd + ;; + hp300hpux) + basic_machine=m68k-hp + os=-hpux + ;; + hp3k9[0-9][0-9] | hp9[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + hp9k2[0-9][0-9] | hp9k31[0-9]) + basic_machine=m68000-hp + ;; + hp9k3[2-9][0-9]) + basic_machine=m68k-hp + ;; + hp9k6[0-9][0-9] | hp6[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + hp9k7[0-79][0-9] | hp7[0-79][0-9]) + basic_machine=hppa1.1-hp + ;; + hp9k78[0-9] | hp78[0-9]) + # FIXME: really hppa2.0-hp + basic_machine=hppa1.1-hp + ;; + hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) + # FIXME: really hppa2.0-hp + basic_machine=hppa1.1-hp + ;; + hp9k8[0-9][13679] | hp8[0-9][13679]) + basic_machine=hppa1.1-hp + ;; + hp9k8[0-9][0-9] | hp8[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + hppa-next) + os=-nextstep3 + ;; + hppaosf) + basic_machine=hppa1.1-hp + os=-osf + ;; + hppro) + basic_machine=hppa1.1-hp + os=-proelf + ;; + i370-ibm* | ibm*) + basic_machine=i370-ibm + ;; +# I'm not sure what "Sysv32" means. Should this be sysv3.2? + i*86v32) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv32 + ;; + i*86v4*) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv4 + ;; + i*86v) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv + ;; + i*86sol2) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-solaris2 + ;; + i386mach) + basic_machine=i386-mach + os=-mach + ;; + i386-vsta | vsta) + basic_machine=i386-unknown + os=-vsta + ;; + iris | iris4d) + basic_machine=mips-sgi + case $os in + -irix*) + ;; + *) + os=-irix4 + ;; + esac + ;; + isi68 | isi) + basic_machine=m68k-isi + os=-sysv + ;; + m88k-omron*) + basic_machine=m88k-omron + ;; + magnum | m3230) + basic_machine=mips-mips + os=-sysv + ;; + merlin) + basic_machine=ns32k-utek + os=-sysv + ;; + mingw32) + basic_machine=i386-pc + os=-mingw32 + ;; + miniframe) + basic_machine=m68000-convergent + ;; + *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) + basic_machine=m68k-atari + os=-mint + ;; + mips3*-*) + basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` + ;; + mips3*) + basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown + ;; + monitor) + basic_machine=m68k-rom68k + os=-coff + ;; + morphos) + basic_machine=powerpc-unknown + os=-morphos + ;; + msdos) + basic_machine=i386-pc + os=-msdos + ;; + ms1-*) + basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'` + ;; + mvs) + basic_machine=i370-ibm + os=-mvs + ;; + ncr3000) + basic_machine=i486-ncr + os=-sysv4 + ;; + netbsd386) + basic_machine=i386-unknown + os=-netbsd + ;; + netwinder) + basic_machine=armv4l-rebel + os=-linux + ;; + news | news700 | news800 | news900) + basic_machine=m68k-sony + os=-newsos + ;; + news1000) + basic_machine=m68030-sony + os=-newsos + ;; + news-3600 | risc-news) + basic_machine=mips-sony + os=-newsos + ;; + necv70) + basic_machine=v70-nec + os=-sysv + ;; + next | m*-next ) + basic_machine=m68k-next + case $os in + -nextstep* ) + ;; + -ns2*) + os=-nextstep2 + ;; + *) + os=-nextstep3 + ;; + esac + ;; + nh3000) + basic_machine=m68k-harris + os=-cxux + ;; + nh[45]000) + basic_machine=m88k-harris + os=-cxux + ;; + nindy960) + basic_machine=i960-intel + os=-nindy + ;; + mon960) + basic_machine=i960-intel + os=-mon960 + ;; + nonstopux) + basic_machine=mips-compaq + os=-nonstopux + ;; + np1) + basic_machine=np1-gould + ;; + nsr-tandem) + basic_machine=nsr-tandem + ;; + op50n-* | op60c-*) + basic_machine=hppa1.1-oki + os=-proelf + ;; + openrisc | openrisc-*) + basic_machine=or32-unknown + ;; + os400) + basic_machine=powerpc-ibm + os=-os400 + ;; + OSE68000 | ose68000) + basic_machine=m68000-ericsson + os=-ose + ;; + os68k) + basic_machine=m68k-none + os=-os68k + ;; + pa-hitachi) + basic_machine=hppa1.1-hitachi + os=-hiuxwe2 + ;; + paragon) + basic_machine=i860-intel + os=-osf + ;; + pbd) + basic_machine=sparc-tti + ;; + pbb) + basic_machine=m68k-tti + ;; + pc532 | pc532-*) + basic_machine=ns32k-pc532 + ;; + pc98) + basic_machine=i386-pc + ;; + pc98-*) + basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentium | p5 | k5 | k6 | nexgen | viac3) + basic_machine=i586-pc + ;; + pentiumpro | p6 | 6x86 | athlon | athlon_*) + basic_machine=i686-pc + ;; + pentiumii | pentium2 | pentiumiii | pentium3) + basic_machine=i686-pc + ;; + pentium4) + basic_machine=i786-pc + ;; + pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) + basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentiumpro-* | p6-* | 6x86-* | athlon-*) + basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) + basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentium4-*) + basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pn) + basic_machine=pn-gould + ;; + power) basic_machine=power-ibm + ;; + ppc) basic_machine=powerpc-unknown + ;; + ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ppcle | powerpclittle | ppc-le | powerpc-little) + basic_machine=powerpcle-unknown + ;; + ppcle-* | powerpclittle-*) + basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ppc64) basic_machine=powerpc64-unknown + ;; + ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ppc64le | powerpc64little | ppc64-le | powerpc64-little) + basic_machine=powerpc64le-unknown + ;; + ppc64le-* | powerpc64little-*) + basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ps2) + basic_machine=i386-ibm + ;; + pw32) + basic_machine=i586-unknown + os=-pw32 + ;; + rdos) + basic_machine=i386-pc + os=-rdos + ;; + rom68k) + basic_machine=m68k-rom68k + os=-coff + ;; + rm[46]00) + basic_machine=mips-siemens + ;; + rtpc | rtpc-*) + basic_machine=romp-ibm + ;; + s390 | s390-*) + basic_machine=s390-ibm + ;; + s390x | s390x-*) + basic_machine=s390x-ibm + ;; + sa29200) + basic_machine=a29k-amd + os=-udi + ;; + sb1) + basic_machine=mipsisa64sb1-unknown + ;; + sb1el) + basic_machine=mipsisa64sb1el-unknown + ;; + sde) + basic_machine=mipsisa32-sde + os=-elf + ;; + sei) + basic_machine=mips-sei + os=-seiux + ;; + sequent) + basic_machine=i386-sequent + ;; + sh) + basic_machine=sh-hitachi + os=-hms + ;; + sh5el) + basic_machine=sh5le-unknown + ;; + sh64) + basic_machine=sh64-unknown + ;; + sparclite-wrs | simso-wrs) + basic_machine=sparclite-wrs + os=-vxworks + ;; + sps7) + basic_machine=m68k-bull + os=-sysv2 + ;; + spur) + basic_machine=spur-unknown + ;; + st2000) + basic_machine=m68k-tandem + ;; + stratus) + basic_machine=i860-stratus + os=-sysv4 + ;; + sun2) + basic_machine=m68000-sun + ;; + sun2os3) + basic_machine=m68000-sun + os=-sunos3 + ;; + sun2os4) + basic_machine=m68000-sun + os=-sunos4 + ;; + sun3os3) + basic_machine=m68k-sun + os=-sunos3 + ;; + sun3os4) + basic_machine=m68k-sun + os=-sunos4 + ;; + sun4os3) + basic_machine=sparc-sun + os=-sunos3 + ;; + sun4os4) + basic_machine=sparc-sun + os=-sunos4 + ;; + sun4sol2) + basic_machine=sparc-sun + os=-solaris2 + ;; + sun3 | sun3-*) + basic_machine=m68k-sun + ;; + sun4) + basic_machine=sparc-sun + ;; + sun386 | sun386i | roadrunner) + basic_machine=i386-sun + ;; + sv1) + basic_machine=sv1-cray + os=-unicos + ;; + symmetry) + basic_machine=i386-sequent + os=-dynix + ;; + t3e) + basic_machine=alphaev5-cray + os=-unicos + ;; + t90) + basic_machine=t90-cray + os=-unicos + ;; + tic54x | c54x*) + basic_machine=tic54x-unknown + os=-coff + ;; + tic55x | c55x*) + basic_machine=tic55x-unknown + os=-coff + ;; + tic6x | c6x*) + basic_machine=tic6x-unknown + os=-coff + ;; + tx39) + basic_machine=mipstx39-unknown + ;; + tx39el) + basic_machine=mipstx39el-unknown + ;; + toad1) + basic_machine=pdp10-xkl + os=-tops20 + ;; + tower | tower-32) + basic_machine=m68k-ncr + ;; + tpf) + basic_machine=s390x-ibm + os=-tpf + ;; + udi29k) + basic_machine=a29k-amd + os=-udi + ;; + ultra3) + basic_machine=a29k-nyu + os=-sym1 + ;; + v810 | necv810) + basic_machine=v810-nec + os=-none + ;; + vaxv) + basic_machine=vax-dec + os=-sysv + ;; + vms) + basic_machine=vax-dec + os=-vms + ;; + vpp*|vx|vx-*) + basic_machine=f301-fujitsu + ;; + vxworks960) + basic_machine=i960-wrs + os=-vxworks + ;; + vxworks68) + basic_machine=m68k-wrs + os=-vxworks + ;; + vxworks29k) + basic_machine=a29k-wrs + os=-vxworks + ;; + w65*) + basic_machine=w65-wdc + os=-none + ;; + w89k-*) + basic_machine=hppa1.1-winbond + os=-proelf + ;; + xbox) + basic_machine=i686-pc + os=-mingw32 + ;; + xps | xps100) + basic_machine=xps100-honeywell + ;; + ymp) + basic_machine=ymp-cray + os=-unicos + ;; + z8k-*-coff) + basic_machine=z8k-unknown + os=-sim + ;; + none) + basic_machine=none-none + os=-none + ;; + +# Here we handle the default manufacturer of certain CPU types. It is in +# some cases the only manufacturer, in others, it is the most popular. + w89k) + basic_machine=hppa1.1-winbond + ;; + op50n) + basic_machine=hppa1.1-oki + ;; + op60c) + basic_machine=hppa1.1-oki + ;; + romp) + basic_machine=romp-ibm + ;; + mmix) + basic_machine=mmix-knuth + ;; + rs6000) + basic_machine=rs6000-ibm + ;; + vax) + basic_machine=vax-dec + ;; + pdp10) + # there are many clones, so DEC is not a safe bet + basic_machine=pdp10-unknown + ;; + pdp11) + basic_machine=pdp11-dec + ;; + we32k) + basic_machine=we32k-att + ;; + sh[1234] | sh[24]a | sh[34]eb | sh[1234]le | sh[23]ele) + basic_machine=sh-unknown + ;; + sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v) + basic_machine=sparc-sun + ;; + cydra) + basic_machine=cydra-cydrome + ;; + orion) + basic_machine=orion-highlevel + ;; + orion105) + basic_machine=clipper-highlevel + ;; + mac | mpw | mac-mpw) + basic_machine=m68k-apple + ;; + pmac | pmac-mpw) + basic_machine=powerpc-apple + ;; + *-unknown) + # Make sure to match an already-canonicalized machine name. + ;; + *) + echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 + exit 1 + ;; +esac + +# Here we canonicalize certain aliases for manufacturers. +case $basic_machine in + *-digital*) + basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` + ;; + *-commodore*) + basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` + ;; + *) + ;; +esac + +# Decode manufacturer-specific aliases for certain operating systems. + +if [ x"$os" != x"" ] +then +case $os in + # First match some system type aliases + # that might get confused with valid system types. + # -solaris* is a basic system type, with this one exception. + -solaris1 | -solaris1.*) + os=`echo $os | sed -e 's|solaris1|sunos4|'` + ;; + -solaris) + os=-solaris2 + ;; + -svr4*) + os=-sysv4 + ;; + -unixware*) + os=-sysv4.2uw + ;; + -gnu/linux*) + os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` + ;; + # First accept the basic system types. + # The portable systems comes first. + # Each alternative MUST END IN A *, to match a version number. + # -sysv* is not here because it comes later, after sysvr4. + -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ + | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\ + | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \ + | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ + | -aos* \ + | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ + | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ + | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \ + | -openbsd* | -solidbsd* \ + | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ + | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ + | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ + | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ + | -chorusos* | -chorusrdb* \ + | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ + | -mingw32* | -linux-gnu* | -linux-newlib* | -linux-uclibc* \ + | -uxpv* | -beos* | -mpeix* | -udk* \ + | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ + | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ + | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ + | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ + | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ + | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ + | -skyos* | -haiku* | -rdos* | -toppers* | -drops*) + # Remember, each alternative MUST END IN *, to match a version number. + ;; + -qnx*) + case $basic_machine in + x86-* | i*86-*) + ;; + *) + os=-nto$os + ;; + esac + ;; + -nto-qnx*) + ;; + -nto*) + os=`echo $os | sed -e 's|nto|nto-qnx|'` + ;; + -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ + | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \ + | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) + ;; + -mac*) + os=`echo $os | sed -e 's|mac|macos|'` + ;; + -linux-dietlibc) + os=-linux-dietlibc + ;; + -linux*) + os=`echo $os | sed -e 's|linux|linux-gnu|'` + ;; + -sunos5*) + os=`echo $os | sed -e 's|sunos5|solaris2|'` + ;; + -sunos6*) + os=`echo $os | sed -e 's|sunos6|solaris3|'` + ;; + -opened*) + os=-openedition + ;; + -os400*) + os=-os400 + ;; + -wince*) + os=-wince + ;; + -osfrose*) + os=-osfrose + ;; + -osf*) + os=-osf + ;; + -utek*) + os=-bsd + ;; + -dynix*) + os=-bsd + ;; + -acis*) + os=-aos + ;; + -atheos*) + os=-atheos + ;; + -syllable*) + os=-syllable + ;; + -386bsd) + os=-bsd + ;; + -ctix* | -uts*) + os=-sysv + ;; + -nova*) + os=-rtmk-nova + ;; + -ns2 ) + os=-nextstep2 + ;; + -nsk*) + os=-nsk + ;; + # Preserve the version number of sinix5. + -sinix5.*) + os=`echo $os | sed -e 's|sinix|sysv|'` + ;; + -sinix*) + os=-sysv4 + ;; + -tpf*) + os=-tpf + ;; + -triton*) + os=-sysv3 + ;; + -oss*) + os=-sysv3 + ;; + -svr4) + os=-sysv4 + ;; + -svr3) + os=-sysv3 + ;; + -sysvr4) + os=-sysv4 + ;; + # This must come after -sysvr4. + -sysv*) + ;; + -ose*) + os=-ose + ;; + -es1800*) + os=-ose + ;; + -xenix) + os=-xenix + ;; + -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) + os=-mint + ;; + -aros*) + os=-aros + ;; + -kaos*) + os=-kaos + ;; + -zvmoe) + os=-zvmoe + ;; + -none) + ;; + *) + # Get rid of the `-' at the beginning of $os. + os=`echo $os | sed 's/[^-]*-//'` + echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 + exit 1 + ;; +esac +else + +# Here we handle the default operating systems that come with various machines. +# The value should be what the vendor currently ships out the door with their +# machine or put another way, the most popular os provided with the machine. + +# Note that if you're going to try to match "-MANUFACTURER" here (say, +# "-sun"), then you have to tell the case statement up towards the top +# that MANUFACTURER isn't an operating system. Otherwise, code above +# will signal an error saying that MANUFACTURER isn't an operating +# system, and we'll never get to this point. + +case $basic_machine in + score-*) + os=-elf + ;; + spu-*) + os=-elf + ;; + *-acorn) + os=-riscix1.2 + ;; + arm*-rebel) + os=-linux + ;; + arm*-semi) + os=-aout + ;; + c4x-* | tic4x-*) + os=-coff + ;; + # This must come before the *-dec entry. + pdp10-*) + os=-tops20 + ;; + pdp11-*) + os=-none + ;; + *-dec | vax-*) + os=-ultrix4.2 + ;; + m68*-apollo) + os=-domain + ;; + i386-sun) + os=-sunos4.0.2 + ;; + m68000-sun) + os=-sunos3 + # This also exists in the configure program, but was not the + # default. + # os=-sunos4 + ;; + m68*-cisco) + os=-aout + ;; + mep-*) + os=-elf + ;; + mips*-cisco) + os=-elf + ;; + mips*-*) + os=-elf + ;; + or32-*) + os=-coff + ;; + *-tti) # must be before sparc entry or we get the wrong os. + os=-sysv3 + ;; + sparc-* | *-sun) + os=-sunos4.1.1 + ;; + *-be) + os=-beos + ;; + *-haiku) + os=-haiku + ;; + *-ibm) + os=-aix + ;; + *-knuth) + os=-mmixware + ;; + *-wec) + os=-proelf + ;; + *-winbond) + os=-proelf + ;; + *-oki) + os=-proelf + ;; + *-hp) + os=-hpux + ;; + *-hitachi) + os=-hiux + ;; + i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) + os=-sysv + ;; + *-cbm) + os=-amigaos + ;; + *-dg) + os=-dgux + ;; + *-dolphin) + os=-sysv3 + ;; + m68k-ccur) + os=-rtu + ;; + m88k-omron*) + os=-luna + ;; + *-next ) + os=-nextstep + ;; + *-sequent) + os=-ptx + ;; + *-crds) + os=-unos + ;; + *-ns) + os=-genix + ;; + i370-*) + os=-mvs + ;; + *-next) + os=-nextstep3 + ;; + *-gould) + os=-sysv + ;; + *-highlevel) + os=-bsd + ;; + *-encore) + os=-bsd + ;; + *-sgi) + os=-irix + ;; + *-siemens) + os=-sysv4 + ;; + *-masscomp) + os=-rtu + ;; + f30[01]-fujitsu | f700-fujitsu) + os=-uxpv + ;; + *-rom68k) + os=-coff + ;; + *-*bug) + os=-coff + ;; + *-apple) + os=-macos + ;; + *-atari*) + os=-mint + ;; + *) + os=-none + ;; +esac +fi + +# Here we handle the case where we know the os, and the CPU type, but not the +# manufacturer. We pick the logical manufacturer. +vendor=unknown +case $basic_machine in + *-unknown) + case $os in + -riscix*) + vendor=acorn + ;; + -sunos*) + vendor=sun + ;; + -aix*) + vendor=ibm + ;; + -beos*) + vendor=be + ;; + -hpux*) + vendor=hp + ;; + -mpeix*) + vendor=hp + ;; + -hiux*) + vendor=hitachi + ;; + -unos*) + vendor=crds + ;; + -dgux*) + vendor=dg + ;; + -luna*) + vendor=omron + ;; + -genix*) + vendor=ns + ;; + -mvs* | -opened*) + vendor=ibm + ;; + -os400*) + vendor=ibm + ;; + -ptx*) + vendor=sequent + ;; + -tpf*) + vendor=ibm + ;; + -vxsim* | -vxworks* | -windiss*) + vendor=wrs + ;; + -aux*) + vendor=apple + ;; + -hms*) + vendor=hitachi + ;; + -mpw* | -macos*) + vendor=apple + ;; + -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) + vendor=atari + ;; + -vos*) + vendor=stratus + ;; + esac + basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` + ;; +esac + +echo $basic_machine$os +exit + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "timestamp='" +# time-stamp-format: "%:y-%02m-%02d" +# time-stamp-end: "'" +# End: diff --git a/driver/xf86-video-geode/configure b/driver/xf86-video-geode/configure new file mode 100755 index 000000000..095152814 --- /dev/null +++ b/driver/xf86-video-geode/configure @@ -0,0 +1,23082 @@ +#! /bin/sh +# Guess values for system-dependent variables and create Makefiles. +# Generated by GNU Autoconf 2.61 for xf86-video-geode 2.10.0. +# +# Report bugs to . +# +# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, +# 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. +# This configure script is free software; the Free Software Foundation +# gives unlimited permission to copy, distribute and modify it. +## --------------------- ## +## M4sh Initialization. ## +## --------------------- ## + +# Be more Bourne compatible +DUALCASE=1; export DUALCASE # for MKS sh +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then + emulate sh + NULLCMD=: + # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' + setopt NO_GLOB_SUBST +else + case `(set -o) 2>/dev/null` in + *posix*) set -o posix ;; +esac + +fi + + + + +# PATH needs CR +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits + +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + echo "#! /bin/sh" >conf$$.sh + echo "exit 0" >>conf$$.sh + chmod +x conf$$.sh + if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then + PATH_SEPARATOR=';' + else + PATH_SEPARATOR=: + fi + rm -f conf$$.sh +fi + +# Support unset when possible. +if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then + as_unset=unset +else + as_unset=false +fi + + +# IFS +# We need space, tab and new line, in precisely that order. Quoting is +# there to prevent editors from complaining about space-tab. +# (If _AS_PATH_WALK were called with IFS unset, it would disable word +# splitting by setting IFS to empty value.) +as_nl=' +' +IFS=" "" $as_nl" + +# Find who we are. Look in the path if we contain no directory separator. +case $0 in + *[\\/]* ) as_myself=$0 ;; + *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break +done +IFS=$as_save_IFS + + ;; +esac +# We did not find ourselves, most probably we were run as `sh COMMAND' +# in which case we are not to be found in the path. +if test "x$as_myself" = x; then + as_myself=$0 +fi +if test ! -f "$as_myself"; then + echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 + { (exit 1); exit 1; } +fi + +# Work around bugs in pre-3.0 UWIN ksh. +for as_var in ENV MAIL MAILPATH +do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var +done +PS1='$ ' +PS2='> ' +PS4='+ ' + +# NLS nuisances. +for as_var in \ + LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ + LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ + LC_TELEPHONE LC_TIME +do + if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then + eval $as_var=C; export $as_var + else + ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var + fi +done + +# Required to use basename. +if expr a : '\(a\)' >/dev/null 2>&1 && + test "X`expr 00001 : '.*\(...\)'`" = X001; then + as_expr=expr +else + as_expr=false +fi + +if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then + as_basename=basename +else + as_basename=false +fi + + +# Name of the executable. +as_me=`$as_basename -- "$0" || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)' \| . 2>/dev/null || +echo X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ + s//\1/ + q + } + /^X\/\(\/\/\)$/{ + s//\1/ + q + } + /^X\/\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + +# CDPATH. +$as_unset CDPATH + + +if test "x$CONFIG_SHELL" = x; then + if (eval ":") 2>/dev/null; then + as_have_required=yes +else + as_have_required=no +fi + + if test $as_have_required = yes && (eval ": +(as_func_return () { + (exit \$1) +} +as_func_success () { + as_func_return 0 +} +as_func_failure () { + as_func_return 1 +} +as_func_ret_success () { + return 0 +} +as_func_ret_failure () { + return 1 +} + +exitcode=0 +if as_func_success; then + : +else + exitcode=1 + echo as_func_success failed. +fi + +if as_func_failure; then + exitcode=1 + echo as_func_failure succeeded. +fi + +if as_func_ret_success; then + : +else + exitcode=1 + echo as_func_ret_success failed. +fi + +if as_func_ret_failure; then + exitcode=1 + echo as_func_ret_failure succeeded. +fi + +if ( set x; as_func_ret_success y && test x = \"\$1\" ); then + : +else + exitcode=1 + echo positional parameters were not saved. +fi + +test \$exitcode = 0) || { (exit 1); exit 1; } + +( + as_lineno_1=\$LINENO + as_lineno_2=\$LINENO + test \"x\$as_lineno_1\" != \"x\$as_lineno_2\" && + test \"x\`expr \$as_lineno_1 + 1\`\" = \"x\$as_lineno_2\") || { (exit 1); exit 1; } +") 2> /dev/null; then + : +else + as_candidate_shells= + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + case $as_dir in + /*) + for as_base in sh bash ksh sh5; do + as_candidate_shells="$as_candidate_shells $as_dir/$as_base" + done;; + esac +done +IFS=$as_save_IFS + + + for as_shell in $as_candidate_shells $SHELL; do + # Try only shells that exist, to save several forks. + if { test -f "$as_shell" || test -f "$as_shell.exe"; } && + { ("$as_shell") 2> /dev/null <<\_ASEOF +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then + emulate sh + NULLCMD=: + # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' + setopt NO_GLOB_SUBST +else + case `(set -o) 2>/dev/null` in + *posix*) set -o posix ;; +esac + +fi + + +: +_ASEOF +}; then + CONFIG_SHELL=$as_shell + as_have_required=yes + if { "$as_shell" 2> /dev/null <<\_ASEOF +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then + emulate sh + NULLCMD=: + # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' + setopt NO_GLOB_SUBST +else + case `(set -o) 2>/dev/null` in + *posix*) set -o posix ;; +esac + +fi + + +: +(as_func_return () { + (exit $1) +} +as_func_success () { + as_func_return 0 +} +as_func_failure () { + as_func_return 1 +} +as_func_ret_success () { + return 0 +} +as_func_ret_failure () { + return 1 +} + +exitcode=0 +if as_func_success; then + : +else + exitcode=1 + echo as_func_success failed. +fi + +if as_func_failure; then + exitcode=1 + echo as_func_failure succeeded. +fi + +if as_func_ret_success; then + : +else + exitcode=1 + echo as_func_ret_success failed. +fi + +if as_func_ret_failure; then + exitcode=1 + echo as_func_ret_failure succeeded. +fi + +if ( set x; as_func_ret_success y && test x = "$1" ); then + : +else + exitcode=1 + echo positional parameters were not saved. +fi + +test $exitcode = 0) || { (exit 1); exit 1; } + +( + as_lineno_1=$LINENO + as_lineno_2=$LINENO + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2") || { (exit 1); exit 1; } + +_ASEOF +}; then + break +fi + +fi + + done + + if test "x$CONFIG_SHELL" != x; then + for as_var in BASH_ENV ENV + do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var + done + export CONFIG_SHELL + exec "$CONFIG_SHELL" "$as_myself" ${1+"$@"} +fi + + + if test $as_have_required = no; then + echo This script requires a shell more modern than all the + echo shells that I found on your system. Please install a + echo modern shell, or manually run the script under such a + echo shell if you do have one. + { (exit 1); exit 1; } +fi + + +fi + +fi + + + +(eval "as_func_return () { + (exit \$1) +} +as_func_success () { + as_func_return 0 +} +as_func_failure () { + as_func_return 1 +} +as_func_ret_success () { + return 0 +} +as_func_ret_failure () { + return 1 +} + +exitcode=0 +if as_func_success; then + : +else + exitcode=1 + echo as_func_success failed. +fi + +if as_func_failure; then + exitcode=1 + echo as_func_failure succeeded. +fi + +if as_func_ret_success; then + : +else + exitcode=1 + echo as_func_ret_success failed. +fi + +if as_func_ret_failure; then + exitcode=1 + echo as_func_ret_failure succeeded. +fi + +if ( set x; as_func_ret_success y && test x = \"\$1\" ); then + : +else + exitcode=1 + echo positional parameters were not saved. +fi + +test \$exitcode = 0") || { + echo No shell found that supports shell functions. + echo Please tell autoconf@gnu.org about your system, + echo including any error possibly output before this + echo message +} + + + + as_lineno_1=$LINENO + as_lineno_2=$LINENO + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || { + + # Create $as_me.lineno as a copy of $as_myself, but with $LINENO + # uniformly replaced by the line number. The first 'sed' inserts a + # line-number line after each line using $LINENO; the second 'sed' + # does the real work. The second script uses 'N' to pair each + # line-number line with the line containing $LINENO, and appends + # trailing '-' during substitution so that $LINENO is not a special + # case at line end. + # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the + # scripts with optimization help from Paolo Bonzini. Blame Lee + # E. McMahon (1931-1989) for sed's syntax. :-) + sed -n ' + p + /[$]LINENO/= + ' <$as_myself | + sed ' + s/[$]LINENO.*/&-/ + t lineno + b + :lineno + N + :loop + s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ + t loop + s/-\n.*// + ' >$as_me.lineno && + chmod +x "$as_me.lineno" || + { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 + { (exit 1); exit 1; }; } + + # Don't try to exec as it changes $[0], causing all sort of problems + # (the dirname of $[0] is not the place where we might find the + # original and so on. Autoconf is especially sensitive to this). + . "./$as_me.lineno" + # Exit status is that of the last command. + exit +} + + +if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then + as_dirname=dirname +else + as_dirname=false +fi + +ECHO_C= ECHO_N= ECHO_T= +case `echo -n x` in +-n*) + case `echo 'x\c'` in + *c*) ECHO_T=' ';; # ECHO_T is single tab character. + *) ECHO_C='\c';; + esac;; +*) + ECHO_N='-n';; +esac + +if expr a : '\(a\)' >/dev/null 2>&1 && + test "X`expr 00001 : '.*\(...\)'`" = X001; then + as_expr=expr +else + as_expr=false +fi + +rm -f conf$$ conf$$.exe conf$$.file +if test -d conf$$.dir; then + rm -f conf$$.dir/conf$$.file +else + rm -f conf$$.dir + mkdir conf$$.dir +fi +echo >conf$$.file +if ln -s conf$$.file conf$$ 2>/dev/null; then + as_ln_s='ln -s' + # ... but there are two gotchas: + # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. + # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. + # In both cases, we have to default to `cp -p'. + ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || + as_ln_s='cp -p' +elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln +else + as_ln_s='cp -p' +fi +rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file +rmdir conf$$.dir 2>/dev/null + +if mkdir -p . 2>/dev/null; then + as_mkdir_p=: +else + test -d ./-p && rmdir ./-p + as_mkdir_p=false +fi + +if test -x / >/dev/null 2>&1; then + as_test_x='test -x' +else + if ls -dL / >/dev/null 2>&1; then + as_ls_L_option=L + else + as_ls_L_option= + fi + as_test_x=' + eval sh -c '\'' + if test -d "$1"; then + test -d "$1/."; + else + case $1 in + -*)set "./$1";; + esac; + case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in + ???[sx]*):;;*)false;;esac;fi + '\'' sh + ' +fi +as_executable_p=$as_test_x + +# Sed expression to map a string onto a valid CPP name. +as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" + +# Sed expression to map a string onto a valid variable name. +as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" + + + + +# Check that we are running under the correct shell. +SHELL=${CONFIG_SHELL-/bin/sh} + +case X$ECHO in +X*--fallback-echo) + # Remove one level of quotation (which was required for Make). + ECHO=`echo "$ECHO" | sed 's,\\\\\$\\$0,'$0','` + ;; +esac + +echo=${ECHO-echo} +if test "X$1" = X--no-reexec; then + # Discard the --no-reexec flag, and continue. + shift +elif test "X$1" = X--fallback-echo; then + # Avoid inline document here, it may be left over + : +elif test "X`($echo '\t') 2>/dev/null`" = 'X\t' ; then + # Yippee, $echo works! + : +else + # Restart under the correct shell. + exec $SHELL "$0" --no-reexec ${1+"$@"} +fi + +if test "X$1" = X--fallback-echo; then + # used as fallback echo + shift + cat </dev/null 2>&1 && unset CDPATH + +if test -z "$ECHO"; then +if test "X${echo_test_string+set}" != Xset; then +# find a string as large as possible, as long as the shell can cope with it + for cmd in 'sed 50q "$0"' 'sed 20q "$0"' 'sed 10q "$0"' 'sed 2q "$0"' 'echo test'; do + # expected sizes: less than 2Kb, 1Kb, 512 bytes, 16 bytes, ... + if (echo_test_string=`eval $cmd`) 2>/dev/null && + echo_test_string=`eval $cmd` && + (test "X$echo_test_string" = "X$echo_test_string") 2>/dev/null + then + break + fi + done +fi + +if test "X`($echo '\t') 2>/dev/null`" = 'X\t' && + echo_testing_string=`($echo "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + : +else + # The Solaris, AIX, and Digital Unix default echo programs unquote + # backslashes. This makes it impossible to quote backslashes using + # echo "$something" | sed 's/\\/\\\\/g' + # + # So, first we look for a working echo in the user's PATH. + + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + for dir in $PATH /usr/ucb; do + IFS="$lt_save_ifs" + if (test -f $dir/echo || test -f $dir/echo$ac_exeext) && + test "X`($dir/echo '\t') 2>/dev/null`" = 'X\t' && + echo_testing_string=`($dir/echo "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + echo="$dir/echo" + break + fi + done + IFS="$lt_save_ifs" + + if test "X$echo" = Xecho; then + # We didn't find a better echo, so look for alternatives. + if test "X`(print -r '\t') 2>/dev/null`" = 'X\t' && + echo_testing_string=`(print -r "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + # This shell has a builtin print -r that does the trick. + echo='print -r' + elif (test -f /bin/ksh || test -f /bin/ksh$ac_exeext) && + test "X$CONFIG_SHELL" != X/bin/ksh; then + # If we have ksh, try running configure again with it. + ORIGINAL_CONFIG_SHELL=${CONFIG_SHELL-/bin/sh} + export ORIGINAL_CONFIG_SHELL + CONFIG_SHELL=/bin/ksh + export CONFIG_SHELL + exec $CONFIG_SHELL "$0" --no-reexec ${1+"$@"} + else + # Try using printf. + echo='printf %s\n' + if test "X`($echo '\t') 2>/dev/null`" = 'X\t' && + echo_testing_string=`($echo "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + # Cool, printf works + : + elif echo_testing_string=`($ORIGINAL_CONFIG_SHELL "$0" --fallback-echo '\t') 2>/dev/null` && + test "X$echo_testing_string" = 'X\t' && + echo_testing_string=`($ORIGINAL_CONFIG_SHELL "$0" --fallback-echo "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + CONFIG_SHELL=$ORIGINAL_CONFIG_SHELL + export CONFIG_SHELL + SHELL="$CONFIG_SHELL" + export SHELL + echo="$CONFIG_SHELL $0 --fallback-echo" + elif echo_testing_string=`($CONFIG_SHELL "$0" --fallback-echo '\t') 2>/dev/null` && + test "X$echo_testing_string" = 'X\t' && + echo_testing_string=`($CONFIG_SHELL "$0" --fallback-echo "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + echo="$CONFIG_SHELL $0 --fallback-echo" + else + # maybe with a smaller string... + prev=: + + for cmd in 'echo test' 'sed 2q "$0"' 'sed 10q "$0"' 'sed 20q "$0"' 'sed 50q "$0"'; do + if (test "X$echo_test_string" = "X`eval $cmd`") 2>/dev/null + then + break + fi + prev="$cmd" + done + + if test "$prev" != 'sed 50q "$0"'; then + echo_test_string=`eval $prev` + export echo_test_string + exec ${ORIGINAL_CONFIG_SHELL-${CONFIG_SHELL-/bin/sh}} "$0" ${1+"$@"} + else + # Oops. We lost completely, so just stick with echo. + echo=echo + fi + fi + fi + fi +fi +fi + +# Copy echo and quote the copy suitably for passing to libtool from +# the Makefile, instead of quoting the original, which is used later. +ECHO=$echo +if test "X$ECHO" = "X$CONFIG_SHELL $0 --fallback-echo"; then + ECHO="$CONFIG_SHELL \\\$\$0 --fallback-echo" +fi + + + + +tagnames=${tagnames+${tagnames},}CXX + +tagnames=${tagnames+${tagnames},}F77 + +exec 7<&0 &1 + +# Name of the host. +# hostname on some systems (SVR3.2, Linux) returns a bogus exit status, +# so uname gets run too. +ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` + +# +# Initializations. +# +ac_default_prefix=/usr/local +ac_clean_files= +ac_config_libobj_dir=. +LIBOBJS= +cross_compiling=no +subdirs= +MFLAGS= +MAKEFLAGS= +SHELL=${CONFIG_SHELL-/bin/sh} + +# Identity of this package. +PACKAGE_NAME='xf86-video-geode' +PACKAGE_TARNAME='xf86-video-geode' +PACKAGE_VERSION='2.10.0' +PACKAGE_STRING='xf86-video-geode 2.10.0' +PACKAGE_BUGREPORT='https://bugs.freedesktop.org/enter_bug.cgi?product=xorg&component=Driver%2Fgeode' + +ac_unique_file="Makefile.am" +# Factoring default headers for most tests. +ac_includes_default="\ +#include +#ifdef HAVE_SYS_TYPES_H +# include +#endif +#ifdef HAVE_SYS_STAT_H +# include +#endif +#ifdef STDC_HEADERS +# include +# include +#else +# ifdef HAVE_STDLIB_H +# include +# endif +#endif +#ifdef HAVE_STRING_H +# if !defined STDC_HEADERS && defined HAVE_MEMORY_H +# include +# endif +# include +#endif +#ifdef HAVE_STRINGS_H +# include +#endif +#ifdef HAVE_INTTYPES_H +# include +#endif +#ifdef HAVE_STDINT_H +# include +#endif +#ifdef HAVE_UNISTD_H +# include +#endif" + +ac_subst_vars='SHELL +PATH_SEPARATOR +PACKAGE_NAME +PACKAGE_TARNAME +PACKAGE_VERSION +PACKAGE_STRING +PACKAGE_BUGREPORT +exec_prefix +prefix +program_transform_name +bindir +sbindir +libexecdir +datarootdir +datadir +sysconfdir +sharedstatedir +localstatedir +includedir +oldincludedir +docdir +infodir +htmldir +dvidir +pdfdir +psdir +libdir +localedir +mandir +DEFS +ECHO_C +ECHO_N +ECHO_T +LIBS +build_alias +host_alias +target_alias +INSTALL_PROGRAM +INSTALL_SCRIPT +INSTALL_DATA +am__isrc +CYGPATH_W +PACKAGE +VERSION +ACLOCAL +AUTOCONF +AUTOMAKE +AUTOHEADER +MAKEINFO +install_sh +STRIP +INSTALL_STRIP_PROGRAM +mkdir_p +AWK +SET_MAKE +am__leading_dot +AMTAR +am__tar +am__untar +MAINTAINER_MODE_TRUE +MAINTAINER_MODE_FALSE +MAINT +build +build_cpu +build_vendor +build_os +host +host_cpu +host_vendor +host_os +CC +CFLAGS +LDFLAGS +CPPFLAGS +ac_ct_CC +EXEEXT +OBJEXT +DEPDIR +am__include +am__quote +AMDEP_TRUE +AMDEP_FALSE +AMDEPBACKSLASH +CCDEPMODE +am__fastdepCC_TRUE +am__fastdepCC_FALSE +SED +GREP +EGREP +LN_S +ECHO +AR +RANLIB +CPP +CXX +CXXFLAGS +ac_ct_CXX +CXXDEPMODE +am__fastdepCXX_TRUE +am__fastdepCXX_FALSE +CXXCPP +F77 +FFLAGS +ac_ct_F77 +LIBTOOL +CCAS +CCASFLAGS +CCASDEPMODE +am__fastdepCCAS_TRUE +am__fastdepCCAS_FALSE +PKG_CONFIG +XORG_CFLAGS +XORG_LIBS +PCIACCESS_CFLAGS +PCIACCESS_LIBS +moduledir +AMD_CFLAGS +I386ARCH_TRUE +I386ARCH_FALSE +DRIVER_NAME +APP_MAN_SUFFIX +LIB_MAN_SUFFIX +FILE_MAN_SUFFIX +MISC_MAN_SUFFIX +DRIVER_MAN_SUFFIX +ADMIN_MAN_SUFFIX +APP_MAN_DIR +LIB_MAN_DIR +FILE_MAN_DIR +MISC_MAN_DIR +DRIVER_MAN_DIR +ADMIN_MAN_DIR +LIBOBJS +LTLIBOBJS' +ac_subst_files='' + ac_precious_vars='build_alias +host_alias +target_alias +CC +CFLAGS +LDFLAGS +LIBS +CPPFLAGS +CPP +CXX +CXXFLAGS +CCC +CXXCPP +F77 +FFLAGS +CCAS +CCASFLAGS +PKG_CONFIG +XORG_CFLAGS +XORG_LIBS +PCIACCESS_CFLAGS +PCIACCESS_LIBS' + + +# Initialize some variables set by options. +ac_init_help= +ac_init_version=false +# The variables have the same names as the options, with +# dashes changed to underlines. +cache_file=/dev/null +exec_prefix=NONE +no_create= +no_recursion= +prefix=NONE +program_prefix=NONE +program_suffix=NONE +program_transform_name=s,x,x, +silent= +site= +srcdir= +verbose= +x_includes=NONE +x_libraries=NONE + +# Installation directory options. +# These are left unexpanded so users can "make install exec_prefix=/foo" +# and all the variables that are supposed to be based on exec_prefix +# by default will actually change. +# Use braces instead of parens because sh, perl, etc. also accept them. +# (The list follows the same order as the GNU Coding Standards.) +bindir='${exec_prefix}/bin' +sbindir='${exec_prefix}/sbin' +libexecdir='${exec_prefix}/libexec' +datarootdir='${prefix}/share' +datadir='${datarootdir}' +sysconfdir='${prefix}/etc' +sharedstatedir='${prefix}/com' +localstatedir='${prefix}/var' +includedir='${prefix}/include' +oldincludedir='/usr/include' +docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' +infodir='${datarootdir}/info' +htmldir='${docdir}' +dvidir='${docdir}' +pdfdir='${docdir}' +psdir='${docdir}' +libdir='${exec_prefix}/lib' +localedir='${datarootdir}/locale' +mandir='${datarootdir}/man' + +ac_prev= +ac_dashdash= +for ac_option +do + # If the previous option needs an argument, assign it. + if test -n "$ac_prev"; then + eval $ac_prev=\$ac_option + ac_prev= + continue + fi + + case $ac_option in + *=*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; + *) ac_optarg=yes ;; + esac + + # Accept the important Cygnus configure options, so we can diagnose typos. + + case $ac_dashdash$ac_option in + --) + ac_dashdash=yes ;; + + -bindir | --bindir | --bindi | --bind | --bin | --bi) + ac_prev=bindir ;; + -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) + bindir=$ac_optarg ;; + + -build | --build | --buil | --bui | --bu) + ac_prev=build_alias ;; + -build=* | --build=* | --buil=* | --bui=* | --bu=*) + build_alias=$ac_optarg ;; + + -cache-file | --cache-file | --cache-fil | --cache-fi \ + | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) + ac_prev=cache_file ;; + -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ + | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) + cache_file=$ac_optarg ;; + + --config-cache | -C) + cache_file=config.cache ;; + + -datadir | --datadir | --datadi | --datad) + ac_prev=datadir ;; + -datadir=* | --datadir=* | --datadi=* | --datad=*) + datadir=$ac_optarg ;; + + -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ + | --dataroo | --dataro | --datar) + ac_prev=datarootdir ;; + -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ + | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) + datarootdir=$ac_optarg ;; + + -disable-* | --disable-*) + ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_feature" : ".*[^-._$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid feature name: $ac_feature" >&2 + { (exit 1); exit 1; }; } + ac_feature=`echo $ac_feature | sed 's/[-.]/_/g'` + eval enable_$ac_feature=no ;; + + -docdir | --docdir | --docdi | --doc | --do) + ac_prev=docdir ;; + -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*) + docdir=$ac_optarg ;; + + -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv) + ac_prev=dvidir ;; + -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*) + dvidir=$ac_optarg ;; + + -enable-* | --enable-*) + ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_feature" : ".*[^-._$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid feature name: $ac_feature" >&2 + { (exit 1); exit 1; }; } + ac_feature=`echo $ac_feature | sed 's/[-.]/_/g'` + eval enable_$ac_feature=\$ac_optarg ;; + + -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ + | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ + | --exec | --exe | --ex) + ac_prev=exec_prefix ;; + -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ + | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ + | --exec=* | --exe=* | --ex=*) + exec_prefix=$ac_optarg ;; + + -gas | --gas | --ga | --g) + # Obsolete; use --with-gas. + with_gas=yes ;; + + -help | --help | --hel | --he | -h) + ac_init_help=long ;; + -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) + ac_init_help=recursive ;; + -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) + ac_init_help=short ;; + + -host | --host | --hos | --ho) + ac_prev=host_alias ;; + -host=* | --host=* | --hos=* | --ho=*) + host_alias=$ac_optarg ;; + + -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht) + ac_prev=htmldir ;; + -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \ + | --ht=*) + htmldir=$ac_optarg ;; + + -includedir | --includedir | --includedi | --included | --include \ + | --includ | --inclu | --incl | --inc) + ac_prev=includedir ;; + -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ + | --includ=* | --inclu=* | --incl=* | --inc=*) + includedir=$ac_optarg ;; + + -infodir | --infodir | --infodi | --infod | --info | --inf) + ac_prev=infodir ;; + -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) + infodir=$ac_optarg ;; + + -libdir | --libdir | --libdi | --libd) + ac_prev=libdir ;; + -libdir=* | --libdir=* | --libdi=* | --libd=*) + libdir=$ac_optarg ;; + + -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ + | --libexe | --libex | --libe) + ac_prev=libexecdir ;; + -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ + | --libexe=* | --libex=* | --libe=*) + libexecdir=$ac_optarg ;; + + -localedir | --localedir | --localedi | --localed | --locale) + ac_prev=localedir ;; + -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*) + localedir=$ac_optarg ;; + + -localstatedir | --localstatedir | --localstatedi | --localstated \ + | --localstate | --localstat | --localsta | --localst | --locals) + ac_prev=localstatedir ;; + -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ + | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*) + localstatedir=$ac_optarg ;; + + -mandir | --mandir | --mandi | --mand | --man | --ma | --m) + ac_prev=mandir ;; + -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) + mandir=$ac_optarg ;; + + -nfp | --nfp | --nf) + # Obsolete; use --without-fp. + with_fp=no ;; + + -no-create | --no-create | --no-creat | --no-crea | --no-cre \ + | --no-cr | --no-c | -n) + no_create=yes ;; + + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) + no_recursion=yes ;; + + -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ + | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ + | --oldin | --oldi | --old | --ol | --o) + ac_prev=oldincludedir ;; + -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ + | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ + | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) + oldincludedir=$ac_optarg ;; + + -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) + ac_prev=prefix ;; + -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) + prefix=$ac_optarg ;; + + -program-prefix | --program-prefix | --program-prefi | --program-pref \ + | --program-pre | --program-pr | --program-p) + ac_prev=program_prefix ;; + -program-prefix=* | --program-prefix=* | --program-prefi=* \ + | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) + program_prefix=$ac_optarg ;; + + -program-suffix | --program-suffix | --program-suffi | --program-suff \ + | --program-suf | --program-su | --program-s) + ac_prev=program_suffix ;; + -program-suffix=* | --program-suffix=* | --program-suffi=* \ + | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) + program_suffix=$ac_optarg ;; + + -program-transform-name | --program-transform-name \ + | --program-transform-nam | --program-transform-na \ + | --program-transform-n | --program-transform- \ + | --program-transform | --program-transfor \ + | --program-transfo | --program-transf \ + | --program-trans | --program-tran \ + | --progr-tra | --program-tr | --program-t) + ac_prev=program_transform_name ;; + -program-transform-name=* | --program-transform-name=* \ + | --program-transform-nam=* | --program-transform-na=* \ + | --program-transform-n=* | --program-transform-=* \ + | --program-transform=* | --program-transfor=* \ + | --program-transfo=* | --program-transf=* \ + | --program-trans=* | --program-tran=* \ + | --progr-tra=* | --program-tr=* | --program-t=*) + program_transform_name=$ac_optarg ;; + + -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd) + ac_prev=pdfdir ;; + -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*) + pdfdir=$ac_optarg ;; + + -psdir | --psdir | --psdi | --psd | --ps) + ac_prev=psdir ;; + -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*) + psdir=$ac_optarg ;; + + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + silent=yes ;; + + -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) + ac_prev=sbindir ;; + -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ + | --sbi=* | --sb=*) + sbindir=$ac_optarg ;; + + -sharedstatedir | --sharedstatedir | --sharedstatedi \ + | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ + | --sharedst | --shareds | --shared | --share | --shar \ + | --sha | --sh) + ac_prev=sharedstatedir ;; + -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ + | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ + | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ + | --sha=* | --sh=*) + sharedstatedir=$ac_optarg ;; + + -site | --site | --sit) + ac_prev=site ;; + -site=* | --site=* | --sit=*) + site=$ac_optarg ;; + + -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) + ac_prev=srcdir ;; + -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) + srcdir=$ac_optarg ;; + + -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ + | --syscon | --sysco | --sysc | --sys | --sy) + ac_prev=sysconfdir ;; + -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ + | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) + sysconfdir=$ac_optarg ;; + + -target | --target | --targe | --targ | --tar | --ta | --t) + ac_prev=target_alias ;; + -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) + target_alias=$ac_optarg ;; + + -v | -verbose | --verbose | --verbos | --verbo | --verb) + verbose=yes ;; + + -version | --version | --versio | --versi | --vers | -V) + ac_init_version=: ;; + + -with-* | --with-*) + ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_package" : ".*[^-._$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid package name: $ac_package" >&2 + { (exit 1); exit 1; }; } + ac_package=`echo $ac_package | sed 's/[-.]/_/g'` + eval with_$ac_package=\$ac_optarg ;; + + -without-* | --without-*) + ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_package" : ".*[^-._$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid package name: $ac_package" >&2 + { (exit 1); exit 1; }; } + ac_package=`echo $ac_package | sed 's/[-.]/_/g'` + eval with_$ac_package=no ;; + + --x) + # Obsolete; use --with-x. + with_x=yes ;; + + -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ + | --x-incl | --x-inc | --x-in | --x-i) + ac_prev=x_includes ;; + -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ + | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) + x_includes=$ac_optarg ;; + + -x-libraries | --x-libraries | --x-librarie | --x-librari \ + | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) + ac_prev=x_libraries ;; + -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ + | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) + x_libraries=$ac_optarg ;; + + -*) { echo "$as_me: error: unrecognized option: $ac_option +Try \`$0 --help' for more information." >&2 + { (exit 1); exit 1; }; } + ;; + + *=*) + ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` + # Reject names that are not valid shell variable names. + expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid variable name: $ac_envvar" >&2 + { (exit 1); exit 1; }; } + eval $ac_envvar=\$ac_optarg + export $ac_envvar ;; + + *) + # FIXME: should be removed in autoconf 3.0. + echo "$as_me: WARNING: you should use --build, --host, --target" >&2 + expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && + echo "$as_me: WARNING: invalid host type: $ac_option" >&2 + : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option} + ;; + + esac +done + +if test -n "$ac_prev"; then + ac_option=--`echo $ac_prev | sed 's/_/-/g'` + { echo "$as_me: error: missing argument to $ac_option" >&2 + { (exit 1); exit 1; }; } +fi + +# Be sure to have absolute directory names. +for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ + datadir sysconfdir sharedstatedir localstatedir includedir \ + oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ + libdir localedir mandir +do + eval ac_val=\$$ac_var + case $ac_val in + [\\/$]* | ?:[\\/]* ) continue;; + NONE | '' ) case $ac_var in *prefix ) continue;; esac;; + esac + { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 + { (exit 1); exit 1; }; } +done + +# There might be people who depend on the old broken behavior: `$host' +# used to hold the argument of --host etc. +# FIXME: To remove some day. +build=$build_alias +host=$host_alias +target=$target_alias + +# FIXME: To remove some day. +if test "x$host_alias" != x; then + if test "x$build_alias" = x; then + cross_compiling=maybe + echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host. + If a cross compiler is detected then cross compile mode will be used." >&2 + elif test "x$build_alias" != "x$host_alias"; then + cross_compiling=yes + fi +fi + +ac_tool_prefix= +test -n "$host_alias" && ac_tool_prefix=$host_alias- + +test "$silent" = yes && exec 6>/dev/null + + +ac_pwd=`pwd` && test -n "$ac_pwd" && +ac_ls_di=`ls -di .` && +ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || + { echo "$as_me: error: Working directory cannot be determined" >&2 + { (exit 1); exit 1; }; } +test "X$ac_ls_di" = "X$ac_pwd_ls_di" || + { echo "$as_me: error: pwd does not report name of working directory" >&2 + { (exit 1); exit 1; }; } + + +# Find the source files, if location was not specified. +if test -z "$srcdir"; then + ac_srcdir_defaulted=yes + # Try the directory containing this script, then the parent directory. + ac_confdir=`$as_dirname -- "$0" || +$as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$0" : 'X\(//\)[^/]' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)' \| . 2>/dev/null || +echo X"$0" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + srcdir=$ac_confdir + if test ! -r "$srcdir/$ac_unique_file"; then + srcdir=.. + fi +else + ac_srcdir_defaulted=no +fi +if test ! -r "$srcdir/$ac_unique_file"; then + test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." + { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2 + { (exit 1); exit 1; }; } +fi +ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" +ac_abs_confdir=`( + cd "$srcdir" && test -r "./$ac_unique_file" || { echo "$as_me: error: $ac_msg" >&2 + { (exit 1); exit 1; }; } + pwd)` +# When building in place, set srcdir=. +if test "$ac_abs_confdir" = "$ac_pwd"; then + srcdir=. +fi +# Remove unnecessary trailing slashes from srcdir. +# Double slashes in file names in object file debugging info +# mess up M-x gdb in Emacs. +case $srcdir in +*/) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;; +esac +for ac_var in $ac_precious_vars; do + eval ac_env_${ac_var}_set=\${${ac_var}+set} + eval ac_env_${ac_var}_value=\$${ac_var} + eval ac_cv_env_${ac_var}_set=\${${ac_var}+set} + eval ac_cv_env_${ac_var}_value=\$${ac_var} +done + +# +# Report the --help message. +# +if test "$ac_init_help" = "long"; then + # Omit some internal or obsolete options to make the list less imposing. + # This message is too long to be a string in the A/UX 3.1 sh. + cat <<_ACEOF +\`configure' configures xf86-video-geode 2.10.0 to adapt to many kinds of systems. + +Usage: $0 [OPTION]... [VAR=VALUE]... + +To assign environment variables (e.g., CC, CFLAGS...), specify them as +VAR=VALUE. See below for descriptions of some of the useful variables. + +Defaults for the options are specified in brackets. + +Configuration: + -h, --help display this help and exit + --help=short display options specific to this package + --help=recursive display the short help of all the included packages + -V, --version display version information and exit + -q, --quiet, --silent do not print \`checking...' messages + --cache-file=FILE cache test results in FILE [disabled] + -C, --config-cache alias for \`--cache-file=config.cache' + -n, --no-create do not create output files + --srcdir=DIR find the sources in DIR [configure dir or \`..'] + +Installation directories: + --prefix=PREFIX install architecture-independent files in PREFIX + [$ac_default_prefix] + --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX + [PREFIX] + +By default, \`make install' will install all the files in +\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify +an installation prefix other than \`$ac_default_prefix' using \`--prefix', +for instance \`--prefix=\$HOME'. + +For better control, use the options below. + +Fine tuning of the installation directories: + --bindir=DIR user executables [EPREFIX/bin] + --sbindir=DIR system admin executables [EPREFIX/sbin] + --libexecdir=DIR program executables [EPREFIX/libexec] + --sysconfdir=DIR read-only single-machine data [PREFIX/etc] + --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] + --localstatedir=DIR modifiable single-machine data [PREFIX/var] + --libdir=DIR object code libraries [EPREFIX/lib] + --includedir=DIR C header files [PREFIX/include] + --oldincludedir=DIR C header files for non-gcc [/usr/include] + --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] + --datadir=DIR read-only architecture-independent data [DATAROOTDIR] + --infodir=DIR info documentation [DATAROOTDIR/info] + --localedir=DIR locale-dependent data [DATAROOTDIR/locale] + --mandir=DIR man documentation [DATAROOTDIR/man] + --docdir=DIR documentation root [DATAROOTDIR/doc/xf86-video-geode] + --htmldir=DIR html documentation [DOCDIR] + --dvidir=DIR dvi documentation [DOCDIR] + --pdfdir=DIR pdf documentation [DOCDIR] + --psdir=DIR ps documentation [DOCDIR] +_ACEOF + + cat <<\_ACEOF + +Program names: + --program-prefix=PREFIX prepend PREFIX to installed program names + --program-suffix=SUFFIX append SUFFIX to installed program names + --program-transform-name=PROGRAM run sed PROGRAM on installed program names + +System types: + --build=BUILD configure for building on BUILD [guessed] + --host=HOST cross-compile to build programs to run on HOST [BUILD] +_ACEOF +fi + +if test -n "$ac_init_help"; then + case $ac_init_help in + short | recursive ) echo "Configuration of xf86-video-geode 2.10.0:";; + esac + cat <<\_ACEOF + +Optional Features: + --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) + --enable-FEATURE[=ARG] include FEATURE [ARG=yes] + --enable-maintainer-mode enable make rules and dependencies not useful + (and sometimes confusing) to the casual installer + --enable-static[=PKGS] build static libraries [default=no] + --enable-shared[=PKGS] build shared libraries [default=yes] + --enable-fast-install[=PKGS] + optimize for fast installation [default=yes] + --disable-dependency-tracking speeds up one-time build + --enable-dependency-tracking do not reject slow dependency extractors + --disable-libtool-lock avoid locking (might break parallel builds) + --disable-geodegx-panel Disable support for flatpanels with the Geode GX + --enable-werror Treat warnings as errors (default: disabled) + --enable-visibility Enable GCC visibility optimizations + +Optional Packages: + --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] + --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) + --with-gnu-ld assume the C compiler uses GNU ld [default=no] + --with-pic try to use only PIC/non-PIC objects [default=use + both] + --with-tags[=TAGS] include additional configurations [automatic] + --with-xorg-module-dir=DIR + Default xorg module directory + [default=$libdir/xorg/modules] + --with-release-version=STRING + Use release version string in package name + +Some influential environment variables: + CC C compiler command + CFLAGS C compiler flags + LDFLAGS linker flags, e.g. -L if you have libraries in a + nonstandard directory + LIBS libraries to pass to the linker, e.g. -l + CPPFLAGS C/C++/Objective C preprocessor flags, e.g. -I if + you have headers in a nonstandard directory + CPP C preprocessor + CXX C++ compiler command + CXXFLAGS C++ compiler flags + CXXCPP C++ preprocessor + F77 Fortran 77 compiler command + FFLAGS Fortran 77 compiler flags + CCAS assembler compiler command (defaults to CC) + CCASFLAGS assembler compiler flags (defaults to CFLAGS) + PKG_CONFIG path to pkg-config utility + XORG_CFLAGS C compiler flags for XORG, overriding pkg-config + XORG_LIBS linker flags for XORG, overriding pkg-config + PCIACCESS_CFLAGS + C compiler flags for PCIACCESS, overriding pkg-config + PCIACCESS_LIBS + linker flags for PCIACCESS, overriding pkg-config + +Use these variables to override the choices made by `configure' or to help +it to find libraries and programs with nonstandard names/locations. + +Report bugs to . +_ACEOF +ac_status=$? +fi + +if test "$ac_init_help" = "recursive"; then + # If there are subdirs, report their specific --help. + for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue + test -d "$ac_dir" || continue + ac_builddir=. + +case "$ac_dir" in +.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; +*) + ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` + # A ".." for each directory in $ac_dir_suffix. + ac_top_builddir_sub=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,/..,g;s,/,,'` + case $ac_top_builddir_sub in + "") ac_top_builddir_sub=. ac_top_build_prefix= ;; + *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; + esac ;; +esac +ac_abs_top_builddir=$ac_pwd +ac_abs_builddir=$ac_pwd$ac_dir_suffix +# for backward compatibility: +ac_top_builddir=$ac_top_build_prefix + +case $srcdir in + .) # We are building in place. + ac_srcdir=. + ac_top_srcdir=$ac_top_builddir_sub + ac_abs_top_srcdir=$ac_pwd ;; + [\\/]* | ?:[\\/]* ) # Absolute name. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir + ac_abs_top_srcdir=$srcdir ;; + *) # Relative name. + ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_build_prefix$srcdir + ac_abs_top_srcdir=$ac_pwd/$srcdir ;; +esac +ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix + + cd "$ac_dir" || { ac_status=$?; continue; } + # Check for guested configure. + if test -f "$ac_srcdir/configure.gnu"; then + echo && + $SHELL "$ac_srcdir/configure.gnu" --help=recursive + elif test -f "$ac_srcdir/configure"; then + echo && + $SHELL "$ac_srcdir/configure" --help=recursive + else + echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 + fi || ac_status=$? + cd "$ac_pwd" || { ac_status=$?; break; } + done +fi + +test -n "$ac_init_help" && exit $ac_status +if $ac_init_version; then + cat <<\_ACEOF +xf86-video-geode configure 2.10.0 +generated by GNU Autoconf 2.61 + +Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, +2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. +This configure script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it. +_ACEOF + exit +fi +cat >config.log <<_ACEOF +This file contains any messages produced by compilers while +running configure, to aid debugging if configure makes a mistake. + +It was created by xf86-video-geode $as_me 2.10.0, which was +generated by GNU Autoconf 2.61. Invocation command line was + + $ $0 $@ + +_ACEOF +exec 5>>config.log +{ +cat <<_ASUNAME +## --------- ## +## Platform. ## +## --------- ## + +hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` +uname -m = `(uname -m) 2>/dev/null || echo unknown` +uname -r = `(uname -r) 2>/dev/null || echo unknown` +uname -s = `(uname -s) 2>/dev/null || echo unknown` +uname -v = `(uname -v) 2>/dev/null || echo unknown` + +/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` +/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` + +/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` +/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` +/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` +/usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown` +/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` +/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` +/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` + +_ASUNAME + +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + echo "PATH: $as_dir" +done +IFS=$as_save_IFS + +} >&5 + +cat >&5 <<_ACEOF + + +## ----------- ## +## Core tests. ## +## ----------- ## + +_ACEOF + + +# Keep a trace of the command line. +# Strip out --no-create and --no-recursion so they do not pile up. +# Strip out --silent because we don't want to record it for future runs. +# Also quote any args containing shell meta-characters. +# Make two passes to allow for proper duplicate-argument suppression. +ac_configure_args= +ac_configure_args0= +ac_configure_args1= +ac_must_keep_next=false +for ac_pass in 1 2 +do + for ac_arg + do + case $ac_arg in + -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + continue ;; + *\'*) + ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; + esac + case $ac_pass in + 1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;; + 2) + ac_configure_args1="$ac_configure_args1 '$ac_arg'" + if test $ac_must_keep_next = true; then + ac_must_keep_next=false # Got value, back to normal. + else + case $ac_arg in + *=* | --config-cache | -C | -disable-* | --disable-* \ + | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ + | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ + | -with-* | --with-* | -without-* | --without-* | --x) + case "$ac_configure_args0 " in + "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; + esac + ;; + -* ) ac_must_keep_next=true ;; + esac + fi + ac_configure_args="$ac_configure_args '$ac_arg'" + ;; + esac + done +done +$as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; } +$as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export ac_configure_args1; } + +# When interrupted or exit'd, cleanup temporary files, and complete +# config.log. We remove comments because anyway the quotes in there +# would cause problems or look ugly. +# WARNING: Use '\'' to represent an apostrophe within the trap. +# WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. +trap 'exit_status=$? + # Save into config.log some information that might help in debugging. + { + echo + + cat <<\_ASBOX +## ---------------- ## +## Cache variables. ## +## ---------------- ## +_ASBOX + echo + # The following way of writing the cache mishandles newlines in values, +( + for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do + eval ac_val=\$$ac_var + case $ac_val in #( + *${as_nl}*) + case $ac_var in #( + *_cv_*) { echo "$as_me:$LINENO: WARNING: Cache variable $ac_var contains a newline." >&5 +echo "$as_me: WARNING: Cache variable $ac_var contains a newline." >&2;} ;; + esac + case $ac_var in #( + _ | IFS | as_nl) ;; #( + *) $as_unset $ac_var ;; + esac ;; + esac + done + (set) 2>&1 | + case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #( + *${as_nl}ac_space=\ *) + sed -n \ + "s/'\''/'\''\\\\'\'''\''/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p" + ;; #( + *) + sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" + ;; + esac | + sort +) + echo + + cat <<\_ASBOX +## ----------------- ## +## Output variables. ## +## ----------------- ## +_ASBOX + echo + for ac_var in $ac_subst_vars + do + eval ac_val=\$$ac_var + case $ac_val in + *\'\''*) ac_val=`echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; + esac + echo "$ac_var='\''$ac_val'\''" + done | sort + echo + + if test -n "$ac_subst_files"; then + cat <<\_ASBOX +## ------------------- ## +## File substitutions. ## +## ------------------- ## +_ASBOX + echo + for ac_var in $ac_subst_files + do + eval ac_val=\$$ac_var + case $ac_val in + *\'\''*) ac_val=`echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; + esac + echo "$ac_var='\''$ac_val'\''" + done | sort + echo + fi + + if test -s confdefs.h; then + cat <<\_ASBOX +## ----------- ## +## confdefs.h. ## +## ----------- ## +_ASBOX + echo + cat confdefs.h + echo + fi + test "$ac_signal" != 0 && + echo "$as_me: caught signal $ac_signal" + echo "$as_me: exit $exit_status" + } >&5 + rm -f core *.core core.conftest.* && + rm -f -r conftest* confdefs* conf$$* $ac_clean_files && + exit $exit_status +' 0 +for ac_signal in 1 2 13 15; do + trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal +done +ac_signal=0 + +# confdefs.h avoids OS command line length limits that DEFS can exceed. +rm -f -r conftest* confdefs.h + +# Predefined preprocessor variables. + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_NAME "$PACKAGE_NAME" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_TARNAME "$PACKAGE_TARNAME" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_VERSION "$PACKAGE_VERSION" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_STRING "$PACKAGE_STRING" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" +_ACEOF + + +# Let the site file select an alternate cache file if it wants to. +# Prefer explicitly selected file to automatically selected ones. +if test -n "$CONFIG_SITE"; then + set x "$CONFIG_SITE" +elif test "x$prefix" != xNONE; then + set x "$prefix/share/config.site" "$prefix/etc/config.site" +else + set x "$ac_default_prefix/share/config.site" \ + "$ac_default_prefix/etc/config.site" +fi +shift +for ac_site_file +do + if test -r "$ac_site_file"; then + { echo "$as_me:$LINENO: loading site script $ac_site_file" >&5 +echo "$as_me: loading site script $ac_site_file" >&6;} + sed 's/^/| /' "$ac_site_file" >&5 + . "$ac_site_file" + fi +done + +if test -r "$cache_file"; then + # Some versions of bash will fail to source /dev/null (special + # files actually), so we avoid doing that. + if test -f "$cache_file"; then + { echo "$as_me:$LINENO: loading cache $cache_file" >&5 +echo "$as_me: loading cache $cache_file" >&6;} + case $cache_file in + [\\/]* | ?:[\\/]* ) . "$cache_file";; + *) . "./$cache_file";; + esac + fi +else + { echo "$as_me:$LINENO: creating cache $cache_file" >&5 +echo "$as_me: creating cache $cache_file" >&6;} + >$cache_file +fi + +# Check that the precious variables saved in the cache have kept the same +# value. +ac_cache_corrupted=false +for ac_var in $ac_precious_vars; do + eval ac_old_set=\$ac_cv_env_${ac_var}_set + eval ac_new_set=\$ac_env_${ac_var}_set + eval ac_old_val=\$ac_cv_env_${ac_var}_value + eval ac_new_val=\$ac_env_${ac_var}_value + case $ac_old_set,$ac_new_set in + set,) + { echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 +echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} + ac_cache_corrupted=: ;; + ,set) + { echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5 +echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} + ac_cache_corrupted=: ;; + ,);; + *) + if test "x$ac_old_val" != "x$ac_new_val"; then + { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5 +echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} + { echo "$as_me:$LINENO: former value: $ac_old_val" >&5 +echo "$as_me: former value: $ac_old_val" >&2;} + { echo "$as_me:$LINENO: current value: $ac_new_val" >&5 +echo "$as_me: current value: $ac_new_val" >&2;} + ac_cache_corrupted=: + fi;; + esac + # Pass precious variables to config.status. + if test "$ac_new_set" = set; then + case $ac_new_val in + *\'*) ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; + *) ac_arg=$ac_var=$ac_new_val ;; + esac + case " $ac_configure_args " in + *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. + *) ac_configure_args="$ac_configure_args '$ac_arg'" ;; + esac + fi +done +if $ac_cache_corrupted; then + { echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5 +echo "$as_me: error: changes in the environment can compromise the build" >&2;} + { { echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5 +echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;} + { (exit 1); exit 1; }; } +fi + + + + + + + + + + + + + + + + + + + + + + + + + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + + + +ac_config_headers="$ac_config_headers config.h" + +ac_aux_dir= +for ac_dir in . "$srcdir"/.; do + if test -f "$ac_dir/install-sh"; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install-sh -c" + break + elif test -f "$ac_dir/install.sh"; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install.sh -c" + break + elif test -f "$ac_dir/shtool"; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/shtool install -c" + break + fi +done +if test -z "$ac_aux_dir"; then + { { echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in . \"$srcdir\"/." >&5 +echo "$as_me: error: cannot find install-sh or install.sh in . \"$srcdir\"/." >&2;} + { (exit 1); exit 1; }; } +fi + +# These three variables are undocumented and unsupported, +# and are intended to be withdrawn in a future Autoconf release. +# They can cause serious problems if a builder's source tree is in a directory +# whose full name contains unusual characters. +ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var. +ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var. +ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. + + + +am__api_version='1.10' + +# Find a good install program. We prefer a C program (faster), +# so one script is as good as another. But avoid the broken or +# incompatible versions: +# SysV /etc/install, /usr/sbin/install +# SunOS /usr/etc/install +# IRIX /sbin/install +# AIX /bin/install +# AmigaOS /C/install, which installs bootblocks on floppy discs +# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag +# AFS /usr/afsws/bin/install, which mishandles nonexistent args +# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" +# OS/2's system install, which has a completely different semantic +# ./install, which can be erroneously created by make from ./install.sh. +{ echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5 +echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6; } +if test -z "$INSTALL"; then +if test "${ac_cv_path_install+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + # Account for people who put trailing slashes in PATH elements. +case $as_dir/ in + ./ | .// | /cC/* | \ + /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ + ?:\\/os2\\/install\\/* | ?:\\/OS2\\/INSTALL\\/* | \ + /usr/ucb/* ) ;; + *) + # OSF1 and SCO ODT 3.0 have their own names for install. + # Don't use installbsd from OSF since it installs stuff as root + # by default. + for ac_prog in ginstall scoinst install; do + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; }; then + if test $ac_prog = install && + grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then + # AIX install. It has an incompatible calling convention. + : + elif test $ac_prog = install && + grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then + # program-specific install script used by HP pwplus--don't use. + : + else + ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" + break 3 + fi + fi + done + done + ;; +esac +done +IFS=$as_save_IFS + + +fi + if test "${ac_cv_path_install+set}" = set; then + INSTALL=$ac_cv_path_install + else + # As a last resort, use the slow shell script. Don't cache a + # value for INSTALL within a source directory, because that will + # break other packages using the cache if that directory is + # removed, or if the value is a relative name. + INSTALL=$ac_install_sh + fi +fi +{ echo "$as_me:$LINENO: result: $INSTALL" >&5 +echo "${ECHO_T}$INSTALL" >&6; } + +# Use test -z because SunOS4 sh mishandles braces in ${var-val}. +# It thinks the first close brace ends the variable substitution. +test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' + +test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' + +test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' + +{ echo "$as_me:$LINENO: checking whether build environment is sane" >&5 +echo $ECHO_N "checking whether build environment is sane... $ECHO_C" >&6; } +# Just in case +sleep 1 +echo timestamp > conftest.file +# Do `set' in a subshell so we don't clobber the current shell's +# arguments. Must try -L first in case configure is actually a +# symlink; some systems play weird games with the mod time of symlinks +# (eg FreeBSD returns the mod time of the symlink's containing +# directory). +if ( + set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null` + if test "$*" = "X"; then + # -L didn't work. + set X `ls -t $srcdir/configure conftest.file` + fi + rm -f conftest.file + if test "$*" != "X $srcdir/configure conftest.file" \ + && test "$*" != "X conftest.file $srcdir/configure"; then + + # If neither matched, then we have a broken ls. This can happen + # if, for instance, CONFIG_SHELL is bash and it inherits a + # broken ls alias from the environment. This has actually + # happened. Such a system could not be considered "sane". + { { echo "$as_me:$LINENO: error: ls -t appears to fail. Make sure there is not a broken +alias in your environment" >&5 +echo "$as_me: error: ls -t appears to fail. Make sure there is not a broken +alias in your environment" >&2;} + { (exit 1); exit 1; }; } + fi + + test "$2" = conftest.file + ) +then + # Ok. + : +else + { { echo "$as_me:$LINENO: error: newly created file is older than distributed files! +Check your system clock" >&5 +echo "$as_me: error: newly created file is older than distributed files! +Check your system clock" >&2;} + { (exit 1); exit 1; }; } +fi +{ echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } +test "$program_prefix" != NONE && + program_transform_name="s&^&$program_prefix&;$program_transform_name" +# Use a double $ so make ignores it. +test "$program_suffix" != NONE && + program_transform_name="s&\$&$program_suffix&;$program_transform_name" +# Double any \ or $. echo might interpret backslashes. +# By default was `s,x,x', remove it if useless. +cat <<\_ACEOF >conftest.sed +s/[\\$]/&&/g;s/;s,x,x,$// +_ACEOF +program_transform_name=`echo $program_transform_name | sed -f conftest.sed` +rm -f conftest.sed + +# expand $ac_aux_dir to an absolute path +am_aux_dir=`cd $ac_aux_dir && pwd` + +test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing" +# Use eval to expand $SHELL +if eval "$MISSING --run true"; then + am_missing_run="$MISSING --run " +else + am_missing_run= + { echo "$as_me:$LINENO: WARNING: \`missing' script is too old or missing" >&5 +echo "$as_me: WARNING: \`missing' script is too old or missing" >&2;} +fi + +{ echo "$as_me:$LINENO: checking for a thread-safe mkdir -p" >&5 +echo $ECHO_N "checking for a thread-safe mkdir -p... $ECHO_C" >&6; } +if test -z "$MKDIR_P"; then + if test "${ac_cv_path_mkdir+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH$PATH_SEPARATOR/opt/sfw/bin +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_prog in mkdir gmkdir; do + for ac_exec_ext in '' $ac_executable_extensions; do + { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; } || continue + case `"$as_dir/$ac_prog$ac_exec_ext" --version 2>&1` in #( + 'mkdir (GNU coreutils) '* | \ + 'mkdir (coreutils) '* | \ + 'mkdir (fileutils) '4.1*) + ac_cv_path_mkdir=$as_dir/$ac_prog$ac_exec_ext + break 3;; + esac + done + done +done +IFS=$as_save_IFS + +fi + + if test "${ac_cv_path_mkdir+set}" = set; then + MKDIR_P="$ac_cv_path_mkdir -p" + else + # As a last resort, use the slow shell script. Don't cache a + # value for MKDIR_P within a source directory, because that will + # break other packages using the cache if that directory is + # removed, or if the value is a relative name. + test -d ./--version && rmdir ./--version + MKDIR_P="$ac_install_sh -d" + fi +fi +{ echo "$as_me:$LINENO: result: $MKDIR_P" >&5 +echo "${ECHO_T}$MKDIR_P" >&6; } + +mkdir_p="$MKDIR_P" +case $mkdir_p in + [\\/$]* | ?:[\\/]*) ;; + */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;; +esac + +for ac_prog in gawk mawk nawk awk +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_prog_AWK+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$AWK"; then + ac_cv_prog_AWK="$AWK" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_AWK="$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +fi +fi +AWK=$ac_cv_prog_AWK +if test -n "$AWK"; then + { echo "$as_me:$LINENO: result: $AWK" >&5 +echo "${ECHO_T}$AWK" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + + test -n "$AWK" && break +done + +{ echo "$as_me:$LINENO: checking whether ${MAKE-make} sets \$(MAKE)" >&5 +echo $ECHO_N "checking whether ${MAKE-make} sets \$(MAKE)... $ECHO_C" >&6; } +set x ${MAKE-make}; ac_make=`echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` +if { as_var=ac_cv_prog_make_${ac_make}_set; eval "test \"\${$as_var+set}\" = set"; }; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.make <<\_ACEOF +SHELL = /bin/sh +all: + @echo '@@@%%%=$(MAKE)=@@@%%%' +_ACEOF +# GNU make sometimes prints "make[1]: Entering...", which would confuse us. +case `${MAKE-make} -f conftest.make 2>/dev/null` in + *@@@%%%=?*=@@@%%%*) + eval ac_cv_prog_make_${ac_make}_set=yes;; + *) + eval ac_cv_prog_make_${ac_make}_set=no;; +esac +rm -f conftest.make +fi +if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } + SET_MAKE= +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } + SET_MAKE="MAKE=${MAKE-make}" +fi + +rm -rf .tst 2>/dev/null +mkdir .tst 2>/dev/null +if test -d .tst; then + am__leading_dot=. +else + am__leading_dot=_ +fi +rmdir .tst 2>/dev/null + +if test "`cd $srcdir && pwd`" != "`pwd`"; then + # Use -I$(srcdir) only when $(srcdir) != ., so that make's output + # is not polluted with repeated "-I." + am__isrc=' -I$(srcdir)' + # test to see if srcdir already configured + if test -f $srcdir/config.status; then + { { echo "$as_me:$LINENO: error: source directory already configured; run \"make distclean\" there first" >&5 +echo "$as_me: error: source directory already configured; run \"make distclean\" there first" >&2;} + { (exit 1); exit 1; }; } + fi +fi + +# test whether we have cygpath +if test -z "$CYGPATH_W"; then + if (cygpath --version) >/dev/null 2>/dev/null; then + CYGPATH_W='cygpath -w' + else + CYGPATH_W=echo + fi +fi + + +# Define the identity of the package. + PACKAGE='xf86-video-geode' + VERSION='2.10.0' + + +cat >>confdefs.h <<_ACEOF +#define PACKAGE "$PACKAGE" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define VERSION "$VERSION" +_ACEOF + +# Some tools Automake needs. + +ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal-${am__api_version}"} + + +AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"} + + +AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake-${am__api_version}"} + + +AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"} + + +MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"} + +install_sh=${install_sh-"\$(SHELL) $am_aux_dir/install-sh"} + +# Installed binaries are usually stripped using `strip' when the user +# run `make install-strip'. However `strip' might not be the right +# tool to use in cross-compilation environments, therefore Automake +# will honor the `STRIP' environment variable to overrule this program. +if test "$cross_compiling" != no; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. +set dummy ${ac_tool_prefix}strip; ac_word=$2 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_prog_STRIP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$STRIP"; then + ac_cv_prog_STRIP="$STRIP" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_STRIP="${ac_tool_prefix}strip" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +fi +fi +STRIP=$ac_cv_prog_STRIP +if test -n "$STRIP"; then + { echo "$as_me:$LINENO: result: $STRIP" >&5 +echo "${ECHO_T}$STRIP" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_STRIP"; then + ac_ct_STRIP=$STRIP + # Extract the first word of "strip", so it can be a program name with args. +set dummy strip; ac_word=$2 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_STRIP"; then + ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_STRIP="strip" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +fi +fi +ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP +if test -n "$ac_ct_STRIP"; then + { echo "$as_me:$LINENO: result: $ac_ct_STRIP" >&5 +echo "${ECHO_T}$ac_ct_STRIP" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + if test "x$ac_ct_STRIP" = x; then + STRIP=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools +whose name does not start with the host triplet. If you think this +configuration is useful to you, please write to autoconf@gnu.org." >&5 +echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools +whose name does not start with the host triplet. If you think this +configuration is useful to you, please write to autoconf@gnu.org." >&2;} +ac_tool_warned=yes ;; +esac + STRIP=$ac_ct_STRIP + fi +else + STRIP="$ac_cv_prog_STRIP" +fi + +fi +INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" + +# We need awk for the "check" target. The system "awk" is bad on +# some platforms. +# Always define AMTAR for backward compatibility. + +AMTAR=${AMTAR-"${am_missing_run}tar"} + +am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -' + + + + + + +{ echo "$as_me:$LINENO: checking whether to enable maintainer-specific portions of Makefiles" >&5 +echo $ECHO_N "checking whether to enable maintainer-specific portions of Makefiles... $ECHO_C" >&6; } + # Check whether --enable-maintainer-mode was given. +if test "${enable_maintainer_mode+set}" = set; then + enableval=$enable_maintainer_mode; USE_MAINTAINER_MODE=$enableval +else + USE_MAINTAINER_MODE=no +fi + + { echo "$as_me:$LINENO: result: $USE_MAINTAINER_MODE" >&5 +echo "${ECHO_T}$USE_MAINTAINER_MODE" >&6; } + if test $USE_MAINTAINER_MODE = yes; then + MAINTAINER_MODE_TRUE= + MAINTAINER_MODE_FALSE='#' +else + MAINTAINER_MODE_TRUE='#' + MAINTAINER_MODE_FALSE= +fi + + MAINT=$MAINTAINER_MODE_TRUE + + + +# Checks for programs. +# Check whether --enable-static was given. +if test "${enable_static+set}" = set; then + enableval=$enable_static; p=${PACKAGE-default} + case $enableval in + yes) enable_static=yes ;; + no) enable_static=no ;; + *) + enable_static=no + # Look at the argument we got. We use all the common list separators. + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for pkg in $enableval; do + IFS="$lt_save_ifs" + if test "X$pkg" = "X$p"; then + enable_static=yes + fi + done + IFS="$lt_save_ifs" + ;; + esac +else + enable_static=no +fi + + + +# Check whether --enable-shared was given. +if test "${enable_shared+set}" = set; then + enableval=$enable_shared; p=${PACKAGE-default} + case $enableval in + yes) enable_shared=yes ;; + no) enable_shared=no ;; + *) + enable_shared=no + # Look at the argument we got. We use all the common list separators. + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for pkg in $enableval; do + IFS="$lt_save_ifs" + if test "X$pkg" = "X$p"; then + enable_shared=yes + fi + done + IFS="$lt_save_ifs" + ;; + esac +else + enable_shared=yes +fi + + +# Check whether --enable-fast-install was given. +if test "${enable_fast_install+set}" = set; then + enableval=$enable_fast_install; p=${PACKAGE-default} + case $enableval in + yes) enable_fast_install=yes ;; + no) enable_fast_install=no ;; + *) + enable_fast_install=no + # Look at the argument we got. We use all the common list separators. + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for pkg in $enableval; do + IFS="$lt_save_ifs" + if test "X$pkg" = "X$p"; then + enable_fast_install=yes + fi + done + IFS="$lt_save_ifs" + ;; + esac +else + enable_fast_install=yes +fi + + +# Make sure we can run config.sub. +$SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 || + { { echo "$as_me:$LINENO: error: cannot run $SHELL $ac_aux_dir/config.sub" >&5 +echo "$as_me: error: cannot run $SHELL $ac_aux_dir/config.sub" >&2;} + { (exit 1); exit 1; }; } + +{ echo "$as_me:$LINENO: checking build system type" >&5 +echo $ECHO_N "checking build system type... $ECHO_C" >&6; } +if test "${ac_cv_build+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_build_alias=$build_alias +test "x$ac_build_alias" = x && + ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"` +test "x$ac_build_alias" = x && + { { echo "$as_me:$LINENO: error: cannot guess build type; you must specify one" >&5 +echo "$as_me: error: cannot guess build type; you must specify one" >&2;} + { (exit 1); exit 1; }; } +ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` || + { { echo "$as_me:$LINENO: error: $SHELL $ac_aux_dir/config.sub $ac_build_alias failed" >&5 +echo "$as_me: error: $SHELL $ac_aux_dir/config.sub $ac_build_alias failed" >&2;} + { (exit 1); exit 1; }; } + +fi +{ echo "$as_me:$LINENO: result: $ac_cv_build" >&5 +echo "${ECHO_T}$ac_cv_build" >&6; } +case $ac_cv_build in +*-*-*) ;; +*) { { echo "$as_me:$LINENO: error: invalid value of canonical build" >&5 +echo "$as_me: error: invalid value of canonical build" >&2;} + { (exit 1); exit 1; }; };; +esac +build=$ac_cv_build +ac_save_IFS=$IFS; IFS='-' +set x $ac_cv_build +shift +build_cpu=$1 +build_vendor=$2 +shift; shift +# Remember, the first character of IFS is used to create $*, +# except with old shells: +build_os=$* +IFS=$ac_save_IFS +case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac + + +{ echo "$as_me:$LINENO: checking host system type" >&5 +echo $ECHO_N "checking host system type... $ECHO_C" >&6; } +if test "${ac_cv_host+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test "x$host_alias" = x; then + ac_cv_host=$ac_cv_build +else + ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` || + { { echo "$as_me:$LINENO: error: $SHELL $ac_aux_dir/config.sub $host_alias failed" >&5 +echo "$as_me: error: $SHELL $ac_aux_dir/config.sub $host_alias failed" >&2;} + { (exit 1); exit 1; }; } +fi + +fi +{ echo "$as_me:$LINENO: result: $ac_cv_host" >&5 +echo "${ECHO_T}$ac_cv_host" >&6; } +case $ac_cv_host in +*-*-*) ;; +*) { { echo "$as_me:$LINENO: error: invalid value of canonical host" >&5 +echo "$as_me: error: invalid value of canonical host" >&2;} + { (exit 1); exit 1; }; };; +esac +host=$ac_cv_host +ac_save_IFS=$IFS; IFS='-' +set x $ac_cv_host +shift +host_cpu=$1 +host_vendor=$2 +shift; shift +# Remember, the first character of IFS is used to create $*, +# except with old shells: +host_os=$* +IFS=$ac_save_IFS +case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac + + +DEPDIR="${am__leading_dot}deps" + +ac_config_commands="$ac_config_commands depfiles" + + +am_make=${MAKE-make} +cat > confinc << 'END' +am__doit: + @echo done +.PHONY: am__doit +END +# If we don't find an include directive, just comment out the code. +{ echo "$as_me:$LINENO: checking for style of include used by $am_make" >&5 +echo $ECHO_N "checking for style of include used by $am_make... $ECHO_C" >&6; } +am__include="#" +am__quote= +_am_result=none +# First try GNU make style include. +echo "include confinc" > confmf +# We grep out `Entering directory' and `Leaving directory' +# messages which can occur if `w' ends up in MAKEFLAGS. +# In particular we don't look at `^make:' because GNU make might +# be invoked under some other name (usually "gmake"), in which +# case it prints its new name instead of `make'. +if test "`$am_make -s -f confmf 2> /dev/null | grep -v 'ing directory'`" = "done"; then + am__include=include + am__quote= + _am_result=GNU +fi +# Now try BSD make style include. +if test "$am__include" = "#"; then + echo '.include "confinc"' > confmf + if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then + am__include=.include + am__quote="\"" + _am_result=BSD + fi +fi + + +{ echo "$as_me:$LINENO: result: $_am_result" >&5 +echo "${ECHO_T}$_am_result" >&6; } +rm -f confinc confmf + +# Check whether --enable-dependency-tracking was given. +if test "${enable_dependency_tracking+set}" = set; then + enableval=$enable_dependency_tracking; +fi + +if test "x$enable_dependency_tracking" != xno; then + am_depcomp="$ac_aux_dir/depcomp" + AMDEPBACKSLASH='\' +fi + if test "x$enable_dependency_tracking" != xno; then + AMDEP_TRUE= + AMDEP_FALSE='#' +else + AMDEP_TRUE='#' + AMDEP_FALSE= +fi + + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. +set dummy ${ac_tool_prefix}gcc; ac_word=$2 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_CC="${ac_tool_prefix}gcc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_CC"; then + ac_ct_CC=$CC + # Extract the first word of "gcc", so it can be a program name with args. +set dummy gcc; ac_word=$2 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_CC="gcc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + { echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 +echo "${ECHO_T}$ac_ct_CC" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + if test "x$ac_ct_CC" = x; then + CC="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools +whose name does not start with the host triplet. If you think this +configuration is useful to you, please write to autoconf@gnu.org." >&5 +echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools +whose name does not start with the host triplet. If you think this +configuration is useful to you, please write to autoconf@gnu.org." >&2;} +ac_tool_warned=yes ;; +esac + CC=$ac_ct_CC + fi +else + CC="$ac_cv_prog_CC" +fi + +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. +set dummy ${ac_tool_prefix}cc; ac_word=$2 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_CC="${ac_tool_prefix}cc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + + fi +fi +if test -z "$CC"; then + # Extract the first word of "cc", so it can be a program name with args. +set dummy cc; ac_word=$2 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + ac_prog_rejected=no +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then + ac_prog_rejected=yes + continue + fi + ac_cv_prog_CC="cc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +if test $ac_prog_rejected = yes; then + # We found a bogon in the path, so make sure we never use it. + set dummy $ac_cv_prog_CC + shift + if test $# != 0; then + # We chose a different compiler from the bogus one. + # However, it has the same basename, so the bogon will be chosen + # first if we set CC to just the basename; use the full file name. + shift + ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" + fi +fi +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + +fi +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + for ac_prog in cl.exe + do + # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. +set dummy $ac_tool_prefix$ac_prog; ac_word=$2 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_CC="$ac_tool_prefix$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + + test -n "$CC" && break + done +fi +if test -z "$CC"; then + ac_ct_CC=$CC + for ac_prog in cl.exe +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_CC="$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + { echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 +echo "${ECHO_T}$ac_ct_CC" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + + test -n "$ac_ct_CC" && break +done + + if test "x$ac_ct_CC" = x; then + CC="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools +whose name does not start with the host triplet. If you think this +configuration is useful to you, please write to autoconf@gnu.org." >&5 +echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools +whose name does not start with the host triplet. If you think this +configuration is useful to you, please write to autoconf@gnu.org." >&2;} +ac_tool_warned=yes ;; +esac + CC=$ac_ct_CC + fi +fi + +fi + + +test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH +See \`config.log' for more details." >&5 +echo "$as_me: error: no acceptable C compiler found in \$PATH +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } + +# Provide some information about the compiler. +echo "$as_me:$LINENO: checking for C compiler version" >&5 +ac_compiler=`set X $ac_compile; echo $2` +{ (ac_try="$ac_compiler --version >&5" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compiler --version >&5") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (ac_try="$ac_compiler -v >&5" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compiler -v >&5") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (ac_try="$ac_compiler -V >&5" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compiler -V >&5") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } + +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files a.out a.exe b.out" +# Try to create an executable without -o first, disregard a.out. +# It will help us diagnose broken compilers, and finding out an intuition +# of exeext. +{ echo "$as_me:$LINENO: checking for C compiler default output file name" >&5 +echo $ECHO_N "checking for C compiler default output file name... $ECHO_C" >&6; } +ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` +# +# List of possible output files, starting from the most likely. +# The algorithm is not robust to junk in `.', hence go to wildcards (a.*) +# only as a last resort. b.out is created by i960 compilers. +ac_files='a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out' +# +# The IRIX 6 linker writes into existing files which may not be +# executable, retaining their permissions. Remove them first so a +# subsequent execution test works. +ac_rmfiles= +for ac_file in $ac_files +do + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj ) ;; + * ) ac_rmfiles="$ac_rmfiles $ac_file";; + esac +done +rm -f $ac_rmfiles + +if { (ac_try="$ac_link_default" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link_default") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. +# So ignore a value of `no', otherwise this would lead to `EXEEXT = no' +# in a Makefile. We should not override ac_cv_exeext if it was cached, +# so that the user can short-circuit this test for compilers unknown to +# Autoconf. +for ac_file in $ac_files '' +do + test -f "$ac_file" || continue + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj ) + ;; + [ab].out ) + # We found the default executable, but exeext='' is most + # certainly right. + break;; + *.* ) + if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; + then :; else + ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + fi + # We set ac_cv_exeext here because the later test for it is not + # safe: cross compilers may not add the suffix if given an `-o' + # argument, so we may need to know it at that point already. + # Even if this section looks crufty: it has the advantage of + # actually working. + break;; + * ) + break;; + esac +done +test "$ac_cv_exeext" = no && ac_cv_exeext= + +else + ac_file='' +fi + +{ echo "$as_me:$LINENO: result: $ac_file" >&5 +echo "${ECHO_T}$ac_file" >&6; } +if test -z "$ac_file"; then + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +{ { echo "$as_me:$LINENO: error: C compiler cannot create executables +See \`config.log' for more details." >&5 +echo "$as_me: error: C compiler cannot create executables +See \`config.log' for more details." >&2;} + { (exit 77); exit 77; }; } +fi + +ac_exeext=$ac_cv_exeext + +# Check that the compiler produces executables we can run. If not, either +# the compiler is broken, or we cross compile. +{ echo "$as_me:$LINENO: checking whether the C compiler works" >&5 +echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6; } +# FIXME: These cross compiler hacks should be removed for Autoconf 3.0 +# If not cross compiling, check that we can run a simple program. +if test "$cross_compiling" != yes; then + if { ac_try='./$ac_file' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cross_compiling=no + else + if test "$cross_compiling" = maybe; then + cross_compiling=yes + else + { { echo "$as_me:$LINENO: error: cannot run C compiled programs. +If you meant to cross compile, use \`--host'. +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot run C compiled programs. +If you meant to cross compile, use \`--host'. +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } + fi + fi +fi +{ echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } + +rm -f a.out a.exe conftest$ac_cv_exeext b.out +ac_clean_files=$ac_clean_files_save +# Check that the compiler produces executables we can run. If not, either +# the compiler is broken, or we cross compile. +{ echo "$as_me:$LINENO: checking whether we are cross compiling" >&5 +echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6; } +{ echo "$as_me:$LINENO: result: $cross_compiling" >&5 +echo "${ECHO_T}$cross_compiling" >&6; } + +{ echo "$as_me:$LINENO: checking for suffix of executables" >&5 +echo $ECHO_N "checking for suffix of executables... $ECHO_C" >&6; } +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + # If both `conftest.exe' and `conftest' are `present' (well, observable) +# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will +# work properly (i.e., refer to `conftest.exe'), while it won't with +# `rm'. +for ac_file in conftest.exe conftest conftest.*; do + test -f "$ac_file" || continue + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj ) ;; + *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + break;; + * ) break;; + esac +done +else + { { echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot compute suffix of executables: cannot compile and link +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } +fi + +rm -f conftest$ac_cv_exeext +{ echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5 +echo "${ECHO_T}$ac_cv_exeext" >&6; } + +rm -f conftest.$ac_ext +EXEEXT=$ac_cv_exeext +ac_exeext=$EXEEXT +{ echo "$as_me:$LINENO: checking for suffix of object files" >&5 +echo $ECHO_N "checking for suffix of object files... $ECHO_C" >&6; } +if test "${ac_cv_objext+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.o conftest.obj +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + for ac_file in conftest.o conftest.obj conftest.*; do + test -f "$ac_file" || continue; + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf ) ;; + *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` + break;; + esac +done +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +{ { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot compute suffix of object files: cannot compile +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } +fi + +rm -f conftest.$ac_cv_objext conftest.$ac_ext +fi +{ echo "$as_me:$LINENO: result: $ac_cv_objext" >&5 +echo "${ECHO_T}$ac_cv_objext" >&6; } +OBJEXT=$ac_cv_objext +ac_objext=$OBJEXT +{ echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5 +echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6; } +if test "${ac_cv_c_compiler_gnu+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ +#ifndef __GNUC__ + choke me +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_compiler_gnu=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_compiler_gnu=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +ac_cv_c_compiler_gnu=$ac_compiler_gnu + +fi +{ echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5 +echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6; } +GCC=`test $ac_compiler_gnu = yes && echo yes` +ac_test_CFLAGS=${CFLAGS+set} +ac_save_CFLAGS=$CFLAGS +{ echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5 +echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6; } +if test "${ac_cv_prog_cc_g+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_save_c_werror_flag=$ac_c_werror_flag + ac_c_werror_flag=yes + ac_cv_prog_cc_g=no + CFLAGS="-g" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_prog_cc_g=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + CFLAGS="" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + : +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_c_werror_flag=$ac_save_c_werror_flag + CFLAGS="-g" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_prog_cc_g=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + ac_c_werror_flag=$ac_save_c_werror_flag +fi +{ echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5 +echo "${ECHO_T}$ac_cv_prog_cc_g" >&6; } +if test "$ac_test_CFLAGS" = set; then + CFLAGS=$ac_save_CFLAGS +elif test $ac_cv_prog_cc_g = yes; then + if test "$GCC" = yes; then + CFLAGS="-g -O2" + else + CFLAGS="-g" + fi +else + if test "$GCC" = yes; then + CFLAGS="-O2" + else + CFLAGS= + fi +fi +{ echo "$as_me:$LINENO: checking for $CC option to accept ISO C89" >&5 +echo $ECHO_N "checking for $CC option to accept ISO C89... $ECHO_C" >&6; } +if test "${ac_cv_prog_cc_c89+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_prog_cc_c89=no +ac_save_CC=$CC +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +#include +#include +#include +/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ +struct buf { int x; }; +FILE * (*rcsopen) (struct buf *, struct stat *, int); +static char *e (p, i) + char **p; + int i; +{ + return p[i]; +} +static char *f (char * (*g) (char **, int), char **p, ...) +{ + char *s; + va_list v; + va_start (v,p); + s = g (p, va_arg (v,int)); + va_end (v); + return s; +} + +/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has + function prototypes and stuff, but not '\xHH' hex character constants. + These don't provoke an error unfortunately, instead are silently treated + as 'x'. The following induces an error, until -std is added to get + proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an + array size at least. It's necessary to write '\x00'==0 to get something + that's true only with -std. */ +int osf4_cc_array ['\x00' == 0 ? 1 : -1]; + +/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters + inside strings and character constants. */ +#define FOO(x) 'x' +int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; + +int test (int i, double x); +struct s1 {int (*f) (int a);}; +struct s2 {int (*f) (double a);}; +int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); +int argc; +char **argv; +int +main () +{ +return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; + ; + return 0; +} +_ACEOF +for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ + -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" +do + CC="$ac_save_CC $ac_arg" + rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_prog_cc_c89=$ac_arg +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + +fi + +rm -f core conftest.err conftest.$ac_objext + test "x$ac_cv_prog_cc_c89" != "xno" && break +done +rm -f conftest.$ac_ext +CC=$ac_save_CC + +fi +# AC_CACHE_VAL +case "x$ac_cv_prog_cc_c89" in + x) + { echo "$as_me:$LINENO: result: none needed" >&5 +echo "${ECHO_T}none needed" >&6; } ;; + xno) + { echo "$as_me:$LINENO: result: unsupported" >&5 +echo "${ECHO_T}unsupported" >&6; } ;; + *) + CC="$CC $ac_cv_prog_cc_c89" + { echo "$as_me:$LINENO: result: $ac_cv_prog_cc_c89" >&5 +echo "${ECHO_T}$ac_cv_prog_cc_c89" >&6; } ;; +esac + + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +depcc="$CC" am_compiler_list= + +{ echo "$as_me:$LINENO: checking dependency style of $depcc" >&5 +echo $ECHO_N "checking dependency style of $depcc... $ECHO_C" >&6; } +if test "${am_cv_CC_dependencies_compiler_type+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then + # We make a subdir and do the tests there. Otherwise we can end up + # making bogus files that we don't know about and never remove. For + # instance it was reported that on HP-UX the gcc test will end up + # making a dummy file named `D' -- because `-MD' means `put the output + # in D'. + mkdir conftest.dir + # Copy depcomp to subdir because otherwise we won't find it if we're + # using a relative directory. + cp "$am_depcomp" conftest.dir + cd conftest.dir + # We will build objects and dependencies in a subdirectory because + # it helps to detect inapplicable dependency modes. For instance + # both Tru64's cc and ICC support -MD to output dependencies as a + # side effect of compilation, but ICC will put the dependencies in + # the current directory while Tru64 will put them in the object + # directory. + mkdir sub + + am_cv_CC_dependencies_compiler_type=none + if test "$am_compiler_list" = ""; then + am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` + fi + for depmode in $am_compiler_list; do + # Setup a source with many dependencies, because some compilers + # like to wrap large dependency lists on column 80 (with \), and + # we should not choose a depcomp mode which is confused by this. + # + # We need to recreate these files for each test, as the compiler may + # overwrite some of them when testing with obscure command lines. + # This happens at least with the AIX C compiler. + : > sub/conftest.c + for i in 1 2 3 4 5 6; do + echo '#include "conftst'$i'.h"' >> sub/conftest.c + # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with + # Solaris 8's {/usr,}/bin/sh. + touch sub/conftst$i.h + done + echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf + + case $depmode in + nosideeffect) + # after this tag, mechanisms are not by side-effect, so they'll + # only be used when explicitly requested + if test "x$enable_dependency_tracking" = xyes; then + continue + else + break + fi + ;; + none) break ;; + esac + # We check with `-c' and `-o' for the sake of the "dashmstdout" + # mode. It turns out that the SunPro C++ compiler does not properly + # handle `-M -o', and we need to detect this. + if depmode=$depmode \ + source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \ + depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ + $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \ + >/dev/null 2>conftest.err && + grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && + grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && + grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 && + ${MAKE-make} -s -f confmf > /dev/null 2>&1; then + # icc doesn't choke on unknown options, it will just issue warnings + # or remarks (even with -Werror). So we grep stderr for any message + # that says an option was ignored or not supported. + # When given -MP, icc 7.0 and 7.1 complain thusly: + # icc: Command line warning: ignoring option '-M'; no argument required + # The diagnosis changed in icc 8.0: + # icc: Command line remark: option '-MP' not supported + if (grep 'ignoring option' conftest.err || + grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else + am_cv_CC_dependencies_compiler_type=$depmode + break + fi + fi + done + + cd .. + rm -rf conftest.dir +else + am_cv_CC_dependencies_compiler_type=none +fi + +fi +{ echo "$as_me:$LINENO: result: $am_cv_CC_dependencies_compiler_type" >&5 +echo "${ECHO_T}$am_cv_CC_dependencies_compiler_type" >&6; } +CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type + + if + test "x$enable_dependency_tracking" != xno \ + && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then + am__fastdepCC_TRUE= + am__fastdepCC_FALSE='#' +else + am__fastdepCC_TRUE='#' + am__fastdepCC_FALSE= +fi + + +{ echo "$as_me:$LINENO: checking for a sed that does not truncate output" >&5 +echo $ECHO_N "checking for a sed that does not truncate output... $ECHO_C" >&6; } +if test "${lt_cv_path_SED+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + # Loop through the user's path and test for sed and gsed. +# Then use that list of sed's as ones to test for truncation. +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for lt_ac_prog in sed gsed; do + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$lt_ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$lt_ac_prog$ac_exec_ext"; }; then + lt_ac_sed_list="$lt_ac_sed_list $as_dir/$lt_ac_prog$ac_exec_ext" + fi + done + done +done +IFS=$as_save_IFS +lt_ac_max=0 +lt_ac_count=0 +# Add /usr/xpg4/bin/sed as it is typically found on Solaris +# along with /bin/sed that truncates output. +for lt_ac_sed in $lt_ac_sed_list /usr/xpg4/bin/sed; do + test ! -f $lt_ac_sed && continue + cat /dev/null > conftest.in + lt_ac_count=0 + echo $ECHO_N "0123456789$ECHO_C" >conftest.in + # Check for GNU sed and select it if it is found. + if "$lt_ac_sed" --version 2>&1 < /dev/null | grep 'GNU' > /dev/null; then + lt_cv_path_SED=$lt_ac_sed + break + fi + while true; do + cat conftest.in conftest.in >conftest.tmp + mv conftest.tmp conftest.in + cp conftest.in conftest.nl + echo >>conftest.nl + $lt_ac_sed -e 's/a$//' < conftest.nl >conftest.out || break + cmp -s conftest.out conftest.nl || break + # 10000 chars as input seems more than enough + test $lt_ac_count -gt 10 && break + lt_ac_count=`expr $lt_ac_count + 1` + if test $lt_ac_count -gt $lt_ac_max; then + lt_ac_max=$lt_ac_count + lt_cv_path_SED=$lt_ac_sed + fi + done +done + +fi + +SED=$lt_cv_path_SED + +{ echo "$as_me:$LINENO: result: $SED" >&5 +echo "${ECHO_T}$SED" >&6; } + +{ echo "$as_me:$LINENO: checking for grep that handles long lines and -e" >&5 +echo $ECHO_N "checking for grep that handles long lines and -e... $ECHO_C" >&6; } +if test "${ac_cv_path_GREP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + # Extract the first word of "grep ggrep" to use in msg output +if test -z "$GREP"; then +set dummy grep ggrep; ac_prog_name=$2 +if test "${ac_cv_path_GREP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_path_GREP_found=false +# Loop through the user's path and test for each of PROGNAME-LIST +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_prog in grep ggrep; do + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" + { test -f "$ac_path_GREP" && $as_test_x "$ac_path_GREP"; } || continue + # Check for GNU ac_path_GREP and select it if it is found. + # Check for GNU $ac_path_GREP +case `"$ac_path_GREP" --version 2>&1` in +*GNU*) + ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; +*) + ac_count=0 + echo $ECHO_N "0123456789$ECHO_C" >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + echo 'GREP' >> "conftest.nl" + "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break + diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break + ac_count=`expr $ac_count + 1` + if test $ac_count -gt ${ac_path_GREP_max-0}; then + # Best one so far, save it but keep looking for a better one + ac_cv_path_GREP="$ac_path_GREP" + ac_path_GREP_max=$ac_count + fi + # 10*(2^10) chars as input seems more than enough + test $ac_count -gt 10 && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out;; +esac + + + $ac_path_GREP_found && break 3 + done +done + +done +IFS=$as_save_IFS + + +fi + +GREP="$ac_cv_path_GREP" +if test -z "$GREP"; then + { { echo "$as_me:$LINENO: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5 +echo "$as_me: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;} + { (exit 1); exit 1; }; } +fi + +else + ac_cv_path_GREP=$GREP +fi + + +fi +{ echo "$as_me:$LINENO: result: $ac_cv_path_GREP" >&5 +echo "${ECHO_T}$ac_cv_path_GREP" >&6; } + GREP="$ac_cv_path_GREP" + + +{ echo "$as_me:$LINENO: checking for egrep" >&5 +echo $ECHO_N "checking for egrep... $ECHO_C" >&6; } +if test "${ac_cv_path_EGREP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 + then ac_cv_path_EGREP="$GREP -E" + else + # Extract the first word of "egrep" to use in msg output +if test -z "$EGREP"; then +set dummy egrep; ac_prog_name=$2 +if test "${ac_cv_path_EGREP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_path_EGREP_found=false +# Loop through the user's path and test for each of PROGNAME-LIST +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_prog in egrep; do + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" + { test -f "$ac_path_EGREP" && $as_test_x "$ac_path_EGREP"; } || continue + # Check for GNU ac_path_EGREP and select it if it is found. + # Check for GNU $ac_path_EGREP +case `"$ac_path_EGREP" --version 2>&1` in +*GNU*) + ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; +*) + ac_count=0 + echo $ECHO_N "0123456789$ECHO_C" >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + echo 'EGREP' >> "conftest.nl" + "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break + diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break + ac_count=`expr $ac_count + 1` + if test $ac_count -gt ${ac_path_EGREP_max-0}; then + # Best one so far, save it but keep looking for a better one + ac_cv_path_EGREP="$ac_path_EGREP" + ac_path_EGREP_max=$ac_count + fi + # 10*(2^10) chars as input seems more than enough + test $ac_count -gt 10 && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out;; +esac + + + $ac_path_EGREP_found && break 3 + done +done + +done +IFS=$as_save_IFS + + +fi + +EGREP="$ac_cv_path_EGREP" +if test -z "$EGREP"; then + { { echo "$as_me:$LINENO: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5 +echo "$as_me: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;} + { (exit 1); exit 1; }; } +fi + +else + ac_cv_path_EGREP=$EGREP +fi + + + fi +fi +{ echo "$as_me:$LINENO: result: $ac_cv_path_EGREP" >&5 +echo "${ECHO_T}$ac_cv_path_EGREP" >&6; } + EGREP="$ac_cv_path_EGREP" + + + +# Check whether --with-gnu-ld was given. +if test "${with_gnu_ld+set}" = set; then + withval=$with_gnu_ld; test "$withval" = no || with_gnu_ld=yes +else + with_gnu_ld=no +fi + +ac_prog=ld +if test "$GCC" = yes; then + # Check if gcc -print-prog-name=ld gives a path. + { echo "$as_me:$LINENO: checking for ld used by $CC" >&5 +echo $ECHO_N "checking for ld used by $CC... $ECHO_C" >&6; } + case $host in + *-*-mingw*) + # gcc leaves a trailing carriage return which upsets mingw + ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; + *) + ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; + esac + case $ac_prog in + # Accept absolute paths. + [\\/]* | ?:[\\/]*) + re_direlt='/[^/][^/]*/\.\./' + # Canonicalize the pathname of ld + ac_prog=`echo $ac_prog| $SED 's%\\\\%/%g'` + while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do + ac_prog=`echo $ac_prog| $SED "s%$re_direlt%/%"` + done + test -z "$LD" && LD="$ac_prog" + ;; + "") + # If it fails, then pretend we aren't using GCC. + ac_prog=ld + ;; + *) + # If it is relative, then search for the first ld in PATH. + with_gnu_ld=unknown + ;; + esac +elif test "$with_gnu_ld" = yes; then + { echo "$as_me:$LINENO: checking for GNU ld" >&5 +echo $ECHO_N "checking for GNU ld... $ECHO_C" >&6; } +else + { echo "$as_me:$LINENO: checking for non-GNU ld" >&5 +echo $ECHO_N "checking for non-GNU ld... $ECHO_C" >&6; } +fi +if test "${lt_cv_path_LD+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -z "$LD"; then + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + for ac_dir in $PATH; do + IFS="$lt_save_ifs" + test -z "$ac_dir" && ac_dir=. + if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then + lt_cv_path_LD="$ac_dir/$ac_prog" + # Check to see if the program is GNU ld. I'd rather use --version, + # but apparently some variants of GNU ld only accept -v. + # Break only if it was the GNU/non-GNU ld that we prefer. + case `"$lt_cv_path_LD" -v 2>&1 &5 +echo "${ECHO_T}$LD" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi +test -z "$LD" && { { echo "$as_me:$LINENO: error: no acceptable ld found in \$PATH" >&5 +echo "$as_me: error: no acceptable ld found in \$PATH" >&2;} + { (exit 1); exit 1; }; } +{ echo "$as_me:$LINENO: checking if the linker ($LD) is GNU ld" >&5 +echo $ECHO_N "checking if the linker ($LD) is GNU ld... $ECHO_C" >&6; } +if test "${lt_cv_prog_gnu_ld+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + # I'd rather use --version here, but apparently some GNU lds only accept -v. +case `$LD -v 2>&1 &5 +echo "${ECHO_T}$lt_cv_prog_gnu_ld" >&6; } +with_gnu_ld=$lt_cv_prog_gnu_ld + + +{ echo "$as_me:$LINENO: checking for $LD option to reload object files" >&5 +echo $ECHO_N "checking for $LD option to reload object files... $ECHO_C" >&6; } +if test "${lt_cv_ld_reload_flag+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + lt_cv_ld_reload_flag='-r' +fi +{ echo "$as_me:$LINENO: result: $lt_cv_ld_reload_flag" >&5 +echo "${ECHO_T}$lt_cv_ld_reload_flag" >&6; } +reload_flag=$lt_cv_ld_reload_flag +case $reload_flag in +"" | " "*) ;; +*) reload_flag=" $reload_flag" ;; +esac +reload_cmds='$LD$reload_flag -o $output$reload_objs' +case $host_os in + darwin*) + if test "$GCC" = yes; then + reload_cmds='$LTCC $LTCFLAGS -nostdlib ${wl}-r -o $output$reload_objs' + else + reload_cmds='$LD$reload_flag -o $output$reload_objs' + fi + ;; +esac + +{ echo "$as_me:$LINENO: checking for BSD-compatible nm" >&5 +echo $ECHO_N "checking for BSD-compatible nm... $ECHO_C" >&6; } +if test "${lt_cv_path_NM+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$NM"; then + # Let the user override the test. + lt_cv_path_NM="$NM" +else + lt_nm_to_check="${ac_tool_prefix}nm" + if test -n "$ac_tool_prefix" && test "$build" = "$host"; then + lt_nm_to_check="$lt_nm_to_check nm" + fi + for lt_tmp_nm in $lt_nm_to_check; do + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do + IFS="$lt_save_ifs" + test -z "$ac_dir" && ac_dir=. + tmp_nm="$ac_dir/$lt_tmp_nm" + if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then + # Check to see if the nm accepts a BSD-compat flag. + # Adding the `sed 1q' prevents false positives on HP-UX, which says: + # nm: unknown option "B" ignored + # Tru64's nm complains that /dev/null is an invalid object file + case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in + */dev/null* | *'Invalid file or object type'*) + lt_cv_path_NM="$tmp_nm -B" + break + ;; + *) + case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in + */dev/null*) + lt_cv_path_NM="$tmp_nm -p" + break + ;; + *) + lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but + continue # so that we can try to find one that supports BSD flags + ;; + esac + ;; + esac + fi + done + IFS="$lt_save_ifs" + done + test -z "$lt_cv_path_NM" && lt_cv_path_NM=nm +fi +fi +{ echo "$as_me:$LINENO: result: $lt_cv_path_NM" >&5 +echo "${ECHO_T}$lt_cv_path_NM" >&6; } +NM="$lt_cv_path_NM" + +{ echo "$as_me:$LINENO: checking whether ln -s works" >&5 +echo $ECHO_N "checking whether ln -s works... $ECHO_C" >&6; } +LN_S=$as_ln_s +if test "$LN_S" = "ln -s"; then + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } +else + { echo "$as_me:$LINENO: result: no, using $LN_S" >&5 +echo "${ECHO_T}no, using $LN_S" >&6; } +fi + +{ echo "$as_me:$LINENO: checking how to recognize dependent libraries" >&5 +echo $ECHO_N "checking how to recognize dependent libraries... $ECHO_C" >&6; } +if test "${lt_cv_deplibs_check_method+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + lt_cv_file_magic_cmd='$MAGIC_CMD' +lt_cv_file_magic_test_file= +lt_cv_deplibs_check_method='unknown' +# Need to set the preceding variable on all platforms that support +# interlibrary dependencies. +# 'none' -- dependencies not supported. +# `unknown' -- same as none, but documents that we really don't know. +# 'pass_all' -- all dependencies passed with no checks. +# 'test_compile' -- check by making test program. +# 'file_magic [[regex]]' -- check by looking for files in library path +# which responds to the $file_magic_cmd with a given extended regex. +# If you have `file' or equivalent on your system and you're not sure +# whether `pass_all' will *always* work, you probably want this one. + +case $host_os in +aix4* | aix5*) + lt_cv_deplibs_check_method=pass_all + ;; + +beos*) + lt_cv_deplibs_check_method=pass_all + ;; + +bsdi[45]*) + lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib)' + lt_cv_file_magic_cmd='/usr/bin/file -L' + lt_cv_file_magic_test_file=/shlib/libc.so + ;; + +cygwin*) + # func_win32_libid is a shell function defined in ltmain.sh + lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' + lt_cv_file_magic_cmd='func_win32_libid' + ;; + +mingw* | pw32*) + # Base MSYS/MinGW do not provide the 'file' command needed by + # func_win32_libid shell function, so use a weaker test based on 'objdump', + # unless we find 'file', for example because we are cross-compiling. + if ( file / ) >/dev/null 2>&1; then + lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' + lt_cv_file_magic_cmd='func_win32_libid' + else + lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?' + lt_cv_file_magic_cmd='$OBJDUMP -f' + fi + ;; + +darwin* | rhapsody*) + lt_cv_deplibs_check_method=pass_all + ;; + +freebsd* | dragonfly*) + if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then + case $host_cpu in + i*86 ) + # Not sure whether the presence of OpenBSD here was a mistake. + # Let's accept both of them until this is cleared up. + lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[3-9]86 (compact )?demand paged shared library' + lt_cv_file_magic_cmd=/usr/bin/file + lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` + ;; + esac + else + lt_cv_deplibs_check_method=pass_all + fi + ;; + +gnu*) + lt_cv_deplibs_check_method=pass_all + ;; + +hpux10.20* | hpux11*) + lt_cv_file_magic_cmd=/usr/bin/file + case $host_cpu in + ia64*) + lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - IA64' + lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so + ;; + hppa*64*) + lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - PA-RISC [0-9].[0-9]' + lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl + ;; + *) + lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|PA-RISC[0-9].[0-9]) shared library' + lt_cv_file_magic_test_file=/usr/lib/libc.sl + ;; + esac + ;; + +interix[3-9]*) + # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here + lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|\.a)$' + ;; + +irix5* | irix6* | nonstopux*) + case $LD in + *-32|*"-32 ") libmagic=32-bit;; + *-n32|*"-n32 ") libmagic=N32;; + *-64|*"-64 ") libmagic=64-bit;; + *) libmagic=never-match;; + esac + lt_cv_deplibs_check_method=pass_all + ;; + +# This must be Linux ELF. +linux* | k*bsd*-gnu) + lt_cv_deplibs_check_method=pass_all + ;; + +netbsd* | netbsdelf*-gnu) + if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then + lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$' + else + lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|_pic\.a)$' + fi + ;; + +newos6*) + lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (executable|dynamic lib)' + lt_cv_file_magic_cmd=/usr/bin/file + lt_cv_file_magic_test_file=/usr/lib/libnls.so + ;; + +nto-qnx*) + lt_cv_deplibs_check_method=unknown + ;; + +openbsd*) + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|\.so|_pic\.a)$' + else + lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$' + fi + ;; + +osf3* | osf4* | osf5*) + lt_cv_deplibs_check_method=pass_all + ;; + +rdos*) + lt_cv_deplibs_check_method=pass_all + ;; + +solaris*) + lt_cv_deplibs_check_method=pass_all + ;; + +sysv4 | sysv4.3*) + case $host_vendor in + motorola) + lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib) M[0-9][0-9]* Version [0-9]' + lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*` + ;; + ncr) + lt_cv_deplibs_check_method=pass_all + ;; + sequent) + lt_cv_file_magic_cmd='/bin/file' + lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )' + ;; + sni) + lt_cv_file_magic_cmd='/bin/file' + lt_cv_deplibs_check_method="file_magic ELF [0-9][0-9]*-bit [LM]SB dynamic lib" + lt_cv_file_magic_test_file=/lib/libc.so + ;; + siemens) + lt_cv_deplibs_check_method=pass_all + ;; + pc) + lt_cv_deplibs_check_method=pass_all + ;; + esac + ;; + +sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) + lt_cv_deplibs_check_method=pass_all + ;; +esac + +fi +{ echo "$as_me:$LINENO: result: $lt_cv_deplibs_check_method" >&5 +echo "${ECHO_T}$lt_cv_deplibs_check_method" >&6; } +file_magic_cmd=$lt_cv_file_magic_cmd +deplibs_check_method=$lt_cv_deplibs_check_method +test -z "$deplibs_check_method" && deplibs_check_method=unknown + + + + +# If no C compiler was specified, use CC. +LTCC=${LTCC-"$CC"} + +# If no C compiler flags were specified, use CFLAGS. +LTCFLAGS=${LTCFLAGS-"$CFLAGS"} + +# Allow CC to be a program name with arguments. +compiler=$CC + + +# Check whether --enable-libtool-lock was given. +if test "${enable_libtool_lock+set}" = set; then + enableval=$enable_libtool_lock; +fi + +test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes + +# Some flags need to be propagated to the compiler or linker for good +# libtool support. +case $host in +ia64-*-hpux*) + # Find out which ABI we are using. + echo 'int i;' > conftest.$ac_ext + if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + case `/usr/bin/file conftest.$ac_objext` in + *ELF-32*) + HPUX_IA64_MODE="32" + ;; + *ELF-64*) + HPUX_IA64_MODE="64" + ;; + esac + fi + rm -rf conftest* + ;; +*-*-irix6*) + # Find out which ABI we are using. + echo '#line 4400 "configure"' > conftest.$ac_ext + if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + if test "$lt_cv_prog_gnu_ld" = yes; then + case `/usr/bin/file conftest.$ac_objext` in + *32-bit*) + LD="${LD-ld} -melf32bsmip" + ;; + *N32*) + LD="${LD-ld} -melf32bmipn32" + ;; + *64-bit*) + LD="${LD-ld} -melf64bmip" + ;; + esac + else + case `/usr/bin/file conftest.$ac_objext` in + *32-bit*) + LD="${LD-ld} -32" + ;; + *N32*) + LD="${LD-ld} -n32" + ;; + *64-bit*) + LD="${LD-ld} -64" + ;; + esac + fi + fi + rm -rf conftest* + ;; + +x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \ +s390*-*linux*|sparc*-*linux*) + # Find out which ABI we are using. + echo 'int i;' > conftest.$ac_ext + if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + case `/usr/bin/file conftest.o` in + *32-bit*) + case $host in + x86_64-*kfreebsd*-gnu) + LD="${LD-ld} -m elf_i386_fbsd" + ;; + x86_64-*linux*) + LD="${LD-ld} -m elf_i386" + ;; + ppc64-*linux*|powerpc64-*linux*) + LD="${LD-ld} -m elf32ppclinux" + ;; + s390x-*linux*) + LD="${LD-ld} -m elf_s390" + ;; + sparc64-*linux*) + LD="${LD-ld} -m elf32_sparc" + ;; + esac + ;; + *64-bit*) + case $host in + x86_64-*kfreebsd*-gnu) + LD="${LD-ld} -m elf_x86_64_fbsd" + ;; + x86_64-*linux*) + LD="${LD-ld} -m elf_x86_64" + ;; + ppc*-*linux*|powerpc*-*linux*) + LD="${LD-ld} -m elf64ppc" + ;; + s390*-*linux*) + LD="${LD-ld} -m elf64_s390" + ;; + sparc*-*linux*) + LD="${LD-ld} -m elf64_sparc" + ;; + esac + ;; + esac + fi + rm -rf conftest* + ;; + +*-*-sco3.2v5*) + # On SCO OpenServer 5, we need -belf to get full-featured binaries. + SAVE_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -belf" + { echo "$as_me:$LINENO: checking whether the C compiler needs -belf" >&5 +echo $ECHO_N "checking whether the C compiler needs -belf... $ECHO_C" >&6; } +if test "${lt_cv_cc_needs_belf+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then + lt_cv_cc_needs_belf=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + lt_cv_cc_needs_belf=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext + ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +fi +{ echo "$as_me:$LINENO: result: $lt_cv_cc_needs_belf" >&5 +echo "${ECHO_T}$lt_cv_cc_needs_belf" >&6; } + if test x"$lt_cv_cc_needs_belf" != x"yes"; then + # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf + CFLAGS="$SAVE_CFLAGS" + fi + ;; +sparc*-*solaris*) + # Find out which ABI we are using. + echo 'int i;' > conftest.$ac_ext + if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + case `/usr/bin/file conftest.o` in + *64-bit*) + case $lt_cv_prog_gnu_ld in + yes*) LD="${LD-ld} -m elf64_sparc" ;; + *) LD="${LD-ld} -64" ;; + esac + ;; + esac + fi + rm -rf conftest* + ;; + + +esac + +need_locks="$enable_libtool_lock" + + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +{ echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5 +echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6; } +# On Suns, sometimes $CPP names a directory. +if test -n "$CPP" && test -d "$CPP"; then + CPP= +fi +if test -z "$CPP"; then + if test "${ac_cv_prog_CPP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + # Double quotes because CPP needs to be expanded + for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" + do + ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # Prefer to if __STDC__ is defined, since + # exists even on freestanding compilers. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#ifdef __STDC__ +# include +#else +# include +#endif + Syntax error +_ACEOF +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then + : +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # Broken: fails on valid input. +continue +fi + +rm -f conftest.err conftest.$ac_ext + + # OK, works on sane cases. Now check whether nonexistent headers + # can be detected and how. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +_ACEOF +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then + # Broken: success on invalid input. +continue +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # Passes both tests. +ac_preproc_ok=: +break +fi + +rm -f conftest.err conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.err conftest.$ac_ext +if $ac_preproc_ok; then + break +fi + + done + ac_cv_prog_CPP=$CPP + +fi + CPP=$ac_cv_prog_CPP +else + ac_cv_prog_CPP=$CPP +fi +{ echo "$as_me:$LINENO: result: $CPP" >&5 +echo "${ECHO_T}$CPP" >&6; } +ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # Prefer to if __STDC__ is defined, since + # exists even on freestanding compilers. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#ifdef __STDC__ +# include +#else +# include +#endif + Syntax error +_ACEOF +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then + : +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # Broken: fails on valid input. +continue +fi + +rm -f conftest.err conftest.$ac_ext + + # OK, works on sane cases. Now check whether nonexistent headers + # can be detected and how. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +_ACEOF +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then + # Broken: success on invalid input. +continue +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # Passes both tests. +ac_preproc_ok=: +break +fi + +rm -f conftest.err conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.err conftest.$ac_ext +if $ac_preproc_ok; then + : +else + { { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check +See \`config.log' for more details." >&5 +echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + +{ echo "$as_me:$LINENO: checking for ANSI C header files" >&5 +echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6; } +if test "${ac_cv_header_stdc+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +#include +#include +#include + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_header_stdc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_header_stdc=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +if test $ac_cv_header_stdc = yes; then + # SunOS 4.x string.h does not declare mem*, contrary to ANSI. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "memchr" >/dev/null 2>&1; then + : +else + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "free" >/dev/null 2>&1; then + : +else + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. + if test "$cross_compiling" = yes; then + : +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +#include +#if ((' ' & 0x0FF) == 0x020) +# define ISLOWER(c) ('a' <= (c) && (c) <= 'z') +# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) +#else +# define ISLOWER(c) \ + (('a' <= (c) && (c) <= 'i') \ + || ('j' <= (c) && (c) <= 'r') \ + || ('s' <= (c) && (c) <= 'z')) +# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) +#endif + +#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) +int +main () +{ + int i; + for (i = 0; i < 256; i++) + if (XOR (islower (i), ISLOWER (i)) + || toupper (i) != TOUPPER (i)) + return 2; + return 0; +} +_ACEOF +rm -f conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + : +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +( exit $ac_status ) +ac_cv_header_stdc=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi + + +fi +fi +{ echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5 +echo "${ECHO_T}$ac_cv_header_stdc" >&6; } +if test $ac_cv_header_stdc = yes; then + +cat >>confdefs.h <<\_ACEOF +#define STDC_HEADERS 1 +_ACEOF + +fi + +# On IRIX 5.3, sys/types and inttypes.h are conflicting. + + + + + + + + + +for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ + inttypes.h stdint.h unistd.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +{ echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default + +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + eval "$as_ac_Header=yes" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + eval "$as_ac_Header=no" +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +ac_res=`eval echo '${'$as_ac_Header'}'` + { echo "$as_me:$LINENO: result: $ac_res" >&5 +echo "${ECHO_T}$ac_res" >&6; } +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + + +for ac_header in dlfcn.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + { echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +ac_res=`eval echo '${'$as_ac_Header'}'` + { echo "$as_me:$LINENO: result: $ac_res" >&5 +echo "${ECHO_T}$ac_res" >&6; } +else + # Is the header compilable? +{ echo "$as_me:$LINENO: checking $ac_header usability" >&5 +echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6; } +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_compiler=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6; } + +# Is the header present? +{ echo "$as_me:$LINENO: checking $ac_header presence" >&5 +echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6; } +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <$ac_header> +_ACEOF +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi + +rm -f conftest.err conftest.$ac_ext +{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6; } + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in + yes:no: ) + { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} + ( cat <<\_ASBOX +## ----------------------------------------------------------------------------------------------- ## +## Report this to https://bugs.freedesktop.org/enter_bug.cgi?product=xorg&component=Driver%2Fgeode ## +## ----------------------------------------------------------------------------------------------- ## +_ASBOX + ) | sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +{ echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + eval "$as_ac_Header=\$ac_header_preproc" +fi +ac_res=`eval echo '${'$as_ac_Header'}'` + { echo "$as_me:$LINENO: result: $ac_res" >&5 +echo "${ECHO_T}$ac_res" >&6; } + +fi +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + +ac_ext=cpp +ac_cpp='$CXXCPP $CPPFLAGS' +ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_cxx_compiler_gnu +if test -z "$CXX"; then + if test -n "$CCC"; then + CXX=$CCC + else + if test -n "$ac_tool_prefix"; then + for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC + do + # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. +set dummy $ac_tool_prefix$ac_prog; ac_word=$2 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_prog_CXX+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CXX"; then + ac_cv_prog_CXX="$CXX" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_CXX="$ac_tool_prefix$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +fi +fi +CXX=$ac_cv_prog_CXX +if test -n "$CXX"; then + { echo "$as_me:$LINENO: result: $CXX" >&5 +echo "${ECHO_T}$CXX" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + + test -n "$CXX" && break + done +fi +if test -z "$CXX"; then + ac_ct_CXX=$CXX + for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_prog_ac_ct_CXX+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_CXX"; then + ac_cv_prog_ac_ct_CXX="$ac_ct_CXX" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_CXX="$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +fi +fi +ac_ct_CXX=$ac_cv_prog_ac_ct_CXX +if test -n "$ac_ct_CXX"; then + { echo "$as_me:$LINENO: result: $ac_ct_CXX" >&5 +echo "${ECHO_T}$ac_ct_CXX" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + + test -n "$ac_ct_CXX" && break +done + + if test "x$ac_ct_CXX" = x; then + CXX="g++" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools +whose name does not start with the host triplet. If you think this +configuration is useful to you, please write to autoconf@gnu.org." >&5 +echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools +whose name does not start with the host triplet. If you think this +configuration is useful to you, please write to autoconf@gnu.org." >&2;} +ac_tool_warned=yes ;; +esac + CXX=$ac_ct_CXX + fi +fi + + fi +fi +# Provide some information about the compiler. +echo "$as_me:$LINENO: checking for C++ compiler version" >&5 +ac_compiler=`set X $ac_compile; echo $2` +{ (ac_try="$ac_compiler --version >&5" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compiler --version >&5") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (ac_try="$ac_compiler -v >&5" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compiler -v >&5") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (ac_try="$ac_compiler -V >&5" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compiler -V >&5") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } + +{ echo "$as_me:$LINENO: checking whether we are using the GNU C++ compiler" >&5 +echo $ECHO_N "checking whether we are using the GNU C++ compiler... $ECHO_C" >&6; } +if test "${ac_cv_cxx_compiler_gnu+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ +#ifndef __GNUC__ + choke me +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_cxx_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_compiler_gnu=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_compiler_gnu=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +ac_cv_cxx_compiler_gnu=$ac_compiler_gnu + +fi +{ echo "$as_me:$LINENO: result: $ac_cv_cxx_compiler_gnu" >&5 +echo "${ECHO_T}$ac_cv_cxx_compiler_gnu" >&6; } +GXX=`test $ac_compiler_gnu = yes && echo yes` +ac_test_CXXFLAGS=${CXXFLAGS+set} +ac_save_CXXFLAGS=$CXXFLAGS +{ echo "$as_me:$LINENO: checking whether $CXX accepts -g" >&5 +echo $ECHO_N "checking whether $CXX accepts -g... $ECHO_C" >&6; } +if test "${ac_cv_prog_cxx_g+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_save_cxx_werror_flag=$ac_cxx_werror_flag + ac_cxx_werror_flag=yes + ac_cv_prog_cxx_g=no + CXXFLAGS="-g" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_cxx_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_prog_cxx_g=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + CXXFLAGS="" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_cxx_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + : +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cxx_werror_flag=$ac_save_cxx_werror_flag + CXXFLAGS="-g" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_cxx_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_prog_cxx_g=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + ac_cxx_werror_flag=$ac_save_cxx_werror_flag +fi +{ echo "$as_me:$LINENO: result: $ac_cv_prog_cxx_g" >&5 +echo "${ECHO_T}$ac_cv_prog_cxx_g" >&6; } +if test "$ac_test_CXXFLAGS" = set; then + CXXFLAGS=$ac_save_CXXFLAGS +elif test $ac_cv_prog_cxx_g = yes; then + if test "$GXX" = yes; then + CXXFLAGS="-g -O2" + else + CXXFLAGS="-g" + fi +else + if test "$GXX" = yes; then + CXXFLAGS="-O2" + else + CXXFLAGS= + fi +fi +ac_ext=cpp +ac_cpp='$CXXCPP $CPPFLAGS' +ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_cxx_compiler_gnu + +depcc="$CXX" am_compiler_list= + +{ echo "$as_me:$LINENO: checking dependency style of $depcc" >&5 +echo $ECHO_N "checking dependency style of $depcc... $ECHO_C" >&6; } +if test "${am_cv_CXX_dependencies_compiler_type+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then + # We make a subdir and do the tests there. Otherwise we can end up + # making bogus files that we don't know about and never remove. For + # instance it was reported that on HP-UX the gcc test will end up + # making a dummy file named `D' -- because `-MD' means `put the output + # in D'. + mkdir conftest.dir + # Copy depcomp to subdir because otherwise we won't find it if we're + # using a relative directory. + cp "$am_depcomp" conftest.dir + cd conftest.dir + # We will build objects and dependencies in a subdirectory because + # it helps to detect inapplicable dependency modes. For instance + # both Tru64's cc and ICC support -MD to output dependencies as a + # side effect of compilation, but ICC will put the dependencies in + # the current directory while Tru64 will put them in the object + # directory. + mkdir sub + + am_cv_CXX_dependencies_compiler_type=none + if test "$am_compiler_list" = ""; then + am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` + fi + for depmode in $am_compiler_list; do + # Setup a source with many dependencies, because some compilers + # like to wrap large dependency lists on column 80 (with \), and + # we should not choose a depcomp mode which is confused by this. + # + # We need to recreate these files for each test, as the compiler may + # overwrite some of them when testing with obscure command lines. + # This happens at least with the AIX C compiler. + : > sub/conftest.c + for i in 1 2 3 4 5 6; do + echo '#include "conftst'$i'.h"' >> sub/conftest.c + # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with + # Solaris 8's {/usr,}/bin/sh. + touch sub/conftst$i.h + done + echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf + + case $depmode in + nosideeffect) + # after this tag, mechanisms are not by side-effect, so they'll + # only be used when explicitly requested + if test "x$enable_dependency_tracking" = xyes; then + continue + else + break + fi + ;; + none) break ;; + esac + # We check with `-c' and `-o' for the sake of the "dashmstdout" + # mode. It turns out that the SunPro C++ compiler does not properly + # handle `-M -o', and we need to detect this. + if depmode=$depmode \ + source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \ + depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ + $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \ + >/dev/null 2>conftest.err && + grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && + grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && + grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 && + ${MAKE-make} -s -f confmf > /dev/null 2>&1; then + # icc doesn't choke on unknown options, it will just issue warnings + # or remarks (even with -Werror). So we grep stderr for any message + # that says an option was ignored or not supported. + # When given -MP, icc 7.0 and 7.1 complain thusly: + # icc: Command line warning: ignoring option '-M'; no argument required + # The diagnosis changed in icc 8.0: + # icc: Command line remark: option '-MP' not supported + if (grep 'ignoring option' conftest.err || + grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else + am_cv_CXX_dependencies_compiler_type=$depmode + break + fi + fi + done + + cd .. + rm -rf conftest.dir +else + am_cv_CXX_dependencies_compiler_type=none +fi + +fi +{ echo "$as_me:$LINENO: result: $am_cv_CXX_dependencies_compiler_type" >&5 +echo "${ECHO_T}$am_cv_CXX_dependencies_compiler_type" >&6; } +CXXDEPMODE=depmode=$am_cv_CXX_dependencies_compiler_type + + if + test "x$enable_dependency_tracking" != xno \ + && test "$am_cv_CXX_dependencies_compiler_type" = gcc3; then + am__fastdepCXX_TRUE= + am__fastdepCXX_FALSE='#' +else + am__fastdepCXX_TRUE='#' + am__fastdepCXX_FALSE= +fi + + + + +if test -n "$CXX" && ( test "X$CXX" != "Xno" && + ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) || + (test "X$CXX" != "Xg++"))) ; then + ac_ext=cpp +ac_cpp='$CXXCPP $CPPFLAGS' +ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_cxx_compiler_gnu +{ echo "$as_me:$LINENO: checking how to run the C++ preprocessor" >&5 +echo $ECHO_N "checking how to run the C++ preprocessor... $ECHO_C" >&6; } +if test -z "$CXXCPP"; then + if test "${ac_cv_prog_CXXCPP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + # Double quotes because CXXCPP needs to be expanded + for CXXCPP in "$CXX -E" "/lib/cpp" + do + ac_preproc_ok=false +for ac_cxx_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # Prefer to if __STDC__ is defined, since + # exists even on freestanding compilers. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#ifdef __STDC__ +# include +#else +# include +#endif + Syntax error +_ACEOF +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null && { + test -z "$ac_cxx_preproc_warn_flag$ac_cxx_werror_flag" || + test ! -s conftest.err + }; then + : +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # Broken: fails on valid input. +continue +fi + +rm -f conftest.err conftest.$ac_ext + + # OK, works on sane cases. Now check whether nonexistent headers + # can be detected and how. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +_ACEOF +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null && { + test -z "$ac_cxx_preproc_warn_flag$ac_cxx_werror_flag" || + test ! -s conftest.err + }; then + # Broken: success on invalid input. +continue +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # Passes both tests. +ac_preproc_ok=: +break +fi + +rm -f conftest.err conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.err conftest.$ac_ext +if $ac_preproc_ok; then + break +fi + + done + ac_cv_prog_CXXCPP=$CXXCPP + +fi + CXXCPP=$ac_cv_prog_CXXCPP +else + ac_cv_prog_CXXCPP=$CXXCPP +fi +{ echo "$as_me:$LINENO: result: $CXXCPP" >&5 +echo "${ECHO_T}$CXXCPP" >&6; } +ac_preproc_ok=false +for ac_cxx_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # Prefer to if __STDC__ is defined, since + # exists even on freestanding compilers. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#ifdef __STDC__ +# include +#else +# include +#endif + Syntax error +_ACEOF +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null && { + test -z "$ac_cxx_preproc_warn_flag$ac_cxx_werror_flag" || + test ! -s conftest.err + }; then + : +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # Broken: fails on valid input. +continue +fi + +rm -f conftest.err conftest.$ac_ext + + # OK, works on sane cases. Now check whether nonexistent headers + # can be detected and how. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +_ACEOF +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null && { + test -z "$ac_cxx_preproc_warn_flag$ac_cxx_werror_flag" || + test ! -s conftest.err + }; then + # Broken: success on invalid input. +continue +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # Passes both tests. +ac_preproc_ok=: +break +fi + +rm -f conftest.err conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.err conftest.$ac_ext +if $ac_preproc_ok; then + : +else + { { echo "$as_me:$LINENO: error: C++ preprocessor \"$CXXCPP\" fails sanity check +See \`config.log' for more details." >&5 +echo "$as_me: error: C++ preprocessor \"$CXXCPP\" fails sanity check +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } +fi + +ac_ext=cpp +ac_cpp='$CXXCPP $CPPFLAGS' +ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_cxx_compiler_gnu + +fi + + +ac_ext=f +ac_compile='$F77 -c $FFLAGS conftest.$ac_ext >&5' +ac_link='$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_f77_compiler_gnu +if test -n "$ac_tool_prefix"; then + for ac_prog in g77 xlf f77 frt pgf77 cf77 fort77 fl32 af77 xlf90 f90 pgf90 pghpf epcf90 gfortran g95 xlf95 f95 fort ifort ifc efc pgf95 lf95 ftn + do + # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. +set dummy $ac_tool_prefix$ac_prog; ac_word=$2 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_prog_F77+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$F77"; then + ac_cv_prog_F77="$F77" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_F77="$ac_tool_prefix$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +fi +fi +F77=$ac_cv_prog_F77 +if test -n "$F77"; then + { echo "$as_me:$LINENO: result: $F77" >&5 +echo "${ECHO_T}$F77" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + + test -n "$F77" && break + done +fi +if test -z "$F77"; then + ac_ct_F77=$F77 + for ac_prog in g77 xlf f77 frt pgf77 cf77 fort77 fl32 af77 xlf90 f90 pgf90 pghpf epcf90 gfortran g95 xlf95 f95 fort ifort ifc efc pgf95 lf95 ftn +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_prog_ac_ct_F77+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_F77"; then + ac_cv_prog_ac_ct_F77="$ac_ct_F77" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_F77="$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +fi +fi +ac_ct_F77=$ac_cv_prog_ac_ct_F77 +if test -n "$ac_ct_F77"; then + { echo "$as_me:$LINENO: result: $ac_ct_F77" >&5 +echo "${ECHO_T}$ac_ct_F77" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + + test -n "$ac_ct_F77" && break +done + + if test "x$ac_ct_F77" = x; then + F77="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools +whose name does not start with the host triplet. If you think this +configuration is useful to you, please write to autoconf@gnu.org." >&5 +echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools +whose name does not start with the host triplet. If you think this +configuration is useful to you, please write to autoconf@gnu.org." >&2;} +ac_tool_warned=yes ;; +esac + F77=$ac_ct_F77 + fi +fi + + +# Provide some information about the compiler. +echo "$as_me:$LINENO: checking for Fortran 77 compiler version" >&5 +ac_compiler=`set X $ac_compile; echo $2` +{ (ac_try="$ac_compiler --version >&5" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compiler --version >&5") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (ac_try="$ac_compiler -v >&5" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compiler -v >&5") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (ac_try="$ac_compiler -V >&5" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compiler -V >&5") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +rm -f a.out + +# If we don't use `.F' as extension, the preprocessor is not run on the +# input file. (Note that this only needs to work for GNU compilers.) +ac_save_ext=$ac_ext +ac_ext=F +{ echo "$as_me:$LINENO: checking whether we are using the GNU Fortran 77 compiler" >&5 +echo $ECHO_N "checking whether we are using the GNU Fortran 77 compiler... $ECHO_C" >&6; } +if test "${ac_cv_f77_compiler_gnu+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF + program main +#ifndef __GNUC__ + choke me +#endif + + end +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_f77_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_compiler_gnu=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_compiler_gnu=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +ac_cv_f77_compiler_gnu=$ac_compiler_gnu + +fi +{ echo "$as_me:$LINENO: result: $ac_cv_f77_compiler_gnu" >&5 +echo "${ECHO_T}$ac_cv_f77_compiler_gnu" >&6; } +ac_ext=$ac_save_ext +ac_test_FFLAGS=${FFLAGS+set} +ac_save_FFLAGS=$FFLAGS +FFLAGS= +{ echo "$as_me:$LINENO: checking whether $F77 accepts -g" >&5 +echo $ECHO_N "checking whether $F77 accepts -g... $ECHO_C" >&6; } +if test "${ac_cv_prog_f77_g+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + FFLAGS=-g +cat >conftest.$ac_ext <<_ACEOF + program main + + end +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_f77_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_prog_f77_g=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_prog_f77_g=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +fi +{ echo "$as_me:$LINENO: result: $ac_cv_prog_f77_g" >&5 +echo "${ECHO_T}$ac_cv_prog_f77_g" >&6; } +if test "$ac_test_FFLAGS" = set; then + FFLAGS=$ac_save_FFLAGS +elif test $ac_cv_prog_f77_g = yes; then + if test "x$ac_cv_f77_compiler_gnu" = xyes; then + FFLAGS="-g -O2" + else + FFLAGS="-g" + fi +else + if test "x$ac_cv_f77_compiler_gnu" = xyes; then + FFLAGS="-O2" + else + FFLAGS= + fi +fi + +G77=`test $ac_compiler_gnu = yes && echo yes` +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + + +# Autoconf 2.13's AC_OBJEXT and AC_EXEEXT macros only works for C compilers! + +# find the maximum length of command line arguments +{ echo "$as_me:$LINENO: checking the maximum length of command line arguments" >&5 +echo $ECHO_N "checking the maximum length of command line arguments... $ECHO_C" >&6; } +if test "${lt_cv_sys_max_cmd_len+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + i=0 + teststring="ABCD" + + case $build_os in + msdosdjgpp*) + # On DJGPP, this test can blow up pretty badly due to problems in libc + # (any single argument exceeding 2000 bytes causes a buffer overrun + # during glob expansion). Even if it were fixed, the result of this + # check would be larger than it should be. + lt_cv_sys_max_cmd_len=12288; # 12K is about right + ;; + + gnu*) + # Under GNU Hurd, this test is not required because there is + # no limit to the length of command line arguments. + # Libtool will interpret -1 as no limit whatsoever + lt_cv_sys_max_cmd_len=-1; + ;; + + cygwin* | mingw*) + # On Win9x/ME, this test blows up -- it succeeds, but takes + # about 5 minutes as the teststring grows exponentially. + # Worse, since 9x/ME are not pre-emptively multitasking, + # you end up with a "frozen" computer, even though with patience + # the test eventually succeeds (with a max line length of 256k). + # Instead, let's just punt: use the minimum linelength reported by + # all of the supported platforms: 8192 (on NT/2K/XP). + lt_cv_sys_max_cmd_len=8192; + ;; + + amigaos*) + # On AmigaOS with pdksh, this test takes hours, literally. + # So we just punt and use a minimum line length of 8192. + lt_cv_sys_max_cmd_len=8192; + ;; + + netbsd* | freebsd* | openbsd* | darwin* | dragonfly*) + # This has been around since 386BSD, at least. Likely further. + if test -x /sbin/sysctl; then + lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax` + elif test -x /usr/sbin/sysctl; then + lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax` + else + lt_cv_sys_max_cmd_len=65536 # usable default for all BSDs + fi + # And add a safety zone + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` + ;; + + interix*) + # We know the value 262144 and hardcode it with a safety zone (like BSD) + lt_cv_sys_max_cmd_len=196608 + ;; + + osf*) + # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure + # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not + # nice to cause kernel panics so lets avoid the loop below. + # First set a reasonable default. + lt_cv_sys_max_cmd_len=16384 + # + if test -x /sbin/sysconfig; then + case `/sbin/sysconfig -q proc exec_disable_arg_limit` in + *1*) lt_cv_sys_max_cmd_len=-1 ;; + esac + fi + ;; + sco3.2v5*) + lt_cv_sys_max_cmd_len=102400 + ;; + sysv5* | sco5v6* | sysv4.2uw2*) + kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null` + if test -n "$kargmax"; then + lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[ ]//'` + else + lt_cv_sys_max_cmd_len=32768 + fi + ;; + *) + lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null` + if test -n "$lt_cv_sys_max_cmd_len"; then + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` + else + SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}} + while (test "X"`$SHELL $0 --fallback-echo "X$teststring" 2>/dev/null` \ + = "XX$teststring") >/dev/null 2>&1 && + new_result=`expr "X$teststring" : ".*" 2>&1` && + lt_cv_sys_max_cmd_len=$new_result && + test $i != 17 # 1/2 MB should be enough + do + i=`expr $i + 1` + teststring=$teststring$teststring + done + teststring= + # Add a significant safety factor because C++ compilers can tack on massive + # amounts of additional arguments before passing them to the linker. + # It appears as though 1/2 is a usable value. + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2` + fi + ;; + esac + +fi + +if test -n $lt_cv_sys_max_cmd_len ; then + { echo "$as_me:$LINENO: result: $lt_cv_sys_max_cmd_len" >&5 +echo "${ECHO_T}$lt_cv_sys_max_cmd_len" >&6; } +else + { echo "$as_me:$LINENO: result: none" >&5 +echo "${ECHO_T}none" >&6; } +fi + + + + + +# Check for command to grab the raw symbol name followed by C symbol from nm. +{ echo "$as_me:$LINENO: checking command to parse $NM output from $compiler object" >&5 +echo $ECHO_N "checking command to parse $NM output from $compiler object... $ECHO_C" >&6; } +if test "${lt_cv_sys_global_symbol_pipe+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + +# These are sane defaults that work on at least a few old systems. +# [They come from Ultrix. What could be older than Ultrix?!! ;)] + +# Character class describing NM global symbol codes. +symcode='[BCDEGRST]' + +# Regexp to match symbols that can be accessed directly from C. +sympat='\([_A-Za-z][_A-Za-z0-9]*\)' + +# Transform an extracted symbol line into a proper C declaration +lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^. .* \(.*\)$/extern int \1;/p'" + +# Transform an extracted symbol line into symbol name and symbol address +lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode \([^ ]*\) \([^ ]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" + +# Define system-specific variables. +case $host_os in +aix*) + symcode='[BCDT]' + ;; +cygwin* | mingw* | pw32*) + symcode='[ABCDGISTW]' + ;; +hpux*) # Its linker distinguishes data from code symbols + if test "$host_cpu" = ia64; then + symcode='[ABCDEGRST]' + fi + lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" + lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" + ;; +linux* | k*bsd*-gnu) + if test "$host_cpu" = ia64; then + symcode='[ABCDGIRSTW]' + lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" + lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" + fi + ;; +irix* | nonstopux*) + symcode='[BCDEGRST]' + ;; +osf*) + symcode='[BCDEGQRST]' + ;; +solaris*) + symcode='[BDRT]' + ;; +sco3.2v5*) + symcode='[DT]' + ;; +sysv4.2uw2*) + symcode='[DT]' + ;; +sysv5* | sco5v6* | unixware* | OpenUNIX*) + symcode='[ABDT]' + ;; +sysv4) + symcode='[DFNSTU]' + ;; +esac + +# Handle CRLF in mingw tool chain +opt_cr= +case $build_os in +mingw*) + opt_cr=`echo 'x\{0,1\}' | tr x '\015'` # option cr in regexp + ;; +esac + +# If we're using GNU nm, then use its standard symbol codes. +case `$NM -V 2>&1` in +*GNU* | *'with BFD'*) + symcode='[ABCDGIRSTW]' ;; +esac + +# Try without a prefix undercore, then with it. +for ac_symprfx in "" "_"; do + + # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol. + symxfrm="\\1 $ac_symprfx\\2 \\2" + + # Write the raw and C identifiers. + lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[ ]\($symcode$symcode*\)[ ][ ]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'" + + # Check to see that the pipe works correctly. + pipe_works=no + + rm -f conftest* + cat > conftest.$ac_ext <&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + # Now try to grab the symbols. + nlist=conftest.nm + if { (eval echo "$as_me:$LINENO: \"$NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist\"") >&5 + (eval $NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && test -s "$nlist"; then + # Try sorting and uniquifying the output. + if sort "$nlist" | uniq > "$nlist"T; then + mv -f "$nlist"T "$nlist" + else + rm -f "$nlist"T + fi + + # Make sure that we snagged all the symbols we need. + if grep ' nm_test_var$' "$nlist" >/dev/null; then + if grep ' nm_test_func$' "$nlist" >/dev/null; then + cat < conftest.$ac_ext +#ifdef __cplusplus +extern "C" { +#endif + +EOF + # Now generate the symbol file. + eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | grep -v main >> conftest.$ac_ext' + + cat <> conftest.$ac_ext +#if defined (__STDC__) && __STDC__ +# define lt_ptr_t void * +#else +# define lt_ptr_t char * +# define const +#endif + +/* The mapping between symbol names and symbols. */ +const struct { + const char *name; + lt_ptr_t address; +} +lt_preloaded_symbols[] = +{ +EOF + $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (lt_ptr_t) \&\2},/" < "$nlist" | grep -v main >> conftest.$ac_ext + cat <<\EOF >> conftest.$ac_ext + {0, (lt_ptr_t) 0} +}; + +#ifdef __cplusplus +} +#endif +EOF + # Now try linking the two files. + mv conftest.$ac_objext conftstm.$ac_objext + lt_save_LIBS="$LIBS" + lt_save_CFLAGS="$CFLAGS" + LIBS="conftstm.$ac_objext" + CFLAGS="$CFLAGS$lt_prog_compiler_no_builtin_flag" + if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && test -s conftest${ac_exeext}; then + pipe_works=yes + fi + LIBS="$lt_save_LIBS" + CFLAGS="$lt_save_CFLAGS" + else + echo "cannot find nm_test_func in $nlist" >&5 + fi + else + echo "cannot find nm_test_var in $nlist" >&5 + fi + else + echo "cannot run $lt_cv_sys_global_symbol_pipe" >&5 + fi + else + echo "$progname: failed program was:" >&5 + cat conftest.$ac_ext >&5 + fi + rm -f conftest* conftst* + + # Do not use the global_symbol_pipe unless it works. + if test "$pipe_works" = yes; then + break + else + lt_cv_sys_global_symbol_pipe= + fi +done + +fi + +if test -z "$lt_cv_sys_global_symbol_pipe"; then + lt_cv_sys_global_symbol_to_cdecl= +fi +if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then + { echo "$as_me:$LINENO: result: failed" >&5 +echo "${ECHO_T}failed" >&6; } +else + { echo "$as_me:$LINENO: result: ok" >&5 +echo "${ECHO_T}ok" >&6; } +fi + +{ echo "$as_me:$LINENO: checking for objdir" >&5 +echo $ECHO_N "checking for objdir... $ECHO_C" >&6; } +if test "${lt_cv_objdir+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + rm -f .libs 2>/dev/null +mkdir .libs 2>/dev/null +if test -d .libs; then + lt_cv_objdir=.libs +else + # MS-DOS does not allow filenames that begin with a dot. + lt_cv_objdir=_libs +fi +rmdir .libs 2>/dev/null +fi +{ echo "$as_me:$LINENO: result: $lt_cv_objdir" >&5 +echo "${ECHO_T}$lt_cv_objdir" >&6; } +objdir=$lt_cv_objdir + + + + + +case $host_os in +aix3*) + # AIX sometimes has problems with the GCC collect2 program. For some + # reason, if we set the COLLECT_NAMES environment variable, the problems + # vanish in a puff of smoke. + if test "X${COLLECT_NAMES+set}" != Xset; then + COLLECT_NAMES= + export COLLECT_NAMES + fi + ;; +esac + +# Sed substitution that helps us do robust quoting. It backslashifies +# metacharacters that are still active within double-quoted strings. +Xsed='sed -e 1s/^X//' +sed_quote_subst='s/\([\\"\\`$\\\\]\)/\\\1/g' + +# Same as above, but do not quote variable references. +double_quote_subst='s/\([\\"\\`\\\\]\)/\\\1/g' + +# Sed substitution to delay expansion of an escaped shell variable in a +# double_quote_subst'ed string. +delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' + +# Sed substitution to avoid accidental globbing in evaled expressions +no_glob_subst='s/\*/\\\*/g' + +# Constants: +rm="rm -f" + +# Global variables: +default_ofile=libtool +can_build_shared=yes + +# All known linkers require a `.a' archive for static linking (except MSVC, +# which needs '.lib'). +libext=a +ltmain="$ac_aux_dir/ltmain.sh" +ofile="$default_ofile" +with_gnu_ld="$lt_cv_prog_gnu_ld" + +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args. +set dummy ${ac_tool_prefix}ar; ac_word=$2 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_prog_AR+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$AR"; then + ac_cv_prog_AR="$AR" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_AR="${ac_tool_prefix}ar" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +fi +fi +AR=$ac_cv_prog_AR +if test -n "$AR"; then + { echo "$as_me:$LINENO: result: $AR" >&5 +echo "${ECHO_T}$AR" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_AR"; then + ac_ct_AR=$AR + # Extract the first word of "ar", so it can be a program name with args. +set dummy ar; ac_word=$2 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_prog_ac_ct_AR+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_AR"; then + ac_cv_prog_ac_ct_AR="$ac_ct_AR" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_AR="ar" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +fi +fi +ac_ct_AR=$ac_cv_prog_ac_ct_AR +if test -n "$ac_ct_AR"; then + { echo "$as_me:$LINENO: result: $ac_ct_AR" >&5 +echo "${ECHO_T}$ac_ct_AR" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + if test "x$ac_ct_AR" = x; then + AR="false" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools +whose name does not start with the host triplet. If you think this +configuration is useful to you, please write to autoconf@gnu.org." >&5 +echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools +whose name does not start with the host triplet. If you think this +configuration is useful to you, please write to autoconf@gnu.org." >&2;} +ac_tool_warned=yes ;; +esac + AR=$ac_ct_AR + fi +else + AR="$ac_cv_prog_AR" +fi + +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. +set dummy ${ac_tool_prefix}ranlib; ac_word=$2 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_prog_RANLIB+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$RANLIB"; then + ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +fi +fi +RANLIB=$ac_cv_prog_RANLIB +if test -n "$RANLIB"; then + { echo "$as_me:$LINENO: result: $RANLIB" >&5 +echo "${ECHO_T}$RANLIB" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_RANLIB"; then + ac_ct_RANLIB=$RANLIB + # Extract the first word of "ranlib", so it can be a program name with args. +set dummy ranlib; ac_word=$2 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_RANLIB"; then + ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_RANLIB="ranlib" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +fi +fi +ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB +if test -n "$ac_ct_RANLIB"; then + { echo "$as_me:$LINENO: result: $ac_ct_RANLIB" >&5 +echo "${ECHO_T}$ac_ct_RANLIB" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + if test "x$ac_ct_RANLIB" = x; then + RANLIB=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools +whose name does not start with the host triplet. If you think this +configuration is useful to you, please write to autoconf@gnu.org." >&5 +echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools +whose name does not start with the host triplet. If you think this +configuration is useful to you, please write to autoconf@gnu.org." >&2;} +ac_tool_warned=yes ;; +esac + RANLIB=$ac_ct_RANLIB + fi +else + RANLIB="$ac_cv_prog_RANLIB" +fi + +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. +set dummy ${ac_tool_prefix}strip; ac_word=$2 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_prog_STRIP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$STRIP"; then + ac_cv_prog_STRIP="$STRIP" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_STRIP="${ac_tool_prefix}strip" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +fi +fi +STRIP=$ac_cv_prog_STRIP +if test -n "$STRIP"; then + { echo "$as_me:$LINENO: result: $STRIP" >&5 +echo "${ECHO_T}$STRIP" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_STRIP"; then + ac_ct_STRIP=$STRIP + # Extract the first word of "strip", so it can be a program name with args. +set dummy strip; ac_word=$2 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_STRIP"; then + ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_STRIP="strip" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +fi +fi +ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP +if test -n "$ac_ct_STRIP"; then + { echo "$as_me:$LINENO: result: $ac_ct_STRIP" >&5 +echo "${ECHO_T}$ac_ct_STRIP" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + if test "x$ac_ct_STRIP" = x; then + STRIP=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools +whose name does not start with the host triplet. If you think this +configuration is useful to you, please write to autoconf@gnu.org." >&5 +echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools +whose name does not start with the host triplet. If you think this +configuration is useful to you, please write to autoconf@gnu.org." >&2;} +ac_tool_warned=yes ;; +esac + STRIP=$ac_ct_STRIP + fi +else + STRIP="$ac_cv_prog_STRIP" +fi + + +old_CC="$CC" +old_CFLAGS="$CFLAGS" + +# Set sane defaults for various variables +test -z "$AR" && AR=ar +test -z "$AR_FLAGS" && AR_FLAGS=cru +test -z "$AS" && AS=as +test -z "$CC" && CC=cc +test -z "$LTCC" && LTCC=$CC +test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS +test -z "$DLLTOOL" && DLLTOOL=dlltool +test -z "$LD" && LD=ld +test -z "$LN_S" && LN_S="ln -s" +test -z "$MAGIC_CMD" && MAGIC_CMD=file +test -z "$NM" && NM=nm +test -z "$SED" && SED=sed +test -z "$OBJDUMP" && OBJDUMP=objdump +test -z "$RANLIB" && RANLIB=: +test -z "$STRIP" && STRIP=: +test -z "$ac_objext" && ac_objext=o + +# Determine commands to create old-style static archives. +old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs' +old_postinstall_cmds='chmod 644 $oldlib' +old_postuninstall_cmds= + +if test -n "$RANLIB"; then + case $host_os in + openbsd*) + old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$oldlib" + ;; + *) + old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$oldlib" + ;; + esac + old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib" +fi + +for cc_temp in $compiler""; do + case $cc_temp in + compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; + distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; + \-*) ;; + *) break;; + esac +done +cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` + + +# Only perform the check for file, if the check method requires it +case $deplibs_check_method in +file_magic*) + if test "$file_magic_cmd" = '$MAGIC_CMD'; then + { echo "$as_me:$LINENO: checking for ${ac_tool_prefix}file" >&5 +echo $ECHO_N "checking for ${ac_tool_prefix}file... $ECHO_C" >&6; } +if test "${lt_cv_path_MAGIC_CMD+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + case $MAGIC_CMD in +[\\/*] | ?:[\\/]*) + lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. + ;; +*) + lt_save_MAGIC_CMD="$MAGIC_CMD" + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + ac_dummy="/usr/bin$PATH_SEPARATOR$PATH" + for ac_dir in $ac_dummy; do + IFS="$lt_save_ifs" + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/${ac_tool_prefix}file; then + lt_cv_path_MAGIC_CMD="$ac_dir/${ac_tool_prefix}file" + if test -n "$file_magic_test_file"; then + case $deplibs_check_method in + "file_magic "*) + file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` + MAGIC_CMD="$lt_cv_path_MAGIC_CMD" + if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | + $EGREP "$file_magic_regex" > /dev/null; then + : + else + cat <&2 + +*** Warning: the command libtool uses to detect shared libraries, +*** $file_magic_cmd, produces output that libtool cannot recognize. +*** The result is that libtool may fail to recognize shared libraries +*** as such. This will affect the creation of libtool libraries that +*** depend on shared libraries, but programs linked with such libtool +*** libraries will work regardless of this problem. Nevertheless, you +*** may want to report the problem to your system manager and/or to +*** bug-libtool@gnu.org + +EOF + fi ;; + esac + fi + break + fi + done + IFS="$lt_save_ifs" + MAGIC_CMD="$lt_save_MAGIC_CMD" + ;; +esac +fi + +MAGIC_CMD="$lt_cv_path_MAGIC_CMD" +if test -n "$MAGIC_CMD"; then + { echo "$as_me:$LINENO: result: $MAGIC_CMD" >&5 +echo "${ECHO_T}$MAGIC_CMD" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + +if test -z "$lt_cv_path_MAGIC_CMD"; then + if test -n "$ac_tool_prefix"; then + { echo "$as_me:$LINENO: checking for file" >&5 +echo $ECHO_N "checking for file... $ECHO_C" >&6; } +if test "${lt_cv_path_MAGIC_CMD+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + case $MAGIC_CMD in +[\\/*] | ?:[\\/]*) + lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. + ;; +*) + lt_save_MAGIC_CMD="$MAGIC_CMD" + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + ac_dummy="/usr/bin$PATH_SEPARATOR$PATH" + for ac_dir in $ac_dummy; do + IFS="$lt_save_ifs" + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/file; then + lt_cv_path_MAGIC_CMD="$ac_dir/file" + if test -n "$file_magic_test_file"; then + case $deplibs_check_method in + "file_magic "*) + file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` + MAGIC_CMD="$lt_cv_path_MAGIC_CMD" + if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | + $EGREP "$file_magic_regex" > /dev/null; then + : + else + cat <&2 + +*** Warning: the command libtool uses to detect shared libraries, +*** $file_magic_cmd, produces output that libtool cannot recognize. +*** The result is that libtool may fail to recognize shared libraries +*** as such. This will affect the creation of libtool libraries that +*** depend on shared libraries, but programs linked with such libtool +*** libraries will work regardless of this problem. Nevertheless, you +*** may want to report the problem to your system manager and/or to +*** bug-libtool@gnu.org + +EOF + fi ;; + esac + fi + break + fi + done + IFS="$lt_save_ifs" + MAGIC_CMD="$lt_save_MAGIC_CMD" + ;; +esac +fi + +MAGIC_CMD="$lt_cv_path_MAGIC_CMD" +if test -n "$MAGIC_CMD"; then + { echo "$as_me:$LINENO: result: $MAGIC_CMD" >&5 +echo "${ECHO_T}$MAGIC_CMD" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + else + MAGIC_CMD=: + fi +fi + + fi + ;; +esac + +enable_dlopen=no +enable_win32_dll=no + +# Check whether --enable-libtool-lock was given. +if test "${enable_libtool_lock+set}" = set; then + enableval=$enable_libtool_lock; +fi + +test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes + + +# Check whether --with-pic was given. +if test "${with_pic+set}" = set; then + withval=$with_pic; pic_mode="$withval" +else + pic_mode=default +fi + +test -z "$pic_mode" && pic_mode=default + +# Use C for the default configuration in the libtool script +tagname= +lt_save_CC="$CC" +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + +# Source file extension for C test sources. +ac_ext=c + +# Object file extension for compiled C test sources. +objext=o +objext=$objext + +# Code to be used in simple compile tests +lt_simple_compile_test_code="int some_variable = 0;" + +# Code to be used in simple link tests +lt_simple_link_test_code='int main(){return(0);}' + + +# If no C compiler was specified, use CC. +LTCC=${LTCC-"$CC"} + +# If no C compiler flags were specified, use CFLAGS. +LTCFLAGS=${LTCFLAGS-"$CFLAGS"} + +# Allow CC to be a program name with arguments. +compiler=$CC + + +# save warnings/boilerplate of simple test code +ac_outfile=conftest.$ac_objext +echo "$lt_simple_compile_test_code" >conftest.$ac_ext +eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err +_lt_compiler_boilerplate=`cat conftest.err` +$rm conftest* + +ac_outfile=conftest.$ac_objext +echo "$lt_simple_link_test_code" >conftest.$ac_ext +eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err +_lt_linker_boilerplate=`cat conftest.err` +$rm conftest* + + + +lt_prog_compiler_no_builtin_flag= + +if test "$GCC" = yes; then + lt_prog_compiler_no_builtin_flag=' -fno-builtin' + + +{ echo "$as_me:$LINENO: checking if $compiler supports -fno-rtti -fno-exceptions" >&5 +echo $ECHO_N "checking if $compiler supports -fno-rtti -fno-exceptions... $ECHO_C" >&6; } +if test "${lt_cv_prog_compiler_rtti_exceptions+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + lt_cv_prog_compiler_rtti_exceptions=no + ac_outfile=conftest.$ac_objext + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + lt_compiler_flag="-fno-rtti -fno-exceptions" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + # The option is referenced via a variable to avoid confusing sed. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ + -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:7142: $lt_compile\"" >&5) + (eval "$lt_compile" 2>conftest.err) + ac_status=$? + cat conftest.err >&5 + echo "$as_me:7146: \$? = $ac_status" >&5 + if (exit $ac_status) && test -s "$ac_outfile"; then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings other than the usual output. + $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp + $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 + if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then + lt_cv_prog_compiler_rtti_exceptions=yes + fi + fi + $rm conftest* + +fi +{ echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_rtti_exceptions" >&5 +echo "${ECHO_T}$lt_cv_prog_compiler_rtti_exceptions" >&6; } + +if test x"$lt_cv_prog_compiler_rtti_exceptions" = xyes; then + lt_prog_compiler_no_builtin_flag="$lt_prog_compiler_no_builtin_flag -fno-rtti -fno-exceptions" +else + : +fi + +fi + +lt_prog_compiler_wl= +lt_prog_compiler_pic= +lt_prog_compiler_static= + +{ echo "$as_me:$LINENO: checking for $compiler option to produce PIC" >&5 +echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6; } + + if test "$GCC" = yes; then + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_static='-static' + + case $host_os in + aix*) + # All AIX code is PIC. + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + lt_prog_compiler_static='-Bstatic' + fi + ;; + + amigaos*) + # FIXME: we need at least 68020 code to build shared libraries, but + # adding the `-m68020' flag to GCC prevents building anything better, + # like `-m68040'. + lt_prog_compiler_pic='-m68020 -resident32 -malways-restore-a4' + ;; + + beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) + # PIC is the default for these OSes. + ;; + + mingw* | cygwin* | pw32* | os2*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + # Although the cygwin gcc ignores -fPIC, still need this for old-style + # (--disable-auto-import) libraries + lt_prog_compiler_pic='-DDLL_EXPORT' + ;; + + darwin* | rhapsody*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + lt_prog_compiler_pic='-fno-common' + ;; + + interix[3-9]*) + # Interix 3.x gcc -fpic/-fPIC options generate broken code. + # Instead, we relocate shared libraries at runtime. + ;; + + msdosdjgpp*) + # Just because we use GCC doesn't mean we suddenly get shared libraries + # on systems that don't support them. + lt_prog_compiler_can_build_shared=no + enable_shared=no + ;; + + sysv4*MP*) + if test -d /usr/nec; then + lt_prog_compiler_pic=-Kconform_pic + fi + ;; + + hpux*) + # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but + # not for PA HP-UX. + case $host_cpu in + hppa*64*|ia64*) + # +Z the default + ;; + *) + lt_prog_compiler_pic='-fPIC' + ;; + esac + ;; + + *) + lt_prog_compiler_pic='-fPIC' + ;; + esac + else + # PORTME Check for flag to pass linker flags through the system compiler. + case $host_os in + aix*) + lt_prog_compiler_wl='-Wl,' + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + lt_prog_compiler_static='-Bstatic' + else + lt_prog_compiler_static='-bnso -bI:/lib/syscalls.exp' + fi + ;; + darwin*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + case $cc_basename in + xlc*) + lt_prog_compiler_pic='-qnocommon' + lt_prog_compiler_wl='-Wl,' + ;; + esac + ;; + + mingw* | cygwin* | pw32* | os2*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + lt_prog_compiler_pic='-DDLL_EXPORT' + ;; + + hpux9* | hpux10* | hpux11*) + lt_prog_compiler_wl='-Wl,' + # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but + # not for PA HP-UX. + case $host_cpu in + hppa*64*|ia64*) + # +Z the default + ;; + *) + lt_prog_compiler_pic='+Z' + ;; + esac + # Is there a better lt_prog_compiler_static that works with the bundled CC? + lt_prog_compiler_static='${wl}-a ${wl}archive' + ;; + + irix5* | irix6* | nonstopux*) + lt_prog_compiler_wl='-Wl,' + # PIC (with -KPIC) is the default. + lt_prog_compiler_static='-non_shared' + ;; + + newsos6) + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-Bstatic' + ;; + + linux* | k*bsd*-gnu) + case $cc_basename in + icc* | ecc*) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-static' + ;; + pgcc* | pgf77* | pgf90* | pgf95*) + # Portland Group compilers (*not* the Pentium gcc compiler, + # which looks to be a dead project) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='-fpic' + lt_prog_compiler_static='-Bstatic' + ;; + ccc*) + lt_prog_compiler_wl='-Wl,' + # All Alpha code is PIC. + lt_prog_compiler_static='-non_shared' + ;; + *) + case `$CC -V 2>&1 | sed 5q` in + *Sun\ C*) + # Sun C 5.9 + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-Bstatic' + lt_prog_compiler_wl='-Wl,' + ;; + *Sun\ F*) + # Sun Fortran 8.3 passes all unrecognized flags to the linker + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-Bstatic' + lt_prog_compiler_wl='' + ;; + esac + ;; + esac + ;; + + osf3* | osf4* | osf5*) + lt_prog_compiler_wl='-Wl,' + # All OSF/1 code is PIC. + lt_prog_compiler_static='-non_shared' + ;; + + rdos*) + lt_prog_compiler_static='-non_shared' + ;; + + solaris*) + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-Bstatic' + case $cc_basename in + f77* | f90* | f95*) + lt_prog_compiler_wl='-Qoption ld ';; + *) + lt_prog_compiler_wl='-Wl,';; + esac + ;; + + sunos4*) + lt_prog_compiler_wl='-Qoption ld ' + lt_prog_compiler_pic='-PIC' + lt_prog_compiler_static='-Bstatic' + ;; + + sysv4 | sysv4.2uw2* | sysv4.3*) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-Bstatic' + ;; + + sysv4*MP*) + if test -d /usr/nec ;then + lt_prog_compiler_pic='-Kconform_pic' + lt_prog_compiler_static='-Bstatic' + fi + ;; + + sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-Bstatic' + ;; + + unicos*) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_can_build_shared=no + ;; + + uts4*) + lt_prog_compiler_pic='-pic' + lt_prog_compiler_static='-Bstatic' + ;; + + *) + lt_prog_compiler_can_build_shared=no + ;; + esac + fi + +{ echo "$as_me:$LINENO: result: $lt_prog_compiler_pic" >&5 +echo "${ECHO_T}$lt_prog_compiler_pic" >&6; } + +# +# Check to make sure the PIC flag actually works. +# +if test -n "$lt_prog_compiler_pic"; then + +{ echo "$as_me:$LINENO: checking if $compiler PIC flag $lt_prog_compiler_pic works" >&5 +echo $ECHO_N "checking if $compiler PIC flag $lt_prog_compiler_pic works... $ECHO_C" >&6; } +if test "${lt_prog_compiler_pic_works+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + lt_prog_compiler_pic_works=no + ac_outfile=conftest.$ac_objext + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + lt_compiler_flag="$lt_prog_compiler_pic -DPIC" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + # The option is referenced via a variable to avoid confusing sed. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ + -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:7432: $lt_compile\"" >&5) + (eval "$lt_compile" 2>conftest.err) + ac_status=$? + cat conftest.err >&5 + echo "$as_me:7436: \$? = $ac_status" >&5 + if (exit $ac_status) && test -s "$ac_outfile"; then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings other than the usual output. + $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp + $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 + if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then + lt_prog_compiler_pic_works=yes + fi + fi + $rm conftest* + +fi +{ echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_works" >&5 +echo "${ECHO_T}$lt_prog_compiler_pic_works" >&6; } + +if test x"$lt_prog_compiler_pic_works" = xyes; then + case $lt_prog_compiler_pic in + "" | " "*) ;; + *) lt_prog_compiler_pic=" $lt_prog_compiler_pic" ;; + esac +else + lt_prog_compiler_pic= + lt_prog_compiler_can_build_shared=no +fi + +fi +case $host_os in + # For platforms which do not support PIC, -DPIC is meaningless: + *djgpp*) + lt_prog_compiler_pic= + ;; + *) + lt_prog_compiler_pic="$lt_prog_compiler_pic -DPIC" + ;; +esac + +# +# Check to make sure the static flag actually works. +# +wl=$lt_prog_compiler_wl eval lt_tmp_static_flag=\"$lt_prog_compiler_static\" +{ echo "$as_me:$LINENO: checking if $compiler static flag $lt_tmp_static_flag works" >&5 +echo $ECHO_N "checking if $compiler static flag $lt_tmp_static_flag works... $ECHO_C" >&6; } +if test "${lt_prog_compiler_static_works+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + lt_prog_compiler_static_works=no + save_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS $lt_tmp_static_flag" + echo "$lt_simple_link_test_code" > conftest.$ac_ext + if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then + # The linker can only warn and ignore the option if not recognized + # So say no if there are warnings + if test -s conftest.err; then + # Append any errors to the config.log. + cat conftest.err 1>&5 + $echo "X$_lt_linker_boilerplate" | $Xsed -e '/^$/d' > conftest.exp + $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 + if diff conftest.exp conftest.er2 >/dev/null; then + lt_prog_compiler_static_works=yes + fi + else + lt_prog_compiler_static_works=yes + fi + fi + $rm conftest* + LDFLAGS="$save_LDFLAGS" + +fi +{ echo "$as_me:$LINENO: result: $lt_prog_compiler_static_works" >&5 +echo "${ECHO_T}$lt_prog_compiler_static_works" >&6; } + +if test x"$lt_prog_compiler_static_works" = xyes; then + : +else + lt_prog_compiler_static= +fi + + +{ echo "$as_me:$LINENO: checking if $compiler supports -c -o file.$ac_objext" >&5 +echo $ECHO_N "checking if $compiler supports -c -o file.$ac_objext... $ECHO_C" >&6; } +if test "${lt_cv_prog_compiler_c_o+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + lt_cv_prog_compiler_c_o=no + $rm -r conftest 2>/dev/null + mkdir conftest + cd conftest + mkdir out + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + + lt_compiler_flag="-o out/conftest2.$ac_objext" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ + -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:7536: $lt_compile\"" >&5) + (eval "$lt_compile" 2>out/conftest.err) + ac_status=$? + cat out/conftest.err >&5 + echo "$as_me:7540: \$? = $ac_status" >&5 + if (exit $ac_status) && test -s out/conftest2.$ac_objext + then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' > out/conftest.exp + $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 + if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then + lt_cv_prog_compiler_c_o=yes + fi + fi + chmod u+w . 2>&5 + $rm conftest* + # SGI C++ compiler will create directory out/ii_files/ for + # template instantiation + test -d out/ii_files && $rm out/ii_files/* && rmdir out/ii_files + $rm out/* && rmdir out + cd .. + rmdir conftest + $rm conftest* + +fi +{ echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_c_o" >&5 +echo "${ECHO_T}$lt_cv_prog_compiler_c_o" >&6; } + + +hard_links="nottested" +if test "$lt_cv_prog_compiler_c_o" = no && test "$need_locks" != no; then + # do not overwrite the value of need_locks provided by the user + { echo "$as_me:$LINENO: checking if we can lock with hard links" >&5 +echo $ECHO_N "checking if we can lock with hard links... $ECHO_C" >&6; } + hard_links=yes + $rm conftest* + ln conftest.a conftest.b 2>/dev/null && hard_links=no + touch conftest.a + ln conftest.a conftest.b 2>&5 || hard_links=no + ln conftest.a conftest.b 2>/dev/null && hard_links=no + { echo "$as_me:$LINENO: result: $hard_links" >&5 +echo "${ECHO_T}$hard_links" >&6; } + if test "$hard_links" = no; then + { echo "$as_me:$LINENO: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5 +echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;} + need_locks=warn + fi +else + need_locks=no +fi + +{ echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5 +echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared libraries... $ECHO_C" >&6; } + + runpath_var= + allow_undefined_flag= + enable_shared_with_static_runtimes=no + archive_cmds= + archive_expsym_cmds= + old_archive_From_new_cmds= + old_archive_from_expsyms_cmds= + export_dynamic_flag_spec= + whole_archive_flag_spec= + thread_safe_flag_spec= + hardcode_libdir_flag_spec= + hardcode_libdir_flag_spec_ld= + hardcode_libdir_separator= + hardcode_direct=no + hardcode_minus_L=no + hardcode_shlibpath_var=unsupported + link_all_deplibs=unknown + hardcode_automatic=no + module_cmds= + module_expsym_cmds= + always_export_symbols=no + export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' + # include_expsyms should be a list of space-separated symbols to be *always* + # included in the symbol list + include_expsyms= + # exclude_expsyms can be an extended regexp of symbols to exclude + # it will be wrapped by ` (' and `)$', so one must not match beginning or + # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', + # as well as any symbol that contains `d'. + exclude_expsyms="_GLOBAL_OFFSET_TABLE_" + # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out + # platforms (ab)use it in PIC code, but their linkers get confused if + # the symbol is explicitly referenced. Since portable code cannot + # rely on this symbol name, it's probably fine to never include it in + # preloaded symbol tables. + extract_expsyms_cmds= + # Just being paranoid about ensuring that cc_basename is set. + for cc_temp in $compiler""; do + case $cc_temp in + compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; + distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; + \-*) ;; + *) break;; + esac +done +cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` + + case $host_os in + cygwin* | mingw* | pw32*) + # FIXME: the MSVC++ port hasn't been tested in a loooong time + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + if test "$GCC" != yes; then + with_gnu_ld=no + fi + ;; + interix*) + # we just hope/assume this is gcc and not c89 (= MSVC++) + with_gnu_ld=yes + ;; + openbsd*) + with_gnu_ld=no + ;; + esac + + ld_shlibs=yes + if test "$with_gnu_ld" = yes; then + # If archive_cmds runs LD, not CC, wlarc should be empty + wlarc='${wl}' + + # Set some defaults for GNU ld with shared library support. These + # are reset later if shared libraries are not supported. Putting them + # here allows them to be overridden if necessary. + runpath_var=LD_RUN_PATH + hardcode_libdir_flag_spec='${wl}--rpath ${wl}$libdir' + export_dynamic_flag_spec='${wl}--export-dynamic' + # ancient GNU ld didn't support --whole-archive et. al. + if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then + whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + else + whole_archive_flag_spec= + fi + supports_anon_versioning=no + case `$LD -v 2>/dev/null` in + *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 + *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... + *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... + *\ 2.11.*) ;; # other 2.11 versions + *) supports_anon_versioning=yes ;; + esac + + # See if GNU ld supports shared libraries. + case $host_os in + aix3* | aix4* | aix5*) + # On AIX/PPC, the GNU linker is very broken + if test "$host_cpu" != ia64; then + ld_shlibs=no + cat <&2 + +*** Warning: the GNU linker, at least up to release 2.9.1, is reported +*** to be unable to reliably create shared libraries on AIX. +*** Therefore, libtool is disabling shared libraries support. If you +*** really care for shared libraries, you may want to modify your PATH +*** so that a non-GNU linker is found, and then restart. + +EOF + fi + ;; + + amigaos*) + archive_cmds='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + + # Samuel A. Falvo II reports + # that the semantics of dynamic libraries on AmigaOS, at least up + # to version 4, is to share data among multiple programs linked + # with the same dynamic library. Since this doesn't match the + # behavior of shared libraries on other platforms, we can't use + # them. + ld_shlibs=no + ;; + + beos*) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + allow_undefined_flag=unsupported + # Joseph Beckenbach says some releases of gcc + # support --undefined. This deserves some investigation. FIXME + archive_cmds='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + else + ld_shlibs=no + fi + ;; + + cygwin* | mingw* | pw32*) + # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, ) is actually meaningless, + # as there is no search path for DLLs. + hardcode_libdir_flag_spec='-L$libdir' + allow_undefined_flag=unsupported + always_export_symbols=no + enable_shared_with_static_runtimes=yes + export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/'\'' -e '\''/^[AITW][ ]/s/.*[ ]//'\'' | sort | uniq > $export_symbols' + + if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' + # If the export-symbols file already is a .def file (1st line + # is EXPORTS), use it as is; otherwise, prepend... + archive_expsym_cmds='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then + cp $export_symbols $output_objdir/$soname.def; + else + echo EXPORTS > $output_objdir/$soname.def; + cat $export_symbols >> $output_objdir/$soname.def; + fi~ + $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' + else + ld_shlibs=no + fi + ;; + + interix[3-9]*) + hardcode_direct=no + hardcode_shlibpath_var=no + hardcode_libdir_flag_spec='${wl}-rpath,$libdir' + export_dynamic_flag_spec='${wl}-E' + # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. + # Instead, shared libraries are loaded at an image base (0x10000000 by + # default) and relocated if they conflict, which is a slow very memory + # consuming and fragmenting process. To avoid this, we pick a random, + # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link + # time. Moving up from 0x10000000 also allows more sbrk(2) space. + archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' + archive_expsym_cmds='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' + ;; + + gnu* | linux* | k*bsd*-gnu) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + tmp_addflag= + case $cc_basename,$host_cpu in + pgcc*) # Portland Group C compiler + whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' + tmp_addflag=' $pic_flag' + ;; + pgf77* | pgf90* | pgf95*) # Portland Group f77 and f90 compilers + whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' + tmp_addflag=' $pic_flag -Mnomain' ;; + ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 + tmp_addflag=' -i_dynamic' ;; + efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 + tmp_addflag=' -i_dynamic -nofor_main' ;; + ifc* | ifort*) # Intel Fortran compiler + tmp_addflag=' -nofor_main' ;; + esac + case `$CC -V 2>&1 | sed 5q` in + *Sun\ C*) # Sun C 5.9 + whole_archive_flag_spec='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' + tmp_sharedflag='-G' ;; + *Sun\ F*) # Sun Fortran 8.3 + tmp_sharedflag='-G' ;; + *) + tmp_sharedflag='-shared' ;; + esac + archive_cmds='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + + if test $supports_anon_versioning = yes; then + archive_expsym_cmds='$echo "{ global:" > $output_objdir/$libname.ver~ + cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ + $echo "local: *; };" >> $output_objdir/$libname.ver~ + $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' + fi + link_all_deplibs=no + else + ld_shlibs=no + fi + ;; + + netbsd* | netbsdelf*-gnu) + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' + wlarc= + else + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + fi + ;; + + solaris*) + if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then + ld_shlibs=no + cat <&2 + +*** Warning: The releases 2.8.* of the GNU linker cannot reliably +*** create shared libraries on Solaris systems. Therefore, libtool +*** is disabling shared libraries support. We urge you to upgrade GNU +*** binutils to release 2.9.1 or newer. Another option is to modify +*** your PATH or compiler configuration so that the native linker is +*** used, and then restart. + +EOF + elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + ld_shlibs=no + fi + ;; + + sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*) + case `$LD -v 2>&1` in + *\ [01].* | *\ 2.[0-9].* | *\ 2.1[0-5].*) + ld_shlibs=no + cat <<_LT_EOF 1>&2 + +*** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not +*** reliably create shared libraries on SCO systems. Therefore, libtool +*** is disabling shared libraries support. We urge you to upgrade GNU +*** binutils to release 2.16.91.0.3 or newer. Another option is to modify +*** your PATH or compiler configuration so that the native linker is +*** used, and then restart. + +_LT_EOF + ;; + *) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + hardcode_libdir_flag_spec='`test -z "$SCOABSPATH" && echo ${wl}-rpath,$libdir`' + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib' + archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname,\${SCOABSPATH:+${install_libdir}/}$soname,-retain-symbols-file,$export_symbols -o $lib' + else + ld_shlibs=no + fi + ;; + esac + ;; + + sunos4*) + archive_cmds='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' + wlarc= + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + *) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + ld_shlibs=no + fi + ;; + esac + + if test "$ld_shlibs" = no; then + runpath_var= + hardcode_libdir_flag_spec= + export_dynamic_flag_spec= + whole_archive_flag_spec= + fi + else + # PORTME fill in a description of your system's linker (not GNU ld) + case $host_os in + aix3*) + allow_undefined_flag=unsupported + always_export_symbols=yes + archive_expsym_cmds='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' + # Note: this linker hardcodes the directories in LIBPATH if there + # are no directories specified by -L. + hardcode_minus_L=yes + if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then + # Neither direct hardcoding nor static linking is supported with a + # broken collect2. + hardcode_direct=unsupported + fi + ;; + + aix4* | aix5*) + if test "$host_cpu" = ia64; then + # On IA64, the linker does run time linking by default, so we don't + # have to do anything special. + aix_use_runtimelinking=no + exp_sym_flag='-Bexport' + no_entry_flag="" + else + # If we're using GNU nm, then we don't want the "-C" option. + # -C means demangle to AIX nm, but means don't demangle with GNU nm + if $NM -V 2>&1 | grep 'GNU' > /dev/null; then + export_symbols_cmds='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' + else + export_symbols_cmds='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' + fi + aix_use_runtimelinking=no + + # Test if we are trying to use run time linking or normal + # AIX style linking. If -brtl is somewhere in LDFLAGS, we + # need to do runtime linking. + case $host_os in aix4.[23]|aix4.[23].*|aix5*) + for ld_flag in $LDFLAGS; do + if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then + aix_use_runtimelinking=yes + break + fi + done + ;; + esac + + exp_sym_flag='-bexport' + no_entry_flag='-bnoentry' + fi + + # When large executables or shared objects are built, AIX ld can + # have problems creating the table of contents. If linking a library + # or program results in "error TOC overflow" add -mminimal-toc to + # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not + # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. + + archive_cmds='' + hardcode_direct=yes + hardcode_libdir_separator=':' + link_all_deplibs=yes + + if test "$GCC" = yes; then + case $host_os in aix4.[012]|aix4.[012].*) + # We only want to do this on AIX 4.2 and lower, the check + # below for broken collect2 doesn't work under 4.3+ + collect2name=`${CC} -print-prog-name=collect2` + if test -f "$collect2name" && \ + strings "$collect2name" | grep resolve_lib_name >/dev/null + then + # We have reworked collect2 + : + else + # We have old collect2 + hardcode_direct=unsupported + # It fails to find uninstalled libraries when the uninstalled + # path is not listed in the libpath. Setting hardcode_minus_L + # to unsupported forces relinking + hardcode_minus_L=yes + hardcode_libdir_flag_spec='-L$libdir' + hardcode_libdir_separator= + fi + ;; + esac + shared_flag='-shared' + if test "$aix_use_runtimelinking" = yes; then + shared_flag="$shared_flag "'${wl}-G' + fi + else + # not using gcc + if test "$host_cpu" = ia64; then + # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release + # chokes on -Wl,-G. The following line is correct: + shared_flag='-G' + else + if test "$aix_use_runtimelinking" = yes; then + shared_flag='${wl}-G' + else + shared_flag='${wl}-bM:SRE' + fi + fi + fi + + # It seems that -bexpall does not export symbols beginning with + # underscore (_), so it is better to generate a list of symbols to export. + always_export_symbols=yes + if test "$aix_use_runtimelinking" = yes; then + # Warning - without using the other runtime loading flags (-brtl), + # -berok will link without error, but may produce a broken library. + allow_undefined_flag='-berok' + # Determine the default libpath from the value encoded in an empty executable. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then + +lt_aix_libpath_sed=' + /Import File Strings/,/^$/ { + /^0/ { + s/^0 *\(.*\)$/\1/ + p + } + }' +aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` +# Check for a 64-bit object if we didn't find anything. +if test -z "$aix_libpath"; then + aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` +fi +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + +fi + +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext +if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi + + hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" + archive_expsym_cmds="\$CC"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" + else + if test "$host_cpu" = ia64; then + hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib' + allow_undefined_flag="-z nodefs" + archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" + else + # Determine the default libpath from the value encoded in an empty executable. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then + +lt_aix_libpath_sed=' + /Import File Strings/,/^$/ { + /^0/ { + s/^0 *\(.*\)$/\1/ + p + } + }' +aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` +# Check for a 64-bit object if we didn't find anything. +if test -z "$aix_libpath"; then + aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` +fi +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + +fi + +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext +if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi + + hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" + # Warning - without using the other run time loading flags, + # -berok will link without error, but may produce a broken library. + no_undefined_flag=' ${wl}-bernotok' + allow_undefined_flag=' ${wl}-berok' + # Exported symbols can be pulled into shared objects from archives + whole_archive_flag_spec='$convenience' + archive_cmds_need_lc=yes + # This is similar to how AIX traditionally builds its shared libraries. + archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' + fi + fi + ;; + + amigaos*) + archive_cmds='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + # see comment about different semantics on the GNU ld section + ld_shlibs=no + ;; + + bsdi[45]*) + export_dynamic_flag_spec=-rdynamic + ;; + + cygwin* | mingw* | pw32*) + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + # hardcode_libdir_flag_spec is actually meaningless, as there is + # no search path for DLLs. + hardcode_libdir_flag_spec=' ' + allow_undefined_flag=unsupported + # Tell ltmain to make .lib files, not .a files. + libext=lib + # Tell ltmain to make .dll files, not .so files. + shrext_cmds=".dll" + # FIXME: Setting linknames here is a bad hack. + archive_cmds='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | $SED -e '\''s/ -lc$//'\''` -link -dll~linknames=' + # The linker will automatically build a .lib file if we build a DLL. + old_archive_From_new_cmds='true' + # FIXME: Should let the user specify the lib program. + old_archive_cmds='lib -OUT:$oldlib$oldobjs$old_deplibs' + fix_srcfile_path='`cygpath -w "$srcfile"`' + enable_shared_with_static_runtimes=yes + ;; + + darwin* | rhapsody*) + case $host_os in + rhapsody* | darwin1.[012]) + allow_undefined_flag='${wl}-undefined ${wl}suppress' + ;; + *) # Darwin 1.3 on + if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then + allow_undefined_flag='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' + else + case ${MACOSX_DEPLOYMENT_TARGET} in + 10.[012]) + allow_undefined_flag='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' + ;; + 10.*) + allow_undefined_flag='${wl}-undefined ${wl}dynamic_lookup' + ;; + esac + fi + ;; + esac + archive_cmds_need_lc=no + hardcode_direct=no + hardcode_automatic=yes + hardcode_shlibpath_var=unsupported + whole_archive_flag_spec='' + link_all_deplibs=yes + if test "$GCC" = yes ; then + output_verbose_link_cmd='echo' + archive_cmds='$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring' + module_cmds='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' + # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds + archive_expsym_cmds='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + module_expsym_cmds='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + else + case $cc_basename in + xlc*) + output_verbose_link_cmd='echo' + archive_cmds='$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $xlcverstring' + module_cmds='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' + # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds + archive_expsym_cmds='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $xlcverstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + module_expsym_cmds='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + ;; + *) + ld_shlibs=no + ;; + esac + fi + ;; + + dgux*) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_shlibpath_var=no + ;; + + freebsd1*) + ld_shlibs=no + ;; + + # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor + # support. Future versions do this automatically, but an explicit c++rt0.o + # does not break anything, and helps significantly (at the cost of a little + # extra space). + freebsd2.2*) + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + # Unfortunately, older versions of FreeBSD 2 do not have this feature. + freebsd2*) + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=yes + hardcode_minus_L=yes + hardcode_shlibpath_var=no + ;; + + # FreeBSD 3 and greater uses gcc -shared to do shared libraries. + freebsd* | dragonfly*) + archive_cmds='$CC -shared -o $lib $libobjs $deplibs $compiler_flags' + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + hpux9*) + if test "$GCC" = yes; then + archive_cmds='$rm $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + else + archive_cmds='$rm $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + fi + hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' + hardcode_libdir_separator=: + hardcode_direct=yes + + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + hardcode_minus_L=yes + export_dynamic_flag_spec='${wl}-E' + ;; + + hpux10*) + if test "$GCC" = yes -a "$with_gnu_ld" = no; then + archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' + else + archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' + fi + if test "$with_gnu_ld" = no; then + hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' + hardcode_libdir_separator=: + + hardcode_direct=yes + export_dynamic_flag_spec='${wl}-E' + + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + hardcode_minus_L=yes + fi + ;; + + hpux11*) + if test "$GCC" = yes -a "$with_gnu_ld" = no; then + case $host_cpu in + hppa*64*) + archive_cmds='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + ia64*) + archive_cmds='$CC -shared ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' + ;; + *) + archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' + ;; + esac + else + case $host_cpu in + hppa*64*) + archive_cmds='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + ia64*) + archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' + ;; + *) + archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' + ;; + esac + fi + if test "$with_gnu_ld" = no; then + hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' + hardcode_libdir_separator=: + + case $host_cpu in + hppa*64*|ia64*) + hardcode_libdir_flag_spec_ld='+b $libdir' + hardcode_direct=no + hardcode_shlibpath_var=no + ;; + *) + hardcode_direct=yes + export_dynamic_flag_spec='${wl}-E' + + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + hardcode_minus_L=yes + ;; + esac + fi + ;; + + irix5* | irix6* | nonstopux*) + if test "$GCC" = yes; then + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + else + archive_cmds='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + hardcode_libdir_flag_spec_ld='-rpath $libdir' + fi + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator=: + link_all_deplibs=yes + ;; + + netbsd* | netbsdelf*-gnu) + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out + else + archive_cmds='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF + fi + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + newsos6) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=yes + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator=: + hardcode_shlibpath_var=no + ;; + + openbsd*) + if test -f /usr/libexec/ld.so; then + hardcode_direct=yes + hardcode_shlibpath_var=no + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols' + hardcode_libdir_flag_spec='${wl}-rpath,$libdir' + export_dynamic_flag_spec='${wl}-E' + else + case $host_os in + openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*) + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec='-R$libdir' + ;; + *) + archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + hardcode_libdir_flag_spec='${wl}-rpath,$libdir' + ;; + esac + fi + else + ld_shlibs=no + fi + ;; + + os2*) + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + allow_undefined_flag=unsupported + archive_cmds='$echo "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$echo DATA >> $output_objdir/$libname.def~$echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~$echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' + old_archive_From_new_cmds='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' + ;; + + osf3*) + if test "$GCC" = yes; then + allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' + archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + else + allow_undefined_flag=' -expect_unresolved \*' + archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + fi + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator=: + ;; + + osf4* | osf5*) # as osf3* with the addition of -msym flag + if test "$GCC" = yes; then + allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' + archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + else + allow_undefined_flag=' -expect_unresolved \*' + archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + archive_expsym_cmds='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~ + $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib~$rm $lib.exp' + + # Both c and cxx compiler support -rpath directly + hardcode_libdir_flag_spec='-rpath $libdir' + fi + hardcode_libdir_separator=: + ;; + + solaris*) + no_undefined_flag=' -z text' + if test "$GCC" = yes; then + wlarc='${wl}' + archive_cmds='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $CC -shared ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$rm $lib.exp' + else + wlarc='' + archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' + archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' + fi + hardcode_libdir_flag_spec='-R$libdir' + hardcode_shlibpath_var=no + case $host_os in + solaris2.[0-5] | solaris2.[0-5].*) ;; + *) + # The compiler driver will combine and reorder linker options, + # but understands `-z linker_flag'. GCC discards it without `$wl', + # but is careful enough not to reorder. + # Supported since Solaris 2.6 (maybe 2.5.1?) + if test "$GCC" = yes; then + whole_archive_flag_spec='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' + else + whole_archive_flag_spec='-z allextract$convenience -z defaultextract' + fi + ;; + esac + link_all_deplibs=yes + ;; + + sunos4*) + if test "x$host_vendor" = xsequent; then + # Use $CC to link under sequent, because it throws in some extra .o + # files that make .init and .fini sections work. + archive_cmds='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' + else + archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' + fi + hardcode_libdir_flag_spec='-L$libdir' + hardcode_direct=yes + hardcode_minus_L=yes + hardcode_shlibpath_var=no + ;; + + sysv4) + case $host_vendor in + sni) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=yes # is this really true??? + ;; + siemens) + ## LD is ld it makes a PLAMLIB + ## CC just makes a GrossModule. + archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags' + reload_cmds='$CC -r -o $output$reload_objs' + hardcode_direct=no + ;; + motorola) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=no #Motorola manual says yes, but my tests say they lie + ;; + esac + runpath_var='LD_RUN_PATH' + hardcode_shlibpath_var=no + ;; + + sysv4.3*) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_shlibpath_var=no + export_dynamic_flag_spec='-Bexport' + ;; + + sysv4*MP*) + if test -d /usr/nec; then + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_shlibpath_var=no + runpath_var=LD_RUN_PATH + hardcode_runpath_var=yes + ld_shlibs=yes + fi + ;; + + sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*) + no_undefined_flag='${wl}-z,text' + archive_cmds_need_lc=no + hardcode_shlibpath_var=no + runpath_var='LD_RUN_PATH' + + if test "$GCC" = yes; then + archive_cmds='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + else + archive_cmds='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + fi + ;; + + sysv5* | sco3.2v5* | sco5v6*) + # Note: We can NOT use -z defs as we might desire, because we do not + # link with -lc, and that would cause any symbols used from libc to + # always be unresolved, which means just about no library would + # ever link correctly. If we're not using GNU ld we use -z text + # though, which does catch some bad symbols but isn't as heavy-handed + # as -z defs. + no_undefined_flag='${wl}-z,text' + allow_undefined_flag='${wl}-z,nodefs' + archive_cmds_need_lc=no + hardcode_shlibpath_var=no + hardcode_libdir_flag_spec='`test -z "$SCOABSPATH" && echo ${wl}-R,$libdir`' + hardcode_libdir_separator=':' + link_all_deplibs=yes + export_dynamic_flag_spec='${wl}-Bexport' + runpath_var='LD_RUN_PATH' + + if test "$GCC" = yes; then + archive_cmds='$CC -shared ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' + else + archive_cmds='$CC -G ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' + fi + ;; + + uts4*) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_shlibpath_var=no + ;; + + *) + ld_shlibs=no + ;; + esac + fi + +{ echo "$as_me:$LINENO: result: $ld_shlibs" >&5 +echo "${ECHO_T}$ld_shlibs" >&6; } +test "$ld_shlibs" = no && can_build_shared=no + +# +# Do we need to explicitly link libc? +# +case "x$archive_cmds_need_lc" in +x|xyes) + # Assume -lc should be added + archive_cmds_need_lc=yes + + if test "$enable_shared" = yes && test "$GCC" = yes; then + case $archive_cmds in + *'~'*) + # FIXME: we may have to deal with multi-command sequences. + ;; + '$CC '*) + # Test whether the compiler implicitly links with -lc since on some + # systems, -lgcc has to come before -lc. If gcc already passes -lc + # to ld, don't add -lc before -lgcc. + { echo "$as_me:$LINENO: checking whether -lc should be explicitly linked in" >&5 +echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >&6; } + $rm conftest* + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + + if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } 2>conftest.err; then + soname=conftest + lib=conftest + libobjs=conftest.$ac_objext + deplibs= + wl=$lt_prog_compiler_wl + pic_flag=$lt_prog_compiler_pic + compiler_flags=-v + linker_flags=-v + verstring= + output_objdir=. + libname=conftest + lt_save_allow_undefined_flag=$allow_undefined_flag + allow_undefined_flag= + if { (eval echo "$as_me:$LINENO: \"$archive_cmds 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1\"") >&5 + (eval $archive_cmds 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } + then + archive_cmds_need_lc=no + else + archive_cmds_need_lc=yes + fi + allow_undefined_flag=$lt_save_allow_undefined_flag + else + cat conftest.err 1>&5 + fi + $rm conftest* + { echo "$as_me:$LINENO: result: $archive_cmds_need_lc" >&5 +echo "${ECHO_T}$archive_cmds_need_lc" >&6; } + ;; + esac + fi + ;; +esac + +{ echo "$as_me:$LINENO: checking dynamic linker characteristics" >&5 +echo $ECHO_N "checking dynamic linker characteristics... $ECHO_C" >&6; } +library_names_spec= +libname_spec='lib$name' +soname_spec= +shrext_cmds=".so" +postinstall_cmds= +postuninstall_cmds= +finish_cmds= +finish_eval= +shlibpath_var= +shlibpath_overrides_runpath=unknown +version_type=none +dynamic_linker="$host_os ld.so" +sys_lib_dlsearch_path_spec="/lib /usr/lib" + +if test "$GCC" = yes; then + case $host_os in + darwin*) lt_awk_arg="/^libraries:/,/LR/" ;; + *) lt_awk_arg="/^libraries:/" ;; + esac + lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e "s,=/,/,g"` + if echo "$lt_search_path_spec" | grep ';' >/dev/null ; then + # if the path contains ";" then we assume it to be the separator + # otherwise default to the standard path separator (i.e. ":") - it is + # assumed that no part of a normal pathname contains ";" but that should + # okay in the real world where ";" in dirpaths is itself problematic. + lt_search_path_spec=`echo "$lt_search_path_spec" | $SED -e 's/;/ /g'` + else + lt_search_path_spec=`echo "$lt_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + fi + # Ok, now we have the path, separated by spaces, we can step through it + # and add multilib dir if necessary. + lt_tmp_lt_search_path_spec= + lt_multi_os_dir=`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null` + for lt_sys_path in $lt_search_path_spec; do + if test -d "$lt_sys_path/$lt_multi_os_dir"; then + lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path/$lt_multi_os_dir" + else + test -d "$lt_sys_path" && \ + lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path" + fi + done + lt_search_path_spec=`echo $lt_tmp_lt_search_path_spec | awk ' +BEGIN {RS=" "; FS="/|\n";} { + lt_foo=""; + lt_count=0; + for (lt_i = NF; lt_i > 0; lt_i--) { + if ($lt_i != "" && $lt_i != ".") { + if ($lt_i == "..") { + lt_count++; + } else { + if (lt_count == 0) { + lt_foo="/" $lt_i lt_foo; + } else { + lt_count--; + } + } + } + } + if (lt_foo != "") { lt_freq[lt_foo]++; } + if (lt_freq[lt_foo] == 1) { print lt_foo; } +}'` + sys_lib_search_path_spec=`echo $lt_search_path_spec` +else + sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" +fi +need_lib_prefix=unknown +hardcode_into_libs=no + +# when you set need_version to no, make sure it does not cause -set_version +# flags to be left without arguments +need_version=unknown + +case $host_os in +aix3*) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' + shlibpath_var=LIBPATH + + # AIX 3 has no versioning support, so we append a major version to the name. + soname_spec='${libname}${release}${shared_ext}$major' + ;; + +aix4* | aix5*) + version_type=linux + need_lib_prefix=no + need_version=no + hardcode_into_libs=yes + if test "$host_cpu" = ia64; then + # AIX 5 supports IA64 + library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + else + # With GCC up to 2.95.x, collect2 would create an import file + # for dependence libraries. The import file would start with + # the line `#! .'. This would cause the generated library to + # depend on `.', always an invalid library. This was fixed in + # development snapshots of GCC prior to 3.0. + case $host_os in + aix4 | aix4.[01] | aix4.[01].*) + if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' + echo ' yes ' + echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then + : + else + can_build_shared=no + fi + ;; + esac + # AIX (on Power*) has no versioning support, so currently we can not hardcode correct + # soname into executable. Probably we can add versioning support to + # collect2, so additional links can be useful in future. + if test "$aix_use_runtimelinking" = yes; then + # If using run time linking (on AIX 4.2 or later) use lib.so + # instead of lib.a to let people know that these are not + # typical AIX shared libraries. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + else + # We preserve .a as extension for shared libraries through AIX4.2 + # and later when we are not doing run time linking. + library_names_spec='${libname}${release}.a $libname.a' + soname_spec='${libname}${release}${shared_ext}$major' + fi + shlibpath_var=LIBPATH + fi + ;; + +amigaos*) + library_names_spec='$libname.ixlibrary $libname.a' + # Create ${libname}_ixlibrary.a entries in /sys/libs. + finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' + ;; + +beos*) + library_names_spec='${libname}${shared_ext}' + dynamic_linker="$host_os ld.so" + shlibpath_var=LIBRARY_PATH + ;; + +bsdi[45]*) + version_type=linux + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' + shlibpath_var=LD_LIBRARY_PATH + sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" + sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" + # the default ld.so.conf also contains /usr/contrib/lib and + # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow + # libtool to hard-code these into programs + ;; + +cygwin* | mingw* | pw32*) + version_type=windows + shrext_cmds=".dll" + need_version=no + need_lib_prefix=no + + case $GCC,$host_os in + yes,cygwin* | yes,mingw* | yes,pw32*) + library_names_spec='$libname.dll.a' + # DLL is installed to $(libdir)/../bin by postinstall_cmds + postinstall_cmds='base_file=`basename \${file}`~ + dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i;echo \$dlname'\''`~ + dldir=$destdir/`dirname \$dlpath`~ + test -d \$dldir || mkdir -p \$dldir~ + $install_prog $dir/$dlname \$dldir/$dlname~ + chmod a+x \$dldir/$dlname' + postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ + dlpath=$dir/\$dldll~ + $rm \$dlpath' + shlibpath_overrides_runpath=yes + + case $host_os in + cygwin*) + # Cygwin DLLs use 'cyg' prefix rather than 'lib' + soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' + sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib" + ;; + mingw*) + # MinGW DLLs use traditional 'lib' prefix + soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' + sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` + if echo "$sys_lib_search_path_spec" | grep ';[c-zC-Z]:/' >/dev/null; then + # It is most probably a Windows format PATH printed by + # mingw gcc, but we are running on Cygwin. Gcc prints its search + # path with ; separators, and with drive letters. We can handle the + # drive letters (cygwin fileutils understands them), so leave them, + # especially as we might pass files found there to a mingw objdump, + # which wouldn't understand a cygwinified path. Ahh. + sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` + else + sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + fi + ;; + pw32*) + # pw32 DLLs use 'pw' prefix rather than 'lib' + library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' + ;; + esac + ;; + + *) + library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib' + ;; + esac + dynamic_linker='Win32 ld.exe' + # FIXME: first we should search . and the directory the executable is in + shlibpath_var=PATH + ;; + +darwin* | rhapsody*) + dynamic_linker="$host_os dyld" + version_type=darwin + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${versuffix}$shared_ext ${libname}${release}${major}$shared_ext ${libname}$shared_ext' + soname_spec='${libname}${release}${major}$shared_ext' + shlibpath_overrides_runpath=yes + shlibpath_var=DYLD_LIBRARY_PATH + shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' + + sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib" + sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' + ;; + +dgux*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +freebsd1*) + dynamic_linker=no + ;; + +freebsd* | dragonfly*) + # DragonFly does not have aout. When/if they implement a new + # versioning mechanism, adjust this. + if test -x /usr/bin/objformat; then + objformat=`/usr/bin/objformat` + else + case $host_os in + freebsd[123]*) objformat=aout ;; + *) objformat=elf ;; + esac + fi + version_type=freebsd-$objformat + case $version_type in + freebsd-elf*) + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' + need_version=no + need_lib_prefix=no + ;; + freebsd-*) + library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' + need_version=yes + ;; + esac + shlibpath_var=LD_LIBRARY_PATH + case $host_os in + freebsd2*) + shlibpath_overrides_runpath=yes + ;; + freebsd3.[01]* | freebsdelf3.[01]*) + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + freebsd3.[2-9]* | freebsdelf3.[2-9]* | \ + freebsd4.[0-5] | freebsdelf4.[0-5] | freebsd4.1.1 | freebsdelf4.1.1) + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + *) # from 4.6 on, and DragonFly + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + esac + ;; + +gnu*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + hardcode_into_libs=yes + ;; + +hpux9* | hpux10* | hpux11*) + # Give a soname corresponding to the major version so that dld.sl refuses to + # link against other versions. + version_type=sunos + need_lib_prefix=no + need_version=no + case $host_cpu in + ia64*) + shrext_cmds='.so' + hardcode_into_libs=yes + dynamic_linker="$host_os dld.so" + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + if test "X$HPUX_IA64_MODE" = X32; then + sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" + else + sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" + fi + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + ;; + hppa*64*) + shrext_cmds='.sl' + hardcode_into_libs=yes + dynamic_linker="$host_os dld.sl" + shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH + shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + ;; + *) + shrext_cmds='.sl' + dynamic_linker="$host_os dld.sl" + shlibpath_var=SHLIB_PATH + shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + ;; + esac + # HP-UX runs *really* slowly unless shared libraries are mode 555. + postinstall_cmds='chmod 555 $lib' + ;; + +interix[3-9]*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + +irix5* | irix6* | nonstopux*) + case $host_os in + nonstopux*) version_type=nonstopux ;; + *) + if test "$lt_cv_prog_gnu_ld" = yes; then + version_type=linux + else + version_type=irix + fi ;; + esac + need_lib_prefix=no + need_version=no + soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' + case $host_os in + irix5* | nonstopux*) + libsuff= shlibsuff= + ;; + *) + case $LD in # libtool.m4 will add one of these switches to LD + *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") + libsuff= shlibsuff= libmagic=32-bit;; + *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") + libsuff=32 shlibsuff=N32 libmagic=N32;; + *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") + libsuff=64 shlibsuff=64 libmagic=64-bit;; + *) libsuff= shlibsuff= libmagic=never-match;; + esac + ;; + esac + shlibpath_var=LD_LIBRARY${shlibsuff}_PATH + shlibpath_overrides_runpath=no + sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" + sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" + hardcode_into_libs=yes + ;; + +# No shared lib support for Linux oldld, aout, or coff. +linux*oldld* | linux*aout* | linux*coff*) + dynamic_linker=no + ;; + +# This must be Linux ELF. +linux* | k*bsd*-gnu) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + # This implies no fast_install, which is unacceptable. + # Some rework will be needed to allow for fast_install + # before this can be enabled. + hardcode_into_libs=yes + + # Append ld.so.conf contents to the search path + if test -f /etc/ld.so.conf; then + lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` + sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" + fi + + # We used to test for /lib/ld.so.1 and disable shared libraries on + # powerpc, because MkLinux only supported shared libraries with the + # GNU dynamic linker. Since this was broken with cross compilers, + # most powerpc-linux boxes support dynamic linking these days and + # people can always --disable-shared, the test was removed, and we + # assume the GNU/Linux dynamic linker is in use. + dynamic_linker='GNU/Linux ld.so' + ;; + +netbsdelf*-gnu) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + dynamic_linker='NetBSD ld.elf_so' + ;; + +netbsd*) + version_type=sunos + need_lib_prefix=no + need_version=no + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + dynamic_linker='NetBSD (a.out) ld.so' + else + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + dynamic_linker='NetBSD ld.elf_so' + fi + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + +newsos6) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + ;; + +nto-qnx*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + ;; + +openbsd*) + version_type=sunos + sys_lib_dlsearch_path_spec="/usr/lib" + need_lib_prefix=no + # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. + case $host_os in + openbsd3.3 | openbsd3.3.*) need_version=yes ;; + *) need_version=no ;; + esac + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + shlibpath_var=LD_LIBRARY_PATH + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + case $host_os in + openbsd2.[89] | openbsd2.[89].*) + shlibpath_overrides_runpath=no + ;; + *) + shlibpath_overrides_runpath=yes + ;; + esac + else + shlibpath_overrides_runpath=yes + fi + ;; + +os2*) + libname_spec='$name' + shrext_cmds=".dll" + need_lib_prefix=no + library_names_spec='$libname${shared_ext} $libname.a' + dynamic_linker='OS/2 ld.exe' + shlibpath_var=LIBPATH + ;; + +osf3* | osf4* | osf5*) + version_type=osf + need_lib_prefix=no + need_version=no + soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" + sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" + ;; + +rdos*) + dynamic_linker=no + ;; + +solaris*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + # ldd complains unless libraries are executable + postinstall_cmds='chmod +x $lib' + ;; + +sunos4*) + version_type=sunos + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + if test "$with_gnu_ld" = yes; then + need_lib_prefix=no + fi + need_version=yes + ;; + +sysv4 | sysv4.3*) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + case $host_vendor in + sni) + shlibpath_overrides_runpath=no + need_lib_prefix=no + export_dynamic_flag_spec='${wl}-Blargedynsym' + runpath_var=LD_RUN_PATH + ;; + siemens) + need_lib_prefix=no + ;; + motorola) + need_lib_prefix=no + need_version=no + shlibpath_overrides_runpath=no + sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' + ;; + esac + ;; + +sysv4*MP*) + if test -d /usr/nec ;then + version_type=linux + library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' + soname_spec='$libname${shared_ext}.$major' + shlibpath_var=LD_LIBRARY_PATH + fi + ;; + +sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) + version_type=freebsd-elf + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + hardcode_into_libs=yes + if test "$with_gnu_ld" = yes; then + sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' + shlibpath_overrides_runpath=no + else + sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' + shlibpath_overrides_runpath=yes + case $host_os in + sco3.2v5*) + sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" + ;; + esac + fi + sys_lib_dlsearch_path_spec='/usr/lib' + ;; + +uts4*) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +*) + dynamic_linker=no + ;; +esac +{ echo "$as_me:$LINENO: result: $dynamic_linker" >&5 +echo "${ECHO_T}$dynamic_linker" >&6; } +test "$dynamic_linker" = no && can_build_shared=no + +variables_saved_for_relink="PATH $shlibpath_var $runpath_var" +if test "$GCC" = yes; then + variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" +fi + +{ echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5 +echo $ECHO_N "checking how to hardcode library paths into programs... $ECHO_C" >&6; } +hardcode_action= +if test -n "$hardcode_libdir_flag_spec" || \ + test -n "$runpath_var" || \ + test "X$hardcode_automatic" = "Xyes" ; then + + # We can hardcode non-existant directories. + if test "$hardcode_direct" != no && + # If the only mechanism to avoid hardcoding is shlibpath_var, we + # have to relink, otherwise we might link with an installed library + # when we should be linking with a yet-to-be-installed one + ## test "$_LT_AC_TAGVAR(hardcode_shlibpath_var, )" != no && + test "$hardcode_minus_L" != no; then + # Linking always hardcodes the temporary library directory. + hardcode_action=relink + else + # We can link without hardcoding, and we can hardcode nonexisting dirs. + hardcode_action=immediate + fi +else + # We cannot hardcode anything, or else we can only hardcode existing + # directories. + hardcode_action=unsupported +fi +{ echo "$as_me:$LINENO: result: $hardcode_action" >&5 +echo "${ECHO_T}$hardcode_action" >&6; } + +if test "$hardcode_action" = relink; then + # Fast installation is not supported + enable_fast_install=no +elif test "$shlibpath_overrides_runpath" = yes || + test "$enable_shared" = no; then + # Fast installation is not necessary + enable_fast_install=needless +fi + +striplib= +old_striplib= +{ echo "$as_me:$LINENO: checking whether stripping libraries is possible" >&5 +echo $ECHO_N "checking whether stripping libraries is possible... $ECHO_C" >&6; } +if test -n "$STRIP" && $STRIP -V 2>&1 | grep "GNU strip" >/dev/null; then + test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" + test -z "$striplib" && striplib="$STRIP --strip-unneeded" + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } +else +# FIXME - insert some real tests, host_os isn't really good enough + case $host_os in + darwin*) + if test -n "$STRIP" ; then + striplib="$STRIP -x" + old_striplib="$STRIP -S" + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } + else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + ;; + *) + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } + ;; + esac +fi + +if test "x$enable_dlopen" != xyes; then + enable_dlopen=unknown + enable_dlopen_self=unknown + enable_dlopen_self_static=unknown +else + lt_cv_dlopen=no + lt_cv_dlopen_libs= + + case $host_os in + beos*) + lt_cv_dlopen="load_add_on" + lt_cv_dlopen_libs= + lt_cv_dlopen_self=yes + ;; + + mingw* | pw32*) + lt_cv_dlopen="LoadLibrary" + lt_cv_dlopen_libs= + ;; + + cygwin*) + lt_cv_dlopen="dlopen" + lt_cv_dlopen_libs= + ;; + + darwin*) + # if libdl is installed we need to link against it + { echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5 +echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6; } +if test "${ac_cv_lib_dl_dlopen+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldl $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char dlopen (); +int +main () +{ +return dlopen (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then + ac_cv_lib_dl_dlopen=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_lib_dl_dlopen=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5 +echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6; } +if test $ac_cv_lib_dl_dlopen = yes; then + lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" +else + + lt_cv_dlopen="dyld" + lt_cv_dlopen_libs= + lt_cv_dlopen_self=yes + +fi + + ;; + + *) + { echo "$as_me:$LINENO: checking for shl_load" >&5 +echo $ECHO_N "checking for shl_load... $ECHO_C" >&6; } +if test "${ac_cv_func_shl_load+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Define shl_load to an innocuous variant, in case declares shl_load. + For example, HP-UX 11i declares gettimeofday. */ +#define shl_load innocuous_shl_load + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char shl_load (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef shl_load + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char shl_load (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined __stub_shl_load || defined __stub___shl_load +choke me +#endif + +int +main () +{ +return shl_load (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then + ac_cv_func_shl_load=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_func_shl_load=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext +fi +{ echo "$as_me:$LINENO: result: $ac_cv_func_shl_load" >&5 +echo "${ECHO_T}$ac_cv_func_shl_load" >&6; } +if test $ac_cv_func_shl_load = yes; then + lt_cv_dlopen="shl_load" +else + { echo "$as_me:$LINENO: checking for shl_load in -ldld" >&5 +echo $ECHO_N "checking for shl_load in -ldld... $ECHO_C" >&6; } +if test "${ac_cv_lib_dld_shl_load+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldld $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char shl_load (); +int +main () +{ +return shl_load (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then + ac_cv_lib_dld_shl_load=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_lib_dld_shl_load=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ echo "$as_me:$LINENO: result: $ac_cv_lib_dld_shl_load" >&5 +echo "${ECHO_T}$ac_cv_lib_dld_shl_load" >&6; } +if test $ac_cv_lib_dld_shl_load = yes; then + lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-dld" +else + { echo "$as_me:$LINENO: checking for dlopen" >&5 +echo $ECHO_N "checking for dlopen... $ECHO_C" >&6; } +if test "${ac_cv_func_dlopen+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Define dlopen to an innocuous variant, in case declares dlopen. + For example, HP-UX 11i declares gettimeofday. */ +#define dlopen innocuous_dlopen + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char dlopen (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef dlopen + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char dlopen (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined __stub_dlopen || defined __stub___dlopen +choke me +#endif + +int +main () +{ +return dlopen (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then + ac_cv_func_dlopen=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_func_dlopen=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext +fi +{ echo "$as_me:$LINENO: result: $ac_cv_func_dlopen" >&5 +echo "${ECHO_T}$ac_cv_func_dlopen" >&6; } +if test $ac_cv_func_dlopen = yes; then + lt_cv_dlopen="dlopen" +else + { echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5 +echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6; } +if test "${ac_cv_lib_dl_dlopen+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldl $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char dlopen (); +int +main () +{ +return dlopen (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then + ac_cv_lib_dl_dlopen=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_lib_dl_dlopen=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5 +echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6; } +if test $ac_cv_lib_dl_dlopen = yes; then + lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" +else + { echo "$as_me:$LINENO: checking for dlopen in -lsvld" >&5 +echo $ECHO_N "checking for dlopen in -lsvld... $ECHO_C" >&6; } +if test "${ac_cv_lib_svld_dlopen+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lsvld $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char dlopen (); +int +main () +{ +return dlopen (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then + ac_cv_lib_svld_dlopen=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_lib_svld_dlopen=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ echo "$as_me:$LINENO: result: $ac_cv_lib_svld_dlopen" >&5 +echo "${ECHO_T}$ac_cv_lib_svld_dlopen" >&6; } +if test $ac_cv_lib_svld_dlopen = yes; then + lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld" +else + { echo "$as_me:$LINENO: checking for dld_link in -ldld" >&5 +echo $ECHO_N "checking for dld_link in -ldld... $ECHO_C" >&6; } +if test "${ac_cv_lib_dld_dld_link+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldld $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char dld_link (); +int +main () +{ +return dld_link (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then + ac_cv_lib_dld_dld_link=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_lib_dld_dld_link=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ echo "$as_me:$LINENO: result: $ac_cv_lib_dld_dld_link" >&5 +echo "${ECHO_T}$ac_cv_lib_dld_dld_link" >&6; } +if test $ac_cv_lib_dld_dld_link = yes; then + lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-dld" +fi + + +fi + + +fi + + +fi + + +fi + + +fi + + ;; + esac + + if test "x$lt_cv_dlopen" != xno; then + enable_dlopen=yes + else + enable_dlopen=no + fi + + case $lt_cv_dlopen in + dlopen) + save_CPPFLAGS="$CPPFLAGS" + test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" + + save_LDFLAGS="$LDFLAGS" + wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" + + save_LIBS="$LIBS" + LIBS="$lt_cv_dlopen_libs $LIBS" + + { echo "$as_me:$LINENO: checking whether a program can dlopen itself" >&5 +echo $ECHO_N "checking whether a program can dlopen itself... $ECHO_C" >&6; } +if test "${lt_cv_dlopen_self+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test "$cross_compiling" = yes; then : + lt_cv_dlopen_self=cross +else + lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 + lt_status=$lt_dlunknown + cat > conftest.$ac_ext < +#endif + +#include + +#ifdef RTLD_GLOBAL +# define LT_DLGLOBAL RTLD_GLOBAL +#else +# ifdef DL_GLOBAL +# define LT_DLGLOBAL DL_GLOBAL +# else +# define LT_DLGLOBAL 0 +# endif +#endif + +/* We may have to define LT_DLLAZY_OR_NOW in the command line if we + find out it does not work in some platform. */ +#ifndef LT_DLLAZY_OR_NOW +# ifdef RTLD_LAZY +# define LT_DLLAZY_OR_NOW RTLD_LAZY +# else +# ifdef DL_LAZY +# define LT_DLLAZY_OR_NOW DL_LAZY +# else +# ifdef RTLD_NOW +# define LT_DLLAZY_OR_NOW RTLD_NOW +# else +# ifdef DL_NOW +# define LT_DLLAZY_OR_NOW DL_NOW +# else +# define LT_DLLAZY_OR_NOW 0 +# endif +# endif +# endif +# endif +#endif + +#ifdef __cplusplus +extern "C" void exit (int); +#endif + +void fnord() { int i=42;} +int main () +{ + void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); + int status = $lt_dlunknown; + + if (self) + { + if (dlsym (self,"fnord")) status = $lt_dlno_uscore; + else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; + /* dlclose (self); */ + } + else + puts (dlerror ()); + + exit (status); +} +EOF + if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && test -s conftest${ac_exeext} 2>/dev/null; then + (./conftest; exit; ) >&5 2>/dev/null + lt_status=$? + case x$lt_status in + x$lt_dlno_uscore) lt_cv_dlopen_self=yes ;; + x$lt_dlneed_uscore) lt_cv_dlopen_self=yes ;; + x$lt_dlunknown|x*) lt_cv_dlopen_self=no ;; + esac + else : + # compilation failed + lt_cv_dlopen_self=no + fi +fi +rm -fr conftest* + + +fi +{ echo "$as_me:$LINENO: result: $lt_cv_dlopen_self" >&5 +echo "${ECHO_T}$lt_cv_dlopen_self" >&6; } + + if test "x$lt_cv_dlopen_self" = xyes; then + wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\" + { echo "$as_me:$LINENO: checking whether a statically linked program can dlopen itself" >&5 +echo $ECHO_N "checking whether a statically linked program can dlopen itself... $ECHO_C" >&6; } +if test "${lt_cv_dlopen_self_static+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test "$cross_compiling" = yes; then : + lt_cv_dlopen_self_static=cross +else + lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 + lt_status=$lt_dlunknown + cat > conftest.$ac_ext < +#endif + +#include + +#ifdef RTLD_GLOBAL +# define LT_DLGLOBAL RTLD_GLOBAL +#else +# ifdef DL_GLOBAL +# define LT_DLGLOBAL DL_GLOBAL +# else +# define LT_DLGLOBAL 0 +# endif +#endif + +/* We may have to define LT_DLLAZY_OR_NOW in the command line if we + find out it does not work in some platform. */ +#ifndef LT_DLLAZY_OR_NOW +# ifdef RTLD_LAZY +# define LT_DLLAZY_OR_NOW RTLD_LAZY +# else +# ifdef DL_LAZY +# define LT_DLLAZY_OR_NOW DL_LAZY +# else +# ifdef RTLD_NOW +# define LT_DLLAZY_OR_NOW RTLD_NOW +# else +# ifdef DL_NOW +# define LT_DLLAZY_OR_NOW DL_NOW +# else +# define LT_DLLAZY_OR_NOW 0 +# endif +# endif +# endif +# endif +#endif + +#ifdef __cplusplus +extern "C" void exit (int); +#endif + +void fnord() { int i=42;} +int main () +{ + void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); + int status = $lt_dlunknown; + + if (self) + { + if (dlsym (self,"fnord")) status = $lt_dlno_uscore; + else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; + /* dlclose (self); */ + } + else + puts (dlerror ()); + + exit (status); +} +EOF + if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && test -s conftest${ac_exeext} 2>/dev/null; then + (./conftest; exit; ) >&5 2>/dev/null + lt_status=$? + case x$lt_status in + x$lt_dlno_uscore) lt_cv_dlopen_self_static=yes ;; + x$lt_dlneed_uscore) lt_cv_dlopen_self_static=yes ;; + x$lt_dlunknown|x*) lt_cv_dlopen_self_static=no ;; + esac + else : + # compilation failed + lt_cv_dlopen_self_static=no + fi +fi +rm -fr conftest* + + +fi +{ echo "$as_me:$LINENO: result: $lt_cv_dlopen_self_static" >&5 +echo "${ECHO_T}$lt_cv_dlopen_self_static" >&6; } + fi + + CPPFLAGS="$save_CPPFLAGS" + LDFLAGS="$save_LDFLAGS" + LIBS="$save_LIBS" + ;; + esac + + case $lt_cv_dlopen_self in + yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; + *) enable_dlopen_self=unknown ;; + esac + + case $lt_cv_dlopen_self_static in + yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; + *) enable_dlopen_self_static=unknown ;; + esac +fi + + +# Report which library types will actually be built +{ echo "$as_me:$LINENO: checking if libtool supports shared libraries" >&5 +echo $ECHO_N "checking if libtool supports shared libraries... $ECHO_C" >&6; } +{ echo "$as_me:$LINENO: result: $can_build_shared" >&5 +echo "${ECHO_T}$can_build_shared" >&6; } + +{ echo "$as_me:$LINENO: checking whether to build shared libraries" >&5 +echo $ECHO_N "checking whether to build shared libraries... $ECHO_C" >&6; } +test "$can_build_shared" = "no" && enable_shared=no + +# On AIX, shared libraries and static libraries use the same namespace, and +# are all built from PIC. +case $host_os in +aix3*) + test "$enable_shared" = yes && enable_static=no + if test -n "$RANLIB"; then + archive_cmds="$archive_cmds~\$RANLIB \$lib" + postinstall_cmds='$RANLIB $lib' + fi + ;; + +aix4* | aix5*) + if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then + test "$enable_shared" = yes && enable_static=no + fi + ;; +esac +{ echo "$as_me:$LINENO: result: $enable_shared" >&5 +echo "${ECHO_T}$enable_shared" >&6; } + +{ echo "$as_me:$LINENO: checking whether to build static libraries" >&5 +echo $ECHO_N "checking whether to build static libraries... $ECHO_C" >&6; } +# Make sure either enable_shared or enable_static is yes. +test "$enable_shared" = yes || enable_static=yes +{ echo "$as_me:$LINENO: result: $enable_static" >&5 +echo "${ECHO_T}$enable_static" >&6; } + +# The else clause should only fire when bootstrapping the +# libtool distribution, otherwise you forgot to ship ltmain.sh +# with your package, and you will get complaints that there are +# no rules to generate ltmain.sh. +if test -f "$ltmain"; then + # See if we are running on zsh, and set the options which allow our commands through + # without removal of \ escapes. + if test -n "${ZSH_VERSION+set}" ; then + setopt NO_GLOB_SUBST + fi + # Now quote all the things that may contain metacharacters while being + # careful not to overquote the AC_SUBSTed values. We take copies of the + # variables and quote the copies for generation of the libtool script. + for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC LTCFLAGS NM \ + SED SHELL STRIP \ + libname_spec library_names_spec soname_spec extract_expsyms_cmds \ + old_striplib striplib file_magic_cmd finish_cmds finish_eval \ + deplibs_check_method reload_flag reload_cmds need_locks \ + lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \ + lt_cv_sys_global_symbol_to_c_name_address \ + sys_lib_search_path_spec sys_lib_dlsearch_path_spec \ + old_postinstall_cmds old_postuninstall_cmds \ + compiler \ + CC \ + LD \ + lt_prog_compiler_wl \ + lt_prog_compiler_pic \ + lt_prog_compiler_static \ + lt_prog_compiler_no_builtin_flag \ + export_dynamic_flag_spec \ + thread_safe_flag_spec \ + whole_archive_flag_spec \ + enable_shared_with_static_runtimes \ + old_archive_cmds \ + old_archive_from_new_cmds \ + predep_objects \ + postdep_objects \ + predeps \ + postdeps \ + compiler_lib_search_path \ + archive_cmds \ + archive_expsym_cmds \ + postinstall_cmds \ + postuninstall_cmds \ + old_archive_from_expsyms_cmds \ + allow_undefined_flag \ + no_undefined_flag \ + export_symbols_cmds \ + hardcode_libdir_flag_spec \ + hardcode_libdir_flag_spec_ld \ + hardcode_libdir_separator \ + hardcode_automatic \ + module_cmds \ + module_expsym_cmds \ + lt_cv_prog_compiler_c_o \ + fix_srcfile_path \ + exclude_expsyms \ + include_expsyms; do + + case $var in + old_archive_cmds | \ + old_archive_from_new_cmds | \ + archive_cmds | \ + archive_expsym_cmds | \ + module_cmds | \ + module_expsym_cmds | \ + old_archive_from_expsyms_cmds | \ + export_symbols_cmds | \ + extract_expsyms_cmds | reload_cmds | finish_cmds | \ + postinstall_cmds | postuninstall_cmds | \ + old_postinstall_cmds | old_postuninstall_cmds | \ + sys_lib_search_path_spec | sys_lib_dlsearch_path_spec) + # Double-quote double-evaled strings. + eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\"" + ;; + *) + eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\"" + ;; + esac + done + + case $lt_echo in + *'\$0 --fallback-echo"') + lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'` + ;; + esac + +cfgfile="${ofile}T" + trap "$rm \"$cfgfile\"; exit 1" 1 2 15 + $rm -f "$cfgfile" + { echo "$as_me:$LINENO: creating $ofile" >&5 +echo "$as_me: creating $ofile" >&6;} + + cat <<__EOF__ >> "$cfgfile" +#! $SHELL + +# `$echo "$cfgfile" | sed 's%^.*/%%'` - Provide generalized library-building support services. +# Generated automatically by $PROGRAM (GNU $PACKAGE $VERSION$TIMESTAMP) +# NOTE: Changes made to this file will be lost: look at ltmain.sh. +# +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 +# Free Software Foundation, Inc. +# +# This file is part of GNU Libtool: +# Originally by Gordon Matzigkeit , 1996 +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# A sed program that does not truncate output. +SED=$lt_SED + +# Sed that helps us avoid accidentally triggering echo(1) options like -n. +Xsed="$SED -e 1s/^X//" + +# The HP-UX ksh and POSIX shell print the target directory to stdout +# if CDPATH is set. +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH + +# The names of the tagged configurations supported by this script. +available_tags= + +# ### BEGIN LIBTOOL CONFIG + +# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: + +# Shell to use when invoking shell scripts. +SHELL=$lt_SHELL + +# Whether or not to build shared libraries. +build_libtool_libs=$enable_shared + +# Whether or not to build static libraries. +build_old_libs=$enable_static + +# Whether or not to add -lc for building shared libraries. +build_libtool_need_lc=$archive_cmds_need_lc + +# Whether or not to disallow shared libs when runtime libs are static +allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes + +# Whether or not to optimize for fast installation. +fast_install=$enable_fast_install + +# The host system. +host_alias=$host_alias +host=$host +host_os=$host_os + +# The build system. +build_alias=$build_alias +build=$build +build_os=$build_os + +# An echo program that does not interpret backslashes. +echo=$lt_echo + +# The archiver. +AR=$lt_AR +AR_FLAGS=$lt_AR_FLAGS + +# A C compiler. +LTCC=$lt_LTCC + +# LTCC compiler flags. +LTCFLAGS=$lt_LTCFLAGS + +# A language-specific compiler. +CC=$lt_compiler + +# Is the compiler the GNU C compiler? +with_gcc=$GCC + +# An ERE matcher. +EGREP=$lt_EGREP + +# The linker used to build libraries. +LD=$lt_LD + +# Whether we need hard or soft links. +LN_S=$lt_LN_S + +# A BSD-compatible nm program. +NM=$lt_NM + +# A symbol stripping program +STRIP=$lt_STRIP + +# Used to examine libraries when file_magic_cmd begins "file" +MAGIC_CMD=$MAGIC_CMD + +# Used on cygwin: DLL creation program. +DLLTOOL="$DLLTOOL" + +# Used on cygwin: object dumper. +OBJDUMP="$OBJDUMP" + +# Used on cygwin: assembler. +AS="$AS" + +# The name of the directory that contains temporary libtool files. +objdir=$objdir + +# How to create reloadable object files. +reload_flag=$lt_reload_flag +reload_cmds=$lt_reload_cmds + +# How to pass a linker flag through the compiler. +wl=$lt_lt_prog_compiler_wl + +# Object file suffix (normally "o"). +objext="$ac_objext" + +# Old archive suffix (normally "a"). +libext="$libext" + +# Shared library suffix (normally ".so"). +shrext_cmds='$shrext_cmds' + +# Executable file suffix (normally ""). +exeext="$exeext" + +# Additional compiler flags for building library objects. +pic_flag=$lt_lt_prog_compiler_pic +pic_mode=$pic_mode + +# What is the maximum length of a command? +max_cmd_len=$lt_cv_sys_max_cmd_len + +# Does compiler simultaneously support -c and -o options? +compiler_c_o=$lt_lt_cv_prog_compiler_c_o + +# Must we lock files when doing compilation? +need_locks=$lt_need_locks + +# Do we need the lib prefix for modules? +need_lib_prefix=$need_lib_prefix + +# Do we need a version for libraries? +need_version=$need_version + +# Whether dlopen is supported. +dlopen_support=$enable_dlopen + +# Whether dlopen of programs is supported. +dlopen_self=$enable_dlopen_self + +# Whether dlopen of statically linked programs is supported. +dlopen_self_static=$enable_dlopen_self_static + +# Compiler flag to prevent dynamic linking. +link_static_flag=$lt_lt_prog_compiler_static + +# Compiler flag to turn off builtin functions. +no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag + +# Compiler flag to allow reflexive dlopens. +export_dynamic_flag_spec=$lt_export_dynamic_flag_spec + +# Compiler flag to generate shared objects directly from archives. +whole_archive_flag_spec=$lt_whole_archive_flag_spec + +# Compiler flag to generate thread-safe objects. +thread_safe_flag_spec=$lt_thread_safe_flag_spec + +# Library versioning type. +version_type=$version_type + +# Format of library name prefix. +libname_spec=$lt_libname_spec + +# List of archive names. First name is the real one, the rest are links. +# The last name is the one that the linker finds with -lNAME. +library_names_spec=$lt_library_names_spec + +# The coded name of the library, if different from the real name. +soname_spec=$lt_soname_spec + +# Commands used to build and install an old-style archive. +RANLIB=$lt_RANLIB +old_archive_cmds=$lt_old_archive_cmds +old_postinstall_cmds=$lt_old_postinstall_cmds +old_postuninstall_cmds=$lt_old_postuninstall_cmds + +# Create an old-style archive from a shared archive. +old_archive_from_new_cmds=$lt_old_archive_from_new_cmds + +# Create a temporary old-style archive to link instead of a shared archive. +old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds + +# Commands used to build and install a shared archive. +archive_cmds=$lt_archive_cmds +archive_expsym_cmds=$lt_archive_expsym_cmds +postinstall_cmds=$lt_postinstall_cmds +postuninstall_cmds=$lt_postuninstall_cmds + +# Commands used to build a loadable module (assumed same as above if empty) +module_cmds=$lt_module_cmds +module_expsym_cmds=$lt_module_expsym_cmds + +# Commands to strip libraries. +old_striplib=$lt_old_striplib +striplib=$lt_striplib + +# Dependencies to place before the objects being linked to create a +# shared library. +predep_objects=$lt_predep_objects + +# Dependencies to place after the objects being linked to create a +# shared library. +postdep_objects=$lt_postdep_objects + +# Dependencies to place before the objects being linked to create a +# shared library. +predeps=$lt_predeps + +# Dependencies to place after the objects being linked to create a +# shared library. +postdeps=$lt_postdeps + +# The library search path used internally by the compiler when linking +# a shared library. +compiler_lib_search_path=$lt_compiler_lib_search_path + +# Method to check whether dependent libraries are shared objects. +deplibs_check_method=$lt_deplibs_check_method + +# Command to use when deplibs_check_method == file_magic. +file_magic_cmd=$lt_file_magic_cmd + +# Flag that allows shared libraries with undefined symbols to be built. +allow_undefined_flag=$lt_allow_undefined_flag + +# Flag that forces no undefined symbols. +no_undefined_flag=$lt_no_undefined_flag + +# Commands used to finish a libtool library installation in a directory. +finish_cmds=$lt_finish_cmds + +# Same as above, but a single script fragment to be evaled but not shown. +finish_eval=$lt_finish_eval + +# Take the output of nm and produce a listing of raw symbols and C names. +global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe + +# Transform the output of nm in a proper C declaration +global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl + +# Transform the output of nm in a C name address pair +global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address + +# This is the shared library runtime path variable. +runpath_var=$runpath_var + +# This is the shared library path variable. +shlibpath_var=$shlibpath_var + +# Is shlibpath searched before the hard-coded library search path? +shlibpath_overrides_runpath=$shlibpath_overrides_runpath + +# How to hardcode a shared library path into an executable. +hardcode_action=$hardcode_action + +# Whether we should hardcode library paths into libraries. +hardcode_into_libs=$hardcode_into_libs + +# Flag to hardcode \$libdir into a binary during linking. +# This must work even if \$libdir does not exist. +hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec + +# If ld is used when linking, flag to hardcode \$libdir into +# a binary during linking. This must work even if \$libdir does +# not exist. +hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld + +# Whether we need a single -rpath flag with a separated argument. +hardcode_libdir_separator=$lt_hardcode_libdir_separator + +# Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the +# resulting binary. +hardcode_direct=$hardcode_direct + +# Set to yes if using the -LDIR flag during linking hardcodes DIR into the +# resulting binary. +hardcode_minus_L=$hardcode_minus_L + +# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into +# the resulting binary. +hardcode_shlibpath_var=$hardcode_shlibpath_var + +# Set to yes if building a shared library automatically hardcodes DIR into the library +# and all subsequent libraries and executables linked against it. +hardcode_automatic=$hardcode_automatic + +# Variables whose values should be saved in libtool wrapper scripts and +# restored at relink time. +variables_saved_for_relink="$variables_saved_for_relink" + +# Whether libtool must link a program against all its dependency libraries. +link_all_deplibs=$link_all_deplibs + +# Compile-time system search path for libraries +sys_lib_search_path_spec=$lt_sys_lib_search_path_spec + +# Run-time system search path for libraries +sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec + +# Fix the shell variable \$srcfile for the compiler. +fix_srcfile_path=$lt_fix_srcfile_path + +# Set to yes if exported symbols are required. +always_export_symbols=$always_export_symbols + +# The commands to list exported symbols. +export_symbols_cmds=$lt_export_symbols_cmds + +# The commands to extract the exported symbol list from a shared archive. +extract_expsyms_cmds=$lt_extract_expsyms_cmds + +# Symbols that should not be listed in the preloaded symbols. +exclude_expsyms=$lt_exclude_expsyms + +# Symbols that must always be exported. +include_expsyms=$lt_include_expsyms + +# ### END LIBTOOL CONFIG + +__EOF__ + + + case $host_os in + aix3*) + cat <<\EOF >> "$cfgfile" + +# AIX sometimes has problems with the GCC collect2 program. For some +# reason, if we set the COLLECT_NAMES environment variable, the problems +# vanish in a puff of smoke. +if test "X${COLLECT_NAMES+set}" != Xset; then + COLLECT_NAMES= + export COLLECT_NAMES +fi +EOF + ;; + esac + + # We use sed instead of cat because bash on DJGPP gets confused if + # if finds mixed CR/LF and LF-only lines. Since sed operates in + # text mode, it properly converts lines to CR/LF. This bash problem + # is reportedly fixed, but why not run on old versions too? + sed '$q' "$ltmain" >> "$cfgfile" || (rm -f "$cfgfile"; exit 1) + + mv -f "$cfgfile" "$ofile" || \ + (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") + chmod +x "$ofile" + +else + # If there is no Makefile yet, we rely on a make rule to execute + # `config.status --recheck' to rerun these tests and create the + # libtool script then. + ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'` + if test -f "$ltmain_in"; then + test -f Makefile && make "$ltmain" + fi +fi + + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +CC="$lt_save_CC" + + +# Check whether --with-tags was given. +if test "${with_tags+set}" = set; then + withval=$with_tags; tagnames="$withval" +fi + + +if test -f "$ltmain" && test -n "$tagnames"; then + if test ! -f "${ofile}"; then + { echo "$as_me:$LINENO: WARNING: output file \`$ofile' does not exist" >&5 +echo "$as_me: WARNING: output file \`$ofile' does not exist" >&2;} + fi + + if test -z "$LTCC"; then + eval "`$SHELL ${ofile} --config | grep '^LTCC='`" + if test -z "$LTCC"; then + { echo "$as_me:$LINENO: WARNING: output file \`$ofile' does not look like a libtool script" >&5 +echo "$as_me: WARNING: output file \`$ofile' does not look like a libtool script" >&2;} + else + { echo "$as_me:$LINENO: WARNING: using \`LTCC=$LTCC', extracted from \`$ofile'" >&5 +echo "$as_me: WARNING: using \`LTCC=$LTCC', extracted from \`$ofile'" >&2;} + fi + fi + if test -z "$LTCFLAGS"; then + eval "`$SHELL ${ofile} --config | grep '^LTCFLAGS='`" + fi + + # Extract list of available tagged configurations in $ofile. + # Note that this assumes the entire list is on one line. + available_tags=`grep "^available_tags=" "${ofile}" | $SED -e 's/available_tags=\(.*$\)/\1/' -e 's/\"//g'` + + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for tagname in $tagnames; do + IFS="$lt_save_ifs" + # Check whether tagname contains only valid characters + case `$echo "X$tagname" | $Xsed -e 's:[-_ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890,/]::g'` in + "") ;; + *) { { echo "$as_me:$LINENO: error: invalid tag name: $tagname" >&5 +echo "$as_me: error: invalid tag name: $tagname" >&2;} + { (exit 1); exit 1; }; } + ;; + esac + + if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "${ofile}" > /dev/null + then + { { echo "$as_me:$LINENO: error: tag name \"$tagname\" already exists" >&5 +echo "$as_me: error: tag name \"$tagname\" already exists" >&2;} + { (exit 1); exit 1; }; } + fi + + # Update the list of available tags. + if test -n "$tagname"; then + echo appending configuration tag \"$tagname\" to $ofile + + case $tagname in + CXX) + if test -n "$CXX" && ( test "X$CXX" != "Xno" && + ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) || + (test "X$CXX" != "Xg++"))) ; then + ac_ext=cpp +ac_cpp='$CXXCPP $CPPFLAGS' +ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_cxx_compiler_gnu + + + + +archive_cmds_need_lc_CXX=no +allow_undefined_flag_CXX= +always_export_symbols_CXX=no +archive_expsym_cmds_CXX= +export_dynamic_flag_spec_CXX= +hardcode_direct_CXX=no +hardcode_libdir_flag_spec_CXX= +hardcode_libdir_flag_spec_ld_CXX= +hardcode_libdir_separator_CXX= +hardcode_minus_L_CXX=no +hardcode_shlibpath_var_CXX=unsupported +hardcode_automatic_CXX=no +module_cmds_CXX= +module_expsym_cmds_CXX= +link_all_deplibs_CXX=unknown +old_archive_cmds_CXX=$old_archive_cmds +no_undefined_flag_CXX= +whole_archive_flag_spec_CXX= +enable_shared_with_static_runtimes_CXX=no + +# Dependencies to place before and after the object being linked: +predep_objects_CXX= +postdep_objects_CXX= +predeps_CXX= +postdeps_CXX= +compiler_lib_search_path_CXX= + +# Source file extension for C++ test sources. +ac_ext=cpp + +# Object file extension for compiled C++ test sources. +objext=o +objext_CXX=$objext + +# Code to be used in simple compile tests +lt_simple_compile_test_code="int some_variable = 0;" + +# Code to be used in simple link tests +lt_simple_link_test_code='int main(int, char *[]) { return(0); }' + +# ltmain only uses $CC for tagged configurations so make sure $CC is set. + +# If no C compiler was specified, use CC. +LTCC=${LTCC-"$CC"} + +# If no C compiler flags were specified, use CFLAGS. +LTCFLAGS=${LTCFLAGS-"$CFLAGS"} + +# Allow CC to be a program name with arguments. +compiler=$CC + + +# save warnings/boilerplate of simple test code +ac_outfile=conftest.$ac_objext +echo "$lt_simple_compile_test_code" >conftest.$ac_ext +eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err +_lt_compiler_boilerplate=`cat conftest.err` +$rm conftest* + +ac_outfile=conftest.$ac_objext +echo "$lt_simple_link_test_code" >conftest.$ac_ext +eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err +_lt_linker_boilerplate=`cat conftest.err` +$rm conftest* + + +# Allow CC to be a program name with arguments. +lt_save_CC=$CC +lt_save_LD=$LD +lt_save_GCC=$GCC +GCC=$GXX +lt_save_with_gnu_ld=$with_gnu_ld +lt_save_path_LD=$lt_cv_path_LD +if test -n "${lt_cv_prog_gnu_ldcxx+set}"; then + lt_cv_prog_gnu_ld=$lt_cv_prog_gnu_ldcxx +else + $as_unset lt_cv_prog_gnu_ld +fi +if test -n "${lt_cv_path_LDCXX+set}"; then + lt_cv_path_LD=$lt_cv_path_LDCXX +else + $as_unset lt_cv_path_LD +fi +test -z "${LDCXX+set}" || LD=$LDCXX +CC=${CXX-"c++"} +compiler=$CC +compiler_CXX=$CC +for cc_temp in $compiler""; do + case $cc_temp in + compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; + distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; + \-*) ;; + *) break;; + esac +done +cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` + + +# We don't want -fno-exception wen compiling C++ code, so set the +# no_builtin_flag separately +if test "$GXX" = yes; then + lt_prog_compiler_no_builtin_flag_CXX=' -fno-builtin' +else + lt_prog_compiler_no_builtin_flag_CXX= +fi + +if test "$GXX" = yes; then + # Set up default GNU C++ configuration + + +# Check whether --with-gnu-ld was given. +if test "${with_gnu_ld+set}" = set; then + withval=$with_gnu_ld; test "$withval" = no || with_gnu_ld=yes +else + with_gnu_ld=no +fi + +ac_prog=ld +if test "$GCC" = yes; then + # Check if gcc -print-prog-name=ld gives a path. + { echo "$as_me:$LINENO: checking for ld used by $CC" >&5 +echo $ECHO_N "checking for ld used by $CC... $ECHO_C" >&6; } + case $host in + *-*-mingw*) + # gcc leaves a trailing carriage return which upsets mingw + ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; + *) + ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; + esac + case $ac_prog in + # Accept absolute paths. + [\\/]* | ?:[\\/]*) + re_direlt='/[^/][^/]*/\.\./' + # Canonicalize the pathname of ld + ac_prog=`echo $ac_prog| $SED 's%\\\\%/%g'` + while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do + ac_prog=`echo $ac_prog| $SED "s%$re_direlt%/%"` + done + test -z "$LD" && LD="$ac_prog" + ;; + "") + # If it fails, then pretend we aren't using GCC. + ac_prog=ld + ;; + *) + # If it is relative, then search for the first ld in PATH. + with_gnu_ld=unknown + ;; + esac +elif test "$with_gnu_ld" = yes; then + { echo "$as_me:$LINENO: checking for GNU ld" >&5 +echo $ECHO_N "checking for GNU ld... $ECHO_C" >&6; } +else + { echo "$as_me:$LINENO: checking for non-GNU ld" >&5 +echo $ECHO_N "checking for non-GNU ld... $ECHO_C" >&6; } +fi +if test "${lt_cv_path_LD+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -z "$LD"; then + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + for ac_dir in $PATH; do + IFS="$lt_save_ifs" + test -z "$ac_dir" && ac_dir=. + if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then + lt_cv_path_LD="$ac_dir/$ac_prog" + # Check to see if the program is GNU ld. I'd rather use --version, + # but apparently some variants of GNU ld only accept -v. + # Break only if it was the GNU/non-GNU ld that we prefer. + case `"$lt_cv_path_LD" -v 2>&1 &5 +echo "${ECHO_T}$LD" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi +test -z "$LD" && { { echo "$as_me:$LINENO: error: no acceptable ld found in \$PATH" >&5 +echo "$as_me: error: no acceptable ld found in \$PATH" >&2;} + { (exit 1); exit 1; }; } +{ echo "$as_me:$LINENO: checking if the linker ($LD) is GNU ld" >&5 +echo $ECHO_N "checking if the linker ($LD) is GNU ld... $ECHO_C" >&6; } +if test "${lt_cv_prog_gnu_ld+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + # I'd rather use --version here, but apparently some GNU lds only accept -v. +case `$LD -v 2>&1 &5 +echo "${ECHO_T}$lt_cv_prog_gnu_ld" >&6; } +with_gnu_ld=$lt_cv_prog_gnu_ld + + + + # Check if GNU C++ uses GNU ld as the underlying linker, since the + # archiving commands below assume that GNU ld is being used. + if test "$with_gnu_ld" = yes; then + archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + + hardcode_libdir_flag_spec_CXX='${wl}--rpath ${wl}$libdir' + export_dynamic_flag_spec_CXX='${wl}--export-dynamic' + + # If archive_cmds runs LD, not CC, wlarc should be empty + # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to + # investigate it a little bit more. (MM) + wlarc='${wl}' + + # ancient GNU ld didn't support --whole-archive et. al. + if eval "`$CC -print-prog-name=ld` --help 2>&1" | \ + grep 'no-whole-archive' > /dev/null; then + whole_archive_flag_spec_CXX="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + else + whole_archive_flag_spec_CXX= + fi + else + with_gnu_ld=no + wlarc= + + # A generic and very simple default shared library creation + # command for GNU C++ for the case where it uses the native + # linker, instead of GNU ld. If possible, this setting should + # overridden to take advantage of the native linker features on + # the platform it is being used on. + archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' + fi + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"' + +else + GXX=no + with_gnu_ld=no + wlarc= +fi + +# PORTME: fill in a description of your system's C++ link characteristics +{ echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5 +echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared libraries... $ECHO_C" >&6; } +ld_shlibs_CXX=yes +case $host_os in + aix3*) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + aix4* | aix5*) + if test "$host_cpu" = ia64; then + # On IA64, the linker does run time linking by default, so we don't + # have to do anything special. + aix_use_runtimelinking=no + exp_sym_flag='-Bexport' + no_entry_flag="" + else + aix_use_runtimelinking=no + + # Test if we are trying to use run time linking or normal + # AIX style linking. If -brtl is somewhere in LDFLAGS, we + # need to do runtime linking. + case $host_os in aix4.[23]|aix4.[23].*|aix5*) + for ld_flag in $LDFLAGS; do + case $ld_flag in + *-brtl*) + aix_use_runtimelinking=yes + break + ;; + esac + done + ;; + esac + + exp_sym_flag='-bexport' + no_entry_flag='-bnoentry' + fi + + # When large executables or shared objects are built, AIX ld can + # have problems creating the table of contents. If linking a library + # or program results in "error TOC overflow" add -mminimal-toc to + # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not + # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. + + archive_cmds_CXX='' + hardcode_direct_CXX=yes + hardcode_libdir_separator_CXX=':' + link_all_deplibs_CXX=yes + + if test "$GXX" = yes; then + case $host_os in aix4.[012]|aix4.[012].*) + # We only want to do this on AIX 4.2 and lower, the check + # below for broken collect2 doesn't work under 4.3+ + collect2name=`${CC} -print-prog-name=collect2` + if test -f "$collect2name" && \ + strings "$collect2name" | grep resolve_lib_name >/dev/null + then + # We have reworked collect2 + : + else + # We have old collect2 + hardcode_direct_CXX=unsupported + # It fails to find uninstalled libraries when the uninstalled + # path is not listed in the libpath. Setting hardcode_minus_L + # to unsupported forces relinking + hardcode_minus_L_CXX=yes + hardcode_libdir_flag_spec_CXX='-L$libdir' + hardcode_libdir_separator_CXX= + fi + ;; + esac + shared_flag='-shared' + if test "$aix_use_runtimelinking" = yes; then + shared_flag="$shared_flag "'${wl}-G' + fi + else + # not using gcc + if test "$host_cpu" = ia64; then + # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release + # chokes on -Wl,-G. The following line is correct: + shared_flag='-G' + else + if test "$aix_use_runtimelinking" = yes; then + shared_flag='${wl}-G' + else + shared_flag='${wl}-bM:SRE' + fi + fi + fi + + # It seems that -bexpall does not export symbols beginning with + # underscore (_), so it is better to generate a list of symbols to export. + always_export_symbols_CXX=yes + if test "$aix_use_runtimelinking" = yes; then + # Warning - without using the other runtime loading flags (-brtl), + # -berok will link without error, but may produce a broken library. + allow_undefined_flag_CXX='-berok' + # Determine the default libpath from the value encoded in an empty executable. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_cxx_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then + +lt_aix_libpath_sed=' + /Import File Strings/,/^$/ { + /^0/ { + s/^0 *\(.*\)$/\1/ + p + } + }' +aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` +# Check for a 64-bit object if we didn't find anything. +if test -z "$aix_libpath"; then + aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` +fi +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + +fi + +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext +if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi + + hardcode_libdir_flag_spec_CXX='${wl}-blibpath:$libdir:'"$aix_libpath" + + archive_expsym_cmds_CXX="\$CC"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" + else + if test "$host_cpu" = ia64; then + hardcode_libdir_flag_spec_CXX='${wl}-R $libdir:/usr/lib:/lib' + allow_undefined_flag_CXX="-z nodefs" + archive_expsym_cmds_CXX="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" + else + # Determine the default libpath from the value encoded in an empty executable. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_cxx_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then + +lt_aix_libpath_sed=' + /Import File Strings/,/^$/ { + /^0/ { + s/^0 *\(.*\)$/\1/ + p + } + }' +aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` +# Check for a 64-bit object if we didn't find anything. +if test -z "$aix_libpath"; then + aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` +fi +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + +fi + +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext +if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi + + hardcode_libdir_flag_spec_CXX='${wl}-blibpath:$libdir:'"$aix_libpath" + # Warning - without using the other run time loading flags, + # -berok will link without error, but may produce a broken library. + no_undefined_flag_CXX=' ${wl}-bernotok' + allow_undefined_flag_CXX=' ${wl}-berok' + # Exported symbols can be pulled into shared objects from archives + whole_archive_flag_spec_CXX='$convenience' + archive_cmds_need_lc_CXX=yes + # This is similar to how AIX traditionally builds its shared libraries. + archive_expsym_cmds_CXX="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' + fi + fi + ;; + + beos*) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + allow_undefined_flag_CXX=unsupported + # Joseph Beckenbach says some releases of gcc + # support --undefined. This deserves some investigation. FIXME + archive_cmds_CXX='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + else + ld_shlibs_CXX=no + fi + ;; + + chorus*) + case $cc_basename in + *) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + esac + ;; + + cygwin* | mingw* | pw32*) + # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, CXX) is actually meaningless, + # as there is no search path for DLLs. + hardcode_libdir_flag_spec_CXX='-L$libdir' + allow_undefined_flag_CXX=unsupported + always_export_symbols_CXX=no + enable_shared_with_static_runtimes_CXX=yes + + if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then + archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' + # If the export-symbols file already is a .def file (1st line + # is EXPORTS), use it as is; otherwise, prepend... + archive_expsym_cmds_CXX='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then + cp $export_symbols $output_objdir/$soname.def; + else + echo EXPORTS > $output_objdir/$soname.def; + cat $export_symbols >> $output_objdir/$soname.def; + fi~ + $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' + else + ld_shlibs_CXX=no + fi + ;; + darwin* | rhapsody*) + case $host_os in + rhapsody* | darwin1.[012]) + allow_undefined_flag_CXX='${wl}-undefined ${wl}suppress' + ;; + *) # Darwin 1.3 on + if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then + allow_undefined_flag_CXX='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' + else + case ${MACOSX_DEPLOYMENT_TARGET} in + 10.[012]) + allow_undefined_flag_CXX='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' + ;; + 10.*) + allow_undefined_flag_CXX='${wl}-undefined ${wl}dynamic_lookup' + ;; + esac + fi + ;; + esac + archive_cmds_need_lc_CXX=no + hardcode_direct_CXX=no + hardcode_automatic_CXX=yes + hardcode_shlibpath_var_CXX=unsupported + whole_archive_flag_spec_CXX='' + link_all_deplibs_CXX=yes + + if test "$GXX" = yes ; then + lt_int_apple_cc_single_mod=no + output_verbose_link_cmd='echo' + if $CC -dumpspecs 2>&1 | $EGREP 'single_module' >/dev/null ; then + lt_int_apple_cc_single_mod=yes + fi + if test "X$lt_int_apple_cc_single_mod" = Xyes ; then + archive_cmds_CXX='$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring' + else + archive_cmds_CXX='$CC -r -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring' + fi + module_cmds_CXX='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' + # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds + if test "X$lt_int_apple_cc_single_mod" = Xyes ; then + archive_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + else + archive_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -r -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + fi + module_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + else + case $cc_basename in + xlc*) + output_verbose_link_cmd='echo' + archive_cmds_CXX='$CC -qmkshrobj ${wl}-single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $xlcverstring' + module_cmds_CXX='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' + # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds + archive_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj ${wl}-single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $xlcverstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + module_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + ;; + *) + ld_shlibs_CXX=no + ;; + esac + fi + ;; + + dgux*) + case $cc_basename in + ec++*) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + ghcx*) + # Green Hills C++ Compiler + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + *) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + esac + ;; + freebsd[12]*) + # C++ shared libraries reported to be fairly broken before switch to ELF + ld_shlibs_CXX=no + ;; + freebsd-elf*) + archive_cmds_need_lc_CXX=no + ;; + freebsd* | dragonfly*) + # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF + # conventions + ld_shlibs_CXX=yes + ;; + gnu*) + ;; + hpux9*) + hardcode_libdir_flag_spec_CXX='${wl}+b ${wl}$libdir' + hardcode_libdir_separator_CXX=: + export_dynamic_flag_spec_CXX='${wl}-E' + hardcode_direct_CXX=yes + hardcode_minus_L_CXX=yes # Not in the search PATH, + # but as the default + # location of the library. + + case $cc_basename in + CC*) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + aCC*) + archive_cmds_CXX='$rm $output_objdir/$soname~$CC -b ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | grep "[-]L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' + ;; + *) + if test "$GXX" = yes; then + archive_cmds_CXX='$rm $output_objdir/$soname~$CC -shared -nostdlib -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + else + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + fi + ;; + esac + ;; + hpux10*|hpux11*) + if test $with_gnu_ld = no; then + hardcode_libdir_flag_spec_CXX='${wl}+b ${wl}$libdir' + hardcode_libdir_separator_CXX=: + + case $host_cpu in + hppa*64*|ia64*) ;; + *) + export_dynamic_flag_spec_CXX='${wl}-E' + ;; + esac + fi + case $host_cpu in + hppa*64*|ia64*) + hardcode_direct_CXX=no + hardcode_shlibpath_var_CXX=no + ;; + *) + hardcode_direct_CXX=yes + hardcode_minus_L_CXX=yes # Not in the search PATH, + # but as the default + # location of the library. + ;; + esac + + case $cc_basename in + CC*) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + aCC*) + case $host_cpu in + hppa*64*) + archive_cmds_CXX='$CC -b ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + ia64*) + archive_cmds_CXX='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + *) + archive_cmds_CXX='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + esac + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | grep "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' + ;; + *) + if test "$GXX" = yes; then + if test $with_gnu_ld = no; then + case $host_cpu in + hppa*64*) + archive_cmds_CXX='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + ia64*) + archive_cmds_CXX='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + *) + archive_cmds_CXX='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + esac + fi + else + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + fi + ;; + esac + ;; + interix[3-9]*) + hardcode_direct_CXX=no + hardcode_shlibpath_var_CXX=no + hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir' + export_dynamic_flag_spec_CXX='${wl}-E' + # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. + # Instead, shared libraries are loaded at an image base (0x10000000 by + # default) and relocated if they conflict, which is a slow very memory + # consuming and fragmenting process. To avoid this, we pick a random, + # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link + # time. Moving up from 0x10000000 also allows more sbrk(2) space. + archive_cmds_CXX='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' + archive_expsym_cmds_CXX='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' + ;; + irix5* | irix6*) + case $cc_basename in + CC*) + # SGI C++ + archive_cmds_CXX='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + + # Archives containing C++ object files must be created using + # "CC -ar", where "CC" is the IRIX C++ compiler. This is + # necessary to make sure instantiated templates are included + # in the archive. + old_archive_cmds_CXX='$CC -ar -WR,-u -o $oldlib $oldobjs' + ;; + *) + if test "$GXX" = yes; then + if test "$with_gnu_ld" = no; then + archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + else + archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` -o $lib' + fi + fi + link_all_deplibs_CXX=yes + ;; + esac + hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator_CXX=: + ;; + linux* | k*bsd*-gnu) + case $cc_basename in + KCC*) + # Kuck and Associates, Inc. (KAI) C++ Compiler + + # KCC will only create a shared library if the output file + # ends with ".so" (or ".sl" for HP-UX), so rename the library + # to its proper name (with version) after linking. + archive_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' + archive_expsym_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib ${wl}-retain-symbols-file,$export_symbols; mv \$templib $lib' + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | grep "ld"`; rm -f libconftest$shared_ext; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' + + hardcode_libdir_flag_spec_CXX='${wl}--rpath,$libdir' + export_dynamic_flag_spec_CXX='${wl}--export-dynamic' + + # Archives containing C++ object files must be created using + # "CC -Bstatic", where "CC" is the KAI C++ compiler. + old_archive_cmds_CXX='$CC -Bstatic -o $oldlib $oldobjs' + ;; + icpc*) + # Intel C++ + with_gnu_ld=yes + # version 8.0 and above of icpc choke on multiply defined symbols + # if we add $predep_objects and $postdep_objects, however 7.1 and + # earlier do not add the objects themselves. + case `$CC -V 2>&1` in + *"Version 7."*) + archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + ;; + *) # Version 8.0 or newer + tmp_idyn= + case $host_cpu in + ia64*) tmp_idyn=' -i_dynamic';; + esac + archive_cmds_CXX='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds_CXX='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + ;; + esac + archive_cmds_need_lc_CXX=no + hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir' + export_dynamic_flag_spec_CXX='${wl}--export-dynamic' + whole_archive_flag_spec_CXX='${wl}--whole-archive$convenience ${wl}--no-whole-archive' + ;; + pgCC*) + # Portland Group C++ compiler + archive_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib' + archive_expsym_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib' + + hardcode_libdir_flag_spec_CXX='${wl}--rpath ${wl}$libdir' + export_dynamic_flag_spec_CXX='${wl}--export-dynamic' + whole_archive_flag_spec_CXX='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' + ;; + cxx*) + # Compaq C++ + archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib ${wl}-retain-symbols-file $wl$export_symbols' + + runpath_var=LD_RUN_PATH + hardcode_libdir_flag_spec_CXX='-rpath $libdir' + hardcode_libdir_separator_CXX=: + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' + ;; + *) + case `$CC -V 2>&1 | sed 5q` in + *Sun\ C*) + # Sun C++ 5.9 + no_undefined_flag_CXX=' -zdefs' + archive_cmds_CXX='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + archive_expsym_cmds_CXX='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file ${wl}$export_symbols' + hardcode_libdir_flag_spec_CXX='-R$libdir' + whole_archive_flag_spec_CXX='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' + + # Not sure whether something based on + # $CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 + # would be better. + output_verbose_link_cmd='echo' + + # Archives containing C++ object files must be created using + # "CC -xar", where "CC" is the Sun C++ compiler. This is + # necessary to make sure instantiated templates are included + # in the archive. + old_archive_cmds_CXX='$CC -xar -o $oldlib $oldobjs' + ;; + esac + ;; + esac + ;; + lynxos*) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + m88k*) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + mvs*) + case $cc_basename in + cxx*) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + *) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + esac + ;; + netbsd* | netbsdelf*-gnu) + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + archive_cmds_CXX='$LD -Bshareable -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags' + wlarc= + hardcode_libdir_flag_spec_CXX='-R$libdir' + hardcode_direct_CXX=yes + hardcode_shlibpath_var_CXX=no + fi + # Workaround some broken pre-1.5 toolchains + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep conftest.$objext | $SED -e "s:-lgcc -lc -lgcc::"' + ;; + openbsd2*) + # C++ shared libraries are fairly broken + ld_shlibs_CXX=no + ;; + openbsd*) + if test -f /usr/libexec/ld.so; then + hardcode_direct_CXX=yes + hardcode_shlibpath_var_CXX=no + archive_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' + hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir' + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + archive_expsym_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file,$export_symbols -o $lib' + export_dynamic_flag_spec_CXX='${wl}-E' + whole_archive_flag_spec_CXX="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + fi + output_verbose_link_cmd='echo' + else + ld_shlibs_CXX=no + fi + ;; + osf3*) + case $cc_basename in + KCC*) + # Kuck and Associates, Inc. (KAI) C++ Compiler + + # KCC will only create a shared library if the output file + # ends with ".so" (or ".sl" for HP-UX), so rename the library + # to its proper name (with version) after linking. + archive_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' + + hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir' + hardcode_libdir_separator_CXX=: + + # Archives containing C++ object files must be created using + # "CC -Bstatic", where "CC" is the KAI C++ compiler. + old_archive_cmds_CXX='$CC -Bstatic -o $oldlib $oldobjs' + + ;; + RCC*) + # Rational C++ 2.4.1 + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + cxx*) + allow_undefined_flag_CXX=' ${wl}-expect_unresolved ${wl}\*' + archive_cmds_CXX='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && echo ${wl}-set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + + hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator_CXX=: + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld" | grep -v "ld:"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' + ;; + *) + if test "$GXX" = yes && test "$with_gnu_ld" = no; then + allow_undefined_flag_CXX=' ${wl}-expect_unresolved ${wl}\*' + archive_cmds_CXX='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + + hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator_CXX=: + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"' + + else + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + fi + ;; + esac + ;; + osf4* | osf5*) + case $cc_basename in + KCC*) + # Kuck and Associates, Inc. (KAI) C++ Compiler + + # KCC will only create a shared library if the output file + # ends with ".so" (or ".sl" for HP-UX), so rename the library + # to its proper name (with version) after linking. + archive_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' + + hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir' + hardcode_libdir_separator_CXX=: + + # Archives containing C++ object files must be created using + # the KAI C++ compiler. + old_archive_cmds_CXX='$CC -o $oldlib $oldobjs' + ;; + RCC*) + # Rational C++ 2.4.1 + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + cxx*) + allow_undefined_flag_CXX=' -expect_unresolved \*' + archive_cmds_CXX='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + archive_expsym_cmds_CXX='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~ + echo "-hidden">> $lib.exp~ + $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname -Wl,-input -Wl,$lib.exp `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib~ + $rm $lib.exp' + + hardcode_libdir_flag_spec_CXX='-rpath $libdir' + hardcode_libdir_separator_CXX=: + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld" | grep -v "ld:"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' + ;; + *) + if test "$GXX" = yes && test "$with_gnu_ld" = no; then + allow_undefined_flag_CXX=' ${wl}-expect_unresolved ${wl}\*' + archive_cmds_CXX='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + + hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator_CXX=: + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"' + + else + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + fi + ;; + esac + ;; + psos*) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + sunos4*) + case $cc_basename in + CC*) + # Sun C++ 4.x + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + lcc*) + # Lucid + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + *) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + esac + ;; + solaris*) + case $cc_basename in + CC*) + # Sun C++ 4.2, 5.x and Centerline C++ + archive_cmds_need_lc_CXX=yes + no_undefined_flag_CXX=' -zdefs' + archive_cmds_CXX='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + archive_expsym_cmds_CXX='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $CC -G${allow_undefined_flag} ${wl}-M ${wl}$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp' + + hardcode_libdir_flag_spec_CXX='-R$libdir' + hardcode_shlibpath_var_CXX=no + case $host_os in + solaris2.[0-5] | solaris2.[0-5].*) ;; + *) + # The compiler driver will combine and reorder linker options, + # but understands `-z linker_flag'. + # Supported since Solaris 2.6 (maybe 2.5.1?) + whole_archive_flag_spec_CXX='-z allextract$convenience -z defaultextract' + ;; + esac + link_all_deplibs_CXX=yes + + output_verbose_link_cmd='echo' + + # Archives containing C++ object files must be created using + # "CC -xar", where "CC" is the Sun C++ compiler. This is + # necessary to make sure instantiated templates are included + # in the archive. + old_archive_cmds_CXX='$CC -xar -o $oldlib $oldobjs' + ;; + gcx*) + # Green Hills C++ Compiler + archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' + + # The C++ compiler must be used to create the archive. + old_archive_cmds_CXX='$CC $LDFLAGS -archive -o $oldlib $oldobjs' + ;; + *) + # GNU C++ compiler with Solaris linker + if test "$GXX" = yes && test "$with_gnu_ld" = no; then + no_undefined_flag_CXX=' ${wl}-z ${wl}defs' + if $CC --version | grep -v '^2\.7' > /dev/null; then + archive_cmds_CXX='$CC -shared -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' + archive_expsym_cmds_CXX='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $CC -shared -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp' + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd="$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep \"\-L\"" + else + # g++ 2.7 appears to require `-G' NOT `-shared' on this + # platform. + archive_cmds_CXX='$CC -G -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' + archive_expsym_cmds_CXX='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $CC -G -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp' + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd="$CC -G $CFLAGS -v conftest.$objext 2>&1 | grep \"\-L\"" + fi + + hardcode_libdir_flag_spec_CXX='${wl}-R $wl$libdir' + case $host_os in + solaris2.[0-5] | solaris2.[0-5].*) ;; + *) + whole_archive_flag_spec_CXX='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' + ;; + esac + fi + ;; + esac + ;; + sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*) + no_undefined_flag_CXX='${wl}-z,text' + archive_cmds_need_lc_CXX=no + hardcode_shlibpath_var_CXX=no + runpath_var='LD_RUN_PATH' + + case $cc_basename in + CC*) + archive_cmds_CXX='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds_CXX='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + *) + archive_cmds_CXX='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds_CXX='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + esac + ;; + sysv5* | sco3.2v5* | sco5v6*) + # Note: We can NOT use -z defs as we might desire, because we do not + # link with -lc, and that would cause any symbols used from libc to + # always be unresolved, which means just about no library would + # ever link correctly. If we're not using GNU ld we use -z text + # though, which does catch some bad symbols but isn't as heavy-handed + # as -z defs. + # For security reasons, it is highly recommended that you always + # use absolute paths for naming shared libraries, and exclude the + # DT_RUNPATH tag from executables and libraries. But doing so + # requires that you compile everything twice, which is a pain. + # So that behaviour is only enabled if SCOABSPATH is set to a + # non-empty value in the environment. Most likely only useful for + # creating official distributions of packages. + # This is a hack until libtool officially supports absolute path + # names for shared libraries. + no_undefined_flag_CXX='${wl}-z,text' + allow_undefined_flag_CXX='${wl}-z,nodefs' + archive_cmds_need_lc_CXX=no + hardcode_shlibpath_var_CXX=no + hardcode_libdir_flag_spec_CXX='`test -z "$SCOABSPATH" && echo ${wl}-R,$libdir`' + hardcode_libdir_separator_CXX=':' + link_all_deplibs_CXX=yes + export_dynamic_flag_spec_CXX='${wl}-Bexport' + runpath_var='LD_RUN_PATH' + + case $cc_basename in + CC*) + archive_cmds_CXX='$CC -G ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds_CXX='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + *) + archive_cmds_CXX='$CC -shared ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds_CXX='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + esac + ;; + tandem*) + case $cc_basename in + NCC*) + # NonStop-UX NCC 3.20 + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + *) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + esac + ;; + vxworks*) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + *) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; +esac +{ echo "$as_me:$LINENO: result: $ld_shlibs_CXX" >&5 +echo "${ECHO_T}$ld_shlibs_CXX" >&6; } +test "$ld_shlibs_CXX" = no && can_build_shared=no + +GCC_CXX="$GXX" +LD_CXX="$LD" + + +cat > conftest.$ac_ext <&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + # Parse the compiler output and extract the necessary + # objects, libraries and library flags. + + # Sentinel used to keep track of whether or not we are before + # the conftest object file. + pre_test_object_deps_done=no + + # The `*' in the case matches for architectures that use `case' in + # $output_verbose_cmd can trigger glob expansion during the loop + # eval without this substitution. + output_verbose_link_cmd=`$echo "X$output_verbose_link_cmd" | $Xsed -e "$no_glob_subst"` + + for p in `eval $output_verbose_link_cmd`; do + case $p in + + -L* | -R* | -l*) + # Some compilers place space between "-{L,R}" and the path. + # Remove the space. + if test $p = "-L" \ + || test $p = "-R"; then + prev=$p + continue + else + prev= + fi + + if test "$pre_test_object_deps_done" = no; then + case $p in + -L* | -R*) + # Internal compiler library paths should come after those + # provided the user. The postdeps already come after the + # user supplied libs so there is no need to process them. + if test -z "$compiler_lib_search_path_CXX"; then + compiler_lib_search_path_CXX="${prev}${p}" + else + compiler_lib_search_path_CXX="${compiler_lib_search_path_CXX} ${prev}${p}" + fi + ;; + # The "-l" case would never come before the object being + # linked, so don't bother handling this case. + esac + else + if test -z "$postdeps_CXX"; then + postdeps_CXX="${prev}${p}" + else + postdeps_CXX="${postdeps_CXX} ${prev}${p}" + fi + fi + ;; + + *.$objext) + # This assumes that the test object file only shows up + # once in the compiler output. + if test "$p" = "conftest.$objext"; then + pre_test_object_deps_done=yes + continue + fi + + if test "$pre_test_object_deps_done" = no; then + if test -z "$predep_objects_CXX"; then + predep_objects_CXX="$p" + else + predep_objects_CXX="$predep_objects_CXX $p" + fi + else + if test -z "$postdep_objects_CXX"; then + postdep_objects_CXX="$p" + else + postdep_objects_CXX="$postdep_objects_CXX $p" + fi + fi + ;; + + *) ;; # Ignore the rest. + + esac + done + + # Clean up. + rm -f a.out a.exe +else + echo "libtool.m4: error: problem compiling CXX test program" +fi + +$rm -f confest.$objext + +# PORTME: override above test on systems where it is broken +case $host_os in +interix[3-9]*) + # Interix 3.5 installs completely hosed .la files for C++, so rather than + # hack all around it, let's just trust "g++" to DTRT. + predep_objects_CXX= + postdep_objects_CXX= + postdeps_CXX= + ;; + +linux*) + case `$CC -V 2>&1 | sed 5q` in + *Sun\ C*) + # Sun C++ 5.9 + # + # The more standards-conforming stlport4 library is + # incompatible with the Cstd library. Avoid specifying + # it if it's in CXXFLAGS. Ignore libCrun as + # -library=stlport4 depends on it. + case " $CXX $CXXFLAGS " in + *" -library=stlport4 "*) + solaris_use_stlport4=yes + ;; + esac + if test "$solaris_use_stlport4" != yes; then + postdeps_CXX='-library=Cstd -library=Crun' + fi + ;; + esac + ;; + +solaris*) + case $cc_basename in + CC*) + # The more standards-conforming stlport4 library is + # incompatible with the Cstd library. Avoid specifying + # it if it's in CXXFLAGS. Ignore libCrun as + # -library=stlport4 depends on it. + case " $CXX $CXXFLAGS " in + *" -library=stlport4 "*) + solaris_use_stlport4=yes + ;; + esac + + # Adding this requires a known-good setup of shared libraries for + # Sun compiler versions before 5.6, else PIC objects from an old + # archive will be linked into the output, leading to subtle bugs. + if test "$solaris_use_stlport4" != yes; then + postdeps_CXX='-library=Cstd -library=Crun' + fi + ;; + esac + ;; +esac + + +case " $postdeps_CXX " in +*" -lc "*) archive_cmds_need_lc_CXX=no ;; +esac + +lt_prog_compiler_wl_CXX= +lt_prog_compiler_pic_CXX= +lt_prog_compiler_static_CXX= + +{ echo "$as_me:$LINENO: checking for $compiler option to produce PIC" >&5 +echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6; } + + # C++ specific cases for pic, static, wl, etc. + if test "$GXX" = yes; then + lt_prog_compiler_wl_CXX='-Wl,' + lt_prog_compiler_static_CXX='-static' + + case $host_os in + aix*) + # All AIX code is PIC. + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + lt_prog_compiler_static_CXX='-Bstatic' + fi + ;; + amigaos*) + # FIXME: we need at least 68020 code to build shared libraries, but + # adding the `-m68020' flag to GCC prevents building anything better, + # like `-m68040'. + lt_prog_compiler_pic_CXX='-m68020 -resident32 -malways-restore-a4' + ;; + beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) + # PIC is the default for these OSes. + ;; + mingw* | cygwin* | os2* | pw32*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + # Although the cygwin gcc ignores -fPIC, still need this for old-style + # (--disable-auto-import) libraries + lt_prog_compiler_pic_CXX='-DDLL_EXPORT' + ;; + darwin* | rhapsody*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + lt_prog_compiler_pic_CXX='-fno-common' + ;; + *djgpp*) + # DJGPP does not support shared libraries at all + lt_prog_compiler_pic_CXX= + ;; + interix[3-9]*) + # Interix 3.x gcc -fpic/-fPIC options generate broken code. + # Instead, we relocate shared libraries at runtime. + ;; + sysv4*MP*) + if test -d /usr/nec; then + lt_prog_compiler_pic_CXX=-Kconform_pic + fi + ;; + hpux*) + # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but + # not for PA HP-UX. + case $host_cpu in + hppa*64*|ia64*) + ;; + *) + lt_prog_compiler_pic_CXX='-fPIC' + ;; + esac + ;; + *) + lt_prog_compiler_pic_CXX='-fPIC' + ;; + esac + else + case $host_os in + aix4* | aix5*) + # All AIX code is PIC. + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + lt_prog_compiler_static_CXX='-Bstatic' + else + lt_prog_compiler_static_CXX='-bnso -bI:/lib/syscalls.exp' + fi + ;; + chorus*) + case $cc_basename in + cxch68*) + # Green Hills C++ Compiler + # _LT_AC_TAGVAR(lt_prog_compiler_static, CXX)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a" + ;; + esac + ;; + darwin*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + case $cc_basename in + xlc*) + lt_prog_compiler_pic_CXX='-qnocommon' + lt_prog_compiler_wl_CXX='-Wl,' + ;; + esac + ;; + dgux*) + case $cc_basename in + ec++*) + lt_prog_compiler_pic_CXX='-KPIC' + ;; + ghcx*) + # Green Hills C++ Compiler + lt_prog_compiler_pic_CXX='-pic' + ;; + *) + ;; + esac + ;; + freebsd* | dragonfly*) + # FreeBSD uses GNU C++ + ;; + hpux9* | hpux10* | hpux11*) + case $cc_basename in + CC*) + lt_prog_compiler_wl_CXX='-Wl,' + lt_prog_compiler_static_CXX='${wl}-a ${wl}archive' + if test "$host_cpu" != ia64; then + lt_prog_compiler_pic_CXX='+Z' + fi + ;; + aCC*) + lt_prog_compiler_wl_CXX='-Wl,' + lt_prog_compiler_static_CXX='${wl}-a ${wl}archive' + case $host_cpu in + hppa*64*|ia64*) + # +Z the default + ;; + *) + lt_prog_compiler_pic_CXX='+Z' + ;; + esac + ;; + *) + ;; + esac + ;; + interix*) + # This is c89, which is MS Visual C++ (no shared libs) + # Anyone wants to do a port? + ;; + irix5* | irix6* | nonstopux*) + case $cc_basename in + CC*) + lt_prog_compiler_wl_CXX='-Wl,' + lt_prog_compiler_static_CXX='-non_shared' + # CC pic flag -KPIC is the default. + ;; + *) + ;; + esac + ;; + linux* | k*bsd*-gnu) + case $cc_basename in + KCC*) + # KAI C++ Compiler + lt_prog_compiler_wl_CXX='--backend -Wl,' + lt_prog_compiler_pic_CXX='-fPIC' + ;; + icpc* | ecpc*) + # Intel C++ + lt_prog_compiler_wl_CXX='-Wl,' + lt_prog_compiler_pic_CXX='-KPIC' + lt_prog_compiler_static_CXX='-static' + ;; + pgCC*) + # Portland Group C++ compiler. + lt_prog_compiler_wl_CXX='-Wl,' + lt_prog_compiler_pic_CXX='-fpic' + lt_prog_compiler_static_CXX='-Bstatic' + ;; + cxx*) + # Compaq C++ + # Make sure the PIC flag is empty. It appears that all Alpha + # Linux and Compaq Tru64 Unix objects are PIC. + lt_prog_compiler_pic_CXX= + lt_prog_compiler_static_CXX='-non_shared' + ;; + *) + case `$CC -V 2>&1 | sed 5q` in + *Sun\ C*) + # Sun C++ 5.9 + lt_prog_compiler_pic_CXX='-KPIC' + lt_prog_compiler_static_CXX='-Bstatic' + lt_prog_compiler_wl_CXX='-Qoption ld ' + ;; + esac + ;; + esac + ;; + lynxos*) + ;; + m88k*) + ;; + mvs*) + case $cc_basename in + cxx*) + lt_prog_compiler_pic_CXX='-W c,exportall' + ;; + *) + ;; + esac + ;; + netbsd* | netbsdelf*-gnu) + ;; + osf3* | osf4* | osf5*) + case $cc_basename in + KCC*) + lt_prog_compiler_wl_CXX='--backend -Wl,' + ;; + RCC*) + # Rational C++ 2.4.1 + lt_prog_compiler_pic_CXX='-pic' + ;; + cxx*) + # Digital/Compaq C++ + lt_prog_compiler_wl_CXX='-Wl,' + # Make sure the PIC flag is empty. It appears that all Alpha + # Linux and Compaq Tru64 Unix objects are PIC. + lt_prog_compiler_pic_CXX= + lt_prog_compiler_static_CXX='-non_shared' + ;; + *) + ;; + esac + ;; + psos*) + ;; + solaris*) + case $cc_basename in + CC*) + # Sun C++ 4.2, 5.x and Centerline C++ + lt_prog_compiler_pic_CXX='-KPIC' + lt_prog_compiler_static_CXX='-Bstatic' + lt_prog_compiler_wl_CXX='-Qoption ld ' + ;; + gcx*) + # Green Hills C++ Compiler + lt_prog_compiler_pic_CXX='-PIC' + ;; + *) + ;; + esac + ;; + sunos4*) + case $cc_basename in + CC*) + # Sun C++ 4.x + lt_prog_compiler_pic_CXX='-pic' + lt_prog_compiler_static_CXX='-Bstatic' + ;; + lcc*) + # Lucid + lt_prog_compiler_pic_CXX='-pic' + ;; + *) + ;; + esac + ;; + tandem*) + case $cc_basename in + NCC*) + # NonStop-UX NCC 3.20 + lt_prog_compiler_pic_CXX='-KPIC' + ;; + *) + ;; + esac + ;; + sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) + case $cc_basename in + CC*) + lt_prog_compiler_wl_CXX='-Wl,' + lt_prog_compiler_pic_CXX='-KPIC' + lt_prog_compiler_static_CXX='-Bstatic' + ;; + esac + ;; + vxworks*) + ;; + *) + lt_prog_compiler_can_build_shared_CXX=no + ;; + esac + fi + +{ echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_CXX" >&5 +echo "${ECHO_T}$lt_prog_compiler_pic_CXX" >&6; } + +# +# Check to make sure the PIC flag actually works. +# +if test -n "$lt_prog_compiler_pic_CXX"; then + +{ echo "$as_me:$LINENO: checking if $compiler PIC flag $lt_prog_compiler_pic_CXX works" >&5 +echo $ECHO_N "checking if $compiler PIC flag $lt_prog_compiler_pic_CXX works... $ECHO_C" >&6; } +if test "${lt_prog_compiler_pic_works_CXX+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + lt_prog_compiler_pic_works_CXX=no + ac_outfile=conftest.$ac_objext + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + lt_compiler_flag="$lt_prog_compiler_pic_CXX -DPIC" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + # The option is referenced via a variable to avoid confusing sed. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ + -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:12418: $lt_compile\"" >&5) + (eval "$lt_compile" 2>conftest.err) + ac_status=$? + cat conftest.err >&5 + echo "$as_me:12422: \$? = $ac_status" >&5 + if (exit $ac_status) && test -s "$ac_outfile"; then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings other than the usual output. + $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp + $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 + if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then + lt_prog_compiler_pic_works_CXX=yes + fi + fi + $rm conftest* + +fi +{ echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_works_CXX" >&5 +echo "${ECHO_T}$lt_prog_compiler_pic_works_CXX" >&6; } + +if test x"$lt_prog_compiler_pic_works_CXX" = xyes; then + case $lt_prog_compiler_pic_CXX in + "" | " "*) ;; + *) lt_prog_compiler_pic_CXX=" $lt_prog_compiler_pic_CXX" ;; + esac +else + lt_prog_compiler_pic_CXX= + lt_prog_compiler_can_build_shared_CXX=no +fi + +fi +case $host_os in + # For platforms which do not support PIC, -DPIC is meaningless: + *djgpp*) + lt_prog_compiler_pic_CXX= + ;; + *) + lt_prog_compiler_pic_CXX="$lt_prog_compiler_pic_CXX -DPIC" + ;; +esac + +# +# Check to make sure the static flag actually works. +# +wl=$lt_prog_compiler_wl_CXX eval lt_tmp_static_flag=\"$lt_prog_compiler_static_CXX\" +{ echo "$as_me:$LINENO: checking if $compiler static flag $lt_tmp_static_flag works" >&5 +echo $ECHO_N "checking if $compiler static flag $lt_tmp_static_flag works... $ECHO_C" >&6; } +if test "${lt_prog_compiler_static_works_CXX+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + lt_prog_compiler_static_works_CXX=no + save_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS $lt_tmp_static_flag" + echo "$lt_simple_link_test_code" > conftest.$ac_ext + if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then + # The linker can only warn and ignore the option if not recognized + # So say no if there are warnings + if test -s conftest.err; then + # Append any errors to the config.log. + cat conftest.err 1>&5 + $echo "X$_lt_linker_boilerplate" | $Xsed -e '/^$/d' > conftest.exp + $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 + if diff conftest.exp conftest.er2 >/dev/null; then + lt_prog_compiler_static_works_CXX=yes + fi + else + lt_prog_compiler_static_works_CXX=yes + fi + fi + $rm conftest* + LDFLAGS="$save_LDFLAGS" + +fi +{ echo "$as_me:$LINENO: result: $lt_prog_compiler_static_works_CXX" >&5 +echo "${ECHO_T}$lt_prog_compiler_static_works_CXX" >&6; } + +if test x"$lt_prog_compiler_static_works_CXX" = xyes; then + : +else + lt_prog_compiler_static_CXX= +fi + + +{ echo "$as_me:$LINENO: checking if $compiler supports -c -o file.$ac_objext" >&5 +echo $ECHO_N "checking if $compiler supports -c -o file.$ac_objext... $ECHO_C" >&6; } +if test "${lt_cv_prog_compiler_c_o_CXX+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + lt_cv_prog_compiler_c_o_CXX=no + $rm -r conftest 2>/dev/null + mkdir conftest + cd conftest + mkdir out + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + + lt_compiler_flag="-o out/conftest2.$ac_objext" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ + -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:12522: $lt_compile\"" >&5) + (eval "$lt_compile" 2>out/conftest.err) + ac_status=$? + cat out/conftest.err >&5 + echo "$as_me:12526: \$? = $ac_status" >&5 + if (exit $ac_status) && test -s out/conftest2.$ac_objext + then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' > out/conftest.exp + $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 + if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then + lt_cv_prog_compiler_c_o_CXX=yes + fi + fi + chmod u+w . 2>&5 + $rm conftest* + # SGI C++ compiler will create directory out/ii_files/ for + # template instantiation + test -d out/ii_files && $rm out/ii_files/* && rmdir out/ii_files + $rm out/* && rmdir out + cd .. + rmdir conftest + $rm conftest* + +fi +{ echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_c_o_CXX" >&5 +echo "${ECHO_T}$lt_cv_prog_compiler_c_o_CXX" >&6; } + + +hard_links="nottested" +if test "$lt_cv_prog_compiler_c_o_CXX" = no && test "$need_locks" != no; then + # do not overwrite the value of need_locks provided by the user + { echo "$as_me:$LINENO: checking if we can lock with hard links" >&5 +echo $ECHO_N "checking if we can lock with hard links... $ECHO_C" >&6; } + hard_links=yes + $rm conftest* + ln conftest.a conftest.b 2>/dev/null && hard_links=no + touch conftest.a + ln conftest.a conftest.b 2>&5 || hard_links=no + ln conftest.a conftest.b 2>/dev/null && hard_links=no + { echo "$as_me:$LINENO: result: $hard_links" >&5 +echo "${ECHO_T}$hard_links" >&6; } + if test "$hard_links" = no; then + { echo "$as_me:$LINENO: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5 +echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;} + need_locks=warn + fi +else + need_locks=no +fi + +{ echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5 +echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared libraries... $ECHO_C" >&6; } + + export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' + case $host_os in + aix4* | aix5*) + # If we're using GNU nm, then we don't want the "-C" option. + # -C means demangle to AIX nm, but means don't demangle with GNU nm + if $NM -V 2>&1 | grep 'GNU' > /dev/null; then + export_symbols_cmds_CXX='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' + else + export_symbols_cmds_CXX='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' + fi + ;; + pw32*) + export_symbols_cmds_CXX="$ltdll_cmds" + ;; + cygwin* | mingw*) + export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/;/^.*[ ]__nm__/s/^.*[ ]__nm__\([^ ]*\)[ ][^ ]*/\1 DATA/;/^I[ ]/d;/^[AITW][ ]/s/.*[ ]//'\'' | sort | uniq > $export_symbols' + ;; + linux* | k*bsd*-gnu) + link_all_deplibs_CXX=no + ;; + *) + export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' + ;; + esac + +{ echo "$as_me:$LINENO: result: $ld_shlibs_CXX" >&5 +echo "${ECHO_T}$ld_shlibs_CXX" >&6; } +test "$ld_shlibs_CXX" = no && can_build_shared=no + +# +# Do we need to explicitly link libc? +# +case "x$archive_cmds_need_lc_CXX" in +x|xyes) + # Assume -lc should be added + archive_cmds_need_lc_CXX=yes + + if test "$enable_shared" = yes && test "$GCC" = yes; then + case $archive_cmds_CXX in + *'~'*) + # FIXME: we may have to deal with multi-command sequences. + ;; + '$CC '*) + # Test whether the compiler implicitly links with -lc since on some + # systems, -lgcc has to come before -lc. If gcc already passes -lc + # to ld, don't add -lc before -lgcc. + { echo "$as_me:$LINENO: checking whether -lc should be explicitly linked in" >&5 +echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >&6; } + $rm conftest* + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + + if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } 2>conftest.err; then + soname=conftest + lib=conftest + libobjs=conftest.$ac_objext + deplibs= + wl=$lt_prog_compiler_wl_CXX + pic_flag=$lt_prog_compiler_pic_CXX + compiler_flags=-v + linker_flags=-v + verstring= + output_objdir=. + libname=conftest + lt_save_allow_undefined_flag=$allow_undefined_flag_CXX + allow_undefined_flag_CXX= + if { (eval echo "$as_me:$LINENO: \"$archive_cmds_CXX 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1\"") >&5 + (eval $archive_cmds_CXX 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } + then + archive_cmds_need_lc_CXX=no + else + archive_cmds_need_lc_CXX=yes + fi + allow_undefined_flag_CXX=$lt_save_allow_undefined_flag + else + cat conftest.err 1>&5 + fi + $rm conftest* + { echo "$as_me:$LINENO: result: $archive_cmds_need_lc_CXX" >&5 +echo "${ECHO_T}$archive_cmds_need_lc_CXX" >&6; } + ;; + esac + fi + ;; +esac + +{ echo "$as_me:$LINENO: checking dynamic linker characteristics" >&5 +echo $ECHO_N "checking dynamic linker characteristics... $ECHO_C" >&6; } +library_names_spec= +libname_spec='lib$name' +soname_spec= +shrext_cmds=".so" +postinstall_cmds= +postuninstall_cmds= +finish_cmds= +finish_eval= +shlibpath_var= +shlibpath_overrides_runpath=unknown +version_type=none +dynamic_linker="$host_os ld.so" +sys_lib_dlsearch_path_spec="/lib /usr/lib" + +need_lib_prefix=unknown +hardcode_into_libs=no + +# when you set need_version to no, make sure it does not cause -set_version +# flags to be left without arguments +need_version=unknown + +case $host_os in +aix3*) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' + shlibpath_var=LIBPATH + + # AIX 3 has no versioning support, so we append a major version to the name. + soname_spec='${libname}${release}${shared_ext}$major' + ;; + +aix4* | aix5*) + version_type=linux + need_lib_prefix=no + need_version=no + hardcode_into_libs=yes + if test "$host_cpu" = ia64; then + # AIX 5 supports IA64 + library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + else + # With GCC up to 2.95.x, collect2 would create an import file + # for dependence libraries. The import file would start with + # the line `#! .'. This would cause the generated library to + # depend on `.', always an invalid library. This was fixed in + # development snapshots of GCC prior to 3.0. + case $host_os in + aix4 | aix4.[01] | aix4.[01].*) + if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' + echo ' yes ' + echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then + : + else + can_build_shared=no + fi + ;; + esac + # AIX (on Power*) has no versioning support, so currently we can not hardcode correct + # soname into executable. Probably we can add versioning support to + # collect2, so additional links can be useful in future. + if test "$aix_use_runtimelinking" = yes; then + # If using run time linking (on AIX 4.2 or later) use lib.so + # instead of lib.a to let people know that these are not + # typical AIX shared libraries. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + else + # We preserve .a as extension for shared libraries through AIX4.2 + # and later when we are not doing run time linking. + library_names_spec='${libname}${release}.a $libname.a' + soname_spec='${libname}${release}${shared_ext}$major' + fi + shlibpath_var=LIBPATH + fi + ;; + +amigaos*) + library_names_spec='$libname.ixlibrary $libname.a' + # Create ${libname}_ixlibrary.a entries in /sys/libs. + finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' + ;; + +beos*) + library_names_spec='${libname}${shared_ext}' + dynamic_linker="$host_os ld.so" + shlibpath_var=LIBRARY_PATH + ;; + +bsdi[45]*) + version_type=linux + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' + shlibpath_var=LD_LIBRARY_PATH + sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" + sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" + # the default ld.so.conf also contains /usr/contrib/lib and + # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow + # libtool to hard-code these into programs + ;; + +cygwin* | mingw* | pw32*) + version_type=windows + shrext_cmds=".dll" + need_version=no + need_lib_prefix=no + + case $GCC,$host_os in + yes,cygwin* | yes,mingw* | yes,pw32*) + library_names_spec='$libname.dll.a' + # DLL is installed to $(libdir)/../bin by postinstall_cmds + postinstall_cmds='base_file=`basename \${file}`~ + dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i;echo \$dlname'\''`~ + dldir=$destdir/`dirname \$dlpath`~ + test -d \$dldir || mkdir -p \$dldir~ + $install_prog $dir/$dlname \$dldir/$dlname~ + chmod a+x \$dldir/$dlname' + postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ + dlpath=$dir/\$dldll~ + $rm \$dlpath' + shlibpath_overrides_runpath=yes + + case $host_os in + cygwin*) + # Cygwin DLLs use 'cyg' prefix rather than 'lib' + soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' + sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib" + ;; + mingw*) + # MinGW DLLs use traditional 'lib' prefix + soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' + sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` + if echo "$sys_lib_search_path_spec" | grep ';[c-zC-Z]:/' >/dev/null; then + # It is most probably a Windows format PATH printed by + # mingw gcc, but we are running on Cygwin. Gcc prints its search + # path with ; separators, and with drive letters. We can handle the + # drive letters (cygwin fileutils understands them), so leave them, + # especially as we might pass files found there to a mingw objdump, + # which wouldn't understand a cygwinified path. Ahh. + sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` + else + sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + fi + ;; + pw32*) + # pw32 DLLs use 'pw' prefix rather than 'lib' + library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' + ;; + esac + ;; + + *) + library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib' + ;; + esac + dynamic_linker='Win32 ld.exe' + # FIXME: first we should search . and the directory the executable is in + shlibpath_var=PATH + ;; + +darwin* | rhapsody*) + dynamic_linker="$host_os dyld" + version_type=darwin + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${versuffix}$shared_ext ${libname}${release}${major}$shared_ext ${libname}$shared_ext' + soname_spec='${libname}${release}${major}$shared_ext' + shlibpath_overrides_runpath=yes + shlibpath_var=DYLD_LIBRARY_PATH + shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' + + sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' + ;; + +dgux*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +freebsd1*) + dynamic_linker=no + ;; + +freebsd* | dragonfly*) + # DragonFly does not have aout. When/if they implement a new + # versioning mechanism, adjust this. + if test -x /usr/bin/objformat; then + objformat=`/usr/bin/objformat` + else + case $host_os in + freebsd[123]*) objformat=aout ;; + *) objformat=elf ;; + esac + fi + version_type=freebsd-$objformat + case $version_type in + freebsd-elf*) + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' + need_version=no + need_lib_prefix=no + ;; + freebsd-*) + library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' + need_version=yes + ;; + esac + shlibpath_var=LD_LIBRARY_PATH + case $host_os in + freebsd2*) + shlibpath_overrides_runpath=yes + ;; + freebsd3.[01]* | freebsdelf3.[01]*) + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + freebsd3.[2-9]* | freebsdelf3.[2-9]* | \ + freebsd4.[0-5] | freebsdelf4.[0-5] | freebsd4.1.1 | freebsdelf4.1.1) + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + *) # from 4.6 on, and DragonFly + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + esac + ;; + +gnu*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + hardcode_into_libs=yes + ;; + +hpux9* | hpux10* | hpux11*) + # Give a soname corresponding to the major version so that dld.sl refuses to + # link against other versions. + version_type=sunos + need_lib_prefix=no + need_version=no + case $host_cpu in + ia64*) + shrext_cmds='.so' + hardcode_into_libs=yes + dynamic_linker="$host_os dld.so" + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + if test "X$HPUX_IA64_MODE" = X32; then + sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" + else + sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" + fi + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + ;; + hppa*64*) + shrext_cmds='.sl' + hardcode_into_libs=yes + dynamic_linker="$host_os dld.sl" + shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH + shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + ;; + *) + shrext_cmds='.sl' + dynamic_linker="$host_os dld.sl" + shlibpath_var=SHLIB_PATH + shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + ;; + esac + # HP-UX runs *really* slowly unless shared libraries are mode 555. + postinstall_cmds='chmod 555 $lib' + ;; + +interix[3-9]*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + +irix5* | irix6* | nonstopux*) + case $host_os in + nonstopux*) version_type=nonstopux ;; + *) + if test "$lt_cv_prog_gnu_ld" = yes; then + version_type=linux + else + version_type=irix + fi ;; + esac + need_lib_prefix=no + need_version=no + soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' + case $host_os in + irix5* | nonstopux*) + libsuff= shlibsuff= + ;; + *) + case $LD in # libtool.m4 will add one of these switches to LD + *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") + libsuff= shlibsuff= libmagic=32-bit;; + *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") + libsuff=32 shlibsuff=N32 libmagic=N32;; + *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") + libsuff=64 shlibsuff=64 libmagic=64-bit;; + *) libsuff= shlibsuff= libmagic=never-match;; + esac + ;; + esac + shlibpath_var=LD_LIBRARY${shlibsuff}_PATH + shlibpath_overrides_runpath=no + sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" + sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" + hardcode_into_libs=yes + ;; + +# No shared lib support for Linux oldld, aout, or coff. +linux*oldld* | linux*aout* | linux*coff*) + dynamic_linker=no + ;; + +# This must be Linux ELF. +linux* | k*bsd*-gnu) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + # This implies no fast_install, which is unacceptable. + # Some rework will be needed to allow for fast_install + # before this can be enabled. + hardcode_into_libs=yes + + # Append ld.so.conf contents to the search path + if test -f /etc/ld.so.conf; then + lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` + sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" + fi + + # We used to test for /lib/ld.so.1 and disable shared libraries on + # powerpc, because MkLinux only supported shared libraries with the + # GNU dynamic linker. Since this was broken with cross compilers, + # most powerpc-linux boxes support dynamic linking these days and + # people can always --disable-shared, the test was removed, and we + # assume the GNU/Linux dynamic linker is in use. + dynamic_linker='GNU/Linux ld.so' + ;; + +netbsdelf*-gnu) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + dynamic_linker='NetBSD ld.elf_so' + ;; + +netbsd*) + version_type=sunos + need_lib_prefix=no + need_version=no + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + dynamic_linker='NetBSD (a.out) ld.so' + else + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + dynamic_linker='NetBSD ld.elf_so' + fi + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + +newsos6) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + ;; + +nto-qnx*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + ;; + +openbsd*) + version_type=sunos + sys_lib_dlsearch_path_spec="/usr/lib" + need_lib_prefix=no + # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. + case $host_os in + openbsd3.3 | openbsd3.3.*) need_version=yes ;; + *) need_version=no ;; + esac + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + shlibpath_var=LD_LIBRARY_PATH + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + case $host_os in + openbsd2.[89] | openbsd2.[89].*) + shlibpath_overrides_runpath=no + ;; + *) + shlibpath_overrides_runpath=yes + ;; + esac + else + shlibpath_overrides_runpath=yes + fi + ;; + +os2*) + libname_spec='$name' + shrext_cmds=".dll" + need_lib_prefix=no + library_names_spec='$libname${shared_ext} $libname.a' + dynamic_linker='OS/2 ld.exe' + shlibpath_var=LIBPATH + ;; + +osf3* | osf4* | osf5*) + version_type=osf + need_lib_prefix=no + need_version=no + soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" + sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" + ;; + +rdos*) + dynamic_linker=no + ;; + +solaris*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + # ldd complains unless libraries are executable + postinstall_cmds='chmod +x $lib' + ;; + +sunos4*) + version_type=sunos + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + if test "$with_gnu_ld" = yes; then + need_lib_prefix=no + fi + need_version=yes + ;; + +sysv4 | sysv4.3*) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + case $host_vendor in + sni) + shlibpath_overrides_runpath=no + need_lib_prefix=no + export_dynamic_flag_spec='${wl}-Blargedynsym' + runpath_var=LD_RUN_PATH + ;; + siemens) + need_lib_prefix=no + ;; + motorola) + need_lib_prefix=no + need_version=no + shlibpath_overrides_runpath=no + sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' + ;; + esac + ;; + +sysv4*MP*) + if test -d /usr/nec ;then + version_type=linux + library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' + soname_spec='$libname${shared_ext}.$major' + shlibpath_var=LD_LIBRARY_PATH + fi + ;; + +sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) + version_type=freebsd-elf + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + hardcode_into_libs=yes + if test "$with_gnu_ld" = yes; then + sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' + shlibpath_overrides_runpath=no + else + sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' + shlibpath_overrides_runpath=yes + case $host_os in + sco3.2v5*) + sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" + ;; + esac + fi + sys_lib_dlsearch_path_spec='/usr/lib' + ;; + +uts4*) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +*) + dynamic_linker=no + ;; +esac +{ echo "$as_me:$LINENO: result: $dynamic_linker" >&5 +echo "${ECHO_T}$dynamic_linker" >&6; } +test "$dynamic_linker" = no && can_build_shared=no + +variables_saved_for_relink="PATH $shlibpath_var $runpath_var" +if test "$GCC" = yes; then + variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" +fi + +{ echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5 +echo $ECHO_N "checking how to hardcode library paths into programs... $ECHO_C" >&6; } +hardcode_action_CXX= +if test -n "$hardcode_libdir_flag_spec_CXX" || \ + test -n "$runpath_var_CXX" || \ + test "X$hardcode_automatic_CXX" = "Xyes" ; then + + # We can hardcode non-existant directories. + if test "$hardcode_direct_CXX" != no && + # If the only mechanism to avoid hardcoding is shlibpath_var, we + # have to relink, otherwise we might link with an installed library + # when we should be linking with a yet-to-be-installed one + ## test "$_LT_AC_TAGVAR(hardcode_shlibpath_var, CXX)" != no && + test "$hardcode_minus_L_CXX" != no; then + # Linking always hardcodes the temporary library directory. + hardcode_action_CXX=relink + else + # We can link without hardcoding, and we can hardcode nonexisting dirs. + hardcode_action_CXX=immediate + fi +else + # We cannot hardcode anything, or else we can only hardcode existing + # directories. + hardcode_action_CXX=unsupported +fi +{ echo "$as_me:$LINENO: result: $hardcode_action_CXX" >&5 +echo "${ECHO_T}$hardcode_action_CXX" >&6; } + +if test "$hardcode_action_CXX" = relink; then + # Fast installation is not supported + enable_fast_install=no +elif test "$shlibpath_overrides_runpath" = yes || + test "$enable_shared" = no; then + # Fast installation is not necessary + enable_fast_install=needless +fi + + +# The else clause should only fire when bootstrapping the +# libtool distribution, otherwise you forgot to ship ltmain.sh +# with your package, and you will get complaints that there are +# no rules to generate ltmain.sh. +if test -f "$ltmain"; then + # See if we are running on zsh, and set the options which allow our commands through + # without removal of \ escapes. + if test -n "${ZSH_VERSION+set}" ; then + setopt NO_GLOB_SUBST + fi + # Now quote all the things that may contain metacharacters while being + # careful not to overquote the AC_SUBSTed values. We take copies of the + # variables and quote the copies for generation of the libtool script. + for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC LTCFLAGS NM \ + SED SHELL STRIP \ + libname_spec library_names_spec soname_spec extract_expsyms_cmds \ + old_striplib striplib file_magic_cmd finish_cmds finish_eval \ + deplibs_check_method reload_flag reload_cmds need_locks \ + lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \ + lt_cv_sys_global_symbol_to_c_name_address \ + sys_lib_search_path_spec sys_lib_dlsearch_path_spec \ + old_postinstall_cmds old_postuninstall_cmds \ + compiler_CXX \ + CC_CXX \ + LD_CXX \ + lt_prog_compiler_wl_CXX \ + lt_prog_compiler_pic_CXX \ + lt_prog_compiler_static_CXX \ + lt_prog_compiler_no_builtin_flag_CXX \ + export_dynamic_flag_spec_CXX \ + thread_safe_flag_spec_CXX \ + whole_archive_flag_spec_CXX \ + enable_shared_with_static_runtimes_CXX \ + old_archive_cmds_CXX \ + old_archive_from_new_cmds_CXX \ + predep_objects_CXX \ + postdep_objects_CXX \ + predeps_CXX \ + postdeps_CXX \ + compiler_lib_search_path_CXX \ + archive_cmds_CXX \ + archive_expsym_cmds_CXX \ + postinstall_cmds_CXX \ + postuninstall_cmds_CXX \ + old_archive_from_expsyms_cmds_CXX \ + allow_undefined_flag_CXX \ + no_undefined_flag_CXX \ + export_symbols_cmds_CXX \ + hardcode_libdir_flag_spec_CXX \ + hardcode_libdir_flag_spec_ld_CXX \ + hardcode_libdir_separator_CXX \ + hardcode_automatic_CXX \ + module_cmds_CXX \ + module_expsym_cmds_CXX \ + lt_cv_prog_compiler_c_o_CXX \ + fix_srcfile_path_CXX \ + exclude_expsyms_CXX \ + include_expsyms_CXX; do + + case $var in + old_archive_cmds_CXX | \ + old_archive_from_new_cmds_CXX | \ + archive_cmds_CXX | \ + archive_expsym_cmds_CXX | \ + module_cmds_CXX | \ + module_expsym_cmds_CXX | \ + old_archive_from_expsyms_cmds_CXX | \ + export_symbols_cmds_CXX | \ + extract_expsyms_cmds | reload_cmds | finish_cmds | \ + postinstall_cmds | postuninstall_cmds | \ + old_postinstall_cmds | old_postuninstall_cmds | \ + sys_lib_search_path_spec | sys_lib_dlsearch_path_spec) + # Double-quote double-evaled strings. + eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\"" + ;; + *) + eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\"" + ;; + esac + done + + case $lt_echo in + *'\$0 --fallback-echo"') + lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'` + ;; + esac + +cfgfile="$ofile" + + cat <<__EOF__ >> "$cfgfile" +# ### BEGIN LIBTOOL TAG CONFIG: $tagname + +# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: + +# Shell to use when invoking shell scripts. +SHELL=$lt_SHELL + +# Whether or not to build shared libraries. +build_libtool_libs=$enable_shared + +# Whether or not to build static libraries. +build_old_libs=$enable_static + +# Whether or not to add -lc for building shared libraries. +build_libtool_need_lc=$archive_cmds_need_lc_CXX + +# Whether or not to disallow shared libs when runtime libs are static +allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes_CXX + +# Whether or not to optimize for fast installation. +fast_install=$enable_fast_install + +# The host system. +host_alias=$host_alias +host=$host +host_os=$host_os + +# The build system. +build_alias=$build_alias +build=$build +build_os=$build_os + +# An echo program that does not interpret backslashes. +echo=$lt_echo + +# The archiver. +AR=$lt_AR +AR_FLAGS=$lt_AR_FLAGS + +# A C compiler. +LTCC=$lt_LTCC + +# LTCC compiler flags. +LTCFLAGS=$lt_LTCFLAGS + +# A language-specific compiler. +CC=$lt_compiler_CXX + +# Is the compiler the GNU C compiler? +with_gcc=$GCC_CXX + +# An ERE matcher. +EGREP=$lt_EGREP + +# The linker used to build libraries. +LD=$lt_LD_CXX + +# Whether we need hard or soft links. +LN_S=$lt_LN_S + +# A BSD-compatible nm program. +NM=$lt_NM + +# A symbol stripping program +STRIP=$lt_STRIP + +# Used to examine libraries when file_magic_cmd begins "file" +MAGIC_CMD=$MAGIC_CMD + +# Used on cygwin: DLL creation program. +DLLTOOL="$DLLTOOL" + +# Used on cygwin: object dumper. +OBJDUMP="$OBJDUMP" + +# Used on cygwin: assembler. +AS="$AS" + +# The name of the directory that contains temporary libtool files. +objdir=$objdir + +# How to create reloadable object files. +reload_flag=$lt_reload_flag +reload_cmds=$lt_reload_cmds + +# How to pass a linker flag through the compiler. +wl=$lt_lt_prog_compiler_wl_CXX + +# Object file suffix (normally "o"). +objext="$ac_objext" + +# Old archive suffix (normally "a"). +libext="$libext" + +# Shared library suffix (normally ".so"). +shrext_cmds='$shrext_cmds' + +# Executable file suffix (normally ""). +exeext="$exeext" + +# Additional compiler flags for building library objects. +pic_flag=$lt_lt_prog_compiler_pic_CXX +pic_mode=$pic_mode + +# What is the maximum length of a command? +max_cmd_len=$lt_cv_sys_max_cmd_len + +# Does compiler simultaneously support -c and -o options? +compiler_c_o=$lt_lt_cv_prog_compiler_c_o_CXX + +# Must we lock files when doing compilation? +need_locks=$lt_need_locks + +# Do we need the lib prefix for modules? +need_lib_prefix=$need_lib_prefix + +# Do we need a version for libraries? +need_version=$need_version + +# Whether dlopen is supported. +dlopen_support=$enable_dlopen + +# Whether dlopen of programs is supported. +dlopen_self=$enable_dlopen_self + +# Whether dlopen of statically linked programs is supported. +dlopen_self_static=$enable_dlopen_self_static + +# Compiler flag to prevent dynamic linking. +link_static_flag=$lt_lt_prog_compiler_static_CXX + +# Compiler flag to turn off builtin functions. +no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag_CXX + +# Compiler flag to allow reflexive dlopens. +export_dynamic_flag_spec=$lt_export_dynamic_flag_spec_CXX + +# Compiler flag to generate shared objects directly from archives. +whole_archive_flag_spec=$lt_whole_archive_flag_spec_CXX + +# Compiler flag to generate thread-safe objects. +thread_safe_flag_spec=$lt_thread_safe_flag_spec_CXX + +# Library versioning type. +version_type=$version_type + +# Format of library name prefix. +libname_spec=$lt_libname_spec + +# List of archive names. First name is the real one, the rest are links. +# The last name is the one that the linker finds with -lNAME. +library_names_spec=$lt_library_names_spec + +# The coded name of the library, if different from the real name. +soname_spec=$lt_soname_spec + +# Commands used to build and install an old-style archive. +RANLIB=$lt_RANLIB +old_archive_cmds=$lt_old_archive_cmds_CXX +old_postinstall_cmds=$lt_old_postinstall_cmds +old_postuninstall_cmds=$lt_old_postuninstall_cmds + +# Create an old-style archive from a shared archive. +old_archive_from_new_cmds=$lt_old_archive_from_new_cmds_CXX + +# Create a temporary old-style archive to link instead of a shared archive. +old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds_CXX + +# Commands used to build and install a shared archive. +archive_cmds=$lt_archive_cmds_CXX +archive_expsym_cmds=$lt_archive_expsym_cmds_CXX +postinstall_cmds=$lt_postinstall_cmds +postuninstall_cmds=$lt_postuninstall_cmds + +# Commands used to build a loadable module (assumed same as above if empty) +module_cmds=$lt_module_cmds_CXX +module_expsym_cmds=$lt_module_expsym_cmds_CXX + +# Commands to strip libraries. +old_striplib=$lt_old_striplib +striplib=$lt_striplib + +# Dependencies to place before the objects being linked to create a +# shared library. +predep_objects=$lt_predep_objects_CXX + +# Dependencies to place after the objects being linked to create a +# shared library. +postdep_objects=$lt_postdep_objects_CXX + +# Dependencies to place before the objects being linked to create a +# shared library. +predeps=$lt_predeps_CXX + +# Dependencies to place after the objects being linked to create a +# shared library. +postdeps=$lt_postdeps_CXX + +# The library search path used internally by the compiler when linking +# a shared library. +compiler_lib_search_path=$lt_compiler_lib_search_path_CXX + +# Method to check whether dependent libraries are shared objects. +deplibs_check_method=$lt_deplibs_check_method + +# Command to use when deplibs_check_method == file_magic. +file_magic_cmd=$lt_file_magic_cmd + +# Flag that allows shared libraries with undefined symbols to be built. +allow_undefined_flag=$lt_allow_undefined_flag_CXX + +# Flag that forces no undefined symbols. +no_undefined_flag=$lt_no_undefined_flag_CXX + +# Commands used to finish a libtool library installation in a directory. +finish_cmds=$lt_finish_cmds + +# Same as above, but a single script fragment to be evaled but not shown. +finish_eval=$lt_finish_eval + +# Take the output of nm and produce a listing of raw symbols and C names. +global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe + +# Transform the output of nm in a proper C declaration +global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl + +# Transform the output of nm in a C name address pair +global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address + +# This is the shared library runtime path variable. +runpath_var=$runpath_var + +# This is the shared library path variable. +shlibpath_var=$shlibpath_var + +# Is shlibpath searched before the hard-coded library search path? +shlibpath_overrides_runpath=$shlibpath_overrides_runpath + +# How to hardcode a shared library path into an executable. +hardcode_action=$hardcode_action_CXX + +# Whether we should hardcode library paths into libraries. +hardcode_into_libs=$hardcode_into_libs + +# Flag to hardcode \$libdir into a binary during linking. +# This must work even if \$libdir does not exist. +hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec_CXX + +# If ld is used when linking, flag to hardcode \$libdir into +# a binary during linking. This must work even if \$libdir does +# not exist. +hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld_CXX + +# Whether we need a single -rpath flag with a separated argument. +hardcode_libdir_separator=$lt_hardcode_libdir_separator_CXX + +# Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the +# resulting binary. +hardcode_direct=$hardcode_direct_CXX + +# Set to yes if using the -LDIR flag during linking hardcodes DIR into the +# resulting binary. +hardcode_minus_L=$hardcode_minus_L_CXX + +# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into +# the resulting binary. +hardcode_shlibpath_var=$hardcode_shlibpath_var_CXX + +# Set to yes if building a shared library automatically hardcodes DIR into the library +# and all subsequent libraries and executables linked against it. +hardcode_automatic=$hardcode_automatic_CXX + +# Variables whose values should be saved in libtool wrapper scripts and +# restored at relink time. +variables_saved_for_relink="$variables_saved_for_relink" + +# Whether libtool must link a program against all its dependency libraries. +link_all_deplibs=$link_all_deplibs_CXX + +# Compile-time system search path for libraries +sys_lib_search_path_spec=$lt_sys_lib_search_path_spec + +# Run-time system search path for libraries +sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec + +# Fix the shell variable \$srcfile for the compiler. +fix_srcfile_path=$lt_fix_srcfile_path + +# Set to yes if exported symbols are required. +always_export_symbols=$always_export_symbols_CXX + +# The commands to list exported symbols. +export_symbols_cmds=$lt_export_symbols_cmds_CXX + +# The commands to extract the exported symbol list from a shared archive. +extract_expsyms_cmds=$lt_extract_expsyms_cmds + +# Symbols that should not be listed in the preloaded symbols. +exclude_expsyms=$lt_exclude_expsyms_CXX + +# Symbols that must always be exported. +include_expsyms=$lt_include_expsyms_CXX + +# ### END LIBTOOL TAG CONFIG: $tagname + +__EOF__ + + +else + # If there is no Makefile yet, we rely on a make rule to execute + # `config.status --recheck' to rerun these tests and create the + # libtool script then. + ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'` + if test -f "$ltmain_in"; then + test -f Makefile && make "$ltmain" + fi +fi + + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +CC=$lt_save_CC +LDCXX=$LD +LD=$lt_save_LD +GCC=$lt_save_GCC +with_gnu_ldcxx=$with_gnu_ld +with_gnu_ld=$lt_save_with_gnu_ld +lt_cv_path_LDCXX=$lt_cv_path_LD +lt_cv_path_LD=$lt_save_path_LD +lt_cv_prog_gnu_ldcxx=$lt_cv_prog_gnu_ld +lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld + + else + tagname="" + fi + ;; + + F77) + if test -n "$F77" && test "X$F77" != "Xno"; then + +ac_ext=f +ac_compile='$F77 -c $FFLAGS conftest.$ac_ext >&5' +ac_link='$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_f77_compiler_gnu + + +archive_cmds_need_lc_F77=no +allow_undefined_flag_F77= +always_export_symbols_F77=no +archive_expsym_cmds_F77= +export_dynamic_flag_spec_F77= +hardcode_direct_F77=no +hardcode_libdir_flag_spec_F77= +hardcode_libdir_flag_spec_ld_F77= +hardcode_libdir_separator_F77= +hardcode_minus_L_F77=no +hardcode_automatic_F77=no +module_cmds_F77= +module_expsym_cmds_F77= +link_all_deplibs_F77=unknown +old_archive_cmds_F77=$old_archive_cmds +no_undefined_flag_F77= +whole_archive_flag_spec_F77= +enable_shared_with_static_runtimes_F77=no + +# Source file extension for f77 test sources. +ac_ext=f + +# Object file extension for compiled f77 test sources. +objext=o +objext_F77=$objext + +# Code to be used in simple compile tests +lt_simple_compile_test_code="\ + subroutine t + return + end +" + +# Code to be used in simple link tests +lt_simple_link_test_code="\ + program t + end +" + +# ltmain only uses $CC for tagged configurations so make sure $CC is set. + +# If no C compiler was specified, use CC. +LTCC=${LTCC-"$CC"} + +# If no C compiler flags were specified, use CFLAGS. +LTCFLAGS=${LTCFLAGS-"$CFLAGS"} + +# Allow CC to be a program name with arguments. +compiler=$CC + + +# save warnings/boilerplate of simple test code +ac_outfile=conftest.$ac_objext +echo "$lt_simple_compile_test_code" >conftest.$ac_ext +eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err +_lt_compiler_boilerplate=`cat conftest.err` +$rm conftest* + +ac_outfile=conftest.$ac_objext +echo "$lt_simple_link_test_code" >conftest.$ac_ext +eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err +_lt_linker_boilerplate=`cat conftest.err` +$rm conftest* + + +# Allow CC to be a program name with arguments. +lt_save_CC="$CC" +CC=${F77-"f77"} +compiler=$CC +compiler_F77=$CC +for cc_temp in $compiler""; do + case $cc_temp in + compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; + distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; + \-*) ;; + *) break;; + esac +done +cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` + + +{ echo "$as_me:$LINENO: checking if libtool supports shared libraries" >&5 +echo $ECHO_N "checking if libtool supports shared libraries... $ECHO_C" >&6; } +{ echo "$as_me:$LINENO: result: $can_build_shared" >&5 +echo "${ECHO_T}$can_build_shared" >&6; } + +{ echo "$as_me:$LINENO: checking whether to build shared libraries" >&5 +echo $ECHO_N "checking whether to build shared libraries... $ECHO_C" >&6; } +test "$can_build_shared" = "no" && enable_shared=no + +# On AIX, shared libraries and static libraries use the same namespace, and +# are all built from PIC. +case $host_os in +aix3*) + test "$enable_shared" = yes && enable_static=no + if test -n "$RANLIB"; then + archive_cmds="$archive_cmds~\$RANLIB \$lib" + postinstall_cmds='$RANLIB $lib' + fi + ;; +aix4* | aix5*) + if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then + test "$enable_shared" = yes && enable_static=no + fi + ;; +esac +{ echo "$as_me:$LINENO: result: $enable_shared" >&5 +echo "${ECHO_T}$enable_shared" >&6; } + +{ echo "$as_me:$LINENO: checking whether to build static libraries" >&5 +echo $ECHO_N "checking whether to build static libraries... $ECHO_C" >&6; } +# Make sure either enable_shared or enable_static is yes. +test "$enable_shared" = yes || enable_static=yes +{ echo "$as_me:$LINENO: result: $enable_static" >&5 +echo "${ECHO_T}$enable_static" >&6; } + +GCC_F77="$G77" +LD_F77="$LD" + +lt_prog_compiler_wl_F77= +lt_prog_compiler_pic_F77= +lt_prog_compiler_static_F77= + +{ echo "$as_me:$LINENO: checking for $compiler option to produce PIC" >&5 +echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6; } + + if test "$GCC" = yes; then + lt_prog_compiler_wl_F77='-Wl,' + lt_prog_compiler_static_F77='-static' + + case $host_os in + aix*) + # All AIX code is PIC. + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + lt_prog_compiler_static_F77='-Bstatic' + fi + ;; + + amigaos*) + # FIXME: we need at least 68020 code to build shared libraries, but + # adding the `-m68020' flag to GCC prevents building anything better, + # like `-m68040'. + lt_prog_compiler_pic_F77='-m68020 -resident32 -malways-restore-a4' + ;; + + beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) + # PIC is the default for these OSes. + ;; + + mingw* | cygwin* | pw32* | os2*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + # Although the cygwin gcc ignores -fPIC, still need this for old-style + # (--disable-auto-import) libraries + lt_prog_compiler_pic_F77='-DDLL_EXPORT' + ;; + + darwin* | rhapsody*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + lt_prog_compiler_pic_F77='-fno-common' + ;; + + interix[3-9]*) + # Interix 3.x gcc -fpic/-fPIC options generate broken code. + # Instead, we relocate shared libraries at runtime. + ;; + + msdosdjgpp*) + # Just because we use GCC doesn't mean we suddenly get shared libraries + # on systems that don't support them. + lt_prog_compiler_can_build_shared_F77=no + enable_shared=no + ;; + + sysv4*MP*) + if test -d /usr/nec; then + lt_prog_compiler_pic_F77=-Kconform_pic + fi + ;; + + hpux*) + # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but + # not for PA HP-UX. + case $host_cpu in + hppa*64*|ia64*) + # +Z the default + ;; + *) + lt_prog_compiler_pic_F77='-fPIC' + ;; + esac + ;; + + *) + lt_prog_compiler_pic_F77='-fPIC' + ;; + esac + else + # PORTME Check for flag to pass linker flags through the system compiler. + case $host_os in + aix*) + lt_prog_compiler_wl_F77='-Wl,' + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + lt_prog_compiler_static_F77='-Bstatic' + else + lt_prog_compiler_static_F77='-bnso -bI:/lib/syscalls.exp' + fi + ;; + darwin*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + case $cc_basename in + xlc*) + lt_prog_compiler_pic_F77='-qnocommon' + lt_prog_compiler_wl_F77='-Wl,' + ;; + esac + ;; + + mingw* | cygwin* | pw32* | os2*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + lt_prog_compiler_pic_F77='-DDLL_EXPORT' + ;; + + hpux9* | hpux10* | hpux11*) + lt_prog_compiler_wl_F77='-Wl,' + # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but + # not for PA HP-UX. + case $host_cpu in + hppa*64*|ia64*) + # +Z the default + ;; + *) + lt_prog_compiler_pic_F77='+Z' + ;; + esac + # Is there a better lt_prog_compiler_static that works with the bundled CC? + lt_prog_compiler_static_F77='${wl}-a ${wl}archive' + ;; + + irix5* | irix6* | nonstopux*) + lt_prog_compiler_wl_F77='-Wl,' + # PIC (with -KPIC) is the default. + lt_prog_compiler_static_F77='-non_shared' + ;; + + newsos6) + lt_prog_compiler_pic_F77='-KPIC' + lt_prog_compiler_static_F77='-Bstatic' + ;; + + linux* | k*bsd*-gnu) + case $cc_basename in + icc* | ecc*) + lt_prog_compiler_wl_F77='-Wl,' + lt_prog_compiler_pic_F77='-KPIC' + lt_prog_compiler_static_F77='-static' + ;; + pgcc* | pgf77* | pgf90* | pgf95*) + # Portland Group compilers (*not* the Pentium gcc compiler, + # which looks to be a dead project) + lt_prog_compiler_wl_F77='-Wl,' + lt_prog_compiler_pic_F77='-fpic' + lt_prog_compiler_static_F77='-Bstatic' + ;; + ccc*) + lt_prog_compiler_wl_F77='-Wl,' + # All Alpha code is PIC. + lt_prog_compiler_static_F77='-non_shared' + ;; + *) + case `$CC -V 2>&1 | sed 5q` in + *Sun\ C*) + # Sun C 5.9 + lt_prog_compiler_pic_F77='-KPIC' + lt_prog_compiler_static_F77='-Bstatic' + lt_prog_compiler_wl_F77='-Wl,' + ;; + *Sun\ F*) + # Sun Fortran 8.3 passes all unrecognized flags to the linker + lt_prog_compiler_pic_F77='-KPIC' + lt_prog_compiler_static_F77='-Bstatic' + lt_prog_compiler_wl_F77='' + ;; + esac + ;; + esac + ;; + + osf3* | osf4* | osf5*) + lt_prog_compiler_wl_F77='-Wl,' + # All OSF/1 code is PIC. + lt_prog_compiler_static_F77='-non_shared' + ;; + + rdos*) + lt_prog_compiler_static_F77='-non_shared' + ;; + + solaris*) + lt_prog_compiler_pic_F77='-KPIC' + lt_prog_compiler_static_F77='-Bstatic' + case $cc_basename in + f77* | f90* | f95*) + lt_prog_compiler_wl_F77='-Qoption ld ';; + *) + lt_prog_compiler_wl_F77='-Wl,';; + esac + ;; + + sunos4*) + lt_prog_compiler_wl_F77='-Qoption ld ' + lt_prog_compiler_pic_F77='-PIC' + lt_prog_compiler_static_F77='-Bstatic' + ;; + + sysv4 | sysv4.2uw2* | sysv4.3*) + lt_prog_compiler_wl_F77='-Wl,' + lt_prog_compiler_pic_F77='-KPIC' + lt_prog_compiler_static_F77='-Bstatic' + ;; + + sysv4*MP*) + if test -d /usr/nec ;then + lt_prog_compiler_pic_F77='-Kconform_pic' + lt_prog_compiler_static_F77='-Bstatic' + fi + ;; + + sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) + lt_prog_compiler_wl_F77='-Wl,' + lt_prog_compiler_pic_F77='-KPIC' + lt_prog_compiler_static_F77='-Bstatic' + ;; + + unicos*) + lt_prog_compiler_wl_F77='-Wl,' + lt_prog_compiler_can_build_shared_F77=no + ;; + + uts4*) + lt_prog_compiler_pic_F77='-pic' + lt_prog_compiler_static_F77='-Bstatic' + ;; + + *) + lt_prog_compiler_can_build_shared_F77=no + ;; + esac + fi + +{ echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_F77" >&5 +echo "${ECHO_T}$lt_prog_compiler_pic_F77" >&6; } + +# +# Check to make sure the PIC flag actually works. +# +if test -n "$lt_prog_compiler_pic_F77"; then + +{ echo "$as_me:$LINENO: checking if $compiler PIC flag $lt_prog_compiler_pic_F77 works" >&5 +echo $ECHO_N "checking if $compiler PIC flag $lt_prog_compiler_pic_F77 works... $ECHO_C" >&6; } +if test "${lt_prog_compiler_pic_works_F77+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + lt_prog_compiler_pic_works_F77=no + ac_outfile=conftest.$ac_objext + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + lt_compiler_flag="$lt_prog_compiler_pic_F77" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + # The option is referenced via a variable to avoid confusing sed. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ + -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:14099: $lt_compile\"" >&5) + (eval "$lt_compile" 2>conftest.err) + ac_status=$? + cat conftest.err >&5 + echo "$as_me:14103: \$? = $ac_status" >&5 + if (exit $ac_status) && test -s "$ac_outfile"; then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings other than the usual output. + $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp + $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 + if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then + lt_prog_compiler_pic_works_F77=yes + fi + fi + $rm conftest* + +fi +{ echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_works_F77" >&5 +echo "${ECHO_T}$lt_prog_compiler_pic_works_F77" >&6; } + +if test x"$lt_prog_compiler_pic_works_F77" = xyes; then + case $lt_prog_compiler_pic_F77 in + "" | " "*) ;; + *) lt_prog_compiler_pic_F77=" $lt_prog_compiler_pic_F77" ;; + esac +else + lt_prog_compiler_pic_F77= + lt_prog_compiler_can_build_shared_F77=no +fi + +fi +case $host_os in + # For platforms which do not support PIC, -DPIC is meaningless: + *djgpp*) + lt_prog_compiler_pic_F77= + ;; + *) + lt_prog_compiler_pic_F77="$lt_prog_compiler_pic_F77" + ;; +esac + +# +# Check to make sure the static flag actually works. +# +wl=$lt_prog_compiler_wl_F77 eval lt_tmp_static_flag=\"$lt_prog_compiler_static_F77\" +{ echo "$as_me:$LINENO: checking if $compiler static flag $lt_tmp_static_flag works" >&5 +echo $ECHO_N "checking if $compiler static flag $lt_tmp_static_flag works... $ECHO_C" >&6; } +if test "${lt_prog_compiler_static_works_F77+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + lt_prog_compiler_static_works_F77=no + save_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS $lt_tmp_static_flag" + echo "$lt_simple_link_test_code" > conftest.$ac_ext + if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then + # The linker can only warn and ignore the option if not recognized + # So say no if there are warnings + if test -s conftest.err; then + # Append any errors to the config.log. + cat conftest.err 1>&5 + $echo "X$_lt_linker_boilerplate" | $Xsed -e '/^$/d' > conftest.exp + $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 + if diff conftest.exp conftest.er2 >/dev/null; then + lt_prog_compiler_static_works_F77=yes + fi + else + lt_prog_compiler_static_works_F77=yes + fi + fi + $rm conftest* + LDFLAGS="$save_LDFLAGS" + +fi +{ echo "$as_me:$LINENO: result: $lt_prog_compiler_static_works_F77" >&5 +echo "${ECHO_T}$lt_prog_compiler_static_works_F77" >&6; } + +if test x"$lt_prog_compiler_static_works_F77" = xyes; then + : +else + lt_prog_compiler_static_F77= +fi + + +{ echo "$as_me:$LINENO: checking if $compiler supports -c -o file.$ac_objext" >&5 +echo $ECHO_N "checking if $compiler supports -c -o file.$ac_objext... $ECHO_C" >&6; } +if test "${lt_cv_prog_compiler_c_o_F77+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + lt_cv_prog_compiler_c_o_F77=no + $rm -r conftest 2>/dev/null + mkdir conftest + cd conftest + mkdir out + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + + lt_compiler_flag="-o out/conftest2.$ac_objext" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ + -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:14203: $lt_compile\"" >&5) + (eval "$lt_compile" 2>out/conftest.err) + ac_status=$? + cat out/conftest.err >&5 + echo "$as_me:14207: \$? = $ac_status" >&5 + if (exit $ac_status) && test -s out/conftest2.$ac_objext + then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' > out/conftest.exp + $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 + if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then + lt_cv_prog_compiler_c_o_F77=yes + fi + fi + chmod u+w . 2>&5 + $rm conftest* + # SGI C++ compiler will create directory out/ii_files/ for + # template instantiation + test -d out/ii_files && $rm out/ii_files/* && rmdir out/ii_files + $rm out/* && rmdir out + cd .. + rmdir conftest + $rm conftest* + +fi +{ echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_c_o_F77" >&5 +echo "${ECHO_T}$lt_cv_prog_compiler_c_o_F77" >&6; } + + +hard_links="nottested" +if test "$lt_cv_prog_compiler_c_o_F77" = no && test "$need_locks" != no; then + # do not overwrite the value of need_locks provided by the user + { echo "$as_me:$LINENO: checking if we can lock with hard links" >&5 +echo $ECHO_N "checking if we can lock with hard links... $ECHO_C" >&6; } + hard_links=yes + $rm conftest* + ln conftest.a conftest.b 2>/dev/null && hard_links=no + touch conftest.a + ln conftest.a conftest.b 2>&5 || hard_links=no + ln conftest.a conftest.b 2>/dev/null && hard_links=no + { echo "$as_me:$LINENO: result: $hard_links" >&5 +echo "${ECHO_T}$hard_links" >&6; } + if test "$hard_links" = no; then + { echo "$as_me:$LINENO: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5 +echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;} + need_locks=warn + fi +else + need_locks=no +fi + +{ echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5 +echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared libraries... $ECHO_C" >&6; } + + runpath_var= + allow_undefined_flag_F77= + enable_shared_with_static_runtimes_F77=no + archive_cmds_F77= + archive_expsym_cmds_F77= + old_archive_From_new_cmds_F77= + old_archive_from_expsyms_cmds_F77= + export_dynamic_flag_spec_F77= + whole_archive_flag_spec_F77= + thread_safe_flag_spec_F77= + hardcode_libdir_flag_spec_F77= + hardcode_libdir_flag_spec_ld_F77= + hardcode_libdir_separator_F77= + hardcode_direct_F77=no + hardcode_minus_L_F77=no + hardcode_shlibpath_var_F77=unsupported + link_all_deplibs_F77=unknown + hardcode_automatic_F77=no + module_cmds_F77= + module_expsym_cmds_F77= + always_export_symbols_F77=no + export_symbols_cmds_F77='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' + # include_expsyms should be a list of space-separated symbols to be *always* + # included in the symbol list + include_expsyms_F77= + # exclude_expsyms can be an extended regexp of symbols to exclude + # it will be wrapped by ` (' and `)$', so one must not match beginning or + # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', + # as well as any symbol that contains `d'. + exclude_expsyms_F77="_GLOBAL_OFFSET_TABLE_" + # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out + # platforms (ab)use it in PIC code, but their linkers get confused if + # the symbol is explicitly referenced. Since portable code cannot + # rely on this symbol name, it's probably fine to never include it in + # preloaded symbol tables. + extract_expsyms_cmds= + # Just being paranoid about ensuring that cc_basename is set. + for cc_temp in $compiler""; do + case $cc_temp in + compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; + distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; + \-*) ;; + *) break;; + esac +done +cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` + + case $host_os in + cygwin* | mingw* | pw32*) + # FIXME: the MSVC++ port hasn't been tested in a loooong time + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + if test "$GCC" != yes; then + with_gnu_ld=no + fi + ;; + interix*) + # we just hope/assume this is gcc and not c89 (= MSVC++) + with_gnu_ld=yes + ;; + openbsd*) + with_gnu_ld=no + ;; + esac + + ld_shlibs_F77=yes + if test "$with_gnu_ld" = yes; then + # If archive_cmds runs LD, not CC, wlarc should be empty + wlarc='${wl}' + + # Set some defaults for GNU ld with shared library support. These + # are reset later if shared libraries are not supported. Putting them + # here allows them to be overridden if necessary. + runpath_var=LD_RUN_PATH + hardcode_libdir_flag_spec_F77='${wl}--rpath ${wl}$libdir' + export_dynamic_flag_spec_F77='${wl}--export-dynamic' + # ancient GNU ld didn't support --whole-archive et. al. + if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then + whole_archive_flag_spec_F77="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + else + whole_archive_flag_spec_F77= + fi + supports_anon_versioning=no + case `$LD -v 2>/dev/null` in + *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 + *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... + *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... + *\ 2.11.*) ;; # other 2.11 versions + *) supports_anon_versioning=yes ;; + esac + + # See if GNU ld supports shared libraries. + case $host_os in + aix3* | aix4* | aix5*) + # On AIX/PPC, the GNU linker is very broken + if test "$host_cpu" != ia64; then + ld_shlibs_F77=no + cat <&2 + +*** Warning: the GNU linker, at least up to release 2.9.1, is reported +*** to be unable to reliably create shared libraries on AIX. +*** Therefore, libtool is disabling shared libraries support. If you +*** really care for shared libraries, you may want to modify your PATH +*** so that a non-GNU linker is found, and then restart. + +EOF + fi + ;; + + amigaos*) + archive_cmds_F77='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + hardcode_libdir_flag_spec_F77='-L$libdir' + hardcode_minus_L_F77=yes + + # Samuel A. Falvo II reports + # that the semantics of dynamic libraries on AmigaOS, at least up + # to version 4, is to share data among multiple programs linked + # with the same dynamic library. Since this doesn't match the + # behavior of shared libraries on other platforms, we can't use + # them. + ld_shlibs_F77=no + ;; + + beos*) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + allow_undefined_flag_F77=unsupported + # Joseph Beckenbach says some releases of gcc + # support --undefined. This deserves some investigation. FIXME + archive_cmds_F77='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + else + ld_shlibs_F77=no + fi + ;; + + cygwin* | mingw* | pw32*) + # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, F77) is actually meaningless, + # as there is no search path for DLLs. + hardcode_libdir_flag_spec_F77='-L$libdir' + allow_undefined_flag_F77=unsupported + always_export_symbols_F77=no + enable_shared_with_static_runtimes_F77=yes + export_symbols_cmds_F77='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/'\'' -e '\''/^[AITW][ ]/s/.*[ ]//'\'' | sort | uniq > $export_symbols' + + if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then + archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' + # If the export-symbols file already is a .def file (1st line + # is EXPORTS), use it as is; otherwise, prepend... + archive_expsym_cmds_F77='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then + cp $export_symbols $output_objdir/$soname.def; + else + echo EXPORTS > $output_objdir/$soname.def; + cat $export_symbols >> $output_objdir/$soname.def; + fi~ + $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' + else + ld_shlibs_F77=no + fi + ;; + + interix[3-9]*) + hardcode_direct_F77=no + hardcode_shlibpath_var_F77=no + hardcode_libdir_flag_spec_F77='${wl}-rpath,$libdir' + export_dynamic_flag_spec_F77='${wl}-E' + # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. + # Instead, shared libraries are loaded at an image base (0x10000000 by + # default) and relocated if they conflict, which is a slow very memory + # consuming and fragmenting process. To avoid this, we pick a random, + # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link + # time. Moving up from 0x10000000 also allows more sbrk(2) space. + archive_cmds_F77='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' + archive_expsym_cmds_F77='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' + ;; + + gnu* | linux* | k*bsd*-gnu) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + tmp_addflag= + case $cc_basename,$host_cpu in + pgcc*) # Portland Group C compiler + whole_archive_flag_spec_F77='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' + tmp_addflag=' $pic_flag' + ;; + pgf77* | pgf90* | pgf95*) # Portland Group f77 and f90 compilers + whole_archive_flag_spec_F77='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' + tmp_addflag=' $pic_flag -Mnomain' ;; + ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 + tmp_addflag=' -i_dynamic' ;; + efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 + tmp_addflag=' -i_dynamic -nofor_main' ;; + ifc* | ifort*) # Intel Fortran compiler + tmp_addflag=' -nofor_main' ;; + esac + case `$CC -V 2>&1 | sed 5q` in + *Sun\ C*) # Sun C 5.9 + whole_archive_flag_spec_F77='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' + tmp_sharedflag='-G' ;; + *Sun\ F*) # Sun Fortran 8.3 + tmp_sharedflag='-G' ;; + *) + tmp_sharedflag='-shared' ;; + esac + archive_cmds_F77='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + + if test $supports_anon_versioning = yes; then + archive_expsym_cmds_F77='$echo "{ global:" > $output_objdir/$libname.ver~ + cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ + $echo "local: *; };" >> $output_objdir/$libname.ver~ + $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' + fi + link_all_deplibs_F77=no + else + ld_shlibs_F77=no + fi + ;; + + netbsd* | netbsdelf*-gnu) + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + archive_cmds_F77='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' + wlarc= + else + archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + fi + ;; + + solaris*) + if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then + ld_shlibs_F77=no + cat <&2 + +*** Warning: The releases 2.8.* of the GNU linker cannot reliably +*** create shared libraries on Solaris systems. Therefore, libtool +*** is disabling shared libraries support. We urge you to upgrade GNU +*** binutils to release 2.9.1 or newer. Another option is to modify +*** your PATH or compiler configuration so that the native linker is +*** used, and then restart. + +EOF + elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + ld_shlibs_F77=no + fi + ;; + + sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*) + case `$LD -v 2>&1` in + *\ [01].* | *\ 2.[0-9].* | *\ 2.1[0-5].*) + ld_shlibs_F77=no + cat <<_LT_EOF 1>&2 + +*** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not +*** reliably create shared libraries on SCO systems. Therefore, libtool +*** is disabling shared libraries support. We urge you to upgrade GNU +*** binutils to release 2.16.91.0.3 or newer. Another option is to modify +*** your PATH or compiler configuration so that the native linker is +*** used, and then restart. + +_LT_EOF + ;; + *) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + hardcode_libdir_flag_spec_F77='`test -z "$SCOABSPATH" && echo ${wl}-rpath,$libdir`' + archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib' + archive_expsym_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname,\${SCOABSPATH:+${install_libdir}/}$soname,-retain-symbols-file,$export_symbols -o $lib' + else + ld_shlibs_F77=no + fi + ;; + esac + ;; + + sunos4*) + archive_cmds_F77='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' + wlarc= + hardcode_direct_F77=yes + hardcode_shlibpath_var_F77=no + ;; + + *) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + ld_shlibs_F77=no + fi + ;; + esac + + if test "$ld_shlibs_F77" = no; then + runpath_var= + hardcode_libdir_flag_spec_F77= + export_dynamic_flag_spec_F77= + whole_archive_flag_spec_F77= + fi + else + # PORTME fill in a description of your system's linker (not GNU ld) + case $host_os in + aix3*) + allow_undefined_flag_F77=unsupported + always_export_symbols_F77=yes + archive_expsym_cmds_F77='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' + # Note: this linker hardcodes the directories in LIBPATH if there + # are no directories specified by -L. + hardcode_minus_L_F77=yes + if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then + # Neither direct hardcoding nor static linking is supported with a + # broken collect2. + hardcode_direct_F77=unsupported + fi + ;; + + aix4* | aix5*) + if test "$host_cpu" = ia64; then + # On IA64, the linker does run time linking by default, so we don't + # have to do anything special. + aix_use_runtimelinking=no + exp_sym_flag='-Bexport' + no_entry_flag="" + else + # If we're using GNU nm, then we don't want the "-C" option. + # -C means demangle to AIX nm, but means don't demangle with GNU nm + if $NM -V 2>&1 | grep 'GNU' > /dev/null; then + export_symbols_cmds_F77='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' + else + export_symbols_cmds_F77='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' + fi + aix_use_runtimelinking=no + + # Test if we are trying to use run time linking or normal + # AIX style linking. If -brtl is somewhere in LDFLAGS, we + # need to do runtime linking. + case $host_os in aix4.[23]|aix4.[23].*|aix5*) + for ld_flag in $LDFLAGS; do + if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then + aix_use_runtimelinking=yes + break + fi + done + ;; + esac + + exp_sym_flag='-bexport' + no_entry_flag='-bnoentry' + fi + + # When large executables or shared objects are built, AIX ld can + # have problems creating the table of contents. If linking a library + # or program results in "error TOC overflow" add -mminimal-toc to + # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not + # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. + + archive_cmds_F77='' + hardcode_direct_F77=yes + hardcode_libdir_separator_F77=':' + link_all_deplibs_F77=yes + + if test "$GCC" = yes; then + case $host_os in aix4.[012]|aix4.[012].*) + # We only want to do this on AIX 4.2 and lower, the check + # below for broken collect2 doesn't work under 4.3+ + collect2name=`${CC} -print-prog-name=collect2` + if test -f "$collect2name" && \ + strings "$collect2name" | grep resolve_lib_name >/dev/null + then + # We have reworked collect2 + : + else + # We have old collect2 + hardcode_direct_F77=unsupported + # It fails to find uninstalled libraries when the uninstalled + # path is not listed in the libpath. Setting hardcode_minus_L + # to unsupported forces relinking + hardcode_minus_L_F77=yes + hardcode_libdir_flag_spec_F77='-L$libdir' + hardcode_libdir_separator_F77= + fi + ;; + esac + shared_flag='-shared' + if test "$aix_use_runtimelinking" = yes; then + shared_flag="$shared_flag "'${wl}-G' + fi + else + # not using gcc + if test "$host_cpu" = ia64; then + # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release + # chokes on -Wl,-G. The following line is correct: + shared_flag='-G' + else + if test "$aix_use_runtimelinking" = yes; then + shared_flag='${wl}-G' + else + shared_flag='${wl}-bM:SRE' + fi + fi + fi + + # It seems that -bexpall does not export symbols beginning with + # underscore (_), so it is better to generate a list of symbols to export. + always_export_symbols_F77=yes + if test "$aix_use_runtimelinking" = yes; then + # Warning - without using the other runtime loading flags (-brtl), + # -berok will link without error, but may produce a broken library. + allow_undefined_flag_F77='-berok' + # Determine the default libpath from the value encoded in an empty executable. + cat >conftest.$ac_ext <<_ACEOF + program main + + end +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_f77_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then + +lt_aix_libpath_sed=' + /Import File Strings/,/^$/ { + /^0/ { + s/^0 *\(.*\)$/\1/ + p + } + }' +aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` +# Check for a 64-bit object if we didn't find anything. +if test -z "$aix_libpath"; then + aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` +fi +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + +fi + +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext +if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi + + hardcode_libdir_flag_spec_F77='${wl}-blibpath:$libdir:'"$aix_libpath" + archive_expsym_cmds_F77="\$CC"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" + else + if test "$host_cpu" = ia64; then + hardcode_libdir_flag_spec_F77='${wl}-R $libdir:/usr/lib:/lib' + allow_undefined_flag_F77="-z nodefs" + archive_expsym_cmds_F77="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" + else + # Determine the default libpath from the value encoded in an empty executable. + cat >conftest.$ac_ext <<_ACEOF + program main + + end +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_f77_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then + +lt_aix_libpath_sed=' + /Import File Strings/,/^$/ { + /^0/ { + s/^0 *\(.*\)$/\1/ + p + } + }' +aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` +# Check for a 64-bit object if we didn't find anything. +if test -z "$aix_libpath"; then + aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` +fi +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + +fi + +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext +if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi + + hardcode_libdir_flag_spec_F77='${wl}-blibpath:$libdir:'"$aix_libpath" + # Warning - without using the other run time loading flags, + # -berok will link without error, but may produce a broken library. + no_undefined_flag_F77=' ${wl}-bernotok' + allow_undefined_flag_F77=' ${wl}-berok' + # Exported symbols can be pulled into shared objects from archives + whole_archive_flag_spec_F77='$convenience' + archive_cmds_need_lc_F77=yes + # This is similar to how AIX traditionally builds its shared libraries. + archive_expsym_cmds_F77="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' + fi + fi + ;; + + amigaos*) + archive_cmds_F77='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + hardcode_libdir_flag_spec_F77='-L$libdir' + hardcode_minus_L_F77=yes + # see comment about different semantics on the GNU ld section + ld_shlibs_F77=no + ;; + + bsdi[45]*) + export_dynamic_flag_spec_F77=-rdynamic + ;; + + cygwin* | mingw* | pw32*) + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + # hardcode_libdir_flag_spec is actually meaningless, as there is + # no search path for DLLs. + hardcode_libdir_flag_spec_F77=' ' + allow_undefined_flag_F77=unsupported + # Tell ltmain to make .lib files, not .a files. + libext=lib + # Tell ltmain to make .dll files, not .so files. + shrext_cmds=".dll" + # FIXME: Setting linknames here is a bad hack. + archive_cmds_F77='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | $SED -e '\''s/ -lc$//'\''` -link -dll~linknames=' + # The linker will automatically build a .lib file if we build a DLL. + old_archive_From_new_cmds_F77='true' + # FIXME: Should let the user specify the lib program. + old_archive_cmds_F77='lib -OUT:$oldlib$oldobjs$old_deplibs' + fix_srcfile_path_F77='`cygpath -w "$srcfile"`' + enable_shared_with_static_runtimes_F77=yes + ;; + + darwin* | rhapsody*) + case $host_os in + rhapsody* | darwin1.[012]) + allow_undefined_flag_F77='${wl}-undefined ${wl}suppress' + ;; + *) # Darwin 1.3 on + if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then + allow_undefined_flag_F77='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' + else + case ${MACOSX_DEPLOYMENT_TARGET} in + 10.[012]) + allow_undefined_flag_F77='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' + ;; + 10.*) + allow_undefined_flag_F77='${wl}-undefined ${wl}dynamic_lookup' + ;; + esac + fi + ;; + esac + archive_cmds_need_lc_F77=no + hardcode_direct_F77=no + hardcode_automatic_F77=yes + hardcode_shlibpath_var_F77=unsupported + whole_archive_flag_spec_F77='' + link_all_deplibs_F77=yes + if test "$GCC" = yes ; then + output_verbose_link_cmd='echo' + archive_cmds_F77='$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring' + module_cmds_F77='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' + # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds + archive_expsym_cmds_F77='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + module_expsym_cmds_F77='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + else + case $cc_basename in + xlc*) + output_verbose_link_cmd='echo' + archive_cmds_F77='$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $xlcverstring' + module_cmds_F77='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' + # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds + archive_expsym_cmds_F77='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $xlcverstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + module_expsym_cmds_F77='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + ;; + *) + ld_shlibs_F77=no + ;; + esac + fi + ;; + + dgux*) + archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec_F77='-L$libdir' + hardcode_shlibpath_var_F77=no + ;; + + freebsd1*) + ld_shlibs_F77=no + ;; + + # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor + # support. Future versions do this automatically, but an explicit c++rt0.o + # does not break anything, and helps significantly (at the cost of a little + # extra space). + freebsd2.2*) + archive_cmds_F77='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' + hardcode_libdir_flag_spec_F77='-R$libdir' + hardcode_direct_F77=yes + hardcode_shlibpath_var_F77=no + ;; + + # Unfortunately, older versions of FreeBSD 2 do not have this feature. + freebsd2*) + archive_cmds_F77='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct_F77=yes + hardcode_minus_L_F77=yes + hardcode_shlibpath_var_F77=no + ;; + + # FreeBSD 3 and greater uses gcc -shared to do shared libraries. + freebsd* | dragonfly*) + archive_cmds_F77='$CC -shared -o $lib $libobjs $deplibs $compiler_flags' + hardcode_libdir_flag_spec_F77='-R$libdir' + hardcode_direct_F77=yes + hardcode_shlibpath_var_F77=no + ;; + + hpux9*) + if test "$GCC" = yes; then + archive_cmds_F77='$rm $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + else + archive_cmds_F77='$rm $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + fi + hardcode_libdir_flag_spec_F77='${wl}+b ${wl}$libdir' + hardcode_libdir_separator_F77=: + hardcode_direct_F77=yes + + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + hardcode_minus_L_F77=yes + export_dynamic_flag_spec_F77='${wl}-E' + ;; + + hpux10*) + if test "$GCC" = yes -a "$with_gnu_ld" = no; then + archive_cmds_F77='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' + else + archive_cmds_F77='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' + fi + if test "$with_gnu_ld" = no; then + hardcode_libdir_flag_spec_F77='${wl}+b ${wl}$libdir' + hardcode_libdir_separator_F77=: + + hardcode_direct_F77=yes + export_dynamic_flag_spec_F77='${wl}-E' + + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + hardcode_minus_L_F77=yes + fi + ;; + + hpux11*) + if test "$GCC" = yes -a "$with_gnu_ld" = no; then + case $host_cpu in + hppa*64*) + archive_cmds_F77='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + ia64*) + archive_cmds_F77='$CC -shared ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' + ;; + *) + archive_cmds_F77='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' + ;; + esac + else + case $host_cpu in + hppa*64*) + archive_cmds_F77='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + ia64*) + archive_cmds_F77='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' + ;; + *) + archive_cmds_F77='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' + ;; + esac + fi + if test "$with_gnu_ld" = no; then + hardcode_libdir_flag_spec_F77='${wl}+b ${wl}$libdir' + hardcode_libdir_separator_F77=: + + case $host_cpu in + hppa*64*|ia64*) + hardcode_libdir_flag_spec_ld_F77='+b $libdir' + hardcode_direct_F77=no + hardcode_shlibpath_var_F77=no + ;; + *) + hardcode_direct_F77=yes + export_dynamic_flag_spec_F77='${wl}-E' + + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + hardcode_minus_L_F77=yes + ;; + esac + fi + ;; + + irix5* | irix6* | nonstopux*) + if test "$GCC" = yes; then + archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + else + archive_cmds_F77='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + hardcode_libdir_flag_spec_ld_F77='-rpath $libdir' + fi + hardcode_libdir_flag_spec_F77='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator_F77=: + link_all_deplibs_F77=yes + ;; + + netbsd* | netbsdelf*-gnu) + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + archive_cmds_F77='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out + else + archive_cmds_F77='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF + fi + hardcode_libdir_flag_spec_F77='-R$libdir' + hardcode_direct_F77=yes + hardcode_shlibpath_var_F77=no + ;; + + newsos6) + archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct_F77=yes + hardcode_libdir_flag_spec_F77='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator_F77=: + hardcode_shlibpath_var_F77=no + ;; + + openbsd*) + if test -f /usr/libexec/ld.so; then + hardcode_direct_F77=yes + hardcode_shlibpath_var_F77=no + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + archive_cmds_F77='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds_F77='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols' + hardcode_libdir_flag_spec_F77='${wl}-rpath,$libdir' + export_dynamic_flag_spec_F77='${wl}-E' + else + case $host_os in + openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*) + archive_cmds_F77='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec_F77='-R$libdir' + ;; + *) + archive_cmds_F77='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + hardcode_libdir_flag_spec_F77='${wl}-rpath,$libdir' + ;; + esac + fi + else + ld_shlibs_F77=no + fi + ;; + + os2*) + hardcode_libdir_flag_spec_F77='-L$libdir' + hardcode_minus_L_F77=yes + allow_undefined_flag_F77=unsupported + archive_cmds_F77='$echo "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$echo DATA >> $output_objdir/$libname.def~$echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~$echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' + old_archive_From_new_cmds_F77='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' + ;; + + osf3*) + if test "$GCC" = yes; then + allow_undefined_flag_F77=' ${wl}-expect_unresolved ${wl}\*' + archive_cmds_F77='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + else + allow_undefined_flag_F77=' -expect_unresolved \*' + archive_cmds_F77='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + fi + hardcode_libdir_flag_spec_F77='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator_F77=: + ;; + + osf4* | osf5*) # as osf3* with the addition of -msym flag + if test "$GCC" = yes; then + allow_undefined_flag_F77=' ${wl}-expect_unresolved ${wl}\*' + archive_cmds_F77='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + hardcode_libdir_flag_spec_F77='${wl}-rpath ${wl}$libdir' + else + allow_undefined_flag_F77=' -expect_unresolved \*' + archive_cmds_F77='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + archive_expsym_cmds_F77='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~ + $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib~$rm $lib.exp' + + # Both c and cxx compiler support -rpath directly + hardcode_libdir_flag_spec_F77='-rpath $libdir' + fi + hardcode_libdir_separator_F77=: + ;; + + solaris*) + no_undefined_flag_F77=' -z text' + if test "$GCC" = yes; then + wlarc='${wl}' + archive_cmds_F77='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds_F77='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $CC -shared ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$rm $lib.exp' + else + wlarc='' + archive_cmds_F77='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' + archive_expsym_cmds_F77='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' + fi + hardcode_libdir_flag_spec_F77='-R$libdir' + hardcode_shlibpath_var_F77=no + case $host_os in + solaris2.[0-5] | solaris2.[0-5].*) ;; + *) + # The compiler driver will combine and reorder linker options, + # but understands `-z linker_flag'. GCC discards it without `$wl', + # but is careful enough not to reorder. + # Supported since Solaris 2.6 (maybe 2.5.1?) + if test "$GCC" = yes; then + whole_archive_flag_spec_F77='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' + else + whole_archive_flag_spec_F77='-z allextract$convenience -z defaultextract' + fi + ;; + esac + link_all_deplibs_F77=yes + ;; + + sunos4*) + if test "x$host_vendor" = xsequent; then + # Use $CC to link under sequent, because it throws in some extra .o + # files that make .init and .fini sections work. + archive_cmds_F77='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' + else + archive_cmds_F77='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' + fi + hardcode_libdir_flag_spec_F77='-L$libdir' + hardcode_direct_F77=yes + hardcode_minus_L_F77=yes + hardcode_shlibpath_var_F77=no + ;; + + sysv4) + case $host_vendor in + sni) + archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct_F77=yes # is this really true??? + ;; + siemens) + ## LD is ld it makes a PLAMLIB + ## CC just makes a GrossModule. + archive_cmds_F77='$LD -G -o $lib $libobjs $deplibs $linker_flags' + reload_cmds_F77='$CC -r -o $output$reload_objs' + hardcode_direct_F77=no + ;; + motorola) + archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct_F77=no #Motorola manual says yes, but my tests say they lie + ;; + esac + runpath_var='LD_RUN_PATH' + hardcode_shlibpath_var_F77=no + ;; + + sysv4.3*) + archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_shlibpath_var_F77=no + export_dynamic_flag_spec_F77='-Bexport' + ;; + + sysv4*MP*) + if test -d /usr/nec; then + archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_shlibpath_var_F77=no + runpath_var=LD_RUN_PATH + hardcode_runpath_var=yes + ld_shlibs_F77=yes + fi + ;; + + sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*) + no_undefined_flag_F77='${wl}-z,text' + archive_cmds_need_lc_F77=no + hardcode_shlibpath_var_F77=no + runpath_var='LD_RUN_PATH' + + if test "$GCC" = yes; then + archive_cmds_F77='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds_F77='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + else + archive_cmds_F77='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds_F77='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + fi + ;; + + sysv5* | sco3.2v5* | sco5v6*) + # Note: We can NOT use -z defs as we might desire, because we do not + # link with -lc, and that would cause any symbols used from libc to + # always be unresolved, which means just about no library would + # ever link correctly. If we're not using GNU ld we use -z text + # though, which does catch some bad symbols but isn't as heavy-handed + # as -z defs. + no_undefined_flag_F77='${wl}-z,text' + allow_undefined_flag_F77='${wl}-z,nodefs' + archive_cmds_need_lc_F77=no + hardcode_shlibpath_var_F77=no + hardcode_libdir_flag_spec_F77='`test -z "$SCOABSPATH" && echo ${wl}-R,$libdir`' + hardcode_libdir_separator_F77=':' + link_all_deplibs_F77=yes + export_dynamic_flag_spec_F77='${wl}-Bexport' + runpath_var='LD_RUN_PATH' + + if test "$GCC" = yes; then + archive_cmds_F77='$CC -shared ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds_F77='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' + else + archive_cmds_F77='$CC -G ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds_F77='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' + fi + ;; + + uts4*) + archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec_F77='-L$libdir' + hardcode_shlibpath_var_F77=no + ;; + + *) + ld_shlibs_F77=no + ;; + esac + fi + +{ echo "$as_me:$LINENO: result: $ld_shlibs_F77" >&5 +echo "${ECHO_T}$ld_shlibs_F77" >&6; } +test "$ld_shlibs_F77" = no && can_build_shared=no + +# +# Do we need to explicitly link libc? +# +case "x$archive_cmds_need_lc_F77" in +x|xyes) + # Assume -lc should be added + archive_cmds_need_lc_F77=yes + + if test "$enable_shared" = yes && test "$GCC" = yes; then + case $archive_cmds_F77 in + *'~'*) + # FIXME: we may have to deal with multi-command sequences. + ;; + '$CC '*) + # Test whether the compiler implicitly links with -lc since on some + # systems, -lgcc has to come before -lc. If gcc already passes -lc + # to ld, don't add -lc before -lgcc. + { echo "$as_me:$LINENO: checking whether -lc should be explicitly linked in" >&5 +echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >&6; } + $rm conftest* + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + + if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } 2>conftest.err; then + soname=conftest + lib=conftest + libobjs=conftest.$ac_objext + deplibs= + wl=$lt_prog_compiler_wl_F77 + pic_flag=$lt_prog_compiler_pic_F77 + compiler_flags=-v + linker_flags=-v + verstring= + output_objdir=. + libname=conftest + lt_save_allow_undefined_flag=$allow_undefined_flag_F77 + allow_undefined_flag_F77= + if { (eval echo "$as_me:$LINENO: \"$archive_cmds_F77 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1\"") >&5 + (eval $archive_cmds_F77 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } + then + archive_cmds_need_lc_F77=no + else + archive_cmds_need_lc_F77=yes + fi + allow_undefined_flag_F77=$lt_save_allow_undefined_flag + else + cat conftest.err 1>&5 + fi + $rm conftest* + { echo "$as_me:$LINENO: result: $archive_cmds_need_lc_F77" >&5 +echo "${ECHO_T}$archive_cmds_need_lc_F77" >&6; } + ;; + esac + fi + ;; +esac + +{ echo "$as_me:$LINENO: checking dynamic linker characteristics" >&5 +echo $ECHO_N "checking dynamic linker characteristics... $ECHO_C" >&6; } +library_names_spec= +libname_spec='lib$name' +soname_spec= +shrext_cmds=".so" +postinstall_cmds= +postuninstall_cmds= +finish_cmds= +finish_eval= +shlibpath_var= +shlibpath_overrides_runpath=unknown +version_type=none +dynamic_linker="$host_os ld.so" +sys_lib_dlsearch_path_spec="/lib /usr/lib" + +need_lib_prefix=unknown +hardcode_into_libs=no + +# when you set need_version to no, make sure it does not cause -set_version +# flags to be left without arguments +need_version=unknown + +case $host_os in +aix3*) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' + shlibpath_var=LIBPATH + + # AIX 3 has no versioning support, so we append a major version to the name. + soname_spec='${libname}${release}${shared_ext}$major' + ;; + +aix4* | aix5*) + version_type=linux + need_lib_prefix=no + need_version=no + hardcode_into_libs=yes + if test "$host_cpu" = ia64; then + # AIX 5 supports IA64 + library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + else + # With GCC up to 2.95.x, collect2 would create an import file + # for dependence libraries. The import file would start with + # the line `#! .'. This would cause the generated library to + # depend on `.', always an invalid library. This was fixed in + # development snapshots of GCC prior to 3.0. + case $host_os in + aix4 | aix4.[01] | aix4.[01].*) + if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' + echo ' yes ' + echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then + : + else + can_build_shared=no + fi + ;; + esac + # AIX (on Power*) has no versioning support, so currently we can not hardcode correct + # soname into executable. Probably we can add versioning support to + # collect2, so additional links can be useful in future. + if test "$aix_use_runtimelinking" = yes; then + # If using run time linking (on AIX 4.2 or later) use lib.so + # instead of lib.a to let people know that these are not + # typical AIX shared libraries. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + else + # We preserve .a as extension for shared libraries through AIX4.2 + # and later when we are not doing run time linking. + library_names_spec='${libname}${release}.a $libname.a' + soname_spec='${libname}${release}${shared_ext}$major' + fi + shlibpath_var=LIBPATH + fi + ;; + +amigaos*) + library_names_spec='$libname.ixlibrary $libname.a' + # Create ${libname}_ixlibrary.a entries in /sys/libs. + finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' + ;; + +beos*) + library_names_spec='${libname}${shared_ext}' + dynamic_linker="$host_os ld.so" + shlibpath_var=LIBRARY_PATH + ;; + +bsdi[45]*) + version_type=linux + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' + shlibpath_var=LD_LIBRARY_PATH + sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" + sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" + # the default ld.so.conf also contains /usr/contrib/lib and + # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow + # libtool to hard-code these into programs + ;; + +cygwin* | mingw* | pw32*) + version_type=windows + shrext_cmds=".dll" + need_version=no + need_lib_prefix=no + + case $GCC,$host_os in + yes,cygwin* | yes,mingw* | yes,pw32*) + library_names_spec='$libname.dll.a' + # DLL is installed to $(libdir)/../bin by postinstall_cmds + postinstall_cmds='base_file=`basename \${file}`~ + dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i;echo \$dlname'\''`~ + dldir=$destdir/`dirname \$dlpath`~ + test -d \$dldir || mkdir -p \$dldir~ + $install_prog $dir/$dlname \$dldir/$dlname~ + chmod a+x \$dldir/$dlname' + postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ + dlpath=$dir/\$dldll~ + $rm \$dlpath' + shlibpath_overrides_runpath=yes + + case $host_os in + cygwin*) + # Cygwin DLLs use 'cyg' prefix rather than 'lib' + soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' + sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib" + ;; + mingw*) + # MinGW DLLs use traditional 'lib' prefix + soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' + sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` + if echo "$sys_lib_search_path_spec" | grep ';[c-zC-Z]:/' >/dev/null; then + # It is most probably a Windows format PATH printed by + # mingw gcc, but we are running on Cygwin. Gcc prints its search + # path with ; separators, and with drive letters. We can handle the + # drive letters (cygwin fileutils understands them), so leave them, + # especially as we might pass files found there to a mingw objdump, + # which wouldn't understand a cygwinified path. Ahh. + sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` + else + sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + fi + ;; + pw32*) + # pw32 DLLs use 'pw' prefix rather than 'lib' + library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' + ;; + esac + ;; + + *) + library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib' + ;; + esac + dynamic_linker='Win32 ld.exe' + # FIXME: first we should search . and the directory the executable is in + shlibpath_var=PATH + ;; + +darwin* | rhapsody*) + dynamic_linker="$host_os dyld" + version_type=darwin + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${versuffix}$shared_ext ${libname}${release}${major}$shared_ext ${libname}$shared_ext' + soname_spec='${libname}${release}${major}$shared_ext' + shlibpath_overrides_runpath=yes + shlibpath_var=DYLD_LIBRARY_PATH + shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' + + sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' + ;; + +dgux*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +freebsd1*) + dynamic_linker=no + ;; + +freebsd* | dragonfly*) + # DragonFly does not have aout. When/if they implement a new + # versioning mechanism, adjust this. + if test -x /usr/bin/objformat; then + objformat=`/usr/bin/objformat` + else + case $host_os in + freebsd[123]*) objformat=aout ;; + *) objformat=elf ;; + esac + fi + version_type=freebsd-$objformat + case $version_type in + freebsd-elf*) + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' + need_version=no + need_lib_prefix=no + ;; + freebsd-*) + library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' + need_version=yes + ;; + esac + shlibpath_var=LD_LIBRARY_PATH + case $host_os in + freebsd2*) + shlibpath_overrides_runpath=yes + ;; + freebsd3.[01]* | freebsdelf3.[01]*) + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + freebsd3.[2-9]* | freebsdelf3.[2-9]* | \ + freebsd4.[0-5] | freebsdelf4.[0-5] | freebsd4.1.1 | freebsdelf4.1.1) + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + *) # from 4.6 on, and DragonFly + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + esac + ;; + +gnu*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + hardcode_into_libs=yes + ;; + +hpux9* | hpux10* | hpux11*) + # Give a soname corresponding to the major version so that dld.sl refuses to + # link against other versions. + version_type=sunos + need_lib_prefix=no + need_version=no + case $host_cpu in + ia64*) + shrext_cmds='.so' + hardcode_into_libs=yes + dynamic_linker="$host_os dld.so" + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + if test "X$HPUX_IA64_MODE" = X32; then + sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" + else + sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" + fi + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + ;; + hppa*64*) + shrext_cmds='.sl' + hardcode_into_libs=yes + dynamic_linker="$host_os dld.sl" + shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH + shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + ;; + *) + shrext_cmds='.sl' + dynamic_linker="$host_os dld.sl" + shlibpath_var=SHLIB_PATH + shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + ;; + esac + # HP-UX runs *really* slowly unless shared libraries are mode 555. + postinstall_cmds='chmod 555 $lib' + ;; + +interix[3-9]*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + +irix5* | irix6* | nonstopux*) + case $host_os in + nonstopux*) version_type=nonstopux ;; + *) + if test "$lt_cv_prog_gnu_ld" = yes; then + version_type=linux + else + version_type=irix + fi ;; + esac + need_lib_prefix=no + need_version=no + soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' + case $host_os in + irix5* | nonstopux*) + libsuff= shlibsuff= + ;; + *) + case $LD in # libtool.m4 will add one of these switches to LD + *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") + libsuff= shlibsuff= libmagic=32-bit;; + *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") + libsuff=32 shlibsuff=N32 libmagic=N32;; + *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") + libsuff=64 shlibsuff=64 libmagic=64-bit;; + *) libsuff= shlibsuff= libmagic=never-match;; + esac + ;; + esac + shlibpath_var=LD_LIBRARY${shlibsuff}_PATH + shlibpath_overrides_runpath=no + sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" + sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" + hardcode_into_libs=yes + ;; + +# No shared lib support for Linux oldld, aout, or coff. +linux*oldld* | linux*aout* | linux*coff*) + dynamic_linker=no + ;; + +# This must be Linux ELF. +linux* | k*bsd*-gnu) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + # This implies no fast_install, which is unacceptable. + # Some rework will be needed to allow for fast_install + # before this can be enabled. + hardcode_into_libs=yes + + # Append ld.so.conf contents to the search path + if test -f /etc/ld.so.conf; then + lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` + sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" + fi + + # We used to test for /lib/ld.so.1 and disable shared libraries on + # powerpc, because MkLinux only supported shared libraries with the + # GNU dynamic linker. Since this was broken with cross compilers, + # most powerpc-linux boxes support dynamic linking these days and + # people can always --disable-shared, the test was removed, and we + # assume the GNU/Linux dynamic linker is in use. + dynamic_linker='GNU/Linux ld.so' + ;; + +netbsdelf*-gnu) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + dynamic_linker='NetBSD ld.elf_so' + ;; + +netbsd*) + version_type=sunos + need_lib_prefix=no + need_version=no + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + dynamic_linker='NetBSD (a.out) ld.so' + else + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + dynamic_linker='NetBSD ld.elf_so' + fi + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + +newsos6) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + ;; + +nto-qnx*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + ;; + +openbsd*) + version_type=sunos + sys_lib_dlsearch_path_spec="/usr/lib" + need_lib_prefix=no + # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. + case $host_os in + openbsd3.3 | openbsd3.3.*) need_version=yes ;; + *) need_version=no ;; + esac + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + shlibpath_var=LD_LIBRARY_PATH + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + case $host_os in + openbsd2.[89] | openbsd2.[89].*) + shlibpath_overrides_runpath=no + ;; + *) + shlibpath_overrides_runpath=yes + ;; + esac + else + shlibpath_overrides_runpath=yes + fi + ;; + +os2*) + libname_spec='$name' + shrext_cmds=".dll" + need_lib_prefix=no + library_names_spec='$libname${shared_ext} $libname.a' + dynamic_linker='OS/2 ld.exe' + shlibpath_var=LIBPATH + ;; + +osf3* | osf4* | osf5*) + version_type=osf + need_lib_prefix=no + need_version=no + soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" + sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" + ;; + +rdos*) + dynamic_linker=no + ;; + +solaris*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + # ldd complains unless libraries are executable + postinstall_cmds='chmod +x $lib' + ;; + +sunos4*) + version_type=sunos + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + if test "$with_gnu_ld" = yes; then + need_lib_prefix=no + fi + need_version=yes + ;; + +sysv4 | sysv4.3*) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + case $host_vendor in + sni) + shlibpath_overrides_runpath=no + need_lib_prefix=no + export_dynamic_flag_spec='${wl}-Blargedynsym' + runpath_var=LD_RUN_PATH + ;; + siemens) + need_lib_prefix=no + ;; + motorola) + need_lib_prefix=no + need_version=no + shlibpath_overrides_runpath=no + sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' + ;; + esac + ;; + +sysv4*MP*) + if test -d /usr/nec ;then + version_type=linux + library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' + soname_spec='$libname${shared_ext}.$major' + shlibpath_var=LD_LIBRARY_PATH + fi + ;; + +sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) + version_type=freebsd-elf + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + hardcode_into_libs=yes + if test "$with_gnu_ld" = yes; then + sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' + shlibpath_overrides_runpath=no + else + sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' + shlibpath_overrides_runpath=yes + case $host_os in + sco3.2v5*) + sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" + ;; + esac + fi + sys_lib_dlsearch_path_spec='/usr/lib' + ;; + +uts4*) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +*) + dynamic_linker=no + ;; +esac +{ echo "$as_me:$LINENO: result: $dynamic_linker" >&5 +echo "${ECHO_T}$dynamic_linker" >&6; } +test "$dynamic_linker" = no && can_build_shared=no + +variables_saved_for_relink="PATH $shlibpath_var $runpath_var" +if test "$GCC" = yes; then + variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" +fi + +{ echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5 +echo $ECHO_N "checking how to hardcode library paths into programs... $ECHO_C" >&6; } +hardcode_action_F77= +if test -n "$hardcode_libdir_flag_spec_F77" || \ + test -n "$runpath_var_F77" || \ + test "X$hardcode_automatic_F77" = "Xyes" ; then + + # We can hardcode non-existant directories. + if test "$hardcode_direct_F77" != no && + # If the only mechanism to avoid hardcoding is shlibpath_var, we + # have to relink, otherwise we might link with an installed library + # when we should be linking with a yet-to-be-installed one + ## test "$_LT_AC_TAGVAR(hardcode_shlibpath_var, F77)" != no && + test "$hardcode_minus_L_F77" != no; then + # Linking always hardcodes the temporary library directory. + hardcode_action_F77=relink + else + # We can link without hardcoding, and we can hardcode nonexisting dirs. + hardcode_action_F77=immediate + fi +else + # We cannot hardcode anything, or else we can only hardcode existing + # directories. + hardcode_action_F77=unsupported +fi +{ echo "$as_me:$LINENO: result: $hardcode_action_F77" >&5 +echo "${ECHO_T}$hardcode_action_F77" >&6; } + +if test "$hardcode_action_F77" = relink; then + # Fast installation is not supported + enable_fast_install=no +elif test "$shlibpath_overrides_runpath" = yes || + test "$enable_shared" = no; then + # Fast installation is not necessary + enable_fast_install=needless +fi + + +# The else clause should only fire when bootstrapping the +# libtool distribution, otherwise you forgot to ship ltmain.sh +# with your package, and you will get complaints that there are +# no rules to generate ltmain.sh. +if test -f "$ltmain"; then + # See if we are running on zsh, and set the options which allow our commands through + # without removal of \ escapes. + if test -n "${ZSH_VERSION+set}" ; then + setopt NO_GLOB_SUBST + fi + # Now quote all the things that may contain metacharacters while being + # careful not to overquote the AC_SUBSTed values. We take copies of the + # variables and quote the copies for generation of the libtool script. + for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC LTCFLAGS NM \ + SED SHELL STRIP \ + libname_spec library_names_spec soname_spec extract_expsyms_cmds \ + old_striplib striplib file_magic_cmd finish_cmds finish_eval \ + deplibs_check_method reload_flag reload_cmds need_locks \ + lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \ + lt_cv_sys_global_symbol_to_c_name_address \ + sys_lib_search_path_spec sys_lib_dlsearch_path_spec \ + old_postinstall_cmds old_postuninstall_cmds \ + compiler_F77 \ + CC_F77 \ + LD_F77 \ + lt_prog_compiler_wl_F77 \ + lt_prog_compiler_pic_F77 \ + lt_prog_compiler_static_F77 \ + lt_prog_compiler_no_builtin_flag_F77 \ + export_dynamic_flag_spec_F77 \ + thread_safe_flag_spec_F77 \ + whole_archive_flag_spec_F77 \ + enable_shared_with_static_runtimes_F77 \ + old_archive_cmds_F77 \ + old_archive_from_new_cmds_F77 \ + predep_objects_F77 \ + postdep_objects_F77 \ + predeps_F77 \ + postdeps_F77 \ + compiler_lib_search_path_F77 \ + archive_cmds_F77 \ + archive_expsym_cmds_F77 \ + postinstall_cmds_F77 \ + postuninstall_cmds_F77 \ + old_archive_from_expsyms_cmds_F77 \ + allow_undefined_flag_F77 \ + no_undefined_flag_F77 \ + export_symbols_cmds_F77 \ + hardcode_libdir_flag_spec_F77 \ + hardcode_libdir_flag_spec_ld_F77 \ + hardcode_libdir_separator_F77 \ + hardcode_automatic_F77 \ + module_cmds_F77 \ + module_expsym_cmds_F77 \ + lt_cv_prog_compiler_c_o_F77 \ + fix_srcfile_path_F77 \ + exclude_expsyms_F77 \ + include_expsyms_F77; do + + case $var in + old_archive_cmds_F77 | \ + old_archive_from_new_cmds_F77 | \ + archive_cmds_F77 | \ + archive_expsym_cmds_F77 | \ + module_cmds_F77 | \ + module_expsym_cmds_F77 | \ + old_archive_from_expsyms_cmds_F77 | \ + export_symbols_cmds_F77 | \ + extract_expsyms_cmds | reload_cmds | finish_cmds | \ + postinstall_cmds | postuninstall_cmds | \ + old_postinstall_cmds | old_postuninstall_cmds | \ + sys_lib_search_path_spec | sys_lib_dlsearch_path_spec) + # Double-quote double-evaled strings. + eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\"" + ;; + *) + eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\"" + ;; + esac + done + + case $lt_echo in + *'\$0 --fallback-echo"') + lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'` + ;; + esac + +cfgfile="$ofile" + + cat <<__EOF__ >> "$cfgfile" +# ### BEGIN LIBTOOL TAG CONFIG: $tagname + +# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: + +# Shell to use when invoking shell scripts. +SHELL=$lt_SHELL + +# Whether or not to build shared libraries. +build_libtool_libs=$enable_shared + +# Whether or not to build static libraries. +build_old_libs=$enable_static + +# Whether or not to add -lc for building shared libraries. +build_libtool_need_lc=$archive_cmds_need_lc_F77 + +# Whether or not to disallow shared libs when runtime libs are static +allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes_F77 + +# Whether or not to optimize for fast installation. +fast_install=$enable_fast_install + +# The host system. +host_alias=$host_alias +host=$host +host_os=$host_os + +# The build system. +build_alias=$build_alias +build=$build +build_os=$build_os + +# An echo program that does not interpret backslashes. +echo=$lt_echo + +# The archiver. +AR=$lt_AR +AR_FLAGS=$lt_AR_FLAGS + +# A C compiler. +LTCC=$lt_LTCC + +# LTCC compiler flags. +LTCFLAGS=$lt_LTCFLAGS + +# A language-specific compiler. +CC=$lt_compiler_F77 + +# Is the compiler the GNU C compiler? +with_gcc=$GCC_F77 + +# An ERE matcher. +EGREP=$lt_EGREP + +# The linker used to build libraries. +LD=$lt_LD_F77 + +# Whether we need hard or soft links. +LN_S=$lt_LN_S + +# A BSD-compatible nm program. +NM=$lt_NM + +# A symbol stripping program +STRIP=$lt_STRIP + +# Used to examine libraries when file_magic_cmd begins "file" +MAGIC_CMD=$MAGIC_CMD + +# Used on cygwin: DLL creation program. +DLLTOOL="$DLLTOOL" + +# Used on cygwin: object dumper. +OBJDUMP="$OBJDUMP" + +# Used on cygwin: assembler. +AS="$AS" + +# The name of the directory that contains temporary libtool files. +objdir=$objdir + +# How to create reloadable object files. +reload_flag=$lt_reload_flag +reload_cmds=$lt_reload_cmds + +# How to pass a linker flag through the compiler. +wl=$lt_lt_prog_compiler_wl_F77 + +# Object file suffix (normally "o"). +objext="$ac_objext" + +# Old archive suffix (normally "a"). +libext="$libext" + +# Shared library suffix (normally ".so"). +shrext_cmds='$shrext_cmds' + +# Executable file suffix (normally ""). +exeext="$exeext" + +# Additional compiler flags for building library objects. +pic_flag=$lt_lt_prog_compiler_pic_F77 +pic_mode=$pic_mode + +# What is the maximum length of a command? +max_cmd_len=$lt_cv_sys_max_cmd_len + +# Does compiler simultaneously support -c and -o options? +compiler_c_o=$lt_lt_cv_prog_compiler_c_o_F77 + +# Must we lock files when doing compilation? +need_locks=$lt_need_locks + +# Do we need the lib prefix for modules? +need_lib_prefix=$need_lib_prefix + +# Do we need a version for libraries? +need_version=$need_version + +# Whether dlopen is supported. +dlopen_support=$enable_dlopen + +# Whether dlopen of programs is supported. +dlopen_self=$enable_dlopen_self + +# Whether dlopen of statically linked programs is supported. +dlopen_self_static=$enable_dlopen_self_static + +# Compiler flag to prevent dynamic linking. +link_static_flag=$lt_lt_prog_compiler_static_F77 + +# Compiler flag to turn off builtin functions. +no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag_F77 + +# Compiler flag to allow reflexive dlopens. +export_dynamic_flag_spec=$lt_export_dynamic_flag_spec_F77 + +# Compiler flag to generate shared objects directly from archives. +whole_archive_flag_spec=$lt_whole_archive_flag_spec_F77 + +# Compiler flag to generate thread-safe objects. +thread_safe_flag_spec=$lt_thread_safe_flag_spec_F77 + +# Library versioning type. +version_type=$version_type + +# Format of library name prefix. +libname_spec=$lt_libname_spec + +# List of archive names. First name is the real one, the rest are links. +# The last name is the one that the linker finds with -lNAME. +library_names_spec=$lt_library_names_spec + +# The coded name of the library, if different from the real name. +soname_spec=$lt_soname_spec + +# Commands used to build and install an old-style archive. +RANLIB=$lt_RANLIB +old_archive_cmds=$lt_old_archive_cmds_F77 +old_postinstall_cmds=$lt_old_postinstall_cmds +old_postuninstall_cmds=$lt_old_postuninstall_cmds + +# Create an old-style archive from a shared archive. +old_archive_from_new_cmds=$lt_old_archive_from_new_cmds_F77 + +# Create a temporary old-style archive to link instead of a shared archive. +old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds_F77 + +# Commands used to build and install a shared archive. +archive_cmds=$lt_archive_cmds_F77 +archive_expsym_cmds=$lt_archive_expsym_cmds_F77 +postinstall_cmds=$lt_postinstall_cmds +postuninstall_cmds=$lt_postuninstall_cmds + +# Commands used to build a loadable module (assumed same as above if empty) +module_cmds=$lt_module_cmds_F77 +module_expsym_cmds=$lt_module_expsym_cmds_F77 + +# Commands to strip libraries. +old_striplib=$lt_old_striplib +striplib=$lt_striplib + +# Dependencies to place before the objects being linked to create a +# shared library. +predep_objects=$lt_predep_objects_F77 + +# Dependencies to place after the objects being linked to create a +# shared library. +postdep_objects=$lt_postdep_objects_F77 + +# Dependencies to place before the objects being linked to create a +# shared library. +predeps=$lt_predeps_F77 + +# Dependencies to place after the objects being linked to create a +# shared library. +postdeps=$lt_postdeps_F77 + +# The library search path used internally by the compiler when linking +# a shared library. +compiler_lib_search_path=$lt_compiler_lib_search_path_F77 + +# Method to check whether dependent libraries are shared objects. +deplibs_check_method=$lt_deplibs_check_method + +# Command to use when deplibs_check_method == file_magic. +file_magic_cmd=$lt_file_magic_cmd + +# Flag that allows shared libraries with undefined symbols to be built. +allow_undefined_flag=$lt_allow_undefined_flag_F77 + +# Flag that forces no undefined symbols. +no_undefined_flag=$lt_no_undefined_flag_F77 + +# Commands used to finish a libtool library installation in a directory. +finish_cmds=$lt_finish_cmds + +# Same as above, but a single script fragment to be evaled but not shown. +finish_eval=$lt_finish_eval + +# Take the output of nm and produce a listing of raw symbols and C names. +global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe + +# Transform the output of nm in a proper C declaration +global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl + +# Transform the output of nm in a C name address pair +global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address + +# This is the shared library runtime path variable. +runpath_var=$runpath_var + +# This is the shared library path variable. +shlibpath_var=$shlibpath_var + +# Is shlibpath searched before the hard-coded library search path? +shlibpath_overrides_runpath=$shlibpath_overrides_runpath + +# How to hardcode a shared library path into an executable. +hardcode_action=$hardcode_action_F77 + +# Whether we should hardcode library paths into libraries. +hardcode_into_libs=$hardcode_into_libs + +# Flag to hardcode \$libdir into a binary during linking. +# This must work even if \$libdir does not exist. +hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec_F77 + +# If ld is used when linking, flag to hardcode \$libdir into +# a binary during linking. This must work even if \$libdir does +# not exist. +hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld_F77 + +# Whether we need a single -rpath flag with a separated argument. +hardcode_libdir_separator=$lt_hardcode_libdir_separator_F77 + +# Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the +# resulting binary. +hardcode_direct=$hardcode_direct_F77 + +# Set to yes if using the -LDIR flag during linking hardcodes DIR into the +# resulting binary. +hardcode_minus_L=$hardcode_minus_L_F77 + +# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into +# the resulting binary. +hardcode_shlibpath_var=$hardcode_shlibpath_var_F77 + +# Set to yes if building a shared library automatically hardcodes DIR into the library +# and all subsequent libraries and executables linked against it. +hardcode_automatic=$hardcode_automatic_F77 + +# Variables whose values should be saved in libtool wrapper scripts and +# restored at relink time. +variables_saved_for_relink="$variables_saved_for_relink" + +# Whether libtool must link a program against all its dependency libraries. +link_all_deplibs=$link_all_deplibs_F77 + +# Compile-time system search path for libraries +sys_lib_search_path_spec=$lt_sys_lib_search_path_spec + +# Run-time system search path for libraries +sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec + +# Fix the shell variable \$srcfile for the compiler. +fix_srcfile_path=$lt_fix_srcfile_path + +# Set to yes if exported symbols are required. +always_export_symbols=$always_export_symbols_F77 + +# The commands to list exported symbols. +export_symbols_cmds=$lt_export_symbols_cmds_F77 + +# The commands to extract the exported symbol list from a shared archive. +extract_expsyms_cmds=$lt_extract_expsyms_cmds + +# Symbols that should not be listed in the preloaded symbols. +exclude_expsyms=$lt_exclude_expsyms_F77 + +# Symbols that must always be exported. +include_expsyms=$lt_include_expsyms_F77 + +# ### END LIBTOOL TAG CONFIG: $tagname + +__EOF__ + + +else + # If there is no Makefile yet, we rely on a make rule to execute + # `config.status --recheck' to rerun these tests and create the + # libtool script then. + ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'` + if test -f "$ltmain_in"; then + test -f Makefile && make "$ltmain" + fi +fi + + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +CC="$lt_save_CC" + + else + tagname="" + fi + ;; + + GCJ) + if test -n "$GCJ" && test "X$GCJ" != "Xno"; then + + +# Source file extension for Java test sources. +ac_ext=java + +# Object file extension for compiled Java test sources. +objext=o +objext_GCJ=$objext + +# Code to be used in simple compile tests +lt_simple_compile_test_code="class foo {}" + +# Code to be used in simple link tests +lt_simple_link_test_code='public class conftest { public static void main(String[] argv) {}; }' + +# ltmain only uses $CC for tagged configurations so make sure $CC is set. + +# If no C compiler was specified, use CC. +LTCC=${LTCC-"$CC"} + +# If no C compiler flags were specified, use CFLAGS. +LTCFLAGS=${LTCFLAGS-"$CFLAGS"} + +# Allow CC to be a program name with arguments. +compiler=$CC + + +# save warnings/boilerplate of simple test code +ac_outfile=conftest.$ac_objext +echo "$lt_simple_compile_test_code" >conftest.$ac_ext +eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err +_lt_compiler_boilerplate=`cat conftest.err` +$rm conftest* + +ac_outfile=conftest.$ac_objext +echo "$lt_simple_link_test_code" >conftest.$ac_ext +eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err +_lt_linker_boilerplate=`cat conftest.err` +$rm conftest* + + +# Allow CC to be a program name with arguments. +lt_save_CC="$CC" +CC=${GCJ-"gcj"} +compiler=$CC +compiler_GCJ=$CC +for cc_temp in $compiler""; do + case $cc_temp in + compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; + distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; + \-*) ;; + *) break;; + esac +done +cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` + + +# GCJ did not exist at the time GCC didn't implicitly link libc in. +archive_cmds_need_lc_GCJ=no + +old_archive_cmds_GCJ=$old_archive_cmds + + +lt_prog_compiler_no_builtin_flag_GCJ= + +if test "$GCC" = yes; then + lt_prog_compiler_no_builtin_flag_GCJ=' -fno-builtin' + + +{ echo "$as_me:$LINENO: checking if $compiler supports -fno-rtti -fno-exceptions" >&5 +echo $ECHO_N "checking if $compiler supports -fno-rtti -fno-exceptions... $ECHO_C" >&6; } +if test "${lt_cv_prog_compiler_rtti_exceptions+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + lt_cv_prog_compiler_rtti_exceptions=no + ac_outfile=conftest.$ac_objext + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + lt_compiler_flag="-fno-rtti -fno-exceptions" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + # The option is referenced via a variable to avoid confusing sed. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ + -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:16403: $lt_compile\"" >&5) + (eval "$lt_compile" 2>conftest.err) + ac_status=$? + cat conftest.err >&5 + echo "$as_me:16407: \$? = $ac_status" >&5 + if (exit $ac_status) && test -s "$ac_outfile"; then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings other than the usual output. + $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp + $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 + if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then + lt_cv_prog_compiler_rtti_exceptions=yes + fi + fi + $rm conftest* + +fi +{ echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_rtti_exceptions" >&5 +echo "${ECHO_T}$lt_cv_prog_compiler_rtti_exceptions" >&6; } + +if test x"$lt_cv_prog_compiler_rtti_exceptions" = xyes; then + lt_prog_compiler_no_builtin_flag_GCJ="$lt_prog_compiler_no_builtin_flag_GCJ -fno-rtti -fno-exceptions" +else + : +fi + +fi + +lt_prog_compiler_wl_GCJ= +lt_prog_compiler_pic_GCJ= +lt_prog_compiler_static_GCJ= + +{ echo "$as_me:$LINENO: checking for $compiler option to produce PIC" >&5 +echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6; } + + if test "$GCC" = yes; then + lt_prog_compiler_wl_GCJ='-Wl,' + lt_prog_compiler_static_GCJ='-static' + + case $host_os in + aix*) + # All AIX code is PIC. + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + lt_prog_compiler_static_GCJ='-Bstatic' + fi + ;; + + amigaos*) + # FIXME: we need at least 68020 code to build shared libraries, but + # adding the `-m68020' flag to GCC prevents building anything better, + # like `-m68040'. + lt_prog_compiler_pic_GCJ='-m68020 -resident32 -malways-restore-a4' + ;; + + beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) + # PIC is the default for these OSes. + ;; + + mingw* | cygwin* | pw32* | os2*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + # Although the cygwin gcc ignores -fPIC, still need this for old-style + # (--disable-auto-import) libraries + lt_prog_compiler_pic_GCJ='-DDLL_EXPORT' + ;; + + darwin* | rhapsody*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + lt_prog_compiler_pic_GCJ='-fno-common' + ;; + + interix[3-9]*) + # Interix 3.x gcc -fpic/-fPIC options generate broken code. + # Instead, we relocate shared libraries at runtime. + ;; + + msdosdjgpp*) + # Just because we use GCC doesn't mean we suddenly get shared libraries + # on systems that don't support them. + lt_prog_compiler_can_build_shared_GCJ=no + enable_shared=no + ;; + + sysv4*MP*) + if test -d /usr/nec; then + lt_prog_compiler_pic_GCJ=-Kconform_pic + fi + ;; + + hpux*) + # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but + # not for PA HP-UX. + case $host_cpu in + hppa*64*|ia64*) + # +Z the default + ;; + *) + lt_prog_compiler_pic_GCJ='-fPIC' + ;; + esac + ;; + + *) + lt_prog_compiler_pic_GCJ='-fPIC' + ;; + esac + else + # PORTME Check for flag to pass linker flags through the system compiler. + case $host_os in + aix*) + lt_prog_compiler_wl_GCJ='-Wl,' + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + lt_prog_compiler_static_GCJ='-Bstatic' + else + lt_prog_compiler_static_GCJ='-bnso -bI:/lib/syscalls.exp' + fi + ;; + darwin*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + case $cc_basename in + xlc*) + lt_prog_compiler_pic_GCJ='-qnocommon' + lt_prog_compiler_wl_GCJ='-Wl,' + ;; + esac + ;; + + mingw* | cygwin* | pw32* | os2*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + lt_prog_compiler_pic_GCJ='-DDLL_EXPORT' + ;; + + hpux9* | hpux10* | hpux11*) + lt_prog_compiler_wl_GCJ='-Wl,' + # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but + # not for PA HP-UX. + case $host_cpu in + hppa*64*|ia64*) + # +Z the default + ;; + *) + lt_prog_compiler_pic_GCJ='+Z' + ;; + esac + # Is there a better lt_prog_compiler_static that works with the bundled CC? + lt_prog_compiler_static_GCJ='${wl}-a ${wl}archive' + ;; + + irix5* | irix6* | nonstopux*) + lt_prog_compiler_wl_GCJ='-Wl,' + # PIC (with -KPIC) is the default. + lt_prog_compiler_static_GCJ='-non_shared' + ;; + + newsos6) + lt_prog_compiler_pic_GCJ='-KPIC' + lt_prog_compiler_static_GCJ='-Bstatic' + ;; + + linux* | k*bsd*-gnu) + case $cc_basename in + icc* | ecc*) + lt_prog_compiler_wl_GCJ='-Wl,' + lt_prog_compiler_pic_GCJ='-KPIC' + lt_prog_compiler_static_GCJ='-static' + ;; + pgcc* | pgf77* | pgf90* | pgf95*) + # Portland Group compilers (*not* the Pentium gcc compiler, + # which looks to be a dead project) + lt_prog_compiler_wl_GCJ='-Wl,' + lt_prog_compiler_pic_GCJ='-fpic' + lt_prog_compiler_static_GCJ='-Bstatic' + ;; + ccc*) + lt_prog_compiler_wl_GCJ='-Wl,' + # All Alpha code is PIC. + lt_prog_compiler_static_GCJ='-non_shared' + ;; + *) + case `$CC -V 2>&1 | sed 5q` in + *Sun\ C*) + # Sun C 5.9 + lt_prog_compiler_pic_GCJ='-KPIC' + lt_prog_compiler_static_GCJ='-Bstatic' + lt_prog_compiler_wl_GCJ='-Wl,' + ;; + *Sun\ F*) + # Sun Fortran 8.3 passes all unrecognized flags to the linker + lt_prog_compiler_pic_GCJ='-KPIC' + lt_prog_compiler_static_GCJ='-Bstatic' + lt_prog_compiler_wl_GCJ='' + ;; + esac + ;; + esac + ;; + + osf3* | osf4* | osf5*) + lt_prog_compiler_wl_GCJ='-Wl,' + # All OSF/1 code is PIC. + lt_prog_compiler_static_GCJ='-non_shared' + ;; + + rdos*) + lt_prog_compiler_static_GCJ='-non_shared' + ;; + + solaris*) + lt_prog_compiler_pic_GCJ='-KPIC' + lt_prog_compiler_static_GCJ='-Bstatic' + case $cc_basename in + f77* | f90* | f95*) + lt_prog_compiler_wl_GCJ='-Qoption ld ';; + *) + lt_prog_compiler_wl_GCJ='-Wl,';; + esac + ;; + + sunos4*) + lt_prog_compiler_wl_GCJ='-Qoption ld ' + lt_prog_compiler_pic_GCJ='-PIC' + lt_prog_compiler_static_GCJ='-Bstatic' + ;; + + sysv4 | sysv4.2uw2* | sysv4.3*) + lt_prog_compiler_wl_GCJ='-Wl,' + lt_prog_compiler_pic_GCJ='-KPIC' + lt_prog_compiler_static_GCJ='-Bstatic' + ;; + + sysv4*MP*) + if test -d /usr/nec ;then + lt_prog_compiler_pic_GCJ='-Kconform_pic' + lt_prog_compiler_static_GCJ='-Bstatic' + fi + ;; + + sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) + lt_prog_compiler_wl_GCJ='-Wl,' + lt_prog_compiler_pic_GCJ='-KPIC' + lt_prog_compiler_static_GCJ='-Bstatic' + ;; + + unicos*) + lt_prog_compiler_wl_GCJ='-Wl,' + lt_prog_compiler_can_build_shared_GCJ=no + ;; + + uts4*) + lt_prog_compiler_pic_GCJ='-pic' + lt_prog_compiler_static_GCJ='-Bstatic' + ;; + + *) + lt_prog_compiler_can_build_shared_GCJ=no + ;; + esac + fi + +{ echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_GCJ" >&5 +echo "${ECHO_T}$lt_prog_compiler_pic_GCJ" >&6; } + +# +# Check to make sure the PIC flag actually works. +# +if test -n "$lt_prog_compiler_pic_GCJ"; then + +{ echo "$as_me:$LINENO: checking if $compiler PIC flag $lt_prog_compiler_pic_GCJ works" >&5 +echo $ECHO_N "checking if $compiler PIC flag $lt_prog_compiler_pic_GCJ works... $ECHO_C" >&6; } +if test "${lt_prog_compiler_pic_works_GCJ+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + lt_prog_compiler_pic_works_GCJ=no + ac_outfile=conftest.$ac_objext + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + lt_compiler_flag="$lt_prog_compiler_pic_GCJ" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + # The option is referenced via a variable to avoid confusing sed. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ + -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:16693: $lt_compile\"" >&5) + (eval "$lt_compile" 2>conftest.err) + ac_status=$? + cat conftest.err >&5 + echo "$as_me:16697: \$? = $ac_status" >&5 + if (exit $ac_status) && test -s "$ac_outfile"; then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings other than the usual output. + $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp + $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 + if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then + lt_prog_compiler_pic_works_GCJ=yes + fi + fi + $rm conftest* + +fi +{ echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_works_GCJ" >&5 +echo "${ECHO_T}$lt_prog_compiler_pic_works_GCJ" >&6; } + +if test x"$lt_prog_compiler_pic_works_GCJ" = xyes; then + case $lt_prog_compiler_pic_GCJ in + "" | " "*) ;; + *) lt_prog_compiler_pic_GCJ=" $lt_prog_compiler_pic_GCJ" ;; + esac +else + lt_prog_compiler_pic_GCJ= + lt_prog_compiler_can_build_shared_GCJ=no +fi + +fi +case $host_os in + # For platforms which do not support PIC, -DPIC is meaningless: + *djgpp*) + lt_prog_compiler_pic_GCJ= + ;; + *) + lt_prog_compiler_pic_GCJ="$lt_prog_compiler_pic_GCJ" + ;; +esac + +# +# Check to make sure the static flag actually works. +# +wl=$lt_prog_compiler_wl_GCJ eval lt_tmp_static_flag=\"$lt_prog_compiler_static_GCJ\" +{ echo "$as_me:$LINENO: checking if $compiler static flag $lt_tmp_static_flag works" >&5 +echo $ECHO_N "checking if $compiler static flag $lt_tmp_static_flag works... $ECHO_C" >&6; } +if test "${lt_prog_compiler_static_works_GCJ+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + lt_prog_compiler_static_works_GCJ=no + save_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS $lt_tmp_static_flag" + echo "$lt_simple_link_test_code" > conftest.$ac_ext + if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then + # The linker can only warn and ignore the option if not recognized + # So say no if there are warnings + if test -s conftest.err; then + # Append any errors to the config.log. + cat conftest.err 1>&5 + $echo "X$_lt_linker_boilerplate" | $Xsed -e '/^$/d' > conftest.exp + $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 + if diff conftest.exp conftest.er2 >/dev/null; then + lt_prog_compiler_static_works_GCJ=yes + fi + else + lt_prog_compiler_static_works_GCJ=yes + fi + fi + $rm conftest* + LDFLAGS="$save_LDFLAGS" + +fi +{ echo "$as_me:$LINENO: result: $lt_prog_compiler_static_works_GCJ" >&5 +echo "${ECHO_T}$lt_prog_compiler_static_works_GCJ" >&6; } + +if test x"$lt_prog_compiler_static_works_GCJ" = xyes; then + : +else + lt_prog_compiler_static_GCJ= +fi + + +{ echo "$as_me:$LINENO: checking if $compiler supports -c -o file.$ac_objext" >&5 +echo $ECHO_N "checking if $compiler supports -c -o file.$ac_objext... $ECHO_C" >&6; } +if test "${lt_cv_prog_compiler_c_o_GCJ+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + lt_cv_prog_compiler_c_o_GCJ=no + $rm -r conftest 2>/dev/null + mkdir conftest + cd conftest + mkdir out + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + + lt_compiler_flag="-o out/conftest2.$ac_objext" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ + -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:16797: $lt_compile\"" >&5) + (eval "$lt_compile" 2>out/conftest.err) + ac_status=$? + cat out/conftest.err >&5 + echo "$as_me:16801: \$? = $ac_status" >&5 + if (exit $ac_status) && test -s out/conftest2.$ac_objext + then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' > out/conftest.exp + $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 + if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then + lt_cv_prog_compiler_c_o_GCJ=yes + fi + fi + chmod u+w . 2>&5 + $rm conftest* + # SGI C++ compiler will create directory out/ii_files/ for + # template instantiation + test -d out/ii_files && $rm out/ii_files/* && rmdir out/ii_files + $rm out/* && rmdir out + cd .. + rmdir conftest + $rm conftest* + +fi +{ echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_c_o_GCJ" >&5 +echo "${ECHO_T}$lt_cv_prog_compiler_c_o_GCJ" >&6; } + + +hard_links="nottested" +if test "$lt_cv_prog_compiler_c_o_GCJ" = no && test "$need_locks" != no; then + # do not overwrite the value of need_locks provided by the user + { echo "$as_me:$LINENO: checking if we can lock with hard links" >&5 +echo $ECHO_N "checking if we can lock with hard links... $ECHO_C" >&6; } + hard_links=yes + $rm conftest* + ln conftest.a conftest.b 2>/dev/null && hard_links=no + touch conftest.a + ln conftest.a conftest.b 2>&5 || hard_links=no + ln conftest.a conftest.b 2>/dev/null && hard_links=no + { echo "$as_me:$LINENO: result: $hard_links" >&5 +echo "${ECHO_T}$hard_links" >&6; } + if test "$hard_links" = no; then + { echo "$as_me:$LINENO: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5 +echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;} + need_locks=warn + fi +else + need_locks=no +fi + +{ echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5 +echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared libraries... $ECHO_C" >&6; } + + runpath_var= + allow_undefined_flag_GCJ= + enable_shared_with_static_runtimes_GCJ=no + archive_cmds_GCJ= + archive_expsym_cmds_GCJ= + old_archive_From_new_cmds_GCJ= + old_archive_from_expsyms_cmds_GCJ= + export_dynamic_flag_spec_GCJ= + whole_archive_flag_spec_GCJ= + thread_safe_flag_spec_GCJ= + hardcode_libdir_flag_spec_GCJ= + hardcode_libdir_flag_spec_ld_GCJ= + hardcode_libdir_separator_GCJ= + hardcode_direct_GCJ=no + hardcode_minus_L_GCJ=no + hardcode_shlibpath_var_GCJ=unsupported + link_all_deplibs_GCJ=unknown + hardcode_automatic_GCJ=no + module_cmds_GCJ= + module_expsym_cmds_GCJ= + always_export_symbols_GCJ=no + export_symbols_cmds_GCJ='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' + # include_expsyms should be a list of space-separated symbols to be *always* + # included in the symbol list + include_expsyms_GCJ= + # exclude_expsyms can be an extended regexp of symbols to exclude + # it will be wrapped by ` (' and `)$', so one must not match beginning or + # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', + # as well as any symbol that contains `d'. + exclude_expsyms_GCJ="_GLOBAL_OFFSET_TABLE_" + # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out + # platforms (ab)use it in PIC code, but their linkers get confused if + # the symbol is explicitly referenced. Since portable code cannot + # rely on this symbol name, it's probably fine to never include it in + # preloaded symbol tables. + extract_expsyms_cmds= + # Just being paranoid about ensuring that cc_basename is set. + for cc_temp in $compiler""; do + case $cc_temp in + compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; + distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; + \-*) ;; + *) break;; + esac +done +cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` + + case $host_os in + cygwin* | mingw* | pw32*) + # FIXME: the MSVC++ port hasn't been tested in a loooong time + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + if test "$GCC" != yes; then + with_gnu_ld=no + fi + ;; + interix*) + # we just hope/assume this is gcc and not c89 (= MSVC++) + with_gnu_ld=yes + ;; + openbsd*) + with_gnu_ld=no + ;; + esac + + ld_shlibs_GCJ=yes + if test "$with_gnu_ld" = yes; then + # If archive_cmds runs LD, not CC, wlarc should be empty + wlarc='${wl}' + + # Set some defaults for GNU ld with shared library support. These + # are reset later if shared libraries are not supported. Putting them + # here allows them to be overridden if necessary. + runpath_var=LD_RUN_PATH + hardcode_libdir_flag_spec_GCJ='${wl}--rpath ${wl}$libdir' + export_dynamic_flag_spec_GCJ='${wl}--export-dynamic' + # ancient GNU ld didn't support --whole-archive et. al. + if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then + whole_archive_flag_spec_GCJ="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + else + whole_archive_flag_spec_GCJ= + fi + supports_anon_versioning=no + case `$LD -v 2>/dev/null` in + *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 + *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... + *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... + *\ 2.11.*) ;; # other 2.11 versions + *) supports_anon_versioning=yes ;; + esac + + # See if GNU ld supports shared libraries. + case $host_os in + aix3* | aix4* | aix5*) + # On AIX/PPC, the GNU linker is very broken + if test "$host_cpu" != ia64; then + ld_shlibs_GCJ=no + cat <&2 + +*** Warning: the GNU linker, at least up to release 2.9.1, is reported +*** to be unable to reliably create shared libraries on AIX. +*** Therefore, libtool is disabling shared libraries support. If you +*** really care for shared libraries, you may want to modify your PATH +*** so that a non-GNU linker is found, and then restart. + +EOF + fi + ;; + + amigaos*) + archive_cmds_GCJ='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + hardcode_libdir_flag_spec_GCJ='-L$libdir' + hardcode_minus_L_GCJ=yes + + # Samuel A. Falvo II reports + # that the semantics of dynamic libraries on AmigaOS, at least up + # to version 4, is to share data among multiple programs linked + # with the same dynamic library. Since this doesn't match the + # behavior of shared libraries on other platforms, we can't use + # them. + ld_shlibs_GCJ=no + ;; + + beos*) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + allow_undefined_flag_GCJ=unsupported + # Joseph Beckenbach says some releases of gcc + # support --undefined. This deserves some investigation. FIXME + archive_cmds_GCJ='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + else + ld_shlibs_GCJ=no + fi + ;; + + cygwin* | mingw* | pw32*) + # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, GCJ) is actually meaningless, + # as there is no search path for DLLs. + hardcode_libdir_flag_spec_GCJ='-L$libdir' + allow_undefined_flag_GCJ=unsupported + always_export_symbols_GCJ=no + enable_shared_with_static_runtimes_GCJ=yes + export_symbols_cmds_GCJ='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/'\'' -e '\''/^[AITW][ ]/s/.*[ ]//'\'' | sort | uniq > $export_symbols' + + if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then + archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' + # If the export-symbols file already is a .def file (1st line + # is EXPORTS), use it as is; otherwise, prepend... + archive_expsym_cmds_GCJ='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then + cp $export_symbols $output_objdir/$soname.def; + else + echo EXPORTS > $output_objdir/$soname.def; + cat $export_symbols >> $output_objdir/$soname.def; + fi~ + $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' + else + ld_shlibs_GCJ=no + fi + ;; + + interix[3-9]*) + hardcode_direct_GCJ=no + hardcode_shlibpath_var_GCJ=no + hardcode_libdir_flag_spec_GCJ='${wl}-rpath,$libdir' + export_dynamic_flag_spec_GCJ='${wl}-E' + # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. + # Instead, shared libraries are loaded at an image base (0x10000000 by + # default) and relocated if they conflict, which is a slow very memory + # consuming and fragmenting process. To avoid this, we pick a random, + # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link + # time. Moving up from 0x10000000 also allows more sbrk(2) space. + archive_cmds_GCJ='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' + archive_expsym_cmds_GCJ='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' + ;; + + gnu* | linux* | k*bsd*-gnu) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + tmp_addflag= + case $cc_basename,$host_cpu in + pgcc*) # Portland Group C compiler + whole_archive_flag_spec_GCJ='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' + tmp_addflag=' $pic_flag' + ;; + pgf77* | pgf90* | pgf95*) # Portland Group f77 and f90 compilers + whole_archive_flag_spec_GCJ='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' + tmp_addflag=' $pic_flag -Mnomain' ;; + ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 + tmp_addflag=' -i_dynamic' ;; + efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 + tmp_addflag=' -i_dynamic -nofor_main' ;; + ifc* | ifort*) # Intel Fortran compiler + tmp_addflag=' -nofor_main' ;; + esac + case `$CC -V 2>&1 | sed 5q` in + *Sun\ C*) # Sun C 5.9 + whole_archive_flag_spec_GCJ='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' + tmp_sharedflag='-G' ;; + *Sun\ F*) # Sun Fortran 8.3 + tmp_sharedflag='-G' ;; + *) + tmp_sharedflag='-shared' ;; + esac + archive_cmds_GCJ='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + + if test $supports_anon_versioning = yes; then + archive_expsym_cmds_GCJ='$echo "{ global:" > $output_objdir/$libname.ver~ + cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ + $echo "local: *; };" >> $output_objdir/$libname.ver~ + $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' + fi + link_all_deplibs_GCJ=no + else + ld_shlibs_GCJ=no + fi + ;; + + netbsd* | netbsdelf*-gnu) + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + archive_cmds_GCJ='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' + wlarc= + else + archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + fi + ;; + + solaris*) + if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then + ld_shlibs_GCJ=no + cat <&2 + +*** Warning: The releases 2.8.* of the GNU linker cannot reliably +*** create shared libraries on Solaris systems. Therefore, libtool +*** is disabling shared libraries support. We urge you to upgrade GNU +*** binutils to release 2.9.1 or newer. Another option is to modify +*** your PATH or compiler configuration so that the native linker is +*** used, and then restart. + +EOF + elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + ld_shlibs_GCJ=no + fi + ;; + + sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*) + case `$LD -v 2>&1` in + *\ [01].* | *\ 2.[0-9].* | *\ 2.1[0-5].*) + ld_shlibs_GCJ=no + cat <<_LT_EOF 1>&2 + +*** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not +*** reliably create shared libraries on SCO systems. Therefore, libtool +*** is disabling shared libraries support. We urge you to upgrade GNU +*** binutils to release 2.16.91.0.3 or newer. Another option is to modify +*** your PATH or compiler configuration so that the native linker is +*** used, and then restart. + +_LT_EOF + ;; + *) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + hardcode_libdir_flag_spec_GCJ='`test -z "$SCOABSPATH" && echo ${wl}-rpath,$libdir`' + archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib' + archive_expsym_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname,\${SCOABSPATH:+${install_libdir}/}$soname,-retain-symbols-file,$export_symbols -o $lib' + else + ld_shlibs_GCJ=no + fi + ;; + esac + ;; + + sunos4*) + archive_cmds_GCJ='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' + wlarc= + hardcode_direct_GCJ=yes + hardcode_shlibpath_var_GCJ=no + ;; + + *) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + ld_shlibs_GCJ=no + fi + ;; + esac + + if test "$ld_shlibs_GCJ" = no; then + runpath_var= + hardcode_libdir_flag_spec_GCJ= + export_dynamic_flag_spec_GCJ= + whole_archive_flag_spec_GCJ= + fi + else + # PORTME fill in a description of your system's linker (not GNU ld) + case $host_os in + aix3*) + allow_undefined_flag_GCJ=unsupported + always_export_symbols_GCJ=yes + archive_expsym_cmds_GCJ='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' + # Note: this linker hardcodes the directories in LIBPATH if there + # are no directories specified by -L. + hardcode_minus_L_GCJ=yes + if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then + # Neither direct hardcoding nor static linking is supported with a + # broken collect2. + hardcode_direct_GCJ=unsupported + fi + ;; + + aix4* | aix5*) + if test "$host_cpu" = ia64; then + # On IA64, the linker does run time linking by default, so we don't + # have to do anything special. + aix_use_runtimelinking=no + exp_sym_flag='-Bexport' + no_entry_flag="" + else + # If we're using GNU nm, then we don't want the "-C" option. + # -C means demangle to AIX nm, but means don't demangle with GNU nm + if $NM -V 2>&1 | grep 'GNU' > /dev/null; then + export_symbols_cmds_GCJ='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' + else + export_symbols_cmds_GCJ='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' + fi + aix_use_runtimelinking=no + + # Test if we are trying to use run time linking or normal + # AIX style linking. If -brtl is somewhere in LDFLAGS, we + # need to do runtime linking. + case $host_os in aix4.[23]|aix4.[23].*|aix5*) + for ld_flag in $LDFLAGS; do + if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then + aix_use_runtimelinking=yes + break + fi + done + ;; + esac + + exp_sym_flag='-bexport' + no_entry_flag='-bnoentry' + fi + + # When large executables or shared objects are built, AIX ld can + # have problems creating the table of contents. If linking a library + # or program results in "error TOC overflow" add -mminimal-toc to + # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not + # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. + + archive_cmds_GCJ='' + hardcode_direct_GCJ=yes + hardcode_libdir_separator_GCJ=':' + link_all_deplibs_GCJ=yes + + if test "$GCC" = yes; then + case $host_os in aix4.[012]|aix4.[012].*) + # We only want to do this on AIX 4.2 and lower, the check + # below for broken collect2 doesn't work under 4.3+ + collect2name=`${CC} -print-prog-name=collect2` + if test -f "$collect2name" && \ + strings "$collect2name" | grep resolve_lib_name >/dev/null + then + # We have reworked collect2 + : + else + # We have old collect2 + hardcode_direct_GCJ=unsupported + # It fails to find uninstalled libraries when the uninstalled + # path is not listed in the libpath. Setting hardcode_minus_L + # to unsupported forces relinking + hardcode_minus_L_GCJ=yes + hardcode_libdir_flag_spec_GCJ='-L$libdir' + hardcode_libdir_separator_GCJ= + fi + ;; + esac + shared_flag='-shared' + if test "$aix_use_runtimelinking" = yes; then + shared_flag="$shared_flag "'${wl}-G' + fi + else + # not using gcc + if test "$host_cpu" = ia64; then + # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release + # chokes on -Wl,-G. The following line is correct: + shared_flag='-G' + else + if test "$aix_use_runtimelinking" = yes; then + shared_flag='${wl}-G' + else + shared_flag='${wl}-bM:SRE' + fi + fi + fi + + # It seems that -bexpall does not export symbols beginning with + # underscore (_), so it is better to generate a list of symbols to export. + always_export_symbols_GCJ=yes + if test "$aix_use_runtimelinking" = yes; then + # Warning - without using the other runtime loading flags (-brtl), + # -berok will link without error, but may produce a broken library. + allow_undefined_flag_GCJ='-berok' + # Determine the default libpath from the value encoded in an empty executable. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then + +lt_aix_libpath_sed=' + /Import File Strings/,/^$/ { + /^0/ { + s/^0 *\(.*\)$/\1/ + p + } + }' +aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` +# Check for a 64-bit object if we didn't find anything. +if test -z "$aix_libpath"; then + aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` +fi +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + +fi + +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext +if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi + + hardcode_libdir_flag_spec_GCJ='${wl}-blibpath:$libdir:'"$aix_libpath" + archive_expsym_cmds_GCJ="\$CC"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" + else + if test "$host_cpu" = ia64; then + hardcode_libdir_flag_spec_GCJ='${wl}-R $libdir:/usr/lib:/lib' + allow_undefined_flag_GCJ="-z nodefs" + archive_expsym_cmds_GCJ="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" + else + # Determine the default libpath from the value encoded in an empty executable. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then + +lt_aix_libpath_sed=' + /Import File Strings/,/^$/ { + /^0/ { + s/^0 *\(.*\)$/\1/ + p + } + }' +aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` +# Check for a 64-bit object if we didn't find anything. +if test -z "$aix_libpath"; then + aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` +fi +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + +fi + +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext +if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi + + hardcode_libdir_flag_spec_GCJ='${wl}-blibpath:$libdir:'"$aix_libpath" + # Warning - without using the other run time loading flags, + # -berok will link without error, but may produce a broken library. + no_undefined_flag_GCJ=' ${wl}-bernotok' + allow_undefined_flag_GCJ=' ${wl}-berok' + # Exported symbols can be pulled into shared objects from archives + whole_archive_flag_spec_GCJ='$convenience' + archive_cmds_need_lc_GCJ=yes + # This is similar to how AIX traditionally builds its shared libraries. + archive_expsym_cmds_GCJ="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' + fi + fi + ;; + + amigaos*) + archive_cmds_GCJ='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + hardcode_libdir_flag_spec_GCJ='-L$libdir' + hardcode_minus_L_GCJ=yes + # see comment about different semantics on the GNU ld section + ld_shlibs_GCJ=no + ;; + + bsdi[45]*) + export_dynamic_flag_spec_GCJ=-rdynamic + ;; + + cygwin* | mingw* | pw32*) + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + # hardcode_libdir_flag_spec is actually meaningless, as there is + # no search path for DLLs. + hardcode_libdir_flag_spec_GCJ=' ' + allow_undefined_flag_GCJ=unsupported + # Tell ltmain to make .lib files, not .a files. + libext=lib + # Tell ltmain to make .dll files, not .so files. + shrext_cmds=".dll" + # FIXME: Setting linknames here is a bad hack. + archive_cmds_GCJ='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | $SED -e '\''s/ -lc$//'\''` -link -dll~linknames=' + # The linker will automatically build a .lib file if we build a DLL. + old_archive_From_new_cmds_GCJ='true' + # FIXME: Should let the user specify the lib program. + old_archive_cmds_GCJ='lib -OUT:$oldlib$oldobjs$old_deplibs' + fix_srcfile_path_GCJ='`cygpath -w "$srcfile"`' + enable_shared_with_static_runtimes_GCJ=yes + ;; + + darwin* | rhapsody*) + case $host_os in + rhapsody* | darwin1.[012]) + allow_undefined_flag_GCJ='${wl}-undefined ${wl}suppress' + ;; + *) # Darwin 1.3 on + if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then + allow_undefined_flag_GCJ='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' + else + case ${MACOSX_DEPLOYMENT_TARGET} in + 10.[012]) + allow_undefined_flag_GCJ='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' + ;; + 10.*) + allow_undefined_flag_GCJ='${wl}-undefined ${wl}dynamic_lookup' + ;; + esac + fi + ;; + esac + archive_cmds_need_lc_GCJ=no + hardcode_direct_GCJ=no + hardcode_automatic_GCJ=yes + hardcode_shlibpath_var_GCJ=unsupported + whole_archive_flag_spec_GCJ='' + link_all_deplibs_GCJ=yes + if test "$GCC" = yes ; then + output_verbose_link_cmd='echo' + archive_cmds_GCJ='$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring' + module_cmds_GCJ='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' + # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds + archive_expsym_cmds_GCJ='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + module_expsym_cmds_GCJ='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + else + case $cc_basename in + xlc*) + output_verbose_link_cmd='echo' + archive_cmds_GCJ='$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $xlcverstring' + module_cmds_GCJ='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' + # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds + archive_expsym_cmds_GCJ='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $xlcverstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + module_expsym_cmds_GCJ='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + ;; + *) + ld_shlibs_GCJ=no + ;; + esac + fi + ;; + + dgux*) + archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec_GCJ='-L$libdir' + hardcode_shlibpath_var_GCJ=no + ;; + + freebsd1*) + ld_shlibs_GCJ=no + ;; + + # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor + # support. Future versions do this automatically, but an explicit c++rt0.o + # does not break anything, and helps significantly (at the cost of a little + # extra space). + freebsd2.2*) + archive_cmds_GCJ='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' + hardcode_libdir_flag_spec_GCJ='-R$libdir' + hardcode_direct_GCJ=yes + hardcode_shlibpath_var_GCJ=no + ;; + + # Unfortunately, older versions of FreeBSD 2 do not have this feature. + freebsd2*) + archive_cmds_GCJ='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct_GCJ=yes + hardcode_minus_L_GCJ=yes + hardcode_shlibpath_var_GCJ=no + ;; + + # FreeBSD 3 and greater uses gcc -shared to do shared libraries. + freebsd* | dragonfly*) + archive_cmds_GCJ='$CC -shared -o $lib $libobjs $deplibs $compiler_flags' + hardcode_libdir_flag_spec_GCJ='-R$libdir' + hardcode_direct_GCJ=yes + hardcode_shlibpath_var_GCJ=no + ;; + + hpux9*) + if test "$GCC" = yes; then + archive_cmds_GCJ='$rm $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + else + archive_cmds_GCJ='$rm $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + fi + hardcode_libdir_flag_spec_GCJ='${wl}+b ${wl}$libdir' + hardcode_libdir_separator_GCJ=: + hardcode_direct_GCJ=yes + + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + hardcode_minus_L_GCJ=yes + export_dynamic_flag_spec_GCJ='${wl}-E' + ;; + + hpux10*) + if test "$GCC" = yes -a "$with_gnu_ld" = no; then + archive_cmds_GCJ='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' + else + archive_cmds_GCJ='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' + fi + if test "$with_gnu_ld" = no; then + hardcode_libdir_flag_spec_GCJ='${wl}+b ${wl}$libdir' + hardcode_libdir_separator_GCJ=: + + hardcode_direct_GCJ=yes + export_dynamic_flag_spec_GCJ='${wl}-E' + + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + hardcode_minus_L_GCJ=yes + fi + ;; + + hpux11*) + if test "$GCC" = yes -a "$with_gnu_ld" = no; then + case $host_cpu in + hppa*64*) + archive_cmds_GCJ='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + ia64*) + archive_cmds_GCJ='$CC -shared ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' + ;; + *) + archive_cmds_GCJ='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' + ;; + esac + else + case $host_cpu in + hppa*64*) + archive_cmds_GCJ='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + ia64*) + archive_cmds_GCJ='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' + ;; + *) + archive_cmds_GCJ='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' + ;; + esac + fi + if test "$with_gnu_ld" = no; then + hardcode_libdir_flag_spec_GCJ='${wl}+b ${wl}$libdir' + hardcode_libdir_separator_GCJ=: + + case $host_cpu in + hppa*64*|ia64*) + hardcode_libdir_flag_spec_ld_GCJ='+b $libdir' + hardcode_direct_GCJ=no + hardcode_shlibpath_var_GCJ=no + ;; + *) + hardcode_direct_GCJ=yes + export_dynamic_flag_spec_GCJ='${wl}-E' + + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + hardcode_minus_L_GCJ=yes + ;; + esac + fi + ;; + + irix5* | irix6* | nonstopux*) + if test "$GCC" = yes; then + archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + else + archive_cmds_GCJ='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + hardcode_libdir_flag_spec_ld_GCJ='-rpath $libdir' + fi + hardcode_libdir_flag_spec_GCJ='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator_GCJ=: + link_all_deplibs_GCJ=yes + ;; + + netbsd* | netbsdelf*-gnu) + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + archive_cmds_GCJ='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out + else + archive_cmds_GCJ='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF + fi + hardcode_libdir_flag_spec_GCJ='-R$libdir' + hardcode_direct_GCJ=yes + hardcode_shlibpath_var_GCJ=no + ;; + + newsos6) + archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct_GCJ=yes + hardcode_libdir_flag_spec_GCJ='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator_GCJ=: + hardcode_shlibpath_var_GCJ=no + ;; + + openbsd*) + if test -f /usr/libexec/ld.so; then + hardcode_direct_GCJ=yes + hardcode_shlibpath_var_GCJ=no + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + archive_cmds_GCJ='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds_GCJ='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols' + hardcode_libdir_flag_spec_GCJ='${wl}-rpath,$libdir' + export_dynamic_flag_spec_GCJ='${wl}-E' + else + case $host_os in + openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*) + archive_cmds_GCJ='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec_GCJ='-R$libdir' + ;; + *) + archive_cmds_GCJ='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + hardcode_libdir_flag_spec_GCJ='${wl}-rpath,$libdir' + ;; + esac + fi + else + ld_shlibs_GCJ=no + fi + ;; + + os2*) + hardcode_libdir_flag_spec_GCJ='-L$libdir' + hardcode_minus_L_GCJ=yes + allow_undefined_flag_GCJ=unsupported + archive_cmds_GCJ='$echo "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$echo DATA >> $output_objdir/$libname.def~$echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~$echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' + old_archive_From_new_cmds_GCJ='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' + ;; + + osf3*) + if test "$GCC" = yes; then + allow_undefined_flag_GCJ=' ${wl}-expect_unresolved ${wl}\*' + archive_cmds_GCJ='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + else + allow_undefined_flag_GCJ=' -expect_unresolved \*' + archive_cmds_GCJ='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + fi + hardcode_libdir_flag_spec_GCJ='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator_GCJ=: + ;; + + osf4* | osf5*) # as osf3* with the addition of -msym flag + if test "$GCC" = yes; then + allow_undefined_flag_GCJ=' ${wl}-expect_unresolved ${wl}\*' + archive_cmds_GCJ='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + hardcode_libdir_flag_spec_GCJ='${wl}-rpath ${wl}$libdir' + else + allow_undefined_flag_GCJ=' -expect_unresolved \*' + archive_cmds_GCJ='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + archive_expsym_cmds_GCJ='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~ + $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib~$rm $lib.exp' + + # Both c and cxx compiler support -rpath directly + hardcode_libdir_flag_spec_GCJ='-rpath $libdir' + fi + hardcode_libdir_separator_GCJ=: + ;; + + solaris*) + no_undefined_flag_GCJ=' -z text' + if test "$GCC" = yes; then + wlarc='${wl}' + archive_cmds_GCJ='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds_GCJ='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $CC -shared ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$rm $lib.exp' + else + wlarc='' + archive_cmds_GCJ='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' + archive_expsym_cmds_GCJ='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' + fi + hardcode_libdir_flag_spec_GCJ='-R$libdir' + hardcode_shlibpath_var_GCJ=no + case $host_os in + solaris2.[0-5] | solaris2.[0-5].*) ;; + *) + # The compiler driver will combine and reorder linker options, + # but understands `-z linker_flag'. GCC discards it without `$wl', + # but is careful enough not to reorder. + # Supported since Solaris 2.6 (maybe 2.5.1?) + if test "$GCC" = yes; then + whole_archive_flag_spec_GCJ='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' + else + whole_archive_flag_spec_GCJ='-z allextract$convenience -z defaultextract' + fi + ;; + esac + link_all_deplibs_GCJ=yes + ;; + + sunos4*) + if test "x$host_vendor" = xsequent; then + # Use $CC to link under sequent, because it throws in some extra .o + # files that make .init and .fini sections work. + archive_cmds_GCJ='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' + else + archive_cmds_GCJ='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' + fi + hardcode_libdir_flag_spec_GCJ='-L$libdir' + hardcode_direct_GCJ=yes + hardcode_minus_L_GCJ=yes + hardcode_shlibpath_var_GCJ=no + ;; + + sysv4) + case $host_vendor in + sni) + archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct_GCJ=yes # is this really true??? + ;; + siemens) + ## LD is ld it makes a PLAMLIB + ## CC just makes a GrossModule. + archive_cmds_GCJ='$LD -G -o $lib $libobjs $deplibs $linker_flags' + reload_cmds_GCJ='$CC -r -o $output$reload_objs' + hardcode_direct_GCJ=no + ;; + motorola) + archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct_GCJ=no #Motorola manual says yes, but my tests say they lie + ;; + esac + runpath_var='LD_RUN_PATH' + hardcode_shlibpath_var_GCJ=no + ;; + + sysv4.3*) + archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_shlibpath_var_GCJ=no + export_dynamic_flag_spec_GCJ='-Bexport' + ;; + + sysv4*MP*) + if test -d /usr/nec; then + archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_shlibpath_var_GCJ=no + runpath_var=LD_RUN_PATH + hardcode_runpath_var=yes + ld_shlibs_GCJ=yes + fi + ;; + + sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*) + no_undefined_flag_GCJ='${wl}-z,text' + archive_cmds_need_lc_GCJ=no + hardcode_shlibpath_var_GCJ=no + runpath_var='LD_RUN_PATH' + + if test "$GCC" = yes; then + archive_cmds_GCJ='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds_GCJ='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + else + archive_cmds_GCJ='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds_GCJ='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + fi + ;; + + sysv5* | sco3.2v5* | sco5v6*) + # Note: We can NOT use -z defs as we might desire, because we do not + # link with -lc, and that would cause any symbols used from libc to + # always be unresolved, which means just about no library would + # ever link correctly. If we're not using GNU ld we use -z text + # though, which does catch some bad symbols but isn't as heavy-handed + # as -z defs. + no_undefined_flag_GCJ='${wl}-z,text' + allow_undefined_flag_GCJ='${wl}-z,nodefs' + archive_cmds_need_lc_GCJ=no + hardcode_shlibpath_var_GCJ=no + hardcode_libdir_flag_spec_GCJ='`test -z "$SCOABSPATH" && echo ${wl}-R,$libdir`' + hardcode_libdir_separator_GCJ=':' + link_all_deplibs_GCJ=yes + export_dynamic_flag_spec_GCJ='${wl}-Bexport' + runpath_var='LD_RUN_PATH' + + if test "$GCC" = yes; then + archive_cmds_GCJ='$CC -shared ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds_GCJ='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' + else + archive_cmds_GCJ='$CC -G ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds_GCJ='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' + fi + ;; + + uts4*) + archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec_GCJ='-L$libdir' + hardcode_shlibpath_var_GCJ=no + ;; + + *) + ld_shlibs_GCJ=no + ;; + esac + fi + +{ echo "$as_me:$LINENO: result: $ld_shlibs_GCJ" >&5 +echo "${ECHO_T}$ld_shlibs_GCJ" >&6; } +test "$ld_shlibs_GCJ" = no && can_build_shared=no + +# +# Do we need to explicitly link libc? +# +case "x$archive_cmds_need_lc_GCJ" in +x|xyes) + # Assume -lc should be added + archive_cmds_need_lc_GCJ=yes + + if test "$enable_shared" = yes && test "$GCC" = yes; then + case $archive_cmds_GCJ in + *'~'*) + # FIXME: we may have to deal with multi-command sequences. + ;; + '$CC '*) + # Test whether the compiler implicitly links with -lc since on some + # systems, -lgcc has to come before -lc. If gcc already passes -lc + # to ld, don't add -lc before -lgcc. + { echo "$as_me:$LINENO: checking whether -lc should be explicitly linked in" >&5 +echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >&6; } + $rm conftest* + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + + if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } 2>conftest.err; then + soname=conftest + lib=conftest + libobjs=conftest.$ac_objext + deplibs= + wl=$lt_prog_compiler_wl_GCJ + pic_flag=$lt_prog_compiler_pic_GCJ + compiler_flags=-v + linker_flags=-v + verstring= + output_objdir=. + libname=conftest + lt_save_allow_undefined_flag=$allow_undefined_flag_GCJ + allow_undefined_flag_GCJ= + if { (eval echo "$as_me:$LINENO: \"$archive_cmds_GCJ 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1\"") >&5 + (eval $archive_cmds_GCJ 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } + then + archive_cmds_need_lc_GCJ=no + else + archive_cmds_need_lc_GCJ=yes + fi + allow_undefined_flag_GCJ=$lt_save_allow_undefined_flag + else + cat conftest.err 1>&5 + fi + $rm conftest* + { echo "$as_me:$LINENO: result: $archive_cmds_need_lc_GCJ" >&5 +echo "${ECHO_T}$archive_cmds_need_lc_GCJ" >&6; } + ;; + esac + fi + ;; +esac + +{ echo "$as_me:$LINENO: checking dynamic linker characteristics" >&5 +echo $ECHO_N "checking dynamic linker characteristics... $ECHO_C" >&6; } +library_names_spec= +libname_spec='lib$name' +soname_spec= +shrext_cmds=".so" +postinstall_cmds= +postuninstall_cmds= +finish_cmds= +finish_eval= +shlibpath_var= +shlibpath_overrides_runpath=unknown +version_type=none +dynamic_linker="$host_os ld.so" +sys_lib_dlsearch_path_spec="/lib /usr/lib" + +need_lib_prefix=unknown +hardcode_into_libs=no + +# when you set need_version to no, make sure it does not cause -set_version +# flags to be left without arguments +need_version=unknown + +case $host_os in +aix3*) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' + shlibpath_var=LIBPATH + + # AIX 3 has no versioning support, so we append a major version to the name. + soname_spec='${libname}${release}${shared_ext}$major' + ;; + +aix4* | aix5*) + version_type=linux + need_lib_prefix=no + need_version=no + hardcode_into_libs=yes + if test "$host_cpu" = ia64; then + # AIX 5 supports IA64 + library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + else + # With GCC up to 2.95.x, collect2 would create an import file + # for dependence libraries. The import file would start with + # the line `#! .'. This would cause the generated library to + # depend on `.', always an invalid library. This was fixed in + # development snapshots of GCC prior to 3.0. + case $host_os in + aix4 | aix4.[01] | aix4.[01].*) + if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' + echo ' yes ' + echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then + : + else + can_build_shared=no + fi + ;; + esac + # AIX (on Power*) has no versioning support, so currently we can not hardcode correct + # soname into executable. Probably we can add versioning support to + # collect2, so additional links can be useful in future. + if test "$aix_use_runtimelinking" = yes; then + # If using run time linking (on AIX 4.2 or later) use lib.so + # instead of lib.a to let people know that these are not + # typical AIX shared libraries. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + else + # We preserve .a as extension for shared libraries through AIX4.2 + # and later when we are not doing run time linking. + library_names_spec='${libname}${release}.a $libname.a' + soname_spec='${libname}${release}${shared_ext}$major' + fi + shlibpath_var=LIBPATH + fi + ;; + +amigaos*) + library_names_spec='$libname.ixlibrary $libname.a' + # Create ${libname}_ixlibrary.a entries in /sys/libs. + finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' + ;; + +beos*) + library_names_spec='${libname}${shared_ext}' + dynamic_linker="$host_os ld.so" + shlibpath_var=LIBRARY_PATH + ;; + +bsdi[45]*) + version_type=linux + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' + shlibpath_var=LD_LIBRARY_PATH + sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" + sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" + # the default ld.so.conf also contains /usr/contrib/lib and + # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow + # libtool to hard-code these into programs + ;; + +cygwin* | mingw* | pw32*) + version_type=windows + shrext_cmds=".dll" + need_version=no + need_lib_prefix=no + + case $GCC,$host_os in + yes,cygwin* | yes,mingw* | yes,pw32*) + library_names_spec='$libname.dll.a' + # DLL is installed to $(libdir)/../bin by postinstall_cmds + postinstall_cmds='base_file=`basename \${file}`~ + dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i;echo \$dlname'\''`~ + dldir=$destdir/`dirname \$dlpath`~ + test -d \$dldir || mkdir -p \$dldir~ + $install_prog $dir/$dlname \$dldir/$dlname~ + chmod a+x \$dldir/$dlname' + postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ + dlpath=$dir/\$dldll~ + $rm \$dlpath' + shlibpath_overrides_runpath=yes + + case $host_os in + cygwin*) + # Cygwin DLLs use 'cyg' prefix rather than 'lib' + soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' + sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib" + ;; + mingw*) + # MinGW DLLs use traditional 'lib' prefix + soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' + sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` + if echo "$sys_lib_search_path_spec" | grep ';[c-zC-Z]:/' >/dev/null; then + # It is most probably a Windows format PATH printed by + # mingw gcc, but we are running on Cygwin. Gcc prints its search + # path with ; separators, and with drive letters. We can handle the + # drive letters (cygwin fileutils understands them), so leave them, + # especially as we might pass files found there to a mingw objdump, + # which wouldn't understand a cygwinified path. Ahh. + sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` + else + sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + fi + ;; + pw32*) + # pw32 DLLs use 'pw' prefix rather than 'lib' + library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' + ;; + esac + ;; + + *) + library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib' + ;; + esac + dynamic_linker='Win32 ld.exe' + # FIXME: first we should search . and the directory the executable is in + shlibpath_var=PATH + ;; + +darwin* | rhapsody*) + dynamic_linker="$host_os dyld" + version_type=darwin + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${versuffix}$shared_ext ${libname}${release}${major}$shared_ext ${libname}$shared_ext' + soname_spec='${libname}${release}${major}$shared_ext' + shlibpath_overrides_runpath=yes + shlibpath_var=DYLD_LIBRARY_PATH + shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' + + sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' + ;; + +dgux*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +freebsd1*) + dynamic_linker=no + ;; + +freebsd* | dragonfly*) + # DragonFly does not have aout. When/if they implement a new + # versioning mechanism, adjust this. + if test -x /usr/bin/objformat; then + objformat=`/usr/bin/objformat` + else + case $host_os in + freebsd[123]*) objformat=aout ;; + *) objformat=elf ;; + esac + fi + version_type=freebsd-$objformat + case $version_type in + freebsd-elf*) + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' + need_version=no + need_lib_prefix=no + ;; + freebsd-*) + library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' + need_version=yes + ;; + esac + shlibpath_var=LD_LIBRARY_PATH + case $host_os in + freebsd2*) + shlibpath_overrides_runpath=yes + ;; + freebsd3.[01]* | freebsdelf3.[01]*) + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + freebsd3.[2-9]* | freebsdelf3.[2-9]* | \ + freebsd4.[0-5] | freebsdelf4.[0-5] | freebsd4.1.1 | freebsdelf4.1.1) + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + *) # from 4.6 on, and DragonFly + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + esac + ;; + +gnu*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + hardcode_into_libs=yes + ;; + +hpux9* | hpux10* | hpux11*) + # Give a soname corresponding to the major version so that dld.sl refuses to + # link against other versions. + version_type=sunos + need_lib_prefix=no + need_version=no + case $host_cpu in + ia64*) + shrext_cmds='.so' + hardcode_into_libs=yes + dynamic_linker="$host_os dld.so" + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + if test "X$HPUX_IA64_MODE" = X32; then + sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" + else + sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" + fi + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + ;; + hppa*64*) + shrext_cmds='.sl' + hardcode_into_libs=yes + dynamic_linker="$host_os dld.sl" + shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH + shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + ;; + *) + shrext_cmds='.sl' + dynamic_linker="$host_os dld.sl" + shlibpath_var=SHLIB_PATH + shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + ;; + esac + # HP-UX runs *really* slowly unless shared libraries are mode 555. + postinstall_cmds='chmod 555 $lib' + ;; + +interix[3-9]*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + +irix5* | irix6* | nonstopux*) + case $host_os in + nonstopux*) version_type=nonstopux ;; + *) + if test "$lt_cv_prog_gnu_ld" = yes; then + version_type=linux + else + version_type=irix + fi ;; + esac + need_lib_prefix=no + need_version=no + soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' + case $host_os in + irix5* | nonstopux*) + libsuff= shlibsuff= + ;; + *) + case $LD in # libtool.m4 will add one of these switches to LD + *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") + libsuff= shlibsuff= libmagic=32-bit;; + *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") + libsuff=32 shlibsuff=N32 libmagic=N32;; + *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") + libsuff=64 shlibsuff=64 libmagic=64-bit;; + *) libsuff= shlibsuff= libmagic=never-match;; + esac + ;; + esac + shlibpath_var=LD_LIBRARY${shlibsuff}_PATH + shlibpath_overrides_runpath=no + sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" + sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" + hardcode_into_libs=yes + ;; + +# No shared lib support for Linux oldld, aout, or coff. +linux*oldld* | linux*aout* | linux*coff*) + dynamic_linker=no + ;; + +# This must be Linux ELF. +linux* | k*bsd*-gnu) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + # This implies no fast_install, which is unacceptable. + # Some rework will be needed to allow for fast_install + # before this can be enabled. + hardcode_into_libs=yes + + # Append ld.so.conf contents to the search path + if test -f /etc/ld.so.conf; then + lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` + sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" + fi + + # We used to test for /lib/ld.so.1 and disable shared libraries on + # powerpc, because MkLinux only supported shared libraries with the + # GNU dynamic linker. Since this was broken with cross compilers, + # most powerpc-linux boxes support dynamic linking these days and + # people can always --disable-shared, the test was removed, and we + # assume the GNU/Linux dynamic linker is in use. + dynamic_linker='GNU/Linux ld.so' + ;; + +netbsdelf*-gnu) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + dynamic_linker='NetBSD ld.elf_so' + ;; + +netbsd*) + version_type=sunos + need_lib_prefix=no + need_version=no + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + dynamic_linker='NetBSD (a.out) ld.so' + else + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + dynamic_linker='NetBSD ld.elf_so' + fi + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + +newsos6) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + ;; + +nto-qnx*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + ;; + +openbsd*) + version_type=sunos + sys_lib_dlsearch_path_spec="/usr/lib" + need_lib_prefix=no + # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. + case $host_os in + openbsd3.3 | openbsd3.3.*) need_version=yes ;; + *) need_version=no ;; + esac + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + shlibpath_var=LD_LIBRARY_PATH + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + case $host_os in + openbsd2.[89] | openbsd2.[89].*) + shlibpath_overrides_runpath=no + ;; + *) + shlibpath_overrides_runpath=yes + ;; + esac + else + shlibpath_overrides_runpath=yes + fi + ;; + +os2*) + libname_spec='$name' + shrext_cmds=".dll" + need_lib_prefix=no + library_names_spec='$libname${shared_ext} $libname.a' + dynamic_linker='OS/2 ld.exe' + shlibpath_var=LIBPATH + ;; + +osf3* | osf4* | osf5*) + version_type=osf + need_lib_prefix=no + need_version=no + soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" + sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" + ;; + +rdos*) + dynamic_linker=no + ;; + +solaris*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + # ldd complains unless libraries are executable + postinstall_cmds='chmod +x $lib' + ;; + +sunos4*) + version_type=sunos + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + if test "$with_gnu_ld" = yes; then + need_lib_prefix=no + fi + need_version=yes + ;; + +sysv4 | sysv4.3*) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + case $host_vendor in + sni) + shlibpath_overrides_runpath=no + need_lib_prefix=no + export_dynamic_flag_spec='${wl}-Blargedynsym' + runpath_var=LD_RUN_PATH + ;; + siemens) + need_lib_prefix=no + ;; + motorola) + need_lib_prefix=no + need_version=no + shlibpath_overrides_runpath=no + sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' + ;; + esac + ;; + +sysv4*MP*) + if test -d /usr/nec ;then + version_type=linux + library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' + soname_spec='$libname${shared_ext}.$major' + shlibpath_var=LD_LIBRARY_PATH + fi + ;; + +sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) + version_type=freebsd-elf + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + hardcode_into_libs=yes + if test "$with_gnu_ld" = yes; then + sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' + shlibpath_overrides_runpath=no + else + sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' + shlibpath_overrides_runpath=yes + case $host_os in + sco3.2v5*) + sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" + ;; + esac + fi + sys_lib_dlsearch_path_spec='/usr/lib' + ;; + +uts4*) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +*) + dynamic_linker=no + ;; +esac +{ echo "$as_me:$LINENO: result: $dynamic_linker" >&5 +echo "${ECHO_T}$dynamic_linker" >&6; } +test "$dynamic_linker" = no && can_build_shared=no + +variables_saved_for_relink="PATH $shlibpath_var $runpath_var" +if test "$GCC" = yes; then + variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" +fi + +{ echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5 +echo $ECHO_N "checking how to hardcode library paths into programs... $ECHO_C" >&6; } +hardcode_action_GCJ= +if test -n "$hardcode_libdir_flag_spec_GCJ" || \ + test -n "$runpath_var_GCJ" || \ + test "X$hardcode_automatic_GCJ" = "Xyes" ; then + + # We can hardcode non-existant directories. + if test "$hardcode_direct_GCJ" != no && + # If the only mechanism to avoid hardcoding is shlibpath_var, we + # have to relink, otherwise we might link with an installed library + # when we should be linking with a yet-to-be-installed one + ## test "$_LT_AC_TAGVAR(hardcode_shlibpath_var, GCJ)" != no && + test "$hardcode_minus_L_GCJ" != no; then + # Linking always hardcodes the temporary library directory. + hardcode_action_GCJ=relink + else + # We can link without hardcoding, and we can hardcode nonexisting dirs. + hardcode_action_GCJ=immediate + fi +else + # We cannot hardcode anything, or else we can only hardcode existing + # directories. + hardcode_action_GCJ=unsupported +fi +{ echo "$as_me:$LINENO: result: $hardcode_action_GCJ" >&5 +echo "${ECHO_T}$hardcode_action_GCJ" >&6; } + +if test "$hardcode_action_GCJ" = relink; then + # Fast installation is not supported + enable_fast_install=no +elif test "$shlibpath_overrides_runpath" = yes || + test "$enable_shared" = no; then + # Fast installation is not necessary + enable_fast_install=needless +fi + + +# The else clause should only fire when bootstrapping the +# libtool distribution, otherwise you forgot to ship ltmain.sh +# with your package, and you will get complaints that there are +# no rules to generate ltmain.sh. +if test -f "$ltmain"; then + # See if we are running on zsh, and set the options which allow our commands through + # without removal of \ escapes. + if test -n "${ZSH_VERSION+set}" ; then + setopt NO_GLOB_SUBST + fi + # Now quote all the things that may contain metacharacters while being + # careful not to overquote the AC_SUBSTed values. We take copies of the + # variables and quote the copies for generation of the libtool script. + for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC LTCFLAGS NM \ + SED SHELL STRIP \ + libname_spec library_names_spec soname_spec extract_expsyms_cmds \ + old_striplib striplib file_magic_cmd finish_cmds finish_eval \ + deplibs_check_method reload_flag reload_cmds need_locks \ + lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \ + lt_cv_sys_global_symbol_to_c_name_address \ + sys_lib_search_path_spec sys_lib_dlsearch_path_spec \ + old_postinstall_cmds old_postuninstall_cmds \ + compiler_GCJ \ + CC_GCJ \ + LD_GCJ \ + lt_prog_compiler_wl_GCJ \ + lt_prog_compiler_pic_GCJ \ + lt_prog_compiler_static_GCJ \ + lt_prog_compiler_no_builtin_flag_GCJ \ + export_dynamic_flag_spec_GCJ \ + thread_safe_flag_spec_GCJ \ + whole_archive_flag_spec_GCJ \ + enable_shared_with_static_runtimes_GCJ \ + old_archive_cmds_GCJ \ + old_archive_from_new_cmds_GCJ \ + predep_objects_GCJ \ + postdep_objects_GCJ \ + predeps_GCJ \ + postdeps_GCJ \ + compiler_lib_search_path_GCJ \ + archive_cmds_GCJ \ + archive_expsym_cmds_GCJ \ + postinstall_cmds_GCJ \ + postuninstall_cmds_GCJ \ + old_archive_from_expsyms_cmds_GCJ \ + allow_undefined_flag_GCJ \ + no_undefined_flag_GCJ \ + export_symbols_cmds_GCJ \ + hardcode_libdir_flag_spec_GCJ \ + hardcode_libdir_flag_spec_ld_GCJ \ + hardcode_libdir_separator_GCJ \ + hardcode_automatic_GCJ \ + module_cmds_GCJ \ + module_expsym_cmds_GCJ \ + lt_cv_prog_compiler_c_o_GCJ \ + fix_srcfile_path_GCJ \ + exclude_expsyms_GCJ \ + include_expsyms_GCJ; do + + case $var in + old_archive_cmds_GCJ | \ + old_archive_from_new_cmds_GCJ | \ + archive_cmds_GCJ | \ + archive_expsym_cmds_GCJ | \ + module_cmds_GCJ | \ + module_expsym_cmds_GCJ | \ + old_archive_from_expsyms_cmds_GCJ | \ + export_symbols_cmds_GCJ | \ + extract_expsyms_cmds | reload_cmds | finish_cmds | \ + postinstall_cmds | postuninstall_cmds | \ + old_postinstall_cmds | old_postuninstall_cmds | \ + sys_lib_search_path_spec | sys_lib_dlsearch_path_spec) + # Double-quote double-evaled strings. + eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\"" + ;; + *) + eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\"" + ;; + esac + done + + case $lt_echo in + *'\$0 --fallback-echo"') + lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'` + ;; + esac + +cfgfile="$ofile" + + cat <<__EOF__ >> "$cfgfile" +# ### BEGIN LIBTOOL TAG CONFIG: $tagname + +# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: + +# Shell to use when invoking shell scripts. +SHELL=$lt_SHELL + +# Whether or not to build shared libraries. +build_libtool_libs=$enable_shared + +# Whether or not to build static libraries. +build_old_libs=$enable_static + +# Whether or not to add -lc for building shared libraries. +build_libtool_need_lc=$archive_cmds_need_lc_GCJ + +# Whether or not to disallow shared libs when runtime libs are static +allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes_GCJ + +# Whether or not to optimize for fast installation. +fast_install=$enable_fast_install + +# The host system. +host_alias=$host_alias +host=$host +host_os=$host_os + +# The build system. +build_alias=$build_alias +build=$build +build_os=$build_os + +# An echo program that does not interpret backslashes. +echo=$lt_echo + +# The archiver. +AR=$lt_AR +AR_FLAGS=$lt_AR_FLAGS + +# A C compiler. +LTCC=$lt_LTCC + +# LTCC compiler flags. +LTCFLAGS=$lt_LTCFLAGS + +# A language-specific compiler. +CC=$lt_compiler_GCJ + +# Is the compiler the GNU C compiler? +with_gcc=$GCC_GCJ + +# An ERE matcher. +EGREP=$lt_EGREP + +# The linker used to build libraries. +LD=$lt_LD_GCJ + +# Whether we need hard or soft links. +LN_S=$lt_LN_S + +# A BSD-compatible nm program. +NM=$lt_NM + +# A symbol stripping program +STRIP=$lt_STRIP + +# Used to examine libraries when file_magic_cmd begins "file" +MAGIC_CMD=$MAGIC_CMD + +# Used on cygwin: DLL creation program. +DLLTOOL="$DLLTOOL" + +# Used on cygwin: object dumper. +OBJDUMP="$OBJDUMP" + +# Used on cygwin: assembler. +AS="$AS" + +# The name of the directory that contains temporary libtool files. +objdir=$objdir + +# How to create reloadable object files. +reload_flag=$lt_reload_flag +reload_cmds=$lt_reload_cmds + +# How to pass a linker flag through the compiler. +wl=$lt_lt_prog_compiler_wl_GCJ + +# Object file suffix (normally "o"). +objext="$ac_objext" + +# Old archive suffix (normally "a"). +libext="$libext" + +# Shared library suffix (normally ".so"). +shrext_cmds='$shrext_cmds' + +# Executable file suffix (normally ""). +exeext="$exeext" + +# Additional compiler flags for building library objects. +pic_flag=$lt_lt_prog_compiler_pic_GCJ +pic_mode=$pic_mode + +# What is the maximum length of a command? +max_cmd_len=$lt_cv_sys_max_cmd_len + +# Does compiler simultaneously support -c and -o options? +compiler_c_o=$lt_lt_cv_prog_compiler_c_o_GCJ + +# Must we lock files when doing compilation? +need_locks=$lt_need_locks + +# Do we need the lib prefix for modules? +need_lib_prefix=$need_lib_prefix + +# Do we need a version for libraries? +need_version=$need_version + +# Whether dlopen is supported. +dlopen_support=$enable_dlopen + +# Whether dlopen of programs is supported. +dlopen_self=$enable_dlopen_self + +# Whether dlopen of statically linked programs is supported. +dlopen_self_static=$enable_dlopen_self_static + +# Compiler flag to prevent dynamic linking. +link_static_flag=$lt_lt_prog_compiler_static_GCJ + +# Compiler flag to turn off builtin functions. +no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag_GCJ + +# Compiler flag to allow reflexive dlopens. +export_dynamic_flag_spec=$lt_export_dynamic_flag_spec_GCJ + +# Compiler flag to generate shared objects directly from archives. +whole_archive_flag_spec=$lt_whole_archive_flag_spec_GCJ + +# Compiler flag to generate thread-safe objects. +thread_safe_flag_spec=$lt_thread_safe_flag_spec_GCJ + +# Library versioning type. +version_type=$version_type + +# Format of library name prefix. +libname_spec=$lt_libname_spec + +# List of archive names. First name is the real one, the rest are links. +# The last name is the one that the linker finds with -lNAME. +library_names_spec=$lt_library_names_spec + +# The coded name of the library, if different from the real name. +soname_spec=$lt_soname_spec + +# Commands used to build and install an old-style archive. +RANLIB=$lt_RANLIB +old_archive_cmds=$lt_old_archive_cmds_GCJ +old_postinstall_cmds=$lt_old_postinstall_cmds +old_postuninstall_cmds=$lt_old_postuninstall_cmds + +# Create an old-style archive from a shared archive. +old_archive_from_new_cmds=$lt_old_archive_from_new_cmds_GCJ + +# Create a temporary old-style archive to link instead of a shared archive. +old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds_GCJ + +# Commands used to build and install a shared archive. +archive_cmds=$lt_archive_cmds_GCJ +archive_expsym_cmds=$lt_archive_expsym_cmds_GCJ +postinstall_cmds=$lt_postinstall_cmds +postuninstall_cmds=$lt_postuninstall_cmds + +# Commands used to build a loadable module (assumed same as above if empty) +module_cmds=$lt_module_cmds_GCJ +module_expsym_cmds=$lt_module_expsym_cmds_GCJ + +# Commands to strip libraries. +old_striplib=$lt_old_striplib +striplib=$lt_striplib + +# Dependencies to place before the objects being linked to create a +# shared library. +predep_objects=$lt_predep_objects_GCJ + +# Dependencies to place after the objects being linked to create a +# shared library. +postdep_objects=$lt_postdep_objects_GCJ + +# Dependencies to place before the objects being linked to create a +# shared library. +predeps=$lt_predeps_GCJ + +# Dependencies to place after the objects being linked to create a +# shared library. +postdeps=$lt_postdeps_GCJ + +# The library search path used internally by the compiler when linking +# a shared library. +compiler_lib_search_path=$lt_compiler_lib_search_path_GCJ + +# Method to check whether dependent libraries are shared objects. +deplibs_check_method=$lt_deplibs_check_method + +# Command to use when deplibs_check_method == file_magic. +file_magic_cmd=$lt_file_magic_cmd + +# Flag that allows shared libraries with undefined symbols to be built. +allow_undefined_flag=$lt_allow_undefined_flag_GCJ + +# Flag that forces no undefined symbols. +no_undefined_flag=$lt_no_undefined_flag_GCJ + +# Commands used to finish a libtool library installation in a directory. +finish_cmds=$lt_finish_cmds + +# Same as above, but a single script fragment to be evaled but not shown. +finish_eval=$lt_finish_eval + +# Take the output of nm and produce a listing of raw symbols and C names. +global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe + +# Transform the output of nm in a proper C declaration +global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl + +# Transform the output of nm in a C name address pair +global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address + +# This is the shared library runtime path variable. +runpath_var=$runpath_var + +# This is the shared library path variable. +shlibpath_var=$shlibpath_var + +# Is shlibpath searched before the hard-coded library search path? +shlibpath_overrides_runpath=$shlibpath_overrides_runpath + +# How to hardcode a shared library path into an executable. +hardcode_action=$hardcode_action_GCJ + +# Whether we should hardcode library paths into libraries. +hardcode_into_libs=$hardcode_into_libs + +# Flag to hardcode \$libdir into a binary during linking. +# This must work even if \$libdir does not exist. +hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec_GCJ + +# If ld is used when linking, flag to hardcode \$libdir into +# a binary during linking. This must work even if \$libdir does +# not exist. +hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld_GCJ + +# Whether we need a single -rpath flag with a separated argument. +hardcode_libdir_separator=$lt_hardcode_libdir_separator_GCJ + +# Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the +# resulting binary. +hardcode_direct=$hardcode_direct_GCJ + +# Set to yes if using the -LDIR flag during linking hardcodes DIR into the +# resulting binary. +hardcode_minus_L=$hardcode_minus_L_GCJ + +# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into +# the resulting binary. +hardcode_shlibpath_var=$hardcode_shlibpath_var_GCJ + +# Set to yes if building a shared library automatically hardcodes DIR into the library +# and all subsequent libraries and executables linked against it. +hardcode_automatic=$hardcode_automatic_GCJ + +# Variables whose values should be saved in libtool wrapper scripts and +# restored at relink time. +variables_saved_for_relink="$variables_saved_for_relink" + +# Whether libtool must link a program against all its dependency libraries. +link_all_deplibs=$link_all_deplibs_GCJ + +# Compile-time system search path for libraries +sys_lib_search_path_spec=$lt_sys_lib_search_path_spec + +# Run-time system search path for libraries +sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec + +# Fix the shell variable \$srcfile for the compiler. +fix_srcfile_path=$lt_fix_srcfile_path + +# Set to yes if exported symbols are required. +always_export_symbols=$always_export_symbols_GCJ + +# The commands to list exported symbols. +export_symbols_cmds=$lt_export_symbols_cmds_GCJ + +# The commands to extract the exported symbol list from a shared archive. +extract_expsyms_cmds=$lt_extract_expsyms_cmds + +# Symbols that should not be listed in the preloaded symbols. +exclude_expsyms=$lt_exclude_expsyms_GCJ + +# Symbols that must always be exported. +include_expsyms=$lt_include_expsyms_GCJ + +# ### END LIBTOOL TAG CONFIG: $tagname + +__EOF__ + + +else + # If there is no Makefile yet, we rely on a make rule to execute + # `config.status --recheck' to rerun these tests and create the + # libtool script then. + ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'` + if test -f "$ltmain_in"; then + test -f Makefile && make "$ltmain" + fi +fi + + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +CC="$lt_save_CC" + + else + tagname="" + fi + ;; + + RC) + + +# Source file extension for RC test sources. +ac_ext=rc + +# Object file extension for compiled RC test sources. +objext=o +objext_RC=$objext + +# Code to be used in simple compile tests +lt_simple_compile_test_code='sample MENU { MENUITEM "&Soup", 100, CHECKED }' + +# Code to be used in simple link tests +lt_simple_link_test_code="$lt_simple_compile_test_code" + +# ltmain only uses $CC for tagged configurations so make sure $CC is set. + +# If no C compiler was specified, use CC. +LTCC=${LTCC-"$CC"} + +# If no C compiler flags were specified, use CFLAGS. +LTCFLAGS=${LTCFLAGS-"$CFLAGS"} + +# Allow CC to be a program name with arguments. +compiler=$CC + + +# save warnings/boilerplate of simple test code +ac_outfile=conftest.$ac_objext +echo "$lt_simple_compile_test_code" >conftest.$ac_ext +eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err +_lt_compiler_boilerplate=`cat conftest.err` +$rm conftest* + +ac_outfile=conftest.$ac_objext +echo "$lt_simple_link_test_code" >conftest.$ac_ext +eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err +_lt_linker_boilerplate=`cat conftest.err` +$rm conftest* + + +# Allow CC to be a program name with arguments. +lt_save_CC="$CC" +CC=${RC-"windres"} +compiler=$CC +compiler_RC=$CC +for cc_temp in $compiler""; do + case $cc_temp in + compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; + distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; + \-*) ;; + *) break;; + esac +done +cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` + +lt_cv_prog_compiler_c_o_RC=yes + +# The else clause should only fire when bootstrapping the +# libtool distribution, otherwise you forgot to ship ltmain.sh +# with your package, and you will get complaints that there are +# no rules to generate ltmain.sh. +if test -f "$ltmain"; then + # See if we are running on zsh, and set the options which allow our commands through + # without removal of \ escapes. + if test -n "${ZSH_VERSION+set}" ; then + setopt NO_GLOB_SUBST + fi + # Now quote all the things that may contain metacharacters while being + # careful not to overquote the AC_SUBSTed values. We take copies of the + # variables and quote the copies for generation of the libtool script. + for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC LTCFLAGS NM \ + SED SHELL STRIP \ + libname_spec library_names_spec soname_spec extract_expsyms_cmds \ + old_striplib striplib file_magic_cmd finish_cmds finish_eval \ + deplibs_check_method reload_flag reload_cmds need_locks \ + lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \ + lt_cv_sys_global_symbol_to_c_name_address \ + sys_lib_search_path_spec sys_lib_dlsearch_path_spec \ + old_postinstall_cmds old_postuninstall_cmds \ + compiler_RC \ + CC_RC \ + LD_RC \ + lt_prog_compiler_wl_RC \ + lt_prog_compiler_pic_RC \ + lt_prog_compiler_static_RC \ + lt_prog_compiler_no_builtin_flag_RC \ + export_dynamic_flag_spec_RC \ + thread_safe_flag_spec_RC \ + whole_archive_flag_spec_RC \ + enable_shared_with_static_runtimes_RC \ + old_archive_cmds_RC \ + old_archive_from_new_cmds_RC \ + predep_objects_RC \ + postdep_objects_RC \ + predeps_RC \ + postdeps_RC \ + compiler_lib_search_path_RC \ + archive_cmds_RC \ + archive_expsym_cmds_RC \ + postinstall_cmds_RC \ + postuninstall_cmds_RC \ + old_archive_from_expsyms_cmds_RC \ + allow_undefined_flag_RC \ + no_undefined_flag_RC \ + export_symbols_cmds_RC \ + hardcode_libdir_flag_spec_RC \ + hardcode_libdir_flag_spec_ld_RC \ + hardcode_libdir_separator_RC \ + hardcode_automatic_RC \ + module_cmds_RC \ + module_expsym_cmds_RC \ + lt_cv_prog_compiler_c_o_RC \ + fix_srcfile_path_RC \ + exclude_expsyms_RC \ + include_expsyms_RC; do + + case $var in + old_archive_cmds_RC | \ + old_archive_from_new_cmds_RC | \ + archive_cmds_RC | \ + archive_expsym_cmds_RC | \ + module_cmds_RC | \ + module_expsym_cmds_RC | \ + old_archive_from_expsyms_cmds_RC | \ + export_symbols_cmds_RC | \ + extract_expsyms_cmds | reload_cmds | finish_cmds | \ + postinstall_cmds | postuninstall_cmds | \ + old_postinstall_cmds | old_postuninstall_cmds | \ + sys_lib_search_path_spec | sys_lib_dlsearch_path_spec) + # Double-quote double-evaled strings. + eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\"" + ;; + *) + eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\"" + ;; + esac + done + + case $lt_echo in + *'\$0 --fallback-echo"') + lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'` + ;; + esac + +cfgfile="$ofile" + + cat <<__EOF__ >> "$cfgfile" +# ### BEGIN LIBTOOL TAG CONFIG: $tagname + +# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: + +# Shell to use when invoking shell scripts. +SHELL=$lt_SHELL + +# Whether or not to build shared libraries. +build_libtool_libs=$enable_shared + +# Whether or not to build static libraries. +build_old_libs=$enable_static + +# Whether or not to add -lc for building shared libraries. +build_libtool_need_lc=$archive_cmds_need_lc_RC + +# Whether or not to disallow shared libs when runtime libs are static +allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes_RC + +# Whether or not to optimize for fast installation. +fast_install=$enable_fast_install + +# The host system. +host_alias=$host_alias +host=$host +host_os=$host_os + +# The build system. +build_alias=$build_alias +build=$build +build_os=$build_os + +# An echo program that does not interpret backslashes. +echo=$lt_echo + +# The archiver. +AR=$lt_AR +AR_FLAGS=$lt_AR_FLAGS + +# A C compiler. +LTCC=$lt_LTCC + +# LTCC compiler flags. +LTCFLAGS=$lt_LTCFLAGS + +# A language-specific compiler. +CC=$lt_compiler_RC + +# Is the compiler the GNU C compiler? +with_gcc=$GCC_RC + +# An ERE matcher. +EGREP=$lt_EGREP + +# The linker used to build libraries. +LD=$lt_LD_RC + +# Whether we need hard or soft links. +LN_S=$lt_LN_S + +# A BSD-compatible nm program. +NM=$lt_NM + +# A symbol stripping program +STRIP=$lt_STRIP + +# Used to examine libraries when file_magic_cmd begins "file" +MAGIC_CMD=$MAGIC_CMD + +# Used on cygwin: DLL creation program. +DLLTOOL="$DLLTOOL" + +# Used on cygwin: object dumper. +OBJDUMP="$OBJDUMP" + +# Used on cygwin: assembler. +AS="$AS" + +# The name of the directory that contains temporary libtool files. +objdir=$objdir + +# How to create reloadable object files. +reload_flag=$lt_reload_flag +reload_cmds=$lt_reload_cmds + +# How to pass a linker flag through the compiler. +wl=$lt_lt_prog_compiler_wl_RC + +# Object file suffix (normally "o"). +objext="$ac_objext" + +# Old archive suffix (normally "a"). +libext="$libext" + +# Shared library suffix (normally ".so"). +shrext_cmds='$shrext_cmds' + +# Executable file suffix (normally ""). +exeext="$exeext" + +# Additional compiler flags for building library objects. +pic_flag=$lt_lt_prog_compiler_pic_RC +pic_mode=$pic_mode + +# What is the maximum length of a command? +max_cmd_len=$lt_cv_sys_max_cmd_len + +# Does compiler simultaneously support -c and -o options? +compiler_c_o=$lt_lt_cv_prog_compiler_c_o_RC + +# Must we lock files when doing compilation? +need_locks=$lt_need_locks + +# Do we need the lib prefix for modules? +need_lib_prefix=$need_lib_prefix + +# Do we need a version for libraries? +need_version=$need_version + +# Whether dlopen is supported. +dlopen_support=$enable_dlopen + +# Whether dlopen of programs is supported. +dlopen_self=$enable_dlopen_self + +# Whether dlopen of statically linked programs is supported. +dlopen_self_static=$enable_dlopen_self_static + +# Compiler flag to prevent dynamic linking. +link_static_flag=$lt_lt_prog_compiler_static_RC + +# Compiler flag to turn off builtin functions. +no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag_RC + +# Compiler flag to allow reflexive dlopens. +export_dynamic_flag_spec=$lt_export_dynamic_flag_spec_RC + +# Compiler flag to generate shared objects directly from archives. +whole_archive_flag_spec=$lt_whole_archive_flag_spec_RC + +# Compiler flag to generate thread-safe objects. +thread_safe_flag_spec=$lt_thread_safe_flag_spec_RC + +# Library versioning type. +version_type=$version_type + +# Format of library name prefix. +libname_spec=$lt_libname_spec + +# List of archive names. First name is the real one, the rest are links. +# The last name is the one that the linker finds with -lNAME. +library_names_spec=$lt_library_names_spec + +# The coded name of the library, if different from the real name. +soname_spec=$lt_soname_spec + +# Commands used to build and install an old-style archive. +RANLIB=$lt_RANLIB +old_archive_cmds=$lt_old_archive_cmds_RC +old_postinstall_cmds=$lt_old_postinstall_cmds +old_postuninstall_cmds=$lt_old_postuninstall_cmds + +# Create an old-style archive from a shared archive. +old_archive_from_new_cmds=$lt_old_archive_from_new_cmds_RC + +# Create a temporary old-style archive to link instead of a shared archive. +old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds_RC + +# Commands used to build and install a shared archive. +archive_cmds=$lt_archive_cmds_RC +archive_expsym_cmds=$lt_archive_expsym_cmds_RC +postinstall_cmds=$lt_postinstall_cmds +postuninstall_cmds=$lt_postuninstall_cmds + +# Commands used to build a loadable module (assumed same as above if empty) +module_cmds=$lt_module_cmds_RC +module_expsym_cmds=$lt_module_expsym_cmds_RC + +# Commands to strip libraries. +old_striplib=$lt_old_striplib +striplib=$lt_striplib + +# Dependencies to place before the objects being linked to create a +# shared library. +predep_objects=$lt_predep_objects_RC + +# Dependencies to place after the objects being linked to create a +# shared library. +postdep_objects=$lt_postdep_objects_RC + +# Dependencies to place before the objects being linked to create a +# shared library. +predeps=$lt_predeps_RC + +# Dependencies to place after the objects being linked to create a +# shared library. +postdeps=$lt_postdeps_RC + +# The library search path used internally by the compiler when linking +# a shared library. +compiler_lib_search_path=$lt_compiler_lib_search_path_RC + +# Method to check whether dependent libraries are shared objects. +deplibs_check_method=$lt_deplibs_check_method + +# Command to use when deplibs_check_method == file_magic. +file_magic_cmd=$lt_file_magic_cmd + +# Flag that allows shared libraries with undefined symbols to be built. +allow_undefined_flag=$lt_allow_undefined_flag_RC + +# Flag that forces no undefined symbols. +no_undefined_flag=$lt_no_undefined_flag_RC + +# Commands used to finish a libtool library installation in a directory. +finish_cmds=$lt_finish_cmds + +# Same as above, but a single script fragment to be evaled but not shown. +finish_eval=$lt_finish_eval + +# Take the output of nm and produce a listing of raw symbols and C names. +global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe + +# Transform the output of nm in a proper C declaration +global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl + +# Transform the output of nm in a C name address pair +global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address + +# This is the shared library runtime path variable. +runpath_var=$runpath_var + +# This is the shared library path variable. +shlibpath_var=$shlibpath_var + +# Is shlibpath searched before the hard-coded library search path? +shlibpath_overrides_runpath=$shlibpath_overrides_runpath + +# How to hardcode a shared library path into an executable. +hardcode_action=$hardcode_action_RC + +# Whether we should hardcode library paths into libraries. +hardcode_into_libs=$hardcode_into_libs + +# Flag to hardcode \$libdir into a binary during linking. +# This must work even if \$libdir does not exist. +hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec_RC + +# If ld is used when linking, flag to hardcode \$libdir into +# a binary during linking. This must work even if \$libdir does +# not exist. +hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld_RC + +# Whether we need a single -rpath flag with a separated argument. +hardcode_libdir_separator=$lt_hardcode_libdir_separator_RC + +# Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the +# resulting binary. +hardcode_direct=$hardcode_direct_RC + +# Set to yes if using the -LDIR flag during linking hardcodes DIR into the +# resulting binary. +hardcode_minus_L=$hardcode_minus_L_RC + +# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into +# the resulting binary. +hardcode_shlibpath_var=$hardcode_shlibpath_var_RC + +# Set to yes if building a shared library automatically hardcodes DIR into the library +# and all subsequent libraries and executables linked against it. +hardcode_automatic=$hardcode_automatic_RC + +# Variables whose values should be saved in libtool wrapper scripts and +# restored at relink time. +variables_saved_for_relink="$variables_saved_for_relink" + +# Whether libtool must link a program against all its dependency libraries. +link_all_deplibs=$link_all_deplibs_RC + +# Compile-time system search path for libraries +sys_lib_search_path_spec=$lt_sys_lib_search_path_spec + +# Run-time system search path for libraries +sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec + +# Fix the shell variable \$srcfile for the compiler. +fix_srcfile_path=$lt_fix_srcfile_path + +# Set to yes if exported symbols are required. +always_export_symbols=$always_export_symbols_RC + +# The commands to list exported symbols. +export_symbols_cmds=$lt_export_symbols_cmds_RC + +# The commands to extract the exported symbol list from a shared archive. +extract_expsyms_cmds=$lt_extract_expsyms_cmds + +# Symbols that should not be listed in the preloaded symbols. +exclude_expsyms=$lt_exclude_expsyms_RC + +# Symbols that must always be exported. +include_expsyms=$lt_include_expsyms_RC + +# ### END LIBTOOL TAG CONFIG: $tagname + +__EOF__ + + +else + # If there is no Makefile yet, we rely on a make rule to execute + # `config.status --recheck' to rerun these tests and create the + # libtool script then. + ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'` + if test -f "$ltmain_in"; then + test -f Makefile && make "$ltmain" + fi +fi + + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +CC="$lt_save_CC" + + ;; + + *) + { { echo "$as_me:$LINENO: error: Unsupported tag name: $tagname" >&5 +echo "$as_me: error: Unsupported tag name: $tagname" >&2;} + { (exit 1); exit 1; }; } + ;; + esac + + # Append the new tag name to the list of available tags. + if test -n "$tagname" ; then + available_tags="$available_tags $tagname" + fi + fi + done + IFS="$lt_save_ifs" + + # Now substitute the updated list of available tags. + if eval "sed -e 's/^available_tags=.*\$/available_tags=\"$available_tags\"/' \"$ofile\" > \"${ofile}T\""; then + mv "${ofile}T" "$ofile" + chmod +x "$ofile" + else + rm -f "${ofile}T" + { { echo "$as_me:$LINENO: error: unable to update list of available tagged configurations." >&5 +echo "$as_me: error: unable to update list of available tagged configurations." >&2;} + { (exit 1); exit 1; }; } + fi +fi + + + +# This can be used to rebuild libtool when needed +LIBTOOL_DEPS="$ac_aux_dir/ltmain.sh" + +# Always use our own libtool. +LIBTOOL='$(SHELL) $(top_builddir)/libtool' + +# Prevent multiple expansion + + + + + + + + + + + + + + + + + + + + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. +set dummy ${ac_tool_prefix}gcc; ac_word=$2 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_CC="${ac_tool_prefix}gcc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_CC"; then + ac_ct_CC=$CC + # Extract the first word of "gcc", so it can be a program name with args. +set dummy gcc; ac_word=$2 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_CC="gcc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + { echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 +echo "${ECHO_T}$ac_ct_CC" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + if test "x$ac_ct_CC" = x; then + CC="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools +whose name does not start with the host triplet. If you think this +configuration is useful to you, please write to autoconf@gnu.org." >&5 +echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools +whose name does not start with the host triplet. If you think this +configuration is useful to you, please write to autoconf@gnu.org." >&2;} +ac_tool_warned=yes ;; +esac + CC=$ac_ct_CC + fi +else + CC="$ac_cv_prog_CC" +fi + +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. +set dummy ${ac_tool_prefix}cc; ac_word=$2 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_CC="${ac_tool_prefix}cc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + + fi +fi +if test -z "$CC"; then + # Extract the first word of "cc", so it can be a program name with args. +set dummy cc; ac_word=$2 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + ac_prog_rejected=no +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then + ac_prog_rejected=yes + continue + fi + ac_cv_prog_CC="cc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +if test $ac_prog_rejected = yes; then + # We found a bogon in the path, so make sure we never use it. + set dummy $ac_cv_prog_CC + shift + if test $# != 0; then + # We chose a different compiler from the bogus one. + # However, it has the same basename, so the bogon will be chosen + # first if we set CC to just the basename; use the full file name. + shift + ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" + fi +fi +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + +fi +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + for ac_prog in cl.exe + do + # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. +set dummy $ac_tool_prefix$ac_prog; ac_word=$2 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_CC="$ac_tool_prefix$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + + test -n "$CC" && break + done +fi +if test -z "$CC"; then + ac_ct_CC=$CC + for ac_prog in cl.exe +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_CC="$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + { echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 +echo "${ECHO_T}$ac_ct_CC" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + + test -n "$ac_ct_CC" && break +done + + if test "x$ac_ct_CC" = x; then + CC="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools +whose name does not start with the host triplet. If you think this +configuration is useful to you, please write to autoconf@gnu.org." >&5 +echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools +whose name does not start with the host triplet. If you think this +configuration is useful to you, please write to autoconf@gnu.org." >&2;} +ac_tool_warned=yes ;; +esac + CC=$ac_ct_CC + fi +fi + +fi + + +test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH +See \`config.log' for more details." >&5 +echo "$as_me: error: no acceptable C compiler found in \$PATH +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } + +# Provide some information about the compiler. +echo "$as_me:$LINENO: checking for C compiler version" >&5 +ac_compiler=`set X $ac_compile; echo $2` +{ (ac_try="$ac_compiler --version >&5" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compiler --version >&5") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (ac_try="$ac_compiler -v >&5" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compiler -v >&5") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (ac_try="$ac_compiler -V >&5" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compiler -V >&5") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } + +{ echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5 +echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6; } +if test "${ac_cv_c_compiler_gnu+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ +#ifndef __GNUC__ + choke me +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_compiler_gnu=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_compiler_gnu=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +ac_cv_c_compiler_gnu=$ac_compiler_gnu + +fi +{ echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5 +echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6; } +GCC=`test $ac_compiler_gnu = yes && echo yes` +ac_test_CFLAGS=${CFLAGS+set} +ac_save_CFLAGS=$CFLAGS +{ echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5 +echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6; } +if test "${ac_cv_prog_cc_g+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_save_c_werror_flag=$ac_c_werror_flag + ac_c_werror_flag=yes + ac_cv_prog_cc_g=no + CFLAGS="-g" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_prog_cc_g=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + CFLAGS="" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + : +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_c_werror_flag=$ac_save_c_werror_flag + CFLAGS="-g" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_prog_cc_g=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + ac_c_werror_flag=$ac_save_c_werror_flag +fi +{ echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5 +echo "${ECHO_T}$ac_cv_prog_cc_g" >&6; } +if test "$ac_test_CFLAGS" = set; then + CFLAGS=$ac_save_CFLAGS +elif test $ac_cv_prog_cc_g = yes; then + if test "$GCC" = yes; then + CFLAGS="-g -O2" + else + CFLAGS="-g" + fi +else + if test "$GCC" = yes; then + CFLAGS="-O2" + else + CFLAGS= + fi +fi +{ echo "$as_me:$LINENO: checking for $CC option to accept ISO C89" >&5 +echo $ECHO_N "checking for $CC option to accept ISO C89... $ECHO_C" >&6; } +if test "${ac_cv_prog_cc_c89+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_prog_cc_c89=no +ac_save_CC=$CC +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +#include +#include +#include +/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ +struct buf { int x; }; +FILE * (*rcsopen) (struct buf *, struct stat *, int); +static char *e (p, i) + char **p; + int i; +{ + return p[i]; +} +static char *f (char * (*g) (char **, int), char **p, ...) +{ + char *s; + va_list v; + va_start (v,p); + s = g (p, va_arg (v,int)); + va_end (v); + return s; +} + +/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has + function prototypes and stuff, but not '\xHH' hex character constants. + These don't provoke an error unfortunately, instead are silently treated + as 'x'. The following induces an error, until -std is added to get + proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an + array size at least. It's necessary to write '\x00'==0 to get something + that's true only with -std. */ +int osf4_cc_array ['\x00' == 0 ? 1 : -1]; + +/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters + inside strings and character constants. */ +#define FOO(x) 'x' +int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; + +int test (int i, double x); +struct s1 {int (*f) (int a);}; +struct s2 {int (*f) (double a);}; +int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); +int argc; +char **argv; +int +main () +{ +return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; + ; + return 0; +} +_ACEOF +for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ + -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" +do + CC="$ac_save_CC $ac_arg" + rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_prog_cc_c89=$ac_arg +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + +fi + +rm -f core conftest.err conftest.$ac_objext + test "x$ac_cv_prog_cc_c89" != "xno" && break +done +rm -f conftest.$ac_ext +CC=$ac_save_CC + +fi +# AC_CACHE_VAL +case "x$ac_cv_prog_cc_c89" in + x) + { echo "$as_me:$LINENO: result: none needed" >&5 +echo "${ECHO_T}none needed" >&6; } ;; + xno) + { echo "$as_me:$LINENO: result: unsupported" >&5 +echo "${ECHO_T}unsupported" >&6; } ;; + *) + CC="$CC $ac_cv_prog_cc_c89" + { echo "$as_me:$LINENO: result: $ac_cv_prog_cc_c89" >&5 +echo "${ECHO_T}$ac_cv_prog_cc_c89" >&6; } ;; +esac + + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +depcc="$CC" am_compiler_list= + +{ echo "$as_me:$LINENO: checking dependency style of $depcc" >&5 +echo $ECHO_N "checking dependency style of $depcc... $ECHO_C" >&6; } +if test "${am_cv_CC_dependencies_compiler_type+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then + # We make a subdir and do the tests there. Otherwise we can end up + # making bogus files that we don't know about and never remove. For + # instance it was reported that on HP-UX the gcc test will end up + # making a dummy file named `D' -- because `-MD' means `put the output + # in D'. + mkdir conftest.dir + # Copy depcomp to subdir because otherwise we won't find it if we're + # using a relative directory. + cp "$am_depcomp" conftest.dir + cd conftest.dir + # We will build objects and dependencies in a subdirectory because + # it helps to detect inapplicable dependency modes. For instance + # both Tru64's cc and ICC support -MD to output dependencies as a + # side effect of compilation, but ICC will put the dependencies in + # the current directory while Tru64 will put them in the object + # directory. + mkdir sub + + am_cv_CC_dependencies_compiler_type=none + if test "$am_compiler_list" = ""; then + am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` + fi + for depmode in $am_compiler_list; do + # Setup a source with many dependencies, because some compilers + # like to wrap large dependency lists on column 80 (with \), and + # we should not choose a depcomp mode which is confused by this. + # + # We need to recreate these files for each test, as the compiler may + # overwrite some of them when testing with obscure command lines. + # This happens at least with the AIX C compiler. + : > sub/conftest.c + for i in 1 2 3 4 5 6; do + echo '#include "conftst'$i'.h"' >> sub/conftest.c + # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with + # Solaris 8's {/usr,}/bin/sh. + touch sub/conftst$i.h + done + echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf + + case $depmode in + nosideeffect) + # after this tag, mechanisms are not by side-effect, so they'll + # only be used when explicitly requested + if test "x$enable_dependency_tracking" = xyes; then + continue + else + break + fi + ;; + none) break ;; + esac + # We check with `-c' and `-o' for the sake of the "dashmstdout" + # mode. It turns out that the SunPro C++ compiler does not properly + # handle `-M -o', and we need to detect this. + if depmode=$depmode \ + source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \ + depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ + $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \ + >/dev/null 2>conftest.err && + grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && + grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && + grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 && + ${MAKE-make} -s -f confmf > /dev/null 2>&1; then + # icc doesn't choke on unknown options, it will just issue warnings + # or remarks (even with -Werror). So we grep stderr for any message + # that says an option was ignored or not supported. + # When given -MP, icc 7.0 and 7.1 complain thusly: + # icc: Command line warning: ignoring option '-M'; no argument required + # The diagnosis changed in icc 8.0: + # icc: Command line remark: option '-MP' not supported + if (grep 'ignoring option' conftest.err || + grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else + am_cv_CC_dependencies_compiler_type=$depmode + break + fi + fi + done + + cd .. + rm -rf conftest.dir +else + am_cv_CC_dependencies_compiler_type=none +fi + +fi +{ echo "$as_me:$LINENO: result: $am_cv_CC_dependencies_compiler_type" >&5 +echo "${ECHO_T}$am_cv_CC_dependencies_compiler_type" >&6; } +CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type + + if + test "x$enable_dependency_tracking" != xno \ + && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then + am__fastdepCC_TRUE= + am__fastdepCC_FALSE='#' +else + am__fastdepCC_TRUE='#' + am__fastdepCC_FALSE= +fi + + +# By default we simply use the C compiler to build assembly code. + +test "${CCAS+set}" = set || CCAS=$CC +test "${CCASFLAGS+set}" = set || CCASFLAGS=$CFLAGS + + + +depcc="$CCAS" am_compiler_list= + +{ echo "$as_me:$LINENO: checking dependency style of $depcc" >&5 +echo $ECHO_N "checking dependency style of $depcc... $ECHO_C" >&6; } +if test "${am_cv_CCAS_dependencies_compiler_type+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then + # We make a subdir and do the tests there. Otherwise we can end up + # making bogus files that we don't know about and never remove. For + # instance it was reported that on HP-UX the gcc test will end up + # making a dummy file named `D' -- because `-MD' means `put the output + # in D'. + mkdir conftest.dir + # Copy depcomp to subdir because otherwise we won't find it if we're + # using a relative directory. + cp "$am_depcomp" conftest.dir + cd conftest.dir + # We will build objects and dependencies in a subdirectory because + # it helps to detect inapplicable dependency modes. For instance + # both Tru64's cc and ICC support -MD to output dependencies as a + # side effect of compilation, but ICC will put the dependencies in + # the current directory while Tru64 will put them in the object + # directory. + mkdir sub + + am_cv_CCAS_dependencies_compiler_type=none + if test "$am_compiler_list" = ""; then + am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` + fi + for depmode in $am_compiler_list; do + # Setup a source with many dependencies, because some compilers + # like to wrap large dependency lists on column 80 (with \), and + # we should not choose a depcomp mode which is confused by this. + # + # We need to recreate these files for each test, as the compiler may + # overwrite some of them when testing with obscure command lines. + # This happens at least with the AIX C compiler. + : > sub/conftest.c + for i in 1 2 3 4 5 6; do + echo '#include "conftst'$i'.h"' >> sub/conftest.c + # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with + # Solaris 8's {/usr,}/bin/sh. + touch sub/conftst$i.h + done + echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf + + case $depmode in + nosideeffect) + # after this tag, mechanisms are not by side-effect, so they'll + # only be used when explicitly requested + if test "x$enable_dependency_tracking" = xyes; then + continue + else + break + fi + ;; + none) break ;; + esac + # We check with `-c' and `-o' for the sake of the "dashmstdout" + # mode. It turns out that the SunPro C++ compiler does not properly + # handle `-M -o', and we need to detect this. + if depmode=$depmode \ + source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \ + depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ + $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \ + >/dev/null 2>conftest.err && + grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && + grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && + grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 && + ${MAKE-make} -s -f confmf > /dev/null 2>&1; then + # icc doesn't choke on unknown options, it will just issue warnings + # or remarks (even with -Werror). So we grep stderr for any message + # that says an option was ignored or not supported. + # When given -MP, icc 7.0 and 7.1 complain thusly: + # icc: Command line warning: ignoring option '-M'; no argument required + # The diagnosis changed in icc 8.0: + # icc: Command line remark: option '-MP' not supported + if (grep 'ignoring option' conftest.err || + grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else + am_cv_CCAS_dependencies_compiler_type=$depmode + break + fi + fi + done + + cd .. + rm -rf conftest.dir +else + am_cv_CCAS_dependencies_compiler_type=none +fi + +fi +{ echo "$as_me:$LINENO: result: $am_cv_CCAS_dependencies_compiler_type" >&5 +echo "${ECHO_T}$am_cv_CCAS_dependencies_compiler_type" >&6; } +CCASDEPMODE=depmode=$am_cv_CCAS_dependencies_compiler_type + + if + test "x$enable_dependency_tracking" != xno \ + && test "$am_cv_CCAS_dependencies_compiler_type" = gcc3; then + am__fastdepCCAS_TRUE= + am__fastdepCCAS_FALSE='#' +else + am__fastdepCCAS_TRUE='#' + am__fastdepCCAS_FALSE= +fi + + + + + + + +# Check whether --with-xorg-module-dir was given. +if test "${with_xorg_module_dir+set}" = set; then + withval=$with_xorg_module_dir; moduledir="$withval" +else + moduledir="$libdir/xorg/modules" +fi + + +# Check whether --enable-geodegx-panel was given. +if test "${enable_geodegx_panel+set}" = set; then + enableval=$enable_geodegx_panel; +else + AMD_CFLAGS="-DPNL_SUP $AMD_CFLAGS" +fi + + +# Check whether --enable-werror was given. +if test "${enable_werror+set}" = set; then + enableval=$enable_werror; WERROR=$enableval +else + WERROR=no +fi + +# Check whether --enable-visibility was given. +if test "${enable_visibility+set}" = set; then + enableval=$enable_visibility; AMD_CFLAGS="$AMD_CFLAGS -fvisibility=hidden" +else + : +fi + + +if test "x$GCC" = "xyes"; then + GCC_WARNINGS1="-Wall -Wpointer-arith -Wstrict-prototypes" + GCC_WARNINGS2="-Wmissing-prototypes -Wmissing-declarations" + GCC_WARNINGS3="-Wnested-externs -fno-strict-aliasing" + GCC_WARNINGS="$GCC_WARNINGS1 $GCC_WARNINGS2 $GCC_WARNINGS3" + if test "x$WERROR" = "xyes"; then + GCC_WARNINGS="${GCC_WARNINGS} -Werror" + fi + AMD_CFLAGS="$GCC_WARNINGS $AMD_CFLAGS" +fi + +# Checks for extensions + + SAVE_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -I`pkg-config --variable=sdkdir xorg-server`" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +#include "xorg-server.h" +#if !defined RANDR +#error RANDR not defined +#endif + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + _EXT_CHECK=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + _EXT_CHECK=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + CFLAGS="$SAVE_CFLAGS" + { echo "$as_me:$LINENO: checking if RANDR is defined" >&5 +echo $ECHO_N "checking if RANDR is defined... $ECHO_C" >&6; } + { echo "$as_me:$LINENO: result: $_EXT_CHECK" >&5 +echo "${ECHO_T}$_EXT_CHECK" >&6; } + if test "$_EXT_CHECK" != no; then + REQUIRED_MODULES="$REQUIRED_MODULES randrproto" + fi + + + SAVE_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -I`pkg-config --variable=sdkdir xorg-server`" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +#include "xorg-server.h" +#if !defined RENDER +#error RENDER not defined +#endif + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + _EXT_CHECK=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + _EXT_CHECK=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + CFLAGS="$SAVE_CFLAGS" + { echo "$as_me:$LINENO: checking if RENDER is defined" >&5 +echo $ECHO_N "checking if RENDER is defined... $ECHO_C" >&6; } + { echo "$as_me:$LINENO: result: $_EXT_CHECK" >&5 +echo "${ECHO_T}$_EXT_CHECK" >&6; } + if test "$_EXT_CHECK" != no; then + REQUIRED_MODULES="$REQUIRED_MODULES renderproto" + fi + + + SAVE_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -I`pkg-config --variable=sdkdir xorg-server`" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +#include "xorg-server.h" +#if !defined XV +#error XV not defined +#endif + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + _EXT_CHECK=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + _EXT_CHECK=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + CFLAGS="$SAVE_CFLAGS" + { echo "$as_me:$LINENO: checking if XV is defined" >&5 +echo $ECHO_N "checking if XV is defined... $ECHO_C" >&6; } + { echo "$as_me:$LINENO: result: $_EXT_CHECK" >&5 +echo "${ECHO_T}$_EXT_CHECK" >&6; } + if test "$_EXT_CHECK" != no; then + REQUIRED_MODULES="$REQUIRED_MODULES videoproto" + fi + + + SAVE_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -I`pkg-config --variable=sdkdir xorg-server`" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +#include "xorg-server.h" +#if !defined DPMSExtension +#error DPMSExtension not defined +#endif + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + _EXT_CHECK=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + _EXT_CHECK=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + CFLAGS="$SAVE_CFLAGS" + { echo "$as_me:$LINENO: checking if DPMSExtension is defined" >&5 +echo $ECHO_N "checking if DPMSExtension is defined... $ECHO_C" >&6; } + { echo "$as_me:$LINENO: result: $_EXT_CHECK" >&5 +echo "${ECHO_T}$_EXT_CHECK" >&6; } + if test "$_EXT_CHECK" != no; then + REQUIRED_MODULES="$REQUIRED_MODULES xextproto" + fi + + + SAVE_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -I`pkg-config --variable=sdkdir xorg-server`" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +#include "xorg-server.h" +#if !defined XFreeXDGA +#error XFreeXDGA not defined +#endif + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + _EXT_CHECK=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + _EXT_CHECK=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + CFLAGS="$SAVE_CFLAGS" + { echo "$as_me:$LINENO: checking if XFreeXDGA is defined" >&5 +echo $ECHO_N "checking if XFreeXDGA is defined... $ECHO_C" >&6; } + { echo "$as_me:$LINENO: result: $_EXT_CHECK" >&5 +echo "${ECHO_T}$_EXT_CHECK" >&6; } + if test "$_EXT_CHECK" != no; then + REQUIRED_MODULES="$REQUIRED_MODULES xf86dgaproto" + fi + + +# Checks for pkg-config packages + + +if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args. +set dummy ${ac_tool_prefix}pkg-config; ac_word=$2 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_path_PKG_CONFIG+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + case $PKG_CONFIG in + [\\/]* | ?:[\\/]*) + ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + + ;; +esac +fi +PKG_CONFIG=$ac_cv_path_PKG_CONFIG +if test -n "$PKG_CONFIG"; then + { echo "$as_me:$LINENO: result: $PKG_CONFIG" >&5 +echo "${ECHO_T}$PKG_CONFIG" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + +fi +if test -z "$ac_cv_path_PKG_CONFIG"; then + ac_pt_PKG_CONFIG=$PKG_CONFIG + # Extract the first word of "pkg-config", so it can be a program name with args. +set dummy pkg-config; ac_word=$2 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_path_ac_pt_PKG_CONFIG+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + case $ac_pt_PKG_CONFIG in + [\\/]* | ?:[\\/]*) + ac_cv_path_ac_pt_PKG_CONFIG="$ac_pt_PKG_CONFIG" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_path_ac_pt_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + + ;; +esac +fi +ac_pt_PKG_CONFIG=$ac_cv_path_ac_pt_PKG_CONFIG +if test -n "$ac_pt_PKG_CONFIG"; then + { echo "$as_me:$LINENO: result: $ac_pt_PKG_CONFIG" >&5 +echo "${ECHO_T}$ac_pt_PKG_CONFIG" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + if test "x$ac_pt_PKG_CONFIG" = x; then + PKG_CONFIG="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools +whose name does not start with the host triplet. If you think this +configuration is useful to you, please write to autoconf@gnu.org." >&5 +echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools +whose name does not start with the host triplet. If you think this +configuration is useful to you, please write to autoconf@gnu.org." >&2;} +ac_tool_warned=yes ;; +esac + PKG_CONFIG=$ac_pt_PKG_CONFIG + fi +else + PKG_CONFIG="$ac_cv_path_PKG_CONFIG" +fi + +fi +if test -n "$PKG_CONFIG"; then + _pkg_min_version=0.9.0 + { echo "$as_me:$LINENO: checking pkg-config is at least version $_pkg_min_version" >&5 +echo $ECHO_N "checking pkg-config is at least version $_pkg_min_version... $ECHO_C" >&6; } + if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } + else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } + PKG_CONFIG="" + fi + +fi + +pkg_failed=no +{ echo "$as_me:$LINENO: checking for XORG" >&5 +echo $ECHO_N "checking for XORG... $ECHO_C" >&6; } + +if test -n "$PKG_CONFIG"; then + if test -n "$XORG_CFLAGS"; then + pkg_cv_XORG_CFLAGS="$XORG_CFLAGS" + else + if test -n "$PKG_CONFIG" && \ + { (echo "$as_me:$LINENO: \$PKG_CONFIG --exists --print-errors \"xorg-server xproto fontsproto \$REQUIRED_MODULES\"") >&5 + ($PKG_CONFIG --exists --print-errors "xorg-server xproto fontsproto $REQUIRED_MODULES") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + pkg_cv_XORG_CFLAGS=`$PKG_CONFIG --cflags "xorg-server xproto fontsproto $REQUIRED_MODULES" 2>/dev/null` +else + pkg_failed=yes +fi + fi +else + pkg_failed=untried +fi +if test -n "$PKG_CONFIG"; then + if test -n "$XORG_LIBS"; then + pkg_cv_XORG_LIBS="$XORG_LIBS" + else + if test -n "$PKG_CONFIG" && \ + { (echo "$as_me:$LINENO: \$PKG_CONFIG --exists --print-errors \"xorg-server xproto fontsproto \$REQUIRED_MODULES\"") >&5 + ($PKG_CONFIG --exists --print-errors "xorg-server xproto fontsproto $REQUIRED_MODULES") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + pkg_cv_XORG_LIBS=`$PKG_CONFIG --libs "xorg-server xproto fontsproto $REQUIRED_MODULES" 2>/dev/null` +else + pkg_failed=yes +fi + fi +else + pkg_failed=untried +fi + + + +if test $pkg_failed = yes; then + +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi + if test $_pkg_short_errors_supported = yes; then + XORG_PKG_ERRORS=`$PKG_CONFIG --short-errors --errors-to-stdout --print-errors "xorg-server xproto fontsproto $REQUIRED_MODULES"` + else + XORG_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "xorg-server xproto fontsproto $REQUIRED_MODULES"` + fi + # Put the nasty error message in config.log where it belongs + echo "$XORG_PKG_ERRORS" >&5 + + { { echo "$as_me:$LINENO: error: Package requirements (xorg-server xproto fontsproto $REQUIRED_MODULES) were not met: + +$XORG_PKG_ERRORS + +Consider adjusting the PKG_CONFIG_PATH environment variable if you +installed software in a non-standard prefix. + +Alternatively, you may set the environment variables XORG_CFLAGS +and XORG_LIBS to avoid the need to call pkg-config. +See the pkg-config man page for more details. +" >&5 +echo "$as_me: error: Package requirements (xorg-server xproto fontsproto $REQUIRED_MODULES) were not met: + +$XORG_PKG_ERRORS + +Consider adjusting the PKG_CONFIG_PATH environment variable if you +installed software in a non-standard prefix. + +Alternatively, you may set the environment variables XORG_CFLAGS +and XORG_LIBS to avoid the need to call pkg-config. +See the pkg-config man page for more details. +" >&2;} + { (exit 1); exit 1; }; } +elif test $pkg_failed = untried; then + { { echo "$as_me:$LINENO: error: The pkg-config script could not be found or is too old. Make sure it +is in your PATH or set the PKG_CONFIG environment variable to the full +path to pkg-config. + +Alternatively, you may set the environment variables XORG_CFLAGS +and XORG_LIBS to avoid the need to call pkg-config. +See the pkg-config man page for more details. + +To get pkg-config, see . +See \`config.log' for more details." >&5 +echo "$as_me: error: The pkg-config script could not be found or is too old. Make sure it +is in your PATH or set the PKG_CONFIG environment variable to the full +path to pkg-config. + +Alternatively, you may set the environment variables XORG_CFLAGS +and XORG_LIBS to avoid the need to call pkg-config. +See the pkg-config man page for more details. + +To get pkg-config, see . +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } +else + XORG_CFLAGS=$pkg_cv_XORG_CFLAGS + XORG_LIBS=$pkg_cv_XORG_LIBS + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } + : +fi +sdkdir=$(pkg-config --variable=sdkdir xorg-server) + +# Checks for libraries. +SAVE_CPPFLAGS="$CPPFLAGS" +CPPFLAGS="$CPPFLAGS $XORG_CFLAGS" +{ echo "$as_me:$LINENO: checking whether XSERVER_LIBPCIACCESS is declared" >&5 +echo $ECHO_N "checking whether XSERVER_LIBPCIACCESS is declared... $ECHO_C" >&6; } +if test "${ac_cv_have_decl_XSERVER_LIBPCIACCESS+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include "xorg-server.h" + +int +main () +{ +#ifndef XSERVER_LIBPCIACCESS + (void) XSERVER_LIBPCIACCESS; +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_have_decl_XSERVER_LIBPCIACCESS=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_have_decl_XSERVER_LIBPCIACCESS=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ echo "$as_me:$LINENO: result: $ac_cv_have_decl_XSERVER_LIBPCIACCESS" >&5 +echo "${ECHO_T}$ac_cv_have_decl_XSERVER_LIBPCIACCESS" >&6; } +if test $ac_cv_have_decl_XSERVER_LIBPCIACCESS = yes; then + XSERVER_LIBPCIACCESS=yes +else + XSERVER_LIBPCIACCESS=no +fi + +CPPFLAGS="$SAVE_CPPFLAGS" + +# Checks for header files. +{ echo "$as_me:$LINENO: checking for ANSI C header files" >&5 +echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6; } +if test "${ac_cv_header_stdc+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +#include +#include +#include + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_header_stdc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_header_stdc=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +if test $ac_cv_header_stdc = yes; then + # SunOS 4.x string.h does not declare mem*, contrary to ANSI. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "memchr" >/dev/null 2>&1; then + : +else + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "free" >/dev/null 2>&1; then + : +else + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. + if test "$cross_compiling" = yes; then + : +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +#include +#if ((' ' & 0x0FF) == 0x020) +# define ISLOWER(c) ('a' <= (c) && (c) <= 'z') +# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) +#else +# define ISLOWER(c) \ + (('a' <= (c) && (c) <= 'i') \ + || ('j' <= (c) && (c) <= 'r') \ + || ('s' <= (c) && (c) <= 'z')) +# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) +#endif + +#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) +int +main () +{ + int i; + for (i = 0; i < 256; i++) + if (XOR (islower (i), ISLOWER (i)) + || toupper (i) != TOUPPER (i)) + return 2; + return 0; +} +_ACEOF +rm -f conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + : +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +( exit $ac_status ) +ac_cv_header_stdc=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi + + +fi +fi +{ echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5 +echo "${ECHO_T}$ac_cv_header_stdc" >&6; } +if test $ac_cv_header_stdc = yes; then + +cat >>confdefs.h <<\_ACEOF +#define STDC_HEADERS 1 +_ACEOF + +fi + + +if test "x$XSERVER_LIBPCIACCESS" = xyes; then + +pkg_failed=no +{ echo "$as_me:$LINENO: checking for PCIACCESS" >&5 +echo $ECHO_N "checking for PCIACCESS... $ECHO_C" >&6; } + +if test -n "$PKG_CONFIG"; then + if test -n "$PCIACCESS_CFLAGS"; then + pkg_cv_PCIACCESS_CFLAGS="$PCIACCESS_CFLAGS" + else + if test -n "$PKG_CONFIG" && \ + { (echo "$as_me:$LINENO: \$PKG_CONFIG --exists --print-errors \"pciaccess >= 0.8.0\"") >&5 + ($PKG_CONFIG --exists --print-errors "pciaccess >= 0.8.0") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + pkg_cv_PCIACCESS_CFLAGS=`$PKG_CONFIG --cflags "pciaccess >= 0.8.0" 2>/dev/null` +else + pkg_failed=yes +fi + fi +else + pkg_failed=untried +fi +if test -n "$PKG_CONFIG"; then + if test -n "$PCIACCESS_LIBS"; then + pkg_cv_PCIACCESS_LIBS="$PCIACCESS_LIBS" + else + if test -n "$PKG_CONFIG" && \ + { (echo "$as_me:$LINENO: \$PKG_CONFIG --exists --print-errors \"pciaccess >= 0.8.0\"") >&5 + ($PKG_CONFIG --exists --print-errors "pciaccess >= 0.8.0") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + pkg_cv_PCIACCESS_LIBS=`$PKG_CONFIG --libs "pciaccess >= 0.8.0" 2>/dev/null` +else + pkg_failed=yes +fi + fi +else + pkg_failed=untried +fi + + + +if test $pkg_failed = yes; then + +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi + if test $_pkg_short_errors_supported = yes; then + PCIACCESS_PKG_ERRORS=`$PKG_CONFIG --short-errors --errors-to-stdout --print-errors "pciaccess >= 0.8.0"` + else + PCIACCESS_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "pciaccess >= 0.8.0"` + fi + # Put the nasty error message in config.log where it belongs + echo "$PCIACCESS_PKG_ERRORS" >&5 + + { { echo "$as_me:$LINENO: error: Package requirements (pciaccess >= 0.8.0) were not met: + +$PCIACCESS_PKG_ERRORS + +Consider adjusting the PKG_CONFIG_PATH environment variable if you +installed software in a non-standard prefix. + +Alternatively, you may set the environment variables PCIACCESS_CFLAGS +and PCIACCESS_LIBS to avoid the need to call pkg-config. +See the pkg-config man page for more details. +" >&5 +echo "$as_me: error: Package requirements (pciaccess >= 0.8.0) were not met: + +$PCIACCESS_PKG_ERRORS + +Consider adjusting the PKG_CONFIG_PATH environment variable if you +installed software in a non-standard prefix. + +Alternatively, you may set the environment variables PCIACCESS_CFLAGS +and PCIACCESS_LIBS to avoid the need to call pkg-config. +See the pkg-config man page for more details. +" >&2;} + { (exit 1); exit 1; }; } +elif test $pkg_failed = untried; then + { { echo "$as_me:$LINENO: error: The pkg-config script could not be found or is too old. Make sure it +is in your PATH or set the PKG_CONFIG environment variable to the full +path to pkg-config. + +Alternatively, you may set the environment variables PCIACCESS_CFLAGS +and PCIACCESS_LIBS to avoid the need to call pkg-config. +See the pkg-config man page for more details. + +To get pkg-config, see . +See \`config.log' for more details." >&5 +echo "$as_me: error: The pkg-config script could not be found or is too old. Make sure it +is in your PATH or set the PKG_CONFIG environment variable to the full +path to pkg-config. + +Alternatively, you may set the environment variables PCIACCESS_CFLAGS +and PCIACCESS_LIBS to avoid the need to call pkg-config. +See the pkg-config man page for more details. + +To get pkg-config, see . +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } +else + PCIACCESS_CFLAGS=$pkg_cv_PCIACCESS_CFLAGS + PCIACCESS_LIBS=$pkg_cv_PCIACCESS_LIBS + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } + : +fi + XORG_CFLAGS="$XORG_CFLAGS $PCIACCESS_CFLAGS" +fi + + + + + +is386=false + +case $host_cpu in + i*86) + is386=true + ;; +esac + +# Unset is386 if compiling for AMD64/EM64T +if test $is386 = true ; then + { echo "$as_me:$LINENO: checking whether _LP64 is declared" >&5 +echo $ECHO_N "checking whether _LP64 is declared... $ECHO_C" >&6; } +if test "${ac_cv_have_decl__LP64+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +#ifndef _LP64 + (void) _LP64; +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_have_decl__LP64=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_have_decl__LP64=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ echo "$as_me:$LINENO: result: $ac_cv_have_decl__LP64" >&5 +echo "${ECHO_T}$ac_cv_have_decl__LP64" >&6; } +if test $ac_cv_have_decl__LP64 = yes; then + +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL__LP64 1 +_ACEOF + +is386=false +else + cat >>confdefs.h <<_ACEOF +#define HAVE_DECL__LP64 0 +_ACEOF + + +fi +{ echo "$as_me:$LINENO: checking whether __amd64__ is declared" >&5 +echo $ECHO_N "checking whether __amd64__ is declared... $ECHO_C" >&6; } +if test "${ac_cv_have_decl___amd64__+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +#ifndef __amd64__ + (void) __amd64__; +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_have_decl___amd64__=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_have_decl___amd64__=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ echo "$as_me:$LINENO: result: $ac_cv_have_decl___amd64__" >&5 +echo "${ECHO_T}$ac_cv_have_decl___amd64__" >&6; } +if test $ac_cv_have_decl___amd64__ = yes; then + +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL___AMD64__ 1 +_ACEOF + +is386=false +else + cat >>confdefs.h <<_ACEOF +#define HAVE_DECL___AMD64__ 0 +_ACEOF + + +fi +{ echo "$as_me:$LINENO: checking whether amd64 is declared" >&5 +echo $ECHO_N "checking whether amd64 is declared... $ECHO_C" >&6; } +if test "${ac_cv_have_decl_amd64+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +#ifndef amd64 + (void) amd64; +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_have_decl_amd64=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_have_decl_amd64=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ echo "$as_me:$LINENO: result: $ac_cv_have_decl_amd64" >&5 +echo "${ECHO_T}$ac_cv_have_decl_amd64" >&6; } +if test $ac_cv_have_decl_amd64 = yes; then + +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_AMD64 1 +_ACEOF + +is386=false +else + cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_AMD64 0 +_ACEOF + + +fi + + +fi + + if test $is386 = true; then + I386ARCH_TRUE= + I386ARCH_FALSE='#' +else + I386ARCH_TRUE='#' + I386ARCH_FALSE= +fi + + +DRIVER_NAME=geode + + + + + +if test x$APP_MAN_SUFFIX = x ; then + APP_MAN_SUFFIX=1 +fi +if test x$APP_MAN_DIR = x ; then + APP_MAN_DIR='$(mandir)/man$(APP_MAN_SUFFIX)' +fi + +if test x$LIB_MAN_SUFFIX = x ; then + LIB_MAN_SUFFIX=3 +fi +if test x$LIB_MAN_DIR = x ; then + LIB_MAN_DIR='$(mandir)/man$(LIB_MAN_SUFFIX)' +fi + +if test x$FILE_MAN_SUFFIX = x ; then + case $host_os in + solaris*) FILE_MAN_SUFFIX=4 ;; + *) FILE_MAN_SUFFIX=5 ;; + esac +fi +if test x$FILE_MAN_DIR = x ; then + FILE_MAN_DIR='$(mandir)/man$(FILE_MAN_SUFFIX)' +fi + +if test x$MISC_MAN_SUFFIX = x ; then + case $host_os in + solaris*) MISC_MAN_SUFFIX=5 ;; + *) MISC_MAN_SUFFIX=7 ;; + esac +fi +if test x$MISC_MAN_DIR = x ; then + MISC_MAN_DIR='$(mandir)/man$(MISC_MAN_SUFFIX)' +fi + +if test x$DRIVER_MAN_SUFFIX = x ; then + case $host_os in + solaris*) DRIVER_MAN_SUFFIX=7 ;; + *) DRIVER_MAN_SUFFIX=4 ;; + esac +fi +if test x$DRIVER_MAN_DIR = x ; then + DRIVER_MAN_DIR='$(mandir)/man$(DRIVER_MAN_SUFFIX)' +fi + +if test x$ADMIN_MAN_SUFFIX = x ; then + case $host_os in + solaris*) ADMIN_MAN_SUFFIX=1m ;; + *) ADMIN_MAN_SUFFIX=8 ;; + esac +fi +if test x$ADMIN_MAN_DIR = x ; then + ADMIN_MAN_DIR='$(mandir)/man$(ADMIN_MAN_SUFFIX)' +fi + + + + + + + + + + + + + + + + + +# Check whether --with-release-version was given. +if test "${with_release_version+set}" = set; then + withval=$with_release_version; RELEASE_VERSION="$withval" +else + RELEASE_VERSION="" +fi + + if test "x$RELEASE_VERSION" != "x"; then + PACKAGE="$PACKAGE-$RELEASE_VERSION" + PACKAGE_TARNAME="$PACKAGE_TARNAME-$RELEASE_VERSION" + { echo "$as_me:$LINENO: Building with package name set to $PACKAGE" >&5 +echo "$as_me: Building with package name set to $PACKAGE" >&6;} + fi + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_VERSION_MAJOR `echo $PACKAGE_VERSION | cut -d . -f 1` +_ACEOF + + PVM=`echo $PACKAGE_VERSION | cut -d . -f 2` + if test "x$PVM" = "x"; then + PVM="0" + fi + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_VERSION_MINOR $PVM +_ACEOF + + PVP=`echo $PACKAGE_VERSION | cut -d . -f 3` + if test "x$PVP" = "x"; then + PVP="0" + fi + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_VERSION_PATCHLEVEL $PVP +_ACEOF + + + +ac_config_files="$ac_config_files Makefile src/Makefile" + +cat >confcache <<\_ACEOF +# This file is a shell script that caches the results of configure +# tests run on this system so they can be shared between configure +# scripts and configure runs, see configure's option --config-cache. +# It is not useful on other systems. If it contains results you don't +# want to keep, you may remove or edit it. +# +# config.status only pays attention to the cache file if you give it +# the --recheck option to rerun configure. +# +# `ac_cv_env_foo' variables (set or unset) will be overridden when +# loading this file, other *unset* `ac_cv_foo' will be assigned the +# following values. + +_ACEOF + +# The following way of writing the cache mishandles newlines in values, +# but we know of no workaround that is simple, portable, and efficient. +# So, we kill variables containing newlines. +# Ultrix sh set writes to stderr and can't be redirected directly, +# and sets the high bit in the cache file unless we assign to the vars. +( + for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do + eval ac_val=\$$ac_var + case $ac_val in #( + *${as_nl}*) + case $ac_var in #( + *_cv_*) { echo "$as_me:$LINENO: WARNING: Cache variable $ac_var contains a newline." >&5 +echo "$as_me: WARNING: Cache variable $ac_var contains a newline." >&2;} ;; + esac + case $ac_var in #( + _ | IFS | as_nl) ;; #( + *) $as_unset $ac_var ;; + esac ;; + esac + done + + (set) 2>&1 | + case $as_nl`(ac_space=' '; set) 2>&1` in #( + *${as_nl}ac_space=\ *) + # `set' does not quote correctly, so add quotes (double-quote + # substitution turns \\\\ into \\, and sed turns \\ into \). + sed -n \ + "s/'/'\\\\''/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" + ;; #( + *) + # `set' quotes correctly as required by POSIX, so do not add quotes. + sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" + ;; + esac | + sort +) | + sed ' + /^ac_cv_env_/b end + t clear + :clear + s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ + t end + s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ + :end' >>confcache +if diff "$cache_file" confcache >/dev/null 2>&1; then :; else + if test -w "$cache_file"; then + test "x$cache_file" != "x/dev/null" && + { echo "$as_me:$LINENO: updating cache $cache_file" >&5 +echo "$as_me: updating cache $cache_file" >&6;} + cat confcache >$cache_file + else + { echo "$as_me:$LINENO: not updating unwritable cache $cache_file" >&5 +echo "$as_me: not updating unwritable cache $cache_file" >&6;} + fi +fi +rm -f confcache + +test "x$prefix" = xNONE && prefix=$ac_default_prefix +# Let make expand exec_prefix. +test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' + +DEFS=-DHAVE_CONFIG_H + +ac_libobjs= +ac_ltlibobjs= +for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue + # 1. Remove the extension, and $U if already installed. + ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' + ac_i=`echo "$ac_i" | sed "$ac_script"` + # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR + # will be set to the directory where LIBOBJS objects are built. + ac_libobjs="$ac_libobjs \${LIBOBJDIR}$ac_i\$U.$ac_objext" + ac_ltlibobjs="$ac_ltlibobjs \${LIBOBJDIR}$ac_i"'$U.lo' +done +LIBOBJS=$ac_libobjs + +LTLIBOBJS=$ac_ltlibobjs + + +if test -z "${MAINTAINER_MODE_TRUE}" && test -z "${MAINTAINER_MODE_FALSE}"; then + { { echo "$as_me:$LINENO: error: conditional \"MAINTAINER_MODE\" was never defined. +Usually this means the macro was only invoked conditionally." >&5 +echo "$as_me: error: conditional \"MAINTAINER_MODE\" was never defined. +Usually this means the macro was only invoked conditionally." >&2;} + { (exit 1); exit 1; }; } +fi +if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then + { { echo "$as_me:$LINENO: error: conditional \"AMDEP\" was never defined. +Usually this means the macro was only invoked conditionally." >&5 +echo "$as_me: error: conditional \"AMDEP\" was never defined. +Usually this means the macro was only invoked conditionally." >&2;} + { (exit 1); exit 1; }; } +fi +if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then + { { echo "$as_me:$LINENO: error: conditional \"am__fastdepCC\" was never defined. +Usually this means the macro was only invoked conditionally." >&5 +echo "$as_me: error: conditional \"am__fastdepCC\" was never defined. +Usually this means the macro was only invoked conditionally." >&2;} + { (exit 1); exit 1; }; } +fi +if test -z "${am__fastdepCXX_TRUE}" && test -z "${am__fastdepCXX_FALSE}"; then + { { echo "$as_me:$LINENO: error: conditional \"am__fastdepCXX\" was never defined. +Usually this means the macro was only invoked conditionally." >&5 +echo "$as_me: error: conditional \"am__fastdepCXX\" was never defined. +Usually this means the macro was only invoked conditionally." >&2;} + { (exit 1); exit 1; }; } +fi +if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then + { { echo "$as_me:$LINENO: error: conditional \"am__fastdepCC\" was never defined. +Usually this means the macro was only invoked conditionally." >&5 +echo "$as_me: error: conditional \"am__fastdepCC\" was never defined. +Usually this means the macro was only invoked conditionally." >&2;} + { (exit 1); exit 1; }; } +fi +if test -z "${am__fastdepCCAS_TRUE}" && test -z "${am__fastdepCCAS_FALSE}"; then + { { echo "$as_me:$LINENO: error: conditional \"am__fastdepCCAS\" was never defined. +Usually this means the macro was only invoked conditionally." >&5 +echo "$as_me: error: conditional \"am__fastdepCCAS\" was never defined. +Usually this means the macro was only invoked conditionally." >&2;} + { (exit 1); exit 1; }; } +fi +if test -z "${I386ARCH_TRUE}" && test -z "${I386ARCH_FALSE}"; then + { { echo "$as_me:$LINENO: error: conditional \"I386ARCH\" was never defined. +Usually this means the macro was only invoked conditionally." >&5 +echo "$as_me: error: conditional \"I386ARCH\" was never defined. +Usually this means the macro was only invoked conditionally." >&2;} + { (exit 1); exit 1; }; } +fi + +: ${CONFIG_STATUS=./config.status} +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files $CONFIG_STATUS" +{ echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5 +echo "$as_me: creating $CONFIG_STATUS" >&6;} +cat >$CONFIG_STATUS <<_ACEOF +#! $SHELL +# Generated by $as_me. +# Run this file to recreate the current configuration. +# Compiler output produced by configure, useful for debugging +# configure, is in config.log if it exists. + +debug=false +ac_cs_recheck=false +ac_cs_silent=false +SHELL=\${CONFIG_SHELL-$SHELL} +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF +## --------------------- ## +## M4sh Initialization. ## +## --------------------- ## + +# Be more Bourne compatible +DUALCASE=1; export DUALCASE # for MKS sh +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then + emulate sh + NULLCMD=: + # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' + setopt NO_GLOB_SUBST +else + case `(set -o) 2>/dev/null` in + *posix*) set -o posix ;; +esac + +fi + + + + +# PATH needs CR +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits + +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + echo "#! /bin/sh" >conf$$.sh + echo "exit 0" >>conf$$.sh + chmod +x conf$$.sh + if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then + PATH_SEPARATOR=';' + else + PATH_SEPARATOR=: + fi + rm -f conf$$.sh +fi + +# Support unset when possible. +if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then + as_unset=unset +else + as_unset=false +fi + + +# IFS +# We need space, tab and new line, in precisely that order. Quoting is +# there to prevent editors from complaining about space-tab. +# (If _AS_PATH_WALK were called with IFS unset, it would disable word +# splitting by setting IFS to empty value.) +as_nl=' +' +IFS=" "" $as_nl" + +# Find who we are. Look in the path if we contain no directory separator. +case $0 in + *[\\/]* ) as_myself=$0 ;; + *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break +done +IFS=$as_save_IFS + + ;; +esac +# We did not find ourselves, most probably we were run as `sh COMMAND' +# in which case we are not to be found in the path. +if test "x$as_myself" = x; then + as_myself=$0 +fi +if test ! -f "$as_myself"; then + echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 + { (exit 1); exit 1; } +fi + +# Work around bugs in pre-3.0 UWIN ksh. +for as_var in ENV MAIL MAILPATH +do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var +done +PS1='$ ' +PS2='> ' +PS4='+ ' + +# NLS nuisances. +for as_var in \ + LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ + LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ + LC_TELEPHONE LC_TIME +do + if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then + eval $as_var=C; export $as_var + else + ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var + fi +done + +# Required to use basename. +if expr a : '\(a\)' >/dev/null 2>&1 && + test "X`expr 00001 : '.*\(...\)'`" = X001; then + as_expr=expr +else + as_expr=false +fi + +if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then + as_basename=basename +else + as_basename=false +fi + + +# Name of the executable. +as_me=`$as_basename -- "$0" || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)' \| . 2>/dev/null || +echo X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ + s//\1/ + q + } + /^X\/\(\/\/\)$/{ + s//\1/ + q + } + /^X\/\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + +# CDPATH. +$as_unset CDPATH + + + + as_lineno_1=$LINENO + as_lineno_2=$LINENO + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || { + + # Create $as_me.lineno as a copy of $as_myself, but with $LINENO + # uniformly replaced by the line number. The first 'sed' inserts a + # line-number line after each line using $LINENO; the second 'sed' + # does the real work. The second script uses 'N' to pair each + # line-number line with the line containing $LINENO, and appends + # trailing '-' during substitution so that $LINENO is not a special + # case at line end. + # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the + # scripts with optimization help from Paolo Bonzini. Blame Lee + # E. McMahon (1931-1989) for sed's syntax. :-) + sed -n ' + p + /[$]LINENO/= + ' <$as_myself | + sed ' + s/[$]LINENO.*/&-/ + t lineno + b + :lineno + N + :loop + s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ + t loop + s/-\n.*// + ' >$as_me.lineno && + chmod +x "$as_me.lineno" || + { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 + { (exit 1); exit 1; }; } + + # Don't try to exec as it changes $[0], causing all sort of problems + # (the dirname of $[0] is not the place where we might find the + # original and so on. Autoconf is especially sensitive to this). + . "./$as_me.lineno" + # Exit status is that of the last command. + exit +} + + +if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then + as_dirname=dirname +else + as_dirname=false +fi + +ECHO_C= ECHO_N= ECHO_T= +case `echo -n x` in +-n*) + case `echo 'x\c'` in + *c*) ECHO_T=' ';; # ECHO_T is single tab character. + *) ECHO_C='\c';; + esac;; +*) + ECHO_N='-n';; +esac + +if expr a : '\(a\)' >/dev/null 2>&1 && + test "X`expr 00001 : '.*\(...\)'`" = X001; then + as_expr=expr +else + as_expr=false +fi + +rm -f conf$$ conf$$.exe conf$$.file +if test -d conf$$.dir; then + rm -f conf$$.dir/conf$$.file +else + rm -f conf$$.dir + mkdir conf$$.dir +fi +echo >conf$$.file +if ln -s conf$$.file conf$$ 2>/dev/null; then + as_ln_s='ln -s' + # ... but there are two gotchas: + # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. + # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. + # In both cases, we have to default to `cp -p'. + ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || + as_ln_s='cp -p' +elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln +else + as_ln_s='cp -p' +fi +rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file +rmdir conf$$.dir 2>/dev/null + +if mkdir -p . 2>/dev/null; then + as_mkdir_p=: +else + test -d ./-p && rmdir ./-p + as_mkdir_p=false +fi + +if test -x / >/dev/null 2>&1; then + as_test_x='test -x' +else + if ls -dL / >/dev/null 2>&1; then + as_ls_L_option=L + else + as_ls_L_option= + fi + as_test_x=' + eval sh -c '\'' + if test -d "$1"; then + test -d "$1/."; + else + case $1 in + -*)set "./$1";; + esac; + case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in + ???[sx]*):;;*)false;;esac;fi + '\'' sh + ' +fi +as_executable_p=$as_test_x + +# Sed expression to map a string onto a valid CPP name. +as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" + +# Sed expression to map a string onto a valid variable name. +as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" + + +exec 6>&1 + +# Save the log message, to keep $[0] and so on meaningful, and to +# report actual input values of CONFIG_FILES etc. instead of their +# values after options handling. +ac_log=" +This file was extended by xf86-video-geode $as_me 2.10.0, which was +generated by GNU Autoconf 2.61. Invocation command line was + + CONFIG_FILES = $CONFIG_FILES + CONFIG_HEADERS = $CONFIG_HEADERS + CONFIG_LINKS = $CONFIG_LINKS + CONFIG_COMMANDS = $CONFIG_COMMANDS + $ $0 $@ + +on `(hostname || uname -n) 2>/dev/null | sed 1q` +" + +_ACEOF + +cat >>$CONFIG_STATUS <<_ACEOF +# Files that config.status was made for. +config_files="$ac_config_files" +config_headers="$ac_config_headers" +config_commands="$ac_config_commands" + +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF +ac_cs_usage="\ +\`$as_me' instantiates files from templates according to the +current configuration. + +Usage: $0 [OPTIONS] [FILE]... + + -h, --help print this help, then exit + -V, --version print version number and configuration settings, then exit + -q, --quiet do not print progress messages + -d, --debug don't remove temporary files + --recheck update $as_me by reconfiguring in the same conditions + --file=FILE[:TEMPLATE] + instantiate the configuration file FILE + --header=FILE[:TEMPLATE] + instantiate the configuration header FILE + +Configuration files: +$config_files + +Configuration headers: +$config_headers + +Configuration commands: +$config_commands + +Report bugs to ." + +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF +ac_cs_version="\\ +xf86-video-geode config.status 2.10.0 +configured by $0, generated by GNU Autoconf 2.61, + with options \\"`echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\" + +Copyright (C) 2006 Free Software Foundation, Inc. +This config.status script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it." + +ac_pwd='$ac_pwd' +srcdir='$srcdir' +INSTALL='$INSTALL' +MKDIR_P='$MKDIR_P' +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF +# If no file are specified by the user, then we need to provide default +# value. By we need to know if files were specified by the user. +ac_need_defaults=: +while test $# != 0 +do + case $1 in + --*=*) + ac_option=`expr "X$1" : 'X\([^=]*\)='` + ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` + ac_shift=: + ;; + *) + ac_option=$1 + ac_optarg=$2 + ac_shift=shift + ;; + esac + + case $ac_option in + # Handling of the options. + -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) + ac_cs_recheck=: ;; + --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) + echo "$ac_cs_version"; exit ;; + --debug | --debu | --deb | --de | --d | -d ) + debug=: ;; + --file | --fil | --fi | --f ) + $ac_shift + CONFIG_FILES="$CONFIG_FILES $ac_optarg" + ac_need_defaults=false;; + --header | --heade | --head | --hea ) + $ac_shift + CONFIG_HEADERS="$CONFIG_HEADERS $ac_optarg" + ac_need_defaults=false;; + --he | --h) + # Conflict between --help and --header + { echo "$as_me: error: ambiguous option: $1 +Try \`$0 --help' for more information." >&2 + { (exit 1); exit 1; }; };; + --help | --hel | -h ) + echo "$ac_cs_usage"; exit ;; + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil | --si | --s) + ac_cs_silent=: ;; + + # This is an error. + -*) { echo "$as_me: error: unrecognized option: $1 +Try \`$0 --help' for more information." >&2 + { (exit 1); exit 1; }; } ;; + + *) ac_config_targets="$ac_config_targets $1" + ac_need_defaults=false ;; + + esac + shift +done + +ac_configure_extra_args= + +if $ac_cs_silent; then + exec 6>/dev/null + ac_configure_extra_args="$ac_configure_extra_args --silent" +fi + +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF +if \$ac_cs_recheck; then + echo "running CONFIG_SHELL=$SHELL $SHELL $0 "$ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6 + CONFIG_SHELL=$SHELL + export CONFIG_SHELL + exec $SHELL "$0"$ac_configure_args \$ac_configure_extra_args --no-create --no-recursion +fi + +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF +exec 5>>config.log +{ + echo + sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX +## Running $as_me. ## +_ASBOX + echo "$ac_log" +} >&5 + +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF +# +# INIT-COMMANDS +# +AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir" + +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF + +# Handling of arguments. +for ac_config_target in $ac_config_targets +do + case $ac_config_target in + "config.h") CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;; + "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;; + "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; + "src/Makefile") CONFIG_FILES="$CONFIG_FILES src/Makefile" ;; + + *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5 +echo "$as_me: error: invalid argument: $ac_config_target" >&2;} + { (exit 1); exit 1; }; };; + esac +done + + +# If the user did not use the arguments to specify the items to instantiate, +# then the envvar interface is used. Set only those that are not. +# We use the long form for the default assignment because of an extremely +# bizarre bug on SunOS 4.1.3. +if $ac_need_defaults; then + test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files + test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers + test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands +fi + +# Have a temporary directory for convenience. Make it in the build tree +# simply because there is no reason against having it here, and in addition, +# creating and moving files from /tmp can sometimes cause problems. +# Hook for its removal unless debugging. +# Note that there is a small window in which the directory will not be cleaned: +# after its creation but before its name has been assigned to `$tmp'. +$debug || +{ + tmp= + trap 'exit_status=$? + { test -z "$tmp" || test ! -d "$tmp" || rm -fr "$tmp"; } && exit $exit_status +' 0 + trap '{ (exit 1); exit 1; }' 1 2 13 15 +} +# Create a (secure) tmp directory for tmp files. + +{ + tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && + test -n "$tmp" && test -d "$tmp" +} || +{ + tmp=./conf$$-$RANDOM + (umask 077 && mkdir "$tmp") +} || +{ + echo "$me: cannot create a temporary directory in ." >&2 + { (exit 1); exit 1; } +} + +# +# Set up the sed scripts for CONFIG_FILES section. +# + +# No need to generate the scripts if there are no CONFIG_FILES. +# This happens for instance when ./config.status config.h +if test -n "$CONFIG_FILES"; then + +_ACEOF + + + +ac_delim='%!_!# ' +for ac_last_try in false false false false false :; do + cat >conf$$subs.sed <<_ACEOF +SHELL!$SHELL$ac_delim +PATH_SEPARATOR!$PATH_SEPARATOR$ac_delim +PACKAGE_NAME!$PACKAGE_NAME$ac_delim +PACKAGE_TARNAME!$PACKAGE_TARNAME$ac_delim +PACKAGE_VERSION!$PACKAGE_VERSION$ac_delim +PACKAGE_STRING!$PACKAGE_STRING$ac_delim +PACKAGE_BUGREPORT!$PACKAGE_BUGREPORT$ac_delim +exec_prefix!$exec_prefix$ac_delim +prefix!$prefix$ac_delim +program_transform_name!$program_transform_name$ac_delim +bindir!$bindir$ac_delim +sbindir!$sbindir$ac_delim +libexecdir!$libexecdir$ac_delim +datarootdir!$datarootdir$ac_delim +datadir!$datadir$ac_delim +sysconfdir!$sysconfdir$ac_delim +sharedstatedir!$sharedstatedir$ac_delim +localstatedir!$localstatedir$ac_delim +includedir!$includedir$ac_delim +oldincludedir!$oldincludedir$ac_delim +docdir!$docdir$ac_delim +infodir!$infodir$ac_delim +htmldir!$htmldir$ac_delim +dvidir!$dvidir$ac_delim +pdfdir!$pdfdir$ac_delim +psdir!$psdir$ac_delim +libdir!$libdir$ac_delim +localedir!$localedir$ac_delim +mandir!$mandir$ac_delim +DEFS!$DEFS$ac_delim +ECHO_C!$ECHO_C$ac_delim +ECHO_N!$ECHO_N$ac_delim +ECHO_T!$ECHO_T$ac_delim +LIBS!$LIBS$ac_delim +build_alias!$build_alias$ac_delim +host_alias!$host_alias$ac_delim +target_alias!$target_alias$ac_delim +INSTALL_PROGRAM!$INSTALL_PROGRAM$ac_delim +INSTALL_SCRIPT!$INSTALL_SCRIPT$ac_delim +INSTALL_DATA!$INSTALL_DATA$ac_delim +am__isrc!$am__isrc$ac_delim +CYGPATH_W!$CYGPATH_W$ac_delim +PACKAGE!$PACKAGE$ac_delim +VERSION!$VERSION$ac_delim +ACLOCAL!$ACLOCAL$ac_delim +AUTOCONF!$AUTOCONF$ac_delim +AUTOMAKE!$AUTOMAKE$ac_delim +AUTOHEADER!$AUTOHEADER$ac_delim +MAKEINFO!$MAKEINFO$ac_delim +install_sh!$install_sh$ac_delim +STRIP!$STRIP$ac_delim +INSTALL_STRIP_PROGRAM!$INSTALL_STRIP_PROGRAM$ac_delim +mkdir_p!$mkdir_p$ac_delim +AWK!$AWK$ac_delim +SET_MAKE!$SET_MAKE$ac_delim +am__leading_dot!$am__leading_dot$ac_delim +AMTAR!$AMTAR$ac_delim +am__tar!$am__tar$ac_delim +am__untar!$am__untar$ac_delim +MAINTAINER_MODE_TRUE!$MAINTAINER_MODE_TRUE$ac_delim +MAINTAINER_MODE_FALSE!$MAINTAINER_MODE_FALSE$ac_delim +MAINT!$MAINT$ac_delim +build!$build$ac_delim +build_cpu!$build_cpu$ac_delim +build_vendor!$build_vendor$ac_delim +build_os!$build_os$ac_delim +host!$host$ac_delim +host_cpu!$host_cpu$ac_delim +host_vendor!$host_vendor$ac_delim +host_os!$host_os$ac_delim +CC!$CC$ac_delim +CFLAGS!$CFLAGS$ac_delim +LDFLAGS!$LDFLAGS$ac_delim +CPPFLAGS!$CPPFLAGS$ac_delim +ac_ct_CC!$ac_ct_CC$ac_delim +EXEEXT!$EXEEXT$ac_delim +OBJEXT!$OBJEXT$ac_delim +DEPDIR!$DEPDIR$ac_delim +am__include!$am__include$ac_delim +am__quote!$am__quote$ac_delim +AMDEP_TRUE!$AMDEP_TRUE$ac_delim +AMDEP_FALSE!$AMDEP_FALSE$ac_delim +AMDEPBACKSLASH!$AMDEPBACKSLASH$ac_delim +CCDEPMODE!$CCDEPMODE$ac_delim +am__fastdepCC_TRUE!$am__fastdepCC_TRUE$ac_delim +am__fastdepCC_FALSE!$am__fastdepCC_FALSE$ac_delim +SED!$SED$ac_delim +GREP!$GREP$ac_delim +EGREP!$EGREP$ac_delim +LN_S!$LN_S$ac_delim +ECHO!$ECHO$ac_delim +AR!$AR$ac_delim +RANLIB!$RANLIB$ac_delim +CPP!$CPP$ac_delim +CXX!$CXX$ac_delim +CXXFLAGS!$CXXFLAGS$ac_delim +ac_ct_CXX!$ac_ct_CXX$ac_delim +_ACEOF + + if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 97; then + break + elif $ac_last_try; then + { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 +echo "$as_me: error: could not make $CONFIG_STATUS" >&2;} + { (exit 1); exit 1; }; } + else + ac_delim="$ac_delim!$ac_delim _$ac_delim!! " + fi +done + +ac_eof=`sed -n '/^CEOF[0-9]*$/s/CEOF/0/p' conf$$subs.sed` +if test -n "$ac_eof"; then + ac_eof=`echo "$ac_eof" | sort -nru | sed 1q` + ac_eof=`expr $ac_eof + 1` +fi + +cat >>$CONFIG_STATUS <<_ACEOF +cat >"\$tmp/subs-1.sed" <<\CEOF$ac_eof +/@[a-zA-Z_][a-zA-Z_0-9]*@/!b +_ACEOF +sed ' +s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g +s/^/s,@/; s/!/@,|#_!!_#|/ +:n +t n +s/'"$ac_delim"'$/,g/; t +s/$/\\/; p +N; s/^.*\n//; s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g; b n +' >>$CONFIG_STATUS >$CONFIG_STATUS <<_ACEOF +CEOF$ac_eof +_ACEOF + + +ac_delim='%!_!# ' +for ac_last_try in false false false false false :; do + cat >conf$$subs.sed <<_ACEOF +CXXDEPMODE!$CXXDEPMODE$ac_delim +am__fastdepCXX_TRUE!$am__fastdepCXX_TRUE$ac_delim +am__fastdepCXX_FALSE!$am__fastdepCXX_FALSE$ac_delim +CXXCPP!$CXXCPP$ac_delim +F77!$F77$ac_delim +FFLAGS!$FFLAGS$ac_delim +ac_ct_F77!$ac_ct_F77$ac_delim +LIBTOOL!$LIBTOOL$ac_delim +CCAS!$CCAS$ac_delim +CCASFLAGS!$CCASFLAGS$ac_delim +CCASDEPMODE!$CCASDEPMODE$ac_delim +am__fastdepCCAS_TRUE!$am__fastdepCCAS_TRUE$ac_delim +am__fastdepCCAS_FALSE!$am__fastdepCCAS_FALSE$ac_delim +PKG_CONFIG!$PKG_CONFIG$ac_delim +XORG_CFLAGS!$XORG_CFLAGS$ac_delim +XORG_LIBS!$XORG_LIBS$ac_delim +PCIACCESS_CFLAGS!$PCIACCESS_CFLAGS$ac_delim +PCIACCESS_LIBS!$PCIACCESS_LIBS$ac_delim +moduledir!$moduledir$ac_delim +AMD_CFLAGS!$AMD_CFLAGS$ac_delim +I386ARCH_TRUE!$I386ARCH_TRUE$ac_delim +I386ARCH_FALSE!$I386ARCH_FALSE$ac_delim +DRIVER_NAME!$DRIVER_NAME$ac_delim +APP_MAN_SUFFIX!$APP_MAN_SUFFIX$ac_delim +LIB_MAN_SUFFIX!$LIB_MAN_SUFFIX$ac_delim +FILE_MAN_SUFFIX!$FILE_MAN_SUFFIX$ac_delim +MISC_MAN_SUFFIX!$MISC_MAN_SUFFIX$ac_delim +DRIVER_MAN_SUFFIX!$DRIVER_MAN_SUFFIX$ac_delim +ADMIN_MAN_SUFFIX!$ADMIN_MAN_SUFFIX$ac_delim +APP_MAN_DIR!$APP_MAN_DIR$ac_delim +LIB_MAN_DIR!$LIB_MAN_DIR$ac_delim +FILE_MAN_DIR!$FILE_MAN_DIR$ac_delim +MISC_MAN_DIR!$MISC_MAN_DIR$ac_delim +DRIVER_MAN_DIR!$DRIVER_MAN_DIR$ac_delim +ADMIN_MAN_DIR!$ADMIN_MAN_DIR$ac_delim +LIBOBJS!$LIBOBJS$ac_delim +LTLIBOBJS!$LTLIBOBJS$ac_delim +_ACEOF + + if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 37; then + break + elif $ac_last_try; then + { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 +echo "$as_me: error: could not make $CONFIG_STATUS" >&2;} + { (exit 1); exit 1; }; } + else + ac_delim="$ac_delim!$ac_delim _$ac_delim!! " + fi +done + +ac_eof=`sed -n '/^CEOF[0-9]*$/s/CEOF/0/p' conf$$subs.sed` +if test -n "$ac_eof"; then + ac_eof=`echo "$ac_eof" | sort -nru | sed 1q` + ac_eof=`expr $ac_eof + 1` +fi + +cat >>$CONFIG_STATUS <<_ACEOF +cat >"\$tmp/subs-2.sed" <<\CEOF$ac_eof +/@[a-zA-Z_][a-zA-Z_0-9]*@/!b end +_ACEOF +sed ' +s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g +s/^/s,@/; s/!/@,|#_!!_#|/ +:n +t n +s/'"$ac_delim"'$/,g/; t +s/$/\\/; p +N; s/^.*\n//; s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g; b n +' >>$CONFIG_STATUS >$CONFIG_STATUS <<_ACEOF +:end +s/|#_!!_#|//g +CEOF$ac_eof +_ACEOF + + +# VPATH may cause trouble with some makes, so we remove $(srcdir), +# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and +# trailing colons and then remove the whole line if VPATH becomes empty +# (actually we leave an empty line to preserve line numbers). +if test "x$srcdir" = x.; then + ac_vpsub='/^[ ]*VPATH[ ]*=/{ +s/:*\$(srcdir):*/:/ +s/:*\${srcdir}:*/:/ +s/:*@srcdir@:*/:/ +s/^\([^=]*=[ ]*\):*/\1/ +s/:*$// +s/^[^=]*=[ ]*$// +}' +fi + +cat >>$CONFIG_STATUS <<\_ACEOF +fi # test -n "$CONFIG_FILES" + + +for ac_tag in :F $CONFIG_FILES :H $CONFIG_HEADERS :C $CONFIG_COMMANDS +do + case $ac_tag in + :[FHLC]) ac_mode=$ac_tag; continue;; + esac + case $ac_mode$ac_tag in + :[FHL]*:*);; + :L* | :C*:*) { { echo "$as_me:$LINENO: error: Invalid tag $ac_tag." >&5 +echo "$as_me: error: Invalid tag $ac_tag." >&2;} + { (exit 1); exit 1; }; };; + :[FH]-) ac_tag=-:-;; + :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; + esac + ac_save_IFS=$IFS + IFS=: + set x $ac_tag + IFS=$ac_save_IFS + shift + ac_file=$1 + shift + + case $ac_mode in + :L) ac_source=$1;; + :[FH]) + ac_file_inputs= + for ac_f + do + case $ac_f in + -) ac_f="$tmp/stdin";; + *) # Look for the file first in the build tree, then in the source tree + # (if the path is not absolute). The absolute path cannot be DOS-style, + # because $ac_f cannot contain `:'. + test -f "$ac_f" || + case $ac_f in + [\\/$]*) false;; + *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; + esac || + { { echo "$as_me:$LINENO: error: cannot find input file: $ac_f" >&5 +echo "$as_me: error: cannot find input file: $ac_f" >&2;} + { (exit 1); exit 1; }; };; + esac + ac_file_inputs="$ac_file_inputs $ac_f" + done + + # Let's still pretend it is `configure' which instantiates (i.e., don't + # use $as_me), people would be surprised to read: + # /* config.h. Generated by config.status. */ + configure_input="Generated from "`IFS=: + echo $* | sed 's|^[^:]*/||;s|:[^:]*/|, |g'`" by configure." + if test x"$ac_file" != x-; then + configure_input="$ac_file. $configure_input" + { echo "$as_me:$LINENO: creating $ac_file" >&5 +echo "$as_me: creating $ac_file" >&6;} + fi + + case $ac_tag in + *:-:* | *:-) cat >"$tmp/stdin";; + esac + ;; + esac + + ac_dir=`$as_dirname -- "$ac_file" || +$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$ac_file" : 'X\(//\)[^/]' \| \ + X"$ac_file" : 'X\(//\)$' \| \ + X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || +echo X"$ac_file" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + { as_dir="$ac_dir" + case $as_dir in #( + -*) as_dir=./$as_dir;; + esac + test -d "$as_dir" || { $as_mkdir_p && mkdir -p "$as_dir"; } || { + as_dirs= + while :; do + case $as_dir in #( + *\'*) as_qdir=`echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #( + *) as_qdir=$as_dir;; + esac + as_dirs="'$as_qdir' $as_dirs" + as_dir=`$as_dirname -- "$as_dir" || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || +echo X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + test -d "$as_dir" && break + done + test -z "$as_dirs" || eval "mkdir $as_dirs" + } || test -d "$as_dir" || { { echo "$as_me:$LINENO: error: cannot create directory $as_dir" >&5 +echo "$as_me: error: cannot create directory $as_dir" >&2;} + { (exit 1); exit 1; }; }; } + ac_builddir=. + +case "$ac_dir" in +.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; +*) + ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` + # A ".." for each directory in $ac_dir_suffix. + ac_top_builddir_sub=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,/..,g;s,/,,'` + case $ac_top_builddir_sub in + "") ac_top_builddir_sub=. ac_top_build_prefix= ;; + *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; + esac ;; +esac +ac_abs_top_builddir=$ac_pwd +ac_abs_builddir=$ac_pwd$ac_dir_suffix +# for backward compatibility: +ac_top_builddir=$ac_top_build_prefix + +case $srcdir in + .) # We are building in place. + ac_srcdir=. + ac_top_srcdir=$ac_top_builddir_sub + ac_abs_top_srcdir=$ac_pwd ;; + [\\/]* | ?:[\\/]* ) # Absolute name. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir + ac_abs_top_srcdir=$srcdir ;; + *) # Relative name. + ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_build_prefix$srcdir + ac_abs_top_srcdir=$ac_pwd/$srcdir ;; +esac +ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix + + + case $ac_mode in + :F) + # + # CONFIG_FILE + # + + case $INSTALL in + [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; + *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;; + esac + ac_MKDIR_P=$MKDIR_P + case $MKDIR_P in + [\\/$]* | ?:[\\/]* ) ;; + */*) ac_MKDIR_P=$ac_top_build_prefix$MKDIR_P ;; + esac +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF +# If the template does not know about datarootdir, expand it. +# FIXME: This hack should be removed a few years after 2.60. +ac_datarootdir_hack=; ac_datarootdir_seen= + +case `sed -n '/datarootdir/ { + p + q +} +/@datadir@/p +/@docdir@/p +/@infodir@/p +/@localedir@/p +/@mandir@/p +' $ac_file_inputs` in +*datarootdir*) ac_datarootdir_seen=yes;; +*@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) + { echo "$as_me:$LINENO: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 +echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF + ac_datarootdir_hack=' + s&@datadir@&$datadir&g + s&@docdir@&$docdir&g + s&@infodir@&$infodir&g + s&@localedir@&$localedir&g + s&@mandir@&$mandir&g + s&\\\${datarootdir}&$datarootdir&g' ;; +esac +_ACEOF + +# Neutralize VPATH when `$srcdir' = `.'. +# Shell code in configure.ac might set extrasub. +# FIXME: do we really want to maintain this feature? +cat >>$CONFIG_STATUS <<_ACEOF + sed "$ac_vpsub +$extrasub +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF +:t +/@[a-zA-Z_][a-zA-Z_0-9]*@/!b +s&@configure_input@&$configure_input&;t t +s&@top_builddir@&$ac_top_builddir_sub&;t t +s&@srcdir@&$ac_srcdir&;t t +s&@abs_srcdir@&$ac_abs_srcdir&;t t +s&@top_srcdir@&$ac_top_srcdir&;t t +s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t +s&@builddir@&$ac_builddir&;t t +s&@abs_builddir@&$ac_abs_builddir&;t t +s&@abs_top_builddir@&$ac_abs_top_builddir&;t t +s&@INSTALL@&$ac_INSTALL&;t t +s&@MKDIR_P@&$ac_MKDIR_P&;t t +$ac_datarootdir_hack +" $ac_file_inputs | sed -f "$tmp/subs-1.sed" | sed -f "$tmp/subs-2.sed" >$tmp/out + +test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && + { ac_out=`sed -n '/\${datarootdir}/p' "$tmp/out"`; test -n "$ac_out"; } && + { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' "$tmp/out"`; test -z "$ac_out"; } && + { echo "$as_me:$LINENO: WARNING: $ac_file contains a reference to the variable \`datarootdir' +which seems to be undefined. Please make sure it is defined." >&5 +echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' +which seems to be undefined. Please make sure it is defined." >&2;} + + rm -f "$tmp/stdin" + case $ac_file in + -) cat "$tmp/out"; rm -f "$tmp/out";; + *) rm -f "$ac_file"; mv "$tmp/out" $ac_file;; + esac + ;; + :H) + # + # CONFIG_HEADER + # +_ACEOF + +# Transform confdefs.h into a sed script `conftest.defines', that +# substitutes the proper values into config.h.in to produce config.h. +rm -f conftest.defines conftest.tail +# First, append a space to every undef/define line, to ease matching. +echo 's/$/ /' >conftest.defines +# Then, protect against being on the right side of a sed subst, or in +# an unquoted here document, in config.status. If some macros were +# called several times there might be several #defines for the same +# symbol, which is useless. But do not sort them, since the last +# AC_DEFINE must be honored. +ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]* +# These sed commands are passed to sed as "A NAME B PARAMS C VALUE D", where +# NAME is the cpp macro being defined, VALUE is the value it is being given. +# PARAMS is the parameter list in the macro definition--in most cases, it's +# just an empty string. +ac_dA='s,^\\([ #]*\\)[^ ]*\\([ ]*' +ac_dB='\\)[ (].*,\\1define\\2' +ac_dC=' ' +ac_dD=' ,' + +uniq confdefs.h | + sed -n ' + t rset + :rset + s/^[ ]*#[ ]*define[ ][ ]*// + t ok + d + :ok + s/[\\&,]/\\&/g + s/^\('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/ '"$ac_dA"'\1'"$ac_dB"'\2'"${ac_dC}"'\3'"$ac_dD"'/p + s/^\('"$ac_word_re"'\)[ ]*\(.*\)/'"$ac_dA"'\1'"$ac_dB$ac_dC"'\2'"$ac_dD"'/p + ' >>conftest.defines + +# Remove the space that was appended to ease matching. +# Then replace #undef with comments. This is necessary, for +# example, in the case of _POSIX_SOURCE, which is predefined and required +# on some systems where configure will not decide to define it. +# (The regexp can be short, since the line contains either #define or #undef.) +echo 's/ $// +s,^[ #]*u.*,/* & */,' >>conftest.defines + +# Break up conftest.defines: +ac_max_sed_lines=50 + +# First sed command is: sed -f defines.sed $ac_file_inputs >"$tmp/out1" +# Second one is: sed -f defines.sed "$tmp/out1" >"$tmp/out2" +# Third one will be: sed -f defines.sed "$tmp/out2" >"$tmp/out1" +# et cetera. +ac_in='$ac_file_inputs' +ac_out='"$tmp/out1"' +ac_nxt='"$tmp/out2"' + +while : +do + # Write a here document: + cat >>$CONFIG_STATUS <<_ACEOF + # First, check the format of the line: + cat >"\$tmp/defines.sed" <<\\CEOF +/^[ ]*#[ ]*undef[ ][ ]*$ac_word_re[ ]*\$/b def +/^[ ]*#[ ]*define[ ][ ]*$ac_word_re[( ]/b def +b +:def +_ACEOF + sed ${ac_max_sed_lines}q conftest.defines >>$CONFIG_STATUS + echo 'CEOF + sed -f "$tmp/defines.sed"' "$ac_in >$ac_out" >>$CONFIG_STATUS + ac_in=$ac_out; ac_out=$ac_nxt; ac_nxt=$ac_in + sed 1,${ac_max_sed_lines}d conftest.defines >conftest.tail + grep . conftest.tail >/dev/null || break + rm -f conftest.defines + mv conftest.tail conftest.defines +done +rm -f conftest.defines conftest.tail + +echo "ac_result=$ac_in" >>$CONFIG_STATUS +cat >>$CONFIG_STATUS <<\_ACEOF + if test x"$ac_file" != x-; then + echo "/* $configure_input */" >"$tmp/config.h" + cat "$ac_result" >>"$tmp/config.h" + if diff $ac_file "$tmp/config.h" >/dev/null 2>&1; then + { echo "$as_me:$LINENO: $ac_file is unchanged" >&5 +echo "$as_me: $ac_file is unchanged" >&6;} + else + rm -f $ac_file + mv "$tmp/config.h" $ac_file + fi + else + echo "/* $configure_input */" + cat "$ac_result" + fi + rm -f "$tmp/out12" +# Compute $ac_file's index in $config_headers. +_am_stamp_count=1 +for _am_header in $config_headers :; do + case $_am_header in + $ac_file | $ac_file:* ) + break ;; + * ) + _am_stamp_count=`expr $_am_stamp_count + 1` ;; + esac +done +echo "timestamp for $ac_file" >`$as_dirname -- $ac_file || +$as_expr X$ac_file : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X$ac_file : 'X\(//\)[^/]' \| \ + X$ac_file : 'X\(//\)$' \| \ + X$ac_file : 'X\(/\)' \| . 2>/dev/null || +echo X$ac_file | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'`/stamp-h$_am_stamp_count + ;; + + :C) { echo "$as_me:$LINENO: executing $ac_file commands" >&5 +echo "$as_me: executing $ac_file commands" >&6;} + ;; + esac + + + case $ac_file$ac_mode in + "depfiles":C) test x"$AMDEP_TRUE" != x"" || for mf in $CONFIG_FILES; do + # Strip MF so we end up with the name of the file. + mf=`echo "$mf" | sed -e 's/:.*$//'` + # Check whether this is an Automake generated Makefile or not. + # We used to match only the files named `Makefile.in', but + # some people rename them; so instead we look at the file content. + # Grep'ing the first line is not enough: some people post-process + # each Makefile.in and add a new line on top of each file to say so. + # Grep'ing the whole file is not good either: AIX grep has a line + # limit of 2048, but all sed's we know have understand at least 4000. + if sed 10q "$mf" | grep '^#.*generated by automake' > /dev/null 2>&1; then + dirpart=`$as_dirname -- "$mf" || +$as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$mf" : 'X\(//\)[^/]' \| \ + X"$mf" : 'X\(//\)$' \| \ + X"$mf" : 'X\(/\)' \| . 2>/dev/null || +echo X"$mf" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + else + continue + fi + # Extract the definition of DEPDIR, am__include, and am__quote + # from the Makefile without running `make'. + DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` + test -z "$DEPDIR" && continue + am__include=`sed -n 's/^am__include = //p' < "$mf"` + test -z "am__include" && continue + am__quote=`sed -n 's/^am__quote = //p' < "$mf"` + # When using ansi2knr, U may be empty or an underscore; expand it + U=`sed -n 's/^U = //p' < "$mf"` + # Find all dependency output files, they are included files with + # $(DEPDIR) in their names. We invoke sed twice because it is the + # simplest approach to changing $(DEPDIR) to its actual value in the + # expansion. + for file in `sed -n " + s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ + sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do + # Make sure the directory exists. + test -f "$dirpart/$file" && continue + fdir=`$as_dirname -- "$file" || +$as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$file" : 'X\(//\)[^/]' \| \ + X"$file" : 'X\(//\)$' \| \ + X"$file" : 'X\(/\)' \| . 2>/dev/null || +echo X"$file" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + { as_dir=$dirpart/$fdir + case $as_dir in #( + -*) as_dir=./$as_dir;; + esac + test -d "$as_dir" || { $as_mkdir_p && mkdir -p "$as_dir"; } || { + as_dirs= + while :; do + case $as_dir in #( + *\'*) as_qdir=`echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #( + *) as_qdir=$as_dir;; + esac + as_dirs="'$as_qdir' $as_dirs" + as_dir=`$as_dirname -- "$as_dir" || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || +echo X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + test -d "$as_dir" && break + done + test -z "$as_dirs" || eval "mkdir $as_dirs" + } || test -d "$as_dir" || { { echo "$as_me:$LINENO: error: cannot create directory $as_dir" >&5 +echo "$as_me: error: cannot create directory $as_dir" >&2;} + { (exit 1); exit 1; }; }; } + # echo "creating $dirpart/$file" + echo '# dummy' > "$dirpart/$file" + done +done + ;; + + esac +done # for ac_tag + + +{ (exit 0); exit 0; } +_ACEOF +chmod +x $CONFIG_STATUS +ac_clean_files=$ac_clean_files_save + + +# configure is writing to config.log, and then calls config.status. +# config.status does its own redirection, appending to config.log. +# Unfortunately, on DOS this fails, as config.log is still kept open +# by configure, so config.status won't be able to write to it; its +# output is simply discarded. So we exec the FD to /dev/null, +# effectively closing config.log, so it can be properly (re)opened and +# appended to by config.status. When coming back to configure, we +# need to make the FD available again. +if test "$no_create" != yes; then + ac_cs_success=: + ac_config_status_args= + test "$silent" = yes && + ac_config_status_args="$ac_config_status_args --quiet" + exec 5>/dev/null + $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false + exec 5>>config.log + # Use ||, not &&, to avoid exiting from the if with $? = 1, which + # would make configure fail if this is the last instruction. + $ac_cs_success || { (exit 1); exit 1; } +fi + diff --git a/driver/xf86-video-geode/configure.ac b/driver/xf86-video-geode/configure.ac new file mode 100644 index 000000000..3eef3b326 --- /dev/null +++ b/driver/xf86-video-geode/configure.ac @@ -0,0 +1,132 @@ +# Copyright 2005 Adam Jackson. +# +# Permission is hereby granted, free of charge, to any person obtaining a +# copy of this software and associated documentation files (the "Software"), +# to deal in the Software without restriction, including without limitation +# on the rights to use, copy, modify, merge, publish, distribute, sub +# license, and/or sell copies of the Software, and to permit persons to whom +# the Software is furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice (including the next +# paragraph) shall be included in all copies or substantial portions of the +# Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL +# ADAM JACKSON BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +# IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +# +# Process this file with autoconf to produce a configure script + +AC_PREREQ(2.57) +AC_INIT([xf86-video-geode], + 2.10.0, + [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg&component=Driver%2Fgeode], + xf86-video-geode) + +AC_CONFIG_SRCDIR([Makefile.am]) +AM_CONFIG_HEADER([config.h]) +AC_CONFIG_AUX_DIR(.) + +AM_INIT_AUTOMAKE([dist-bzip2]) + +AM_MAINTAINER_MODE + +# Checks for programs. +AC_DISABLE_STATIC +AC_PROG_LIBTOOL +AC_PROG_CC +AM_PROG_AS + +AH_TOP([#include "xorg-server.h"]) + +AC_ARG_WITH(xorg-module-dir, + AC_HELP_STRING([--with-xorg-module-dir=DIR], + [Default xorg module directory [[default=$libdir/xorg/modules]]]), + [moduledir="$withval"], + [moduledir="$libdir/xorg/modules"]) + +AC_ARG_ENABLE(geodegx-panel, + AC_HELP_STRING([--disable-geodegx-panel], + [Disable support for flatpanels with the Geode GX]), + [ ], + [ AMD_CFLAGS="-DPNL_SUP $AMD_CFLAGS" ]) + +AC_ARG_ENABLE(werror, AC_HELP_STRING([--enable-werror], + [Treat warnings as errors (default: disabled)]), + [WERROR=$enableval], [WERROR=no]) +AC_ARG_ENABLE(visibility, + AC_HELP_STRING([--enable-visibility], + [Enable GCC visibility optimizations]), + [ AMD_CFLAGS="$AMD_CFLAGS -fvisibility=hidden" ], + [ : ]) + +if test "x$GCC" = "xyes"; then + GCC_WARNINGS1="-Wall -Wpointer-arith -Wstrict-prototypes" + GCC_WARNINGS2="-Wmissing-prototypes -Wmissing-declarations" + GCC_WARNINGS3="-Wnested-externs -fno-strict-aliasing" + GCC_WARNINGS="$GCC_WARNINGS1 $GCC_WARNINGS2 $GCC_WARNINGS3" + if test "x$WERROR" = "xyes"; then + GCC_WARNINGS="${GCC_WARNINGS} -Werror" + fi + AMD_CFLAGS="$GCC_WARNINGS $AMD_CFLAGS" +fi + +# Checks for extensions +XORG_DRIVER_CHECK_EXT(RANDR, randrproto) +XORG_DRIVER_CHECK_EXT(RENDER, renderproto) +XORG_DRIVER_CHECK_EXT(XV, videoproto) +XORG_DRIVER_CHECK_EXT(DPMSExtension, xextproto) +XORG_DRIVER_CHECK_EXT(XFreeXDGA, xf86dgaproto) + +# Checks for pkg-config packages +PKG_CHECK_MODULES(XORG, [xorg-server xproto fontsproto $REQUIRED_MODULES]) +sdkdir=$(pkg-config --variable=sdkdir xorg-server) + +# Checks for libraries. +SAVE_CPPFLAGS="$CPPFLAGS" +CPPFLAGS="$CPPFLAGS $XORG_CFLAGS" +AC_CHECK_DECL(XSERVER_LIBPCIACCESS, + [XSERVER_LIBPCIACCESS=yes],[XSERVER_LIBPCIACCESS=no], + [#include "xorg-server.h"]) +CPPFLAGS="$SAVE_CPPFLAGS" + +# Checks for header files. +AC_HEADER_STDC + +if test "x$XSERVER_LIBPCIACCESS" = xyes; then + PKG_CHECK_MODULES([PCIACCESS], [pciaccess >= 0.8.0]) + XORG_CFLAGS="$XORG_CFLAGS $PCIACCESS_CFLAGS" +fi + +AC_SUBST([XORG_CFLAGS]) +AC_SUBST([moduledir]) +AC_SUBST([AMD_CFLAGS]) + +is386=false + +case $host_cpu in + i*86) + is386=true + ;; +esac + +# Unset is386 if compiling for AMD64/EM64T +if test $is386 = true ; then + AC_CHECK_DECLS([_LP64, __amd64__, amd64], [is386=false]) +fi + +AM_CONDITIONAL([I386ARCH], [test $is386 = true]) + +DRIVER_NAME=geode +AC_SUBST([DRIVER_NAME]) + +XORG_MANPAGE_SECTIONS +XORG_RELEASE_VERSION + +AC_OUTPUT([ + Makefile + src/Makefile +]) diff --git a/driver/xf86-video-geode/depcomp b/driver/xf86-video-geode/depcomp new file mode 100755 index 000000000..ca5ea4e1e --- /dev/null +++ b/driver/xf86-video-geode/depcomp @@ -0,0 +1,584 @@ +#! /bin/sh +# depcomp - compile a program generating dependencies as side-effects + +scriptversion=2006-10-15.18 + +# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006 Free Software +# Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +# 02110-1301, USA. + +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# Originally written by Alexandre Oliva . + +case $1 in + '') + echo "$0: No command. Try \`$0 --help' for more information." 1>&2 + exit 1; + ;; + -h | --h*) + cat <<\EOF +Usage: depcomp [--help] [--version] PROGRAM [ARGS] + +Run PROGRAMS ARGS to compile a file, generating dependencies +as side-effects. + +Environment variables: + depmode Dependency tracking mode. + source Source file read by `PROGRAMS ARGS'. + object Object file output by `PROGRAMS ARGS'. + DEPDIR directory where to store dependencies. + depfile Dependency file to output. + tmpdepfile Temporary file to use when outputing dependencies. + libtool Whether libtool is used (yes/no). + +Report bugs to . +EOF + exit $? + ;; + -v | --v*) + echo "depcomp $scriptversion" + exit $? + ;; +esac + +if test -z "$depmode" || test -z "$source" || test -z "$object"; then + echo "depcomp: Variables source, object and depmode must be set" 1>&2 + exit 1 +fi + +# Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po. +depfile=${depfile-`echo "$object" | + sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`} +tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`} + +rm -f "$tmpdepfile" + +# Some modes work just like other modes, but use different flags. We +# parameterize here, but still list the modes in the big case below, +# to make depend.m4 easier to write. Note that we *cannot* use a case +# here, because this file can only contain one case statement. +if test "$depmode" = hp; then + # HP compiler uses -M and no extra arg. + gccflag=-M + depmode=gcc +fi + +if test "$depmode" = dashXmstdout; then + # This is just like dashmstdout with a different argument. + dashmflag=-xM + depmode=dashmstdout +fi + +case "$depmode" in +gcc3) +## gcc 3 implements dependency tracking that does exactly what +## we want. Yay! Note: for some reason libtool 1.4 doesn't like +## it if -MD -MP comes after the -MF stuff. Hmm. +## Unfortunately, FreeBSD c89 acceptance of flags depends upon +## the command line argument order; so add the flags where they +## appear in depend2.am. Note that the slowdown incurred here +## affects only configure: in makefiles, %FASTDEP% shortcuts this. + for arg + do + case $arg in + -c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;; + *) set fnord "$@" "$arg" ;; + esac + shift # fnord + shift # $arg + done + "$@" + stat=$? + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile" + exit $stat + fi + mv "$tmpdepfile" "$depfile" + ;; + +gcc) +## There are various ways to get dependency output from gcc. Here's +## why we pick this rather obscure method: +## - Don't want to use -MD because we'd like the dependencies to end +## up in a subdir. Having to rename by hand is ugly. +## (We might end up doing this anyway to support other compilers.) +## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like +## -MM, not -M (despite what the docs say). +## - Using -M directly means running the compiler twice (even worse +## than renaming). + if test -z "$gccflag"; then + gccflag=-MD, + fi + "$@" -Wp,"$gccflag$tmpdepfile" + stat=$? + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile" + exit $stat + fi + rm -f "$depfile" + echo "$object : \\" > "$depfile" + alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz +## The second -e expression handles DOS-style file names with drive letters. + sed -e 's/^[^:]*: / /' \ + -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile" +## This next piece of magic avoids the `deleted header file' problem. +## The problem is that when a header file which appears in a .P file +## is deleted, the dependency causes make to die (because there is +## typically no way to rebuild the header). We avoid this by adding +## dummy dependencies for each header file. Too bad gcc doesn't do +## this for us directly. + tr ' ' ' +' < "$tmpdepfile" | +## Some versions of gcc put a space before the `:'. On the theory +## that the space means something, we add a space to the output as +## well. +## Some versions of the HPUX 10.20 sed can't process this invocation +## correctly. Breaking it into two sed invocations is a workaround. + sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +hp) + # This case exists only to let depend.m4 do its work. It works by + # looking at the text of this script. This case will never be run, + # since it is checked for above. + exit 1 + ;; + +sgi) + if test "$libtool" = yes; then + "$@" "-Wp,-MDupdate,$tmpdepfile" + else + "$@" -MDupdate "$tmpdepfile" + fi + stat=$? + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile" + exit $stat + fi + rm -f "$depfile" + + if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files + echo "$object : \\" > "$depfile" + + # Clip off the initial element (the dependent). Don't try to be + # clever and replace this with sed code, as IRIX sed won't handle + # lines with more than a fixed number of characters (4096 in + # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines; + # the IRIX cc adds comments like `#:fec' to the end of the + # dependency line. + tr ' ' ' +' < "$tmpdepfile" \ + | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \ + tr ' +' ' ' >> $depfile + echo >> $depfile + + # The second pass generates a dummy entry for each header file. + tr ' ' ' +' < "$tmpdepfile" \ + | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \ + >> $depfile + else + # The sourcefile does not contain any dependencies, so just + # store a dummy comment line, to avoid errors with the Makefile + # "include basename.Plo" scheme. + echo "#dummy" > "$depfile" + fi + rm -f "$tmpdepfile" + ;; + +aix) + # The C for AIX Compiler uses -M and outputs the dependencies + # in a .u file. In older versions, this file always lives in the + # current directory. Also, the AIX compiler puts `$object:' at the + # start of each line; $object doesn't have directory information. + # Version 6 uses the directory in both cases. + stripped=`echo "$object" | sed 's/\(.*\)\..*$/\1/'` + tmpdepfile="$stripped.u" + if test "$libtool" = yes; then + "$@" -Wc,-M + else + "$@" -M + fi + stat=$? + + if test -f "$tmpdepfile"; then : + else + stripped=`echo "$stripped" | sed 's,^.*/,,'` + tmpdepfile="$stripped.u" + fi + + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile" + exit $stat + fi + + if test -f "$tmpdepfile"; then + outname="$stripped.o" + # Each line is of the form `foo.o: dependent.h'. + # Do two passes, one to just change these to + # `$object: dependent.h' and one to simply `dependent.h:'. + sed -e "s,^$outname:,$object :," < "$tmpdepfile" > "$depfile" + sed -e "s,^$outname: \(.*\)$,\1:," < "$tmpdepfile" >> "$depfile" + else + # The sourcefile does not contain any dependencies, so just + # store a dummy comment line, to avoid errors with the Makefile + # "include basename.Plo" scheme. + echo "#dummy" > "$depfile" + fi + rm -f "$tmpdepfile" + ;; + +icc) + # Intel's C compiler understands `-MD -MF file'. However on + # icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c + # ICC 7.0 will fill foo.d with something like + # foo.o: sub/foo.c + # foo.o: sub/foo.h + # which is wrong. We want: + # sub/foo.o: sub/foo.c + # sub/foo.o: sub/foo.h + # sub/foo.c: + # sub/foo.h: + # ICC 7.1 will output + # foo.o: sub/foo.c sub/foo.h + # and will wrap long lines using \ : + # foo.o: sub/foo.c ... \ + # sub/foo.h ... \ + # ... + + "$@" -MD -MF "$tmpdepfile" + stat=$? + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile" + exit $stat + fi + rm -f "$depfile" + # Each line is of the form `foo.o: dependent.h', + # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'. + # Do two passes, one to just change these to + # `$object: dependent.h' and one to simply `dependent.h:'. + sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile" + # Some versions of the HPUX 10.20 sed can't process this invocation + # correctly. Breaking it into two sed invocations is a workaround. + sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" | + sed -e 's/$/ :/' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +hp2) + # The "hp" stanza above does not work with aCC (C++) and HP's ia64 + # compilers, which have integrated preprocessors. The correct option + # to use with these is +Maked; it writes dependencies to a file named + # 'foo.d', which lands next to the object file, wherever that + # happens to be. + # Much of this is similar to the tru64 case; see comments there. + dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` + test "x$dir" = "x$object" && dir= + base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` + if test "$libtool" = yes; then + tmpdepfile1=$dir$base.d + tmpdepfile2=$dir.libs/$base.d + "$@" -Wc,+Maked + else + tmpdepfile1=$dir$base.d + tmpdepfile2=$dir$base.d + "$@" +Maked + fi + stat=$? + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile1" "$tmpdepfile2" + exit $stat + fi + + for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" + do + test -f "$tmpdepfile" && break + done + if test -f "$tmpdepfile"; then + sed -e "s,^.*\.[a-z]*:,$object:," "$tmpdepfile" > "$depfile" + # Add `dependent.h:' lines. + sed -ne '2,${; s/^ *//; s/ \\*$//; s/$/:/; p;}' "$tmpdepfile" >> "$depfile" + else + echo "#dummy" > "$depfile" + fi + rm -f "$tmpdepfile" "$tmpdepfile2" + ;; + +tru64) + # The Tru64 compiler uses -MD to generate dependencies as a side + # effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'. + # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put + # dependencies in `foo.d' instead, so we check for that too. + # Subdirectories are respected. + dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` + test "x$dir" = "x$object" && dir= + base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` + + if test "$libtool" = yes; then + # With Tru64 cc, shared objects can also be used to make a + # static library. This mechanism is used in libtool 1.4 series to + # handle both shared and static libraries in a single compilation. + # With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d. + # + # With libtool 1.5 this exception was removed, and libtool now + # generates 2 separate objects for the 2 libraries. These two + # compilations output dependencies in $dir.libs/$base.o.d and + # in $dir$base.o.d. We have to check for both files, because + # one of the two compilations can be disabled. We should prefer + # $dir$base.o.d over $dir.libs/$base.o.d because the latter is + # automatically cleaned when .libs/ is deleted, while ignoring + # the former would cause a distcleancheck panic. + tmpdepfile1=$dir.libs/$base.lo.d # libtool 1.4 + tmpdepfile2=$dir$base.o.d # libtool 1.5 + tmpdepfile3=$dir.libs/$base.o.d # libtool 1.5 + tmpdepfile4=$dir.libs/$base.d # Compaq CCC V6.2-504 + "$@" -Wc,-MD + else + tmpdepfile1=$dir$base.o.d + tmpdepfile2=$dir$base.d + tmpdepfile3=$dir$base.d + tmpdepfile4=$dir$base.d + "$@" -MD + fi + + stat=$? + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4" + exit $stat + fi + + for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4" + do + test -f "$tmpdepfile" && break + done + if test -f "$tmpdepfile"; then + sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" + # That's a tab and a space in the []. + sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" + else + echo "#dummy" > "$depfile" + fi + rm -f "$tmpdepfile" + ;; + +#nosideeffect) + # This comment above is used by automake to tell side-effect + # dependency tracking mechanisms from slower ones. + +dashmstdout) + # Important note: in order to support this mode, a compiler *must* + # always write the preprocessed file to stdout, regardless of -o. + "$@" || exit $? + + # Remove the call to Libtool. + if test "$libtool" = yes; then + while test $1 != '--mode=compile'; do + shift + done + shift + fi + + # Remove `-o $object'. + IFS=" " + for arg + do + case $arg in + -o) + shift + ;; + $object) + shift + ;; + *) + set fnord "$@" "$arg" + shift # fnord + shift # $arg + ;; + esac + done + + test -z "$dashmflag" && dashmflag=-M + # Require at least two characters before searching for `:' + # in the target name. This is to cope with DOS-style filenames: + # a dependency such as `c:/foo/bar' could be seen as target `c' otherwise. + "$@" $dashmflag | + sed 's:^[ ]*[^: ][^:][^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile" + rm -f "$depfile" + cat < "$tmpdepfile" > "$depfile" + tr ' ' ' +' < "$tmpdepfile" | \ +## Some versions of the HPUX 10.20 sed can't process this invocation +## correctly. Breaking it into two sed invocations is a workaround. + sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +dashXmstdout) + # This case only exists to satisfy depend.m4. It is never actually + # run, as this mode is specially recognized in the preamble. + exit 1 + ;; + +makedepend) + "$@" || exit $? + # Remove any Libtool call + if test "$libtool" = yes; then + while test $1 != '--mode=compile'; do + shift + done + shift + fi + # X makedepend + shift + cleared=no + for arg in "$@"; do + case $cleared in + no) + set ""; shift + cleared=yes ;; + esac + case "$arg" in + -D*|-I*) + set fnord "$@" "$arg"; shift ;; + # Strip any option that makedepend may not understand. Remove + # the object too, otherwise makedepend will parse it as a source file. + -*|$object) + ;; + *) + set fnord "$@" "$arg"; shift ;; + esac + done + obj_suffix="`echo $object | sed 's/^.*\././'`" + touch "$tmpdepfile" + ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@" + rm -f "$depfile" + cat < "$tmpdepfile" > "$depfile" + sed '1,2d' "$tmpdepfile" | tr ' ' ' +' | \ +## Some versions of the HPUX 10.20 sed can't process this invocation +## correctly. Breaking it into two sed invocations is a workaround. + sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" + rm -f "$tmpdepfile" "$tmpdepfile".bak + ;; + +cpp) + # Important note: in order to support this mode, a compiler *must* + # always write the preprocessed file to stdout. + "$@" || exit $? + + # Remove the call to Libtool. + if test "$libtool" = yes; then + while test $1 != '--mode=compile'; do + shift + done + shift + fi + + # Remove `-o $object'. + IFS=" " + for arg + do + case $arg in + -o) + shift + ;; + $object) + shift + ;; + *) + set fnord "$@" "$arg" + shift # fnord + shift # $arg + ;; + esac + done + + "$@" -E | + sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \ + -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' | + sed '$ s: \\$::' > "$tmpdepfile" + rm -f "$depfile" + echo "$object : \\" > "$depfile" + cat < "$tmpdepfile" >> "$depfile" + sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +msvisualcpp) + # Important note: in order to support this mode, a compiler *must* + # always write the preprocessed file to stdout, regardless of -o, + # because we must use -o when running libtool. + "$@" || exit $? + IFS=" " + for arg + do + case "$arg" in + "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI") + set fnord "$@" + shift + shift + ;; + *) + set fnord "$@" "$arg" + shift + shift + ;; + esac + done + "$@" -E | + sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile" + rm -f "$depfile" + echo "$object : \\" > "$depfile" + . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile" + echo " " >> "$depfile" + . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::\1\::p' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +none) + exec "$@" + ;; + +*) + echo "Unknown depmode $depmode" 1>&2 + exit 1 + ;; +esac + +exit 0 + +# Local Variables: +# mode: shell-script +# sh-indentation: 2 +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "scriptversion=" +# time-stamp-format: "%:y-%02m-%02d.%02H" +# time-stamp-end: "$" +# End: diff --git a/driver/xf86-video-geode/install-sh b/driver/xf86-video-geode/install-sh new file mode 100755 index 000000000..4fbbae7b7 --- /dev/null +++ b/driver/xf86-video-geode/install-sh @@ -0,0 +1,507 @@ +#!/bin/sh +# install - install a program, script, or datafile + +scriptversion=2006-10-14.15 + +# This originates from X11R5 (mit/util/scripts/install.sh), which was +# later released in X11R6 (xc/config/util/install.sh) with the +# following copyright and license. +# +# Copyright (C) 1994 X Consortium +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- +# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +# +# Except as contained in this notice, the name of the X Consortium shall not +# be used in advertising or otherwise to promote the sale, use or other deal- +# ings in this Software without prior written authorization from the X Consor- +# tium. +# +# +# FSF changes to this file are in the public domain. +# +# Calling this script install-sh is preferred over install.sh, to prevent +# `make' implicit rules from creating a file called install from it +# when there is no Makefile. +# +# This script is compatible with the BSD install script, but was written +# from scratch. + +nl=' +' +IFS=" "" $nl" + +# set DOITPROG to echo to test this script + +# Don't use :- since 4.3BSD and earlier shells don't like it. +doit="${DOITPROG-}" +if test -z "$doit"; then + doit_exec=exec +else + doit_exec=$doit +fi + +# Put in absolute file names if you don't have them in your path; +# or use environment vars. + +mvprog="${MVPROG-mv}" +cpprog="${CPPROG-cp}" +chmodprog="${CHMODPROG-chmod}" +chownprog="${CHOWNPROG-chown}" +chgrpprog="${CHGRPPROG-chgrp}" +stripprog="${STRIPPROG-strip}" +rmprog="${RMPROG-rm}" +mkdirprog="${MKDIRPROG-mkdir}" + +posix_glob= +posix_mkdir= + +# Desired mode of installed file. +mode=0755 + +chmodcmd=$chmodprog +chowncmd= +chgrpcmd= +stripcmd= +rmcmd="$rmprog -f" +mvcmd="$mvprog" +src= +dst= +dir_arg= +dstarg= +no_target_directory= + +usage="Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE + or: $0 [OPTION]... SRCFILES... DIRECTORY + or: $0 [OPTION]... -t DIRECTORY SRCFILES... + or: $0 [OPTION]... -d DIRECTORIES... + +In the 1st form, copy SRCFILE to DSTFILE. +In the 2nd and 3rd, copy all SRCFILES to DIRECTORY. +In the 4th, create DIRECTORIES. + +Options: +-c (ignored) +-d create directories instead of installing files. +-g GROUP $chgrpprog installed files to GROUP. +-m MODE $chmodprog installed files to MODE. +-o USER $chownprog installed files to USER. +-s $stripprog installed files. +-t DIRECTORY install into DIRECTORY. +-T report an error if DSTFILE is a directory. +--help display this help and exit. +--version display version info and exit. + +Environment variables override the default commands: + CHGRPPROG CHMODPROG CHOWNPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG +" + +while test $# -ne 0; do + case $1 in + -c) shift + continue;; + + -d) dir_arg=true + shift + continue;; + + -g) chgrpcmd="$chgrpprog $2" + shift + shift + continue;; + + --help) echo "$usage"; exit $?;; + + -m) mode=$2 + shift + shift + case $mode in + *' '* | *' '* | *' +'* | *'*'* | *'?'* | *'['*) + echo "$0: invalid mode: $mode" >&2 + exit 1;; + esac + continue;; + + -o) chowncmd="$chownprog $2" + shift + shift + continue;; + + -s) stripcmd=$stripprog + shift + continue;; + + -t) dstarg=$2 + shift + shift + continue;; + + -T) no_target_directory=true + shift + continue;; + + --version) echo "$0 $scriptversion"; exit $?;; + + --) shift + break;; + + -*) echo "$0: invalid option: $1" >&2 + exit 1;; + + *) break;; + esac +done + +if test $# -ne 0 && test -z "$dir_arg$dstarg"; then + # When -d is used, all remaining arguments are directories to create. + # When -t is used, the destination is already specified. + # Otherwise, the last argument is the destination. Remove it from $@. + for arg + do + if test -n "$dstarg"; then + # $@ is not empty: it contains at least $arg. + set fnord "$@" "$dstarg" + shift # fnord + fi + shift # arg + dstarg=$arg + done +fi + +if test $# -eq 0; then + if test -z "$dir_arg"; then + echo "$0: no input file specified." >&2 + exit 1 + fi + # It's OK to call `install-sh -d' without argument. + # This can happen when creating conditional directories. + exit 0 +fi + +if test -z "$dir_arg"; then + trap '(exit $?); exit' 1 2 13 15 + + # Set umask so as not to create temps with too-generous modes. + # However, 'strip' requires both read and write access to temps. + case $mode in + # Optimize common cases. + *644) cp_umask=133;; + *755) cp_umask=22;; + + *[0-7]) + if test -z "$stripcmd"; then + u_plus_rw= + else + u_plus_rw='% 200' + fi + cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;; + *) + if test -z "$stripcmd"; then + u_plus_rw= + else + u_plus_rw=,u+rw + fi + cp_umask=$mode$u_plus_rw;; + esac +fi + +for src +do + # Protect names starting with `-'. + case $src in + -*) src=./$src ;; + esac + + if test -n "$dir_arg"; then + dst=$src + dstdir=$dst + test -d "$dstdir" + dstdir_status=$? + else + + # Waiting for this to be detected by the "$cpprog $src $dsttmp" command + # might cause directories to be created, which would be especially bad + # if $src (and thus $dsttmp) contains '*'. + if test ! -f "$src" && test ! -d "$src"; then + echo "$0: $src does not exist." >&2 + exit 1 + fi + + if test -z "$dstarg"; then + echo "$0: no destination specified." >&2 + exit 1 + fi + + dst=$dstarg + # Protect names starting with `-'. + case $dst in + -*) dst=./$dst ;; + esac + + # If destination is a directory, append the input filename; won't work + # if double slashes aren't ignored. + if test -d "$dst"; then + if test -n "$no_target_directory"; then + echo "$0: $dstarg: Is a directory" >&2 + exit 1 + fi + dstdir=$dst + dst=$dstdir/`basename "$src"` + dstdir_status=0 + else + # Prefer dirname, but fall back on a substitute if dirname fails. + dstdir=` + (dirname "$dst") 2>/dev/null || + expr X"$dst" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$dst" : 'X\(//\)[^/]' \| \ + X"$dst" : 'X\(//\)$' \| \ + X"$dst" : 'X\(/\)' \| . 2>/dev/null || + echo X"$dst" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q' + ` + + test -d "$dstdir" + dstdir_status=$? + fi + fi + + obsolete_mkdir_used=false + + if test $dstdir_status != 0; then + case $posix_mkdir in + '') + # Create intermediate dirs using mode 755 as modified by the umask. + # This is like FreeBSD 'install' as of 1997-10-28. + umask=`umask` + case $stripcmd.$umask in + # Optimize common cases. + *[2367][2367]) mkdir_umask=$umask;; + .*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;; + + *[0-7]) + mkdir_umask=`expr $umask + 22 \ + - $umask % 100 % 40 + $umask % 20 \ + - $umask % 10 % 4 + $umask % 2 + `;; + *) mkdir_umask=$umask,go-w;; + esac + + # With -d, create the new directory with the user-specified mode. + # Otherwise, rely on $mkdir_umask. + if test -n "$dir_arg"; then + mkdir_mode=-m$mode + else + mkdir_mode= + fi + + posix_mkdir=false + case $umask in + *[123567][0-7][0-7]) + # POSIX mkdir -p sets u+wx bits regardless of umask, which + # is incompatible with FreeBSD 'install' when (umask & 300) != 0. + ;; + *) + tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$ + trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0 + + if (umask $mkdir_umask && + exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1 + then + if test -z "$dir_arg" || { + # Check for POSIX incompatibilities with -m. + # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or + # other-writeable bit of parent directory when it shouldn't. + # FreeBSD 6.1 mkdir -m -p sets mode of existing directory. + ls_ld_tmpdir=`ls -ld "$tmpdir"` + case $ls_ld_tmpdir in + d????-?r-*) different_mode=700;; + d????-?--*) different_mode=755;; + *) false;; + esac && + $mkdirprog -m$different_mode -p -- "$tmpdir" && { + ls_ld_tmpdir_1=`ls -ld "$tmpdir"` + test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1" + } + } + then posix_mkdir=: + fi + rmdir "$tmpdir/d" "$tmpdir" + else + # Remove any dirs left behind by ancient mkdir implementations. + rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null + fi + trap '' 0;; + esac;; + esac + + if + $posix_mkdir && ( + umask $mkdir_umask && + $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir" + ) + then : + else + + # The umask is ridiculous, or mkdir does not conform to POSIX, + # or it failed possibly due to a race condition. Create the + # directory the slow way, step by step, checking for races as we go. + + case $dstdir in + /*) prefix=/ ;; + -*) prefix=./ ;; + *) prefix= ;; + esac + + case $posix_glob in + '') + if (set -f) 2>/dev/null; then + posix_glob=true + else + posix_glob=false + fi ;; + esac + + oIFS=$IFS + IFS=/ + $posix_glob && set -f + set fnord $dstdir + shift + $posix_glob && set +f + IFS=$oIFS + + prefixes= + + for d + do + test -z "$d" && continue + + prefix=$prefix$d + if test -d "$prefix"; then + prefixes= + else + if $posix_mkdir; then + (umask=$mkdir_umask && + $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break + # Don't fail if two instances are running concurrently. + test -d "$prefix" || exit 1 + else + case $prefix in + *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;; + *) qprefix=$prefix;; + esac + prefixes="$prefixes '$qprefix'" + fi + fi + prefix=$prefix/ + done + + if test -n "$prefixes"; then + # Don't fail if two instances are running concurrently. + (umask $mkdir_umask && + eval "\$doit_exec \$mkdirprog $prefixes") || + test -d "$dstdir" || exit 1 + obsolete_mkdir_used=true + fi + fi + fi + + if test -n "$dir_arg"; then + { test -z "$chowncmd" || $doit $chowncmd "$dst"; } && + { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } && + { test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false || + test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1 + else + + # Make a couple of temp file names in the proper directory. + dsttmp=$dstdir/_inst.$$_ + rmtmp=$dstdir/_rm.$$_ + + # Trap to clean up those temp files at exit. + trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0 + + # Copy the file name to the temp name. + (umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") && + + # and set any options; do chmod last to preserve setuid bits. + # + # If any of these fail, we abort the whole thing. If we want to + # ignore errors from any of these, just make sure not to ignore + # errors from the above "$doit $cpprog $src $dsttmp" command. + # + { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } \ + && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } \ + && { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } \ + && { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } && + + # Now rename the file to the real destination. + { $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null \ + || { + # The rename failed, perhaps because mv can't rename something else + # to itself, or perhaps because mv is so ancient that it does not + # support -f. + + # Now remove or move aside any old file at destination location. + # We try this two ways since rm can't unlink itself on some + # systems and the destination file might be busy for other + # reasons. In this case, the final cleanup might fail but the new + # file should still install successfully. + { + if test -f "$dst"; then + $doit $rmcmd -f "$dst" 2>/dev/null \ + || { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null \ + && { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; }; }\ + || { + echo "$0: cannot unlink or rename $dst" >&2 + (exit 1); exit 1 + } + else + : + fi + } && + + # Now rename the file to the real destination. + $doit $mvcmd "$dsttmp" "$dst" + } + } || exit 1 + + trap '' 0 + fi +done + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "scriptversion=" +# time-stamp-format: "%:y-%02m-%02d.%02H" +# time-stamp-end: "$" +# End: diff --git a/driver/xf86-video-geode/ltmain.sh b/driver/xf86-video-geode/ltmain.sh new file mode 100644 index 000000000..2160ef7b9 --- /dev/null +++ b/driver/xf86-video-geode/ltmain.sh @@ -0,0 +1,6938 @@ +# ltmain.sh - Provide generalized library-building support services. +# NOTE: Changing this file will not affect anything until you rerun configure. +# +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006, +# 2007 Free Software Foundation, Inc. +# Originally by Gordon Matzigkeit , 1996 +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +basename="s,^.*/,,g" + +# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh +# is ksh but when the shell is invoked as "sh" and the current value of +# the _XPG environment variable is not equal to 1 (one), the special +# positional parameter $0, within a function call, is the name of the +# function. +progpath="$0" + +# The name of this program: +progname=`echo "$progpath" | $SED $basename` +modename="$progname" + +# Global variables: +EXIT_SUCCESS=0 +EXIT_FAILURE=1 + +PROGRAM=ltmain.sh +PACKAGE=libtool +VERSION="1.5.24 Debian 1.5.24-1ubuntu1" +TIMESTAMP=" (1.1220.2.456 2007/06/24 02:25:32)" + +# Be Bourne compatible (taken from Autoconf:_AS_BOURNE_COMPATIBLE). +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then + emulate sh + NULLCMD=: + # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' + setopt NO_GLOB_SUBST +else + case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac +fi +BIN_SH=xpg4; export BIN_SH # for Tru64 +DUALCASE=1; export DUALCASE # for MKS sh + +# Check that we have a working $echo. +if test "X$1" = X--no-reexec; then + # Discard the --no-reexec flag, and continue. + shift +elif test "X$1" = X--fallback-echo; then + # Avoid inline document here, it may be left over + : +elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then + # Yippee, $echo works! + : +else + # Restart under the correct shell, and then maybe $echo will work. + exec $SHELL "$progpath" --no-reexec ${1+"$@"} +fi + +if test "X$1" = X--fallback-echo; then + # used as fallback echo + shift + cat <&2 + $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 + exit $EXIT_FAILURE +fi + +# Global variables. +mode=$default_mode +nonopt= +prev= +prevopt= +run= +show="$echo" +show_help= +execute_dlfiles= +duplicate_deps=no +preserve_args= +lo2o="s/\\.lo\$/.${objext}/" +o2lo="s/\\.${objext}\$/.lo/" +extracted_archives= +extracted_serial=0 + +##################################### +# Shell function definitions: +# This seems to be the best place for them + +# func_mktempdir [string] +# Make a temporary directory that won't clash with other running +# libtool processes, and avoids race conditions if possible. If +# given, STRING is the basename for that directory. +func_mktempdir () +{ + my_template="${TMPDIR-/tmp}/${1-$progname}" + + if test "$run" = ":"; then + # Return a directory name, but don't create it in dry-run mode + my_tmpdir="${my_template}-$$" + else + + # If mktemp works, use that first and foremost + my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null` + + if test ! -d "$my_tmpdir"; then + # Failing that, at least try and use $RANDOM to avoid a race + my_tmpdir="${my_template}-${RANDOM-0}$$" + + save_mktempdir_umask=`umask` + umask 0077 + $mkdir "$my_tmpdir" + umask $save_mktempdir_umask + fi + + # If we're not in dry-run mode, bomb out on failure + test -d "$my_tmpdir" || { + $echo "cannot create temporary directory \`$my_tmpdir'" 1>&2 + exit $EXIT_FAILURE + } + fi + + $echo "X$my_tmpdir" | $Xsed +} + + +# func_win32_libid arg +# return the library type of file 'arg' +# +# Need a lot of goo to handle *both* DLLs and import libs +# Has to be a shell function in order to 'eat' the argument +# that is supplied when $file_magic_command is called. +func_win32_libid () +{ + win32_libid_type="unknown" + win32_fileres=`file -L $1 2>/dev/null` + case $win32_fileres in + *ar\ archive\ import\ library*) # definitely import + win32_libid_type="x86 archive import" + ;; + *ar\ archive*) # could be an import, or static + if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | \ + $EGREP -e 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then + win32_nmres=`eval $NM -f posix -A $1 | \ + $SED -n -e '1,100{ + / I /{ + s,.*,import, + p + q + } + }'` + case $win32_nmres in + import*) win32_libid_type="x86 archive import";; + *) win32_libid_type="x86 archive static";; + esac + fi + ;; + *DLL*) + win32_libid_type="x86 DLL" + ;; + *executable*) # but shell scripts are "executable" too... + case $win32_fileres in + *MS\ Windows\ PE\ Intel*) + win32_libid_type="x86 DLL" + ;; + esac + ;; + esac + $echo $win32_libid_type +} + + +# func_infer_tag arg +# Infer tagged configuration to use if any are available and +# if one wasn't chosen via the "--tag" command line option. +# Only attempt this if the compiler in the base compile +# command doesn't match the default compiler. +# arg is usually of the form 'gcc ...' +func_infer_tag () +{ + if test -n "$available_tags" && test -z "$tagname"; then + CC_quoted= + for arg in $CC; do + case $arg in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + arg="\"$arg\"" + ;; + esac + CC_quoted="$CC_quoted $arg" + done + case $@ in + # Blanks in the command may have been stripped by the calling shell, + # but not from the CC environment variable when configure was run. + " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) ;; + # Blanks at the start of $base_compile will cause this to fail + # if we don't check for them as well. + *) + for z in $available_tags; do + if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then + # Evaluate the configuration. + eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`" + CC_quoted= + for arg in $CC; do + # Double-quote args containing other shell metacharacters. + case $arg in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + arg="\"$arg\"" + ;; + esac + CC_quoted="$CC_quoted $arg" + done + case "$@ " in + " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) + # The compiler in the base compile command matches + # the one in the tagged configuration. + # Assume this is the tagged configuration we want. + tagname=$z + break + ;; + esac + fi + done + # If $tagname still isn't set, then no tagged configuration + # was found and let the user know that the "--tag" command + # line option must be used. + if test -z "$tagname"; then + $echo "$modename: unable to infer tagged configuration" + $echo "$modename: specify a tag with \`--tag'" 1>&2 + exit $EXIT_FAILURE +# else +# $echo "$modename: using $tagname tagged configuration" + fi + ;; + esac + fi +} + + +# func_extract_an_archive dir oldlib +func_extract_an_archive () +{ + f_ex_an_ar_dir="$1"; shift + f_ex_an_ar_oldlib="$1" + + $show "(cd $f_ex_an_ar_dir && $AR x $f_ex_an_ar_oldlib)" + $run eval "(cd \$f_ex_an_ar_dir && $AR x \$f_ex_an_ar_oldlib)" || exit $? + if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then + : + else + $echo "$modename: ERROR: object name conflicts: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" 1>&2 + exit $EXIT_FAILURE + fi +} + +# func_extract_archives gentop oldlib ... +func_extract_archives () +{ + my_gentop="$1"; shift + my_oldlibs=${1+"$@"} + my_oldobjs="" + my_xlib="" + my_xabs="" + my_xdir="" + my_status="" + + $show "${rm}r $my_gentop" + $run ${rm}r "$my_gentop" + $show "$mkdir $my_gentop" + $run $mkdir "$my_gentop" + my_status=$? + if test "$my_status" -ne 0 && test ! -d "$my_gentop"; then + exit $my_status + fi + + for my_xlib in $my_oldlibs; do + # Extract the objects. + case $my_xlib in + [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;; + *) my_xabs=`pwd`"/$my_xlib" ;; + esac + my_xlib=`$echo "X$my_xlib" | $Xsed -e 's%^.*/%%'` + my_xlib_u=$my_xlib + while :; do + case " $extracted_archives " in + *" $my_xlib_u "*) + extracted_serial=`expr $extracted_serial + 1` + my_xlib_u=lt$extracted_serial-$my_xlib ;; + *) break ;; + esac + done + extracted_archives="$extracted_archives $my_xlib_u" + my_xdir="$my_gentop/$my_xlib_u" + + $show "${rm}r $my_xdir" + $run ${rm}r "$my_xdir" + $show "$mkdir $my_xdir" + $run $mkdir "$my_xdir" + exit_status=$? + if test "$exit_status" -ne 0 && test ! -d "$my_xdir"; then + exit $exit_status + fi + case $host in + *-darwin*) + $show "Extracting $my_xabs" + # Do not bother doing anything if just a dry run + if test -z "$run"; then + darwin_orig_dir=`pwd` + cd $my_xdir || exit $? + darwin_archive=$my_xabs + darwin_curdir=`pwd` + darwin_base_archive=`$echo "X$darwin_archive" | $Xsed -e 's%^.*/%%'` + darwin_arches=`lipo -info "$darwin_archive" 2>/dev/null | $EGREP Architectures 2>/dev/null` + if test -n "$darwin_arches"; then + darwin_arches=`echo "$darwin_arches" | $SED -e 's/.*are://'` + darwin_arch= + $show "$darwin_base_archive has multiple architectures $darwin_arches" + for darwin_arch in $darwin_arches ; do + mkdir -p "unfat-$$/${darwin_base_archive}-${darwin_arch}" + lipo -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}" + cd "unfat-$$/${darwin_base_archive}-${darwin_arch}" + func_extract_an_archive "`pwd`" "${darwin_base_archive}" + cd "$darwin_curdir" + $rm "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" + done # $darwin_arches + ## Okay now we have a bunch of thin objects, gotta fatten them up :) + darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print| xargs basename | sort -u | $NL2SP` + darwin_file= + darwin_files= + for darwin_file in $darwin_filelist; do + darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP` + lipo -create -output "$darwin_file" $darwin_files + done # $darwin_filelist + ${rm}r unfat-$$ + cd "$darwin_orig_dir" + else + cd "$darwin_orig_dir" + func_extract_an_archive "$my_xdir" "$my_xabs" + fi # $darwin_arches + fi # $run + ;; + *) + func_extract_an_archive "$my_xdir" "$my_xabs" + ;; + esac + my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP` + done + func_extract_archives_result="$my_oldobjs" +} +# End of Shell function definitions +##################################### + +# Darwin sucks +eval std_shrext=\"$shrext_cmds\" + +disable_libs=no + +# Parse our command line options once, thoroughly. +while test "$#" -gt 0 +do + arg="$1" + shift + + case $arg in + -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;; + *) optarg= ;; + esac + + # If the previous option needs an argument, assign it. + if test -n "$prev"; then + case $prev in + execute_dlfiles) + execute_dlfiles="$execute_dlfiles $arg" + ;; + tag) + tagname="$arg" + preserve_args="${preserve_args}=$arg" + + # Check whether tagname contains only valid characters + case $tagname in + *[!-_A-Za-z0-9,/]*) + $echo "$progname: invalid tag name: $tagname" 1>&2 + exit $EXIT_FAILURE + ;; + esac + + case $tagname in + CC) + # Don't test for the "default" C tag, as we know, it's there, but + # not specially marked. + ;; + *) + if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "$progpath" > /dev/null; then + taglist="$taglist $tagname" + # Evaluate the configuration. + eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$tagname'$/,/^# ### END LIBTOOL TAG CONFIG: '$tagname'$/p' < $progpath`" + else + $echo "$progname: ignoring unknown tag $tagname" 1>&2 + fi + ;; + esac + ;; + *) + eval "$prev=\$arg" + ;; + esac + + prev= + prevopt= + continue + fi + + # Have we seen a non-optional argument yet? + case $arg in + --help) + show_help=yes + ;; + + --version) + echo "\ +$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP + +Copyright (C) 2007 Free Software Foundation, Inc. +This is free software; see the source for copying conditions. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." + exit $? + ;; + + --config) + ${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $progpath + # Now print the configurations for the tags. + for tagname in $taglist; do + ${SED} -n -e "/^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^# ### END LIBTOOL TAG CONFIG: $tagname$/p" < "$progpath" + done + exit $? + ;; + + --debug) + $echo "$progname: enabling shell trace mode" + set -x + preserve_args="$preserve_args $arg" + ;; + + --dry-run | -n) + run=: + ;; + + --features) + $echo "host: $host" + if test "$build_libtool_libs" = yes; then + $echo "enable shared libraries" + else + $echo "disable shared libraries" + fi + if test "$build_old_libs" = yes; then + $echo "enable static libraries" + else + $echo "disable static libraries" + fi + exit $? + ;; + + --finish) mode="finish" ;; + + --mode) prevopt="--mode" prev=mode ;; + --mode=*) mode="$optarg" ;; + + --preserve-dup-deps) duplicate_deps="yes" ;; + + --quiet | --silent) + show=: + preserve_args="$preserve_args $arg" + ;; + + --tag) + prevopt="--tag" + prev=tag + preserve_args="$preserve_args --tag" + ;; + --tag=*) + set tag "$optarg" ${1+"$@"} + shift + prev=tag + preserve_args="$preserve_args --tag" + ;; + + -dlopen) + prevopt="-dlopen" + prev=execute_dlfiles + ;; + + -*) + $echo "$modename: unrecognized option \`$arg'" 1>&2 + $echo "$help" 1>&2 + exit $EXIT_FAILURE + ;; + + *) + nonopt="$arg" + break + ;; + esac +done + +if test -n "$prevopt"; then + $echo "$modename: option \`$prevopt' requires an argument" 1>&2 + $echo "$help" 1>&2 + exit $EXIT_FAILURE +fi + +case $disable_libs in +no) + ;; +shared) + build_libtool_libs=no + build_old_libs=yes + ;; +static) + build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac` + ;; +esac + +# If this variable is set in any of the actions, the command in it +# will be execed at the end. This prevents here-documents from being +# left over by shells. +exec_cmd= + +if test -z "$show_help"; then + + # Infer the operation mode. + if test -z "$mode"; then + $echo "*** Warning: inferring the mode of operation is deprecated." 1>&2 + $echo "*** Future versions of Libtool will require --mode=MODE be specified." 1>&2 + case $nonopt in + *cc | cc* | *++ | gcc* | *-gcc* | g++* | xlc*) + mode=link + for arg + do + case $arg in + -c) + mode=compile + break + ;; + esac + done + ;; + *db | *dbx | *strace | *truss) + mode=execute + ;; + *install*|cp|mv) + mode=install + ;; + *rm) + mode=uninstall + ;; + *) + # If we have no mode, but dlfiles were specified, then do execute mode. + test -n "$execute_dlfiles" && mode=execute + + # Just use the default operation mode. + if test -z "$mode"; then + if test -n "$nonopt"; then + $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2 + else + $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2 + fi + fi + ;; + esac + fi + + # Only execute mode is allowed to have -dlopen flags. + if test -n "$execute_dlfiles" && test "$mode" != execute; then + $echo "$modename: unrecognized option \`-dlopen'" 1>&2 + $echo "$help" 1>&2 + exit $EXIT_FAILURE + fi + + # Change the help message to a mode-specific one. + generic_help="$help" + help="Try \`$modename --help --mode=$mode' for more information." + + # These modes are in order of execution frequency so that they run quickly. + case $mode in + # libtool compile mode + compile) + modename="$modename: compile" + # Get the compilation command and the source file. + base_compile= + srcfile="$nonopt" # always keep a non-empty value in "srcfile" + suppress_opt=yes + suppress_output= + arg_mode=normal + libobj= + later= + + for arg + do + case $arg_mode in + arg ) + # do not "continue". Instead, add this to base_compile + lastarg="$arg" + arg_mode=normal + ;; + + target ) + libobj="$arg" + arg_mode=normal + continue + ;; + + normal ) + # Accept any command-line options. + case $arg in + -o) + if test -n "$libobj" ; then + $echo "$modename: you cannot specify \`-o' more than once" 1>&2 + exit $EXIT_FAILURE + fi + arg_mode=target + continue + ;; + + -static | -prefer-pic | -prefer-non-pic) + later="$later $arg" + continue + ;; + + -no-suppress) + suppress_opt=no + continue + ;; + + -Xcompiler) + arg_mode=arg # the next one goes into the "base_compile" arg list + continue # The current "srcfile" will either be retained or + ;; # replaced later. I would guess that would be a bug. + + -Wc,*) + args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"` + lastarg= + save_ifs="$IFS"; IFS=',' + for arg in $args; do + IFS="$save_ifs" + + # Double-quote args containing other shell metacharacters. + # Many Bourne shells cannot handle close brackets correctly + # in scan sets, so we specify it separately. + case $arg in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + arg="\"$arg\"" + ;; + esac + lastarg="$lastarg $arg" + done + IFS="$save_ifs" + lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"` + + # Add the arguments to base_compile. + base_compile="$base_compile $lastarg" + continue + ;; + + * ) + # Accept the current argument as the source file. + # The previous "srcfile" becomes the current argument. + # + lastarg="$srcfile" + srcfile="$arg" + ;; + esac # case $arg + ;; + esac # case $arg_mode + + # Aesthetically quote the previous argument. + lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"` + + case $lastarg in + # Double-quote args containing other shell metacharacters. + # Many Bourne shells cannot handle close brackets correctly + # in scan sets, and some SunOS ksh mistreat backslash-escaping + # in scan sets (worked around with variable expansion), + # and furthermore cannot handle '|' '&' '(' ')' in scan sets + # at all, so we specify them separately. + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + lastarg="\"$lastarg\"" + ;; + esac + + base_compile="$base_compile $lastarg" + done # for arg + + case $arg_mode in + arg) + $echo "$modename: you must specify an argument for -Xcompile" + exit $EXIT_FAILURE + ;; + target) + $echo "$modename: you must specify a target with \`-o'" 1>&2 + exit $EXIT_FAILURE + ;; + *) + # Get the name of the library object. + [ -z "$libobj" ] && libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'` + ;; + esac + + # Recognize several different file suffixes. + # If the user specifies -o file.o, it is replaced with file.lo + xform='[cCFSifmso]' + case $libobj in + *.ada) xform=ada ;; + *.adb) xform=adb ;; + *.ads) xform=ads ;; + *.asm) xform=asm ;; + *.c++) xform=c++ ;; + *.cc) xform=cc ;; + *.ii) xform=ii ;; + *.class) xform=class ;; + *.cpp) xform=cpp ;; + *.cxx) xform=cxx ;; + *.[fF][09]?) xform=[fF][09]. ;; + *.for) xform=for ;; + *.java) xform=java ;; + *.obj) xform=obj ;; + esac + + libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"` + + case $libobj in + *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;; + *) + $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2 + exit $EXIT_FAILURE + ;; + esac + + func_infer_tag $base_compile + + for arg in $later; do + case $arg in + -static) + build_old_libs=yes + continue + ;; + + -prefer-pic) + pic_mode=yes + continue + ;; + + -prefer-non-pic) + pic_mode=no + continue + ;; + esac + done + + qlibobj=`$echo "X$libobj" | $Xsed -e "$sed_quote_subst"` + case $qlibobj in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + qlibobj="\"$qlibobj\"" ;; + esac + test "X$libobj" != "X$qlibobj" \ + && $echo "X$libobj" | grep '[]~#^*{};<>?"'"'"' &()|`$[]' \ + && $echo "$modename: libobj name \`$libobj' may not contain shell special characters." + objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'` + xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'` + if test "X$xdir" = "X$obj"; then + xdir= + else + xdir=$xdir/ + fi + lobj=${xdir}$objdir/$objname + + if test -z "$base_compile"; then + $echo "$modename: you must specify a compilation command" 1>&2 + $echo "$help" 1>&2 + exit $EXIT_FAILURE + fi + + # Delete any leftover library objects. + if test "$build_old_libs" = yes; then + removelist="$obj $lobj $libobj ${libobj}T" + else + removelist="$lobj $libobj ${libobj}T" + fi + + $run $rm $removelist + trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15 + + # On Cygwin there's no "real" PIC flag so we must build both object types + case $host_os in + cygwin* | mingw* | pw32* | os2*) + pic_mode=default + ;; + esac + if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then + # non-PIC code in shared libraries is not supported + pic_mode=default + fi + + # Calculate the filename of the output object if compiler does + # not support -o with -c + if test "$compiler_c_o" = no; then + output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext} + lockfile="$output_obj.lock" + removelist="$removelist $output_obj $lockfile" + trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15 + else + output_obj= + need_locks=no + lockfile= + fi + + # Lock this critical section if it is needed + # We use this script file to make the link, it avoids creating a new file + if test "$need_locks" = yes; then + until $run ln "$progpath" "$lockfile" 2>/dev/null; do + $show "Waiting for $lockfile to be removed" + sleep 2 + done + elif test "$need_locks" = warn; then + if test -f "$lockfile"; then + $echo "\ +*** ERROR, $lockfile exists and contains: +`cat $lockfile 2>/dev/null` + +This indicates that another process is trying to use the same +temporary object file, and libtool could not work around it because +your compiler does not support \`-c' and \`-o' together. If you +repeat this compilation, it may succeed, by chance, but you had better +avoid parallel builds (make -j) in this platform, or get a better +compiler." + + $run $rm $removelist + exit $EXIT_FAILURE + fi + $echo "$srcfile" > "$lockfile" + fi + + if test -n "$fix_srcfile_path"; then + eval srcfile=\"$fix_srcfile_path\" + fi + qsrcfile=`$echo "X$srcfile" | $Xsed -e "$sed_quote_subst"` + case $qsrcfile in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + qsrcfile="\"$qsrcfile\"" ;; + esac + + $run $rm "$libobj" "${libobj}T" + + # Create a libtool object file (analogous to a ".la" file), + # but don't create it if we're doing a dry run. + test -z "$run" && cat > ${libobj}T </dev/null`" != "X$srcfile"; then + $echo "\ +*** ERROR, $lockfile contains: +`cat $lockfile 2>/dev/null` + +but it should contain: +$srcfile + +This indicates that another process is trying to use the same +temporary object file, and libtool could not work around it because +your compiler does not support \`-c' and \`-o' together. If you +repeat this compilation, it may succeed, by chance, but you had better +avoid parallel builds (make -j) in this platform, or get a better +compiler." + + $run $rm $removelist + exit $EXIT_FAILURE + fi + + # Just move the object if needed, then go on to compile the next one + if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then + $show "$mv $output_obj $lobj" + if $run $mv $output_obj $lobj; then : + else + error=$? + $run $rm $removelist + exit $error + fi + fi + + # Append the name of the PIC object to the libtool object file. + test -z "$run" && cat >> ${libobj}T <> ${libobj}T </dev/null`" != "X$srcfile"; then + $echo "\ +*** ERROR, $lockfile contains: +`cat $lockfile 2>/dev/null` + +but it should contain: +$srcfile + +This indicates that another process is trying to use the same +temporary object file, and libtool could not work around it because +your compiler does not support \`-c' and \`-o' together. If you +repeat this compilation, it may succeed, by chance, but you had better +avoid parallel builds (make -j) in this platform, or get a better +compiler." + + $run $rm $removelist + exit $EXIT_FAILURE + fi + + # Just move the object if needed + if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then + $show "$mv $output_obj $obj" + if $run $mv $output_obj $obj; then : + else + error=$? + $run $rm $removelist + exit $error + fi + fi + + # Append the name of the non-PIC object the libtool object file. + # Only append if the libtool object file exists. + test -z "$run" && cat >> ${libobj}T <> ${libobj}T <&2 + fi + if test -n "$link_static_flag"; then + dlopen_self=$dlopen_self_static + fi + prefer_static_libs=yes + ;; + -static) + if test -z "$pic_flag" && test -n "$link_static_flag"; then + dlopen_self=$dlopen_self_static + fi + prefer_static_libs=built + ;; + -static-libtool-libs) + if test -z "$pic_flag" && test -n "$link_static_flag"; then + dlopen_self=$dlopen_self_static + fi + prefer_static_libs=yes + ;; + esac + build_libtool_libs=no + build_old_libs=yes + break + ;; + esac + done + + # See if our shared archives depend on static archives. + test -n "$old_archive_from_new_cmds" && build_old_libs=yes + + # Go through the arguments, transforming them on the way. + while test "$#" -gt 0; do + arg="$1" + shift + case $arg in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + qarg=\"`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`\" ### testsuite: skip nested quoting test + ;; + *) qarg=$arg ;; + esac + libtool_args="$libtool_args $qarg" + + # If the previous option needs an argument, assign it. + if test -n "$prev"; then + case $prev in + output) + compile_command="$compile_command @OUTPUT@" + finalize_command="$finalize_command @OUTPUT@" + ;; + esac + + case $prev in + dlfiles|dlprefiles) + if test "$preload" = no; then + # Add the symbol object into the linking commands. + compile_command="$compile_command @SYMFILE@" + finalize_command="$finalize_command @SYMFILE@" + preload=yes + fi + case $arg in + *.la | *.lo) ;; # We handle these cases below. + force) + if test "$dlself" = no; then + dlself=needless + export_dynamic=yes + fi + prev= + continue + ;; + self) + if test "$prev" = dlprefiles; then + dlself=yes + elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then + dlself=yes + else + dlself=needless + export_dynamic=yes + fi + prev= + continue + ;; + *) + if test "$prev" = dlfiles; then + dlfiles="$dlfiles $arg" + else + dlprefiles="$dlprefiles $arg" + fi + prev= + continue + ;; + esac + ;; + expsyms) + export_symbols="$arg" + if test ! -f "$arg"; then + $echo "$modename: symbol file \`$arg' does not exist" + exit $EXIT_FAILURE + fi + prev= + continue + ;; + expsyms_regex) + export_symbols_regex="$arg" + prev= + continue + ;; + inst_prefix) + inst_prefix_dir="$arg" + prev= + continue + ;; + precious_regex) + precious_files_regex="$arg" + prev= + continue + ;; + release) + release="-$arg" + prev= + continue + ;; + objectlist) + if test -f "$arg"; then + save_arg=$arg + moreargs= + for fil in `cat $save_arg` + do +# moreargs="$moreargs $fil" + arg=$fil + # A libtool-controlled object. + + # Check to see that this really is a libtool object. + if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then + pic_object= + non_pic_object= + + # Read the .lo file + # If there is no directory component, then add one. + case $arg in + */* | *\\*) . $arg ;; + *) . ./$arg ;; + esac + + if test -z "$pic_object" || \ + test -z "$non_pic_object" || + test "$pic_object" = none && \ + test "$non_pic_object" = none; then + $echo "$modename: cannot find name of object for \`$arg'" 1>&2 + exit $EXIT_FAILURE + fi + + # Extract subdirectory from the argument. + xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` + if test "X$xdir" = "X$arg"; then + xdir= + else + xdir="$xdir/" + fi + + if test "$pic_object" != none; then + # Prepend the subdirectory the object is found in. + pic_object="$xdir$pic_object" + + if test "$prev" = dlfiles; then + if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then + dlfiles="$dlfiles $pic_object" + prev= + continue + else + # If libtool objects are unsupported, then we need to preload. + prev=dlprefiles + fi + fi + + # CHECK ME: I think I busted this. -Ossama + if test "$prev" = dlprefiles; then + # Preload the old-style object. + dlprefiles="$dlprefiles $pic_object" + prev= + fi + + # A PIC object. + libobjs="$libobjs $pic_object" + arg="$pic_object" + fi + + # Non-PIC object. + if test "$non_pic_object" != none; then + # Prepend the subdirectory the object is found in. + non_pic_object="$xdir$non_pic_object" + + # A standard non-PIC object + non_pic_objects="$non_pic_objects $non_pic_object" + if test -z "$pic_object" || test "$pic_object" = none ; then + arg="$non_pic_object" + fi + else + # If the PIC object exists, use it instead. + # $xdir was prepended to $pic_object above. + non_pic_object="$pic_object" + non_pic_objects="$non_pic_objects $non_pic_object" + fi + else + # Only an error if not doing a dry-run. + if test -z "$run"; then + $echo "$modename: \`$arg' is not a valid libtool object" 1>&2 + exit $EXIT_FAILURE + else + # Dry-run case. + + # Extract subdirectory from the argument. + xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` + if test "X$xdir" = "X$arg"; then + xdir= + else + xdir="$xdir/" + fi + + pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"` + non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"` + libobjs="$libobjs $pic_object" + non_pic_objects="$non_pic_objects $non_pic_object" + fi + fi + done + else + $echo "$modename: link input file \`$save_arg' does not exist" + exit $EXIT_FAILURE + fi + arg=$save_arg + prev= + continue + ;; + rpath | xrpath) + # We need an absolute path. + case $arg in + [\\/]* | [A-Za-z]:[\\/]*) ;; + *) + $echo "$modename: only absolute run-paths are allowed" 1>&2 + exit $EXIT_FAILURE + ;; + esac + if test "$prev" = rpath; then + case "$rpath " in + *" $arg "*) ;; + *) rpath="$rpath $arg" ;; + esac + else + case "$xrpath " in + *" $arg "*) ;; + *) xrpath="$xrpath $arg" ;; + esac + fi + prev= + continue + ;; + xcompiler) + compiler_flags="$compiler_flags $qarg" + prev= + compile_command="$compile_command $qarg" + finalize_command="$finalize_command $qarg" + continue + ;; + xlinker) + linker_flags="$linker_flags $qarg" + compiler_flags="$compiler_flags $wl$qarg" + prev= + compile_command="$compile_command $wl$qarg" + finalize_command="$finalize_command $wl$qarg" + continue + ;; + xcclinker) + linker_flags="$linker_flags $qarg" + compiler_flags="$compiler_flags $qarg" + prev= + compile_command="$compile_command $qarg" + finalize_command="$finalize_command $qarg" + continue + ;; + shrext) + shrext_cmds="$arg" + prev= + continue + ;; + darwin_framework|darwin_framework_skip) + test "$prev" = "darwin_framework" && compiler_flags="$compiler_flags $arg" + compile_command="$compile_command $arg" + finalize_command="$finalize_command $arg" + prev= + continue + ;; + *) + eval "$prev=\"\$arg\"" + prev= + continue + ;; + esac + fi # test -n "$prev" + + prevarg="$arg" + + case $arg in + -all-static) + if test -n "$link_static_flag"; then + compile_command="$compile_command $link_static_flag" + finalize_command="$finalize_command $link_static_flag" + fi + continue + ;; + + -allow-undefined) + # FIXME: remove this flag sometime in the future. + $echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2 + continue + ;; + + -avoid-version) + avoid_version=yes + continue + ;; + + -dlopen) + prev=dlfiles + continue + ;; + + -dlpreopen) + prev=dlprefiles + continue + ;; + + -export-dynamic) + export_dynamic=yes + continue + ;; + + -export-symbols | -export-symbols-regex) + if test -n "$export_symbols" || test -n "$export_symbols_regex"; then + $echo "$modename: more than one -exported-symbols argument is not allowed" + exit $EXIT_FAILURE + fi + if test "X$arg" = "X-export-symbols"; then + prev=expsyms + else + prev=expsyms_regex + fi + continue + ;; + + -framework|-arch|-isysroot) + case " $CC " in + *" ${arg} ${1} "* | *" ${arg} ${1} "*) + prev=darwin_framework_skip ;; + *) compiler_flags="$compiler_flags $arg" + prev=darwin_framework ;; + esac + compile_command="$compile_command $arg" + finalize_command="$finalize_command $arg" + continue + ;; + + -inst-prefix-dir) + prev=inst_prefix + continue + ;; + + # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:* + # so, if we see these flags be careful not to treat them like -L + -L[A-Z][A-Z]*:*) + case $with_gcc/$host in + no/*-*-irix* | /*-*-irix*) + compile_command="$compile_command $arg" + finalize_command="$finalize_command $arg" + ;; + esac + continue + ;; + + -L*) + dir=`$echo "X$arg" | $Xsed -e 's/^-L//'` + # We need an absolute path. + case $dir in + [\\/]* | [A-Za-z]:[\\/]*) ;; + *) + absdir=`cd "$dir" && pwd` + if test -z "$absdir"; then + $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2 + absdir="$dir" + notinst_path="$notinst_path $dir" + fi + dir="$absdir" + ;; + esac + case "$deplibs " in + *" -L$dir "*) ;; + *) + deplibs="$deplibs -L$dir" + lib_search_path="$lib_search_path $dir" + ;; + esac + case $host in + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) + testbindir=`$echo "X$dir" | $Xsed -e 's*/lib$*/bin*'` + case :$dllsearchpath: in + *":$dir:"*) ;; + *) dllsearchpath="$dllsearchpath:$dir";; + esac + case :$dllsearchpath: in + *":$testbindir:"*) ;; + *) dllsearchpath="$dllsearchpath:$testbindir";; + esac + ;; + esac + continue + ;; + + -l*) + if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then + case $host in + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos*) + # These systems don't actually have a C or math library (as such) + continue + ;; + *-*-os2*) + # These systems don't actually have a C library (as such) + test "X$arg" = "X-lc" && continue + ;; + *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) + # Do not include libc due to us having libc/libc_r. + test "X$arg" = "X-lc" && continue + ;; + *-*-rhapsody* | *-*-darwin1.[012]) + # Rhapsody C and math libraries are in the System framework + deplibs="$deplibs -framework System" + continue + ;; + *-*-sco3.2v5* | *-*-sco5v6*) + # Causes problems with __ctype + test "X$arg" = "X-lc" && continue + ;; + *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) + # Compiler inserts libc in the correct place for threads to work + test "X$arg" = "X-lc" && continue + ;; + esac + elif test "X$arg" = "X-lc_r"; then + case $host in + *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) + # Do not include libc_r directly, use -pthread flag. + continue + ;; + esac + fi + deplibs="$deplibs $arg" + continue + ;; + + # Tru64 UNIX uses -model [arg] to determine the layout of C++ + # classes, name mangling, and exception handling. + -model) + compile_command="$compile_command $arg" + compiler_flags="$compiler_flags $arg" + finalize_command="$finalize_command $arg" + prev=xcompiler + continue + ;; + + -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads) + compiler_flags="$compiler_flags $arg" + compile_command="$compile_command $arg" + finalize_command="$finalize_command $arg" + continue + ;; + + -module) + module=yes + continue + ;; + + # -64, -mips[0-9] enable 64-bit mode on the SGI compiler + # -r[0-9][0-9]* specifies the processor on the SGI compiler + # -xarch=*, -xtarget=* enable 64-bit mode on the Sun compiler + # +DA*, +DD* enable 64-bit mode on the HP compiler + # -q* pass through compiler args for the IBM compiler + # -m* pass through architecture-specific compiler args for GCC + # -m*, -t[45]*, -txscale* pass through architecture-specific + # compiler args for GCC + # -p, -pg, --coverage, -fprofile-* pass through profiling flag for GCC + # -F/path gives path to uninstalled frameworks, gcc on darwin + # @file GCC response files + -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \ + -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*) + + # Unknown arguments in both finalize_command and compile_command need + # to be aesthetically quoted because they are evaled later. + arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` + case $arg in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + arg="\"$arg\"" + ;; + esac + compile_command="$compile_command $arg" + finalize_command="$finalize_command $arg" + compiler_flags="$compiler_flags $arg" + continue + ;; + + -shrext) + prev=shrext + continue + ;; + + -no-fast-install) + fast_install=no + continue + ;; + + -no-install) + case $host in + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin*) + # The PATH hackery in wrapper scripts is required on Windows + # and Darwin in order for the loader to find any dlls it needs. + $echo "$modename: warning: \`-no-install' is ignored for $host" 1>&2 + $echo "$modename: warning: assuming \`-no-fast-install' instead" 1>&2 + fast_install=no + ;; + *) no_install=yes ;; + esac + continue + ;; + + -no-undefined) + allow_undefined=no + continue + ;; + + -objectlist) + prev=objectlist + continue + ;; + + -o) prev=output ;; + + -precious-files-regex) + prev=precious_regex + continue + ;; + + -release) + prev=release + continue + ;; + + -rpath) + prev=rpath + continue + ;; + + -R) + prev=xrpath + continue + ;; + + -R*) + dir=`$echo "X$arg" | $Xsed -e 's/^-R//'` + # We need an absolute path. + case $dir in + [\\/]* | [A-Za-z]:[\\/]*) ;; + *) + $echo "$modename: only absolute run-paths are allowed" 1>&2 + exit $EXIT_FAILURE + ;; + esac + case "$xrpath " in + *" $dir "*) ;; + *) xrpath="$xrpath $dir" ;; + esac + continue + ;; + + -static | -static-libtool-libs) + # The effects of -static are defined in a previous loop. + # We used to do the same as -all-static on platforms that + # didn't have a PIC flag, but the assumption that the effects + # would be equivalent was wrong. It would break on at least + # Digital Unix and AIX. + continue + ;; + + -thread-safe) + thread_safe=yes + continue + ;; + + -version-info) + prev=vinfo + continue + ;; + -version-number) + prev=vinfo + vinfo_number=yes + continue + ;; + + -Wc,*) + args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'` + arg= + save_ifs="$IFS"; IFS=',' + for flag in $args; do + IFS="$save_ifs" + case $flag in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + flag="\"$flag\"" + ;; + esac + arg="$arg $wl$flag" + compiler_flags="$compiler_flags $flag" + done + IFS="$save_ifs" + arg=`$echo "X$arg" | $Xsed -e "s/^ //"` + ;; + + -Wl,*) + args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'` + arg= + save_ifs="$IFS"; IFS=',' + for flag in $args; do + IFS="$save_ifs" + case $flag in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + flag="\"$flag\"" + ;; + esac + arg="$arg $wl$flag" + compiler_flags="$compiler_flags $wl$flag" + linker_flags="$linker_flags $flag" + done + IFS="$save_ifs" + arg=`$echo "X$arg" | $Xsed -e "s/^ //"` + ;; + + -Xcompiler) + prev=xcompiler + continue + ;; + + -Xlinker) + prev=xlinker + continue + ;; + + -XCClinker) + prev=xcclinker + continue + ;; + + # Some other compiler flag. + -* | +*) + # Unknown arguments in both finalize_command and compile_command need + # to be aesthetically quoted because they are evaled later. + arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` + case $arg in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + arg="\"$arg\"" + ;; + esac + ;; + + *.$objext) + # A standard object. + objs="$objs $arg" + ;; + + *.lo) + # A libtool-controlled object. + + # Check to see that this really is a libtool object. + if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then + pic_object= + non_pic_object= + + # Read the .lo file + # If there is no directory component, then add one. + case $arg in + */* | *\\*) . $arg ;; + *) . ./$arg ;; + esac + + if test -z "$pic_object" || \ + test -z "$non_pic_object" || + test "$pic_object" = none && \ + test "$non_pic_object" = none; then + $echo "$modename: cannot find name of object for \`$arg'" 1>&2 + exit $EXIT_FAILURE + fi + + # Extract subdirectory from the argument. + xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` + if test "X$xdir" = "X$arg"; then + xdir= + else + xdir="$xdir/" + fi + + if test "$pic_object" != none; then + # Prepend the subdirectory the object is found in. + pic_object="$xdir$pic_object" + + if test "$prev" = dlfiles; then + if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then + dlfiles="$dlfiles $pic_object" + prev= + continue + else + # If libtool objects are unsupported, then we need to preload. + prev=dlprefiles + fi + fi + + # CHECK ME: I think I busted this. -Ossama + if test "$prev" = dlprefiles; then + # Preload the old-style object. + dlprefiles="$dlprefiles $pic_object" + prev= + fi + + # A PIC object. + libobjs="$libobjs $pic_object" + arg="$pic_object" + fi + + # Non-PIC object. + if test "$non_pic_object" != none; then + # Prepend the subdirectory the object is found in. + non_pic_object="$xdir$non_pic_object" + + # A standard non-PIC object + non_pic_objects="$non_pic_objects $non_pic_object" + if test -z "$pic_object" || test "$pic_object" = none ; then + arg="$non_pic_object" + fi + else + # If the PIC object exists, use it instead. + # $xdir was prepended to $pic_object above. + non_pic_object="$pic_object" + non_pic_objects="$non_pic_objects $non_pic_object" + fi + else + # Only an error if not doing a dry-run. + if test -z "$run"; then + $echo "$modename: \`$arg' is not a valid libtool object" 1>&2 + exit $EXIT_FAILURE + else + # Dry-run case. + + # Extract subdirectory from the argument. + xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` + if test "X$xdir" = "X$arg"; then + xdir= + else + xdir="$xdir/" + fi + + pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"` + non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"` + libobjs="$libobjs $pic_object" + non_pic_objects="$non_pic_objects $non_pic_object" + fi + fi + ;; + + *.$libext) + # An archive. + deplibs="$deplibs $arg" + old_deplibs="$old_deplibs $arg" + continue + ;; + + *.la) + # A libtool-controlled library. + + if test "$prev" = dlfiles; then + # This library was specified with -dlopen. + dlfiles="$dlfiles $arg" + prev= + elif test "$prev" = dlprefiles; then + # The library was specified with -dlpreopen. + dlprefiles="$dlprefiles $arg" + prev= + else + deplibs="$deplibs $arg" + fi + continue + ;; + + # Some other compiler argument. + *) + # Unknown arguments in both finalize_command and compile_command need + # to be aesthetically quoted because they are evaled later. + arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` + case $arg in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + arg="\"$arg\"" + ;; + esac + ;; + esac # arg + + # Now actually substitute the argument into the commands. + if test -n "$arg"; then + compile_command="$compile_command $arg" + finalize_command="$finalize_command $arg" + fi + done # argument parsing loop + + if test -n "$prev"; then + $echo "$modename: the \`$prevarg' option requires an argument" 1>&2 + $echo "$help" 1>&2 + exit $EXIT_FAILURE + fi + + if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then + eval arg=\"$export_dynamic_flag_spec\" + compile_command="$compile_command $arg" + finalize_command="$finalize_command $arg" + fi + + oldlibs= + # calculate the name of the file, without its directory + outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'` + libobjs_save="$libobjs" + + if test -n "$shlibpath_var"; then + # get the directories listed in $shlibpath_var + eval shlib_search_path=\`\$echo \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\` + else + shlib_search_path= + fi + eval sys_lib_search_path=\"$sys_lib_search_path_spec\" + eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\" + + output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'` + if test "X$output_objdir" = "X$output"; then + output_objdir="$objdir" + else + output_objdir="$output_objdir/$objdir" + fi + # Create the object directory. + if test ! -d "$output_objdir"; then + $show "$mkdir $output_objdir" + $run $mkdir $output_objdir + exit_status=$? + if test "$exit_status" -ne 0 && test ! -d "$output_objdir"; then + exit $exit_status + fi + fi + + # Determine the type of output + case $output in + "") + $echo "$modename: you must specify an output file" 1>&2 + $echo "$help" 1>&2 + exit $EXIT_FAILURE + ;; + *.$libext) linkmode=oldlib ;; + *.lo | *.$objext) linkmode=obj ;; + *.la) linkmode=lib ;; + *) linkmode=prog ;; # Anything else should be a program. + esac + + case $host in + *cygwin* | *mingw* | *pw32*) + # don't eliminate duplications in $postdeps and $predeps + duplicate_compiler_generated_deps=yes + ;; + *) + duplicate_compiler_generated_deps=$duplicate_deps + ;; + esac + specialdeplibs= + + libs= + # Find all interdependent deplibs by searching for libraries + # that are linked more than once (e.g. -la -lb -la) + for deplib in $deplibs; do + if test "X$duplicate_deps" = "Xyes" ; then + case "$libs " in + *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; + esac + fi + libs="$libs $deplib" + done + + if test "$linkmode" = lib; then + libs="$predeps $libs $compiler_lib_search_path $postdeps" + + # Compute libraries that are listed more than once in $predeps + # $postdeps and mark them as special (i.e., whose duplicates are + # not to be eliminated). + pre_post_deps= + if test "X$duplicate_compiler_generated_deps" = "Xyes" ; then + for pre_post_dep in $predeps $postdeps; do + case "$pre_post_deps " in + *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;; + esac + pre_post_deps="$pre_post_deps $pre_post_dep" + done + fi + pre_post_deps= + fi + + deplibs= + newdependency_libs= + newlib_search_path= + need_relink=no # whether we're linking any uninstalled libtool libraries + notinst_deplibs= # not-installed libtool libraries + case $linkmode in + lib) + passes="conv link" + for file in $dlfiles $dlprefiles; do + case $file in + *.la) ;; + *) + $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2 + exit $EXIT_FAILURE + ;; + esac + done + ;; + prog) + compile_deplibs= + finalize_deplibs= + alldeplibs=no + newdlfiles= + newdlprefiles= + passes="conv scan dlopen dlpreopen link" + ;; + *) passes="conv" + ;; + esac + for pass in $passes; do + if test "$linkmode,$pass" = "lib,link" || + test "$linkmode,$pass" = "prog,scan"; then + libs="$deplibs" + deplibs= + fi + if test "$linkmode" = prog; then + case $pass in + dlopen) libs="$dlfiles" ;; + dlpreopen) libs="$dlprefiles" ;; + link) + libs="$deplibs %DEPLIBS%" + test "X$link_all_deplibs" != Xno && libs="$libs $dependency_libs" + ;; + esac + fi + if test "$pass" = dlopen; then + # Collect dlpreopened libraries + save_deplibs="$deplibs" + deplibs= + fi + for deplib in $libs; do + lib= + found=no + case $deplib in + -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads) + if test "$linkmode,$pass" = "prog,link"; then + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + else + compiler_flags="$compiler_flags $deplib" + fi + continue + ;; + -l*) + if test "$linkmode" != lib && test "$linkmode" != prog; then + $echo "$modename: warning: \`-l' is ignored for archives/objects" 1>&2 + continue + fi + name=`$echo "X$deplib" | $Xsed -e 's/^-l//'` + for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do + for search_ext in .la $std_shrext .so .a; do + # Search the libtool library + lib="$searchdir/lib${name}${search_ext}" + if test -f "$lib"; then + if test "$search_ext" = ".la"; then + found=yes + else + found=no + fi + break 2 + fi + done + done + if test "$found" != yes; then + # deplib doesn't seem to be a libtool library + if test "$linkmode,$pass" = "prog,link"; then + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + else + deplibs="$deplib $deplibs" + test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" + fi + continue + else # deplib is a libtool library + # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib, + # We need to do some special things here, and not later. + if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then + case " $predeps $postdeps " in + *" $deplib "*) + if (${SED} -e '2q' $lib | + grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then + library_names= + old_library= + case $lib in + */* | *\\*) . $lib ;; + *) . ./$lib ;; + esac + for l in $old_library $library_names; do + ll="$l" + done + if test "X$ll" = "X$old_library" ; then # only static version available + found=no + ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'` + test "X$ladir" = "X$lib" && ladir="." + lib=$ladir/$old_library + if test "$linkmode,$pass" = "prog,link"; then + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + else + deplibs="$deplib $deplibs" + test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" + fi + continue + fi + fi + ;; + *) ;; + esac + fi + fi + ;; # -l + -L*) + case $linkmode in + lib) + deplibs="$deplib $deplibs" + test "$pass" = conv && continue + newdependency_libs="$deplib $newdependency_libs" + newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'` + ;; + prog) + if test "$pass" = conv; then + deplibs="$deplib $deplibs" + continue + fi + if test "$pass" = scan; then + deplibs="$deplib $deplibs" + else + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + fi + newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'` + ;; + *) + $echo "$modename: warning: \`-L' is ignored for archives/objects" 1>&2 + ;; + esac # linkmode + continue + ;; # -L + -R*) + if test "$pass" = link; then + dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'` + # Make sure the xrpath contains only unique directories. + case "$xrpath " in + *" $dir "*) ;; + *) xrpath="$xrpath $dir" ;; + esac + fi + deplibs="$deplib $deplibs" + continue + ;; + *.la) lib="$deplib" ;; + *.$libext) + if test "$pass" = conv; then + deplibs="$deplib $deplibs" + continue + fi + case $linkmode in + lib) + valid_a_lib=no + case $deplibs_check_method in + match_pattern*) + set dummy $deplibs_check_method + match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"` + if eval $echo \"$deplib\" 2>/dev/null \ + | $SED 10q \ + | $EGREP "$match_pattern_regex" > /dev/null; then + valid_a_lib=yes + fi + ;; + pass_all) + valid_a_lib=yes + ;; + esac + if test "$valid_a_lib" != yes; then + $echo + $echo "*** Warning: Trying to link with static lib archive $deplib." + $echo "*** I have the capability to make that library automatically link in when" + $echo "*** you link to this library. But I can only do this if you have a" + $echo "*** shared version of the library, which you do not appear to have" + $echo "*** because the file extensions .$libext of this argument makes me believe" + $echo "*** that it is just a static archive that I should not used here." + else + $echo + $echo "*** Warning: Linking the shared library $output against the" + $echo "*** static library $deplib is not portable!" + deplibs="$deplib $deplibs" + fi + continue + ;; + prog) + if test "$pass" != link; then + deplibs="$deplib $deplibs" + else + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + fi + continue + ;; + esac # linkmode + ;; # *.$libext + *.lo | *.$objext) + if test "$pass" = conv; then + deplibs="$deplib $deplibs" + elif test "$linkmode" = prog; then + if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then + # If there is no dlopen support or we're linking statically, + # we need to preload. + newdlprefiles="$newdlprefiles $deplib" + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + else + newdlfiles="$newdlfiles $deplib" + fi + fi + continue + ;; + %DEPLIBS%) + alldeplibs=yes + continue + ;; + esac # case $deplib + if test "$found" = yes || test -f "$lib"; then : + else + $echo "$modename: cannot find the library \`$lib' or unhandled argument \`$deplib'" 1>&2 + exit $EXIT_FAILURE + fi + + # Check to see that this really is a libtool archive. + if (${SED} -e '2q' $lib | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : + else + $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 + exit $EXIT_FAILURE + fi + + ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'` + test "X$ladir" = "X$lib" && ladir="." + + dlname= + dlopen= + dlpreopen= + libdir= + library_names= + old_library= + # If the library was installed with an old release of libtool, + # it will not redefine variables installed, or shouldnotlink + installed=yes + shouldnotlink=no + avoidtemprpath= + + + # Read the .la file + case $lib in + */* | *\\*) . $lib ;; + *) . ./$lib ;; + esac + + if test "$linkmode,$pass" = "lib,link" || + test "$linkmode,$pass" = "prog,scan" || + { test "$linkmode" != prog && test "$linkmode" != lib; }; then + test -n "$dlopen" && dlfiles="$dlfiles $dlopen" + test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen" + fi + + if test "$pass" = conv; then + # Only check for convenience libraries + deplibs="$lib $deplibs" + if test -z "$libdir"; then + if test -z "$old_library"; then + $echo "$modename: cannot find name of link library for \`$lib'" 1>&2 + exit $EXIT_FAILURE + fi + # It is a libtool convenience library, so add in its objects. + convenience="$convenience $ladir/$objdir/$old_library" + old_convenience="$old_convenience $ladir/$objdir/$old_library" + tmp_libs= + for deplib in $dependency_libs; do + deplibs="$deplib $deplibs" + if test "X$duplicate_deps" = "Xyes" ; then + case "$tmp_libs " in + *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; + esac + fi + tmp_libs="$tmp_libs $deplib" + done + elif test "$linkmode" != prog && test "$linkmode" != lib; then + $echo "$modename: \`$lib' is not a convenience library" 1>&2 + exit $EXIT_FAILURE + fi + continue + fi # $pass = conv + + + # Get the name of the library we link against. + linklib= + for l in $old_library $library_names; do + linklib="$l" + done + if test -z "$linklib"; then + $echo "$modename: cannot find name of link library for \`$lib'" 1>&2 + exit $EXIT_FAILURE + fi + + # This library was specified with -dlopen. + if test "$pass" = dlopen; then + if test -z "$libdir"; then + $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2 + exit $EXIT_FAILURE + fi + if test -z "$dlname" || + test "$dlopen_support" != yes || + test "$build_libtool_libs" = no; then + # If there is no dlname, no dlopen support or we're linking + # statically, we need to preload. We also need to preload any + # dependent libraries so libltdl's deplib preloader doesn't + # bomb out in the load deplibs phase. + dlprefiles="$dlprefiles $lib $dependency_libs" + else + newdlfiles="$newdlfiles $lib" + fi + continue + fi # $pass = dlopen + + # We need an absolute path. + case $ladir in + [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;; + *) + abs_ladir=`cd "$ladir" && pwd` + if test -z "$abs_ladir"; then + $echo "$modename: warning: cannot determine absolute directory name of \`$ladir'" 1>&2 + $echo "$modename: passing it literally to the linker, although it might fail" 1>&2 + abs_ladir="$ladir" + fi + ;; + esac + laname=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` + + # Find the relevant object directory and library name. + if test "X$installed" = Xyes; then + if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then + $echo "$modename: warning: library \`$lib' was moved." 1>&2 + dir="$ladir" + absdir="$abs_ladir" + libdir="$abs_ladir" + else + dir="$libdir" + absdir="$libdir" + fi + test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes + else + if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then + dir="$ladir" + absdir="$abs_ladir" + # Remove this search path later + notinst_path="$notinst_path $abs_ladir" + else + dir="$ladir/$objdir" + absdir="$abs_ladir/$objdir" + # Remove this search path later + notinst_path="$notinst_path $abs_ladir" + fi + fi # $installed = yes + name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'` + + # This library was specified with -dlpreopen. + if test "$pass" = dlpreopen; then + if test -z "$libdir"; then + $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2 + exit $EXIT_FAILURE + fi + # Prefer using a static library (so that no silly _DYNAMIC symbols + # are required to link). + if test -n "$old_library"; then + newdlprefiles="$newdlprefiles $dir/$old_library" + # Otherwise, use the dlname, so that lt_dlopen finds it. + elif test -n "$dlname"; then + newdlprefiles="$newdlprefiles $dir/$dlname" + else + newdlprefiles="$newdlprefiles $dir/$linklib" + fi + fi # $pass = dlpreopen + + if test -z "$libdir"; then + # Link the convenience library + if test "$linkmode" = lib; then + deplibs="$dir/$old_library $deplibs" + elif test "$linkmode,$pass" = "prog,link"; then + compile_deplibs="$dir/$old_library $compile_deplibs" + finalize_deplibs="$dir/$old_library $finalize_deplibs" + else + deplibs="$lib $deplibs" # used for prog,scan pass + fi + continue + fi + + + if test "$linkmode" = prog && test "$pass" != link; then + newlib_search_path="$newlib_search_path $ladir" + deplibs="$lib $deplibs" + + linkalldeplibs=no + if test "$link_all_deplibs" != no || test -z "$library_names" || + test "$build_libtool_libs" = no; then + linkalldeplibs=yes + fi + + tmp_libs= + for deplib in $dependency_libs; do + case $deplib in + -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test + esac + # Need to link against all dependency_libs? + if test "$linkalldeplibs" = yes; then + deplibs="$deplib $deplibs" + else + # Need to hardcode shared library paths + # or/and link against static libraries + newdependency_libs="$deplib $newdependency_libs" + fi + if test "X$duplicate_deps" = "Xyes" ; then + case "$tmp_libs " in + *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; + esac + fi + tmp_libs="$tmp_libs $deplib" + done # for deplib + continue + fi # $linkmode = prog... + + if test "$linkmode,$pass" = "prog,link"; then + if test -n "$library_names" && + { { test "$prefer_static_libs" = no || + test "$prefer_static_libs,$installed" = "built,yes"; } || + test -z "$old_library"; }; then + # We need to hardcode the library path + if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then + # Make sure the rpath contains only unique directories. + case "$temp_rpath " in + *" $dir "*) ;; + *" $absdir "*) ;; + *) temp_rpath="$temp_rpath $absdir" ;; + esac + fi + + # Hardcode the library path. + # Skip directories that are in the system default run-time + # search path. + case " $sys_lib_dlsearch_path " in + *" $absdir "*) ;; + *) + case "$compile_rpath " in + *" $absdir "*) ;; + *) compile_rpath="$compile_rpath $absdir" + esac + ;; + esac + case " $sys_lib_dlsearch_path " in + *" $libdir "*) ;; + *) + case "$finalize_rpath " in + *" $libdir "*) ;; + *) finalize_rpath="$finalize_rpath $libdir" + esac + ;; + esac + fi # $linkmode,$pass = prog,link... + + if test "$alldeplibs" = yes && + { test "$deplibs_check_method" = pass_all || + { test "$build_libtool_libs" = yes && + test -n "$library_names"; }; }; then + # We only need to search for static libraries + continue + fi + fi + + link_static=no # Whether the deplib will be linked statically + use_static_libs=$prefer_static_libs + if test "$use_static_libs" = built && test "$installed" = yes ; then + use_static_libs=no + fi + if test -n "$library_names" && + { test "$use_static_libs" = no || test -z "$old_library"; }; then + if test "$installed" = no; then + notinst_deplibs="$notinst_deplibs $lib" + need_relink=yes + fi + # This is a shared library + + # Warn about portability, can't link against -module's on + # some systems (darwin) + if test "$shouldnotlink" = yes && test "$pass" = link ; then + $echo + if test "$linkmode" = prog; then + $echo "*** Warning: Linking the executable $output against the loadable module" + else + $echo "*** Warning: Linking the shared library $output against the loadable module" + fi + $echo "*** $linklib is not portable!" + fi + if test "$linkmode" = lib && + test "$hardcode_into_libs" = yes; then + # Hardcode the library path. + # Skip directories that are in the system default run-time + # search path. + case " $sys_lib_dlsearch_path " in + *" $absdir "*) ;; + *) + case "$compile_rpath " in + *" $absdir "*) ;; + *) compile_rpath="$compile_rpath $absdir" + esac + ;; + esac + case " $sys_lib_dlsearch_path " in + *" $libdir "*) ;; + *) + case "$finalize_rpath " in + *" $libdir "*) ;; + *) finalize_rpath="$finalize_rpath $libdir" + esac + ;; + esac + fi + + if test -n "$old_archive_from_expsyms_cmds"; then + # figure out the soname + set dummy $library_names + realname="$2" + shift; shift + libname=`eval \\$echo \"$libname_spec\"` + # use dlname if we got it. it's perfectly good, no? + if test -n "$dlname"; then + soname="$dlname" + elif test -n "$soname_spec"; then + # bleh windows + case $host in + *cygwin* | mingw*) + major=`expr $current - $age` + versuffix="-$major" + ;; + esac + eval soname=\"$soname_spec\" + else + soname="$realname" + fi + + # Make a new name for the extract_expsyms_cmds to use + soroot="$soname" + soname=`$echo $soroot | ${SED} -e 's/^.*\///'` + newlib="libimp-`$echo $soname | ${SED} 's/^lib//;s/\.dll$//'`.a" + + # If the library has no export list, then create one now + if test -f "$output_objdir/$soname-def"; then : + else + $show "extracting exported symbol list from \`$soname'" + save_ifs="$IFS"; IFS='~' + cmds=$extract_expsyms_cmds + for cmd in $cmds; do + IFS="$save_ifs" + eval cmd=\"$cmd\" + $show "$cmd" + $run eval "$cmd" || exit $? + done + IFS="$save_ifs" + fi + + # Create $newlib + if test -f "$output_objdir/$newlib"; then :; else + $show "generating import library for \`$soname'" + save_ifs="$IFS"; IFS='~' + cmds=$old_archive_from_expsyms_cmds + for cmd in $cmds; do + IFS="$save_ifs" + eval cmd=\"$cmd\" + $show "$cmd" + $run eval "$cmd" || exit $? + done + IFS="$save_ifs" + fi + # make sure the library variables are pointing to the new library + dir=$output_objdir + linklib=$newlib + fi # test -n "$old_archive_from_expsyms_cmds" + + if test "$linkmode" = prog || test "$mode" != relink; then + add_shlibpath= + add_dir= + add= + lib_linked=yes + case $hardcode_action in + immediate | unsupported) + if test "$hardcode_direct" = no; then + add="$dir/$linklib" + case $host in + *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;; + *-*-sysv4*uw2*) add_dir="-L$dir" ;; + *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \ + *-*-unixware7*) add_dir="-L$dir" ;; + *-*-darwin* ) + # if the lib is a module then we can not link against + # it, someone is ignoring the new warnings I added + if /usr/bin/file -L $add 2> /dev/null | + $EGREP ": [^:]* bundle" >/dev/null ; then + $echo "** Warning, lib $linklib is a module, not a shared library" + if test -z "$old_library" ; then + $echo + $echo "** And there doesn't seem to be a static archive available" + $echo "** The link will probably fail, sorry" + else + add="$dir/$old_library" + fi + fi + esac + elif test "$hardcode_minus_L" = no; then + case $host in + *-*-sunos*) add_shlibpath="$dir" ;; + esac + add_dir="-L$dir" + add="-l$name" + elif test "$hardcode_shlibpath_var" = no; then + add_shlibpath="$dir" + add="-l$name" + else + lib_linked=no + fi + ;; + relink) + if test "$hardcode_direct" = yes; then + add="$dir/$linklib" + elif test "$hardcode_minus_L" = yes; then + add_dir="-L$dir" + # Try looking first in the location we're being installed to. + if test -n "$inst_prefix_dir"; then + case $libdir in + [\\/]*) + add_dir="$add_dir -L$inst_prefix_dir$libdir" + ;; + esac + fi + add="-l$name" + elif test "$hardcode_shlibpath_var" = yes; then + add_shlibpath="$dir" + add="-l$name" + else + lib_linked=no + fi + ;; + *) lib_linked=no ;; + esac + + if test "$lib_linked" != yes; then + $echo "$modename: configuration error: unsupported hardcode properties" + exit $EXIT_FAILURE + fi + + if test -n "$add_shlibpath"; then + case :$compile_shlibpath: in + *":$add_shlibpath:"*) ;; + *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;; + esac + fi + if test "$linkmode" = prog; then + test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs" + test -n "$add" && compile_deplibs="$add $compile_deplibs" + else + test -n "$add_dir" && deplibs="$add_dir $deplibs" + test -n "$add" && deplibs="$add $deplibs" + if test "$hardcode_direct" != yes && \ + test "$hardcode_minus_L" != yes && \ + test "$hardcode_shlibpath_var" = yes; then + case :$finalize_shlibpath: in + *":$libdir:"*) ;; + *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; + esac + fi + fi + fi + + if test "$linkmode" = prog || test "$mode" = relink; then + add_shlibpath= + add_dir= + add= + # Finalize command for both is simple: just hardcode it. + if test "$hardcode_direct" = yes; then + add="$libdir/$linklib" + elif test "$hardcode_minus_L" = yes; then + add_dir="-L$libdir" + add="-l$name" + elif test "$hardcode_shlibpath_var" = yes; then + case :$finalize_shlibpath: in + *":$libdir:"*) ;; + *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; + esac + add="-l$name" + elif test "$hardcode_automatic" = yes; then + if test -n "$inst_prefix_dir" && + test -f "$inst_prefix_dir$libdir/$linklib" ; then + add="$inst_prefix_dir$libdir/$linklib" + else + add="$libdir/$linklib" + fi + else + # We cannot seem to hardcode it, guess we'll fake it. + add_dir="-L$libdir" + # Try looking first in the location we're being installed to. + if test -n "$inst_prefix_dir"; then + case $libdir in + [\\/]*) + add_dir="$add_dir -L$inst_prefix_dir$libdir" + ;; + esac + fi + add="-l$name" + fi + + if test "$linkmode" = prog; then + test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs" + test -n "$add" && finalize_deplibs="$add $finalize_deplibs" + else + test -n "$add_dir" && deplibs="$add_dir $deplibs" + test -n "$add" && deplibs="$add $deplibs" + fi + fi + elif test "$linkmode" = prog; then + # Here we assume that one of hardcode_direct or hardcode_minus_L + # is not unsupported. This is valid on all known static and + # shared platforms. + if test "$hardcode_direct" != unsupported; then + test -n "$old_library" && linklib="$old_library" + compile_deplibs="$dir/$linklib $compile_deplibs" + finalize_deplibs="$dir/$linklib $finalize_deplibs" + else + compile_deplibs="-l$name -L$dir $compile_deplibs" + finalize_deplibs="-l$name -L$dir $finalize_deplibs" + fi + elif test "$build_libtool_libs" = yes; then + # Not a shared library + if test "$deplibs_check_method" != pass_all; then + # We're trying link a shared library against a static one + # but the system doesn't support it. + + # Just print a warning and add the library to dependency_libs so + # that the program can be linked against the static library. + $echo + $echo "*** Warning: This system can not link to static lib archive $lib." + $echo "*** I have the capability to make that library automatically link in when" + $echo "*** you link to this library. But I can only do this if you have a" + $echo "*** shared version of the library, which you do not appear to have." + if test "$module" = yes; then + $echo "*** But as you try to build a module library, libtool will still create " + $echo "*** a static module, that should work as long as the dlopening application" + $echo "*** is linked with the -dlopen flag to resolve symbols at runtime." + if test -z "$global_symbol_pipe"; then + $echo + $echo "*** However, this would only work if libtool was able to extract symbol" + $echo "*** lists from a program, using \`nm' or equivalent, but libtool could" + $echo "*** not find such a program. So, this module is probably useless." + $echo "*** \`nm' from GNU binutils and a full rebuild may help." + fi + if test "$build_old_libs" = no; then + build_libtool_libs=module + build_old_libs=yes + else + build_libtool_libs=no + fi + fi + else + deplibs="$dir/$old_library $deplibs" + link_static=yes + fi + fi # link shared/static library? + + if test "$linkmode" = lib; then + if test -n "$dependency_libs" && + { test "$hardcode_into_libs" != yes || + test "$build_old_libs" = yes || + test "$link_static" = yes; }; then + # Extract -R from dependency_libs + temp_deplibs= + for libdir in $dependency_libs; do + case $libdir in + -R*) temp_xrpath=`$echo "X$libdir" | $Xsed -e 's/^-R//'` + case " $xrpath " in + *" $temp_xrpath "*) ;; + *) xrpath="$xrpath $temp_xrpath";; + esac;; + *) temp_deplibs="$temp_deplibs $libdir";; + esac + done + dependency_libs="$temp_deplibs" + fi + + newlib_search_path="$newlib_search_path $absdir" + # Link against this library + test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs" + # ... and its dependency_libs + tmp_libs= + for deplib in $dependency_libs; do + newdependency_libs="$deplib $newdependency_libs" + if test "X$duplicate_deps" = "Xyes" ; then + case "$tmp_libs " in + *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; + esac + fi + tmp_libs="$tmp_libs $deplib" + done + + if test "$link_all_deplibs" != no; then + # Add the search paths of all dependency libraries + for deplib in $dependency_libs; do + case $deplib in + -L*) path="$deplib" ;; + *.la) + dir=`$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%'` + test "X$dir" = "X$deplib" && dir="." + # We need an absolute path. + case $dir in + [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;; + *) + absdir=`cd "$dir" && pwd` + if test -z "$absdir"; then + $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2 + absdir="$dir" + fi + ;; + esac + if grep "^installed=no" $deplib > /dev/null; then + path="$absdir/$objdir" + else + eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` + if test -z "$libdir"; then + $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2 + exit $EXIT_FAILURE + fi + if test "$absdir" != "$libdir"; then + $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2 + fi + path="$absdir" + fi + depdepl= + case $host in + *-*-darwin*) + # we do not want to link against static libs, + # but need to link against shared + eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib` + if test -n "$deplibrary_names" ; then + for tmp in $deplibrary_names ; do + depdepl=$tmp + done + if test -f "$path/$depdepl" ; then + depdepl="$path/$depdepl" + fi + # do not add paths which are already there + case " $newlib_search_path " in + *" $path "*) ;; + *) newlib_search_path="$newlib_search_path $path";; + esac + fi + path="" + ;; + *) + path="-L$path" + ;; + esac + ;; + -l*) + case $host in + *-*-darwin*) + # Again, we only want to link against shared libraries + eval tmp_libs=`$echo "X$deplib" | $Xsed -e "s,^\-l,,"` + for tmp in $newlib_search_path ; do + if test -f "$tmp/lib$tmp_libs.dylib" ; then + eval depdepl="$tmp/lib$tmp_libs.dylib" + break + fi + done + path="" + ;; + *) continue ;; + esac + ;; + *) continue ;; + esac + case " $deplibs " in + *" $path "*) ;; + *) deplibs="$path $deplibs" ;; + esac + case " $deplibs " in + *" $depdepl "*) ;; + *) deplibs="$depdepl $deplibs" ;; + esac + done + fi # link_all_deplibs != no + fi # linkmode = lib + done # for deplib in $libs + dependency_libs="$newdependency_libs" + if test "$pass" = dlpreopen; then + # Link the dlpreopened libraries before other libraries + for deplib in $save_deplibs; do + deplibs="$deplib $deplibs" + done + fi + if test "$pass" != dlopen; then + if test "$pass" != conv; then + # Make sure lib_search_path contains only unique directories. + lib_search_path= + for dir in $newlib_search_path; do + case "$lib_search_path " in + *" $dir "*) ;; + *) lib_search_path="$lib_search_path $dir" ;; + esac + done + newlib_search_path= + fi + + if test "$linkmode,$pass" != "prog,link"; then + vars="deplibs" + else + vars="compile_deplibs finalize_deplibs" + fi + for var in $vars dependency_libs; do + # Add libraries to $var in reverse order + eval tmp_libs=\"\$$var\" + new_libs= + for deplib in $tmp_libs; do + # FIXME: Pedantically, this is the right thing to do, so + # that some nasty dependency loop isn't accidentally + # broken: + #new_libs="$deplib $new_libs" + # Pragmatically, this seems to cause very few problems in + # practice: + case $deplib in + -L*) new_libs="$deplib $new_libs" ;; + -R*) ;; + *) + # And here is the reason: when a library appears more + # than once as an explicit dependence of a library, or + # is implicitly linked in more than once by the + # compiler, it is considered special, and multiple + # occurrences thereof are not removed. Compare this + # with having the same library being listed as a + # dependency of multiple other libraries: in this case, + # we know (pedantically, we assume) the library does not + # need to be listed more than once, so we keep only the + # last copy. This is not always right, but it is rare + # enough that we require users that really mean to play + # such unportable linking tricks to link the library + # using -Wl,-lname, so that libtool does not consider it + # for duplicate removal. + case " $specialdeplibs " in + *" $deplib "*) new_libs="$deplib $new_libs" ;; + *) + case " $new_libs " in + *" $deplib "*) ;; + *) new_libs="$deplib $new_libs" ;; + esac + ;; + esac + ;; + esac + done + tmp_libs= + for deplib in $new_libs; do + case $deplib in + -L*) + case " $tmp_libs " in + *" $deplib "*) ;; + *) tmp_libs="$tmp_libs $deplib" ;; + esac + ;; + *) tmp_libs="$tmp_libs $deplib" ;; + esac + done + eval $var=\"$tmp_libs\" + done # for var + fi + # Last step: remove runtime libs from dependency_libs + # (they stay in deplibs) + tmp_libs= + for i in $dependency_libs ; do + case " $predeps $postdeps $compiler_lib_search_path " in + *" $i "*) + i="" + ;; + esac + if test -n "$i" ; then + tmp_libs="$tmp_libs $i" + fi + done + dependency_libs=$tmp_libs + done # for pass + if test "$linkmode" = prog; then + dlfiles="$newdlfiles" + dlprefiles="$newdlprefiles" + fi + + case $linkmode in + oldlib) + if test -n "$deplibs"; then + $echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2 + fi + + if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then + $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2 + fi + + if test -n "$rpath"; then + $echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2 + fi + + if test -n "$xrpath"; then + $echo "$modename: warning: \`-R' is ignored for archives" 1>&2 + fi + + if test -n "$vinfo"; then + $echo "$modename: warning: \`-version-info/-version-number' is ignored for archives" 1>&2 + fi + + if test -n "$release"; then + $echo "$modename: warning: \`-release' is ignored for archives" 1>&2 + fi + + if test -n "$export_symbols" || test -n "$export_symbols_regex"; then + $echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2 + fi + + # Now set the variables for building old libraries. + build_libtool_libs=no + oldlibs="$output" + objs="$objs$old_deplibs" + ;; + + lib) + # Make sure we only generate libraries of the form `libNAME.la'. + case $outputname in + lib*) + name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'` + eval shared_ext=\"$shrext_cmds\" + eval libname=\"$libname_spec\" + ;; + *) + if test "$module" = no; then + $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2 + $echo "$help" 1>&2 + exit $EXIT_FAILURE + fi + if test "$need_lib_prefix" != no; then + # Add the "lib" prefix for modules if required + name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'` + eval shared_ext=\"$shrext_cmds\" + eval libname=\"$libname_spec\" + else + libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'` + fi + ;; + esac + + if test -n "$objs"; then + if test "$deplibs_check_method" != pass_all; then + $echo "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 2>&1 + exit $EXIT_FAILURE + else + $echo + $echo "*** Warning: Linking the shared library $output against the non-libtool" + $echo "*** objects $objs is not portable!" + libobjs="$libobjs $objs" + fi + fi + + if test "$dlself" != no; then + $echo "$modename: warning: \`-dlopen self' is ignored for libtool libraries" 1>&2 + fi + + set dummy $rpath + if test "$#" -gt 2; then + $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2 + fi + install_libdir="$2" + + oldlibs= + if test -z "$rpath"; then + if test "$build_libtool_libs" = yes; then + # Building a libtool convenience library. + # Some compilers have problems with a `.al' extension so + # convenience libraries should have the same extension an + # archive normally would. + oldlibs="$output_objdir/$libname.$libext $oldlibs" + build_libtool_libs=convenience + build_old_libs=yes + fi + + if test -n "$vinfo"; then + $echo "$modename: warning: \`-version-info/-version-number' is ignored for convenience libraries" 1>&2 + fi + + if test -n "$release"; then + $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2 + fi + else + + # Parse the version information argument. + save_ifs="$IFS"; IFS=':' + set dummy $vinfo 0 0 0 + IFS="$save_ifs" + + if test -n "$8"; then + $echo "$modename: too many parameters to \`-version-info'" 1>&2 + $echo "$help" 1>&2 + exit $EXIT_FAILURE + fi + + # convert absolute version numbers to libtool ages + # this retains compatibility with .la files and attempts + # to make the code below a bit more comprehensible + + case $vinfo_number in + yes) + number_major="$2" + number_minor="$3" + number_revision="$4" + # + # There are really only two kinds -- those that + # use the current revision as the major version + # and those that subtract age and use age as + # a minor version. But, then there is irix + # which has an extra 1 added just for fun + # + case $version_type in + darwin|linux|osf|windows|none) + current=`expr $number_major + $number_minor` + age="$number_minor" + revision="$number_revision" + ;; + freebsd-aout|freebsd-elf|sunos) + current="$number_major" + revision="$number_minor" + age="0" + ;; + irix|nonstopux) + current=`expr $number_major + $number_minor` + age="$number_minor" + revision="$number_minor" + lt_irix_increment=no + ;; + *) + $echo "$modename: unknown library version type \`$version_type'" 1>&2 + $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 + exit $EXIT_FAILURE + ;; + esac + ;; + no) + current="$2" + revision="$3" + age="$4" + ;; + esac + + # Check that each of the things are valid numbers. + case $current in + 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; + *) + $echo "$modename: CURRENT \`$current' must be a nonnegative integer" 1>&2 + $echo "$modename: \`$vinfo' is not valid version information" 1>&2 + exit $EXIT_FAILURE + ;; + esac + + case $revision in + 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; + *) + $echo "$modename: REVISION \`$revision' must be a nonnegative integer" 1>&2 + $echo "$modename: \`$vinfo' is not valid version information" 1>&2 + exit $EXIT_FAILURE + ;; + esac + + case $age in + 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; + *) + $echo "$modename: AGE \`$age' must be a nonnegative integer" 1>&2 + $echo "$modename: \`$vinfo' is not valid version information" 1>&2 + exit $EXIT_FAILURE + ;; + esac + + if test "$age" -gt "$current"; then + $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2 + $echo "$modename: \`$vinfo' is not valid version information" 1>&2 + exit $EXIT_FAILURE + fi + + # Calculate the version variables. + major= + versuffix= + verstring= + case $version_type in + none) ;; + + darwin) + # Like Linux, but with the current version available in + # verstring for coding it into the library header + major=.`expr $current - $age` + versuffix="$major.$age.$revision" + # Darwin ld doesn't like 0 for these options... + minor_current=`expr $current + 1` + xlcverstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision" + verstring="-compatibility_version $minor_current -current_version $minor_current.$revision" + ;; + + freebsd-aout) + major=".$current" + versuffix=".$current.$revision"; + ;; + + freebsd-elf) + major=".$current" + versuffix=".$current"; + ;; + + irix | nonstopux) + if test "X$lt_irix_increment" = "Xno"; then + major=`expr $current - $age` + else + major=`expr $current - $age + 1` + fi + case $version_type in + nonstopux) verstring_prefix=nonstopux ;; + *) verstring_prefix=sgi ;; + esac + verstring="$verstring_prefix$major.$revision" + + # Add in all the interfaces that we are compatible with. + loop=$revision + while test "$loop" -ne 0; do + iface=`expr $revision - $loop` + loop=`expr $loop - 1` + verstring="$verstring_prefix$major.$iface:$verstring" + done + + # Before this point, $major must not contain `.'. + major=.$major + versuffix="$major.$revision" + ;; + + linux) + major=.`expr $current - $age` + versuffix="$major.$age.$revision" + ;; + + osf) + major=.`expr $current - $age` + versuffix=".$current.$age.$revision" + verstring="$current.$age.$revision" + + # Add in all the interfaces that we are compatible with. + loop=$age + while test "$loop" -ne 0; do + iface=`expr $current - $loop` + loop=`expr $loop - 1` + verstring="$verstring:${iface}.0" + done + + # Make executables depend on our current version. + verstring="$verstring:${current}.0" + ;; + + sunos) + major=".$current" + versuffix=".$current.$revision" + ;; + + windows) + # Use '-' rather than '.', since we only want one + # extension on DOS 8.3 filesystems. + major=`expr $current - $age` + versuffix="-$major" + ;; + + *) + $echo "$modename: unknown library version type \`$version_type'" 1>&2 + $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 + exit $EXIT_FAILURE + ;; + esac + + # Clear the version info if we defaulted, and they specified a release. + if test -z "$vinfo" && test -n "$release"; then + major= + case $version_type in + darwin) + # we can't check for "0.0" in archive_cmds due to quoting + # problems, so we reset it completely + verstring= + ;; + *) + verstring="0.0" + ;; + esac + if test "$need_version" = no; then + versuffix= + else + versuffix=".0.0" + fi + fi + + # Remove version info from name if versioning should be avoided + if test "$avoid_version" = yes && test "$need_version" = no; then + major= + versuffix= + verstring="" + fi + + # Check to see if the archive will have undefined symbols. + if test "$allow_undefined" = yes; then + if test "$allow_undefined_flag" = unsupported; then + $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2 + build_libtool_libs=no + build_old_libs=yes + fi + else + # Don't allow undefined symbols. + allow_undefined_flag="$no_undefined_flag" + fi + fi + + if test "$mode" != relink; then + # Remove our outputs, but don't remove object files since they + # may have been created when compiling PIC objects. + removelist= + tempremovelist=`$echo "$output_objdir/*"` + for p in $tempremovelist; do + case $p in + *.$objext) + ;; + $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*) + if test "X$precious_files_regex" != "X"; then + if echo $p | $EGREP -e "$precious_files_regex" >/dev/null 2>&1 + then + continue + fi + fi + removelist="$removelist $p" + ;; + *) ;; + esac + done + if test -n "$removelist"; then + $show "${rm}r $removelist" + $run ${rm}r $removelist + fi + fi + + # Now set the variables for building old libraries. + if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then + oldlibs="$oldlibs $output_objdir/$libname.$libext" + + # Transform .lo files to .o files. + oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP` + fi + + # Eliminate all temporary directories. + #for path in $notinst_path; do + # lib_search_path=`$echo "$lib_search_path " | ${SED} -e "s% $path % %g"` + # deplibs=`$echo "$deplibs " | ${SED} -e "s% -L$path % %g"` + # dependency_libs=`$echo "$dependency_libs " | ${SED} -e "s% -L$path % %g"` + #done + + if test -n "$xrpath"; then + # If the user specified any rpath flags, then add them. + temp_xrpath= + for libdir in $xrpath; do + temp_xrpath="$temp_xrpath -R$libdir" + case "$finalize_rpath " in + *" $libdir "*) ;; + *) finalize_rpath="$finalize_rpath $libdir" ;; + esac + done + if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then + dependency_libs="$temp_xrpath $dependency_libs" + fi + fi + + # Make sure dlfiles contains only unique files that won't be dlpreopened + old_dlfiles="$dlfiles" + dlfiles= + for lib in $old_dlfiles; do + case " $dlprefiles $dlfiles " in + *" $lib "*) ;; + *) dlfiles="$dlfiles $lib" ;; + esac + done + + # Make sure dlprefiles contains only unique files + old_dlprefiles="$dlprefiles" + dlprefiles= + for lib in $old_dlprefiles; do + case "$dlprefiles " in + *" $lib "*) ;; + *) dlprefiles="$dlprefiles $lib" ;; + esac + done + + if test "$build_libtool_libs" = yes; then + if test -n "$rpath"; then + case $host in + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*) + # these systems don't actually have a c library (as such)! + ;; + *-*-rhapsody* | *-*-darwin1.[012]) + # Rhapsody C library is in the System framework + deplibs="$deplibs -framework System" + ;; + *-*-netbsd*) + # Don't link with libc until the a.out ld.so is fixed. + ;; + *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) + # Do not include libc due to us having libc/libc_r. + ;; + *-*-sco3.2v5* | *-*-sco5v6*) + # Causes problems with __ctype + ;; + *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) + # Compiler inserts libc in the correct place for threads to work + ;; + *) + # Add libc to deplibs on all other systems if necessary. + if test "$build_libtool_need_lc" = "yes"; then + deplibs="$deplibs -lc" + fi + ;; + esac + fi + + # Transform deplibs into only deplibs that can be linked in shared. + name_save=$name + libname_save=$libname + release_save=$release + versuffix_save=$versuffix + major_save=$major + # I'm not sure if I'm treating the release correctly. I think + # release should show up in the -l (ie -lgmp5) so we don't want to + # add it in twice. Is that correct? + release="" + versuffix="" + major="" + newdeplibs= + droppeddeps=no + case $deplibs_check_method in + pass_all) + # Don't check for shared/static. Everything works. + # This might be a little naive. We might want to check + # whether the library exists or not. But this is on + # osf3 & osf4 and I'm not really sure... Just + # implementing what was already the behavior. + newdeplibs=$deplibs + ;; + test_compile) + # This code stresses the "libraries are programs" paradigm to its + # limits. Maybe even breaks it. We compile a program, linking it + # against the deplibs as a proxy for the library. Then we can check + # whether they linked in statically or dynamically with ldd. + $rm conftest.c + cat > conftest.c </dev/null` + for potent_lib in $potential_libs; do + # Follow soft links. + if ls -lLd "$potent_lib" 2>/dev/null \ + | grep " -> " >/dev/null; then + continue + fi + # The statement above tries to avoid entering an + # endless loop below, in case of cyclic links. + # We might still enter an endless loop, since a link + # loop can be closed while we follow links, + # but so what? + potlib="$potent_lib" + while test -h "$potlib" 2>/dev/null; do + potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'` + case $potliblink in + [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";; + *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";; + esac + done + if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \ + | ${SED} 10q \ + | $EGREP "$file_magic_regex" > /dev/null; then + newdeplibs="$newdeplibs $a_deplib" + a_deplib="" + break 2 + fi + done + done + fi + if test -n "$a_deplib" ; then + droppeddeps=yes + $echo + $echo "*** Warning: linker path does not have real file for library $a_deplib." + $echo "*** I have the capability to make that library automatically link in when" + $echo "*** you link to this library. But I can only do this if you have a" + $echo "*** shared version of the library, which you do not appear to have" + $echo "*** because I did check the linker path looking for a file starting" + if test -z "$potlib" ; then + $echo "*** with $libname but no candidates were found. (...for file magic test)" + else + $echo "*** with $libname and none of the candidates passed a file format test" + $echo "*** using a file magic. Last file checked: $potlib" + fi + fi + else + # Add a -L argument. + newdeplibs="$newdeplibs $a_deplib" + fi + done # Gone through all deplibs. + ;; + match_pattern*) + set dummy $deplibs_check_method + match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"` + for a_deplib in $deplibs; do + name=`expr $a_deplib : '-l\(.*\)'` + # If $name is empty we are operating on a -L argument. + if test -n "$name" && test "$name" != "0"; then + if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then + case " $predeps $postdeps " in + *" $a_deplib "*) + newdeplibs="$newdeplibs $a_deplib" + a_deplib="" + ;; + esac + fi + if test -n "$a_deplib" ; then + libname=`eval \\$echo \"$libname_spec\"` + for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do + potential_libs=`ls $i/$libname[.-]* 2>/dev/null` + for potent_lib in $potential_libs; do + potlib="$potent_lib" # see symlink-check above in file_magic test + if eval $echo \"$potent_lib\" 2>/dev/null \ + | ${SED} 10q \ + | $EGREP "$match_pattern_regex" > /dev/null; then + newdeplibs="$newdeplibs $a_deplib" + a_deplib="" + break 2 + fi + done + done + fi + if test -n "$a_deplib" ; then + droppeddeps=yes + $echo + $echo "*** Warning: linker path does not have real file for library $a_deplib." + $echo "*** I have the capability to make that library automatically link in when" + $echo "*** you link to this library. But I can only do this if you have a" + $echo "*** shared version of the library, which you do not appear to have" + $echo "*** because I did check the linker path looking for a file starting" + if test -z "$potlib" ; then + $echo "*** with $libname but no candidates were found. (...for regex pattern test)" + else + $echo "*** with $libname and none of the candidates passed a file format test" + $echo "*** using a regex pattern. Last file checked: $potlib" + fi + fi + else + # Add a -L argument. + newdeplibs="$newdeplibs $a_deplib" + fi + done # Gone through all deplibs. + ;; + none | unknown | *) + newdeplibs="" + tmp_deplibs=`$echo "X $deplibs" | $Xsed -e 's/ -lc$//' \ + -e 's/ -[LR][^ ]*//g'` + if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then + for i in $predeps $postdeps ; do + # can't use Xsed below, because $i might contain '/' + tmp_deplibs=`$echo "X $tmp_deplibs" | ${SED} -e "1s,^X,," -e "s,$i,,"` + done + fi + if $echo "X $tmp_deplibs" | $Xsed -e 's/[ ]//g' \ + | grep . >/dev/null; then + $echo + if test "X$deplibs_check_method" = "Xnone"; then + $echo "*** Warning: inter-library dependencies are not supported in this platform." + else + $echo "*** Warning: inter-library dependencies are not known to be supported." + fi + $echo "*** All declared inter-library dependencies are being dropped." + droppeddeps=yes + fi + ;; + esac + versuffix=$versuffix_save + major=$major_save + release=$release_save + libname=$libname_save + name=$name_save + + case $host in + *-*-rhapsody* | *-*-darwin1.[012]) + # On Rhapsody replace the C library is the System framework + newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's/ -lc / -framework System /'` + ;; + esac + + if test "$droppeddeps" = yes; then + if test "$module" = yes; then + $echo + $echo "*** Warning: libtool could not satisfy all declared inter-library" + $echo "*** dependencies of module $libname. Therefore, libtool will create" + $echo "*** a static module, that should work as long as the dlopening" + $echo "*** application is linked with the -dlopen flag." + if test -z "$global_symbol_pipe"; then + $echo + $echo "*** However, this would only work if libtool was able to extract symbol" + $echo "*** lists from a program, using \`nm' or equivalent, but libtool could" + $echo "*** not find such a program. So, this module is probably useless." + $echo "*** \`nm' from GNU binutils and a full rebuild may help." + fi + if test "$build_old_libs" = no; then + oldlibs="$output_objdir/$libname.$libext" + build_libtool_libs=module + build_old_libs=yes + else + build_libtool_libs=no + fi + else + $echo "*** The inter-library dependencies that have been dropped here will be" + $echo "*** automatically added whenever a program is linked with this library" + $echo "*** or is declared to -dlopen it." + + if test "$allow_undefined" = no; then + $echo + $echo "*** Since this library must not contain undefined symbols," + $echo "*** because either the platform does not support them or" + $echo "*** it was explicitly requested with -no-undefined," + $echo "*** libtool will only create a static version of it." + if test "$build_old_libs" = no; then + oldlibs="$output_objdir/$libname.$libext" + build_libtool_libs=module + build_old_libs=yes + else + build_libtool_libs=no + fi + fi + fi + fi + # Done checking deplibs! + deplibs=$newdeplibs + fi + + + # move library search paths that coincide with paths to not yet + # installed libraries to the beginning of the library search list + new_libs= + for path in $notinst_path; do + case " $new_libs " in + *" -L$path/$objdir "*) ;; + *) + case " $deplibs " in + *" -L$path/$objdir "*) + new_libs="$new_libs -L$path/$objdir" ;; + esac + ;; + esac + done + for deplib in $deplibs; do + case $deplib in + -L*) + case " $new_libs " in + *" $deplib "*) ;; + *) new_libs="$new_libs $deplib" ;; + esac + ;; + *) new_libs="$new_libs $deplib" ;; + esac + done + deplibs="$new_libs" + + + # All the library-specific variables (install_libdir is set above). + library_names= + old_library= + dlname= + + # Test again, we may have decided not to build it any more + if test "$build_libtool_libs" = yes; then + if test "$hardcode_into_libs" = yes; then + # Hardcode the library paths + hardcode_libdirs= + dep_rpath= + rpath="$finalize_rpath" + test "$mode" != relink && rpath="$compile_rpath$rpath" + for libdir in $rpath; do + if test -n "$hardcode_libdir_flag_spec"; then + if test -n "$hardcode_libdir_separator"; then + if test -z "$hardcode_libdirs"; then + hardcode_libdirs="$libdir" + else + # Just accumulate the unique libdirs. + case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in + *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) + ;; + *) + hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" + ;; + esac + fi + else + eval flag=\"$hardcode_libdir_flag_spec\" + dep_rpath="$dep_rpath $flag" + fi + elif test -n "$runpath_var"; then + case "$perm_rpath " in + *" $libdir "*) ;; + *) perm_rpath="$perm_rpath $libdir" ;; + esac + fi + done + # Substitute the hardcoded libdirs into the rpath. + if test -n "$hardcode_libdir_separator" && + test -n "$hardcode_libdirs"; then + libdir="$hardcode_libdirs" + if test -n "$hardcode_libdir_flag_spec_ld"; then + case $archive_cmds in + *\$LD*) eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\" ;; + *) eval dep_rpath=\"$hardcode_libdir_flag_spec\" ;; + esac + else + eval dep_rpath=\"$hardcode_libdir_flag_spec\" + fi + fi + if test -n "$runpath_var" && test -n "$perm_rpath"; then + # We should set the runpath_var. + rpath= + for dir in $perm_rpath; do + rpath="$rpath$dir:" + done + eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var" + fi + test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs" + fi + + shlibpath="$finalize_shlibpath" + test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath" + if test -n "$shlibpath"; then + eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var" + fi + + # Get the real and link names of the library. + eval shared_ext=\"$shrext_cmds\" + eval library_names=\"$library_names_spec\" + set dummy $library_names + realname="$2" + shift; shift + + if test -n "$soname_spec"; then + eval soname=\"$soname_spec\" + else + soname="$realname" + fi + if test -z "$dlname"; then + dlname=$soname + fi + + lib="$output_objdir/$realname" + linknames= + for link + do + linknames="$linknames $link" + done + + # Use standard objects if they are pic + test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` + + # Prepare the list of exported symbols + if test -z "$export_symbols"; then + if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then + $show "generating symbol list for \`$libname.la'" + export_symbols="$output_objdir/$libname.exp" + $run $rm $export_symbols + cmds=$export_symbols_cmds + save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + eval cmd=\"$cmd\" + if len=`expr "X$cmd" : ".*"` && + test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then + $show "$cmd" + $run eval "$cmd" || exit $? + skipped_export=false + else + # The command line is too long to execute in one step. + $show "using reloadable object file for export list..." + skipped_export=: + # Break out early, otherwise skipped_export may be + # set to false by a later but shorter cmd. + break + fi + done + IFS="$save_ifs" + if test -n "$export_symbols_regex"; then + $show "$EGREP -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\"" + $run eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' + $show "$mv \"${export_symbols}T\" \"$export_symbols\"" + $run eval '$mv "${export_symbols}T" "$export_symbols"' + fi + fi + fi + + if test -n "$export_symbols" && test -n "$include_expsyms"; then + $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"' + fi + + tmp_deplibs= + for test_deplib in $deplibs; do + case " $convenience " in + *" $test_deplib "*) ;; + *) + tmp_deplibs="$tmp_deplibs $test_deplib" + ;; + esac + done + deplibs="$tmp_deplibs" + + if test -n "$convenience"; then + if test -n "$whole_archive_flag_spec"; then + save_libobjs=$libobjs + eval libobjs=\"\$libobjs $whole_archive_flag_spec\" + else + gentop="$output_objdir/${outputname}x" + generated="$generated $gentop" + + func_extract_archives $gentop $convenience + libobjs="$libobjs $func_extract_archives_result" + fi + fi + + if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then + eval flag=\"$thread_safe_flag_spec\" + linker_flags="$linker_flags $flag" + fi + + # Make a backup of the uninstalled library when relinking + if test "$mode" = relink; then + $run eval '(cd $output_objdir && $rm ${realname}U && $mv $realname ${realname}U)' || exit $? + fi + + # Do each of the archive commands. + if test "$module" = yes && test -n "$module_cmds" ; then + if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then + eval test_cmds=\"$module_expsym_cmds\" + cmds=$module_expsym_cmds + else + eval test_cmds=\"$module_cmds\" + cmds=$module_cmds + fi + else + if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then + eval test_cmds=\"$archive_expsym_cmds\" + cmds=$archive_expsym_cmds + else + eval test_cmds=\"$archive_cmds\" + cmds=$archive_cmds + fi + fi + + if test "X$skipped_export" != "X:" && + len=`expr "X$test_cmds" : ".*" 2>/dev/null` && + test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then + : + else + # The command line is too long to link in one step, link piecewise. + $echo "creating reloadable object files..." + + # Save the value of $output and $libobjs because we want to + # use them later. If we have whole_archive_flag_spec, we + # want to use save_libobjs as it was before + # whole_archive_flag_spec was expanded, because we can't + # assume the linker understands whole_archive_flag_spec. + # This may have to be revisited, in case too many + # convenience libraries get linked in and end up exceeding + # the spec. + if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then + save_libobjs=$libobjs + fi + save_output=$output + output_la=`$echo "X$output" | $Xsed -e "$basename"` + + # Clear the reloadable object creation command queue and + # initialize k to one. + test_cmds= + concat_cmds= + objlist= + delfiles= + last_robj= + k=1 + output=$output_objdir/$output_la-${k}.$objext + # Loop over the list of objects to be linked. + for obj in $save_libobjs + do + eval test_cmds=\"$reload_cmds $objlist $last_robj\" + if test "X$objlist" = X || + { len=`expr "X$test_cmds" : ".*" 2>/dev/null` && + test "$len" -le "$max_cmd_len"; }; then + objlist="$objlist $obj" + else + # The command $test_cmds is almost too long, add a + # command to the queue. + if test "$k" -eq 1 ; then + # The first file doesn't have a previous command to add. + eval concat_cmds=\"$reload_cmds $objlist $last_robj\" + else + # All subsequent reloadable object files will link in + # the last one created. + eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj\" + fi + last_robj=$output_objdir/$output_la-${k}.$objext + k=`expr $k + 1` + output=$output_objdir/$output_la-${k}.$objext + objlist=$obj + len=1 + fi + done + # Handle the remaining objects by creating one last + # reloadable object file. All subsequent reloadable object + # files will link in the last one created. + test -z "$concat_cmds" || concat_cmds=$concat_cmds~ + eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\" + + if ${skipped_export-false}; then + $show "generating symbol list for \`$libname.la'" + export_symbols="$output_objdir/$libname.exp" + $run $rm $export_symbols + libobjs=$output + # Append the command to create the export file. + eval concat_cmds=\"\$concat_cmds~$export_symbols_cmds\" + fi + + # Set up a command to remove the reloadable object files + # after they are used. + i=0 + while test "$i" -lt "$k" + do + i=`expr $i + 1` + delfiles="$delfiles $output_objdir/$output_la-${i}.$objext" + done + + $echo "creating a temporary reloadable object file: $output" + + # Loop through the commands generated above and execute them. + save_ifs="$IFS"; IFS='~' + for cmd in $concat_cmds; do + IFS="$save_ifs" + $show "$cmd" + $run eval "$cmd" || exit $? + done + IFS="$save_ifs" + + libobjs=$output + # Restore the value of output. + output=$save_output + + if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then + eval libobjs=\"\$libobjs $whole_archive_flag_spec\" + fi + # Expand the library linking commands again to reset the + # value of $libobjs for piecewise linking. + + # Do each of the archive commands. + if test "$module" = yes && test -n "$module_cmds" ; then + if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then + cmds=$module_expsym_cmds + else + cmds=$module_cmds + fi + else + if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then + cmds=$archive_expsym_cmds + else + cmds=$archive_cmds + fi + fi + + # Append the command to remove the reloadable object files + # to the just-reset $cmds. + eval cmds=\"\$cmds~\$rm $delfiles\" + fi + save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + eval cmd=\"$cmd\" + $show "$cmd" + $run eval "$cmd" || { + lt_exit=$? + + # Restore the uninstalled library and exit + if test "$mode" = relink; then + $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)' + fi + + exit $lt_exit + } + done + IFS="$save_ifs" + + # Restore the uninstalled library and exit + if test "$mode" = relink; then + $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $? + + if test -n "$convenience"; then + if test -z "$whole_archive_flag_spec"; then + $show "${rm}r $gentop" + $run ${rm}r "$gentop" + fi + fi + + exit $EXIT_SUCCESS + fi + + # Create links to the real library. + for linkname in $linknames; do + if test "$realname" != "$linkname"; then + $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)" + $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $? + fi + done + + # If -module or -export-dynamic was specified, set the dlname. + if test "$module" = yes || test "$export_dynamic" = yes; then + # On all known operating systems, these are identical. + dlname="$soname" + fi + fi + ;; + + obj) + if test -n "$deplibs"; then + $echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2 + fi + + if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then + $echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2 + fi + + if test -n "$rpath"; then + $echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2 + fi + + if test -n "$xrpath"; then + $echo "$modename: warning: \`-R' is ignored for objects" 1>&2 + fi + + if test -n "$vinfo"; then + $echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2 + fi + + if test -n "$release"; then + $echo "$modename: warning: \`-release' is ignored for objects" 1>&2 + fi + + case $output in + *.lo) + if test -n "$objs$old_deplibs"; then + $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2 + exit $EXIT_FAILURE + fi + libobj="$output" + obj=`$echo "X$output" | $Xsed -e "$lo2o"` + ;; + *) + libobj= + obj="$output" + ;; + esac + + # Delete the old objects. + $run $rm $obj $libobj + + # Objects from convenience libraries. This assumes + # single-version convenience libraries. Whenever we create + # different ones for PIC/non-PIC, this we'll have to duplicate + # the extraction. + reload_conv_objs= + gentop= + # reload_cmds runs $LD directly, so let us get rid of + # -Wl from whole_archive_flag_spec and hope we can get by with + # turning comma into space.. + wl= + + if test -n "$convenience"; then + if test -n "$whole_archive_flag_spec"; then + eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\" + reload_conv_objs=$reload_objs\ `$echo "X$tmp_whole_archive_flags" | $Xsed -e 's|,| |g'` + else + gentop="$output_objdir/${obj}x" + generated="$generated $gentop" + + func_extract_archives $gentop $convenience + reload_conv_objs="$reload_objs $func_extract_archives_result" + fi + fi + + # Create the old-style object. + reload_objs="$objs$old_deplibs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test + + output="$obj" + cmds=$reload_cmds + save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + eval cmd=\"$cmd\" + $show "$cmd" + $run eval "$cmd" || exit $? + done + IFS="$save_ifs" + + # Exit if we aren't doing a library object file. + if test -z "$libobj"; then + if test -n "$gentop"; then + $show "${rm}r $gentop" + $run ${rm}r $gentop + fi + + exit $EXIT_SUCCESS + fi + + if test "$build_libtool_libs" != yes; then + if test -n "$gentop"; then + $show "${rm}r $gentop" + $run ${rm}r $gentop + fi + + # Create an invalid libtool object if no PIC, so that we don't + # accidentally link it into a program. + # $show "echo timestamp > $libobj" + # $run eval "echo timestamp > $libobj" || exit $? + exit $EXIT_SUCCESS + fi + + if test -n "$pic_flag" || test "$pic_mode" != default; then + # Only do commands if we really have different PIC objects. + reload_objs="$libobjs $reload_conv_objs" + output="$libobj" + cmds=$reload_cmds + save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + eval cmd=\"$cmd\" + $show "$cmd" + $run eval "$cmd" || exit $? + done + IFS="$save_ifs" + fi + + if test -n "$gentop"; then + $show "${rm}r $gentop" + $run ${rm}r $gentop + fi + + exit $EXIT_SUCCESS + ;; + + prog) + case $host in + *cygwin*) output=`$echo $output | ${SED} -e 's,.exe$,,;s,$,.exe,'` ;; + esac + if test -n "$vinfo"; then + $echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2 + fi + + if test -n "$release"; then + $echo "$modename: warning: \`-release' is ignored for programs" 1>&2 + fi + + if test "$preload" = yes; then + if test "$dlopen_support" = unknown && test "$dlopen_self" = unknown && + test "$dlopen_self_static" = unknown; then + $echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support." + fi + fi + + case $host in + *-*-rhapsody* | *-*-darwin1.[012]) + # On Rhapsody replace the C library is the System framework + compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's/ -lc / -framework System /'` + finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's/ -lc / -framework System /'` + ;; + esac + + case $host in + *darwin*) + # Don't allow lazy linking, it breaks C++ global constructors + if test "$tagname" = CXX ; then + compile_command="$compile_command ${wl}-bind_at_load" + finalize_command="$finalize_command ${wl}-bind_at_load" + fi + ;; + esac + + + # move library search paths that coincide with paths to not yet + # installed libraries to the beginning of the library search list + new_libs= + for path in $notinst_path; do + case " $new_libs " in + *" -L$path/$objdir "*) ;; + *) + case " $compile_deplibs " in + *" -L$path/$objdir "*) + new_libs="$new_libs -L$path/$objdir" ;; + esac + ;; + esac + done + for deplib in $compile_deplibs; do + case $deplib in + -L*) + case " $new_libs " in + *" $deplib "*) ;; + *) new_libs="$new_libs $deplib" ;; + esac + ;; + *) new_libs="$new_libs $deplib" ;; + esac + done + compile_deplibs="$new_libs" + + + compile_command="$compile_command $compile_deplibs" + finalize_command="$finalize_command $finalize_deplibs" + + if test -n "$rpath$xrpath"; then + # If the user specified any rpath flags, then add them. + for libdir in $rpath $xrpath; do + # This is the magic to use -rpath. + case "$finalize_rpath " in + *" $libdir "*) ;; + *) finalize_rpath="$finalize_rpath $libdir" ;; + esac + done + fi + + # Now hardcode the library paths + rpath= + hardcode_libdirs= + for libdir in $compile_rpath $finalize_rpath; do + if test -n "$hardcode_libdir_flag_spec"; then + if test -n "$hardcode_libdir_separator"; then + if test -z "$hardcode_libdirs"; then + hardcode_libdirs="$libdir" + else + # Just accumulate the unique libdirs. + case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in + *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) + ;; + *) + hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" + ;; + esac + fi + else + eval flag=\"$hardcode_libdir_flag_spec\" + rpath="$rpath $flag" + fi + elif test -n "$runpath_var"; then + case "$perm_rpath " in + *" $libdir "*) ;; + *) perm_rpath="$perm_rpath $libdir" ;; + esac + fi + case $host in + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) + testbindir=`$echo "X$libdir" | $Xsed -e 's*/lib$*/bin*'` + case :$dllsearchpath: in + *":$libdir:"*) ;; + *) dllsearchpath="$dllsearchpath:$libdir";; + esac + case :$dllsearchpath: in + *":$testbindir:"*) ;; + *) dllsearchpath="$dllsearchpath:$testbindir";; + esac + ;; + esac + done + # Substitute the hardcoded libdirs into the rpath. + if test -n "$hardcode_libdir_separator" && + test -n "$hardcode_libdirs"; then + libdir="$hardcode_libdirs" + eval rpath=\" $hardcode_libdir_flag_spec\" + fi + compile_rpath="$rpath" + + rpath= + hardcode_libdirs= + for libdir in $finalize_rpath; do + if test -n "$hardcode_libdir_flag_spec"; then + if test -n "$hardcode_libdir_separator"; then + if test -z "$hardcode_libdirs"; then + hardcode_libdirs="$libdir" + else + # Just accumulate the unique libdirs. + case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in + *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) + ;; + *) + hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" + ;; + esac + fi + else + eval flag=\"$hardcode_libdir_flag_spec\" + rpath="$rpath $flag" + fi + elif test -n "$runpath_var"; then + case "$finalize_perm_rpath " in + *" $libdir "*) ;; + *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;; + esac + fi + done + # Substitute the hardcoded libdirs into the rpath. + if test -n "$hardcode_libdir_separator" && + test -n "$hardcode_libdirs"; then + libdir="$hardcode_libdirs" + eval rpath=\" $hardcode_libdir_flag_spec\" + fi + finalize_rpath="$rpath" + + if test -n "$libobjs" && test "$build_old_libs" = yes; then + # Transform all the library objects into standard objects. + compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` + finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` + fi + + dlsyms= + if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then + if test -n "$NM" && test -n "$global_symbol_pipe"; then + dlsyms="${outputname}S.c" + else + $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2 + fi + fi + + if test -n "$dlsyms"; then + case $dlsyms in + "") ;; + *.c) + # Discover the nlist of each of the dlfiles. + nlist="$output_objdir/${outputname}.nm" + + $show "$rm $nlist ${nlist}S ${nlist}T" + $run $rm "$nlist" "${nlist}S" "${nlist}T" + + # Parse the name list into a source file. + $show "creating $output_objdir/$dlsyms" + + test -z "$run" && $echo > "$output_objdir/$dlsyms" "\ +/* $dlsyms - symbol resolution table for \`$outputname' dlsym emulation. */ +/* Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP */ + +#ifdef __cplusplus +extern \"C\" { +#endif + +/* Prevent the only kind of declaration conflicts we can make. */ +#define lt_preloaded_symbols some_other_symbol + +/* External symbol declarations for the compiler. */\ +" + + if test "$dlself" = yes; then + $show "generating symbol list for \`$output'" + + test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist" + + # Add our own program objects to the symbol list. + progfiles=`$echo "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` + for arg in $progfiles; do + $show "extracting global C symbols from \`$arg'" + $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'" + done + + if test -n "$exclude_expsyms"; then + $run eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T' + $run eval '$mv "$nlist"T "$nlist"' + fi + + if test -n "$export_symbols_regex"; then + $run eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T' + $run eval '$mv "$nlist"T "$nlist"' + fi + + # Prepare the list of exported symbols + if test -z "$export_symbols"; then + export_symbols="$output_objdir/$outputname.exp" + $run $rm $export_symbols + $run eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"' + case $host in + *cygwin* | *mingw* ) + $run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' + $run eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"' + ;; + esac + else + $run eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"' + $run eval 'grep -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T' + $run eval 'mv "$nlist"T "$nlist"' + case $host in + *cygwin* | *mingw* ) + $run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' + $run eval 'cat "$nlist" >> "$output_objdir/$outputname.def"' + ;; + esac + fi + fi + + for arg in $dlprefiles; do + $show "extracting global C symbols from \`$arg'" + name=`$echo "$arg" | ${SED} -e 's%^.*/%%'` + $run eval '$echo ": $name " >> "$nlist"' + $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'" + done + + if test -z "$run"; then + # Make sure we have at least an empty file. + test -f "$nlist" || : > "$nlist" + + if test -n "$exclude_expsyms"; then + $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T + $mv "$nlist"T "$nlist" + fi + + # Try sorting and uniquifying the output. + if grep -v "^: " < "$nlist" | + if sort -k 3 /dev/null 2>&1; then + sort -k 3 + else + sort +2 + fi | + uniq > "$nlist"S; then + : + else + grep -v "^: " < "$nlist" > "$nlist"S + fi + + if test -f "$nlist"S; then + eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"' + else + $echo '/* NONE */' >> "$output_objdir/$dlsyms" + fi + + $echo >> "$output_objdir/$dlsyms" "\ + +#undef lt_preloaded_symbols + +#if defined (__STDC__) && __STDC__ +# define lt_ptr void * +#else +# define lt_ptr char * +# define const +#endif + +/* The mapping between symbol names and symbols. */ +" + + case $host in + *cygwin* | *mingw* ) + $echo >> "$output_objdir/$dlsyms" "\ +/* DATA imports from DLLs on WIN32 can't be const, because + runtime relocations are performed -- see ld's documentation + on pseudo-relocs */ +struct { +" + ;; + * ) + $echo >> "$output_objdir/$dlsyms" "\ +const struct { +" + ;; + esac + + + $echo >> "$output_objdir/$dlsyms" "\ + const char *name; + lt_ptr address; +} +lt_preloaded_symbols[] = +{\ +" + + eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$dlsyms" + + $echo >> "$output_objdir/$dlsyms" "\ + {0, (lt_ptr) 0} +}; + +/* This works around a problem in FreeBSD linker */ +#ifdef FREEBSD_WORKAROUND +static const void *lt_preloaded_setup() { + return lt_preloaded_symbols; +} +#endif + +#ifdef __cplusplus +} +#endif\ +" + fi + + pic_flag_for_symtable= + case $host in + # compiling the symbol table file with pic_flag works around + # a FreeBSD bug that causes programs to crash when -lm is + # linked before any other PIC object. But we must not use + # pic_flag when linking with -static. The problem exists in + # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1. + *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*) + case "$compile_command " in + *" -static "*) ;; + *) pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND";; + esac;; + *-*-hpux*) + case "$compile_command " in + *" -static "*) ;; + *) pic_flag_for_symtable=" $pic_flag";; + esac + esac + + # Now compile the dynamic symbol file. + $show "(cd $output_objdir && $LTCC $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")" + $run eval '(cd $output_objdir && $LTCC $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $? + + # Clean up the generated files. + $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T" + $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T" + + # Transform the symbol file into the correct name. + case $host in + *cygwin* | *mingw* ) + if test -f "$output_objdir/${outputname}.def" ; then + compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%" | $NL2SP` + finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%" | $NL2SP` + else + compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP` + finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP` + fi + ;; + * ) + compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP` + finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP` + ;; + esac + ;; + *) + $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2 + exit $EXIT_FAILURE + ;; + esac + else + # We keep going just in case the user didn't refer to + # lt_preloaded_symbols. The linker will fail if global_symbol_pipe + # really was required. + + # Nullify the symbol file. + compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s% @SYMFILE@%%" | $NL2SP` + finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s% @SYMFILE@%%" | $NL2SP` + fi + + if test "$need_relink" = no || test "$build_libtool_libs" != yes; then + # Replace the output file specification. + compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e 's%@OUTPUT@%'"$output"'%g' | $NL2SP` + link_command="$compile_command$compile_rpath" + + # We have no uninstalled library dependencies, so finalize right now. + $show "$link_command" + $run eval "$link_command" + exit_status=$? + + # Delete the generated files. + if test -n "$dlsyms"; then + $show "$rm $output_objdir/${outputname}S.${objext}" + $run $rm "$output_objdir/${outputname}S.${objext}" + fi + + exit $exit_status + fi + + if test -n "$shlibpath_var"; then + # We should set the shlibpath_var + rpath= + for dir in $temp_rpath; do + case $dir in + [\\/]* | [A-Za-z]:[\\/]*) + # Absolute path. + rpath="$rpath$dir:" + ;; + *) + # Relative path: add a thisdir entry. + rpath="$rpath\$thisdir/$dir:" + ;; + esac + done + temp_rpath="$rpath" + fi + + if test -n "$compile_shlibpath$finalize_shlibpath"; then + compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command" + fi + if test -n "$finalize_shlibpath"; then + finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command" + fi + + compile_var= + finalize_var= + if test -n "$runpath_var"; then + if test -n "$perm_rpath"; then + # We should set the runpath_var. + rpath= + for dir in $perm_rpath; do + rpath="$rpath$dir:" + done + compile_var="$runpath_var=\"$rpath\$$runpath_var\" " + fi + if test -n "$finalize_perm_rpath"; then + # We should set the runpath_var. + rpath= + for dir in $finalize_perm_rpath; do + rpath="$rpath$dir:" + done + finalize_var="$runpath_var=\"$rpath\$$runpath_var\" " + fi + fi + + if test "$no_install" = yes; then + # We don't need to create a wrapper script. + link_command="$compile_var$compile_command$compile_rpath" + # Replace the output file specification. + link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` + # Delete the old output file. + $run $rm $output + # Link the executable and exit + $show "$link_command" + $run eval "$link_command" || exit $? + exit $EXIT_SUCCESS + fi + + if test "$hardcode_action" = relink; then + # Fast installation is not supported + link_command="$compile_var$compile_command$compile_rpath" + relink_command="$finalize_var$finalize_command$finalize_rpath" + + $echo "$modename: warning: this platform does not like uninstalled shared libraries" 1>&2 + $echo "$modename: \`$output' will be relinked during installation" 1>&2 + else + if test "$fast_install" != no; then + link_command="$finalize_var$compile_command$finalize_rpath" + if test "$fast_install" = yes; then + relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $SP2NL | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g' | $NL2SP` + else + # fast_install is set to needless + relink_command= + fi + else + link_command="$compile_var$compile_command$compile_rpath" + relink_command="$finalize_var$finalize_command$finalize_rpath" + fi + fi + + # Replace the output file specification. + link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'` + + # Delete the old output files. + $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname + + $show "$link_command" + $run eval "$link_command" || exit $? + + # Now create the wrapper script. + $show "creating $output" + + # Quote the relink command for shipping. + if test -n "$relink_command"; then + # Preserve any variables that may affect compiler behavior + for var in $variables_saved_for_relink; do + if eval test -z \"\${$var+set}\"; then + relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command" + elif eval var_value=\$$var; test -z "$var_value"; then + relink_command="$var=; export $var; $relink_command" + else + var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"` + relink_command="$var=\"$var_value\"; export $var; $relink_command" + fi + done + relink_command="(cd `pwd`; $relink_command)" + relink_command=`$echo "X$relink_command" | $SP2NL | $Xsed -e "$sed_quote_subst" | $NL2SP` + fi + + # Quote $echo for shipping. + if test "X$echo" = "X$SHELL $progpath --fallback-echo"; then + case $progpath in + [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $progpath --fallback-echo";; + *) qecho="$SHELL `pwd`/$progpath --fallback-echo";; + esac + qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"` + else + qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"` + fi + + # Only actually do things if our run command is non-null. + if test -z "$run"; then + # win32 will think the script is a binary if it has + # a .exe suffix, so we strip it off here. + case $output in + *.exe) output=`$echo $output|${SED} 's,.exe$,,'` ;; + esac + # test for cygwin because mv fails w/o .exe extensions + case $host in + *cygwin*) + exeext=.exe + outputname=`$echo $outputname|${SED} 's,.exe$,,'` ;; + *) exeext= ;; + esac + case $host in + *cygwin* | *mingw* ) + output_name=`basename $output` + output_path=`dirname $output` + cwrappersource="$output_path/$objdir/lt-$output_name.c" + cwrapper="$output_path/$output_name.exe" + $rm $cwrappersource $cwrapper + trap "$rm $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15 + + cat > $cwrappersource <> $cwrappersource<<"EOF" +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#if defined(PATH_MAX) +# define LT_PATHMAX PATH_MAX +#elif defined(MAXPATHLEN) +# define LT_PATHMAX MAXPATHLEN +#else +# define LT_PATHMAX 1024 +#endif + +#ifndef DIR_SEPARATOR +# define DIR_SEPARATOR '/' +# define PATH_SEPARATOR ':' +#endif + +#if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \ + defined (__OS2__) +# define HAVE_DOS_BASED_FILE_SYSTEM +# ifndef DIR_SEPARATOR_2 +# define DIR_SEPARATOR_2 '\\' +# endif +# ifndef PATH_SEPARATOR_2 +# define PATH_SEPARATOR_2 ';' +# endif +#endif + +#ifndef DIR_SEPARATOR_2 +# define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR) +#else /* DIR_SEPARATOR_2 */ +# define IS_DIR_SEPARATOR(ch) \ + (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2)) +#endif /* DIR_SEPARATOR_2 */ + +#ifndef PATH_SEPARATOR_2 +# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR) +#else /* PATH_SEPARATOR_2 */ +# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2) +#endif /* PATH_SEPARATOR_2 */ + +#define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type))) +#define XFREE(stale) do { \ + if (stale) { free ((void *) stale); stale = 0; } \ +} while (0) + +/* -DDEBUG is fairly common in CFLAGS. */ +#undef DEBUG +#if defined DEBUGWRAPPER +# define DEBUG(format, ...) fprintf(stderr, format, __VA_ARGS__) +#else +# define DEBUG(format, ...) +#endif + +const char *program_name = NULL; + +void * xmalloc (size_t num); +char * xstrdup (const char *string); +const char * base_name (const char *name); +char * find_executable(const char *wrapper); +int check_executable(const char *path); +char * strendzap(char *str, const char *pat); +void lt_fatal (const char *message, ...); + +int +main (int argc, char *argv[]) +{ + char **newargz; + int i; + + program_name = (char *) xstrdup (base_name (argv[0])); + DEBUG("(main) argv[0] : %s\n",argv[0]); + DEBUG("(main) program_name : %s\n",program_name); + newargz = XMALLOC(char *, argc+2); +EOF + + cat >> $cwrappersource <> $cwrappersource <<"EOF" + newargz[1] = find_executable(argv[0]); + if (newargz[1] == NULL) + lt_fatal("Couldn't find %s", argv[0]); + DEBUG("(main) found exe at : %s\n",newargz[1]); + /* we know the script has the same name, without the .exe */ + /* so make sure newargz[1] doesn't end in .exe */ + strendzap(newargz[1],".exe"); + for (i = 1; i < argc; i++) + newargz[i+1] = xstrdup(argv[i]); + newargz[argc+1] = NULL; + + for (i=0; i> $cwrappersource <> $cwrappersource <> $cwrappersource <<"EOF" + return 127; +} + +void * +xmalloc (size_t num) +{ + void * p = (void *) malloc (num); + if (!p) + lt_fatal ("Memory exhausted"); + + return p; +} + +char * +xstrdup (const char *string) +{ + return string ? strcpy ((char *) xmalloc (strlen (string) + 1), string) : NULL +; +} + +const char * +base_name (const char *name) +{ + const char *base; + +#if defined (HAVE_DOS_BASED_FILE_SYSTEM) + /* Skip over the disk name in MSDOS pathnames. */ + if (isalpha ((unsigned char)name[0]) && name[1] == ':') + name += 2; +#endif + + for (base = name; *name; name++) + if (IS_DIR_SEPARATOR (*name)) + base = name + 1; + return base; +} + +int +check_executable(const char * path) +{ + struct stat st; + + DEBUG("(check_executable) : %s\n", path ? (*path ? path : "EMPTY!") : "NULL!"); + if ((!path) || (!*path)) + return 0; + + if ((stat (path, &st) >= 0) && + ( + /* MinGW & native WIN32 do not support S_IXOTH or S_IXGRP */ +#if defined (S_IXOTH) + ((st.st_mode & S_IXOTH) == S_IXOTH) || +#endif +#if defined (S_IXGRP) + ((st.st_mode & S_IXGRP) == S_IXGRP) || +#endif + ((st.st_mode & S_IXUSR) == S_IXUSR)) + ) + return 1; + else + return 0; +} + +/* Searches for the full path of the wrapper. Returns + newly allocated full path name if found, NULL otherwise */ +char * +find_executable (const char* wrapper) +{ + int has_slash = 0; + const char* p; + const char* p_next; + /* static buffer for getcwd */ + char tmp[LT_PATHMAX + 1]; + int tmp_len; + char* concat_name; + + DEBUG("(find_executable) : %s\n", wrapper ? (*wrapper ? wrapper : "EMPTY!") : "NULL!"); + + if ((wrapper == NULL) || (*wrapper == '\0')) + return NULL; + + /* Absolute path? */ +#if defined (HAVE_DOS_BASED_FILE_SYSTEM) + if (isalpha ((unsigned char)wrapper[0]) && wrapper[1] == ':') + { + concat_name = xstrdup (wrapper); + if (check_executable(concat_name)) + return concat_name; + XFREE(concat_name); + } + else + { +#endif + if (IS_DIR_SEPARATOR (wrapper[0])) + { + concat_name = xstrdup (wrapper); + if (check_executable(concat_name)) + return concat_name; + XFREE(concat_name); + } +#if defined (HAVE_DOS_BASED_FILE_SYSTEM) + } +#endif + + for (p = wrapper; *p; p++) + if (*p == '/') + { + has_slash = 1; + break; + } + if (!has_slash) + { + /* no slashes; search PATH */ + const char* path = getenv ("PATH"); + if (path != NULL) + { + for (p = path; *p; p = p_next) + { + const char* q; + size_t p_len; + for (q = p; *q; q++) + if (IS_PATH_SEPARATOR(*q)) + break; + p_len = q - p; + p_next = (*q == '\0' ? q : q + 1); + if (p_len == 0) + { + /* empty path: current directory */ + if (getcwd (tmp, LT_PATHMAX) == NULL) + lt_fatal ("getcwd failed"); + tmp_len = strlen(tmp); + concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1); + memcpy (concat_name, tmp, tmp_len); + concat_name[tmp_len] = '/'; + strcpy (concat_name + tmp_len + 1, wrapper); + } + else + { + concat_name = XMALLOC(char, p_len + 1 + strlen(wrapper) + 1); + memcpy (concat_name, p, p_len); + concat_name[p_len] = '/'; + strcpy (concat_name + p_len + 1, wrapper); + } + if (check_executable(concat_name)) + return concat_name; + XFREE(concat_name); + } + } + /* not found in PATH; assume curdir */ + } + /* Relative path | not found in path: prepend cwd */ + if (getcwd (tmp, LT_PATHMAX) == NULL) + lt_fatal ("getcwd failed"); + tmp_len = strlen(tmp); + concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1); + memcpy (concat_name, tmp, tmp_len); + concat_name[tmp_len] = '/'; + strcpy (concat_name + tmp_len + 1, wrapper); + + if (check_executable(concat_name)) + return concat_name; + XFREE(concat_name); + return NULL; +} + +char * +strendzap(char *str, const char *pat) +{ + size_t len, patlen; + + assert(str != NULL); + assert(pat != NULL); + + len = strlen(str); + patlen = strlen(pat); + + if (patlen <= len) + { + str += len - patlen; + if (strcmp(str, pat) == 0) + *str = '\0'; + } + return str; +} + +static void +lt_error_core (int exit_status, const char * mode, + const char * message, va_list ap) +{ + fprintf (stderr, "%s: %s: ", program_name, mode); + vfprintf (stderr, message, ap); + fprintf (stderr, ".\n"); + + if (exit_status >= 0) + exit (exit_status); +} + +void +lt_fatal (const char *message, ...) +{ + va_list ap; + va_start (ap, message); + lt_error_core (EXIT_FAILURE, "FATAL", message, ap); + va_end (ap); +} +EOF + # we should really use a build-platform specific compiler + # here, but OTOH, the wrappers (shell script and this C one) + # are only useful if you want to execute the "real" binary. + # Since the "real" binary is built for $host, then this + # wrapper might as well be built for $host, too. + $run $LTCC $LTCFLAGS -s -o $cwrapper $cwrappersource + ;; + esac + $rm $output + trap "$rm $output; exit $EXIT_FAILURE" 1 2 15 + + $echo > $output "\ +#! $SHELL + +# $output - temporary wrapper script for $objdir/$outputname +# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP +# +# The $output program cannot be directly executed until all the libtool +# libraries that it depends on are installed. +# +# This wrapper script should never be moved out of the build directory. +# If it is, it will not operate correctly. + +# Sed substitution that helps us do robust quoting. It backslashifies +# metacharacters that are still active within double-quoted strings. +Xsed='${SED} -e 1s/^X//' +sed_quote_subst='$sed_quote_subst' + +# Be Bourne compatible (taken from Autoconf:_AS_BOURNE_COMPATIBLE). +if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then + emulate sh + NULLCMD=: + # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which + # is contrary to our usage. Disable this feature. + alias -g '\${1+\"\$@\"}'='\"\$@\"' + setopt NO_GLOB_SUBST +else + case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac +fi +BIN_SH=xpg4; export BIN_SH # for Tru64 +DUALCASE=1; export DUALCASE # for MKS sh + +# The HP-UX ksh and POSIX shell print the target directory to stdout +# if CDPATH is set. +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH + +relink_command=\"$relink_command\" + +# This environment variable determines our operation mode. +if test \"\$libtool_install_magic\" = \"$magic\"; then + # install mode needs the following variable: + notinst_deplibs='$notinst_deplibs' +else + # When we are sourced in execute mode, \$file and \$echo are already set. + if test \"\$libtool_execute_magic\" != \"$magic\"; then + echo=\"$qecho\" + file=\"\$0\" + # Make sure echo works. + if test \"X\$1\" = X--no-reexec; then + # Discard the --no-reexec flag, and continue. + shift + elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then + # Yippee, \$echo works! + : + else + # Restart under the correct shell, and then maybe \$echo will work. + exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"} + fi + fi\ +" + $echo >> $output "\ + + # Find the directory that this script lives in. + thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\` + test \"x\$thisdir\" = \"x\$file\" && thisdir=. + + # Follow symbolic links until we get to the real thisdir. + file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\` + while test -n \"\$file\"; do + destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\` + + # If there was a directory component, then change thisdir. + if test \"x\$destdir\" != \"x\$file\"; then + case \"\$destdir\" in + [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;; + *) thisdir=\"\$thisdir/\$destdir\" ;; + esac + fi + + file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\` + file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\` + done + + # Try to get the absolute directory name. + absdir=\`cd \"\$thisdir\" && pwd\` + test -n \"\$absdir\" && thisdir=\"\$absdir\" +" + + if test "$fast_install" = yes; then + $echo >> $output "\ + program=lt-'$outputname'$exeext + progdir=\"\$thisdir/$objdir\" + + if test ! -f \"\$progdir/\$program\" || \\ + { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\ + test \"X\$file\" != \"X\$progdir/\$program\"; }; then + + file=\"\$\$-\$program\" + + if test ! -d \"\$progdir\"; then + $mkdir \"\$progdir\" + else + $rm \"\$progdir/\$file\" + fi" + + $echo >> $output "\ + + # relink executable if necessary + if test -n \"\$relink_command\"; then + if relink_command_output=\`eval \$relink_command 2>&1\`; then : + else + $echo \"\$relink_command_output\" >&2 + $rm \"\$progdir/\$file\" + exit $EXIT_FAILURE + fi + fi + + $mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null || + { $rm \"\$progdir/\$program\"; + $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; } + $rm \"\$progdir/\$file\" + fi" + else + $echo >> $output "\ + program='$outputname' + progdir=\"\$thisdir/$objdir\" +" + fi + + $echo >> $output "\ + + if test -f \"\$progdir/\$program\"; then" + + # Export our shlibpath_var if we have one. + if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then + $echo >> $output "\ + # Add our own library path to $shlibpath_var + $shlibpath_var=\"$temp_rpath\$$shlibpath_var\" + + # Some systems cannot cope with colon-terminated $shlibpath_var + # The second colon is a workaround for a bug in BeOS R4 sed + $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\` + + export $shlibpath_var +" + fi + + # fixup the dll searchpath if we need to. + if test -n "$dllsearchpath"; then + $echo >> $output "\ + # Add the dll search path components to the executable PATH + PATH=$dllsearchpath:\$PATH +" + fi + + $echo >> $output "\ + if test \"\$libtool_execute_magic\" != \"$magic\"; then + # Run the actual program with our arguments. +" + case $host in + # Backslashes separate directories on plain windows + *-*-mingw | *-*-os2*) + $echo >> $output "\ + exec \"\$progdir\\\\\$program\" \${1+\"\$@\"} +" + ;; + + *) + $echo >> $output "\ + exec \"\$progdir/\$program\" \${1+\"\$@\"} +" + ;; + esac + $echo >> $output "\ + \$echo \"\$0: cannot exec \$program \$*\" + exit $EXIT_FAILURE + fi + else + # The program doesn't exist. + \$echo \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2 + \$echo \"This script is just a wrapper for \$program.\" 1>&2 + $echo \"See the $PACKAGE documentation for more information.\" 1>&2 + exit $EXIT_FAILURE + fi +fi\ +" + chmod +x $output + fi + exit $EXIT_SUCCESS + ;; + esac + + # See if we need to build an old-fashioned archive. + for oldlib in $oldlibs; do + + if test "$build_libtool_libs" = convenience; then + oldobjs="$libobjs_save" + addlibs="$convenience" + build_libtool_libs=no + else + if test "$build_libtool_libs" = module; then + oldobjs="$libobjs_save" + build_libtool_libs=no + else + oldobjs="$old_deplibs $non_pic_objects" + fi + addlibs="$old_convenience" + fi + + if test -n "$addlibs"; then + gentop="$output_objdir/${outputname}x" + generated="$generated $gentop" + + func_extract_archives $gentop $addlibs + oldobjs="$oldobjs $func_extract_archives_result" + fi + + # Do each command in the archive commands. + if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then + cmds=$old_archive_from_new_cmds + else + # POSIX demands no paths to be encoded in archives. We have + # to avoid creating archives with duplicate basenames if we + # might have to extract them afterwards, e.g., when creating a + # static archive out of a convenience library, or when linking + # the entirety of a libtool archive into another (currently + # not supported by libtool). + if (for obj in $oldobjs + do + $echo "X$obj" | $Xsed -e 's%^.*/%%' + done | sort | sort -uc >/dev/null 2>&1); then + : + else + $echo "copying selected object files to avoid basename conflicts..." + + if test -z "$gentop"; then + gentop="$output_objdir/${outputname}x" + generated="$generated $gentop" + + $show "${rm}r $gentop" + $run ${rm}r "$gentop" + $show "$mkdir $gentop" + $run $mkdir "$gentop" + exit_status=$? + if test "$exit_status" -ne 0 && test ! -d "$gentop"; then + exit $exit_status + fi + fi + + save_oldobjs=$oldobjs + oldobjs= + counter=1 + for obj in $save_oldobjs + do + objbase=`$echo "X$obj" | $Xsed -e 's%^.*/%%'` + case " $oldobjs " in + " ") oldobjs=$obj ;; + *[\ /]"$objbase "*) + while :; do + # Make sure we don't pick an alternate name that also + # overlaps. + newobj=lt$counter-$objbase + counter=`expr $counter + 1` + case " $oldobjs " in + *[\ /]"$newobj "*) ;; + *) if test ! -f "$gentop/$newobj"; then break; fi ;; + esac + done + $show "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj" + $run ln "$obj" "$gentop/$newobj" || + $run cp "$obj" "$gentop/$newobj" + oldobjs="$oldobjs $gentop/$newobj" + ;; + *) oldobjs="$oldobjs $obj" ;; + esac + done + fi + + eval cmds=\"$old_archive_cmds\" + + if len=`expr "X$cmds" : ".*"` && + test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then + cmds=$old_archive_cmds + else + # the command line is too long to link in one step, link in parts + $echo "using piecewise archive linking..." + save_RANLIB=$RANLIB + RANLIB=: + objlist= + concat_cmds= + save_oldobjs=$oldobjs + + # Is there a better way of finding the last object in the list? + for obj in $save_oldobjs + do + last_oldobj=$obj + done + for obj in $save_oldobjs + do + oldobjs="$objlist $obj" + objlist="$objlist $obj" + eval test_cmds=\"$old_archive_cmds\" + if len=`expr "X$test_cmds" : ".*" 2>/dev/null` && + test "$len" -le "$max_cmd_len"; then + : + else + # the above command should be used before it gets too long + oldobjs=$objlist + if test "$obj" = "$last_oldobj" ; then + RANLIB=$save_RANLIB + fi + test -z "$concat_cmds" || concat_cmds=$concat_cmds~ + eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\" + objlist= + fi + done + RANLIB=$save_RANLIB + oldobjs=$objlist + if test "X$oldobjs" = "X" ; then + eval cmds=\"\$concat_cmds\" + else + eval cmds=\"\$concat_cmds~\$old_archive_cmds\" + fi + fi + fi + save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + eval cmd=\"$cmd\" + IFS="$save_ifs" + $show "$cmd" + $run eval "$cmd" || exit $? + done + IFS="$save_ifs" + done + + if test -n "$generated"; then + $show "${rm}r$generated" + $run ${rm}r$generated + fi + + # Now create the libtool archive. + case $output in + *.la) + old_library= + test "$build_old_libs" = yes && old_library="$libname.$libext" + $show "creating $output" + + # Preserve any variables that may affect compiler behavior + for var in $variables_saved_for_relink; do + if eval test -z \"\${$var+set}\"; then + relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command" + elif eval var_value=\$$var; test -z "$var_value"; then + relink_command="$var=; export $var; $relink_command" + else + var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"` + relink_command="$var=\"$var_value\"; export $var; $relink_command" + fi + done + # Quote the link command for shipping. + relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)" + relink_command=`$echo "X$relink_command" | $SP2NL | $Xsed -e "$sed_quote_subst" | $NL2SP` + if test "$hardcode_automatic" = yes ; then + relink_command= + fi + + + # Only create the output if not a dry run. + if test -z "$run"; then + for installed in no yes; do + if test "$installed" = yes; then + if test -z "$install_libdir"; then + break + fi + output="$output_objdir/$outputname"i + # Replace all uninstalled libtool libraries with the installed ones + newdependency_libs= + for deplib in $dependency_libs; do + case $deplib in + *.la) + name=`$echo "X$deplib" | $Xsed -e 's%^.*/%%'` + eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` + if test -z "$libdir"; then + $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2 + exit $EXIT_FAILURE + fi + newdependency_libs="$newdependency_libs $libdir/$name" + ;; + *) newdependency_libs="$newdependency_libs $deplib" ;; + esac + done + dependency_libs="$newdependency_libs" + newdlfiles= + for lib in $dlfiles; do + name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` + eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` + if test -z "$libdir"; then + $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 + exit $EXIT_FAILURE + fi + newdlfiles="$newdlfiles $libdir/$name" + done + dlfiles="$newdlfiles" + newdlprefiles= + for lib in $dlprefiles; do + name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` + eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` + if test -z "$libdir"; then + $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 + exit $EXIT_FAILURE + fi + newdlprefiles="$newdlprefiles $libdir/$name" + done + dlprefiles="$newdlprefiles" + else + newdlfiles= + for lib in $dlfiles; do + case $lib in + [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; + *) abs=`pwd`"/$lib" ;; + esac + newdlfiles="$newdlfiles $abs" + done + dlfiles="$newdlfiles" + newdlprefiles= + for lib in $dlprefiles; do + case $lib in + [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; + *) abs=`pwd`"/$lib" ;; + esac + newdlprefiles="$newdlprefiles $abs" + done + dlprefiles="$newdlprefiles" + fi + $rm $output + # place dlname in correct position for cygwin + tdlname=$dlname + case $host,$output,$installed,$module,$dlname in + *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;; + esac + $echo > $output "\ +# $outputname - a libtool library file +# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP +# +# Please DO NOT delete this file! +# It is necessary for linking the library. + +# The name that we can dlopen(3). +dlname='$tdlname' + +# Names of this library. +library_names='$library_names' + +# The name of the static archive. +old_library='$old_library' + +# Libraries that this one depends upon. +dependency_libs='$dependency_libs' + +# Version information for $libname. +current=$current +age=$age +revision=$revision + +# Is this an already installed library? +installed=$installed + +# Should we warn about portability when linking against -modules? +shouldnotlink=$module + +# Files to dlopen/dlpreopen +dlopen='$dlfiles' +dlpreopen='$dlprefiles' + +# Directory that this library needs to be installed in: +libdir='$install_libdir'" + if test "$installed" = no && test "$need_relink" = yes; then + $echo >> $output "\ +relink_command=\"$relink_command\"" + fi + done + fi + + # Do a symbolic link so that the libtool archive can be found in + # LD_LIBRARY_PATH before the program is installed. + $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)" + $run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $? + ;; + esac + exit $EXIT_SUCCESS + ;; + + # libtool install mode + install) + modename="$modename: install" + + # There may be an optional sh(1) argument at the beginning of + # install_prog (especially on Windows NT). + if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh || + # Allow the use of GNU shtool's install command. + $echo "X$nonopt" | grep shtool > /dev/null; then + # Aesthetically quote it. + arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"` + case $arg in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + arg="\"$arg\"" + ;; + esac + install_prog="$arg " + arg="$1" + shift + else + install_prog= + arg=$nonopt + fi + + # The real first argument should be the name of the installation program. + # Aesthetically quote it. + arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` + case $arg in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + arg="\"$arg\"" + ;; + esac + install_prog="$install_prog$arg" + + # We need to accept at least all the BSD install flags. + dest= + files= + opts= + prev= + install_type= + isdir=no + stripme= + for arg + do + if test -n "$dest"; then + files="$files $dest" + dest=$arg + continue + fi + + case $arg in + -d) isdir=yes ;; + -f) + case " $install_prog " in + *[\\\ /]cp\ *) ;; + *) prev=$arg ;; + esac + ;; + -g | -m | -o) prev=$arg ;; + -s) + stripme=" -s" + continue + ;; + -*) + ;; + *) + # If the previous option needed an argument, then skip it. + if test -n "$prev"; then + prev= + else + dest=$arg + continue + fi + ;; + esac + + # Aesthetically quote the argument. + arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` + case $arg in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + arg="\"$arg\"" + ;; + esac + install_prog="$install_prog $arg" + done + + if test -z "$install_prog"; then + $echo "$modename: you must specify an install program" 1>&2 + $echo "$help" 1>&2 + exit $EXIT_FAILURE + fi + + if test -n "$prev"; then + $echo "$modename: the \`$prev' option requires an argument" 1>&2 + $echo "$help" 1>&2 + exit $EXIT_FAILURE + fi + + if test -z "$files"; then + if test -z "$dest"; then + $echo "$modename: no file or destination specified" 1>&2 + else + $echo "$modename: you must specify a destination" 1>&2 + fi + $echo "$help" 1>&2 + exit $EXIT_FAILURE + fi + + # Strip any trailing slash from the destination. + dest=`$echo "X$dest" | $Xsed -e 's%/$%%'` + + # Check to see that the destination is a directory. + test -d "$dest" && isdir=yes + if test "$isdir" = yes; then + destdir="$dest" + destname= + else + destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'` + test "X$destdir" = "X$dest" && destdir=. + destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'` + + # Not a directory, so check to see that there is only one file specified. + set dummy $files + if test "$#" -gt 2; then + $echo "$modename: \`$dest' is not a directory" 1>&2 + $echo "$help" 1>&2 + exit $EXIT_FAILURE + fi + fi + case $destdir in + [\\/]* | [A-Za-z]:[\\/]*) ;; + *) + for file in $files; do + case $file in + *.lo) ;; + *) + $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2 + $echo "$help" 1>&2 + exit $EXIT_FAILURE + ;; + esac + done + ;; + esac + + # This variable tells wrapper scripts just to set variables rather + # than running their programs. + libtool_install_magic="$magic" + + staticlibs= + future_libdirs= + current_libdirs= + for file in $files; do + + # Do each installation. + case $file in + *.$libext) + # Do the static libraries later. + staticlibs="$staticlibs $file" + ;; + + *.la) + # Check to see that this really is a libtool archive. + if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : + else + $echo "$modename: \`$file' is not a valid libtool archive" 1>&2 + $echo "$help" 1>&2 + exit $EXIT_FAILURE + fi + + library_names= + old_library= + relink_command= + # If there is no directory component, then add one. + case $file in + */* | *\\*) . $file ;; + *) . ./$file ;; + esac + + # Add the libdir to current_libdirs if it is the destination. + if test "X$destdir" = "X$libdir"; then + case "$current_libdirs " in + *" $libdir "*) ;; + *) current_libdirs="$current_libdirs $libdir" ;; + esac + else + # Note the libdir as a future libdir. + case "$future_libdirs " in + *" $libdir "*) ;; + *) future_libdirs="$future_libdirs $libdir" ;; + esac + fi + + dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/ + test "X$dir" = "X$file/" && dir= + dir="$dir$objdir" + + if test -n "$relink_command"; then + # Determine the prefix the user has applied to our future dir. + inst_prefix_dir=`$echo "$destdir" | $SED "s%$libdir\$%%"` + + # Don't allow the user to place us outside of our expected + # location b/c this prevents finding dependent libraries that + # are installed to the same prefix. + # At present, this check doesn't affect windows .dll's that + # are installed into $libdir/../bin (currently, that works fine) + # but it's something to keep an eye on. + if test "$inst_prefix_dir" = "$destdir"; then + $echo "$modename: error: cannot install \`$file' to a directory not ending in $libdir" 1>&2 + exit $EXIT_FAILURE + fi + + if test -n "$inst_prefix_dir"; then + # Stick the inst_prefix_dir data into the link command. + relink_command=`$echo "$relink_command" | $SP2NL | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%" | $NL2SP` + else + relink_command=`$echo "$relink_command" | $SP2NL | $SED "s%@inst_prefix_dir@%%" | $NL2SP` + fi + + $echo "$modename: warning: relinking \`$file'" 1>&2 + $show "$relink_command" + if $run eval "$relink_command"; then : + else + $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2 + exit $EXIT_FAILURE + fi + fi + + # See the names of the shared library. + set dummy $library_names + if test -n "$2"; then + realname="$2" + shift + shift + + srcname="$realname" + test -n "$relink_command" && srcname="$realname"T + + # Install the shared library and build the symlinks. + $show "$install_prog $dir/$srcname $destdir/$realname" + $run eval "$install_prog $dir/$srcname $destdir/$realname" || exit $? + if test -n "$stripme" && test -n "$striplib"; then + $show "$striplib $destdir/$realname" + $run eval "$striplib $destdir/$realname" || exit $? + fi + + if test "$#" -gt 0; then + # Delete the old symlinks, and create new ones. + # Try `ln -sf' first, because the `ln' binary might depend on + # the symlink we replace! Solaris /bin/ln does not understand -f, + # so we also need to try rm && ln -s. + for linkname + do + if test "$linkname" != "$realname"; then + $show "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })" + $run eval "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })" + fi + done + fi + + # Do each command in the postinstall commands. + lib="$destdir/$realname" + cmds=$postinstall_cmds + save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + eval cmd=\"$cmd\" + $show "$cmd" + $run eval "$cmd" || { + lt_exit=$? + + # Restore the uninstalled library and exit + if test "$mode" = relink; then + $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)' + fi + + exit $lt_exit + } + done + IFS="$save_ifs" + fi + + # Install the pseudo-library for information purposes. + name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` + instname="$dir/$name"i + $show "$install_prog $instname $destdir/$name" + $run eval "$install_prog $instname $destdir/$name" || exit $? + + # Maybe install the static library, too. + test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library" + ;; + + *.lo) + # Install (i.e. copy) a libtool object. + + # Figure out destination file name, if it wasn't already specified. + if test -n "$destname"; then + destfile="$destdir/$destname" + else + destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'` + destfile="$destdir/$destfile" + fi + + # Deduce the name of the destination old-style object file. + case $destfile in + *.lo) + staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"` + ;; + *.$objext) + staticdest="$destfile" + destfile= + ;; + *) + $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2 + $echo "$help" 1>&2 + exit $EXIT_FAILURE + ;; + esac + + # Install the libtool object if requested. + if test -n "$destfile"; then + $show "$install_prog $file $destfile" + $run eval "$install_prog $file $destfile" || exit $? + fi + + # Install the old object if enabled. + if test "$build_old_libs" = yes; then + # Deduce the name of the old-style object file. + staticobj=`$echo "X$file" | $Xsed -e "$lo2o"` + + $show "$install_prog $staticobj $staticdest" + $run eval "$install_prog \$staticobj \$staticdest" || exit $? + fi + exit $EXIT_SUCCESS + ;; + + *) + # Figure out destination file name, if it wasn't already specified. + if test -n "$destname"; then + destfile="$destdir/$destname" + else + destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'` + destfile="$destdir/$destfile" + fi + + # If the file is missing, and there is a .exe on the end, strip it + # because it is most likely a libtool script we actually want to + # install + stripped_ext="" + case $file in + *.exe) + if test ! -f "$file"; then + file=`$echo $file|${SED} 's,.exe$,,'` + stripped_ext=".exe" + fi + ;; + esac + + # Do a test to see if this is really a libtool program. + case $host in + *cygwin*|*mingw*) + wrapper=`$echo $file | ${SED} -e 's,.exe$,,'` + ;; + *) + wrapper=$file + ;; + esac + if (${SED} -e '4q' $wrapper | grep "^# Generated by .*$PACKAGE")>/dev/null 2>&1; then + notinst_deplibs= + relink_command= + + # Note that it is not necessary on cygwin/mingw to append a dot to + # foo even if both foo and FILE.exe exist: automatic-append-.exe + # behavior happens only for exec(3), not for open(2)! Also, sourcing + # `FILE.' does not work on cygwin managed mounts. + # + # If there is no directory component, then add one. + case $wrapper in + */* | *\\*) . ${wrapper} ;; + *) . ./${wrapper} ;; + esac + + # Check the variables that should have been set. + if test -z "$notinst_deplibs"; then + $echo "$modename: invalid libtool wrapper script \`$wrapper'" 1>&2 + exit $EXIT_FAILURE + fi + + finalize=yes + for lib in $notinst_deplibs; do + # Check to see that each library is installed. + libdir= + if test -f "$lib"; then + # If there is no directory component, then add one. + case $lib in + */* | *\\*) . $lib ;; + *) . ./$lib ;; + esac + fi + libfile="$libdir/"`$echo "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test + if test -n "$libdir" && test ! -f "$libfile"; then + $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2 + finalize=no + fi + done + + relink_command= + # Note that it is not necessary on cygwin/mingw to append a dot to + # foo even if both foo and FILE.exe exist: automatic-append-.exe + # behavior happens only for exec(3), not for open(2)! Also, sourcing + # `FILE.' does not work on cygwin managed mounts. + # + # If there is no directory component, then add one. + case $wrapper in + */* | *\\*) . ${wrapper} ;; + *) . ./${wrapper} ;; + esac + + outputname= + if test "$fast_install" = no && test -n "$relink_command"; then + if test "$finalize" = yes && test -z "$run"; then + tmpdir=`func_mktempdir` + file=`$echo "X$file$stripped_ext" | $Xsed -e 's%^.*/%%'` + outputname="$tmpdir/$file" + # Replace the output file specification. + relink_command=`$echo "X$relink_command" | $SP2NL | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g' | $NL2SP` + + $show "$relink_command" + if $run eval "$relink_command"; then : + else + $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2 + ${rm}r "$tmpdir" + continue + fi + file="$outputname" + else + $echo "$modename: warning: cannot relink \`$file'" 1>&2 + fi + else + # Install the binary that we compiled earlier. + file=`$echo "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"` + fi + fi + + # remove .exe since cygwin /usr/bin/install will append another + # one anyway + case $install_prog,$host in + */usr/bin/install*,*cygwin*) + case $file:$destfile in + *.exe:*.exe) + # this is ok + ;; + *.exe:*) + destfile=$destfile.exe + ;; + *:*.exe) + destfile=`$echo $destfile | ${SED} -e 's,.exe$,,'` + ;; + esac + ;; + esac + $show "$install_prog$stripme $file $destfile" + $run eval "$install_prog\$stripme \$file \$destfile" || exit $? + test -n "$outputname" && ${rm}r "$tmpdir" + ;; + esac + done + + for file in $staticlibs; do + name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` + + # Set up the ranlib parameters. + oldlib="$destdir/$name" + + $show "$install_prog $file $oldlib" + $run eval "$install_prog \$file \$oldlib" || exit $? + + if test -n "$stripme" && test -n "$old_striplib"; then + $show "$old_striplib $oldlib" + $run eval "$old_striplib $oldlib" || exit $? + fi + + # Do each command in the postinstall commands. + cmds=$old_postinstall_cmds + save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + eval cmd=\"$cmd\" + $show "$cmd" + $run eval "$cmd" || exit $? + done + IFS="$save_ifs" + done + + if test -n "$future_libdirs"; then + $echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2 + fi + + if test -n "$current_libdirs"; then + # Maybe just do a dry run. + test -n "$run" && current_libdirs=" -n$current_libdirs" + exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs' + else + exit $EXIT_SUCCESS + fi + ;; + + # libtool finish mode + finish) + modename="$modename: finish" + libdirs="$nonopt" + admincmds= + + if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then + for dir + do + libdirs="$libdirs $dir" + done + + for libdir in $libdirs; do + if test -n "$finish_cmds"; then + # Do each command in the finish commands. + cmds=$finish_cmds + save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + eval cmd=\"$cmd\" + $show "$cmd" + $run eval "$cmd" || admincmds="$admincmds + $cmd" + done + IFS="$save_ifs" + fi + if test -n "$finish_eval"; then + # Do the single finish_eval. + eval cmds=\"$finish_eval\" + $run eval "$cmds" || admincmds="$admincmds + $cmds" + fi + done + fi + + # Exit here if they wanted silent mode. + test "$show" = : && exit $EXIT_SUCCESS + + $echo "X----------------------------------------------------------------------" | $Xsed + $echo "Libraries have been installed in:" + for libdir in $libdirs; do + $echo " $libdir" + done + $echo + $echo "If you ever happen to want to link against installed libraries" + $echo "in a given directory, LIBDIR, you must either use libtool, and" + $echo "specify the full pathname of the library, or use the \`-LLIBDIR'" + $echo "flag during linking and do at least one of the following:" + if test -n "$shlibpath_var"; then + $echo " - add LIBDIR to the \`$shlibpath_var' environment variable" + $echo " during execution" + fi + if test -n "$runpath_var"; then + $echo " - add LIBDIR to the \`$runpath_var' environment variable" + $echo " during linking" + fi + if test -n "$hardcode_libdir_flag_spec"; then + libdir=LIBDIR + eval flag=\"$hardcode_libdir_flag_spec\" + + $echo " - use the \`$flag' linker flag" + fi + if test -n "$admincmds"; then + $echo " - have your system administrator run these commands:$admincmds" + fi + if test -f /etc/ld.so.conf; then + $echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'" + fi + $echo + $echo "See any operating system documentation about shared libraries for" + $echo "more information, such as the ld(1) and ld.so(8) manual pages." + $echo "X----------------------------------------------------------------------" | $Xsed + exit $EXIT_SUCCESS + ;; + + # libtool execute mode + execute) + modename="$modename: execute" + + # The first argument is the command name. + cmd="$nonopt" + if test -z "$cmd"; then + $echo "$modename: you must specify a COMMAND" 1>&2 + $echo "$help" + exit $EXIT_FAILURE + fi + + # Handle -dlopen flags immediately. + for file in $execute_dlfiles; do + if test ! -f "$file"; then + $echo "$modename: \`$file' is not a file" 1>&2 + $echo "$help" 1>&2 + exit $EXIT_FAILURE + fi + + dir= + case $file in + *.la) + # Check to see that this really is a libtool archive. + if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : + else + $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 + $echo "$help" 1>&2 + exit $EXIT_FAILURE + fi + + # Read the libtool library. + dlname= + library_names= + + # If there is no directory component, then add one. + case $file in + */* | *\\*) . $file ;; + *) . ./$file ;; + esac + + # Skip this library if it cannot be dlopened. + if test -z "$dlname"; then + # Warn if it was a shared library. + test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'" + continue + fi + + dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` + test "X$dir" = "X$file" && dir=. + + if test -f "$dir/$objdir/$dlname"; then + dir="$dir/$objdir" + else + if test ! -f "$dir/$dlname"; then + $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2 + exit $EXIT_FAILURE + fi + fi + ;; + + *.lo) + # Just add the directory containing the .lo file. + dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` + test "X$dir" = "X$file" && dir=. + ;; + + *) + $echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2 + continue + ;; + esac + + # Get the absolute pathname. + absdir=`cd "$dir" && pwd` + test -n "$absdir" && dir="$absdir" + + # Now add the directory to shlibpath_var. + if eval "test -z \"\$$shlibpath_var\""; then + eval "$shlibpath_var=\"\$dir\"" + else + eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\"" + fi + done + + # This variable tells wrapper scripts just to set shlibpath_var + # rather than running their programs. + libtool_execute_magic="$magic" + + # Check if any of the arguments is a wrapper script. + args= + for file + do + case $file in + -*) ;; + *) + # Do a test to see if this is really a libtool program. + if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then + # If there is no directory component, then add one. + case $file in + */* | *\\*) . $file ;; + *) . ./$file ;; + esac + + # Transform arg to wrapped name. + file="$progdir/$program" + fi + ;; + esac + # Quote arguments (to preserve shell metacharacters). + file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"` + args="$args \"$file\"" + done + + if test -z "$run"; then + if test -n "$shlibpath_var"; then + # Export the shlibpath_var. + eval "export $shlibpath_var" + fi + + # Restore saved environment variables + for lt_var in LANG LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES + do + eval "if test \"\${save_$lt_var+set}\" = set; then + $lt_var=\$save_$lt_var; export $lt_var + fi" + done + + # Now prepare to actually exec the command. + exec_cmd="\$cmd$args" + else + # Display what would be done. + if test -n "$shlibpath_var"; then + eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\"" + $echo "export $shlibpath_var" + fi + $echo "$cmd$args" + exit $EXIT_SUCCESS + fi + ;; + + # libtool clean and uninstall mode + clean | uninstall) + modename="$modename: $mode" + rm="$nonopt" + files= + rmforce= + exit_status=0 + + # This variable tells wrapper scripts just to set variables rather + # than running their programs. + libtool_install_magic="$magic" + + for arg + do + case $arg in + -f) rm="$rm $arg"; rmforce=yes ;; + -*) rm="$rm $arg" ;; + *) files="$files $arg" ;; + esac + done + + if test -z "$rm"; then + $echo "$modename: you must specify an RM program" 1>&2 + $echo "$help" 1>&2 + exit $EXIT_FAILURE + fi + + rmdirs= + + origobjdir="$objdir" + for file in $files; do + dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` + if test "X$dir" = "X$file"; then + dir=. + objdir="$origobjdir" + else + objdir="$dir/$origobjdir" + fi + name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` + test "$mode" = uninstall && objdir="$dir" + + # Remember objdir for removal later, being careful to avoid duplicates + if test "$mode" = clean; then + case " $rmdirs " in + *" $objdir "*) ;; + *) rmdirs="$rmdirs $objdir" ;; + esac + fi + + # Don't error if the file doesn't exist and rm -f was used. + if (test -L "$file") >/dev/null 2>&1 \ + || (test -h "$file") >/dev/null 2>&1 \ + || test -f "$file"; then + : + elif test -d "$file"; then + exit_status=1 + continue + elif test "$rmforce" = yes; then + continue + fi + + rmfiles="$file" + + case $name in + *.la) + # Possibly a libtool archive, so verify it. + if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then + . $dir/$name + + # Delete the libtool libraries and symlinks. + for n in $library_names; do + rmfiles="$rmfiles $objdir/$n" + done + test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library" + + case "$mode" in + clean) + case " $library_names " in + # " " in the beginning catches empty $dlname + *" $dlname "*) ;; + *) rmfiles="$rmfiles $objdir/$dlname" ;; + esac + test -n "$libdir" && rmfiles="$rmfiles $objdir/$name $objdir/${name}i" + ;; + uninstall) + if test -n "$library_names"; then + # Do each command in the postuninstall commands. + cmds=$postuninstall_cmds + save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + eval cmd=\"$cmd\" + $show "$cmd" + $run eval "$cmd" + if test "$?" -ne 0 && test "$rmforce" != yes; then + exit_status=1 + fi + done + IFS="$save_ifs" + fi + + if test -n "$old_library"; then + # Do each command in the old_postuninstall commands. + cmds=$old_postuninstall_cmds + save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + eval cmd=\"$cmd\" + $show "$cmd" + $run eval "$cmd" + if test "$?" -ne 0 && test "$rmforce" != yes; then + exit_status=1 + fi + done + IFS="$save_ifs" + fi + # FIXME: should reinstall the best remaining shared library. + ;; + esac + fi + ;; + + *.lo) + # Possibly a libtool object, so verify it. + if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then + + # Read the .lo file + . $dir/$name + + # Add PIC object to the list of files to remove. + if test -n "$pic_object" \ + && test "$pic_object" != none; then + rmfiles="$rmfiles $dir/$pic_object" + fi + + # Add non-PIC object to the list of files to remove. + if test -n "$non_pic_object" \ + && test "$non_pic_object" != none; then + rmfiles="$rmfiles $dir/$non_pic_object" + fi + fi + ;; + + *) + if test "$mode" = clean ; then + noexename=$name + case $file in + *.exe) + file=`$echo $file|${SED} 's,.exe$,,'` + noexename=`$echo $name|${SED} 's,.exe$,,'` + # $file with .exe has already been added to rmfiles, + # add $file without .exe + rmfiles="$rmfiles $file" + ;; + esac + # Do a test to see if this is a libtool program. + if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then + relink_command= + . $dir/$noexename + + # note $name still contains .exe if it was in $file originally + # as does the version of $file that was added into $rmfiles + rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}" + if test "$fast_install" = yes && test -n "$relink_command"; then + rmfiles="$rmfiles $objdir/lt-$name" + fi + if test "X$noexename" != "X$name" ; then + rmfiles="$rmfiles $objdir/lt-${noexename}.c" + fi + fi + fi + ;; + esac + $show "$rm $rmfiles" + $run $rm $rmfiles || exit_status=1 + done + objdir="$origobjdir" + + # Try to remove the ${objdir}s in the directories where we deleted files + for dir in $rmdirs; do + if test -d "$dir"; then + $show "rmdir $dir" + $run rmdir $dir >/dev/null 2>&1 + fi + done + + exit $exit_status + ;; + + "") + $echo "$modename: you must specify a MODE" 1>&2 + $echo "$generic_help" 1>&2 + exit $EXIT_FAILURE + ;; + esac + + if test -z "$exec_cmd"; then + $echo "$modename: invalid operation mode \`$mode'" 1>&2 + $echo "$generic_help" 1>&2 + exit $EXIT_FAILURE + fi +fi # test -z "$show_help" + +if test -n "$exec_cmd"; then + eval exec $exec_cmd + exit $EXIT_FAILURE +fi + +# We need to display help for each of the modes. +case $mode in +"") $echo \ +"Usage: $modename [OPTION]... [MODE-ARG]... + +Provide generalized library-building support services. + + --config show all configuration variables + --debug enable verbose shell tracing +-n, --dry-run display commands without modifying any files + --features display basic configuration information and exit + --finish same as \`--mode=finish' + --help display this help message and exit + --mode=MODE use operation mode MODE [default=inferred from MODE-ARGS] + --quiet same as \`--silent' + --silent don't print informational messages + --tag=TAG use configuration variables from tag TAG + --version print version information + +MODE must be one of the following: + + clean remove files from the build directory + compile compile a source file into a libtool object + execute automatically set library path, then run a program + finish complete the installation of libtool libraries + install install libraries or executables + link create a library or an executable + uninstall remove libraries from an installed directory + +MODE-ARGS vary depending on the MODE. Try \`$modename --help --mode=MODE' for +a more detailed description of MODE. + +Report bugs to ." + exit $EXIT_SUCCESS + ;; + +clean) + $echo \ +"Usage: $modename [OPTION]... --mode=clean RM [RM-OPTION]... FILE... + +Remove files from the build directory. + +RM is the name of the program to use to delete files associated with each FILE +(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed +to RM. + +If FILE is a libtool library, object or program, all the files associated +with it are deleted. Otherwise, only FILE itself is deleted using RM." + ;; + +compile) + $echo \ +"Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE + +Compile a source file into a libtool library object. + +This mode accepts the following additional options: + + -o OUTPUT-FILE set the output file name to OUTPUT-FILE + -prefer-pic try to building PIC objects only + -prefer-non-pic try to building non-PIC objects only + -static always build a \`.o' file suitable for static linking + +COMPILE-COMMAND is a command to be used in creating a \`standard' object file +from the given SOURCEFILE. + +The output file name is determined by removing the directory component from +SOURCEFILE, then substituting the C source code suffix \`.c' with the +library object suffix, \`.lo'." + ;; + +execute) + $echo \ +"Usage: $modename [OPTION]... --mode=execute COMMAND [ARGS]... + +Automatically set library path, then run a program. + +This mode accepts the following additional options: + + -dlopen FILE add the directory containing FILE to the library path + +This mode sets the library path environment variable according to \`-dlopen' +flags. + +If any of the ARGS are libtool executable wrappers, then they are translated +into their corresponding uninstalled binary, and any of their required library +directories are added to the library path. + +Then, COMMAND is executed, with ARGS as arguments." + ;; + +finish) + $echo \ +"Usage: $modename [OPTION]... --mode=finish [LIBDIR]... + +Complete the installation of libtool libraries. + +Each LIBDIR is a directory that contains libtool libraries. + +The commands that this mode executes may require superuser privileges. Use +the \`--dry-run' option if you just want to see what would be executed." + ;; + +install) + $echo \ +"Usage: $modename [OPTION]... --mode=install INSTALL-COMMAND... + +Install executables or libraries. + +INSTALL-COMMAND is the installation command. The first component should be +either the \`install' or \`cp' program. + +The rest of the components are interpreted as arguments to that command (only +BSD-compatible install options are recognized)." + ;; + +link) + $echo \ +"Usage: $modename [OPTION]... --mode=link LINK-COMMAND... + +Link object files or libraries together to form another library, or to +create an executable program. + +LINK-COMMAND is a command using the C compiler that you would use to create +a program from several object files. + +The following components of LINK-COMMAND are treated specially: + + -all-static do not do any dynamic linking at all + -avoid-version do not add a version suffix if possible + -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime + -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols + -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3) + -export-symbols SYMFILE + try to export only the symbols listed in SYMFILE + -export-symbols-regex REGEX + try to export only the symbols matching REGEX + -LLIBDIR search LIBDIR for required installed libraries + -lNAME OUTPUT-FILE requires the installed library libNAME + -module build a library that can dlopened + -no-fast-install disable the fast-install mode + -no-install link a not-installable executable + -no-undefined declare that a library does not refer to external symbols + -o OUTPUT-FILE create OUTPUT-FILE from the specified objects + -objectlist FILE Use a list of object files found in FILE to specify objects + -precious-files-regex REGEX + don't remove output files matching REGEX + -release RELEASE specify package release information + -rpath LIBDIR the created library will eventually be installed in LIBDIR + -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries + -static do not do any dynamic linking of uninstalled libtool libraries + -static-libtool-libs + do not do any dynamic linking of libtool libraries + -version-info CURRENT[:REVISION[:AGE]] + specify library version info [each variable defaults to 0] + +All other options (arguments beginning with \`-') are ignored. + +Every other argument is treated as a filename. Files ending in \`.la' are +treated as uninstalled libtool libraries, other files are standard or library +object files. + +If the OUTPUT-FILE ends in \`.la', then a libtool library is created, +only library objects (\`.lo' files) may be specified, and \`-rpath' is +required, except when creating a convenience library. + +If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created +using \`ar' and \`ranlib', or on Windows using \`lib'. + +If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file +is created, otherwise an executable program is created." + ;; + +uninstall) + $echo \ +"Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE... + +Remove libraries from an installation directory. + +RM is the name of the program to use to delete files associated with each FILE +(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed +to RM. + +If FILE is a libtool library, all the files associated with it are deleted. +Otherwise, only FILE itself is deleted using RM." + ;; + +*) + $echo "$modename: invalid operation mode \`$mode'" 1>&2 + $echo "$help" 1>&2 + exit $EXIT_FAILURE + ;; +esac + +$echo +$echo "Try \`$modename --help' for more information about other modes." + +exit $? + +# The TAGs below are defined such that we never get into a situation +# in which we disable both kinds of libraries. Given conflicting +# choices, we go for a static library, that is the most portable, +# since we can't tell whether shared libraries were disabled because +# the user asked for that or because the platform doesn't support +# them. This is particularly important on AIX, because we don't +# support having both static and shared libraries enabled at the same +# time on that platform, so we default to a shared-only configuration. +# If a disable-shared tag is given, we'll fallback to a static-only +# configuration. But we'll never go from static-only to shared-only. + +# ### BEGIN LIBTOOL TAG CONFIG: disable-shared +disable_libs=shared +# ### END LIBTOOL TAG CONFIG: disable-shared + +# ### BEGIN LIBTOOL TAG CONFIG: disable-static +disable_libs=static +# ### END LIBTOOL TAG CONFIG: disable-static + +# Local Variables: +# mode:shell-script +# sh-indentation:2 +# End: diff --git a/driver/xf86-video-geode/missing b/driver/xf86-video-geode/missing new file mode 100755 index 000000000..1c8ff7049 --- /dev/null +++ b/driver/xf86-video-geode/missing @@ -0,0 +1,367 @@ +#! /bin/sh +# Common stub for a few missing GNU programs while installing. + +scriptversion=2006-05-10.23 + +# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006 +# Free Software Foundation, Inc. +# Originally by Fran,cois Pinard , 1996. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +# 02110-1301, USA. + +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +if test $# -eq 0; then + echo 1>&2 "Try \`$0 --help' for more information" + exit 1 +fi + +run=: +sed_output='s/.* --output[ =]\([^ ]*\).*/\1/p' +sed_minuso='s/.* -o \([^ ]*\).*/\1/p' + +# In the cases where this matters, `missing' is being run in the +# srcdir already. +if test -f configure.ac; then + configure_ac=configure.ac +else + configure_ac=configure.in +fi + +msg="missing on your system" + +case $1 in +--run) + # Try to run requested program, and just exit if it succeeds. + run= + shift + "$@" && exit 0 + # Exit code 63 means version mismatch. This often happens + # when the user try to use an ancient version of a tool on + # a file that requires a minimum version. In this case we + # we should proceed has if the program had been absent, or + # if --run hadn't been passed. + if test $? = 63; then + run=: + msg="probably too old" + fi + ;; + + -h|--h|--he|--hel|--help) + echo "\ +$0 [OPTION]... PROGRAM [ARGUMENT]... + +Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an +error status if there is no known handling for PROGRAM. + +Options: + -h, --help display this help and exit + -v, --version output version information and exit + --run try to run the given command, and emulate it if it fails + +Supported PROGRAM values: + aclocal touch file \`aclocal.m4' + autoconf touch file \`configure' + autoheader touch file \`config.h.in' + autom4te touch the output file, or create a stub one + automake touch all \`Makefile.in' files + bison create \`y.tab.[ch]', if possible, from existing .[ch] + flex create \`lex.yy.c', if possible, from existing .c + help2man touch the output file + lex create \`lex.yy.c', if possible, from existing .c + makeinfo touch the output file + tar try tar, gnutar, gtar, then tar without non-portable flags + yacc create \`y.tab.[ch]', if possible, from existing .[ch] + +Send bug reports to ." + exit $? + ;; + + -v|--v|--ve|--ver|--vers|--versi|--versio|--version) + echo "missing $scriptversion (GNU Automake)" + exit $? + ;; + + -*) + echo 1>&2 "$0: Unknown \`$1' option" + echo 1>&2 "Try \`$0 --help' for more information" + exit 1 + ;; + +esac + +# Now exit if we have it, but it failed. Also exit now if we +# don't have it and --version was passed (most likely to detect +# the program). +case $1 in + lex|yacc) + # Not GNU programs, they don't have --version. + ;; + + tar) + if test -n "$run"; then + echo 1>&2 "ERROR: \`tar' requires --run" + exit 1 + elif test "x$2" = "x--version" || test "x$2" = "x--help"; then + exit 1 + fi + ;; + + *) + if test -z "$run" && ($1 --version) > /dev/null 2>&1; then + # We have it, but it failed. + exit 1 + elif test "x$2" = "x--version" || test "x$2" = "x--help"; then + # Could not run --version or --help. This is probably someone + # running `$TOOL --version' or `$TOOL --help' to check whether + # $TOOL exists and not knowing $TOOL uses missing. + exit 1 + fi + ;; +esac + +# If it does not exist, or fails to run (possibly an outdated version), +# try to emulate it. +case $1 in + aclocal*) + echo 1>&2 "\ +WARNING: \`$1' is $msg. You should only need it if + you modified \`acinclude.m4' or \`${configure_ac}'. You might want + to install the \`Automake' and \`Perl' packages. Grab them from + any GNU archive site." + touch aclocal.m4 + ;; + + autoconf) + echo 1>&2 "\ +WARNING: \`$1' is $msg. You should only need it if + you modified \`${configure_ac}'. You might want to install the + \`Autoconf' and \`GNU m4' packages. Grab them from any GNU + archive site." + touch configure + ;; + + autoheader) + echo 1>&2 "\ +WARNING: \`$1' is $msg. You should only need it if + you modified \`acconfig.h' or \`${configure_ac}'. You might want + to install the \`Autoconf' and \`GNU m4' packages. Grab them + from any GNU archive site." + files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}` + test -z "$files" && files="config.h" + touch_files= + for f in $files; do + case $f in + *:*) touch_files="$touch_files "`echo "$f" | + sed -e 's/^[^:]*://' -e 's/:.*//'`;; + *) touch_files="$touch_files $f.in";; + esac + done + touch $touch_files + ;; + + automake*) + echo 1>&2 "\ +WARNING: \`$1' is $msg. You should only need it if + you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'. + You might want to install the \`Automake' and \`Perl' packages. + Grab them from any GNU archive site." + find . -type f -name Makefile.am -print | + sed 's/\.am$/.in/' | + while read f; do touch "$f"; done + ;; + + autom4te) + echo 1>&2 "\ +WARNING: \`$1' is needed, but is $msg. + You might have modified some files without having the + proper tools for further handling them. + You can get \`$1' as part of \`Autoconf' from any GNU + archive site." + + file=`echo "$*" | sed -n "$sed_output"` + test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` + if test -f "$file"; then + touch $file + else + test -z "$file" || exec >$file + echo "#! /bin/sh" + echo "# Created by GNU Automake missing as a replacement of" + echo "# $ $@" + echo "exit 0" + chmod +x $file + exit 1 + fi + ;; + + bison|yacc) + echo 1>&2 "\ +WARNING: \`$1' $msg. You should only need it if + you modified a \`.y' file. You may need the \`Bison' package + in order for those modifications to take effect. You can get + \`Bison' from any GNU archive site." + rm -f y.tab.c y.tab.h + if test $# -ne 1; then + eval LASTARG="\${$#}" + case $LASTARG in + *.y) + SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` + if test -f "$SRCFILE"; then + cp "$SRCFILE" y.tab.c + fi + SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` + if test -f "$SRCFILE"; then + cp "$SRCFILE" y.tab.h + fi + ;; + esac + fi + if test ! -f y.tab.h; then + echo >y.tab.h + fi + if test ! -f y.tab.c; then + echo 'main() { return 0; }' >y.tab.c + fi + ;; + + lex|flex) + echo 1>&2 "\ +WARNING: \`$1' is $msg. You should only need it if + you modified a \`.l' file. You may need the \`Flex' package + in order for those modifications to take effect. You can get + \`Flex' from any GNU archive site." + rm -f lex.yy.c + if test $# -ne 1; then + eval LASTARG="\${$#}" + case $LASTARG in + *.l) + SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` + if test -f "$SRCFILE"; then + cp "$SRCFILE" lex.yy.c + fi + ;; + esac + fi + if test ! -f lex.yy.c; then + echo 'main() { return 0; }' >lex.yy.c + fi + ;; + + help2man) + echo 1>&2 "\ +WARNING: \`$1' is $msg. You should only need it if + you modified a dependency of a manual page. You may need the + \`Help2man' package in order for those modifications to take + effect. You can get \`Help2man' from any GNU archive site." + + file=`echo "$*" | sed -n "$sed_output"` + test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` + if test -f "$file"; then + touch $file + else + test -z "$file" || exec >$file + echo ".ab help2man is required to generate this page" + exit 1 + fi + ;; + + makeinfo) + echo 1>&2 "\ +WARNING: \`$1' is $msg. You should only need it if + you modified a \`.texi' or \`.texinfo' file, or any other file + indirectly affecting the aspect of the manual. The spurious + call might also be the consequence of using a buggy \`make' (AIX, + DU, IRIX). You might want to install the \`Texinfo' package or + the \`GNU make' package. Grab either from any GNU archive site." + # The file to touch is that specified with -o ... + file=`echo "$*" | sed -n "$sed_output"` + test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` + if test -z "$file"; then + # ... or it is the one specified with @setfilename ... + infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` + file=`sed -n ' + /^@setfilename/{ + s/.* \([^ ]*\) *$/\1/ + p + q + }' $infile` + # ... or it is derived from the source name (dir/f.texi becomes f.info) + test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info + fi + # If the file does not exist, the user really needs makeinfo; + # let's fail without touching anything. + test -f $file || exit 1 + touch $file + ;; + + tar) + shift + + # We have already tried tar in the generic part. + # Look for gnutar/gtar before invocation to avoid ugly error + # messages. + if (gnutar --version > /dev/null 2>&1); then + gnutar "$@" && exit 0 + fi + if (gtar --version > /dev/null 2>&1); then + gtar "$@" && exit 0 + fi + firstarg="$1" + if shift; then + case $firstarg in + *o*) + firstarg=`echo "$firstarg" | sed s/o//` + tar "$firstarg" "$@" && exit 0 + ;; + esac + case $firstarg in + *h*) + firstarg=`echo "$firstarg" | sed s/h//` + tar "$firstarg" "$@" && exit 0 + ;; + esac + fi + + echo 1>&2 "\ +WARNING: I can't seem to be able to run \`tar' with the given arguments. + You may want to install GNU tar or Free paxutils, or check the + command line arguments." + exit 1 + ;; + + *) + echo 1>&2 "\ +WARNING: \`$1' is needed, and is $msg. + You might have modified some files without having the + proper tools for further handling them. Check the \`README' file, + it often tells you about the needed prerequisites for installing + this package. You may also peek at any GNU archive site, in case + some other package would contain this missing \`$1' program." + exit 1 + ;; +esac + +exit 0 + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "scriptversion=" +# time-stamp-format: "%:y-%02m-%02d.%02H" +# time-stamp-end: "$" +# End: diff --git a/driver/xf86-video-geode/src/Makefile.am b/driver/xf86-video-geode/src/Makefile.am new file mode 100644 index 000000000..15c9f6609 --- /dev/null +++ b/driver/xf86-video-geode/src/Makefile.am @@ -0,0 +1,150 @@ +# Copyright 2005 Adam Jackson. +# +# Permission is hereby granted, free of charge, to any person obtaining a +# copy of this software and associated documentation files (the "Software"), +# to deal in the Software without restriction, including without limitation +# on the rights to use, copy, modify, merge, publish, distribute, sub +# license, and/or sell copies of the Software, and to permit persons to whom +# the Software is furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice (including the next +# paragraph) shall be included in all copies or substantial portions of the +# Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL +# ADAM JACKSON BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +# IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +# this is obnoxious: +# -module lets us name the module exactly how we want +# -avoid-version prevents gratuitous .0.0.0 version numbers on the end +# _ladir passes a dummy rpath to libtool so the thing will actually link +# TODO: -nostdlib/-Bstatic/-lgcc platform magic, not installing the .a, etc. +DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) \ + -I$(top_srcdir)/src/cim -I$(top_srcdir)/src/gfx \ + -I$(top_srcdir)/src/panel -I$(top_srcdir)/linux_v26 + +# -DPNL_SUP is now provided by AMD_CFLAGS +# +AM_CFLAGS = @XORG_CFLAGS@ \ + -DHAVE_GX -DHAVE_LX -DAMD_V4L2_VIDEO -DOPT_ACCEL \ + -DLINUX_2_6 @AMD_CFLAGS@ + +AM_CCASFLAGS = @XORG_CFLAGS@ +geode_drv_la_LTLIBRARIES = geode_drv.la +geode_drv_la_LDFLAGS = -module -avoid-version +geode_drv_ladir = @moduledir@/drivers + +geode_drv_la_SOURCES = \ + geode.h \ + geode_blend.h \ + geode_fourcc.h \ + cim_dev.h \ + geode_driver.c \ + geode_common.c \ + geode_dcon.c \ + geode_ddc.c \ + geode_msr.c \ + gx_driver.c\ + gx_accel.c \ + gx_cursor.c \ + gx_video.c \ + gx_regacc.c \ + gx_rotate.c \ + gx_randr.c \ + durango.c \ + panel.c \ + lx_driver.c \ + lx_cursor.c \ + lx_video.c \ + lx_regacc.c \ + lx_rotate.c \ + lx_randr.c \ + lx_exa.c \ + cimarron.c \ + geode_pcirename.h + +EXTRA_DIST = \ + cim/cim_defs.h \ + cim/cim_df.c \ + cim/cim_filter.c \ + cim/cim_gp.c \ + cim/cim_init.c \ + cim/cim_modes.c \ + cim/cim_msr.c \ + cim/cim_parm.h \ + cim/cim_regs.h \ + cim/cim_rtns.h \ + cim/cim_version.h \ + cim/cim_vg.c \ + cim/cim_vip.c \ + cim/cim_vop.c \ + cim/doc/release.txt \ + \ + gfx/disp_gu1.c \ + gfx/disp_gu2.c \ + gfx/gfx_dcdr.c \ + gfx/gfx_defs.h \ + gfx/gfx_disp.c \ + gfx/gfx_i2c.c \ + gfx/gfx_init.c \ + gfx/gfx_mode.h \ + gfx/gfx_msr.c \ + gfx/gfx_priv.h \ + gfx/gfx_regs.h \ + gfx/gfx_rndr.c \ + gfx/gfx_rtns.h \ + gfx/gfx_tv.c \ + gfx/gfx_type.h \ + gfx/gfx_vga.c \ + gfx/gfx_vid.c \ + gfx/gfx_vip.c \ + gfx/history.h \ + gfx/i2c_acc.c \ + gfx/i2c_gpio.c \ + gfx/init_gu1.c \ + gfx/init_gu2.c \ + gfx/msr_rdcl.c \ + gfx/release.txt \ + gfx/rndr_gu1.c \ + gfx/rndr_gu2.c \ + gfx/saa7114.c \ + gfx/tv_1200.c \ + gfx/tv_fs450.c \ + gfx/tv_fs450.h \ + gfx/vga_gu1.c \ + gfx/vid_1200.c \ + gfx/vid_5530.c \ + gfx/vid_rdcl.c \ + gfx/vip_1200.c \ + \ + panel/92xx.h \ + panel/cen9211.c \ + panel/cen9211.h \ + panel/dora9211.c \ + panel/dora9211.h \ + panel/drac9210.c \ + panel/drac9210.h \ + panel/gx2_9211.c \ + panel/gx2_9211.h \ + panel/panel.c \ + panel/panel.h \ + panel/platform.c \ + panel/pnl_bios.c \ + panel/pnl_defs.h \ + panel/pnl_init.c \ + panel/readme.txt \ + \ + gx_vga.c \ + lx_vga.c + +ztv_drv_la_LTLIBRARIES = ztv_drv.la +ztv_drv_la_LDFLAGS = -module -avoid-version +ztv_drv_ladir = @moduledir@/drivers + +ztv_drv_la_SOURCES = \ + z4l.c + diff --git a/driver/xf86-video-geode/src/Makefile.in b/driver/xf86-video-geode/src/Makefile.in new file mode 100644 index 000000000..900761cf4 --- /dev/null +++ b/driver/xf86-video-geode/src/Makefile.in @@ -0,0 +1,703 @@ +# Makefile.in generated by automake 1.10 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +# Copyright 2005 Adam Jackson. +# +# Permission is hereby granted, free of charge, to any person obtaining a +# copy of this software and associated documentation files (the "Software"), +# to deal in the Software without restriction, including without limitation +# on the rights to use, copy, modify, merge, publish, distribute, sub +# license, and/or sell copies of the Software, and to permit persons to whom +# the Software is furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice (including the next +# paragraph) shall be included in all copies or substantial portions of the +# Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL +# ADAM JACKSON BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +# IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +subdir = src +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; +am__installdirs = "$(DESTDIR)$(geode_drv_ladir)" \ + "$(DESTDIR)$(ztv_drv_ladir)" +geode_drv_laLTLIBRARIES_INSTALL = $(INSTALL) +ztv_drv_laLTLIBRARIES_INSTALL = $(INSTALL) +LTLIBRARIES = $(geode_drv_la_LTLIBRARIES) $(ztv_drv_la_LTLIBRARIES) +geode_drv_la_LIBADD = +am_geode_drv_la_OBJECTS = geode_driver.lo geode_common.lo \ + geode_dcon.lo geode_ddc.lo geode_msr.lo gx_driver.lo \ + gx_accel.lo gx_cursor.lo gx_video.lo gx_regacc.lo gx_rotate.lo \ + gx_randr.lo durango.lo panel.lo lx_driver.lo lx_cursor.lo \ + lx_video.lo lx_regacc.lo lx_rotate.lo lx_randr.lo lx_exa.lo \ + cimarron.lo +geode_drv_la_OBJECTS = $(am_geode_drv_la_OBJECTS) +geode_drv_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(geode_drv_la_LDFLAGS) $(LDFLAGS) -o $@ +ztv_drv_la_LIBADD = +am_ztv_drv_la_OBJECTS = z4l.lo +ztv_drv_la_OBJECTS = $(am_ztv_drv_la_OBJECTS) +ztv_drv_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(ztv_drv_la_LDFLAGS) $(LDFLAGS) -o $@ +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +CCLD = $(CC) +LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ + $(LDFLAGS) -o $@ +SOURCES = $(geode_drv_la_SOURCES) $(ztv_drv_la_SOURCES) +DIST_SOURCES = $(geode_drv_la_SOURCES) $(ztv_drv_la_SOURCES) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +ADMIN_MAN_DIR = @ADMIN_MAN_DIR@ +ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@ +AMD_CFLAGS = @AMD_CFLAGS@ +AMTAR = @AMTAR@ +APP_MAN_DIR = @APP_MAN_DIR@ +APP_MAN_SUFFIX = @APP_MAN_SUFFIX@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCAS = @CCAS@ +CCASDEPMODE = @CCASDEPMODE@ +CCASFLAGS = @CCASFLAGS@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DRIVER_MAN_DIR = @DRIVER_MAN_DIR@ +DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@ +DRIVER_NAME = @DRIVER_NAME@ +ECHO = @ECHO@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +F77 = @F77@ +FFLAGS = @FFLAGS@ +FILE_MAN_DIR = @FILE_MAN_DIR@ +FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ +GREP = @GREP@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LDFLAGS = @LDFLAGS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIB_MAN_DIR = @LIB_MAN_DIR@ +LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +MISC_MAN_DIR = @MISC_MAN_DIR@ +MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@ +MKDIR_P = @MKDIR_P@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PCIACCESS_CFLAGS = @PCIACCESS_CFLAGS@ +PCIACCESS_LIBS = @PCIACCESS_LIBS@ +PKG_CONFIG = @PKG_CONFIG@ +RANLIB = @RANLIB@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +VERSION = @VERSION@ +XORG_CFLAGS = @XORG_CFLAGS@ +XORG_LIBS = @XORG_LIBS@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_F77 = @ac_ct_F77@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +moduledir = @moduledir@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ + +# this is obnoxious: +# -module lets us name the module exactly how we want +# -avoid-version prevents gratuitous .0.0.0 version numbers on the end +# _ladir passes a dummy rpath to libtool so the thing will actually link +# TODO: -nostdlib/-Bstatic/-lgcc platform magic, not installing the .a, etc. +DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) \ + -I$(top_srcdir)/src/cim -I$(top_srcdir)/src/gfx \ + -I$(top_srcdir)/src/panel -I$(top_srcdir)/linux_v26 + + +# -DPNL_SUP is now provided by AMD_CFLAGS +# +AM_CFLAGS = @XORG_CFLAGS@ \ + -DHAVE_GX -DHAVE_LX -DAMD_V4L2_VIDEO -DOPT_ACCEL \ + -DLINUX_2_6 @AMD_CFLAGS@ + +AM_CCASFLAGS = @XORG_CFLAGS@ +geode_drv_la_LTLIBRARIES = geode_drv.la +geode_drv_la_LDFLAGS = -module -avoid-version +geode_drv_ladir = @moduledir@/drivers +geode_drv_la_SOURCES = \ + geode.h \ + geode_blend.h \ + geode_fourcc.h \ + cim_dev.h \ + geode_driver.c \ + geode_common.c \ + geode_dcon.c \ + geode_ddc.c \ + geode_msr.c \ + gx_driver.c\ + gx_accel.c \ + gx_cursor.c \ + gx_video.c \ + gx_regacc.c \ + gx_rotate.c \ + gx_randr.c \ + durango.c \ + panel.c \ + lx_driver.c \ + lx_cursor.c \ + lx_video.c \ + lx_regacc.c \ + lx_rotate.c \ + lx_randr.c \ + lx_exa.c \ + cimarron.c \ + geode_pcirename.h + +EXTRA_DIST = \ + cim/cim_defs.h \ + cim/cim_df.c \ + cim/cim_filter.c \ + cim/cim_gp.c \ + cim/cim_init.c \ + cim/cim_modes.c \ + cim/cim_msr.c \ + cim/cim_parm.h \ + cim/cim_regs.h \ + cim/cim_rtns.h \ + cim/cim_version.h \ + cim/cim_vg.c \ + cim/cim_vip.c \ + cim/cim_vop.c \ + cim/doc/release.txt \ + \ + gfx/disp_gu1.c \ + gfx/disp_gu2.c \ + gfx/gfx_dcdr.c \ + gfx/gfx_defs.h \ + gfx/gfx_disp.c \ + gfx/gfx_i2c.c \ + gfx/gfx_init.c \ + gfx/gfx_mode.h \ + gfx/gfx_msr.c \ + gfx/gfx_priv.h \ + gfx/gfx_regs.h \ + gfx/gfx_rndr.c \ + gfx/gfx_rtns.h \ + gfx/gfx_tv.c \ + gfx/gfx_type.h \ + gfx/gfx_vga.c \ + gfx/gfx_vid.c \ + gfx/gfx_vip.c \ + gfx/history.h \ + gfx/i2c_acc.c \ + gfx/i2c_gpio.c \ + gfx/init_gu1.c \ + gfx/init_gu2.c \ + gfx/msr_rdcl.c \ + gfx/release.txt \ + gfx/rndr_gu1.c \ + gfx/rndr_gu2.c \ + gfx/saa7114.c \ + gfx/tv_1200.c \ + gfx/tv_fs450.c \ + gfx/tv_fs450.h \ + gfx/vga_gu1.c \ + gfx/vid_1200.c \ + gfx/vid_5530.c \ + gfx/vid_rdcl.c \ + gfx/vip_1200.c \ + \ + panel/92xx.h \ + panel/cen9211.c \ + panel/cen9211.h \ + panel/dora9211.c \ + panel/dora9211.h \ + panel/drac9210.c \ + panel/drac9210.h \ + panel/gx2_9211.c \ + panel/gx2_9211.h \ + panel/panel.c \ + panel/panel.h \ + panel/platform.c \ + panel/pnl_bios.c \ + panel/pnl_defs.h \ + panel/pnl_init.c \ + panel/readme.txt \ + \ + gx_vga.c \ + lx_vga.c + +ztv_drv_la_LTLIBRARIES = ztv_drv.la +ztv_drv_la_LDFLAGS = -module -avoid-version +ztv_drv_ladir = @moduledir@/drivers +ztv_drv_la_SOURCES = \ + z4l.c + +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu src/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +install-geode_drv_laLTLIBRARIES: $(geode_drv_la_LTLIBRARIES) + @$(NORMAL_INSTALL) + test -z "$(geode_drv_ladir)" || $(MKDIR_P) "$(DESTDIR)$(geode_drv_ladir)" + @list='$(geode_drv_la_LTLIBRARIES)'; for p in $$list; do \ + if test -f $$p; then \ + f=$(am__strip_dir) \ + echo " $(LIBTOOL) --mode=install $(geode_drv_laLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(geode_drv_ladir)/$$f'"; \ + $(LIBTOOL) --mode=install $(geode_drv_laLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(geode_drv_ladir)/$$f"; \ + else :; fi; \ + done + +uninstall-geode_drv_laLTLIBRARIES: + @$(NORMAL_UNINSTALL) + @list='$(geode_drv_la_LTLIBRARIES)'; for p in $$list; do \ + p=$(am__strip_dir) \ + echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(geode_drv_ladir)/$$p'"; \ + $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(geode_drv_ladir)/$$p"; \ + done + +clean-geode_drv_laLTLIBRARIES: + -test -z "$(geode_drv_la_LTLIBRARIES)" || rm -f $(geode_drv_la_LTLIBRARIES) + @list='$(geode_drv_la_LTLIBRARIES)'; for p in $$list; do \ + dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ + test "$$dir" != "$$p" || dir=.; \ + echo "rm -f \"$${dir}/so_locations\""; \ + rm -f "$${dir}/so_locations"; \ + done +install-ztv_drv_laLTLIBRARIES: $(ztv_drv_la_LTLIBRARIES) + @$(NORMAL_INSTALL) + test -z "$(ztv_drv_ladir)" || $(MKDIR_P) "$(DESTDIR)$(ztv_drv_ladir)" + @list='$(ztv_drv_la_LTLIBRARIES)'; for p in $$list; do \ + if test -f $$p; then \ + f=$(am__strip_dir) \ + echo " $(LIBTOOL) --mode=install $(ztv_drv_laLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(ztv_drv_ladir)/$$f'"; \ + $(LIBTOOL) --mode=install $(ztv_drv_laLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(ztv_drv_ladir)/$$f"; \ + else :; fi; \ + done + +uninstall-ztv_drv_laLTLIBRARIES: + @$(NORMAL_UNINSTALL) + @list='$(ztv_drv_la_LTLIBRARIES)'; for p in $$list; do \ + p=$(am__strip_dir) \ + echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(ztv_drv_ladir)/$$p'"; \ + $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(ztv_drv_ladir)/$$p"; \ + done + +clean-ztv_drv_laLTLIBRARIES: + -test -z "$(ztv_drv_la_LTLIBRARIES)" || rm -f $(ztv_drv_la_LTLIBRARIES) + @list='$(ztv_drv_la_LTLIBRARIES)'; for p in $$list; do \ + dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ + test "$$dir" != "$$p" || dir=.; \ + echo "rm -f \"$${dir}/so_locations\""; \ + rm -f "$${dir}/so_locations"; \ + done +geode_drv.la: $(geode_drv_la_OBJECTS) $(geode_drv_la_DEPENDENCIES) + $(geode_drv_la_LINK) -rpath $(geode_drv_ladir) $(geode_drv_la_OBJECTS) $(geode_drv_la_LIBADD) $(LIBS) +ztv_drv.la: $(ztv_drv_la_OBJECTS) $(ztv_drv_la_DEPENDENCIES) + $(ztv_drv_la_LINK) -rpath $(ztv_drv_ladir) $(ztv_drv_la_OBJECTS) $(ztv_drv_la_LIBADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cimarron.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/durango.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/geode_common.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/geode_dcon.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/geode_ddc.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/geode_driver.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/geode_msr.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gx_accel.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gx_cursor.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gx_driver.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gx_randr.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gx_regacc.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gx_rotate.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gx_video.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lx_cursor.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lx_driver.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lx_exa.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lx_randr.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lx_regacc.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lx_rotate.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lx_video.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/panel.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/z4l.Plo@am__quote@ + +.c.o: +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c $< + +.c.obj: +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(LTLIBRARIES) +installdirs: + for dir in "$(DESTDIR)$(geode_drv_ladir)" "$(DESTDIR)$(ztv_drv_ladir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-geode_drv_laLTLIBRARIES clean-libtool \ + clean-ztv_drv_laLTLIBRARIES mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +info: info-am + +info-am: + +install-data-am: install-geode_drv_laLTLIBRARIES \ + install-ztv_drv_laLTLIBRARIES + +install-dvi: install-dvi-am + +install-exec-am: + +install-html: install-html-am + +install-info: install-info-am + +install-man: + +install-pdf: install-pdf-am + +install-ps: install-ps-am + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-geode_drv_laLTLIBRARIES \ + uninstall-ztv_drv_laLTLIBRARIES + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-geode_drv_laLTLIBRARIES clean-libtool \ + clean-ztv_drv_laLTLIBRARIES ctags distclean distclean-compile \ + distclean-generic distclean-libtool distclean-tags distdir dvi \ + dvi-am html html-am info info-am install install-am \ + install-data install-data-am install-dvi install-dvi-am \ + install-exec install-exec-am install-geode_drv_laLTLIBRARIES \ + install-html install-html-am install-info install-info-am \ + install-man install-pdf install-pdf-am install-ps \ + install-ps-am install-strip install-ztv_drv_laLTLIBRARIES \ + installcheck installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + tags uninstall uninstall-am uninstall-geode_drv_laLTLIBRARIES \ + uninstall-ztv_drv_laLTLIBRARIES + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/driver/xf86-video-geode/src/cim/cim_defs.h b/driver/xf86-video-geode/src/cim/cim_defs.h new file mode 100644 index 000000000..eea2f4943 --- /dev/null +++ b/driver/xf86-video-geode/src/cim/cim_defs.h @@ -0,0 +1,761 @@ +/* + * Copyright (c) 2006 Advanced Micro Devices, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + * Neither the name of the Advanced Micro Devices, Inc. nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + */ + +/* + * Cimarron hardware access macros. + */ + +#ifndef _cim_defs_h +#define _cim_defs_h + +/*-----------------------------------------*/ +/* MEMORY ACCESS MACROS */ +/*-----------------------------------------*/ + +#ifndef CIMARRON_EXCLUDE_REGISTER_ACCESS_MACROS + +#define READ_GP32(offset) \ + (*(volatile unsigned long *)(cim_gp_ptr + (offset))) + +#define READ_REG32(offset) \ + (*(volatile unsigned long *)(cim_vg_ptr + (offset))) + +#define READ_FB32(offset) \ + (*(volatile unsigned long *)(cim_fb_ptr + (offset))) + +#define WRITE_GP32(offset, value) \ + (*(volatile unsigned long *)(cim_gp_ptr + (offset))) = (value) + +#define WRITE_REG32(offset, value) \ + (*(volatile unsigned long *)(cim_vg_ptr + (offset))) = (value) + +#define WRITE_COMMAND32(offset, value) \ + (*(unsigned long *)(cim_cmd_ptr + (offset))) = (value) + +#define WRITE_COMMAND8(offset, value) \ + (*(unsigned char *)(cim_cmd_ptr + (offset))) = (value) + +#define WRITE_FB32(offset, value) \ + (*(unsigned long *)(cim_fb_ptr + (offset))) = (value) + +#define READ_VID32(offset) \ + (*(volatile unsigned long *)(cim_vid_ptr + (offset))) + +#define WRITE_VID32(offset, value) \ + (*(volatile unsigned long *)(cim_vid_ptr + (offset))) = (value) + +#define READ_VIP32(offset) \ + (*(volatile unsigned long *)(cim_vip_ptr + (offset))) + +#define WRITE_VIP32(offset, value) \ + (*(volatile unsigned long *)(cim_vip_ptr + (offset))) = (value) + +#define READ_VOP32(offset) \ + (*(volatile unsigned long *)(cim_vid_ptr + (offset))) + +#define WRITE_VOP32(offset, value) \ + (*(volatile unsigned long *)(cim_vid_ptr + (offset))) = (value) + +#endif + +/*-----------------------------------------*/ +/* GP POLLING MACROS */ +/*-----------------------------------------*/ + +#define GP3_WAIT_WRAP(variable) \ + while(((variable = READ_GP32 (GP3_CMD_READ)) > gp3_cmd_current) || \ + (variable <= (gp3_cmd_top + GP3_BLT_COMMAND_SIZE + GP3_BLT_COMMAND_SIZE + 96))) + +#define GP3_WAIT_PRIMITIVE(variable) \ + while (((variable = READ_GP32 (GP3_CMD_READ)) > gp3_cmd_current) && \ + (variable <= (gp3_cmd_next + 96))) + +#define GP3_WAIT_BUSY \ + while(READ_GP32 (GP3_BLT_STATUS) & GP3_BS_BLT_BUSY) + +#define GP3_WAIT_PENDING \ + while(READ_GP32 (GP3_BLT_STATUS) & GP3_BS_BLT_PENDING) + +/*-----------------------------------------------------------------*/ +/* MSR MACROS */ +/* These macros facilitate interaction with the model specific */ +/* registers in GeodeLX. There are two included methods, direct */ +/* access using the rdmsr and wrmsr opcodes and an indirect method */ +/* using VSAII. */ +/*-----------------------------------------------------------------*/ + +#ifdef CIMARRON_INCLUDE_MSR_MACROS + +#if CIMARRON_MSR_DIRECT_ASM + +/*----------------------------------------------------------------- + * MSR_READ + * Read the contents of a 64 bit MSR into a data structure + *-----------------------------------------------------------------*/ + +#define MSR_READ(msr_reg, device_add, data64_ptr) \ +{ \ + unsigned long msr_add = (unsigned long)(msr_reg) | \ + (unsigned long)(device_add); \ + unsigned long data_high, data_low; \ + _asm { mov ecx, msr_add } \ + _asm { rdmsr } \ + _asm { mov data_high, edx } \ + _asm { mov data_low, eax } \ + \ + ((Q_WORD *)(data64_ptr))->high = data_high; \ + ((Q_WORD *)(data64_ptr))->low = data_low; \ +} + +/*----------------------------------------------------------------- + * MSR_WRITE + * Write the contents of a 64 bit data structure to a MSR. + *-----------------------------------------------------------------*/ + +#define MSR_WRITE(msr_reg, device_add, data64_ptr) \ +{ \ + unsigned long msr_add = (unsigned long)(msr_reg) | \ + (unsigned long)(device_add); \ + unsigned long data_high, data_low; \ + \ + data_high = ((Q_WORD *)(data64_ptr))->high; \ + data_low = ((Q_WORD *)(data64_ptr))->low; \ + \ + _asm { mov ecx, msr_add } \ + _asm { mov edx, data_high } \ + _asm { mov eax, data_low } \ + _asm { wrmsr } \ +} + +#elif CIMARRON_MSR_VSA_IO + +/*----------------------------------------------------------------- + * MSR_READ + * Read the contents of a 64 bit MSR into a data structure + *-----------------------------------------------------------------*/ + +#define MSR_READ(msr_reg, device_add, data64_ptr) \ +{ \ + unsigned long msr_add = (unsigned long)(msr_reg) | \ + (unsigned long)(device_add); \ + unsigned long data_high, data_low; \ + \ + _asm { mov dx, 0x0AC1C } \ + _asm { mov eax, 0x0FC530007 } \ + _asm { out dx, eax } \ + \ + _asm { add dl, 2 } \ + _asm { mov ecx, msr_add } \ + _asm { in ax, dx } \ + _asm { mov data_high, edx } \ + _asm { mov data_low, eax } \ + \ + ((Q_WORD *)(data64_ptr))->high = data_high; \ + ((Q_WORD *)(data64_ptr))->low = data_low; \ +} + +/*----------------------------------------------------------------- + * MSR_WRITE + * Write the contents of a 64 bit data structure to a MSR. + *-----------------------------------------------------------------*/ + +#define MSR_WRITE(msr_reg, device_add, data64_ptr) \ +{ \ + unsigned long msr_add = (unsigned long)(msr_reg) | \ + (unsigned long)(device_add); \ + unsigned long data_high, data_low; \ + \ + data_high = ((Q_WORD *)(data64_ptr))->high; \ + data_low = ((Q_WORD *)(data64_ptr))->low; \ + \ + _asm { mov dx, 0x0AC1C } \ + _asm { mov eax, 0x0FC530007 } \ + _asm { out dx, eax } \ + \ + _asm { add dl, 2 } \ + _asm { mov ecx, msr_add } \ + _asm { mov ebx, data_high } \ + _asm { mov eax, data_low } \ + \ + _asm { mov esi, 0 } \ + _asm { mov edi, 0 } \ + _asm { out dx, ax } \ +} + +#elif CIMARRON_MSR_ABSTRACTED_ASM + +/*----------------------------------------------------------------- + * MSR_READ + * Read the contents of a 64 bit MSR into a data structure + *-----------------------------------------------------------------*/ + +#define MSR_READ(msr,adr,val) \ + __asm__ __volatile__( \ + " mov $0x0AC1C, %%edx\n" \ + " mov $0xFC530007, %%eax\n" \ + " out %%eax,%%dx\n" \ + " add $2,%%dl\n" \ + " in %%dx, %%ax" \ + : "=a" ((val)->low), "=d" ((val)->high) \ + : "c" (msr | adr)) + +/*----------------------------------------------------------------- + * MSR_WRITE + * Write the contents of a 64 bit data structure to a MSR. + *-----------------------------------------------------------------*/ + +#define MSR_WRITE(msr,adr,val) \ + { int d0, d1, d2, d3; \ + __asm__ __volatile__( \ + " push %%ebx\n" \ + " mov $0x0AC1C, %%edx\n" \ + " mov $0xFC530007, %%eax\n" \ + " out %%eax,%%dx\n" \ + " add $2,%%dl\n" \ + " mov %4, %3\n" \ + " mov 0(%5), %%ebx\n" \ + " mov 4(%5), %0\n" \ + " xor %2, %2\n" \ + " xor %1, %1\n" \ + " out %%ax, %%dx\n" \ + " pop %%ebx\n" \ + : "=a" (d0), "=&D" (d1), "=&S" (d2), "=c" (d3) \ + : "1" (msr | adr), "2" (val)); \ + } + +#elif CIMARRON_MSR_KERNEL_ROUTINE + +#include "asm/msr.h" + +/*----------------------------------------------------------------- + * MSR_READ + * Read the contents of a 64 bit MSR into a data structure + *-----------------------------------------------------------------*/ + +#define MSR_READ(msr_reg, device_add, data64_ptr) \ +{ \ + unsigned long addr, val1, val2; \ + \ + addr = device_add | msr_reg; \ + rdmsr (addr, val1, val2); \ + \ + ((Q_WORD *)(data64_ptr))->high = val2; \ + ((Q_WORD *)(data64_ptr))->low = val1; \ +} + +/*----------------------------------------------------------------- + * MSR_WRITE + * Read the contents of a 64 bit data structure to a MSR. + *-----------------------------------------------------------------*/ + +#define MSR_WRITE(msr_reg, device_add, data64_ptr) \ +{ \ + unsigned long addr, val1, val2; \ + \ + val2 = ((Q_WORD *)(data64_ptr))->high; \ + val1 = ((Q_WORD *)(data64_ptr))->low; \ + \ + addr = (device_add & 0xFFFF0000) | (unsigned long)msr_reg; \ + wrmsr(addr, val1, val2); \ +} + +#elif CIMARRON_MSR_HOOKS + + +#define MSR_READ(msr_reg, device_add, data64_ptr) \ +{ \ + unsigned long addr, val1, val2; \ + \ + addr = device_add | msr_reg; \ + if (cim_rdmsr) { \ + cim_rdmsr (addr, &val1, &val2); \ + \ + ((Q_WORD *)(data64_ptr))->high = val2; \ + ((Q_WORD *)(data64_ptr))->low = val1; \ + } \ +} + +#define MSR_WRITE(msr_reg, device_add, data64_ptr) \ +{ \ + unsigned long addr, val1, val2; \ + \ + val2 = ((Q_WORD *)(data64_ptr))->high; \ + val1 = ((Q_WORD *)(data64_ptr))->low; \ + \ + addr = (device_add & 0xFFFF0000) | (unsigned long)msr_reg; \ + if (cim_wrmsr) \ + cim_wrmsr(addr, val1, val2); \ +} +#endif + +#endif /* #ifdef CIMARRON_INCLUDE_MSR_MACROS */ + +/*-----------------------------------------------------------------*/ +/* STRING MACROS */ +/* These macros are included to facilitate the optimization of */ +/* routines that write or copy large amounts of data. Two vesions */ +/* of these macros are included. One is intended for operating */ +/* systems that allow the use of inline assembly, while the other */ +/* is a pure C implementation for stricter operating systems. */ +/*-----------------------------------------------------------------*/ + +#ifdef CIMARRON_INCLUDE_STRING_MACROS + +#if CIMARRON_OPTIMIZE_ASSEMBLY + +/*----------------------------------------------------------------- + * WRITE_COMMAND_STRING32 + * Write a series of DWORDs to the current command buffer offset + *-----------------------------------------------------------------*/ + +#define WRITE_COMMAND_STRING32(offset, dataptr, dataoffset, dword_count) \ +{ \ + _asm { cld } \ + _asm { mov edi, cim_cmd_ptr } \ + _asm { add edi, offset } \ + _asm { mov esi, dataptr } \ + _asm { add esi, dataoffset } \ + _asm { mov ecx, dword_count } \ + _asm { rep movsd } \ +} + +/*----------------------------------------------------------------- + * WRITE_FB_STRING32 + * Write a series of DWORDS to video memory. + *-----------------------------------------------------------------*/ + +#define WRITE_FB_STRING32(offset, dataptr, dword_count) \ +{ \ + unsigned long temp = (unsigned long)(dataptr); \ + _asm { cld } \ + _asm { mov edi, cim_fb_ptr } \ + _asm { add edi, offset } \ + _asm { mov esi, temp } \ + _asm { mov ecx, dword_count } \ + _asm { rep movsd } \ +} + +/*----------------------------------------------------------------- + * WRITE_FB_CONSTANT + * Write a constant DWORD to multiple video memory addresses + *-----------------------------------------------------------------*/ + +#define WRITE_FB_CONSTANT(offset, value, dword_count) \ +{ \ + unsigned long outptr = (unsigned long)cim_fb_ptr + offset; \ + unsigned long dwords = dword_count; \ + _asm { cld } \ + _asm { mov edi, outptr } \ + _asm { mov eax, value } \ + _asm { mov ecx, dwords } \ + _asm { rep stosd } \ +} + +/*----------------------------------------------------------------- + * WRITE_HOST_SOURCE_STRING32 + * Write a series of DWORDs to the GP host source register + *-----------------------------------------------------------------*/ + +#define WRITE_HOST_SOURCE_STRING32(dataptr, dataoffset, dword_count) \ +{ \ + _asm { cld } \ + _asm { mov edi, cim_gp_ptr } \ + _asm { add edi, GP3_HST_SRC_RANGE } \ + _asm { mov esi, dataptr } \ + _asm { add esi, dataoffset } \ + _asm { mov ecx, dword_count } \ + _asm { rep movsd } \ +} + +#elif CIMARRON_OPTIMIZE_FORLOOP + +/*----------------------------------------------------------------- + * WRITE_COMMAND_STRING32 + * Write a series of DWORDs to the current command buffer offset + *-----------------------------------------------------------------*/ + +#define WRITE_COMMAND_STRING32(offset, dataptr, dataoffset, dword_count) \ +{ \ + unsigned long i; \ + unsigned long tempdata = (unsigned long)dataptr + (dataoffset); \ + unsigned long byte_off = 0; \ + for (i = 0; i < dword_count; i++, byte_off += 4) \ + WRITE_COMMAND32 ((offset) + byte_off, \ + *((unsigned long *)(tempdata + byte_off))); \ +} + +/*----------------------------------------------------------------- + * WRITE_FB_STRING32 + * Write a series of DWORDS to video memory. + *-----------------------------------------------------------------*/ + +#define WRITE_FB_STRING32(offset, dataptr, dword_count) \ +{ \ + unsigned long i; \ + unsigned long tempdata = (unsigned long)dataptr; \ + unsigned long byte_off = 0; \ + for (i = 0; i < dword_count; i++, byte_off += 4) \ + WRITE_FB32 ((offset) + byte_off, \ + *((unsigned long *)(tempdata + byte_off))); \ +} + +/*----------------------------------------------------------------- + * WRITE_FB_CONSTANT + * Write a constant DWORD to multiple video memory addresses + *-----------------------------------------------------------------*/ + +#define WRITE_FB_CONSTANT(offset, value, dword_count) \ +{ \ + unsigned long i; \ + unsigned long tempoffset = offset; \ + for (i = 0; i < dword_count; i++, tempoffset += 4) \ + WRITE_FB32 (tempoffset, value); \ +} + +/*----------------------------------------------------------------- + * WRITE_HOST_SOURCE_STRING32 + * Write a series of DWORDs to the GP host source register + *-----------------------------------------------------------------*/ + +#define WRITE_HOST_SOURCE_STRING32(dataptr, dataoffset, dword_count) \ +{ \ + unsigned long i; \ + unsigned long tempdata = (unsigned long)dataptr + (dataoffset); \ + unsigned long byte_off = 0; \ + for (i = 0; i < dword_count; i++, byte_off += 4) \ + WRITE_GP32 (byte_off + GP3_HST_SRC_RANGE, \ + *((unsigned long *)(tempdata + byte_off))); \ +} + +#elif CIMARRON_OPTIMIZE_ABSTRACTED_ASM + +#define move_dw(d,s,n) \ + __asm__ __volatile__( \ + " rep\n" \ + " movsl\n" \ + : "=&c" (d0), "=&S" (d1), "=&D" (d2) \ + : "0" (n), "1" ((const char *)s), "2" ((char *)d) \ + : "memory") + +/*----------------------------------------------------------------- + * WRITE_COMMAND_STRING32 + * Write a series of DWORDs to the current command buffer offset + *-----------------------------------------------------------------*/ + +#define WRITE_COMMAND_STRING32(offset, dataptr, dataoffset, dword_count) \ +{ \ + int d0, d1, d2; \ + move_dw (cim_cmd_ptr+ ((unsigned long)(offset)), \ + ((unsigned long)(dataptr)+(dataoffset)), \ + dword_count); \ +} + +/*----------------------------------------------------------------- + * WRITE_FB_STRING32 + * Write a series of DWORDS to video memory. + *-----------------------------------------------------------------*/ + +#define WRITE_FB_STRING32(offset, dataptr, dword_count) \ +{ \ + unsigned long i; \ + unsigned long tempdata = (unsigned long)dataptr; \ + unsigned long byte_off = 0; \ + for (i = 0; i < dword_count; i++, byte_off += 4) \ + WRITE_FB32 ((offset) + byte_off, \ + *((unsigned long *)(tempdata + byte_off))); \ +} + +/*----------------------------------------------------------------- + * WRITE_FB_CONSTANT + * Write a constant DWORD to multiple video memory addresses + *-----------------------------------------------------------------*/ + +#define WRITE_FB_CONSTANT(offset, value, dword_count) \ +{ \ + unsigned long i; \ + unsigned long tempoffset = offset; \ + for (i = 0; i < dword_count; i++, tempoffset += 4) \ + WRITE_FB32 (tempoffset, value); \ +} + +/*----------------------------------------------------------------- + * WRITE_HOST_SOURCE_STRING32 + * Write a series of DWORDs to the GP host source register + *-----------------------------------------------------------------*/ + +#define WRITE_HOST_SOURCE_STRING32(dataptr, dataoffset, dword_count) \ +{ \ + unsigned long i; \ + unsigned long tempdata = (unsigned long)dataptr + (dataoffset); \ + unsigned long byte_off = 0; \ + for (i = 0; i < dword_count; i++, byte_off += 4) \ + WRITE_GP32 (byte_off + GP3_HST_SRC_RANGE, \ + *((unsigned long *)(tempdata + byte_off))); \ +} + +#endif + +#endif /* #ifdef CIMARRON_INCLUDE_STRING_MACROS */ + +/*----------------------------------------------------------------- + * WRITE_COMMAND_STRING8 + * Write a series of bytes to the current command buffer offset + *-----------------------------------------------------------------*/ + +#define WRITE_COMMAND_STRING8(offset, dataptr, dataoffset, byte_count) \ +{ \ + unsigned long i; \ + unsigned long array = (unsigned long)dataptr + (dataoffset); \ + for (i = 0; i < byte_count; i++) \ + WRITE_COMMAND8 ((offset) + i, *((unsigned char *)(array + i))); \ +} + +/*----------------------------------------------------------------- + * WRITE_HOST_SOURCE_STRING8 + * Write a series of bytes to the host source register + *-----------------------------------------------------------------*/ + +#define WRITE_HOST_SOURCE_STRING8(dataptr, dataoffset, byte_count) \ +{ \ + unsigned long temp1 = (unsigned long)dataptr + (dataoffset); \ + unsigned long temp2 = 0; \ + unsigned long shift = 0; \ + unsigned long counter; \ + if (byte_count) \ + { \ + for (counter = 0; counter < byte_count; counter++) \ + { \ + temp2 |= ((unsigned long)(*((unsigned char *) \ + (temp1 + counter)))) << shift; \ + shift += 8; \ + } \ + WRITE_GP32 (GP3_HST_SRC, temp2); \ + } \ +} + +/*-----------------------------------------*/ +/* CUSTOM STRING MACROS */ +/*-----------------------------------------*/ + +#ifndef CIMARRON_EXCLUDE_CUSTOM_MACROS + +#define WRITE_CUSTOM_COMMAND_STRING32 WRITE_COMMAND_STRING32 +#define WRITE_CUSTOM_COMMAND_STRING8 WRITE_COMMAND_STRING8 + +#endif + +/*-----------------------------------------*/ +/* IO ACCESS MACROS */ +/*-----------------------------------------*/ + +#ifdef CIMARRON_INCLUDE_IO_MACROS + +#if CIMARRON_IO_DIRECT_ACCESS + +/*------------------------------------------- + * OUTD + * Writes one DWORD to a single I/O address. + *-------------------------------------------*/ + +#define OUTD(port, data) cim_outd(port, data) +void +cim_outd(unsigned short port, unsigned long data) +{ + _asm { + pushf mov eax, data mov dx, port out dx, eax popf} +} + +/*------------------------------------------- + * IND + * Reads one DWORD from a single I/O address. + *-------------------------------------------*/ + +#define IND(port) cim_ind(port) +unsigned long +cim_ind(unsigned short port) +{ + unsigned long data; + + _asm { + pushf mov dx, port in eax, dx mov data, eax popf} + return data; +} + +/*------------------------------------------- + * OUTW + * Writes one WORD to a single I/O address. + *-------------------------------------------*/ + +#define OUTW(port, data) cim_outw(port, data) +void +cim_outw(unsigned short port, unsigned short data) +{ + _asm { + pushf mov ax, data mov dx, port out dx, ax popf} +} + +/*------------------------------------------- + * INW + * Reads one WORD from a single I/O address. + *-------------------------------------------*/ + +#define INW(port) cim_inw(port) +unsigned short +cim_inw(unsigned short port) +{ + unsigned short data; + + _asm { + pushf mov dx, port in ax, dx mov data, ax popf} + return data; +} + +/*------------------------------------------- + * OUTB + * Writes one BYTE to a single I/O address. + *-------------------------------------------*/ + +#define OUTB(port, data) cim_outb(port, data) +void +cim_outb(unsigned short port, unsigned char data) +{ + _asm { + pushf mov al, data mov dx, port out dx, al popf} +} + +/*------------------------------------------- + * INB + * Reads one BYTE from a single I/O address. + *-------------------------------------------*/ + +#define INB(port) cim_inb(port) +unsigned char +cim_inb(unsigned short port) +{ + unsigned char data; + + _asm { + pushf mov dx, port in al, dx mov data, al popf} + return data; +} + +#elif CIMARRON_IO_ABSTRACTED_ASM + +/*------------------------------------------- + * OUTD + * Writes one DWORD to a single I/O address. + *-------------------------------------------*/ + +#define OUTD(port, data) cim_outd(port, data) +void cim_outd(unsigned short port, unsigned long data); +void +cim_outd(unsigned short port, unsigned long data) +{ + __asm__ __volatile__("outl %0,%w1"::"a"(data), "Nd"(port)); +} + +/*------------------------------------------- + * IND + * Reads one DWORD from a single I/O address. + *-------------------------------------------*/ + +#define IND(port) cim_ind(port) +unsigned long cim_ind(unsigned short port); +unsigned long +cim_ind(unsigned short port) +{ + unsigned long value; + __asm__ __volatile__("inl %w1,%0":"=a"(value):"Nd"(port)); + + return value; +} + +/*------------------------------------------- + * OUTW + * Writes one WORD to a single I/O address. + *-------------------------------------------*/ + +#define OUTW(port, data) cim_outw(port, data) +void cim_outw(unsigned short port, unsigned short data); +void +cim_outw(unsigned short port, unsigned short data) +{ + __asm__ volatile ("out %0,%1"::"a" (data), "d"(port)); +} + +/*------------------------------------------- + * INW + * Reads one WORD from a single I/O address. + *-------------------------------------------*/ + +#define INW(port) cim_inw(port) +unsigned short cim_inw(unsigned short port); +unsigned short +cim_inw(unsigned short port) +{ + unsigned short value; + __asm__ volatile ("in %1,%0":"=a" (value):"d"(port)); + + return value; +} + +/*------------------------------------------- + * INB + * Reads one BYTE from a single I/O address. + *-------------------------------------------*/ + +#define INB(port) cim_inb(port) +unsigned char cim_inb(unsigned short port); +unsigned char +cim_inb(unsigned short port) +{ + unsigned char value; + __asm__ volatile ("inb %1,%0":"=a" (value):"d"(port)); + + return value; +} + +/*------------------------------------------- + * OUTB + * Writes one BYTE to a single I/O address. + *-------------------------------------------*/ + +#define OUTB(port) cim_outb(port) +void cim_outb(unsigned short port, unsigned char data); +void +cim_outb(unsigned short port, unsigned char data) +{ + __asm__ volatile ("outb %0,%1"::"a" (data), "d"(port)); +} + +#endif + +#endif /* CIMARRON_INCLUDE_IO_MACROS */ + +extern void (*cim_rdmsr)(unsigned long, unsigned long *, unsigned long *); +extern void (*cim_wrmsr)(unsigned long, unsigned long, unsigned long); + +#endif diff --git a/driver/xf86-video-geode/src/cim/cim_df.c b/driver/xf86-video-geode/src/cim/cim_df.c new file mode 100644 index 000000000..242603a40 --- /dev/null +++ b/driver/xf86-video-geode/src/cim/cim_df.c @@ -0,0 +1,2581 @@ +/* + * Copyright (c) 2006 Advanced Micro Devices, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + * Neither the name of the Advanced Micro Devices, Inc. nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + */ + + /* + * Cimarron display filter routines. These routines program the video + * hardware. + */ + +/*--------------------------------------------------------------------------- + * df_set_crt_enable + * + * This routine enables or disables CRT output. + *--------------------------------------------------------------------------*/ + +int +df_set_crt_enable(int crt_output) +{ + unsigned long config, misc; + + config = READ_VID32(DF_DISPLAY_CONFIG); + misc = READ_VID32(DF_VID_MISC); + + switch (crt_output) { + /* DISABLE DISPLAY */ + + case DF_CRT_DISABLE: + + config &= ~(DF_DCFG_DIS_EN | DF_DCFG_HSYNC_EN | + DF_DCFG_VSYNC_EN | DF_DCFG_DAC_BL_EN); + misc |= DF_DAC_POWER_DOWN; + break; + + /* ENABLE THE DISPLAY */ + + case DF_CRT_ENABLE: + + config |= (DF_DCFG_DIS_EN | DF_DCFG_HSYNC_EN | + DF_DCFG_VSYNC_EN | DF_DCFG_DAC_BL_EN); + misc &= ~(DF_DAC_POWER_DOWN | DF_ANALOG_POWER_DOWN); + break; + + /* HSYNC:OFF VSYNC:ON */ + + case DF_CRT_STANDBY: + + config = (config & ~(DF_DCFG_DIS_EN | DF_DCFG_HSYNC_EN | + DF_DCFG_DAC_BL_EN)) | DF_DCFG_VSYNC_EN; + misc |= DF_DAC_POWER_DOWN; + break; + + /* HSYNC:ON VSYNC:OFF */ + + case DF_CRT_SUSPEND: + + config = (config & ~(DF_DCFG_DIS_EN | DF_DCFG_VSYNC_EN | + DF_DCFG_DAC_BL_EN)) | DF_DCFG_HSYNC_EN; + misc |= DF_DAC_POWER_DOWN; + break; + + default: + return CIM_STATUS_INVALIDPARAMS; + } + + WRITE_VID32(DF_DISPLAY_CONFIG, config); + WRITE_VID32(DF_VID_MISC, misc); + + return CIM_STATUS_OK; +} + +/*--------------------------------------------------------------------------- + * df_set_panel_enable + * + * This routine enables or disables panel output. + *--------------------------------------------------------------------------*/ + +int +df_set_panel_enable(int enable) +{ + unsigned long pm; + + pm = READ_VID32(DF_POWER_MANAGEMENT); + + if (enable) + pm |= DF_PM_PANEL_ON; + else + pm &= ~DF_PM_PANEL_ON; + + WRITE_VID32(DF_POWER_MANAGEMENT, pm); + + return CIM_STATUS_OK; +} + +/*--------------------------------------------------------------------------- + * df_configure_video_source + * + * This routine initializes all aspects of the source buffer for a video overlay. + *--------------------------------------------------------------------------*/ + +int +df_configure_video_source(DF_VIDEO_SOURCE_PARAMS * video_source_odd, + DF_VIDEO_SOURCE_PARAMS * video_source_even) +{ + unsigned long pitch, ctrl, vcfg; + unsigned long lock, vg_line, gcfg; + unsigned long width, size, scale; + unsigned long misc; + + lock = READ_REG32(DC3_UNLOCK); + vg_line = READ_REG32(DC3_LINE_SIZE); + gcfg = READ_REG32(DC3_GENERAL_CFG); + vcfg = READ_VID32(DF_VIDEO_CONFIG); + ctrl = READ_VID32(DF_VID_ALPHA_CONTROL); + scale = READ_VID32(DF_VIDEO_SCALER); + + /* STORE THE DESIRED SCALING PROCEDURE */ + /* Cimarron supports two modes when programming the scale and position */ + /* of the video window. The first mode is designed to implicitly apply */ + /* the graphics scale to any video operations. The second applys the */ + /* video unchanged, allowing complete control by the user. To allow */ + /* visibility between modules, the current mode is stored in a spare */ + /* bit in the DF miscellaneous register. */ + + misc = READ_VID32(DF_VID_MISC); + if (video_source_odd->flags & DF_SOURCEFLAG_IMPLICITSCALING) + misc |= DF_USER_IMPLICIT_SCALING; + else + misc &= DF_USER_IMPLICIT_SCALING; + WRITE_VID32(DF_VID_MISC, misc); + + /* PARAMETER - VIDEO PITCH */ + + pitch = + (video_source_odd->y_pitch >> 3) | ((video_source_odd-> + uv_pitch >> 3) << 16); + + /* PARAMETER - VIDEO FORMAT */ + + gcfg &= ~DC3_GCFG_YUV_420; + vcfg &= ~(DF_VCFG_VID_INP_FORMAT | DF_VCFG_4_2_0_MODE); + ctrl &= ~(DF_VIDEO_INPUT_IS_RGB | DF_CSC_VIDEO_YUV_TO_RGB | DF_HD_VIDEO | + DF_YUV_CSC_EN); + + /* SELECT PIXEL ORDERING */ + + switch (video_source_odd->video_format & 3) { + case 0: + vcfg |= DF_VCFG_UYVY_FORMAT; + break; + case 1: + vcfg |= DF_VCFG_Y2YU_FORMAT; + break; + case 2: + vcfg |= DF_VCFG_YUYV_FORMAT; + break; + case 3: + vcfg |= DF_VCFG_YVYU_FORMAT; + break; + } + + /* SELECT SOURCE FORMAT (4:2:2, 4:2:0, RGB) */ + + switch (video_source_odd->video_format >> 2) { + case 0: + ctrl |= DF_CSC_VIDEO_YUV_TO_RGB; + break; + + case 1: + ctrl |= DF_CSC_VIDEO_YUV_TO_RGB; + vcfg |= DF_VCFG_4_2_0_MODE; + gcfg |= DC3_GCFG_YUV_420; + break; + + case 2: + ctrl |= DF_VIDEO_INPUT_IS_RGB; + break; + + default: + return CIM_STATUS_INVALIDPARAMS; + } + + /* ALIGN TO APPROPRIATE OUTPUT COLOR SPACE */ + /* We have assumed until this point that the output color space is RGB */ + /* and the input (if YUV) is always SDTV video. */ + + if (video_source_odd->flags & DF_SOURCEFLAG_HDTVSOURCE) + ctrl |= DF_HD_VIDEO; + + if (ctrl & DF_CSC_GRAPHICS_RGB_TO_YUV) { + /* YUV OUTPUT - DISABLE YUV->RGB AND ENABLE YUV->YUV */ + + ctrl &= ~DF_CSC_VIDEO_YUV_TO_RGB; + + if ((!(ctrl & DF_HD_VIDEO) && (ctrl & DF_HD_GRAPHICS)) || + ((ctrl & DF_HD_VIDEO) && !(ctrl & DF_HD_GRAPHICS))) { + ctrl |= DF_YUV_CSC_EN; + } + } + + /* PARAMETER - DISPLAY FILTER BUFFER SIZE */ + /* The line size in the video generator must be 32-byte aligned. */ + /* However, smaller alignments are managed by setting the */ + /* appropriate pitch and clipping the video window. */ + + vcfg &= ~(DF_VCFG_LINE_SIZE_LOWER_MASK | DF_VCFG_LINE_SIZE_BIT8 | + DF_VCFG_LINE_SIZE_BIT9); + + size = ((video_source_odd->width >> 1) + 7) & 0xFFF8; + + vcfg |= (size & 0x00FF) << 8; + if (size & 0x0100) + vcfg |= DF_VCFG_LINE_SIZE_BIT8; + if (size & 0x0200) + vcfg |= DF_VCFG_LINE_SIZE_BIT9; + + scale = (scale & ~0x7FF) | video_source_odd->height; + + /* PARAMETER - VIDEO GENERATOR BUFFER SIZE */ + + vg_line &= ~DC3_LINE_SIZE_VLS_MASK; + + if (gcfg & DC3_GCFG_YUV_420) + width = ((video_source_odd->width >> 1) + 7) & 0xFFF8; + else + width = ((video_source_odd->width << 1) + 31) & 0xFFE0; + + vg_line |= (width >> 3) << DC3_LINE_SIZE_VB_SHIFT; + + /* WRITE ALL PARAMETERS AT ONCE */ + + WRITE_REG32(DC3_UNLOCK, DC3_UNLOCK_VALUE); + WRITE_VID32(DF_VIDEO_CONFIG, vcfg); + WRITE_VID32(DF_VID_ALPHA_CONTROL, ctrl); + WRITE_VID32(DF_VIDEO_SCALER, scale); + WRITE_REG32(DC3_GENERAL_CFG, gcfg); + WRITE_REG32(DC3_LINE_SIZE, vg_line); + WRITE_REG32(DC3_VID_YUV_PITCH, pitch); + + /* WRITE EVEN OR ODD BUFFER OFFSETS */ + /* The even buffer is only valid inside an interlaced display. */ + + if (READ_REG32(DC3_IRQ_FILT_CTL) & DC3_IRQFILT_INTL_EN) { + WRITE_REG32(DC3_VID_EVEN_Y_ST_OFFSET, video_source_even->y_offset); + WRITE_REG32(DC3_VID_EVEN_U_ST_OFFSET, video_source_even->u_offset); + WRITE_REG32(DC3_VID_EVEN_V_ST_OFFSET, video_source_even->v_offset); + } + + WRITE_REG32(DC3_VID_Y_ST_OFFSET, video_source_odd->y_offset); + WRITE_REG32(DC3_VID_U_ST_OFFSET, video_source_odd->u_offset); + WRITE_REG32(DC3_VID_V_ST_OFFSET, video_source_odd->v_offset); + + WRITE_REG32(DC3_UNLOCK, lock); + + return CIM_STATUS_OK; +} + +/*--------------------------------------------------------------------------- + * df_set_video_offsets + * + * This routine sets the starting offset for the video buffer(s). The buffers + * can also be configured inside df_configure_video_source, but a separate + * routine is provided here to allow quick buffer flipping. + *--------------------------------------------------------------------------*/ + +int +df_set_video_offsets(int even, unsigned long y_offset, + unsigned long u_offset, unsigned long v_offset) +{ + unsigned long lock = READ_REG32(DC3_UNLOCK); + + WRITE_REG32(DC3_UNLOCK, DC3_UNLOCK_VALUE); + + if (even) { + WRITE_REG32(DC3_VID_EVEN_Y_ST_OFFSET, y_offset); + WRITE_REG32(DC3_VID_EVEN_U_ST_OFFSET, u_offset); + WRITE_REG32(DC3_VID_EVEN_V_ST_OFFSET, v_offset); + } else { + WRITE_REG32(DC3_VID_Y_ST_OFFSET, y_offset); + WRITE_REG32(DC3_VID_U_ST_OFFSET, u_offset); + WRITE_REG32(DC3_VID_V_ST_OFFSET, v_offset); + } + + WRITE_REG32(DC3_UNLOCK, lock); + + return CIM_STATUS_OK; +} + +/*--------------------------------------------------------------------------- + * df_set_video_scale + * + * This routine programs the horizontal/vertical scale factors for video. To + * disable scaling/filtering, this routine should be called with identical source + * and destination dimensions. + *--------------------------------------------------------------------------*/ + +int +df_set_video_scale(unsigned long src_width, unsigned long src_height, + unsigned long dst_width, unsigned long dst_height, unsigned long flags) +{ + unsigned long temp, misc; + unsigned long scale, gfxscale; + unsigned long fbactive, src; + unsigned long size, downscale; + unsigned long vcfg, gcfg, unlock; + + /* APPLY THE GRAPHICS SCALE */ + /* When requested by the user, we will adjust the video scale by the */ + /* current graphics scale factor. This allows video to be programmed */ + /* in terms of the graphics source resolution. */ + + misc = READ_VID32(DF_VID_MISC); + if (misc & DF_USER_IMPLICIT_SCALING) { + gfxscale = READ_REG32(DC3_GFX_SCALE); + fbactive = READ_REG32(DC3_FB_ACTIVE); + + /* REVERSE ENGINEER THE SCALE FACTOR */ + /* The graphics scale factor is (source / (dst - 1)), so a little */ + /* math is performed to reverse engineer the correct scale for */ + /* video. */ + /* */ + /* F = (0x4000*S)/(D-1) -> (D/S) = (((0x4000*S)/F)+1)/S */ + + scale = gfxscale & 0xFFFF; + src = (fbactive >> 16) + 1; + if (scale != 0x4000) { + dst_width = dst_width * (((0x4000 * src) / scale) + 1); + dst_width /= src; + } + + scale = gfxscale >> 16; + src = (fbactive & 0xFFFF) + 1; + if (scale != 0x4000) { + dst_height = dst_height * (((0x4000 * src) / scale) + 1); + dst_height /= src; + } + } + + /* CHECK FOR VALID SCALING FACTOR */ + /* The display filter/video generator can support up to 8:1 */ + /* horizontal downscale and up to 4:1 vertical downscale. */ + /* Scale factors above 4:1 horizontal and 2:1 horizontal */ + /* will have a quality impact. However, at such large scale */ + /* factors, it might not matter, */ + + if (((flags & DF_SCALEFLAG_CHANGEX) && dst_width < (src_width >> 3)) || + ((flags & DF_SCALEFLAG_CHANGEY) && dst_height < (src_height >> 2))) { + return CIM_STATUS_INVALIDSCALE; + } + + /* ENABLE OR DISABLE ADVANCED SCALING FEATURES */ + /* Scaling above 2:1 vertical and 4:1 horizontal relies */ + /* on mechanisms beside the line filter. */ + + if (flags & DF_SCALEFLAG_CHANGEX) { + scale = READ_VID32(DF_VIDEO_SCALER); + vcfg = READ_VID32(DF_VIDEO_CONFIG); + vcfg &= ~(DF_VCFG_LINE_SIZE_LOWER_MASK | DF_VCFG_LINE_SIZE_BIT8 | + DF_VCFG_LINE_SIZE_BIT9); + + if (dst_width < (src_width >> 2)) { + src_width >>= 1; + WRITE_VID32(DF_VIDEO_SCALER, scale | DF_SCALE_DOUBLE_H_DOWNSCALE); + } else { + WRITE_VID32(DF_VIDEO_SCALER, + scale & ~DF_SCALE_DOUBLE_H_DOWNSCALE); + } + + /* PROGRAM A NEW LINE SIZE */ + /* The line size must be updated when using the Double Horizontal */ + /* Downscale (DHD) bit. This is because the amount of VFIFO space */ + /* consumed is effectively half in this mode. */ + + size = ((src_width >> 1) + 7) & 0xFFF8; + vcfg |= (size & 0x00FF) << 8; + if (size & 0x0100) + vcfg |= DF_VCFG_LINE_SIZE_BIT8; + if (size & 0x0200) + vcfg |= DF_VCFG_LINE_SIZE_BIT9; + WRITE_VID32(DF_VIDEO_CONFIG, vcfg); + WRITE_VID32(DF_VIDEO_XSCALE, ((0x10000 * src_width) / dst_width)); + } + + if (flags & DF_SCALEFLAG_CHANGEY) { + unlock = READ_REG32(DC3_UNLOCK); + gcfg = READ_REG32(DC3_GENERAL_CFG) & ~DC3_GCFG_VDSE; + WRITE_REG32(DC3_UNLOCK, DC3_UNLOCK_VALUE); + if (dst_height < (src_height >> 1)) { + gcfg |= DC3_GCFG_VDSE; + downscale = READ_REG32(DC3_VID_DS_DELTA) & ~DC3_DS_DELTA_MASK; + if (dst_height == (src_height >> 2)) + downscale |= (0x3FFF << 18); + else + downscale |= (((src_height >> 1) << 14) / dst_height) << 18; + + WRITE_REG32(DC3_VID_DS_DELTA, downscale); + WRITE_VID32(DF_VIDEO_YSCALE, 0x20000); + } else { + WRITE_VID32(DF_VIDEO_YSCALE, + ((0x10000 * src_height) / dst_height)); + } + WRITE_REG32(DC3_GENERAL_CFG, gcfg); + WRITE_REG32(DC3_UNLOCK, unlock); + } + + /* CHECK IF SCALING IS DISABLED */ + /* If no scaling occurs, we disable the hardware filter. */ + + temp = READ_VID32(DF_VIDEO_CONFIG); + if ((READ_VID32(DF_VIDEO_XSCALE) == 0x10000) && + (READ_VID32(DF_VIDEO_YSCALE) == 0x10000)) { + WRITE_VID32(DF_VIDEO_CONFIG, (temp | DF_VCFG_SC_BYP)); + } else + WRITE_VID32(DF_VIDEO_CONFIG, (temp & ~DF_VCFG_SC_BYP)); + + return CIM_STATUS_OK; +} + +/*--------------------------------------------------------------------------- + * df_set_video_position + * + * This routine programs the position of the video window on the display. + * An indent parameter is also passed to this program to prevent artifacts + * when the video window is moved beyond the left edge of the screen. + *--------------------------------------------------------------------------*/ + +int +df_set_video_position(DF_VIDEO_POSITION * video_window) +{ + unsigned long vblankstart_even, vblankend_even, vsyncend_even, + vtotal_even, vactive_even; + unsigned long hblankstart, hblankend, hsyncend, htotal, hactive; + unsigned long vblankstart, vblankend, vsyncend, vtotal, vactive; + unsigned long width, height, height_even; + unsigned long adjust, border_x, border_y, border_y_even; + unsigned long xstart, xend; + unsigned long ystart, yend; + unsigned long ckey_x, ckey_y; + unsigned long x_copy, y_copy; + unsigned long width_copy, height_copy; + unsigned long vcfg, initread; + unsigned long xscale, dst_clip; + unsigned long ypos, ypos_even; + unsigned long y, gfxscale; + unsigned long misc, fbactive; + unsigned long scale, src; + unsigned long irq_ctl; + unsigned long unlock; + + hsyncend = ((READ_REG32(DC3_H_SYNC_TIMING) >> 16) & 0xFFF) + 1; + vsyncend = ((READ_REG32(DC3_V_SYNC_TIMING) >> 16) & 0xFFF) + 1; + vblankend = ((READ_REG32(DC3_V_BLANK_TIMING) >> 16) & 0xFFF) + 1; + hblankend = ((READ_REG32(DC3_H_BLANK_TIMING) >> 16) & 0xFFF) + 1; + htotal = ((READ_REG32(DC3_H_ACTIVE_TIMING) >> 16) & 0xFFF) + 1; + vtotal = ((READ_REG32(DC3_V_ACTIVE_TIMING) >> 16) & 0xFFF) + 1; + vblankstart = (READ_REG32(DC3_V_BLANK_TIMING) & 0xFFF) + 1; + hblankstart = (READ_REG32(DC3_H_BLANK_TIMING) & 0xFFF) + 1; + hactive = (READ_REG32(DC3_H_ACTIVE_TIMING) & 0xFFF) + 1; + vactive = (READ_REG32(DC3_V_ACTIVE_TIMING) & 0xFFF) + 1; + unlock = READ_REG32(DC3_UNLOCK); + + /* INCLUDE BORDER IF REQUESTED */ + + if (video_window->flags & DF_POSFLAG_INCLUDEBORDER) { + border_x = htotal - hblankend; + border_y = vtotal - vblankend; + hactive = hblankstart + htotal - hblankend; + vactive = vblankstart + vtotal - vblankend; + } else { + border_x = border_y = 0; + } + + /* APPLY THE GRAPHICS SCALE */ + /* Do not alter the input data. */ + + width_copy = video_window->width; + height_copy = video_window->height; + x_copy = video_window->x; + y_copy = video_window->y; + + misc = READ_VID32(DF_VID_MISC); + if (misc & DF_USER_IMPLICIT_SCALING) { + gfxscale = READ_REG32(DC3_GFX_SCALE); + fbactive = READ_REG32(DC3_FB_ACTIVE); + + /* REVERSE ENGINEER THE SCALE FACTOR */ + + scale = gfxscale & 0xFFFF; + src = (fbactive >> 16) + 1; + if (scale != 0x4000) { + width_copy = width_copy * (((0x4000 * src) / scale) + 1); + width_copy /= src; + x_copy = x_copy * (((0x4000 * src) / scale) + 1); + x_copy /= src; + } + + scale = gfxscale >> 16; + src = (fbactive & 0xFFFF) + 1; + if (scale != 0x4000) { + height_copy = height_copy * (((0x4000 * src) / scale) + 1); + height_copy /= src; + y_copy = y_copy * (((0x4000 * src) / scale) + 1); + y_copy /= src; + } + } + + /* HANDLE INTERLACING */ + /* When the output is interlaced, we must set the position and height */ + /* on the fields and not on the composite image. */ + + if ((irq_ctl = READ_REG32(DC3_IRQ_FILT_CTL)) & DC3_IRQFILT_INTL_EN) { + vsyncend_even = ((READ_REG32(DC3_V_SYNC_EVEN) >> 16) & 0xFFF) + 1; + vtotal_even = ((READ_REG32(DC3_V_ACTIVE_EVEN) >> 16) & 0xFFF) + 1; + vblankend_even = ((READ_REG32(DC3_V_BLANK_EVEN) >> 16) & 0xFFF) + 1; + vactive_even = (READ_REG32(DC3_V_ACTIVE_EVEN) & 0xFFF) + 1; + vblankstart_even = (READ_REG32(DC3_V_BLANK_EVEN) & 0xFFF) + 1; + + if (video_window->flags & DF_POSFLAG_INCLUDEBORDER) { + border_y_even = vtotal_even - vblankend_even; + vactive_even = vblankstart_even + vtotal_even - vblankend_even; + } else + border_y_even = 0; + + /* + * THE ODD FIELD MUST ALWAYS PRECEDE THE EVEN FIELD + * This implies that we can never start video on an odd y position + * in the composite image. This is required because the only way + * to accomplish an odd y start would be to switch the buffer + * which could have serious repercussions for genlocked VIP. + */ + + y = y_copy >> 1; + + /* CALCULATE Y POSITION FOR ODD FIELD */ + /* Clip the video window to the odd field timings. Note that the */ + /* height in the odd field may be greater if the video height is */ + /* odd. */ + + height = (height_copy + 1) >> 1; + if ((y + height) > vactive) + height = vactive - y; + + ystart = y + vtotal_even - vsyncend_even + 1; + if (video_window->flags & DF_POSFLAG_INCLUDEBORDER) + ystart -= border_y_even; + + yend = ystart + height; + ypos = (yend << 16) | ystart; + + /* CALCULATE Y POSITION FOR EVEN FIELD */ + + height_even = height_copy >> 1; + if ((y + height_even) > vactive_even) + height_even = vactive_even - y; + + ystart = y + vtotal - vsyncend + 1; + if (video_window->flags & DF_POSFLAG_INCLUDEBORDER) + ystart -= border_y; + + yend = ystart + height_even; + ypos_even = (yend << 16) | ystart; + + /* CALCULATE ACTUAL FRAME BUFFER HEIGHT */ + /* The y position and height are used to determine the actual */ + /* placement of the color key region. The region will either be */ + /* the sum of the even and odd fields (for interlaced addressing */ + /* or flicker filtering) or it will be the union of the two (for */ + /* line doubling). We must also adjust the region such that the */ + /* origin (0, 0) is centered on the beginning of graphics data. */ + /* This is only a problem if video is being displayed over the */ + /* overscan area. */ + + if ((READ_REG32(DC3_GENLK_CTL) & DC3_GC_FLICKER_FILTER_ENABLE) || + (irq_ctl & DC3_IRQFILT_INTL_ADDR)) { + y <<= 1; + height += height_even; + adjust = border_y + border_y_even; + } else { + adjust = border_y; + if (height_even > height) + height = height_even; + } + if (video_window->flags & DF_POSFLAG_INCLUDEBORDER) { + if (y > adjust) { + y -= adjust; + adjust = 0; + } else { + adjust -= y; + if (height > adjust) + height -= adjust; + else + height = 0; + } + } + + } else { + y = y_copy; + + height = height_copy; + if ((y + height) > vactive) + height = vactive - y; + + ystart = y + vtotal - vsyncend + 1; + if (video_window->flags & DF_POSFLAG_INCLUDEBORDER) + ystart -= border_y; + + yend = ystart + height; + ypos = (yend << 16) | ystart; + ypos_even = 0; + } + + /* HORIZONTAL POSITION */ + /* The horizontal values are identical for the even and odd field. */ + + width = width_copy; + xstart = x_copy + htotal - hsyncend - 14; + if (video_window->flags & DF_POSFLAG_INCLUDEBORDER) + xstart -= border_x; + + /* RIGHT CLIPPING */ + + if ((x_copy + width) > hactive) + width = hactive - x_copy; + + xend = xstart + width; + + /* + * CALCULATE LEFT CLIPPING PARAMETER + * The value passed in can be interpreted as destination pixels, in + * which case the video scale is factored in, or as source pixels, in + * which case the value is written directly. Also, the display filter's + * initial read address value is only programmable on 4-pixel increments. + * However, we can achieve an arbitrary left clip by adjusting the + * xstart value, as there is a 14-clock delay in which to play. Also, + * according to the designers, 4:2:0 and 4:2:2 behave identically when + * setting the initial read address. The addition of scaling further + * complicates the algorithm. When setting the initial read address, it + * is in terms of source pixels, while adjusting the xstart value is in + * destination pixels We may thus not be able to achieve a perfect + * clipping fit for scaled video. We compensate by including two + * clipping parameters in our structure. This allows us the user + * additional control and it allows us to accurately convey to the user + * the state of clipping on the machine. + */ + + initread = video_window->left_clip; + dst_clip = 0; + if (!(video_window->flags & DF_POSFLAG_DIRECTCLIP)) { + xscale = READ_VID32(DF_VIDEO_XSCALE) & 0xFFFFF; + initread = (initread * xscale) / 0x10000; + if (xscale) + dst_clip = ((initread & 3) * 0x10000) / xscale; + } else + dst_clip = video_window->dst_clip; + + /* + * LIMIT THE CLIP + * We technically have a 14 pixel window in which to play. However, + * taking the entire 14 pixels makes the video timing a little hairy... + * Also note that we cannot do this when performing panel centering, as + * the video would then exceed the mode size. + */ + + if (dst_clip > 4) + dst_clip = 4; + if (READ_REG32(DC3_DISPLAY_CFG) & DC3_DCFG_DCEN) + dst_clip = 0; + + xstart -= dst_clip; + + vcfg = READ_VID32(DF_VIDEO_CONFIG); + vcfg &= ~DF_VCFG_INIT_READ_MASK; + vcfg |= (initread >> 2) << 16; + + /* SET COLOR KEY REGION */ + /* We are assuming that color keying will never be desired outside */ + /* of the video region. We adjust the color key region for graphics */ + /* scaling. */ + + gfxscale = READ_REG32(DC3_GFX_SCALE); + + ckey_x = ((x_copy * (gfxscale & 0xFFFF)) / 0x4000) | + ((((x_copy + width) * (gfxscale & 0xFFFF)) / 0x4000) << 16); + ckey_y = ((y * (gfxscale >> 16)) / 0x4000) | + ((((y + height) * (gfxscale >> 16)) / 0x4000) << 16); + + /* WRITE ALL PARAMETERS AT ONCE */ + + WRITE_REG32(DC3_UNLOCK, DC3_UNLOCK_VALUE); + WRITE_REG32(DC3_CLR_KEY_X, ckey_x); + WRITE_REG32(DC3_CLR_KEY_Y, ckey_y); + WRITE_VID32(DF_VIDEO_X_POS, (xend << 16) | xstart); + WRITE_VID32(DF_VIDEO_Y_POS, ypos); + WRITE_VID32(DF_VID_YPOS_EVEN, ypos_even); + WRITE_VID32(DF_VIDEO_CONFIG, vcfg); + WRITE_REG32(DC3_UNLOCK, unlock); + + return CIM_STATUS_OK; +} + +/*--------------------------------------------------------------------------- + * df_set_video_filter_coefficients + * + * This routine sets the horizontal and vertical filter coefficients for video + * scaling. These coefficients are used for upscaling and downscaling video. + * If the phase256 parameter is 1, the coefficient arrays are used as single + * arrays of 256 phases for both vertical and horizontal scaling. If the + * phase256 parameter is clear, the coefficient arrays are used as two + * 128-phase arrays. The first 128 entries represent the phases for + * vertical scaling. The last 128 entries represent the phases for + * horizontal scaling. + *--------------------------------------------------------------------------*/ + +int +df_set_video_filter_coefficients(long taps[][4], int phase256) +{ + unsigned long scale, coeff0, coeff1; + unsigned long i; + long (*defaults)[2]; + + /* SET PHASE COUNT AND CHOOSE COEFFICIENT ARRAY */ + + scale = READ_VID32(DF_VIDEO_SCALER); + if (phase256) { + WRITE_VID32(DF_VIDEO_SCALER, (scale & ~DF_SCALE_128_PHASES)); + defaults = CimarronVideoFilter256; + } else { + WRITE_VID32(DF_VIDEO_SCALER, (scale | DF_SCALE_128_PHASES)); + defaults = CimarronVideoFilter128; + } + + /* PROGRAM COEFFICIENTS */ + + for (i = 0; i < 256; i++) { + if (!taps) { + coeff0 = defaults[i][0]; + coeff1 = defaults[i][1]; + } else { + if (taps[i][1] < 0) + coeff0 = -taps[i][1] | 0x8000; + else + coeff0 = taps[i][1]; + + coeff0 <<= 16; + + if (taps[i][0] < 0) + coeff0 |= -taps[i][0] | 0x8000; + else + coeff0 |= taps[i][0]; + + if (taps[i][3] < 0) + coeff1 = -taps[i][3] | 0x8000; + else + coeff1 = taps[i][3]; + + coeff1 <<= 16; + + if (taps[i][2] < 0) + coeff1 |= -taps[i][2] | 0x8000; + else + coeff1 |= taps[i][2]; + } + + WRITE_VID32((DF_COEFFICIENT_BASE + (i << 3)), coeff0); + WRITE_VID32((DF_COEFFICIENT_BASE + (i << 3) + 4), coeff1); + } + + return CIM_STATUS_OK; +} + +/*--------------------------------------------------------------------------- + * df_set_video_enable + * + * This routine enables or disables the video overlay. + *--------------------------------------------------------------------------*/ + +int +df_set_video_enable(int enable, unsigned long flags) +{ + unsigned long vcfg, lock, gcfg; + unsigned long dcfg, vg_ckey, fifo = 0; + + vcfg = READ_VID32(DF_VIDEO_CONFIG); + lock = READ_REG32(DC3_UNLOCK); + gcfg = READ_REG32(DC3_GENERAL_CFG); + + /* SET VIDEO FIFO END WATERMARK */ + /* The video FIFO end watermark is set to 0 when video is disabled */ + /* to allow low priority transactions in the VG. Otherwise, the */ + /* priority will be forced high until the VG fills the video FIFO */ + /* by not fetching video. That could take a while... Note that */ + /* we set the end priority to be 4 greater than the start. We */ + /* assume that the start priority has been configured by a modeset. */ + + dcfg = READ_REG32(DC3_DISPLAY_CFG) & ~DC3_DCFG_VFHPEL_MASK; + if (enable) { + fifo = ((dcfg >> 12) & 0x0000000F) + 4; + if (fifo > 0xF) + fifo = 0xF; + } + WRITE_REG32(DC3_UNLOCK, DC3_UNLOCK_VALUE); + WRITE_REG32(DC3_DISPLAY_CFG, dcfg | (fifo << 16)); + + /* ENABLE OR DISABLE VIDEO */ + /* The mechanism to fetch video data is enabled first and */ + /* disabled last. */ + + if (enable) { + WRITE_REG32(DC3_GENERAL_CFG, (gcfg | DC3_GCFG_VIDE)); + WRITE_VID32(DF_VIDEO_CONFIG, (vcfg | DF_VCFG_VID_EN)); + + /* DISABLE COLOR KEYING IF REQUESTED BY THE USER */ + + if (flags & DF_ENABLEFLAG_NOCOLORKEY) { + /* OVERRIDE THE MODE TO COLOR KEYING */ + + dcfg = READ_VID32(DF_DISPLAY_CONFIG); + WRITE_VID32(DF_DISPLAY_CONFIG, (dcfg & ~DF_DCFG_VG_CK)); + + /* DISABLE COLOR KEYING IN THE VG */ + + vg_ckey = READ_REG32(DC3_COLOR_KEY); + WRITE_REG32(DC3_COLOR_KEY, (vg_ckey & ~DC3_CLR_KEY_ENABLE)); + } else if (!(READ_VID32(DF_DISPLAY_CONFIG) & DF_DCFG_VG_CK)) { + /* OTHERWISE RE-ENABLE COLOR KEYING */ + + vg_ckey = READ_REG32(DC3_COLOR_KEY); + WRITE_REG32(DC3_COLOR_KEY, (vg_ckey | DC3_CLR_KEY_ENABLE)); + } + } else { + WRITE_VID32(DF_VIDEO_CONFIG, (vcfg & ~DF_VCFG_VID_EN)); + WRITE_REG32(DC3_GENERAL_CFG, (gcfg & ~DC3_GCFG_VIDE)); + + /* DISABLE COLOR KEY WINDOW WHEN VIDEO IS INACTIVE */ + /* To mimic legacy functionality, we disble color keying */ + /* when the video window is not active. We will restore */ + /* the enable when video is re-enabled if the appropriate */ + /* bit is set in display config. */ + + vg_ckey = READ_REG32(DC3_COLOR_KEY); + WRITE_REG32(DC3_COLOR_KEY, (vg_ckey & ~DC3_CLR_KEY_ENABLE)); + } + WRITE_REG32(DC3_UNLOCK, lock); + + return CIM_STATUS_OK; +} + +/*--------------------------------------------------------------------------- + * df_set_video_color_key + * + * This routine configures the video color/chroma key mechanism. + *--------------------------------------------------------------------------*/ + +int +df_set_video_color_key(unsigned long key, unsigned long mask, int graphics) +{ + unsigned long lock, vg_ckey, df_dcfg; + + vg_ckey = READ_REG32(DC3_COLOR_KEY); + lock = READ_REG32(DC3_UNLOCK); + df_dcfg = READ_VID32(DF_DISPLAY_CONFIG); + + WRITE_REG32(DC3_UNLOCK, DC3_UNLOCK_VALUE); + + if (graphics) { + /* COLOR KEY - USE VG HARDWARE */ + /* Note that color key is never enabled unless a video window */ + /* is active. This is to match legacy behavior. */ + + df_dcfg &= ~DF_DCFG_VG_CK; + vg_ckey = (vg_ckey & 0xFF000000) | (key & 0xFFFFFF); + if (READ_VID32(DF_VIDEO_CONFIG) & DF_VCFG_VID_EN) + vg_ckey |= DC3_CLR_KEY_ENABLE; + else + vg_ckey &= ~DC3_CLR_KEY_ENABLE; + + WRITE_VID32(DF_DISPLAY_CONFIG, df_dcfg); + WRITE_REG32(DC3_COLOR_KEY, vg_ckey); + WRITE_REG32(DC3_COLOR_MASK, (mask & 0xFFFFFF)); + } else { + /* CHROMA KEY - USE DF HARDWARE */ + + df_dcfg |= DF_DCFG_VG_CK; + vg_ckey &= ~DC3_CLR_KEY_ENABLE; + + WRITE_REG32(DC3_COLOR_KEY, vg_ckey); + WRITE_VID32(DF_DISPLAY_CONFIG, df_dcfg); + WRITE_VID32(DF_VIDEO_COLOR_KEY, (key & 0xFFFFFF)); + WRITE_VID32(DF_VIDEO_COLOR_MASK, (mask & 0xFFFFFF)); + } + + WRITE_REG32(DC3_UNLOCK, lock); + + return CIM_STATUS_OK; +} + +/*--------------------------------------------------------------------------- + * df_set_video_palette + * + * This routine loads the video hardware palette. If a NULL pointer is + * specified, the palette is bypassed. + *-------------------------------------------------------------------------*/ + +int +df_set_video_palette(unsigned long *palette) +{ + unsigned long i, entry; + unsigned long misc, dcfg; + + /* LOAD GEODE LX VIDEO PALETTE */ + + WRITE_VID32(DF_PALETTE_ADDRESS, 0); + for (i = 0; i < 256; i++) { + if (palette) + entry = palette[i]; + else + entry = i | (i << 8) | (i << 16); + WRITE_VID32(DF_PALETTE_DATA, entry); + } + + /* ENABLE THE VIDEO PALETTE */ + /* Ensure that the video palette has an effect by routing video data */ + /* through the palette RAM and clearing the 'Bypass Both' bit. */ + + dcfg = READ_VID32(DF_DISPLAY_CONFIG); + misc = READ_VID32(DF_VID_MISC); + + dcfg |= DF_DCFG_GV_PAL_BYP; + misc &= ~DF_GAMMA_BYPASS_BOTH; + + WRITE_VID32(DF_DISPLAY_CONFIG, dcfg); + WRITE_VID32(DF_VID_MISC, misc); + + return CIM_STATUS_OK; +} + +/*--------------------------------------------------------------------------- + * df_set_video_palette_entry + * + * This routine loads a single entry of the video hardware palette. + *--------------------------------------------------------------------------*/ + +int +df_set_video_palette_entry(unsigned long index, unsigned long palette) +{ + unsigned long misc, dcfg; + + if (index > 0xFF) + return CIM_STATUS_INVALIDPARAMS; + + /* SET A SINGLE ENTRY */ + + WRITE_VID32(DF_PALETTE_ADDRESS, index); + WRITE_VID32(DF_PALETTE_DATA, palette); + + /* ENABLE THE VIDEO PALETTE */ + /* Ensure that the video palette has an effect by routing video data */ + /* through the palette RAM and clearing the 'Bypass Both' bit. */ + + dcfg = READ_VID32(DF_DISPLAY_CONFIG); + misc = READ_VID32(DF_VID_MISC); + + dcfg |= DF_DCFG_GV_PAL_BYP; + misc &= ~DF_GAMMA_BYPASS_BOTH; + + WRITE_VID32(DF_DISPLAY_CONFIG, dcfg); + WRITE_VID32(DF_VID_MISC, misc); + + return CIM_STATUS_OK; +} + +/*--------------------------------------------------------------------------- + * df_configure_video_cursor_color_key + * + * This routine configures the hardware video cursor color key mechanism. + *--------------------------------------------------------------------------*/ + +int +df_configure_video_cursor_color_key(DF_VIDEO_CURSOR_PARAMS * cursor_color_key) +{ + unsigned long key; + + if (cursor_color_key->select_color2 >= 24) + return CIM_STATUS_INVALIDPARAMS; + + key = READ_VID32(DF_CURSOR_COLOR_KEY) & DF_CURSOR_COLOR_KEY_ENABLE; + key = key | (cursor_color_key->key & 0xFFFFFF) | (cursor_color_key-> + select_color2 << 24); + + WRITE_VID32(DF_CURSOR_COLOR_KEY, key); + WRITE_VID32(DF_CURSOR_COLOR_MASK, (cursor_color_key->mask & 0xFFFFFF)); + WRITE_VID32(DF_CURSOR_COLOR_1, (cursor_color_key->color1 & 0xFFFFFF)); + WRITE_VID32(DF_CURSOR_COLOR_2, (cursor_color_key->color2 & 0xFFFFFF)); + + return CIM_STATUS_OK; +} + +/*--------------------------------------------------------------------------- + * df_set_video_cursor_color_key_enable + * + * This routine enables or disables the video cursor color key. + *--------------------------------------------------------------------------*/ + +int +df_set_video_cursor_color_key_enable(int enable) +{ + unsigned long temp = READ_VID32(DF_CURSOR_COLOR_KEY); + + if (enable) + temp |= DF_CURSOR_COLOR_KEY_ENABLE; + else + temp &= ~DF_CURSOR_COLOR_KEY_ENABLE; + + WRITE_VID32(DF_CURSOR_COLOR_KEY, temp); + + return CIM_STATUS_OK; +} + +/*--------------------------------------------------------------------------- + * df_configure_alpha_window + * + * This routine configures one of the three hardware alpha regions. + *--------------------------------------------------------------------------*/ + +int +df_configure_alpha_window(int window, DF_ALPHA_REGION_PARAMS * alpha_data) +{ + unsigned long vsyncend_even, vtotal_even, vactive_even; + unsigned long hsyncend, htotal, hactive; + unsigned long vsyncend, vtotal, vactive; + unsigned long alpha_ctl, pos; + unsigned long hadjust, vadjust; + unsigned long y, height; + unsigned long xstart, xend; + unsigned long ystart, yend; + unsigned long x_copy, width_copy; + unsigned long y_copy, height_copy; + unsigned long scale, src, misc; + unsigned long gfxscale, fbactive; + unsigned long color; + + if (window > 2) + return CIM_STATUS_INVALIDPARAMS; + + hsyncend = ((READ_REG32(DC3_H_SYNC_TIMING) >> 16) & 0xFFF) + 1; + vsyncend = ((READ_REG32(DC3_V_SYNC_TIMING) >> 16) & 0xFFF) + 1; + htotal = ((READ_REG32(DC3_H_ACTIVE_TIMING) >> 16) & 0xFFF) + 1; + vtotal = ((READ_REG32(DC3_V_ACTIVE_TIMING) >> 16) & 0xFFF) + 1; + hactive = (READ_REG32(DC3_H_ACTIVE_TIMING) & 0xFFF) + 1; + vactive = (READ_REG32(DC3_V_ACTIVE_TIMING) & 0xFFF) + 1; + + /* APPLY THE GRAPHICS SCALE */ + + width_copy = alpha_data->width; + height_copy = alpha_data->height; + x_copy = alpha_data->x; + y_copy = alpha_data->y; + + misc = READ_VID32(DF_VID_MISC); + if (misc & DF_USER_IMPLICIT_SCALING) { + gfxscale = READ_REG32(DC3_GFX_SCALE); + fbactive = READ_REG32(DC3_FB_ACTIVE); + + /* REVERSE ENGINEER THE SCALE FACTOR */ + + scale = gfxscale & 0xFFFF; + src = (fbactive >> 16) + 1; + if (scale != 0x4000) { + width_copy = width_copy * (((0x4000 * src) / scale) + 1); + width_copy /= src; + x_copy = x_copy * (((0x4000 * src) / scale) + 1); + x_copy /= src; + } + + scale = gfxscale >> 16; + src = (fbactive & 0xFFFF) + 1; + if (scale != 0x4000) { + height_copy = height_copy * (((0x4000 * src) / scale) + 1); + height_copy /= src; + y_copy = y_copy * (((0x4000 * src) / scale) + 1); + y_copy /= src; + } + } + + /* SET PRIORITY */ + /* Priority is the only alpha parameter that is not in a register that */ + /* can be indexed based on the alpha window number. */ + + pos = 16 + (window << 1); + alpha_ctl = READ_VID32(DF_VID_ALPHA_CONTROL) & ~(3L << pos); + alpha_ctl |= (alpha_data->priority & 3) << pos; + WRITE_VID32(DF_VID_ALPHA_CONTROL, alpha_ctl); + + /* HANDLE INTERLACED MODES */ + + if (READ_REG32(DC3_IRQ_FILT_CTL) & DC3_IRQFILT_INTL_EN) { + vsyncend_even = ((READ_REG32(DC3_V_SYNC_EVEN) >> 16) & 0xFFF) + 1; + vtotal_even = ((READ_REG32(DC3_V_ACTIVE_EVEN) >> 16) & 0xFFF) + 1; + vactive_even = (READ_REG32(DC3_V_ACTIVE_EVEN) & 0xFFF) + 1; + + y = y_copy >> 1; + + /* SET Y POSITION FOR ODD FIELD */ + + height = (height_copy + 1) >> 1; + vadjust = vtotal_even - vsyncend_even + 1; + + ystart = y + vadjust; + yend = y + vadjust + height; + + if (yend > (vactive + vadjust)) + yend = vactive + vadjust; + + WRITE_VID32((DF_ALPHA_YPOS_1 + (window << 5)), + (ystart | (yend << 16))); + + /* SET Y POSITION FOR EVEN FIELD */ + + height = height_copy >> 1; + vadjust = vtotal - vsyncend + 1; + + ystart = y + vadjust; + yend = y + vadjust + height; + + if (yend > (vactive_even + vadjust)) + yend = vactive_even + vadjust; + + WRITE_VID32((DF_VID_ALPHA_Y_EVEN_1 + (window << 3)), + (ystart | (yend << 16))); + } else { + y = y_copy; + height = height_copy; + vadjust = vtotal - vsyncend + 1; + + ystart = y + vadjust; + yend = y + vadjust + height; + + if (yend > (vactive + vadjust)) + yend = vactive + vadjust; + + WRITE_VID32((DF_ALPHA_YPOS_1 + (window << 5)), + (ystart | (yend << 16))); + } + + /* SET ALPHA X POSITION */ + /* The x position is the same for both the odd and even fields. */ + + hadjust = htotal - hsyncend - 2; + + xstart = x_copy + hadjust; + xend = x_copy + hadjust + width_copy; + + if (xend > (hactive + hadjust)) + xend = hactive + hadjust; + + WRITE_VID32((DF_ALPHA_XPOS_1 + (window << 5)), (xstart | (xend << 16))); + + /* SET COLOR REGISTER */ + + color = alpha_data->color & 0xFFFFFF; + if (alpha_data->flags & DF_ALPHAFLAG_COLORENABLED) + color |= DF_ALPHA_COLOR_ENABLE; + + WRITE_VID32((DF_ALPHA_COLOR_1 + (window << 5)), color); + + /* SET ALPHA VALUE, DELTA AND PER PIXEL */ + + alpha_ctl = READ_VID32(DF_ALPHA_CONTROL_1 + (window << 5)) & + DF_ACTRL_WIN_ENABLE; + alpha_ctl |= (alpha_data->alpha_value & 0xFF) | DF_ACTRL_LOAD_ALPHA | + (((unsigned long)alpha_data->delta & 0xFF) << 8); + if (alpha_data->flags & DF_ALPHAFLAG_PERPIXELENABLED) + alpha_ctl |= DF_ACTRL_PERPIXEL_EN; + + WRITE_VID32((DF_ALPHA_CONTROL_1 + (window << 5)), alpha_ctl); + + return CIM_STATUS_OK; +} + +/*--------------------------------------------------------------------------- + * df_set_alpha_window_enable + * + * This routine enables or disables one of the three hardware alpha regions. + *--------------------------------------------------------------------------*/ + +int +df_set_alpha_window_enable(int window, int enable) +{ + unsigned long alpha_ctl; + + if (window > 2) + return CIM_STATUS_INVALIDPARAMS; + + alpha_ctl = READ_VID32(DF_ALPHA_CONTROL_1 + (window << 5)); + if (enable) + alpha_ctl |= DF_ACTRL_WIN_ENABLE; + else + alpha_ctl &= ~DF_ACTRL_WIN_ENABLE; + WRITE_VID32((DF_ALPHA_CONTROL_1 + (window << 5)), alpha_ctl); + + return CIM_STATUS_OK; +} + +/*--------------------------------------------------------------------------- + * df_set_no_ck_outside_alpha + * + * This function affects how color/chroma keying is performed inside the video + * window. + * + * If enable is 1, color/chroma key comparison is performed only inside + * the enabled alpha windows. Outside the enabled alpha windows, video + * is displayed if color keying is enabled, or graphics is displayed if + * chroma keying is enabled. + * If enable is 0, color/chroma key comparison is performed inside the + * entire video window. + *--------------------------------------------------------------------------*/ + +int +df_set_no_ck_outside_alpha(int enable) +{ + unsigned long value; + + value = READ_VID32(DF_VID_ALPHA_CONTROL); + if (enable) + value |= DF_NO_CK_OUTSIDE_ALPHA; + else + value &= ~DF_NO_CK_OUTSIDE_ALPHA; + WRITE_VID32(DF_VID_ALPHA_CONTROL, value); + + return CIM_STATUS_OK; +} + +/*--------------------------------------------------------------------------- + * df_set_video_request + * + * This routine sets the horizontal (pixel) and vertical (line) video request + * values. + *--------------------------------------------------------------------------*/ + +int +df_set_video_request(unsigned long x, unsigned long y) +{ + unsigned long htotal, hsyncend; + unsigned long vtotal, vsyncend; + + hsyncend = ((READ_REG32(DC3_H_SYNC_TIMING) >> 16) & 0xFFF) + 1; + vsyncend = ((READ_REG32(DC3_V_SYNC_TIMING) >> 16) & 0xFFF) + 1; + htotal = ((READ_REG32(DC3_H_ACTIVE_TIMING) >> 16) & 0xFFF) + 1; + vtotal = ((READ_REG32(DC3_V_ACTIVE_TIMING) >> 16) & 0xFFF) + 1; + + /* SET DISPLAY FILTER VIDEO REQUEST */ + + x += htotal - hsyncend - 2; + y += vtotal - vsyncend + 1; + + if (x >= 0x1000 || y >= 0x800) + return CIM_STATUS_INVALIDPARAMS; + + WRITE_VID32(DF_VIDEO_REQUEST, (y | (x << 16))); + return CIM_STATUS_OK; +} + +/*--------------------------------------------------------------------------- + * df_set_output_color_space + * + * This routine sets the color space used when combining graphics and video. + *--------------------------------------------------------------------------*/ + +int +df_set_output_color_space(int color_space) +{ + unsigned long alpha_ctl; + + alpha_ctl = READ_VID32(DF_VID_ALPHA_CONTROL); + + alpha_ctl &= ~(DF_CSC_GRAPHICS_RGB_TO_YUV | DF_CSC_VIDEO_YUV_TO_RGB | + DF_HD_GRAPHICS | DF_YUV_CSC_EN | DF_ALPHA_DRGB); + + /* OUTPUT IS RGB */ + /* Enable YUV->RGB CSC if necessary and enable alpha output if */ + /* requested. */ + + if (color_space == DF_OUTPUT_RGB || color_space == DF_OUTPUT_ARGB) { + if (!(alpha_ctl & DF_VIDEO_INPUT_IS_RGB)) + alpha_ctl |= DF_CSC_VIDEO_YUV_TO_RGB; + + if (color_space == DF_OUTPUT_ARGB) + alpha_ctl |= DF_ALPHA_DRGB; + } + + /* OUTPUT IS YUV */ + /* Enable YUV->YUV CSC if necessary and enable RGB->YUV CSC. */ + + else if (color_space == DF_OUTPUT_SDTV || color_space == DF_OUTPUT_HDTV) { + alpha_ctl |= DF_CSC_GRAPHICS_RGB_TO_YUV; + + if (((alpha_ctl & DF_HD_VIDEO) && color_space == DF_OUTPUT_SDTV) || + (!(alpha_ctl & DF_HD_VIDEO) && color_space == DF_OUTPUT_HDTV)) { + alpha_ctl |= DF_YUV_CSC_EN; + } + + if (color_space == DF_OUTPUT_HDTV) + alpha_ctl |= DF_HD_GRAPHICS; + } else + return CIM_STATUS_INVALIDPARAMS; + + WRITE_VID32(DF_VID_ALPHA_CONTROL, alpha_ctl); + + return CIM_STATUS_OK; +} + +/*--------------------------------------------------------------------------- + * df_set_output_path + * + * This routine changes the current output path in the display filter. + *--------------------------------------------------------------------------*/ + +int +df_set_output_path(int format) +{ + unsigned long panel_tim2, panel_pm; + unsigned long output = 0; + Q_WORD msr_value; + + msr_read64(MSR_DEVICE_GEODELX_DF, MSR_GEODELINK_CONFIG, &msr_value); + msr_value.low &= ~(DF_SIMULTANEOUS_CRT_FP | DF_CONFIG_OUTPUT_MASK); + panel_tim2 = READ_VID32(DF_VIDEO_PANEL_TIM2); + panel_pm = READ_VID32(DF_POWER_MANAGEMENT); + + if (format == DF_DISPLAY_CRT) { + /* SiBZ #4188 */ + /* When CRT output is selected, the DF drives the DISP_EN signal */ + /* with the CRT display enable. As a consequence, systems that */ + /* wire the DISP_EN signal to the TFT backlight control will not */ + /* be able to set CRT-only output without leaving the backlight */ + /* enabled. To workaround this issue, we are setting simultaneous */ + /* TFT/CRT and disabling the TFT logic. The only caveat to this */ + /* is that some TFT pins are shared with VIP 601 pins. VIP 601 */ + /* will thus not work when in this pseudo-CRT mode. To address */ + /* THAT issue, normal CRT mode sets (in cim_vg.c) will set CRT */ + /* as the DF output format. This will allow VIP 601 on CRT-only */ + /* systems without a TFT attached. */ + + panel_pm &= ~DF_PM_PANEL_ON; + panel_tim2 |= DF_PMTIM2_TFT_PASSHTHROUGH; + output = DF_OUTPUT_PANEL | DF_SIMULTANEOUS_CRT_FP; + } else if (format == DF_DISPLAY_FP || format == DF_DISPLAY_CRT_FP) { + panel_pm |= DF_PM_PANEL_ON; + panel_tim2 &= ~DF_PMTIM2_TFT_PASSHTHROUGH; + + if (format == DF_DISPLAY_FP) + output = DF_OUTPUT_PANEL; + else if (format == DF_DISPLAY_CRT_FP) + output = DF_OUTPUT_PANEL | DF_SIMULTANEOUS_CRT_FP; + } else { + switch (format) { + case DF_DISPLAY_VOP: + output = DF_OUTPUT_VOP; + break; + case DF_DISPLAY_DRGB: + output = DF_OUTPUT_DRGB; + break; + case DF_DISPLAY_CRT_DRGB: + output = DF_OUTPUT_DRGB | DF_SIMULTANEOUS_CRT_FP; + break; + default: + return CIM_STATUS_INVALIDPARAMS; + } + } + msr_value.low |= output; + msr_write64(MSR_DEVICE_GEODELX_DF, MSR_GEODELINK_CONFIG, &msr_value); + WRITE_VID32(DF_VIDEO_PANEL_TIM2, panel_tim2); + WRITE_VID32(DF_POWER_MANAGEMENT, panel_pm); + + return CIM_STATUS_OK; +} + +/*--------------------------------------------------------------------------- + * df_test_video_flip_status + * + * This routine tests if a new video offset has been latched. + *--------------------------------------------------------------------------*/ + +unsigned long +df_test_video_flip_status(void) +{ + return (READ_REG32(DC3_LINE_CNT_STATUS) & DC3_LNCNT_VFLIP); +} + +/*--------------------------------------------------------------------------- + * df_save_state + * + * This routine saves all persistent DF state information. + *--------------------------------------------------------------------------*/ + +int +df_save_state(DF_SAVE_RESTORE * df_state) +{ + unsigned long i; + + /* READ ALL DF REGISTERS */ + + df_state->vcfg = READ_VID32(DF_VIDEO_CONFIG); + df_state->dcfg = READ_VID32(DF_DISPLAY_CONFIG); + df_state->video_x = READ_VID32(DF_VIDEO_X_POS); + df_state->video_y = READ_VID32(DF_VIDEO_Y_POS); + df_state->video_scaler = READ_VID32(DF_VIDEO_SCALER); + df_state->video_color_key = READ_VID32(DF_VIDEO_COLOR_KEY); + df_state->video_color_mask = READ_VID32(DF_VIDEO_COLOR_MASK); + df_state->sat_limit = READ_VID32(DF_SATURATION_LIMIT); + df_state->vid_misc = READ_VID32(DF_VID_MISC); + df_state->video_yscale = READ_VID32(DF_VIDEO_YSCALE); + df_state->video_xscale = READ_VID32(DF_VIDEO_XSCALE); + df_state->vid_alpha_control = READ_VID32(DF_VID_ALPHA_CONTROL); + df_state->cursor_key = READ_VID32(DF_CURSOR_COLOR_KEY); + df_state->cursor_mask = READ_VID32(DF_CURSOR_COLOR_MASK); + df_state->cursor_color1 = READ_VID32(DF_CURSOR_COLOR_1); + df_state->cursor_color2 = READ_VID32(DF_CURSOR_COLOR_2); + df_state->alpha_xpos1 = READ_VID32(DF_ALPHA_XPOS_1); + df_state->alpha_ypos1 = READ_VID32(DF_ALPHA_YPOS_1); + df_state->alpha_color1 = READ_VID32(DF_ALPHA_COLOR_1); + df_state->alpha_control1 = READ_VID32(DF_ALPHA_CONTROL_1); + df_state->alpha_xpos2 = READ_VID32(DF_ALPHA_XPOS_2); + df_state->alpha_ypos2 = READ_VID32(DF_ALPHA_YPOS_2); + df_state->alpha_color2 = READ_VID32(DF_ALPHA_COLOR_2); + df_state->alpha_control2 = READ_VID32(DF_ALPHA_CONTROL_2); + df_state->alpha_xpos3 = READ_VID32(DF_ALPHA_XPOS_3); + df_state->alpha_ypos3 = READ_VID32(DF_ALPHA_YPOS_3); + df_state->alpha_color3 = READ_VID32(DF_ALPHA_COLOR_3); + df_state->alpha_control3 = READ_VID32(DF_ALPHA_CONTROL_3); + df_state->vid_request = READ_VID32(DF_VIDEO_REQUEST); + df_state->vid_ypos_even = READ_VID32(DF_VID_YPOS_EVEN); + df_state->alpha_ypos_even1 = READ_VID32(DF_VID_ALPHA_Y_EVEN_1); + df_state->alpha_ypos_even2 = READ_VID32(DF_VID_ALPHA_Y_EVEN_2); + df_state->alpha_ypos_even3 = READ_VID32(DF_VID_ALPHA_Y_EVEN_3); + df_state->panel_tim1 = READ_VID32(DF_VIDEO_PANEL_TIM1); + df_state->panel_tim2 = READ_VID32(DF_VIDEO_PANEL_TIM2); + df_state->panel_pm = READ_VID32(DF_POWER_MANAGEMENT); + df_state->panel_dither = READ_VID32(DF_DITHER_CONTROL); + + /* READ DF PALETTE */ + + WRITE_VID32(DF_PALETTE_ADDRESS, 0); + for (i = 0; i < 256; i++) + df_state->palette[i] = READ_VID32(DF_PALETTE_DATA); + + /* READ FILTER COEFFICIENTS */ + + for (i = 0; i < 512; i++) + df_state->coefficients[i] = + READ_VID32(DF_COEFFICIENT_BASE + (i << 2)); + + /* READ ALL DF MSRS */ + + msr_read64(MSR_DEVICE_GEODELX_DF, MSR_GEODELINK_CAP, + &(df_state->msr_cap)); + msr_read64(MSR_DEVICE_GEODELX_DF, MSR_GEODELINK_CONFIG, + &(df_state->msr_config)); + msr_read64(MSR_DEVICE_GEODELX_DF, MSR_GEODELINK_SMI, + &(df_state->msr_smi)); + msr_read64(MSR_DEVICE_GEODELX_DF, MSR_GEODELINK_ERROR, + &(df_state->msr_error)); + msr_read64(MSR_DEVICE_GEODELX_DF, MSR_GEODELINK_PM, &(df_state->msr_pm)); + msr_read64(MSR_DEVICE_GEODELX_DF, MSR_GEODELINK_DIAG, + &(df_state->msr_diag)); + msr_read64(MSR_DEVICE_GEODELX_DF, DF_MBD_MSR_DIAG_DF, + &(df_state->msr_df_diag)); + msr_read64(MSR_DEVICE_GEODELX_DF, DF_MSR_PAD_SEL, + &(df_state->msr_pad_sel)); + + return CIM_STATUS_OK; +} + +/*--------------------------------------------------------------------------- + * df_restore_state + * + * This routine restores all persistent DF state information. + *--------------------------------------------------------------------------*/ + +int +df_restore_state(DF_SAVE_RESTORE * df_state) +{ + unsigned long i; + + /* CLEAR VCFG AND DCFG */ + + WRITE_VID32(DF_VIDEO_CONFIG, 0); + WRITE_VID32(DF_DISPLAY_CONFIG, 0); + + /* RESTORE DF MSRS */ + + msr_write64(MSR_DEVICE_GEODELX_DF, MSR_GEODELINK_CAP, + &(df_state->msr_cap)); + msr_write64(MSR_DEVICE_GEODELX_DF, MSR_GEODELINK_CONFIG, + &(df_state->msr_config)); + msr_write64(MSR_DEVICE_GEODELX_DF, MSR_GEODELINK_SMI, + &(df_state->msr_smi)); + msr_write64(MSR_DEVICE_GEODELX_DF, MSR_GEODELINK_ERROR, + &(df_state->msr_error)); + msr_write64(MSR_DEVICE_GEODELX_DF, MSR_GEODELINK_PM, &(df_state->msr_pm)); + msr_write64(MSR_DEVICE_GEODELX_DF, MSR_GEODELINK_DIAG, + &(df_state->msr_diag)); + msr_write64(MSR_DEVICE_GEODELX_DF, DF_MBD_MSR_DIAG_DF, + &(df_state->msr_df_diag)); + msr_write64(MSR_DEVICE_GEODELX_DF, DF_MSR_PAD_SEL, + &(df_state->msr_pad_sel)); + + /* RESTORE ALL DF REGISTERS */ + + WRITE_VID32(DF_VIDEO_X_POS, df_state->video_x); + WRITE_VID32(DF_VIDEO_Y_POS, df_state->video_y); + WRITE_VID32(DF_VIDEO_SCALER, df_state->video_scaler); + WRITE_VID32(DF_VIDEO_COLOR_KEY, df_state->video_color_key); + WRITE_VID32(DF_VIDEO_COLOR_MASK, df_state->video_color_mask); + WRITE_VID32(DF_SATURATION_LIMIT, df_state->sat_limit); + WRITE_VID32(DF_VID_MISC, df_state->vid_misc); + WRITE_VID32(DF_VIDEO_YSCALE, df_state->video_yscale); + WRITE_VID32(DF_VIDEO_XSCALE, df_state->video_xscale); + WRITE_VID32(DF_VID_ALPHA_CONTROL, df_state->vid_alpha_control); + WRITE_VID32(DF_CURSOR_COLOR_KEY, df_state->cursor_key); + WRITE_VID32(DF_CURSOR_COLOR_MASK, df_state->cursor_mask); + WRITE_VID32(DF_CURSOR_COLOR_1, df_state->cursor_color1); + WRITE_VID32(DF_CURSOR_COLOR_2, df_state->cursor_color2); + WRITE_VID32(DF_ALPHA_XPOS_1, df_state->alpha_xpos1); + WRITE_VID32(DF_ALPHA_YPOS_1, df_state->alpha_ypos1); + WRITE_VID32(DF_ALPHA_COLOR_1, df_state->alpha_color1); + WRITE_VID32(DF_ALPHA_CONTROL_1, df_state->alpha_control1); + WRITE_VID32(DF_ALPHA_XPOS_2, df_state->alpha_xpos2); + WRITE_VID32(DF_ALPHA_YPOS_2, df_state->alpha_ypos2); + WRITE_VID32(DF_ALPHA_COLOR_2, df_state->alpha_color2); + WRITE_VID32(DF_ALPHA_CONTROL_2, df_state->alpha_control1); + WRITE_VID32(DF_ALPHA_XPOS_3, df_state->alpha_xpos3); + WRITE_VID32(DF_ALPHA_YPOS_3, df_state->alpha_ypos3); + WRITE_VID32(DF_ALPHA_COLOR_3, df_state->alpha_color3); + WRITE_VID32(DF_ALPHA_CONTROL_3, df_state->alpha_control3); + WRITE_VID32(DF_VIDEO_REQUEST, df_state->vid_request); + WRITE_VID32(DF_VID_YPOS_EVEN, df_state->vid_ypos_even); + WRITE_VID32(DF_VID_ALPHA_Y_EVEN_1, df_state->alpha_ypos_even1); + WRITE_VID32(DF_VID_ALPHA_Y_EVEN_2, df_state->alpha_ypos_even2); + WRITE_VID32(DF_VID_ALPHA_Y_EVEN_3, df_state->alpha_ypos_even3); + WRITE_VID32(DF_VIDEO_PANEL_TIM1, df_state->panel_tim1); + WRITE_VID32(DF_VIDEO_PANEL_TIM2, df_state->panel_tim2); + WRITE_VID32(DF_POWER_MANAGEMENT, df_state->panel_pm); + WRITE_VID32(DF_DITHER_CONTROL, df_state->panel_dither); + + /* RESTORE DF PALETTE */ + + WRITE_VID32(DF_PALETTE_ADDRESS, 0); + for (i = 0; i < 256; i++) + WRITE_VID32(DF_PALETTE_DATA, df_state->palette[i]); + + /* RESTORE FILTER COEFFICIENTS */ + + for (i = 0; i < 512; i++) + WRITE_VID32(DF_COEFFICIENT_BASE + (i << 2), + df_state->coefficients[i]); + + /* RESTORE DCFG AND VCFG */ + + WRITE_VID32(DF_DISPLAY_CONFIG, df_state->dcfg); + WRITE_VID32(DF_VIDEO_CONFIG, df_state->vcfg); + + return CIM_STATUS_OK; +} + +/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + * CIMARRON DF READ ROUTINES + * These routines are included for use in diagnostics or when debugging. They + * can be optionally excluded from a project. + *++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ + +#if CIMARRON_INCLUDE_DF_READ_ROUTINES + +/*--------------------------------------------------------------------------- + * df_read_composite_crc + * + * This routine reads the CRC of the combination of graphics/video data. This + * CRC checks data immediately before the CRT DACs. + *--------------------------------------------------------------------------*/ + +unsigned long +df_read_composite_crc(int crc_source) +{ + Q_WORD msr_value; + unsigned long crc; + unsigned long interlaced; + unsigned long line, field; + unsigned long timeout = 1000; + + if (!(READ_REG32(DC3_DISPLAY_CFG) & DC3_DCFG_TGEN)) + return 0xFFFFFFFF; + + /* ENABLE 32-BIT CRCS */ + + msr_read64(MSR_DEVICE_GEODELX_DF, DF_MBD_MSR_DIAG_DF, &msr_value); + msr_value.low |= DF_DIAG_32BIT_CRC; + msr_write64(MSR_DEVICE_GEODELX_DF, DF_MBD_MSR_DIAG_DF, &msr_value); + + /* RESET THE CRC */ + + WRITE_VID32(DF_VID_CRC, 0); + + /* WAIT FOR THE RESET TO BE LATCHED */ + + while ((READ_VID32(DF_VID_CRC32) != 0x00000001) && timeout) + timeout--; + + /* WAIT FOR THE CORRECT FIELD */ + /* We use the VG line count and field indicator to determine when */ + /* to kick off a CRC. */ + + if (crc_source & DF_CRC_SOURCE_EVEN) + field = 0; + else + field = DC3_LNCNT_EVEN_FIELD; + + if ((interlaced = (READ_REG32(DC3_IRQ_FILT_CTL) & DC3_IRQFILT_INTL_EN))) { + /* WAIT FOR THE BEGINNING OF THE FIELD (LINE 1-5) */ + /* Note that we wait for the field to be odd when CRCing the even */ + /* field and vice versa. This is because the CRC will not begin */ + /* until the following field. */ + + do { + line = READ_REG32(DC3_LINE_CNT_STATUS); + } while ((line & DC3_LNCNT_EVEN_FIELD) != field || + ((line & DC3_LNCNT_V_LINE_CNT) >> 16) < 10 || + ((line & DC3_LNCNT_V_LINE_CNT) >> 16) > 15); + } else { + /* NON-INTERLACED - EVEN FIELD CRCS ARE INVALID */ + + if (crc_source & DF_CRC_SOURCE_EVEN) + return 0xFFFFFFFF; + } + + /* ENABLE THE CRC */ + + WRITE_VID32(DF_VID_CRC, 1); + + /* WAIT FOR THE CRC TO BE COMPLETED */ + + while (!(READ_VID32(DF_VID_CRC) & 4)) ; + + crc = READ_VID32(DF_VID_CRC32); + + return crc; +} + +/*--------------------------------------------------------------------------- + * df_read_composite_window_crc + * + * This routine reads the CRC of a rectangular subsection of the combination + * of graphics/video data. + *--------------------------------------------------------------------------*/ + +unsigned long +df_read_composite_window_crc(unsigned long x, unsigned long y, + unsigned long width, unsigned long height, int source) +{ + Q_WORD msr_value; + unsigned long interlaced; + unsigned long line, field; + unsigned long crc = 0; + unsigned long hsyncend, htotal, hsyncstart; + unsigned long vsyncend, vtotal, vsyncstart; + unsigned long hblankstart, hactive; + unsigned long vblankstart, vactive; + + hsyncend = ((READ_REG32(DC3_H_SYNC_TIMING) >> 16) & 0xFFF) + 1; + htotal = ((READ_REG32(DC3_H_ACTIVE_TIMING) >> 16) & 0xFFF) + 1; + hsyncstart = (READ_REG32(DC3_H_SYNC_TIMING) & 0xFFF) + 1; + hactive = (READ_REG32(DC3_H_ACTIVE_TIMING) & 0xFFF) + 1; + hblankstart = (READ_REG32(DC3_H_BLANK_TIMING) & 0xFFF) + 1; + if ((interlaced = (READ_REG32(DC3_IRQ_FILT_CTL) & DC3_IRQFILT_INTL_EN)) && + !(source & DF_CRC_SOURCE_EVEN)) { + vsyncend = ((READ_REG32(DC3_V_SYNC_EVEN) >> 16) & 0xFFF) + 1; + vtotal = ((READ_REG32(DC3_V_ACTIVE_EVEN) >> 16) & 0xFFF) + 1; + vsyncstart = (READ_REG32(DC3_V_SYNC_EVEN) & 0xFFF) + 1; + vactive = (READ_REG32(DC3_V_ACTIVE_EVEN) & 0xFFF) + 1; + vblankstart = (READ_REG32(DC3_V_BLANK_EVEN) & 0xFFF) + 1; + } else { + vsyncend = ((READ_REG32(DC3_V_SYNC_TIMING) >> 16) & 0xFFF) + 1; + vtotal = ((READ_REG32(DC3_V_ACTIVE_TIMING) >> 16) & 0xFFF) + 1; + vsyncstart = (READ_REG32(DC3_V_SYNC_TIMING) & 0xFFF) + 1; + vactive = (READ_REG32(DC3_V_ACTIVE_TIMING) & 0xFFF) + 1; + vblankstart = (READ_REG32(DC3_V_BLANK_TIMING) & 0xFFF) + 1; + } + + /* TIMINGS MUST BE ACTIVE */ + + if (!(READ_REG32(DC3_DISPLAY_CFG) & DC3_DCFG_TGEN)) + return 0xFFFFFFFF; + + /* DISABLE GLCP ACTIONS */ + + msr_value.low = 0; + msr_value.high = 0; + msr_write64(MSR_DEVICE_GEODELX_GLCP, GLCP_DIAGCTL, &msr_value); + + /* ENABLE HW CLOCK GATING AND SET GLCP CLOCK TO DOT CLOCK */ + + msr_value.low = 5; + msr_write64(MSR_DEVICE_GEODELX_GLCP, MSR_GEODELINK_PM, &msr_value); + msr_value.low = 0; + msr_write64(MSR_DEVICE_GEODELX_GLCP, GLCP_DBGCLKCTL, &msr_value); + msr_value.low = 3; + msr_write64(MSR_DEVICE_GEODELX_GLCP, GLCP_DBGCLKCTL, &msr_value); + + /* USE H4 FUNCTION A FOR HSYNC AND H4 FUNCTION B FOR NOT HSYNC */ + /* HSYNC is bit 30 for the DF */ + + msr_value.high = 0x00000001; + msr_value.low = 0xE0000FF0; + msr_write64(MSR_DEVICE_GEODELX_GLCP, GLCP_H0CTL + 4, &msr_value); + + /* USE H3 FUNCTION A FOR VSYNC AND H3 FUNCTION B FOR NOT VSYNC */ + /* VSYNC is bit 54 for VG and bit 29 for DF */ + + msr_value.high = 0x00000000; + msr_value.low = 0x001D55AA; + msr_write64(MSR_DEVICE_GEODELX_GLCP, GLCP_H0CTL + 3, &msr_value); + + /* M4 (XSTATE = 00 AND VSYNC HIGH) */ + /* Goto state 01 */ + /* Note: VSync = H3A */ + + msr_value.high = 0x00000001; + msr_value.low = 0x000000A0; + msr_write64(MSR_DEVICE_GEODELX_GLCP, GLCP_SETM0CTL + 4, &msr_value); + + /* N0 (XSTATE = 01 AND VSYNC LOW) */ + /* Goto state 02 */ + /* Note: VSync low = H3B */ + + msr_value.high = 0x00040000; + msr_value.low = 0x000000C0; + msr_write64(MSR_DEVICE_GEODELX_GLCP, GLCP_SETN0CTL, &msr_value); + + /* M5 (XSTATE = 10 AND VSYNC HIGH) */ + /* Goto state 11 */ + + msr_value.high = 0x00000001; + msr_value.low = 0x00000120; + msr_write64(MSR_DEVICE_GEODELX_GLCP, GLCP_SETM0CTL + 5, &msr_value); + + /* N1 (XSTATE = 10 and HSYNC LOW) */ + /* Increment H. Counter */ + /* Note: HSync = H4 */ + + msr_value.high = 0x00080000; + msr_value.low = 0x00000120; + msr_write64(MSR_DEVICE_GEODELX_GLCP, GLCP_SETN0CTL + 1, &msr_value); + + /* M0 (XSTATE = 10 and H. COUNTER == LIMIT) */ + /* Clear H. Counter and increment V. Counter */ + + msr_value.high = 0x00000000; + msr_value.low = 0x00000122; + msr_write64(MSR_DEVICE_GEODELX_GLCP, GLCP_SETM0CTL, &msr_value); + + /* N4 (XSTATE = 10 && CMP0 <= H. COUNTER <= CMP1 && CMP2 <= V. COUNTER + * <= CMP3) + * CRC into REGB + */ + + msr_value.high = 0x00000000; + msr_value.low = 0x10C20120; + msr_write64(MSR_DEVICE_GEODELX_GLCP, GLCP_SETN0CTL + 4, &msr_value); + + /* COMPARATOR 0 VALUE */ + /* Value = xstart + (htotal - hsync_end) - 1 */ + /* The value will be adjusted for a border if necessary */ + + msr_value.low = x + htotal - hsyncend - 1; + if (READ_REG32(DC3_DISPLAY_CFG) & DC3_DCFG_DCEN) + msr_value.low -= hblankstart - hactive; + msr_value.low--; + msr_write64(MSR_DEVICE_GEODELX_GLCP, GLCP_CMPVAL0, &msr_value); + + /* COMPARATOR 1 VALUE */ + /* Value = xstart + (htotal - hsync_end - 1) - 1 + width */ + + msr_value.low += width - 1; + msr_write64(MSR_DEVICE_GEODELX_GLCP, GLCP_CMPVAL0 + 2, &msr_value); + + /* COMPARATOR 2 VALUE */ + /* Value = ystart + vtotal - vsyncend */ + + msr_value.low = (y + vtotal - vsyncend) << 16; + if (READ_REG32(DC3_DISPLAY_CFG) & DC3_DCFG_DCEN) + msr_value.low -= (vblankstart - vactive) << 16; + msr_write64(MSR_DEVICE_GEODELX_GLCP, GLCP_CMPVAL0 + 4, &msr_value); + + /* COMPARATOR 3 VALUE */ + /* Value = ystart + vtotal - vsyncend + height - 1 */ + + msr_value.low += (height - 1) << 16; + msr_write64(MSR_DEVICE_GEODELX_GLCP, GLCP_CMPVAL0 + 6, &msr_value); + + /* COMPARATOR MASKS */ + /* Comparators 0 and 1 refer to lower 16 bits of RegB */ + + msr_value.low = 0x0000FFFF; + msr_write64(MSR_DEVICE_GEODELX_GLCP, GLCP_CMPMASK0, &msr_value); + msr_write64(MSR_DEVICE_GEODELX_GLCP, GLCP_CMPMASK0 + 2, &msr_value); + + /* Comparators 2 and 3 refer to upper 16 bits of RegB */ + + msr_value.low = 0xFFFF0000; + msr_write64(MSR_DEVICE_GEODELX_GLCP, GLCP_CMPMASK0 + 4, &msr_value); + msr_write64(MSR_DEVICE_GEODELX_GLCP, GLCP_CMPMASK0 + 6, &msr_value); + + /* SET REGB MASK */ + /* We set the mask such that all only 24 bits of data are CRCed */ + + msr_value.low = 0x00FFFFFF; + msr_write64(MSR_DEVICE_GEODELX_GLCP, GLCP_REGBMASK, &msr_value); + + /* SET REGA LIMITS */ + /* Lower counter uses htotal - sync_time - 1. */ + /* Upper counter is 0xFFFF to prevent rollover. */ + + msr_value.low = 0xFFFF0000 | (htotal - (hsyncend - hsyncstart) - 1); + msr_write64(MSR_DEVICE_GEODELX_GLCP, GLCP_REGAVAL, &msr_value); + + /* ACTIONS */ + + /* STATE 00->01 (SET 4M) */ + + msr_value.low = 0x000C0000; + msr_write64(MSR_DEVICE_GEODELX_GLCP, GLCP_ACTION0 + 14, &msr_value); + + /* STATE 01->10 (SET 0N) */ + + msr_value.low = 0x0000000A; + msr_write64(MSR_DEVICE_GEODELX_GLCP, GLCP_ACTION0 + 15, &msr_value); + + /* STATE 10->11 (SET 5M) */ + + msr_value.low = 0x00C00000; + msr_write64(MSR_DEVICE_GEODELX_GLCP, GLCP_ACTION0 + 16, &msr_value); + + /* CLEAR REGA WHEN TRANSITIONING TO STATE 10 */ + /* Do not clear RegB as the initial value must be 0x00000001 */ + + msr_value.low = 0x0000000A; + msr_write64(MSR_DEVICE_GEODELX_GLCP, GLCP_ACTION0, &msr_value); + + /* REGISTER ACTION 1 */ + /* CRC into RegB if cmp0 <= h.counter <= cmp1 && cmp2 <= v. counter < + * cmp3 && 7 xstate = 10 8 + * Increment h.counter if xstate = 10 and HSync is low. + */ + + msr_value.low = 0x000A00A0; + msr_write64(MSR_DEVICE_GEODELX_GLCP, GLCP_ACTION0 + 1, &msr_value); + + /* REGISTER ACTION 2 */ + /* Increment V. Counter in REGA */ + + msr_value.low = 0x0000000C; + msr_write64(MSR_DEVICE_GEODELX_GLCP, GLCP_ACTION0 + 2, &msr_value); + + /* SET REGB TO 0x00000001 */ + + msr_value.low = 0x00000001; + msr_write64(MSR_DEVICE_GEODELX_GLCP, GLCP_REGB, &msr_value); + + /* SET XSTATE TO 0 */ + + msr_value.low = 0x00000000; + msr_write64(MSR_DEVICE_GEODELX_GLCP, GLCP_XSTATE, &msr_value); + + /* CLEAR ALL OTHER ACTIONS */ + /* This prevents side-effects from previous accesses to the GLCP */ + /* debug logic. */ + + msr_value.low = 0x00000000; + msr_value.high = 0x00000000; + msr_write64(MSR_DEVICE_GEODELX_GLCP, GLCP_ACTION0 + 3, &msr_value); + msr_write64(MSR_DEVICE_GEODELX_GLCP, GLCP_ACTION0 + 4, &msr_value); + msr_write64(MSR_DEVICE_GEODELX_GLCP, GLCP_ACTION0 + 5, &msr_value); + msr_write64(MSR_DEVICE_GEODELX_GLCP, GLCP_ACTION0 + 6, &msr_value); + msr_write64(MSR_DEVICE_GEODELX_GLCP, GLCP_ACTION0 + 7, &msr_value); + msr_write64(MSR_DEVICE_GEODELX_GLCP, GLCP_ACTION0 + 8, &msr_value); + msr_write64(MSR_DEVICE_GEODELX_GLCP, GLCP_ACTION0 + 9, &msr_value); + msr_write64(MSR_DEVICE_GEODELX_GLCP, GLCP_ACTION0 + 10, &msr_value); + msr_write64(MSR_DEVICE_GEODELX_GLCP, GLCP_ACTION0 + 11, &msr_value); + msr_write64(MSR_DEVICE_GEODELX_GLCP, GLCP_ACTION0 + 12, &msr_value); + msr_write64(MSR_DEVICE_GEODELX_GLCP, GLCP_ACTION0 + 13, &msr_value); + msr_write64(MSR_DEVICE_GEODELX_GLCP, GLCP_ACTION0 + 17, &msr_value); + msr_write64(MSR_DEVICE_GEODELX_GLCP, GLCP_ACTION0 + 18, &msr_value); + msr_write64(MSR_DEVICE_GEODELX_GLCP, GLCP_ACTION0 + 19, &msr_value); + msr_write64(MSR_DEVICE_GEODELX_GLCP, GLCP_ACTION0 + 20, &msr_value); + + /* WAIT FOR THE CORRECT FIELD */ + /* We use the VG line count and field indicator to determine when */ + /* to kick off a CRC. */ + + if (source & DF_CRC_SOURCE_EVEN) + field = 0; + else + field = DC3_LNCNT_EVEN_FIELD; + + if (interlaced) { + /* WAIT FOR THE BEGINNING OF THE FIELD (LINE 1-5) */ + /* Note that we wait for the field to be odd when CRCing the even */ + /* field and vice versa. This is because the CRC will not begin */ + /* until the following field. */ + + do { + line = READ_REG32(DC3_LINE_CNT_STATUS); + } while ((line & DC3_LNCNT_EVEN_FIELD) != field || + ((line & DC3_LNCNT_V_LINE_CNT) >> 16) < 1 || + ((line & DC3_LNCNT_V_LINE_CNT) >> 16) > 5); + } else { + /* NON-INTERLACED - EVEN FIELD CRCS ARE INVALID */ + + if (source & DF_CRC_SOURCE_EVEN) + return 0xFFFFFFFF; + } + + /* CONFIGURE DISPLAY FILTER TO LOAD DATA ONTO LOWER 32-BITS */ + + msr_value.high = 0; + msr_value.low = 0x0000800B; + msr_write64(MSR_DEVICE_GEODELX_DF, MSR_GEODELINK_DIAG, &msr_value); + + /* CONFIGURE DIAG CONTROL */ + /* Set RegA action1 to increment lower 16 bits and clear at limit. (5) + * Set RegA action2 to increment upper 16 bits. (6) + * Set RegB action1 to CRC32 (1) + * Set all comparators to REGA override (0,1 lower mbus, 2,3 upper mbus) + * Enable all actions + */ + + msr_value.low = 0x80EA20A0; + msr_write64(MSR_DEVICE_GEODELX_GLCP, GLCP_DIAGCTL, &msr_value); + + /* DELAY TWO FRAMES */ + + while (READ_REG32(DC3_LINE_CNT_STATUS) & DC3_LNCNT_VNA) ; + while (!(READ_REG32(DC3_LINE_CNT_STATUS) & DC3_LNCNT_VNA)) ; + while (READ_REG32(DC3_LINE_CNT_STATUS) & DC3_LNCNT_VNA) ; + while (!(READ_REG32(DC3_LINE_CNT_STATUS) & DC3_LNCNT_VNA)) ; + while (READ_REG32(DC3_LINE_CNT_STATUS) & DC3_LNCNT_VNA) ; + + /* VERIFY THAT XSTATE = 11 */ + + msr_read64(MSR_DEVICE_GEODELX_GLCP, GLCP_XSTATE, &msr_value); + if ((msr_value.low & 3) == 3) { + msr_read64(MSR_DEVICE_GEODELX_GLCP, GLCP_REGB, &msr_value); + + crc = msr_value.low; + } + + /* DISABLE DF DIAG BUS OUTPUTS */ + + msr_value.low = 0x00000000; + msr_value.high = 0x00000000; + msr_write64(MSR_DEVICE_GEODELX_DF, MSR_GEODELINK_DIAG, &msr_value); + + /* DISABLE GLCP ACTIONS */ + + msr_write64(MSR_DEVICE_GEODELX_GLCP, GLCP_DIAGCTL, &msr_value); + + return crc; +} + +/*--------------------------------------------------------------------------- + * df_read_panel_crc + * + * This routine reads the CRC for a frame of data after the panel dithering + * logic. + *--------------------------------------------------------------------------*/ + +unsigned long +df_read_panel_crc(void) +{ + Q_WORD msr_value; + unsigned long timeout = 1000; + + if (!(READ_REG32(DC3_DISPLAY_CFG) & DC3_DCFG_TGEN)) + return 0xFFFFFFFF; + + /* ENABLE 32-BIT CRCS */ + + msr_read64(MSR_DEVICE_GEODELX_DF, DF_MBD_MSR_DIAG_DF, &msr_value); + msr_value.low |= DF_DIAG_32BIT_CRC; + msr_write64(MSR_DEVICE_GEODELX_DF, DF_MBD_MSR_DIAG_DF, &msr_value); + + /* RESET CRC */ + + WRITE_VID32(DF_PANEL_CRC, 0); + + /* WAIT FOR THE RESET TO BE LATCHED */ + + while ((READ_VID32(DF_PANEL_CRC32) != 0x00000001) && timeout) + timeout--; + + WRITE_VID32(DF_PANEL_CRC, 1); + + /* WAIT FOR THE CRC TO BE COMPLETED */ + + while (!(READ_VID32(DF_PANEL_CRC) & 4)) ; + + return READ_VID32(DF_PANEL_CRC32); +} + +/*--------------------------------------------------------------------------- + * df_get_video_enable + * + * This routine reads the enable status of the video overlay. + *--------------------------------------------------------------------------*/ + +int +df_get_video_enable(int *enable, unsigned long *flags) +{ + *enable = 0; + *flags = 0; + if (READ_VID32(DF_VIDEO_CONFIG) & DF_VCFG_VID_EN) { + *enable = 1; + + /* CHECK FOR COLOR KEY DISABLED */ + /* Color keying can be completely disabled when video is enabled to */ + /* allow unhindered per-pixel alpha blending. As color keying is */ + /* always disabled when video is disabled, it is only possible to */ + /* test for this condition when video is enabled. */ + + if (!(READ_VID32(DF_DISPLAY_CONFIG) & DF_DCFG_VG_CK) && + !(READ_REG32(DC3_COLOR_KEY) & DC3_CLR_KEY_ENABLE)) { + *flags = DF_ENABLEFLAG_NOCOLORKEY; + } + } + + return CIM_STATUS_OK; +} + +/*--------------------------------------------------------------------------- + * df_get_video_source_configuration + * + * This routine reads the current configuration of the source buffers for the + * video overlay. + *--------------------------------------------------------------------------*/ + +int +df_get_video_source_configuration(DF_VIDEO_SOURCE_PARAMS * video_source_odd, + DF_VIDEO_SOURCE_PARAMS * video_source_even) +{ + unsigned long format, temp; + unsigned long size; + + /* READ VIDEO FORMAT */ + + temp = READ_VID32(DF_VIDEO_CONFIG); + + format = (temp >> 2) & 3; + if (temp & DF_VCFG_4_2_0_MODE) + format |= 4; + else if (READ_VID32(DF_VID_ALPHA_CONTROL) & DF_VIDEO_INPUT_IS_RGB) + format |= 8; + video_source_odd->video_format = format; + + /* CHECK IF SOURCE IS HD VIDEO */ + + if (READ_VID32(DF_VID_ALPHA_CONTROL) & DF_HD_VIDEO) + video_source_odd->flags = DF_SOURCEFLAG_HDTVSOURCE; + else + video_source_odd->flags = 0; + + /* READ SCALING ALGORITHM */ + + if (READ_VID32(DF_VID_MISC) & DF_USER_IMPLICIT_SCALING) + video_source_odd->flags |= DF_SOURCEFLAG_IMPLICITSCALING; + + /* READ VIDEO PITCH */ + + temp = READ_REG32(DC3_VID_YUV_PITCH); + video_source_odd->y_pitch = (temp & 0xFFFF) << 3; + video_source_odd->uv_pitch = (temp >> 16) << 3; + + /* READ VIDEO SIZE */ + + temp = READ_VID32(DF_VIDEO_CONFIG); + size = (temp >> 8) & 0xFF; + if (temp & DF_VCFG_LINE_SIZE_BIT8) + size |= 0x100; + if (temp & DF_VCFG_LINE_SIZE_BIT9) + size |= 0x200; + + video_source_odd->width = size << 1; + video_source_odd->height = READ_VID32(DF_VIDEO_SCALER) & 0x7FF; + + /* READ VIDEO OFFSETS */ + + video_source_odd->y_offset = READ_REG32(DC3_VID_Y_ST_OFFSET) & 0xFFFFFFF; + video_source_odd->u_offset = READ_REG32(DC3_VID_U_ST_OFFSET) & 0xFFFFFFF; + video_source_odd->v_offset = READ_REG32(DC3_VID_V_ST_OFFSET) & 0xFFFFFFF; + + if (READ_REG32(DC3_IRQ_FILT_CTL) & DC3_IRQFILT_INTL_EN) { + video_source_even->y_offset = + READ_REG32(DC3_VID_EVEN_Y_ST_OFFSET) & 0xFFFFFFF; + video_source_even->u_offset = + READ_REG32(DC3_VID_EVEN_U_ST_OFFSET) & 0xFFFFFFF; + video_source_even->v_offset = + READ_REG32(DC3_VID_EVEN_V_ST_OFFSET) & 0xFFFFFFF; + } + + return CIM_STATUS_OK; +} + +/*--------------------------------------------------------------------------- + * df_get_video_position + * + * This routine reads the current position of the video overlay. + *--------------------------------------------------------------------------*/ + +int +df_get_video_position(DF_VIDEO_POSITION * video_window) +{ + unsigned long xreg, yreg, dst_clip, clip; + unsigned long height; + unsigned long xend, yend; + unsigned long hsyncend, htotal; + unsigned long vsyncend, vtotal; + unsigned long hadjust, vadjust; + unsigned long misc, gfxscale; + unsigned long temp; + long xstart, ystart; + + video_window->flags = DF_POSFLAG_DIRECTCLIP; + + hsyncend = ((READ_REG32(DC3_H_SYNC_TIMING) >> 16) & 0xFFF) + 1; + htotal = ((READ_REG32(DC3_H_ACTIVE_TIMING) >> 16) & 0xFFF) + 1; + + /* ODD FIELD START COUNTS FROM THE EVEN FIELD TIMINGS */ + /* We assume that the even field y position is always programmed */ + /* to be just after the odd field. */ + + if (READ_REG32(DC3_IRQ_FILT_CTL) & DC3_IRQFILT_INTL_EN) { + vsyncend = ((READ_REG32(DC3_V_SYNC_EVEN) >> 16) & 0xFFF) + 1; + vtotal = ((READ_REG32(DC3_V_ACTIVE_EVEN) >> 16) & 0xFFF) + 1; + } else { + vsyncend = ((READ_REG32(DC3_V_SYNC_TIMING) >> 16) & 0xFFF) + 1; + vtotal = ((READ_REG32(DC3_V_ACTIVE_TIMING) >> 16) & 0xFFF) + 1; + } + + hadjust = htotal - hsyncend - 14; + vadjust = vtotal - vsyncend + 1; + + xreg = READ_VID32(DF_VIDEO_X_POS); + yreg = READ_VID32(DF_VIDEO_Y_POS); + + xstart = (xreg & 0xFFF) - hadjust; + ystart = (yreg & 0x7FF) - vadjust; + xend = ((xreg >> 16) & 0xFFF) - hadjust; + yend = ((yreg >> 16) & 0x7FF) - vadjust; + + height = yend - ystart; + + if (READ_REG32(DC3_IRQ_FILT_CTL) & DC3_IRQFILT_INTL_EN) { + /* Y COORDINATE IS ACTUALLY 2X THE ODD FIELD START */ + + ystart <<= 1; + + /* CALCULATE THE EXACT VIDEO HEIGHT */ + /* The height of the video window is the sum of the */ + /* odd and even field heights. */ + + yreg = READ_VID32(DF_VID_YPOS_EVEN); + height += ((yreg >> 16) & 0x7FF) - (yreg & 0x7FF); + } + + clip = ((READ_VID32(DF_VIDEO_CONFIG) >> 16) & 0x1FF) << 2; + + /* ADJUST FOR CLIPPING VALUES THAT ARE NOT FOUR-PIXEL ALIGNED */ + + dst_clip = 0; + if (xstart < 0) { + dst_clip += -xstart; + xstart = 0; + } + + /* REVERSE THE GRAPHICS SCALE */ + + misc = READ_VID32(DF_VID_MISC); + if (misc & DF_USER_IMPLICIT_SCALING) { + gfxscale = READ_REG32(DC3_GFX_SCALE); + + if (gfxscale != 0x40004000) { + temp = ystart + height; + temp = (temp * (gfxscale >> 16)) / 0x4000; + + xstart = (xstart * (gfxscale & 0xFFFF)) / 0x4000; + xend = (xend * (gfxscale & 0xFFFF)) / 0x4000; + ystart = (ystart * (gfxscale >> 16)) / 0x4000; + height = temp - ystart; + } + } + + video_window->left_clip = clip; + video_window->dst_clip = dst_clip; + video_window->x = xstart; + video_window->y = ystart; + video_window->width = xend - xstart; + video_window->height = height; + + return CIM_STATUS_OK; +} + +/*--------------------------------------------------------------------------- + * df_get_video_scale + * + * This routine reads the current scale values for video scaling. + *--------------------------------------------------------------------------*/ + +int +df_get_video_scale(unsigned long *x_scale, unsigned long *y_scale) +{ + *x_scale = READ_VID32(DF_VIDEO_XSCALE) & 0x000FFFFF; + *y_scale = READ_VID32(DF_VIDEO_YSCALE) & 0x000FFFFF; + return CIM_STATUS_OK; +} + +/*--------------------------------------------------------------------------- + * df_get_video_filter_coefficients + * + * This routine reads the coefficients for the video scaler/filter. + *--------------------------------------------------------------------------*/ + +int +df_get_video_filter_coefficients(long taps[][4], int *phase256) +{ + unsigned long i, temp; + long coeff; + + if (READ_VID32(DF_VIDEO_SCALER) & DF_SCALE_128_PHASES) + *phase256 = 0; + else + *phase256 = 1; + + for (i = 0; i < 256; i++) { + temp = READ_VID32(DF_COEFFICIENT_BASE + (i << 3)); + + /* TAP 0 */ + + coeff = temp & 0x7FFF; + if (temp & 0x8000) + coeff = -coeff; + taps[i][0] = coeff; + + /* TAP 1 */ + + temp >>= 16; + coeff = temp & 0x7FFF; + if (temp & 0x8000) + coeff = -coeff; + taps[i][1] = coeff; + + temp = READ_VID32(DF_COEFFICIENT_BASE + (i << 3) + 4); + + /* TAP 2 */ + + coeff = temp & 0x7FFF; + if (temp & 0x8000) + coeff = -coeff; + taps[i][2] = coeff; + + /* TAP 3 */ + + temp >>= 16; + coeff = temp & 0x7FFF; + if (temp & 0x8000) + coeff = -coeff; + taps[i][3] = coeff; + } + + return CIM_STATUS_OK; +} + +/*--------------------------------------------------------------------------- + * df_get_video_color_key + * + * This routine reads the current settings for hardware color/chroma keying. + *--------------------------------------------------------------------------*/ + +int +df_get_video_color_key(unsigned long *key, unsigned long *mask, int *graphics) +{ + unsigned long chroma = READ_VID32(DF_DISPLAY_CONFIG) & DF_DCFG_VG_CK; + + if (chroma) { + /* CHROMA KEY - READ KEY AND MASK FROM DF */ + + *graphics = 0; + *key = READ_VID32(DF_VIDEO_COLOR_KEY) & 0xFFFFFF; + *mask = READ_VID32(DF_VIDEO_COLOR_MASK) & 0xFFFFFF; + } else { + *graphics = 1; + + *key = READ_REG32(DC3_COLOR_KEY) & 0xFFFFFF; + *mask = READ_REG32(DC3_COLOR_MASK) & 0xFFFFFF; + } + + return CIM_STATUS_OK; +} + +/*--------------------------------------------------------------------------- + * df_get_video_palette_entry + * + * This routine returns a single palette entry. + *--------------------------------------------------------------------------*/ + +int +df_get_video_palette_entry(unsigned long index, unsigned long *palette) +{ + if (index > 0xFF) + return CIM_STATUS_INVALIDPARAMS; + + /* READ A SINGLE ENTRY */ + + WRITE_VID32(DF_PALETTE_ADDRESS, index); + *palette = READ_VID32(DF_PALETTE_DATA); + + return CIM_STATUS_OK; +} + +/*--------------------------------------------------------------------------- + * df_get_video_palette + * + * This routine returns the entire video palette. + *--------------------------------------------------------------------------*/ + +int +df_get_video_palette(unsigned long *palette) +{ + unsigned long i; + + WRITE_VID32(DF_PALETTE_ADDRESS, 0); + for (i = 0; i < 256; i++) + palette[i] = READ_VID32(DF_PALETTE_DATA); + + return CIM_STATUS_OK; +} + +/*--------------------------------------------------------------------------- + * df_get_video_cursor_color_key + * + * This routine returns the current configuration for the hardware video cursor + * color key. + *--------------------------------------------------------------------------*/ + +int +df_get_video_cursor_color_key(DF_VIDEO_CURSOR_PARAMS * cursor_color_key) +{ + unsigned long key; + + cursor_color_key->flags = 0; + cursor_color_key->color1 = READ_VID32(DF_CURSOR_COLOR_1) & 0xFFFFFF; + cursor_color_key->color2 = READ_VID32(DF_CURSOR_COLOR_2) & 0xFFFFFF; + cursor_color_key->mask = READ_VID32(DF_CURSOR_COLOR_MASK) & 0xFFFFFF; + + key = READ_VID32(DF_CURSOR_COLOR_KEY); + cursor_color_key->key = key & 0xFFFFFF; + cursor_color_key->select_color2 = (key >> 24) & 0x1F; + + return CIM_STATUS_OK; +} + +/*--------------------------------------------------------------------------- + * df_get_video_cursor_color_key_enable + * + * This routine returns the current enable status of the hardware video cursor + * color key. + *--------------------------------------------------------------------------*/ + +int +df_get_video_cursor_color_key_enable(void) +{ + if (READ_VID32(DF_CURSOR_COLOR_KEY) & DF_CURSOR_COLOR_KEY_ENABLE) + return 1; + + return 0; +} + +/*--------------------------------------------------------------------------- + * df_get_alpha_window_configuration + * + * This routine reads the current configuration for one of the three hardware + * alpha regions. + *--------------------------------------------------------------------------*/ + +int +df_get_alpha_window_configuration(int window, + DF_ALPHA_REGION_PARAMS * alpha_data) +{ + unsigned long pos, color, alpha_ctl; + unsigned long hsyncend, htotal; + unsigned long vsyncend, vtotal; + unsigned long hadjust, vadjust; + unsigned long xreg, yreg; + unsigned long misc, gfxscale; + unsigned long temp; + char delta; + + if (window > 2) + return CIM_STATUS_INVALIDPARAMS; + + hsyncend = ((READ_REG32(DC3_H_SYNC_TIMING) >> 16) & 0xFFF) + 1; + htotal = ((READ_REG32(DC3_H_ACTIVE_TIMING) >> 16) & 0xFFF) + 1; + if (READ_REG32(DC3_IRQ_FILT_CTL) & DC3_IRQFILT_INTL_EN) { + vtotal = ((READ_REG32(DC3_V_ACTIVE_EVEN) >> 16) & 0xFFF) + 1; + vsyncend = ((READ_REG32(DC3_V_SYNC_EVEN) >> 16) & 0xFFF) + 1; + } else { + vtotal = ((READ_REG32(DC3_V_ACTIVE_TIMING) >> 16) & 0xFFF) + 1; + vsyncend = ((READ_REG32(DC3_V_SYNC_TIMING) >> 16) & 0xFFF) + 1; + } + + /* GET PRIORITY */ + + pos = 16 + (window << 1); + alpha_data->priority = (READ_VID32(DF_VID_ALPHA_CONTROL) >> pos) & 3L; + + /* GET ALPHA WINDOW */ + + hadjust = htotal - hsyncend - 2; + vadjust = vtotal - vsyncend + 1; + + xreg = READ_VID32(DF_ALPHA_XPOS_1 + (window << 5)); + yreg = READ_VID32(DF_ALPHA_YPOS_1 + (window << 5)); + alpha_data->width = ((xreg >> 16) & 0xFFF) - (xreg & 0xFFF); + alpha_data->height = ((yreg >> 16) & 0x7FF) - (yreg & 0x7FF); + alpha_data->x = (xreg & 0xFFF) - hadjust; + alpha_data->y = (yreg & 0x7FF) - vadjust; + + /* REVERSE THE GRAPHICS SCALE */ + + misc = READ_VID32(DF_VID_MISC); + if (misc & DF_USER_IMPLICIT_SCALING) { + gfxscale = READ_REG32(DC3_GFX_SCALE); + if (gfxscale != 0x40004000) { + temp = alpha_data->y + alpha_data->height; + temp = (temp * (gfxscale >> 16)) / 0x4000; + + alpha_data->x = (alpha_data->x * (gfxscale & 0xFFFF)) / 0x4000; + alpha_data->width = + (alpha_data->width * (gfxscale & 0xFFFF)) / 0x4000; + alpha_data->y = (alpha_data->y * (gfxscale >> 16)) / 0x4000; + alpha_data->height = temp - alpha_data->y; + } + } + + if (READ_REG32(DC3_IRQ_FILT_CTL) & DC3_IRQFILT_INTL_EN) { + /* Y COORDINATE IS ACTUALLY 2X THE ODD FIELD START */ + + alpha_data->y <<= 1; + + /* CALCULATE THE EXACT VIDEO HEIGHT */ + /* The height of the video window is the sum of the */ + /* odd and even field heights. */ + + yreg = READ_VID32(DF_VID_ALPHA_Y_EVEN_1 + (window << 3)); + alpha_data->height += ((yreg >> 16) & 0x7FF) - (yreg & 0x7FF); + } + + /* GET COLOR REGISTER */ + + color = READ_VID32(DF_ALPHA_COLOR_1 + (window << 5)); + alpha_data->color = color & 0xFFFFFF; + if (color & DF_ALPHA_COLOR_ENABLE) + alpha_data->flags = DF_ALPHAFLAG_COLORENABLED; + else + alpha_data->flags = 0; + + /* GET ALPHA VALUE, DELTA AND PER PIXEL */ + + alpha_ctl = READ_VID32(DF_ALPHA_CONTROL_1 + (window << 5)); + alpha_data->alpha_value = alpha_ctl & 0xFF; + if (alpha_ctl & DF_ACTRL_PERPIXEL_EN) + alpha_data->flags |= DF_ALPHAFLAG_PERPIXELENABLED; + + delta = (char)((alpha_ctl >> 8) & 0xFF); + alpha_data->delta = (long)delta; + return CIM_STATUS_OK; +} + +/*--------------------------------------------------------------------------- + * df_get_alpha_window_enable + * + * This routine reads the current enable status of one of the three hardware + * alpha regions. + *--------------------------------------------------------------------------*/ + +int +df_get_alpha_window_enable(int window) +{ + if (window > 2) + return 0; + + if (READ_VID32(DF_ALPHA_CONTROL_1 + (window << 5)) & DF_ACTRL_WIN_ENABLE) + return 1; + + return 0; +} + +/*--------------------------------------------------------------------------- + * df_get_video_request + * + * This routine reads the horizontal (pixel) and vertical (line) video request + * values. + *--------------------------------------------------------------------------*/ + +int +df_get_video_request(unsigned long *x, unsigned long *y) +{ + unsigned long request; + unsigned long hsyncend, htotal; + unsigned long vsyncend, vtotal; + + hsyncend = ((READ_REG32(DC3_H_SYNC_TIMING) >> 16) & 0xFFF) + 1; + vsyncend = ((READ_REG32(DC3_V_SYNC_TIMING) >> 16) & 0xFFF) + 1; + htotal = ((READ_REG32(DC3_H_ACTIVE_TIMING) >> 16) & 0xFFF) + 1; + vtotal = ((READ_REG32(DC3_V_ACTIVE_TIMING) >> 16) & 0xFFF) + 1; + + request = READ_VID32(DF_VIDEO_REQUEST); + *x = ((request >> 16) & 0xFFF) - (htotal - hsyncend - 2); + *y = (request & 0x7FF) - (vtotal - vsyncend + 1); + + return CIM_STATUS_OK; +} + +/*--------------------------------------------------------------------------- + * df_get_output_color_space + * + * This routine sets the color space used when combining graphics and video. + *--------------------------------------------------------------------------*/ + +int +df_get_output_color_space(int *color_space) +{ + unsigned long alpha_ctl; + + alpha_ctl = READ_VID32(DF_VID_ALPHA_CONTROL); + + if ((alpha_ctl & DF_CSC_VIDEO_YUV_TO_RGB) || + !(alpha_ctl & DF_CSC_GRAPHICS_RGB_TO_YUV)) { + if (alpha_ctl & DF_ALPHA_DRGB) + *color_space = DF_OUTPUT_ARGB; + else + *color_space = DF_OUTPUT_RGB; + } else { + *color_space = DF_OUTPUT_SDTV; + + if (alpha_ctl & DF_HD_GRAPHICS) + *color_space = DF_OUTPUT_HDTV; + } + + return CIM_STATUS_OK; +} + +#endif diff --git a/driver/xf86-video-geode/src/cim/cim_filter.c b/driver/xf86-video-geode/src/cim/cim_filter.c new file mode 100644 index 000000000..87c1bf62e --- /dev/null +++ b/driver/xf86-video-geode/src/cim/cim_filter.c @@ -0,0 +1,547 @@ +/* + * Copyright (c) 2006 Advanced Micro Devices, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + * Neither the name of the Advanced Micro Devices, Inc. nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + */ + + /* + * Cimarron default video coefficients. + */ + +long CimarronVideoFilter256[][2] = { + {0x10000000, 0x00000000}, /* 0, 4096, 0, 0 */ + {0x10008008, 0x00000008}, /* -8, 4096, 8, 0 */ + {0x10008010, 0x80010011}, /* -16, 4096, 17, -1 */ + {0x10008019, 0x8001001A}, /* -25, 4096, 26, -1 */ + {0x10008021, 0x80020023}, /* -33, 4096, 35, -2 */ + {0x0FFF8029, 0x8003002D}, /* -41, 4095, 45, -3 */ + {0x0FFE8031, 0x80030036}, /* -49, 4094, 54, -3 */ + {0x0FFC8038, 0x80040040}, /* -56, 4092, 64, -4 */ + {0x0FFB8040, 0x8005004A}, /* -64, 4091, 74, -5 */ + {0x0FF88047, 0x80050054}, /* -71, 4088, 84, -5 */ + {0x0FF6804E, 0x8006005E}, /* -78, 4086, 94, -6 */ + {0x0FF48055, 0x80070068}, /* -85, 4084, 104, -7 */ + {0x0FF0805C, 0x80070073}, /* -92, 4080, 115, -7 */ + {0x0FEE8063, 0x8008007D}, /* -99, 4078, 125, -8 */ + {0x0FEA8069, 0x80090088}, /* -105, 4074, 136, -9 */ + {0x0FE78070, 0x800A0093}, /* -112, 4071, 147, -10 */ + {0x0FE28076, 0x800A009E}, /* -118, 4066, 158, -10 */ + {0x0FDD807C, 0x800B00AA}, /* -124, 4061, 170, -11 */ + {0x0FD98082, 0x800C00B5}, /* -130, 4057, 181, -12 */ + {0x0FD48088, 0x800D00C1}, /* -136, 4052, 193, -13 */ + {0x0FCE808E, 0x800D00CD}, /* -142, 4046, 205, -13 */ + {0x0FC88093, 0x800E00D9}, /* -147, 4040, 217, -14 */ + {0x0FC38099, 0x800F00E5}, /* -153, 4035, 229, -15 */ + {0x0FBD809E, 0x801000F1}, /* -158, 4029, 241, -16 */ + {0x0FB680A3, 0x801000FD}, /* -163, 4022, 253, -16 */ + {0x0FAF80A8, 0x8011010A}, /* -168, 4015, 266, -17 */ + {0x0FA880AD, 0x80120117}, /* -173, 4008, 279, -18 */ + {0x0FA180B2, 0x80130124}, /* -178, 4001, 292, -19 */ + {0x0F9980B6, 0x80140131}, /* -182, 3993, 305, -20 */ + {0x0F9280BB, 0x8015013E}, /* -187, 3986, 318, -21 */ + {0x0F8880BF, 0x8015014C}, /* -191, 3976, 332, -21 */ + {0x0F8080C3, 0x80160159}, /* -195, 3968, 345, -22 */ + {0x0F7880C8, 0x80170167}, /* -200, 3960, 359, -23 */ + {0x0F6E80CB, 0x80180175}, /* -203, 3950, 373, -24 */ + {0x0F6580CF, 0x80190183}, /* -207, 3941, 387, -25 */ + {0x0F5C80D3, 0x801A0191}, /* -211, 3932, 401, -26 */ + {0x0F5280D7, 0x801B01A0}, /* -215, 3922, 416, -27 */ + {0x0F4880DA, 0x801C01AE}, /* -218, 3912, 430, -28 */ + {0x0F3D80DD, 0x801D01BD}, /* -221, 3901, 445, -29 */ + {0x0F3280E0, 0x801E01CC}, /* -224, 3890, 460, -30 */ + {0x0F2880E4, 0x801F01DB}, /* -228, 3880, 475, -31 */ + {0x0F1C80E6, 0x802001EA}, /* -230, 3868, 490, -32 */ + {0x0F1180E9, 0x802101F9}, /* -233, 3857, 505, -33 */ + {0x0F0480EB, 0x80210208}, /* -235, 3844, 520, -33 */ + {0x0EFA80EF, 0x80230218}, /* -239, 3834, 536, -35 */ + {0x0EEC80F0, 0x80230227}, /* -240, 3820, 551, -35 */ + {0x0EE080F3, 0x80240237}, /* -243, 3808, 567, -36 */ + {0x0ED380F5, 0x80250247}, /* -245, 3795, 583, -37 */ + {0x0EC780F7, 0x80270257}, /* -247, 3783, 599, -39 */ + {0x0EB980F9, 0x80280268}, /* -249, 3769, 616, -40 */ + {0x0EAC80FB, 0x80290278}, /* -251, 3756, 632, -41 */ + {0x0E9E80FD, 0x802A0289}, /* -253, 3742, 649, -42 */ + {0x0E9080FE, 0x802B0299}, /* -254, 3728, 665, -43 */ + {0x0E838100, 0x802D02AA}, /* -256, 3715, 682, -45 */ + {0x0E758102, 0x802E02BB}, /* -258, 3701, 699, -46 */ + {0x0E668103, 0x802F02CC}, /* -259, 3686, 716, -47 */ + {0x0E568104, 0x803002DE}, /* -260, 3670, 734, -48 */ + {0x0E498106, 0x803202EF}, /* -262, 3657, 751, -50 */ + {0x0E398107, 0x80330301}, /* -263, 3641, 769, -51 */ + {0x0E298108, 0x80340313}, /* -264, 3625, 787, -52 */ + {0x0E1A8109, 0x80360325}, /* -265, 3610, 805, -54 */ + {0x0E0B810A, 0x80370336}, /* -266, 3595, 822, -55 */ + {0x0DFA810A, 0x80380348}, /* -266, 3578, 840, -56 */ + {0x0DEA810B, 0x803A035B}, /* -267, 3562, 859, -58 */ + {0x0DDA810C, 0x803B036D}, /* -268, 3546, 877, -59 */ + {0x0DCA810C, 0x803D037F}, /* -268, 3530, 895, -61 */ + {0x0DB7810B, 0x803E0392}, /* -267, 3511, 914, -62 */ + {0x0DA7810C, 0x804003A5}, /* -268, 3495, 933, -64 */ + {0x0D95810C, 0x804103B8}, /* -268, 3477, 952, -65 */ + {0x0D85810C, 0x804303CA}, /* -268, 3461, 970, -67 */ + {0x0D73810C, 0x804403DD}, /* -268, 3443, 989, -68 */ + {0x0D61810C, 0x804603F1}, /* -268, 3425, 1009, -70 */ + {0x0D50810C, 0x80480404}, /* -268, 3408, 1028, -72 */ + {0x0D3E810C, 0x80490417}, /* -268, 3390, 1047, -73 */ + {0x0D2C810C, 0x804B042B}, /* -268, 3372, 1067, -75 */ + {0x0D1B810C, 0x804D043E}, /* -268, 3355, 1086, -77 */ + {0x0D07810B, 0x804E0452}, /* -267, 3335, 1106, -78 */ + {0x0CF5810B, 0x80500466}, /* -267, 3317, 1126, -80 */ + {0x0CE2810A, 0x8052047A}, /* -266, 3298, 1146, -82 */ + {0x0CCF810A, 0x8053048E}, /* -266, 3279, 1166, -83 */ + {0x0CBC8109, 0x805504A2}, /* -265, 3260, 1186, -85 */ + {0x0CA98108, 0x805704B6}, /* -264, 3241, 1206, -87 */ + {0x0C968108, 0x805904CB}, /* -264, 3222, 1227, -89 */ + {0x0C838107, 0x805B04DF}, /* -263, 3203, 1247, -91 */ + {0x0C6F8106, 0x805C04F3}, /* -262, 3183, 1267, -92 */ + {0x0C5B8105, 0x805E0508}, /* -261, 3163, 1288, -94 */ + {0x0C478104, 0x8060051D}, /* -260, 3143, 1309, -96 */ + {0x0C348103, 0x80620531}, /* -259, 3124, 1329, -98 */ + {0x0C1F8102, 0x80640547}, /* -258, 3103, 1351, -100 */ + {0x0C0C8101, 0x8066055B}, /* -257, 3084, 1371, -102 */ + {0x0BF88100, 0x80680570}, /* -256, 3064, 1392, -104 */ + {0x0BE380FE, 0x806A0585}, /* -254, 3043, 1413, -106 */ + {0x0BCF80FD, 0x806C059A}, /* -253, 3023, 1434, -108 */ + {0x0BBA80FC, 0x806E05B0}, /* -252, 3002, 1456, -110 */ + {0x0BA480F9, 0x807005C5}, /* -249, 2980, 1477, -112 */ + {0x0B8F80F8, 0x807205DB}, /* -248, 2959, 1499, -114 */ + {0x0B7A80F6, 0x807405F0}, /* -246, 2938, 1520, -116 */ + {0x0B6580F5, 0x80760606}, /* -245, 2917, 1542, -118 */ + {0x0B4F80F3, 0x8077061B}, /* -243, 2895, 1563, -119 */ + {0x0B3A80F2, 0x80790631}, /* -242, 2874, 1585, -121 */ + {0x0B2480F0, 0x807B0647}, /* -240, 2852, 1607, -123 */ + {0x0B0F80EE, 0x807D065C}, /* -238, 2831, 1628, -125 */ + {0x0AF980ED, 0x807F0673}, /* -237, 2809, 1651, -127 */ + {0x0AE480EB, 0x80810688}, /* -235, 2788, 1672, -129 */ + {0x0ACE80E9, 0x8084069F}, /* -233, 2766, 1695, -132 */ + {0x0AB980E7, 0x808606B4}, /* -231, 2745, 1716, -134 */ + {0x0AA380E6, 0x808806CB}, /* -230, 2723, 1739, -136 */ + {0x0A8D80E4, 0x808A06E1}, /* -228, 2701, 1761, -138 */ + {0x0A7780E2, 0x808C06F7}, /* -226, 2679, 1783, -140 */ + {0x0A6180E0, 0x808E070D}, /* -224, 2657, 1805, -142 */ + {0x0A4B80DE, 0x80910724}, /* -222, 2635, 1828, -145 */ + {0x0A3580DC, 0x8093073A}, /* -220, 2613, 1850, -147 */ + {0x0A1F80DA, 0x80950750}, /* -218, 2591, 1872, -149 */ + {0x0A0880D8, 0x80970767}, /* -216, 2568, 1895, -151 */ + {0x09F280D6, 0x8099077D}, /* -214, 2546, 1917, -153 */ + {0x09DD80D4, 0x809C0793}, /* -212, 2525, 1939, -156 */ + {0x09C680D2, 0x809E07AA}, /* -210, 2502, 1962, -158 */ + {0x09B080D0, 0x80A007C0}, /* -208, 2480, 1984, -160 */ + {0x099980CE, 0x80A207D7}, /* -206, 2457, 2007, -162 */ + {0x098380CB, 0x80A507ED}, /* -203, 2435, 2029, -165 */ + {0x096C80C9, 0x80A70804}, /* -201, 2412, 2052, -167 */ + {0x095680C7, 0x80A9081A}, /* -199, 2390, 2074, -169 */ + {0x094080C5, 0x80AB0830}, /* -197, 2368, 2096, -171 */ + {0x092980C3, 0x80AE0848}, /* -195, 2345, 2120, -174 */ + {0x091380C1, 0x80B0085E}, /* -193, 2323, 2142, -176 */ + {0x08FC80BE, 0x80B20874}, /* -190, 2300, 2164, -178 */ + {0x08E580BC, 0x80B4088B}, /* -188, 2277, 2187, -180 */ + {0x08D080BB, 0x80B708A2}, /* -187, 2256, 2210, -183 */ + {0x08B980B9, 0x80B908B9}, /* -185, 2233, 2233, -185 */ + {0x08A380B7, 0x80BB08CF}, /* -183, 2211, 2255, -187 */ + {0x088B80B4, 0x80BC08E5}, /* -180, 2187, 2277, -188 */ + {0x087480B2, 0x80BE08FC}, /* -178, 2164, 2300, -190 */ + {0x085E80B0, 0x80C10913}, /* -176, 2142, 2323, -193 */ + {0x084880AE, 0x80C30929}, /* -174, 2120, 2345, -195 */ + {0x083080AB, 0x80C50940}, /* -171, 2096, 2368, -197 */ + {0x081A80A9, 0x80C70956}, /* -169, 2074, 2390, -199 */ + {0x080480A7, 0x80C9096C}, /* -167, 2052, 2412, -201 */ + {0x07ED80A5, 0x80CB0983}, /* -165, 2029, 2435, -203 */ + {0x07D780A2, 0x80CE0999}, /* -162, 2007, 2457, -206 */ + {0x07C080A0, 0x80D009B0}, /* -160, 1984, 2480, -208 */ + {0x07AA809E, 0x80D209C6}, /* -158, 1962, 2502, -210 */ + {0x0793809C, 0x80D409DD}, /* -156, 1939, 2525, -212 */ + {0x077D8099, 0x80D609F2}, /* -153, 1917, 2546, -214 */ + {0x07668097, 0x80D80A09}, /* -151, 1894, 2569, -216 */ + {0x074F8095, 0x80DA0A20}, /* -149, 1871, 2592, -218 */ + {0x073A8093, 0x80DC0A35}, /* -147, 1850, 2613, -220 */ + {0x07238091, 0x80DE0A4C}, /* -145, 1827, 2636, -222 */ + {0x070C808E, 0x80E00A62}, /* -142, 1804, 2658, -224 */ + {0x06F7808C, 0x80E20A77}, /* -140, 1783, 2679, -226 */ + {0x06E0808A, 0x80E40A8E}, /* -138, 1760, 2702, -228 */ + {0x06CA8088, 0x80E60AA4}, /* -136, 1738, 2724, -230 */ + {0x06B48086, 0x80E70AB9}, /* -134, 1716, 2745, -231 */ + {0x069E8084, 0x80E90ACF}, /* -132, 1694, 2767, -233 */ + {0x06878081, 0x80EB0AE5}, /* -129, 1671, 2789, -235 */ + {0x0672807F, 0x80ED0AFA}, /* -127, 1650, 2810, -237 */ + {0x065C807D, 0x80EE0B0F}, /* -125, 1628, 2831, -238 */ + {0x0646807B, 0x80F00B25}, /* -123, 1606, 2853, -240 */ + {0x06308079, 0x80F20B3B}, /* -121, 1584, 2875, -242 */ + {0x061A8077, 0x80F30B50}, /* -119, 1562, 2896, -243 */ + {0x06068076, 0x80F50B65}, /* -118, 1542, 2917, -245 */ + {0x05F08074, 0x80F60B7A}, /* -116, 1520, 2938, -246 */ + {0x05DB8072, 0x80F80B8F}, /* -114, 1499, 2959, -248 */ + {0x05C58070, 0x80F90BA4}, /* -112, 1477, 2980, -249 */ + {0x05B1806E, 0x80FC0BB9}, /* -110, 1457, 3001, -252 */ + {0x059B806C, 0x80FD0BCE}, /* -108, 1435, 3022, -253 */ + {0x0586806A, 0x80FE0BE2}, /* -106, 1414, 3042, -254 */ + {0x05718068, 0x81000BF7}, /* -104, 1393, 3063, -256 */ + {0x055C8066, 0x81010C0B}, /* -102, 1372, 3083, -257 */ + {0x05478064, 0x81020C1F}, /* -100, 1351, 3103, -258 */ + {0x05328062, 0x81030C33}, /* -98, 1330, 3123, -259 */ + {0x051D8060, 0x81040C47}, /* -96, 1309, 3143, -260 */ + {0x0508805E, 0x81050C5B}, /* -94, 1288, 3163, -261 */ + {0x04F3805C, 0x81060C6F}, /* -92, 1267, 3183, -262 */ + {0x04E0805B, 0x81070C82}, /* -91, 1248, 3202, -263 */ + {0x04CB8059, 0x81080C96}, /* -89, 1227, 3222, -264 */ + {0x04B68057, 0x81080CA9}, /* -87, 1206, 3241, -264 */ + {0x04A28055, 0x81090CBC}, /* -85, 1186, 3260, -265 */ + {0x048E8053, 0x810A0CCF}, /* -83, 1166, 3279, -266 */ + {0x047A8052, 0x810A0CE2}, /* -82, 1146, 3298, -266 */ + {0x04668050, 0x810B0CF5}, /* -80, 1126, 3317, -267 */ + {0x0451804E, 0x810B0D08}, /* -78, 1105, 3336, -267 */ + {0x043E804D, 0x810C0D1B}, /* -77, 1086, 3355, -268 */ + {0x042B804B, 0x810C0D2C}, /* -75, 1067, 3372, -268 */ + {0x04178049, 0x810C0D3E}, /* -73, 1047, 3390, -268 */ + {0x04038048, 0x810C0D51}, /* -72, 1027, 3409, -268 */ + {0x03F08046, 0x810C0D62}, /* -70, 1008, 3426, -268 */ + {0x03DD8044, 0x810C0D73}, /* -68, 989, 3443, -268 */ + {0x03CA8043, 0x810C0D85}, /* -67, 970, 3461, -268 */ + {0x03B78041, 0x810C0D96}, /* -65, 951, 3478, -268 */ + {0x03A48040, 0x810C0DA8}, /* -64, 932, 3496, -268 */ + {0x0391803E, 0x810B0DB8}, /* -62, 913, 3512, -267 */ + {0x0380803D, 0x810C0DC9}, /* -61, 896, 3529, -268 */ + {0x036D803B, 0x810C0DDA}, /* -59, 877, 3546, -268 */ + {0x035B803A, 0x810B0DEA}, /* -58, 859, 3562, -267 */ + {0x03488038, 0x810A0DFA}, /* -56, 840, 3578, -266 */ + {0x03368037, 0x810A0E0B}, /* -55, 822, 3595, -266 */ + {0x03248036, 0x81090E1B}, /* -54, 804, 3611, -265 */ + {0x03128034, 0x81080E2A}, /* -52, 786, 3626, -264 */ + {0x03018033, 0x81070E39}, /* -51, 769, 3641, -263 */ + {0x02EF8032, 0x81060E49}, /* -50, 751, 3657, -262 */ + {0x02DE8030, 0x81040E56}, /* -48, 734, 3670, -260 */ + {0x02CC802F, 0x81030E66}, /* -47, 716, 3686, -259 */ + {0x02BB802E, 0x81020E75}, /* -46, 699, 3701, -258 */ + {0x02AA802D, 0x81000E83}, /* -45, 682, 3715, -256 */ + {0x0299802B, 0x80FE0E90}, /* -43, 665, 3728, -254 */ + {0x0288802A, 0x80FD0E9F}, /* -42, 648, 3743, -253 */ + {0x02778029, 0x80FB0EAD}, /* -41, 631, 3757, -251 */ + {0x02678028, 0x80F90EBA}, /* -40, 615, 3770, -249 */ + {0x02568027, 0x80F70EC8}, /* -39, 598, 3784, -247 */ + {0x02468025, 0x80F50ED4}, /* -37, 582, 3796, -245 */ + {0x02368024, 0x80F30EE1}, /* -36, 566, 3809, -243 */ + {0x02268023, 0x80F00EED}, /* -35, 550, 3821, -240 */ + {0x02188023, 0x80EF0EFA}, /* -35, 536, 3834, -239 */ + {0x02078021, 0x80EB0F05}, /* -33, 519, 3845, -235 */ + {0x01F98021, 0x80E90F11}, /* -33, 505, 3857, -233 */ + {0x01EA8020, 0x80E60F1C}, /* -32, 490, 3868, -230 */ + {0x01DC801F, 0x80E40F27}, /* -31, 476, 3879, -228 */ + {0x01CD801E, 0x80E00F31}, /* -30, 461, 3889, -224 */ + {0x01BE801D, 0x80DD0F3C}, /* -29, 446, 3900, -221 */ + {0x01AF801C, 0x80DA0F47}, /* -28, 431, 3911, -218 */ + {0x01A1801B, 0x80D70F51}, /* -27, 417, 3921, -215 */ + {0x0192801A, 0x80D30F5B}, /* -26, 402, 3931, -211 */ + {0x01848019, 0x80CF0F64}, /* -25, 388, 3940, -207 */ + {0x01768018, 0x80CB0F6D}, /* -24, 374, 3949, -203 */ + {0x01688017, 0x80C80F77}, /* -23, 360, 3959, -200 */ + {0x015A8016, 0x80C30F7F}, /* -22, 346, 3967, -195 */ + {0x014D8015, 0x80BF0F87}, /* -21, 333, 3975, -191 */ + {0x013F8015, 0x80BB0F91}, /* -21, 319, 3985, -187 */ + {0x01328014, 0x80B60F98}, /* -20, 306, 3992, -182 */ + {0x01258013, 0x80B20FA0}, /* -19, 293, 4000, -178 */ + {0x01188012, 0x80AD0FA7}, /* -18, 280, 4007, -173 */ + {0x010B8011, 0x80A80FAE}, /* -17, 267, 4014, -168 */ + {0x00FE8010, 0x80A30FB5}, /* -16, 254, 4021, -163 */ + {0x00F28010, 0x809E0FBC}, /* -16, 242, 4028, -158 */ + {0x00E6800F, 0x80990FC2}, /* -15, 230, 4034, -153 */ + {0x00DA800E, 0x80930FC7}, /* -14, 218, 4039, -147 */ + {0x00CE800D, 0x808E0FCD}, /* -13, 206, 4045, -142 */ + {0x00C2800D, 0x80880FD3}, /* -13, 194, 4051, -136 */ + {0x00B6800C, 0x80820FD8}, /* -12, 182, 4056, -130 */ + {0x00AB800B, 0x807C0FDC}, /* -11, 171, 4060, -124 */ + {0x009F800A, 0x80760FE1}, /* -10, 159, 4065, -118 */ + {0x0094800A, 0x80700FE6}, /* -10, 148, 4070, -112 */ + {0x00898009, 0x80690FE9}, /* -9, 137, 4073, -105 */ + {0x007E8008, 0x80630FED}, /* -8, 126, 4077, -99 */ + {0x00748007, 0x805C0FEF}, /* -7, 116, 4079, -92 */ + {0x00698007, 0x80550FF3}, /* -7, 105, 4083, -85 */ + {0x005F8006, 0x804E0FF5}, /* -6, 95, 4085, -78 */ + {0x00558005, 0x80470FF7}, /* -5, 85, 4087, -71 */ + {0x004B8005, 0x80400FFA}, /* -5, 75, 4090, -64 */ + {0x00418004, 0x80380FFB}, /* -4, 65, 4091, -56 */ + {0x00378003, 0x80310FFD}, /* -3, 55, 4093, -49 */ + {0x002E8003, 0x80290FFE}, /* -3, 46, 4094, -41 */ + {0x00238002, 0x80211000}, /* -2, 35, 4096, -33 */ + {0x001A8001, 0x80191000}, /* -1, 26, 4096, -25 */ + {0x00118001, 0x80101000}, /* -1, 17, 4096, -16 */ + {0x00080000, 0x80081000}, /* 0, 8, 4096, -8 */ +}; + +long CimarronVideoFilter128[][2] = { + {0x10000000, 0x00000000}, /* 0, 4096, 0, 0 */ + {0x10018011, 0x80010011}, /* -17, 4097, 17, -1 */ + {0x10008021, 0x80020023}, /* -33, 4096, 35, -2 */ + {0x0FFE8031, 0x80030036}, /* -49, 4094, 54, -3 */ + {0x0FFB8040, 0x8005004A}, /* -64, 4091, 74, -5 */ + {0x0FF6804E, 0x8006005E}, /* -78, 4086, 94, -6 */ + {0x0FF0805C, 0x80070073}, /* -92, 4080, 115, -7 */ + {0x0FEB806A, 0x80090088}, /* -106, 4075, 136, -9 */ + {0x0FE18076, 0x800A009F}, /* -118, 4065, 159, -10 */ + {0x0FD98082, 0x800C00B5}, /* -130, 4057, 181, -12 */ + {0x0FCE808E, 0x800D00CD}, /* -142, 4046, 205, -13 */ + {0x0FC38099, 0x800F00E5}, /* -153, 4035, 229, -15 */ + {0x0FB680A4, 0x801000FE}, /* -164, 4022, 254, -16 */ + {0x0FA880AD, 0x80120117}, /* -173, 4008, 279, -18 */ + {0x0F9A80B7, 0x80140131}, /* -183, 3994, 305, -20 */ + {0x0F8980C0, 0x8015014C}, /* -192, 3977, 332, -21 */ + {0x0F7880C8, 0x80170167}, /* -200, 3960, 359, -23 */ + {0x0F6680D0, 0x80190183}, /* -208, 3942, 387, -25 */ + {0x0F5280D7, 0x801B01A0}, /* -215, 3922, 416, -27 */ + {0x0F3E80DE, 0x801D01BD}, /* -222, 3902, 445, -29 */ + {0x0F2880E4, 0x801F01DB}, /* -228, 3880, 475, -31 */ + {0x0F1180EA, 0x802101FA}, /* -234, 3857, 506, -33 */ + {0x0EF880EE, 0x80220218}, /* -238, 3832, 536, -34 */ + {0x0EDF80F3, 0x80240238}, /* -243, 3807, 568, -36 */ + {0x0EC680F7, 0x80270258}, /* -247, 3782, 600, -39 */ + {0x0EAB80FB, 0x80290279}, /* -251, 3755, 633, -41 */ + {0x0E9080FF, 0x802B029A}, /* -255, 3728, 666, -43 */ + {0x0E748102, 0x802E02BC}, /* -258, 3700, 700, -46 */ + {0x0E588105, 0x803102DE}, /* -261, 3672, 734, -49 */ + {0x0E388107, 0x80330302}, /* -263, 3640, 770, -51 */ + {0x0E1A8109, 0x80360325}, /* -265, 3610, 805, -54 */ + {0x0DFB810B, 0x80390349}, /* -267, 3579, 841, -57 */ + {0x0DDB810C, 0x803C036D}, /* -268, 3547, 877, -60 */ + {0x0DBA810D, 0x803F0392}, /* -269, 3514, 914, -63 */ + {0x0D98810E, 0x804203B8}, /* -270, 3480, 952, -66 */ + {0x0D74810D, 0x804503DE}, /* -269, 3444, 990, -69 */ + {0x0D50810D, 0x80480405}, /* -269, 3408, 1029, -72 */ + {0x0D2C810C, 0x804B042B}, /* -268, 3372, 1067, -75 */ + {0x0D08810C, 0x804F0453}, /* -268, 3336, 1107, -79 */ + {0x0CE3810B, 0x8052047A}, /* -267, 3299, 1146, -82 */ + {0x0CBD810A, 0x805604A3}, /* -266, 3261, 1187, -86 */ + {0x0C968108, 0x805904CB}, /* -264, 3222, 1227, -89 */ + {0x0C708107, 0x805D04F4}, /* -263, 3184, 1268, -93 */ + {0x0C488105, 0x8061051E}, /* -261, 3144, 1310, -97 */ + {0x0C208103, 0x80640547}, /* -259, 3104, 1351, -100 */ + {0x0BF78100, 0x80680571}, /* -256, 3063, 1393, -104 */ + {0x0BCF80FE, 0x806C059B}, /* -254, 3023, 1435, -108 */ + {0x0BA480FA, 0x807005C6}, /* -250, 2980, 1478, -112 */ + {0x0B7A80F7, 0x807405F1}, /* -247, 2938, 1521, -116 */ + {0x0B4F80F4, 0x8077061C}, /* -244, 2895, 1564, -119 */ + {0x0B2580F1, 0x807C0648}, /* -241, 2853, 1608, -124 */ + {0x0AFA80ED, 0x80800673}, /* -237, 2810, 1651, -128 */ + {0x0ACF80EA, 0x8084069F}, /* -234, 2767, 1695, -132 */ + {0x0AA380E6, 0x808806CB}, /* -230, 2723, 1739, -136 */ + {0x0A7880E2, 0x808D06F7}, /* -226, 2680, 1783, -141 */ + {0x0A4C80DF, 0x80910724}, /* -223, 2636, 1828, -145 */ + {0x0A2080DB, 0x80960751}, /* -219, 2592, 1873, -150 */ + {0x09F480D7, 0x809A077D}, /* -215, 2548, 1917, -154 */ + {0x09C780D2, 0x809F07AA}, /* -210, 2503, 1962, -159 */ + {0x099A80CE, 0x80A307D7}, /* -206, 2458, 2007, -163 */ + {0x096D80CA, 0x80A70804}, /* -202, 2413, 2052, -167 */ + {0x094180C6, 0x80AC0831}, /* -198, 2369, 2097, -172 */ + {0x091380C1, 0x80B0085E}, /* -193, 2323, 2142, -176 */ + {0x08E780BE, 0x80B5088C}, /* -190, 2279, 2188, -181 */ + {0x08B980B9, 0x80B908B9}, /* -185, 2233, 2233, -185 */ + {0x088C80B5, 0x80BE08E7}, /* -181, 2188, 2279, -190 */ + {0x085E80B0, 0x80C10913}, /* -176, 2142, 2323, -193 */ + {0x083180AC, 0x80C60941}, /* -172, 2097, 2369, -198 */ + {0x080480A7, 0x80CA096D}, /* -167, 2052, 2413, -202 */ + {0x07D780A3, 0x80CE099A}, /* -163, 2007, 2458, -206 */ + {0x07AA809F, 0x80D209C7}, /* -159, 1962, 2503, -210 */ + {0x077D809A, 0x80D709F4}, /* -154, 1917, 2548, -215 */ + {0x07518096, 0x80DB0A20}, /* -150, 1873, 2592, -219 */ + {0x07248091, 0x80DF0A4C}, /* -145, 1828, 2636, -223 */ + {0x06F7808D, 0x80E20A78}, /* -141, 1783, 2680, -226 */ + {0x06CA8088, 0x80E60AA4}, /* -136, 1738, 2724, -230 */ + {0x069E8084, 0x80EA0AD0}, /* -132, 1694, 2768, -234 */ + {0x06738080, 0x80ED0AFA}, /* -128, 1651, 2810, -237 */ + {0x0647807C, 0x80F10B26}, /* -124, 1607, 2854, -241 */ + {0x061B8077, 0x80F40B50}, /* -119, 1563, 2896, -244 */ + {0x05F18074, 0x80F70B7A}, /* -116, 1521, 2938, -247 */ + {0x05C68070, 0x80FA0BA4}, /* -112, 1478, 2980, -250 */ + {0x059C806C, 0x80FE0BCE}, /* -108, 1436, 3022, -254 */ + {0x05728068, 0x81000BF6}, /* -104, 1394, 3062, -256 */ + {0x05478064, 0x81030C20}, /* -100, 1351, 3104, -259 */ + {0x051E8061, 0x81050C48}, /* -97, 1310, 3144, -261 */ + {0x04F4805D, 0x81070C70}, /* -93, 1268, 3184, -263 */ + {0x04CB8059, 0x81080C96}, /* -89, 1227, 3222, -264 */ + {0x04A38056, 0x810A0CBD}, /* -86, 1187, 3261, -266 */ + {0x047A8052, 0x810B0CE3}, /* -82, 1146, 3299, -267 */ + {0x0453804F, 0x810C0D08}, /* -79, 1107, 3336, -268 */ + {0x042B804B, 0x810C0D2C}, /* -75, 1067, 3372, -268 */ + {0x04048048, 0x810D0D51}, /* -72, 1028, 3409, -269 */ + {0x03DE8045, 0x810D0D74}, /* -69, 990, 3444, -269 */ + {0x03B88042, 0x810E0D98}, /* -66, 952, 3480, -270 */ + {0x0393803F, 0x810D0DB9}, /* -63, 915, 3513, -269 */ + {0x036E803C, 0x810C0DDA}, /* -60, 878, 3546, -268 */ + {0x03498039, 0x810B0DFB}, /* -57, 841, 3579, -267 */ + {0x03258036, 0x81090E1A}, /* -54, 805, 3610, -265 */ + {0x03018033, 0x81070E39}, /* -51, 769, 3641, -263 */ + {0x02DE8031, 0x81050E58}, /* -49, 734, 3672, -261 */ + {0x02BC802E, 0x81020E74}, /* -46, 700, 3700, -258 */ + {0x0299802B, 0x80FF0E91}, /* -43, 665, 3729, -255 */ + {0x02788029, 0x80FB0EAC}, /* -41, 632, 3756, -251 */ + {0x02578027, 0x80F70EC7}, /* -39, 599, 3783, -247 */ + {0x02378024, 0x80F30EE0}, /* -36, 567, 3808, -243 */ + {0x02178022, 0x80EE0EF9}, /* -34, 535, 3833, -238 */ + {0x01FA8021, 0x80EA0F11}, /* -33, 506, 3857, -234 */ + {0x01DC801F, 0x80E40F27}, /* -31, 476, 3879, -228 */ + {0x01BE801D, 0x80DE0F3D}, /* -29, 446, 3901, -222 */ + {0x01A1801B, 0x80D70F51}, /* -27, 417, 3921, -215 */ + {0x01848019, 0x80D00F65}, /* -25, 388, 3941, -208 */ + {0x01688017, 0x80C80F77}, /* -23, 360, 3959, -200 */ + {0x014D8015, 0x80C00F88}, /* -21, 333, 3976, -192 */ + {0x01328014, 0x80B70F99}, /* -20, 306, 3993, -183 */ + {0x01188012, 0x80AD0FA7}, /* -18, 280, 4007, -173 */ + {0x00FF8010, 0x80A40FB5}, /* -16, 255, 4021, -164 */ + {0x00E6800F, 0x80990FC2}, /* -15, 230, 4034, -153 */ + {0x00CE800D, 0x808E0FCD}, /* -13, 206, 4045, -142 */ + {0x00B6800C, 0x80820FD8}, /* -12, 182, 4056, -130 */ + {0x00A0800A, 0x80760FE0}, /* -10, 160, 4064, -118 */ + {0x00898009, 0x806A0FEA}, /* -9, 137, 4074, -106 */ + {0x00748007, 0x805C0FEF}, /* -7, 116, 4079, -92 */ + {0x005F8006, 0x804E0FF5}, /* -6, 95, 4085, -78 */ + {0x004B8005, 0x80400FFA}, /* -5, 75, 4090, -64 */ + {0x00378003, 0x80310FFD}, /* -3, 55, 4093, -49 */ + {0x00238002, 0x80211000}, /* -2, 35, 4096, -33 */ + {0x00118001, 0x80111001}, /* -1, 17, 4097, -17 */ + {0x10000000, 0x00000000}, /* 0, 4096, 0, 0 */ + {0x10018011, 0x80010011}, /* -17, 4097, 17, -1 */ + {0x10008021, 0x80020023}, /* -33, 4096, 35, -2 */ + {0x0FFE8031, 0x80030036}, /* -49, 4094, 54, -3 */ + {0x0FFB8040, 0x8005004A}, /* -64, 4091, 74, -5 */ + {0x0FF6804E, 0x8006005E}, /* -78, 4086, 94, -6 */ + {0x0FF0805C, 0x80070073}, /* -92, 4080, 115, -7 */ + {0x0FEB806A, 0x80090088}, /* -106, 4075, 136, -9 */ + {0x0FE18076, 0x800A009F}, /* -118, 4065, 159, -10 */ + {0x0FD98082, 0x800C00B5}, /* -130, 4057, 181, -12 */ + {0x0FCE808E, 0x800D00CD}, /* -142, 4046, 205, -13 */ + {0x0FC38099, 0x800F00E5}, /* -153, 4035, 229, -15 */ + {0x0FB680A4, 0x801000FE}, /* -164, 4022, 254, -16 */ + {0x0FA880AD, 0x80120117}, /* -173, 4008, 279, -18 */ + {0x0F9A80B7, 0x80140131}, /* -183, 3994, 305, -20 */ + {0x0F8980C0, 0x8015014C}, /* -192, 3977, 332, -21 */ + {0x0F7880C8, 0x80170167}, /* -200, 3960, 359, -23 */ + {0x0F6680D0, 0x80190183}, /* -208, 3942, 387, -25 */ + {0x0F5280D7, 0x801B01A0}, /* -215, 3922, 416, -27 */ + {0x0F3E80DE, 0x801D01BD}, /* -222, 3902, 445, -29 */ + {0x0F2880E4, 0x801F01DB}, /* -228, 3880, 475, -31 */ + {0x0F1180EA, 0x802101FA}, /* -234, 3857, 506, -33 */ + {0x0EF880EE, 0x80220218}, /* -238, 3832, 536, -34 */ + {0x0EDF80F3, 0x80240238}, /* -243, 3807, 568, -36 */ + {0x0EC680F7, 0x80270258}, /* -247, 3782, 600, -39 */ + {0x0EAB80FB, 0x80290279}, /* -251, 3755, 633, -41 */ + {0x0E9080FF, 0x802B029A}, /* -255, 3728, 666, -43 */ + {0x0E748102, 0x802E02BC}, /* -258, 3700, 700, -46 */ + {0x0E588105, 0x803102DE}, /* -261, 3672, 734, -49 */ + {0x0E388107, 0x80330302}, /* -263, 3640, 770, -51 */ + {0x0E1A8109, 0x80360325}, /* -265, 3610, 805, -54 */ + {0x0DFB810B, 0x80390349}, /* -267, 3579, 841, -57 */ + {0x0DDB810C, 0x803C036D}, /* -268, 3547, 877, -60 */ + {0x0DBA810D, 0x803F0392}, /* -269, 3514, 914, -63 */ + {0x0D98810E, 0x804203B8}, /* -270, 3480, 952, -66 */ + {0x0D74810D, 0x804503DE}, /* -269, 3444, 990, -69 */ + {0x0D50810D, 0x80480405}, /* -269, 3408, 1029, -72 */ + {0x0D2C810C, 0x804B042B}, /* -268, 3372, 1067, -75 */ + {0x0D08810C, 0x804F0453}, /* -268, 3336, 1107, -79 */ + {0x0CE3810B, 0x8052047A}, /* -267, 3299, 1146, -82 */ + {0x0CBD810A, 0x805604A3}, /* -266, 3261, 1187, -86 */ + {0x0C968108, 0x805904CB}, /* -264, 3222, 1227, -89 */ + {0x0C708107, 0x805D04F4}, /* -263, 3184, 1268, -93 */ + {0x0C488105, 0x8061051E}, /* -261, 3144, 1310, -97 */ + {0x0C208103, 0x80640547}, /* -259, 3104, 1351, -100 */ + {0x0BF78100, 0x80680571}, /* -256, 3063, 1393, -104 */ + {0x0BCF80FE, 0x806C059B}, /* -254, 3023, 1435, -108 */ + {0x0BA480FA, 0x807005C6}, /* -250, 2980, 1478, -112 */ + {0x0B7A80F7, 0x807405F1}, /* -247, 2938, 1521, -116 */ + {0x0B4F80F4, 0x8077061C}, /* -244, 2895, 1564, -119 */ + {0x0B2580F1, 0x807C0648}, /* -241, 2853, 1608, -124 */ + {0x0AFA80ED, 0x80800673}, /* -237, 2810, 1651, -128 */ + {0x0ACF80EA, 0x8084069F}, /* -234, 2767, 1695, -132 */ + {0x0AA380E6, 0x808806CB}, /* -230, 2723, 1739, -136 */ + {0x0A7880E2, 0x808D06F7}, /* -226, 2680, 1783, -141 */ + {0x0A4C80DF, 0x80910724}, /* -223, 2636, 1828, -145 */ + {0x0A2080DB, 0x80960751}, /* -219, 2592, 1873, -150 */ + {0x09F480D7, 0x809A077D}, /* -215, 2548, 1917, -154 */ + {0x09C780D2, 0x809F07AA}, /* -210, 2503, 1962, -159 */ + {0x099A80CE, 0x80A307D7}, /* -206, 2458, 2007, -163 */ + {0x096D80CA, 0x80A70804}, /* -202, 2413, 2052, -167 */ + {0x094180C6, 0x80AC0831}, /* -198, 2369, 2097, -172 */ + {0x091380C1, 0x80B0085E}, /* -193, 2323, 2142, -176 */ + {0x08E780BE, 0x80B5088C}, /* -190, 2279, 2188, -181 */ + {0x08B980B9, 0x80B908B9}, /* -185, 2233, 2233, -185 */ + {0x088C80B5, 0x80BE08E7}, /* -181, 2188, 2279, -190 */ + {0x085E80B0, 0x80C10913}, /* -176, 2142, 2323, -193 */ + {0x083180AC, 0x80C60941}, /* -172, 2097, 2369, -198 */ + {0x080480A7, 0x80CA096D}, /* -167, 2052, 2413, -202 */ + {0x07D780A3, 0x80CE099A}, /* -163, 2007, 2458, -206 */ + {0x07AA809F, 0x80D209C7}, /* -159, 1962, 2503, -210 */ + {0x077D809A, 0x80D709F4}, /* -154, 1917, 2548, -215 */ + {0x07518096, 0x80DB0A20}, /* -150, 1873, 2592, -219 */ + {0x07248091, 0x80DF0A4C}, /* -145, 1828, 2636, -223 */ + {0x06F7808D, 0x80E20A78}, /* -141, 1783, 2680, -226 */ + {0x06CA8088, 0x80E60AA4}, /* -136, 1738, 2724, -230 */ + {0x069E8084, 0x80EA0AD0}, /* -132, 1694, 2768, -234 */ + {0x06738080, 0x80ED0AFA}, /* -128, 1651, 2810, -237 */ + {0x0647807C, 0x80F10B26}, /* -124, 1607, 2854, -241 */ + {0x061B8077, 0x80F40B50}, /* -119, 1563, 2896, -244 */ + {0x05F18074, 0x80F70B7A}, /* -116, 1521, 2938, -247 */ + {0x05C68070, 0x80FA0BA4}, /* -112, 1478, 2980, -250 */ + {0x059C806C, 0x80FE0BCE}, /* -108, 1436, 3022, -254 */ + {0x05728068, 0x81000BF6}, /* -104, 1394, 3062, -256 */ + {0x05478064, 0x81030C20}, /* -100, 1351, 3104, -259 */ + {0x051E8061, 0x81050C48}, /* -97, 1310, 3144, -261 */ + {0x04F4805D, 0x81070C70}, /* -93, 1268, 3184, -263 */ + {0x04CB8059, 0x81080C96}, /* -89, 1227, 3222, -264 */ + {0x04A38056, 0x810A0CBD}, /* -86, 1187, 3261, -266 */ + {0x047A8052, 0x810B0CE3}, /* -82, 1146, 3299, -267 */ + {0x0453804F, 0x810C0D08}, /* -79, 1107, 3336, -268 */ + {0x042B804B, 0x810C0D2C}, /* -75, 1067, 3372, -268 */ + {0x04048048, 0x810D0D51}, /* -72, 1028, 3409, -269 */ + {0x03DE8045, 0x810D0D74}, /* -69, 990, 3444, -269 */ + {0x03B88042, 0x810E0D98}, /* -66, 952, 3480, -270 */ + {0x0393803F, 0x810D0DB9}, /* -63, 915, 3513, -269 */ + {0x036E803C, 0x810C0DDA}, /* -60, 878, 3546, -268 */ + {0x03498039, 0x810B0DFB}, /* -57, 841, 3579, -267 */ + {0x03258036, 0x81090E1A}, /* -54, 805, 3610, -265 */ + {0x03018033, 0x81070E39}, /* -51, 769, 3641, -263 */ + {0x02DE8031, 0x81050E58}, /* -49, 734, 3672, -261 */ + {0x02BC802E, 0x81020E74}, /* -46, 700, 3700, -258 */ + {0x0299802B, 0x80FF0E91}, /* -43, 665, 3729, -255 */ + {0x02788029, 0x80FB0EAC}, /* -41, 632, 3756, -251 */ + {0x02578027, 0x80F70EC7}, /* -39, 599, 3783, -247 */ + {0x02378024, 0x80F30EE0}, /* -36, 567, 3808, -243 */ + {0x02178022, 0x80EE0EF9}, /* -34, 535, 3833, -238 */ + {0x01FA8021, 0x80EA0F11}, /* -33, 506, 3857, -234 */ + {0x01DC801F, 0x80E40F27}, /* -31, 476, 3879, -228 */ + {0x01BE801D, 0x80DE0F3D}, /* -29, 446, 3901, -222 */ + {0x01A1801B, 0x80D70F51}, /* -27, 417, 3921, -215 */ + {0x01848019, 0x80D00F65}, /* -25, 388, 3941, -208 */ + {0x01688017, 0x80C80F77}, /* -23, 360, 3959, -200 */ + {0x014D8015, 0x80C00F88}, /* -21, 333, 3976, -192 */ + {0x01328014, 0x80B70F99}, /* -20, 306, 3993, -183 */ + {0x01188012, 0x80AD0FA7}, /* -18, 280, 4007, -173 */ + {0x00FF8010, 0x80A40FB5}, /* -16, 255, 4021, -164 */ + {0x00E6800F, 0x80990FC2}, /* -15, 230, 4034, -153 */ + {0x00CE800D, 0x808E0FCD}, /* -13, 206, 4045, -142 */ + {0x00B6800C, 0x80820FD8}, /* -12, 182, 4056, -130 */ + {0x00A0800A, 0x80760FE0}, /* -10, 160, 4064, -118 */ + {0x00898009, 0x806A0FEA}, /* -9, 137, 4074, -106 */ + {0x00748007, 0x805C0FEF}, /* -7, 116, 4079, -92 */ + {0x005F8006, 0x804E0FF5}, /* -6, 95, 4085, -78 */ + {0x004B8005, 0x80400FFA}, /* -5, 75, 4090, -64 */ + {0x00378003, 0x80310FFD}, /* -3, 55, 4093, -49 */ + {0x00238002, 0x80211000}, /* -2, 35, 4096, -33 */ + {0x00118001, 0x80111001}, /* -1, 17, 4097, -17 */ +}; diff --git a/driver/xf86-video-geode/src/cim/cim_gp.c b/driver/xf86-video-geode/src/cim/cim_gp.c new file mode 100644 index 000000000..7c4bc5bee --- /dev/null +++ b/driver/xf86-video-geode/src/cim/cim_gp.c @@ -0,0 +1,3477 @@ +/* + * Copyright (c) 2006 Advanced Micro Devices, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + * Neither the name of the Advanced Micro Devices, Inc. nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + */ + + /* + * Cimarron graphics processor routines. These routines program the graphics + * hardware using the graphics command buffer. + */ + +/*---------------------*/ +/* CIMARRON GP GLOBALS */ +/*---------------------*/ + +CIMARRON_STATIC unsigned long gp3_bpp = 0; +CIMARRON_STATIC unsigned long gp3_ch3_bpp = 0; +CIMARRON_STATIC unsigned long gp3_pat_origin = 0; +CIMARRON_STATIC unsigned long gp3_buffer_lead = 0; +CIMARRON_STATIC unsigned long gp3_cmd_header; +CIMARRON_STATIC unsigned long gp3_cmd_top; +CIMARRON_STATIC unsigned long gp3_cmd_bottom; +CIMARRON_STATIC unsigned long gp3_cmd_current; +CIMARRON_STATIC unsigned long gp3_cmd_next; +CIMARRON_STATIC unsigned long gp3_blt_mode; +CIMARRON_STATIC unsigned long gp3_vec_mode; +CIMARRON_STATIC unsigned long gp3_raster_mode; +CIMARRON_STATIC unsigned long gp3_pix_shift; +CIMARRON_STATIC unsigned long gp3_ch3_pat; +CIMARRON_STATIC unsigned long gp3_blt; +CIMARRON_STATIC unsigned long gp3_blt_flags; +CIMARRON_STATIC unsigned long gp3_src_stride; +CIMARRON_STATIC unsigned long gp3_dst_stride; +CIMARRON_STATIC unsigned long gp3_src_format; +CIMARRON_STATIC unsigned long gp3_src_pix_shift; +CIMARRON_STATIC unsigned long gp3_pat_format; +CIMARRON_STATIC unsigned long gp3_pat_pix_shift; +CIMARRON_STATIC unsigned long gp3_fb_base; +CIMARRON_STATIC unsigned long gp3_vector_pattern_color; +CIMARRON_STATIC unsigned long gp3_scratch_base; +CIMARRON_STATIC unsigned long gp3_base_register; +CIMARRON_STATIC unsigned long gp3_vec_pat; + +/*--------------------------------------------------------------------------- + * gp_set_limit_on_buffer_lead + * + * This routine is used to specify the maximum number of bytes in the command + * buffer by which software can lead the graphics processor. When declaring + * a BLT with the CIMGP_BLTFLAGS_LIMITBUFFER flag set, Cimarron will wait + * until the command buffer read and write pointers differ by no more than + * 'lead' bytes. This can be useful to limit the time lag possible when + * creating a command buffer full of simple BLT commands. + *-------------------------------------------------------------------------*/ + +void +gp_set_limit_on_buffer_lead(unsigned long lead) +{ + gp3_buffer_lead = lead; +} + +/*--------------------------------------------------------------------------- + * gp_set_command_buffer_base + * + * This routine is used to program the command buffer region in physical + * memory. The command buffer start address must be 1MB aligned. start and + * stop refer to endpoints within the associated 16MB region. Command buffers + * larger than 16MB are not supported. + *-------------------------------------------------------------------------*/ + +void +gp_set_command_buffer_base(unsigned long address, unsigned long start, + unsigned long stop) +{ + Q_WORD msr_value; + + /* WAIT FOR IDLE */ + /* Obviously, we cannot change the command buffer pointer while the GP */ + /* is currently fetching commands. */ + + gp_wait_until_idle(); + + /* WRITE THE COMMAND BUFFER BASE */ + + msr_read64(MSR_DEVICE_GEODELX_GP, MSR_GEODELINK_CONFIG, &msr_value); + msr_value.low &= 0xF000FFFF; + msr_value.low |= (address >> 4) & 0x0FFF0000; + msr_write64(MSR_DEVICE_GEODELX_GP, MSR_GEODELINK_CONFIG, &msr_value); + + /* WRITE THE BASE OFFSETS */ + /* We also reset the write and read pointers. The hardware will */ + /* automatically update the write pointer when the read pointer */ + /* is updated to prevent the hardware from getting confused when */ + /* initializing a new command buffer. */ + + WRITE_GP32(GP3_CMD_TOP, start); + WRITE_GP32(GP3_CMD_BOT, stop); + WRITE_GP32(GP3_CMD_READ, start); + + /* SAVE THE BASE ADDRESSES */ + /* These are used to determine the appropriate wrap point. */ + + gp3_cmd_current = gp3_cmd_top = start; + gp3_cmd_bottom = stop; +} + +/*--------------------------------------------------------------------------- + * gp_set_frame_buffer_base + * + * This routine is used to program the base address of the frame buffer in + * physical memory. The frame buffer address must be 16MB aligned. Cimarron + * tracks the base address because the maximum frame buffer size may exceed + * 16MB. Any primitive will thus program the corresponding 16MB region into + * all base offset registers as well as program the offset into the 16MB + * region. The size parameter is provided to allow Cimarron to claim the + * last 1MB of space to be used as a scratch area for workarounds or + * expanded functionality. + *-------------------------------------------------------------------------*/ + +void +gp_set_frame_buffer_base(unsigned long address, unsigned long size) +{ + gp3_scratch_base = size - GP3_SCRATCH_BUFFER_SIZE; + gp3_fb_base = address >> 24; + gp3_base_register = + (gp3_fb_base << 24) | (gp3_fb_base << 14) | (gp3_fb_base << 4); + WRITE_GP32(GP3_BASE_OFFSET, gp3_base_register); +} + +/*--------------------------------------------------------------------------- + * gp_set_bpp + * + * This routine sets the output BPP of the GP. The BPP used by the GP does + * not have to match the display BPP, but that is usually the case. The + * supported BPP values are as follows: + * + * 8 - palettized 8BPP + * 12 - 4:4:4:4 + * 15 - 1:5:5:5 + * 16 - 0:5:6:5 + * 32 - 8:8:8:8 + *-------------------------------------------------------------------------*/ + +void +gp_set_bpp(int bpp) +{ + /* STORE BPP */ + /* The bpp is not updated until the next call to gp_set_raster_mode. */ + /* This allows the gp_set_bpp call to happen outside of a BLT. It */ + /* also implies that no registers need be written in this routine. */ + + switch (bpp) { + case 8: + gp3_bpp = GP3_RM_BPPFMT_332; + gp3_ch3_bpp = GP3_CH3_SRC_3_3_2; + gp3_pix_shift = 0; + break; + case 12: + gp3_bpp = GP3_RM_BPPFMT_4444; + gp3_ch3_bpp = GP3_CH3_SRC_4_4_4_4; + gp3_pix_shift = 1; + break; + case 15: + gp3_bpp = GP3_RM_BPPFMT_1555; + gp3_ch3_bpp = GP3_CH3_SRC_1_5_5_5; + gp3_pix_shift = 1; + break; + case 16: + gp3_bpp = GP3_RM_BPPFMT_565; + gp3_ch3_bpp = GP3_CH3_SRC_0_5_6_5; + gp3_pix_shift = 1; + break; + case 24: + case 32: + gp3_bpp = GP3_RM_BPPFMT_8888; + gp3_ch3_bpp = GP3_CH3_SRC_8_8_8_8; + gp3_pix_shift = 2; + break; + default: + gp3_bpp = GP3_RM_BPPFMT_332; + gp3_ch3_bpp = GP3_CH3_SRC_3_3_2; + gp3_pix_shift = 0; + break; + } +} + +/*--------------------------------------------------------------------------- + * gp_declare_blt + * + * This routine is used to prepare for a 2D BLT. Its primary function + * is to verify that enough room is available in the command buffer + * to hold a BLT command. This command can be called multiple times if + * necessary. For example, if a function calls this routine on entry, but + * later realizes that a LUT load command must be executed before the BLT, + * the application could call gp_set_color_pattern and then call + * gp_declare_blt to declare the BLT. This is possible because the hardware + * buffer pointer is not updated until a new BLT is actually executed. An + * application must take care not to call any routines that perform a buffer + * command, (such as gp_set_color_pattern) between gp_declare_blt and the + * routines used to program the BLT parameters. In addition to checking for + * available space, this routine also performs the following actions: + * - Sets the wrap bit if this BLT will pass close to the end of the + * buffer. + * - Writes the command header. + * + * The available flags are defined as follows: + * 0x01 - Preserve the LUT + * 0x02 - Preserve the color pattern. + * 0x04 - Enable prefetch. + *-------------------------------------------------------------------------*/ + +void +gp_declare_blt(unsigned long flags) +{ + unsigned long temp; + + gp3_blt = 1; + gp3_blt_flags = flags; + + /* SET ADDRESS OF NEXT COMMAND */ + /* A summary of the command buffer logic is as follows: */ + /* - If after a basic BLT we will not have room for the largest */ + /* command (a full line of host source data), we set the wrap */ + /* bit. This will waste up to a whopping 8K of command buffer */ + /* space, but it simplifies the logic for all commands. */ + /* - If we are wrapping, we have extra logic to ensure that we */ + /* don't skip over the current GP read pointer. */ + + gp3_cmd_next = gp3_cmd_current + GP3_BLT_COMMAND_SIZE; + + /* CHECK WRAP CONDITION */ + + if ((gp3_cmd_bottom - gp3_cmd_next) <= GP3_MAX_COMMAND_SIZE) { + gp3_cmd_next = gp3_cmd_top; + gp3_cmd_header = GP3_BLT_HDR_TYPE | GP3_BLT_HDR_WRAP; + + /* WAIT FOR HARDWARE */ + /* When wrapping, we must take steps to ensure that we do not */ + /* wrap over the current hardware read pointer. We do this by */ + /* verifying that the hardware is not between us and the end of */ + /* the command buffer. We also have a special case to make sure */ + /* that the hardware is not currently reading the top of the */ + /* command buffer. */ + + GP3_WAIT_WRAP(temp); + } else { + gp3_cmd_header = GP3_BLT_HDR_TYPE; + + /* WAIT FOR AVAILABLE SPACE */ + + GP3_WAIT_PRIMITIVE(temp); + } + + if (flags & CIMGP_BLTFLAGS_LIMITBUFFER) { + while (1) { + temp = READ_GP32(GP3_CMD_READ); + if (((gp3_cmd_current >= temp) + && ((gp3_cmd_current - temp) <= gp3_buffer_lead)) + || ((gp3_cmd_current < temp) + && ((gp3_cmd_current + (gp3_cmd_bottom - temp)) <= + gp3_buffer_lead))) { + break; + } + } + } + + /* SET THE CURRENT BUFFER POINTER */ + /* We initialize a pointer to the current buffer base to avoid an */ + /* extra addition for every buffer write. */ + + cim_cmd_ptr = cim_cmd_base_ptr + gp3_cmd_current; + + /* SET THE HAZARD BIT */ + + if (flags & CIMGP_BLTFLAGS_HAZARD) + gp3_cmd_header |= GP3_BLT_HDR_HAZARD_ENABLE; +} + +/*--------------------------------------------------------------------------- + * gp_declare_vector + * + * This routine is used to prepare for a 2D vector. It has no other function + * except to verify that enough room is available in the command buffer + * to hold a vector command. The same rules that apply to BLTs apply to + * vectors. (See the documentation for gp_declare_blt). + *-------------------------------------------------------------------------*/ + +void +gp_declare_vector(unsigned long flags) +{ + unsigned long temp; + + gp3_blt = 0; + gp3_blt_flags = flags; + + /* SET ADDRESS OF NEXT COMMAND */ + /* The logic to force a wrap during a vector is identical */ + /* to the BLT logic. */ + + /* ALLOCATE SPACE FOR AN ADDITIONAL VECTOR TO CLEAR THE BYTE ENABLES */ + + gp3_cmd_next = gp3_cmd_current + GP3_VECTOR_COMMAND_SIZE + + GP3_VECTOR_COMMAND_SIZE + 32; + + /* CHECK WRAP CONDITION */ + + if ((gp3_cmd_bottom - gp3_cmd_next) <= GP3_MAX_COMMAND_SIZE) { + gp3_cmd_next = gp3_cmd_top; + gp3_cmd_header = GP3_VEC_HDR_TYPE | GP3_VEC_HDR_WRAP; + + /* CHECK WRAP CONDITION */ + + GP3_WAIT_WRAP(temp); + } else { + gp3_cmd_header = GP3_VEC_HDR_TYPE; + + /* WAIT FOR AVAILABLE SPACE */ + + GP3_WAIT_PRIMITIVE(temp); + + gp3_cmd_next -= GP3_VECTOR_COMMAND_SIZE + 32; + } + + if (flags & CIMGP_BLTFLAGS_LIMITBUFFER) { + while (1) { + temp = READ_GP32(GP3_CMD_READ); + if (((gp3_cmd_current >= temp) + && ((gp3_cmd_current - temp) <= gp3_buffer_lead)) + || ((gp3_cmd_current < temp) + && ((gp3_cmd_current + (gp3_cmd_bottom - temp)) <= + gp3_buffer_lead))) { + break; + } + } + } + + cim_cmd_ptr = cim_cmd_base_ptr + gp3_cmd_current; + + /* SET THE HAZARD BIT */ + + if (flags & CIMGP_BLTFLAGS_HAZARD) + gp3_cmd_header |= GP3_VEC_HDR_HAZARD_ENABLE; +} + +/*--------------------------------------------------------------------------- + * gp_write_parameters + * + * This routine is called to write all recent parameters to the hardware. + * This routine is necessary for any implementation that performs the setup + * for a BLT separate from the actual BLT. An example would be a driver + * that prepares for multiple pattern fills by programming the ROP, + * pattern color and destination stride. The driver might then perform + * repeated pattern fills with minimal effort. + *-------------------------------------------------------------------------*/ + +void +gp_write_parameters(void) +{ + /* WRITE THE COMMAND HEADER */ + /* Command header is at offset 0 for BLTs and vectors */ + + WRITE_COMMAND32(GP3_BLT_CMD_HEADER, gp3_cmd_header); + + /* INCREMENT THE CURRENT WRITE POINTER */ + + gp3_cmd_current = gp3_cmd_next; + + /* UPDATE THE GP WRITE POINTER */ + + WRITE_GP32(GP3_CMD_WRITE, gp3_cmd_current); +} + +/*--------------------------------------------------------------------------- + * gp_set_raster_operation + * + * This is generally the first routine called when programming a BLT. This + * routine performs the following functions: + * - Sets the initial value of the GP3_RASTER_MODE register in the buffer. + * - Clears any 8x8 pattern if the ROP does not involve pattern data. + *-------------------------------------------------------------------------*/ + +void +gp_set_raster_operation(unsigned char ROP) +{ + gp3_cmd_header |= GP3_BLT_HDR_RASTER_ENABLE; + + /* WRITE THE RASTER MODE REGISTER */ + /* This register is in the same location in BLT and vector commands */ + + gp3_raster_mode = gp3_bpp | (unsigned long)ROP; + WRITE_COMMAND32(GP3_BLT_RASTER_MODE, gp3_raster_mode); + + /* CHECK IF DESTINATION IS REQUIRED */ + + if ((ROP & 0x55) ^ ((ROP >> 1) & 0x55)) { + gp3_blt_mode = GP3_BM_DST_REQ; + gp3_vec_mode = GP3_VM_DST_REQ; + } else { + gp3_blt_mode = gp3_vec_mode = 0; + } +} + +/*---------------------------------------------------------------------------- + * gp_set_alpha_operation + * + * BLTs are generally one of two types, a ROPed BLT or a BLT composited using + * alpha blending. For the latter, this routine is used to configure the + * mathematical function used to create the blended output. This routine + * should generally be called first when programming a BLT. The available + * parameters mirror the hardware and are described as follows: + * + * alpha_operation = + * 0 - alpha * A + * 1 - (1 - alpha) * B + * 2 - A + (1 - alpha)*B + * 3 - alpha*A + (1 - alpha)*B + * + * alpha_type = + * 0 - alpha component of channel A + * 1 - alpha component of channel B + * 2 - Constant alpha + * 3 - Constant 1 + * 4 - The color components of channel A + * 5 - The color components of channel B + * 6 - Alpha comes from the alpha channel of the source before the source + * undergoes color conversion. + * + * channel = + * 0 - Channel A = source, channel B = destination + * 1 - Channel B = source, channel A = destination + * + * apply_alpha = + * 1 - Apply alpha blend to only the RGB portion of the pixel. This must be + * set when the source or destination format do not include an alpha + * channel. + * 2 - Apply alpha blend only to the alpha portion of the pixel. This + * implies that both destination and source include an alpha channel. + * 3 - Apply alpha blend to both the RGB and alpha portions of the pixel. + * + * Alpha-blended vectors are not currently supported. + *-------------------------------------------------------------------------*/ + +void +gp_set_alpha_operation(int alpha_operation, int alpha_type, int channel, + int apply_alpha, unsigned char alpha) +{ + gp3_cmd_header |= GP3_BLT_HDR_RASTER_ENABLE; + + /* THE AVAILABLE ALPHA DEFINITIONS FOLLOW THE HARDWARE */ + /* This allows us to avoid giant switch structures, but it */ + /* also implies that there is no mechanism to detect invalid */ + /* parameters. */ + + gp3_raster_mode = gp3_bpp | (unsigned long)alpha | + ((unsigned long)apply_alpha << 22) | + ((unsigned long)alpha_operation << 20) | + ((unsigned long)alpha_type << 17) | ((unsigned long)channel << 16); + + WRITE_COMMAND32(GP3_BLT_RASTER_MODE, gp3_raster_mode); + + /* CHECK IF DESTINATION IS REQUIRED */ + + if ((alpha_operation == CIMGP_ALPHA_TIMES_A && + channel == CIMGP_CHANNEL_A_SOURCE && + alpha_type != CIMGP_CHANNEL_B_ALPHA && + alpha_type != CIMGP_ALPHA_FROM_RGB_B) || + (alpha_operation == CIMGP_BETA_TIMES_B && + channel == CIMGP_CHANNEL_A_DEST && + alpha_type != CIMGP_CHANNEL_A_ALPHA && + alpha_type != CIMGP_ALPHA_FROM_RGB_A)) { + gp3_blt_mode = 0; + } else + gp3_blt_mode = GP3_BM_DST_REQ; +} + +/*--------------------------------------------------------------------------- + * gp_set_solid_pattern + * + * This routine is called to program the hardware for a solid pattern. It + * need not be called for any other reason. As a side effect, this routine + * will clear any 8x8 pattern data. + *-------------------------------------------------------------------------*/ + +void +gp_set_solid_pattern(unsigned long color) +{ + /* CHANNEL 3 IS NOT NEEDED FOR SOLID PATTERNS */ + + gp3_ch3_pat = 0; + + /* SET SOLID PATTERN IN COMMAND BUFFER */ + /* We are assuming that only one pattern type is ever set for a */ + /* BLT. We are also assuming that gp_set_raster_operation will */ + /* be called before this routine. With these assumptions, we */ + /* will thus never have to change the raster mode register for */ + /* solid patterns. */ + + if (gp3_blt) { + gp3_cmd_header |= GP3_BLT_HDR_PAT_CLR0_ENABLE; + + WRITE_COMMAND32(GP3_BLT_PAT_COLOR_0, color); + } else { + gp3_cmd_header |= GP3_VEC_HDR_PAT_CLR0_ENABLE; + + WRITE_COMMAND32(GP3_VECTOR_PAT_COLOR_0, color); + } +} + +/*--------------------------------------------------------------------------- + * gp_set_mono_pattern + * + * This routine is called to program the hardware for a monochrome pattern. + * As a side effect, this routine will clear any 8x8 pattern data. + *-------------------------------------------------------------------------*/ + +void +gp_set_mono_pattern(unsigned long bgcolor, unsigned long fgcolor, + unsigned long data0, unsigned long data1, int transparent, int x, int y) +{ + /* CHANNEL 3 IS NOT NEEDED FOR MONOCHROME PATTERNS */ + + gp3_ch3_pat = 0; + + /* UPDATE RASTER MODE REGISTER */ + + if (transparent) + gp3_raster_mode |= GP3_RM_PAT_MONO | GP3_RM_PAT_TRANS; + else + gp3_raster_mode |= GP3_RM_PAT_MONO; + + gp3_cmd_header |= GP3_BLT_HDR_RASTER_ENABLE; + + WRITE_COMMAND32(GP3_BLT_RASTER_MODE, gp3_raster_mode); + + /* SET MONOCHROME PATTERN DATA AND COLORS */ + + if (gp3_blt) { + gp3_cmd_header |= + (GP3_BLT_HDR_PAT_CLR0_ENABLE | GP3_BLT_HDR_PAT_CLR1_ENABLE | + GP3_BLT_HDR_PAT_DATA0_ENABLE | GP3_BLT_HDR_PAT_DATA1_ENABLE); + + WRITE_COMMAND32(GP3_BLT_PAT_COLOR_0, bgcolor); + WRITE_COMMAND32(GP3_BLT_PAT_COLOR_1, fgcolor); + WRITE_COMMAND32(GP3_BLT_PAT_DATA_0, data0); + WRITE_COMMAND32(GP3_BLT_PAT_DATA_1, data1); + } else { + gp3_cmd_header |= + (GP3_VEC_HDR_PAT_CLR0_ENABLE | GP3_VEC_HDR_PAT_CLR1_ENABLE | + GP3_VEC_HDR_PAT_DATA0_ENABLE | GP3_VEC_HDR_PAT_DATA1_ENABLE); + + WRITE_COMMAND32(GP3_VECTOR_PAT_COLOR_0, bgcolor); + WRITE_COMMAND32(GP3_VECTOR_PAT_COLOR_1, fgcolor); + WRITE_COMMAND32(GP3_VECTOR_PAT_DATA_0, data0); + WRITE_COMMAND32(GP3_VECTOR_PAT_DATA_1, data1); + } + + /* SAVE PATTERN ORIGIN */ + + gp3_pat_origin = ((unsigned long)y << 29) | + (((unsigned long)x & 7) << 26); +} + +/*--------------------------------------------------------------------------- + * gp_set_pattern_origin + * + * This routine overrides the pattern origins set in gp_set_mono_pattern or + * gp_set_color_pattern. It is generally used to override the original + * pattern origin due to a change in clipping. + *-------------------------------------------------------------------------*/ + +void +gp_set_pattern_origin(int x, int y) +{ + /* SAVE PATTERN ORIGIN */ + + gp3_pat_origin = ((unsigned long)y << 29) | + (((unsigned long)x & 7) << 26); +} + +/*--------------------------------------------------------------------------- + * gp_set_color_pattern + * + * This routine is called to program a 8x8 color pattern into the LUT + * hardware. Unlike the other pattern routines, this routine must be called + * before any gp_declare_xxxx routines. The pattern that is programmed into + * the hardware will stay persistent for all subsequent primitives until one + * of the following conditions happens. + * - Another pattern type is programmed. + * - A color-conversion BLT rotation BLT. + *-------------------------------------------------------------------------*/ + +void +gp_set_color_pattern(unsigned long *pattern, int format, int x, int y) +{ + unsigned long size_dwords, temp; + + gp3_ch3_pat = 1; + + /* SAVE COLOR PATTERN SOURCE INFO + * Color patterns can be in a format different than the primary display. + * 4BPP patterns are not supported. + */ + + gp3_pat_pix_shift = (unsigned long)((format >> 2) & 3); + gp3_pat_format = (((unsigned long)format & 0xF) << 24) | + (((unsigned long)format & 0x10) << 17) | + GP3_CH3_COLOR_PAT_ENABLE | GP3_CH3_C3EN; + + size_dwords = (64 << gp3_pat_pix_shift) >> 2; + + /* CHECK FOR WRAP AFTER LUT LOAD */ + /* Primitive size is 12 plus the amount of data. */ + + gp3_cmd_next = gp3_cmd_current + (size_dwords << 2) + 12; + + if ((gp3_cmd_bottom - gp3_cmd_next) <= GP3_MAX_COMMAND_SIZE) { + gp3_cmd_next = gp3_cmd_top; + gp3_cmd_header = GP3_LUT_HDR_TYPE | GP3_LUT_HDR_WRAP | + GP3_LUT_HDR_DATA_ENABLE; + + /* WAIT FOR HARDWARE */ + /* Same logic as BLT wrapping. */ + + GP3_WAIT_WRAP(temp); + } else { + gp3_cmd_header = GP3_LUT_HDR_TYPE | GP3_LUT_HDR_DATA_ENABLE; + + /* WAIT FOR AVAILABLE SPACE */ + + GP3_WAIT_PRIMITIVE(temp); + } + + /* SAVE CURRENT BUFFER POINTER */ + + cim_cmd_ptr = cim_cmd_base_ptr + gp3_cmd_current; + + /* PREPARE FOR COMMAND BUFFER DATA WRITES */ + /* Pattern data is contiguous DWORDs at LUT address 0x100 */ + + WRITE_COMMAND32(0, gp3_cmd_header); + WRITE_COMMAND32(4, 0x100); + WRITE_COMMAND32(8, size_dwords | GP3_LUT_DATA_TYPE); + + /* WRITE ALL DATA */ + + WRITE_COMMAND_STRING32(12, pattern, 0, size_dwords); + + /* START OPERATION */ + + WRITE_GP32(GP3_CMD_WRITE, gp3_cmd_next); + gp3_cmd_current = gp3_cmd_next; + + /* SAVE PATTERN ORIGIN */ + + gp3_pat_origin = ((unsigned long)y << 29) | + (((unsigned long)x & 7) << 26); +} + +/*--------------------------------------------------------------------------- + * gp_set_mono_source + * + * This routine is called to program the colors for monochrome source data. + *-------------------------------------------------------------------------*/ + +void +gp_set_mono_source(unsigned long bgcolor, unsigned long fgcolor, + int transparent) +{ + /* UPDATE RASTER MODE REGISTER IF TRANSPARENT */ + + if (transparent) { + gp3_cmd_header |= GP3_BLT_HDR_RASTER_ENABLE; + gp3_raster_mode |= GP3_RM_SRC_TRANS; + + WRITE_COMMAND32(GP3_BLT_RASTER_MODE, gp3_raster_mode); + } + + /* SET MONOCHROME SOURCE COLORS */ + /* Note that this routine only sets the colors. The actual */ + /* source type is determined by the final output routine */ + /* (gp_mono_bitmap_xxx, gp_color_bitmap_xxx, etc.) */ + + gp3_cmd_header |= GP3_BLT_HDR_SRC_FG_ENABLE | GP3_BLT_HDR_SRC_BG_ENABLE; + + WRITE_COMMAND32(GP3_BLT_SRC_COLOR_FG, fgcolor); + WRITE_COMMAND32(GP3_BLT_SRC_COLOR_BG, bgcolor); +} + +/*--------------------------------------------------------------------------- + * gp_set_solid_source + * + * This routine is called to program a solid source color. A solid source + * color is used primarily for vectors or antialiased text. + *-------------------------------------------------------------------------*/ + +void +gp_set_solid_source(unsigned long color) +{ + /* SET SOLID SOURCE COLOR */ + /* The solid source register is in the same place for both BLTs and */ + /* vectors. */ + + gp3_cmd_header |= GP3_BLT_HDR_SRC_FG_ENABLE; + + WRITE_COMMAND32(GP3_BLT_SRC_COLOR_FG, color); +} + +/*--------------------------------------------------------------------------- + * gp_set_source_transparency + * + * This routine sets the source transparency and mask to be used in future + * rendering operations. Transparency is cleared by gp_set_raster_operation, + * so this routine should never be called first. + *-------------------------------------------------------------------------*/ + +void +gp_set_source_transparency(unsigned long color, unsigned long mask) +{ + gp3_raster_mode |= GP3_RM_SRC_TRANS; + gp3_cmd_header |= GP3_BLT_HDR_RASTER_ENABLE | GP3_BLT_HDR_SRC_FG_ENABLE | + GP3_BLT_HDR_SRC_BG_ENABLE; + + WRITE_COMMAND32(GP3_BLT_RASTER_MODE, gp3_raster_mode); + WRITE_COMMAND32(GP3_BLT_SRC_COLOR_FG, color); + WRITE_COMMAND32(GP3_BLT_SRC_COLOR_BG, mask); +} + +/*--------------------------------------------------------------------------- + * gp_program_lut + * + * This routine is called to program the hardware LUT with color-conversion + * information. This routine should be called before any gp_declare_xxxx + * routines. + * + * colors - Pointer to an array of DWORDs for color expansion. + * + * full_lut - Selector between 4BPP and 8BPP expansion. The hardware is + * initialized with 16 dwords for 4BPP expansion and 256 dwords + * for 8BPP expansion. + *-------------------------------------------------------------------------*/ + +void +gp_program_lut(unsigned long *colors, int full_lut) +{ + unsigned long size_dwords, temp; + + /* SIZE IS EITHER 16 DWORDS (4BPP) or 256 DWORDS (8BPP) */ + + if (full_lut) + size_dwords = 256; + else + size_dwords = 16; + + /* CHECK FOR WRAP AFTER LUT LOAD */ + /* Primitive size is 12 plus the amount of data. */ + + gp3_cmd_next = gp3_cmd_current + (size_dwords << 2) + 12; + + if ((gp3_cmd_bottom - gp3_cmd_next) <= GP3_MAX_COMMAND_SIZE) { + gp3_cmd_next = gp3_cmd_top; + gp3_cmd_header = GP3_LUT_HDR_TYPE | GP3_LUT_HDR_WRAP | + GP3_LUT_HDR_DATA_ENABLE; + + /* WAIT FOR HARDWARE */ + /* Same logic as BLT wrapping. */ + + GP3_WAIT_WRAP(temp); + } else { + gp3_cmd_header = GP3_LUT_HDR_TYPE | GP3_LUT_HDR_DATA_ENABLE; + + /* WAIT FOR AVAILABLE SPACE */ + + GP3_WAIT_PRIMITIVE(temp); + } + + /* SAVE CURRENT BUFFER POINTER */ + + cim_cmd_ptr = cim_cmd_base_ptr + gp3_cmd_current; + + /* PREPARE FOR COMMAND BUFFER DATA WRITES */ + /* Pattern data is contiguous DWORDs at LUT address 0 */ + + WRITE_COMMAND32(0, gp3_cmd_header); + WRITE_COMMAND32(4, 0); + WRITE_COMMAND32(8, (size_dwords | GP3_LUT_DATA_TYPE)); + + /* WRITE ALL DATA */ + + WRITE_COMMAND_STRING32(12, colors, 0, size_dwords); + + /* START OPERATION */ + + WRITE_GP32(GP3_CMD_WRITE, gp3_cmd_next); + gp3_cmd_current = gp3_cmd_next; +} + +/*--------------------------------------------------------------------------- + * gp_set_vector_pattern + * + * This routine is called to program the hardware LUT with a vector pattern. + * A vector pattern is programmed as a 32-bit mask that specifies a + * transparency pattern. A length parameter is used to specify patterns + * smaller than 32. Note that vectors in Geode LX do not continue across + * corners. The beginning of each vector will always begin with bit 0 of the + * vector pattern. It is the responsibility of the caller to update the + * pattern if an alternate behavior is desired. + * + * This routine faces the same restrictions of all routines that program + * the LUT, in that it must be called before any gp_declare_xxxx routines, + * it cannot be combined with an 8x8 color pattern, color conversion or + * rotation. + *-------------------------------------------------------------------------*/ + +void +gp_set_vector_pattern(unsigned long pattern, unsigned long color, int length) +{ + unsigned long temp, mask; + + gp3_ch3_pat = 1; + gp3_vector_pattern_color = color; + + /* CREATE SUITABLE PATTERN MASK */ + /* The GP requires a minimum of four pixels in a vector pattern. We */ + /* can get around this restriction by doubling any patterns smaller */ + /* than 4 pixels. */ + + while (length < 4) { + mask = 0xFFFFFFFF >> (32 - length); + pattern = (pattern << length) | (pattern & mask); + length <<= 1; + } + mask = 0xFFFFFFFF >> (32 - length); + + gp3_vec_pat = pattern; + + /* CHECK FOR WRAP AFTER LUT LOAD */ + + gp3_cmd_next = gp3_cmd_current + GP3_VECTOR_PATTERN_COMMAND_SIZE; + + if ((gp3_cmd_bottom - gp3_cmd_next) <= GP3_MAX_COMMAND_SIZE) { + gp3_cmd_next = gp3_cmd_top; + gp3_cmd_header = GP3_LUT_HDR_TYPE | GP3_LUT_HDR_WRAP | + GP3_LUT_HDR_DATA_ENABLE; + + /* WAIT FOR HARDWARE */ + /* Same logic as BLT wrapping. */ + + GP3_WAIT_WRAP(temp); + } else { + gp3_cmd_header = GP3_LUT_HDR_TYPE | GP3_LUT_HDR_DATA_ENABLE; + + /* WAIT FOR AVAILABLE SPACE */ + + GP3_WAIT_PRIMITIVE(temp); + } + + /* SAVE CURRENT BUFFER POINTER */ + + cim_cmd_ptr = cim_cmd_base_ptr + gp3_cmd_current; + + /* PREPARE FOR COMMAND BUFFER DATA WRITES */ + /* Pattern data is 2 DWORDs at 0x100 and 0x101 */ + + WRITE_COMMAND32(0, gp3_cmd_header); + WRITE_COMMAND32(4, 0x100); + WRITE_COMMAND32(8, (2 | GP3_LUT_DATA_TYPE)); + WRITE_COMMAND32(12, pattern); + WRITE_COMMAND32(16, mask); + + /* START OPERATION */ + + WRITE_GP32(GP3_CMD_WRITE, gp3_cmd_next); + gp3_cmd_current = gp3_cmd_next; +} + +/*--------------------------------------------------------------------------- + * gp_set_strides + * + * This routine is called to program the pitch between successive lines of + * data in the frame buffer. The strides should be DWORD aligned and less + * than 64K. These restrictions are not checked by the API. + *-------------------------------------------------------------------------*/ + +void +gp_set_strides(unsigned long dst_stride, unsigned long src_stride) +{ + /* SAVE STRIDES */ + /* The source stride may be needed later for channel 3 source data and */ + /* we may need to use these strides in calculations. */ + + gp3_src_stride = src_stride; + gp3_dst_stride = dst_stride; + + /* ENABLE STRIDES */ + /* The stride register is in the same place for BLTs and vectors */ + + gp3_cmd_header |= GP3_BLT_HDR_STRIDE_ENABLE; + + WRITE_COMMAND32(GP3_BLT_STRIDE, ((src_stride << 16) | dst_stride)); +} + +/*--------------------------------------------------------------------------- + * gp_set_source_format + * + * This routine is used to program the format of source data used in + * subsequent color-conversion or rotation operations. Note that 4BPP + * indexed and 8BPP indexed source formats cannot be used when rotating, as + * the LUT will be destroyed. These formats also cannot be combined with an + * 8x8 color pattern. The supported formats mirror the hardware and are + * described as follows: + * + * 0 - 8BPP 3:3:2 + * 1 - 8BPP indexed + * 4 - 16BPP 4:4:4:4 + * 5 - 16BPP 1:5:5:5 + * 6 - 16BPP 5:6:5 + * 7 - 16BPP YUV + * 8 - 32BPP 8:8:8:8 + * 13 - 4BPP indexed + * 20 - 16BPP 4:4:4:4 BGR + * 21 - 16BPP 1:5:5:5 BGR + * 22 - 16BPP 0:5:6:5 BGR + * 24 - 32BPP 8:8:8:8 BGR + *-------------------------------------------------------------------------*/ + +void +gp_set_source_format(int format) +{ + /* SAVE FORMAT */ + /* We will combine the source format later when doing color conversion. */ + /* We also save the pixel size for host source calculations. */ + /* Conveniently, the source formats are organized such that the upper */ + /* two bits of the nibble represent the pixel shift, with a pixel shift */ + /* of 3 being a special case for 4BPP data. Clever, yes? Even more */ + /* clever, bit 4 indicates BGR ordering. */ + + gp3_src_pix_shift = (unsigned long)((format >> 2) & 3); + gp3_src_format = (((unsigned long)format & 0xF) << 24) | + (((unsigned long)format & 0x10) << 18); +} + +/*--------------------------------------------------------------------------- + * gp_pattern_fill + * + * This routine is called to perform a simple pattern fill. The pattern + * can be solid, monochrome or a preprogrammed 8x8 color pattern. If + * the ROP involves source data, that source data will be constant. + *-------------------------------------------------------------------------*/ + +void +gp_pattern_fill(unsigned long dstoffset, unsigned long width, + unsigned long height) +{ + unsigned long base_register; + + base_register = (gp3_base_register & ~GP3_BASE_OFFSET_DSTMASK) | + ((gp3_fb_base << 24) + (dstoffset & 0xFFC00000)); + + /* ENABLE RELEVANT REGISTERS */ + /* Note that we always enable and write the channel 3 mode, if only */ + /* to turn it off. Cimarron also always writes the base offset */ + /* register to allow operation with frame buffers larger than 16MB. */ + + gp3_cmd_header |= GP3_BLT_HDR_DST_OFF_ENABLE | + GP3_BLT_HDR_WIDHI_ENABLE | + GP3_BLT_HDR_BASE_OFFSET_ENABLE | + GP3_BLT_HDR_CH3_STR_ENABLE | + GP3_BLT_HDR_CH3_WIDHI_ENABLE | GP3_BLT_HDR_BLT_MODE_ENABLE; + + /* WRITE THE REGISTERS COMMON TO ALL PATTERN TYPES */ + /* The destination base is the frame buffer base plus whatever */ + /* 4MB segment we happen to be BLTing to. */ + + WRITE_COMMAND32(GP3_BLT_WID_HEIGHT, ((width << 16) | height)); + WRITE_COMMAND32(GP3_BLT_BASE_OFFSET, base_register); + + /* CHECK 8X8 COLOR PATTERN CASE */ + + if (gp3_ch3_pat) { + /* SET CHANNEL 3 PATTERN ORIGINS */ + + gp3_cmd_header |= GP3_BLT_HDR_CH3_OFF_ENABLE; + + /* INITIALIZE CHANNEL 3 PARAMETERS */ + + WRITE_COMMAND32(GP3_BLT_CH3_WIDHI, ((width << 16) | height)); + WRITE_COMMAND32(GP3_BLT_CH3_OFFSET, gp3_pat_origin); + WRITE_COMMAND32(GP3_BLT_DST_OFFSET, dstoffset & 0x3FFFFF); + WRITE_COMMAND32(GP3_BLT_CH3_MODE_STR, gp3_pat_format); + } else { + /* DISABLE CHANNEL 3 AND USE NORMAL PATTERN ORIGINS */ + + WRITE_COMMAND32(GP3_BLT_CH3_MODE_STR, 0); + WRITE_COMMAND32(GP3_BLT_DST_OFFSET, + ((dstoffset & 0x3FFFFF) | gp3_pat_origin)); + } + + /* START THE BLT */ + + WRITE_COMMAND32(GP3_BLT_CMD_HEADER, gp3_cmd_header); + WRITE_COMMAND32(GP3_BLT_MODE, gp3_blt_mode); + WRITE_GP32(GP3_CMD_WRITE, gp3_cmd_next); + gp3_cmd_current = gp3_cmd_next; +} + +/*--------------------------------------------------------------------------- + * gp_screen_to_screen_blt + * + * This routine is called to perform a BLT from one location inside video + * memory to another location inside video memory. The source and destination + * formats are assumed to be the current BPP. Whenever possible, this routine + * tries to use channel 3 to fetch source data. The BLT flags can affect this + * behavior in the following ways: + * CIMGP_BLTFLAGS_PRES_COLOR_PAT + * A color pattern is being stored in the channel 3 buffer. It is either + * being stored for a later BLT or being combined with the current source + * data. Channel 3 cannot be used to fetch source data or the pattern + * will be overwritten. + * CIMGP_BLTFLAGS_PRES_LUT + * If the first flag is not set, this flag will limit the use of the + * channel 3 buffer to 1K. + *-------------------------------------------------------------------------*/ + +void +gp_screen_to_screen_blt(unsigned long dstoffset, unsigned long srcoffset, + unsigned long width, unsigned long height, int flags) +{ + unsigned long base; + unsigned long ch3_flags = 0; + unsigned long blt_mode = gp3_blt_mode; + unsigned long size = ((width << 16) | height); + unsigned long dstbase, srcbase; + + /* CALCULATE BASE OFFSETS */ + /* We need to set the 4MB aligned base offsets before we add offsets */ + /* for negative BLTs. */ + + srcbase = srcoffset & 0xFFC00000; + dstbase = dstoffset & 0xFFC00000; + srcoffset &= 0x3FFFFF; + dstoffset &= 0x3FFFFF; + + /* ADJUST OFFSETS BASED ON FLAGS */ + /* We adjust the source and destination offsets to point to the first */ + /* byte of the first pixel of the BLT. This routine assumes that the */ + /* source and destination regions do not wrap past the end of a 16MB */ + /* region. */ + + if (flags & CIMGP_NEGXDIR) { + srcoffset += (width << gp3_pix_shift) - 1; + dstoffset += (width << gp3_pix_shift) - 1; + blt_mode |= GP3_BM_NEG_XDIR; + ch3_flags |= GP3_CH3_NEG_XDIR; + } + if (flags & CIMGP_NEGYDIR) { + srcoffset += (height - 1) * gp3_src_stride; + dstoffset += (height - 1) * gp3_dst_stride; + blt_mode |= GP3_BM_NEG_YDIR; + ch3_flags |= GP3_CH3_NEG_YDIR; + } + + /* BRANCH BASED ON CHANNEL 3 */ + /* If a color pattern is not being saved or used, channel 3 will */ + /* be used to fetch source for maximum throughput. Channel 3 */ + /* is not used if transparency or alpha blending is enabled. */ + + if (!(gp3_blt_flags & CIMGP_BLTFLAGS_PRES_COLOR_PAT) && + !(gp3_raster_mode & GP3_RM_SRC_TRANS) && !(flags & CIMGP_NEGYDIR)) { + base = ((gp3_fb_base << 24) + dstbase) | + ((gp3_fb_base << 4) + (srcbase >> 20)) | + (gp3_base_register & GP3_BASE_OFFSET_SRCMASK); + + gp3_cmd_header |= GP3_BLT_HDR_DST_OFF_ENABLE | + GP3_BLT_HDR_WIDHI_ENABLE | + GP3_BLT_HDR_CH3_STR_ENABLE | + GP3_BLT_HDR_CH3_WIDHI_ENABLE | + GP3_BLT_HDR_CH3_OFF_ENABLE | + GP3_BLT_HDR_BASE_OFFSET_ENABLE | GP3_BLT_HDR_BLT_MODE_ENABLE; + + WRITE_COMMAND32(GP3_BLT_DST_OFFSET, (dstoffset | gp3_pat_origin)); + WRITE_COMMAND32(GP3_BLT_CH3_OFFSET, srcoffset); + WRITE_COMMAND32(GP3_BLT_WID_HEIGHT, size); + WRITE_COMMAND32(GP3_BLT_CH3_WIDHI, size); + WRITE_COMMAND32(GP3_BLT_BASE_OFFSET, base); + WRITE_COMMAND32(GP3_BLT_CH3_MODE_STR, + GP3_CH3_C3EN | GP3_CH3_REPLACE_SOURCE | + gp3_ch3_bpp | gp3_src_stride | ch3_flags | + ((gp3_blt_flags & CIMGP_ENABLE_PREFETCH) << 17) | + ((gp3_blt_flags & CIMGP_BLTFLAGS_PRES_LUT) << 20)); + } else { + /* CALCULATE BASE OFFSET REGISTER */ + + base = ((gp3_fb_base << 24) + dstbase) | + ((gp3_fb_base << 14) + (srcbase >> 10)) | + (gp3_base_register & GP3_BASE_OFFSET_CH3MASK); + + /* PROGRAM THE NORMAL SOURCE CHANNEL REGISTERS */ + /* We assume that a color pattern is being ROPed with source */ + /* data if the pattern type is color and the preserve pattern */ + /* was set. */ + + blt_mode |= GP3_BM_SRC_FB; + + gp3_cmd_header |= GP3_BLT_HDR_SRC_OFF_ENABLE | + GP3_BLT_HDR_DST_OFF_ENABLE | + GP3_BLT_HDR_WIDHI_ENABLE | + GP3_BLT_HDR_CH3_WIDHI_ENABLE | + GP3_BLT_HDR_CH3_STR_ENABLE | + GP3_BLT_HDR_CH3_OFF_ENABLE | + GP3_BLT_HDR_BASE_OFFSET_ENABLE | GP3_BLT_HDR_BLT_MODE_ENABLE; + + if (gp3_ch3_pat) { + WRITE_COMMAND32(GP3_BLT_CH3_OFFSET, gp3_pat_origin); + WRITE_COMMAND32(GP3_BLT_DST_OFFSET, dstoffset); + WRITE_COMMAND32(GP3_BLT_CH3_MODE_STR, gp3_pat_format | ch3_flags); + WRITE_COMMAND32(GP3_BLT_CH3_WIDHI, size); + } else { + WRITE_COMMAND32(GP3_BLT_DST_OFFSET, dstoffset | gp3_pat_origin); + WRITE_COMMAND32(GP3_BLT_CH3_MODE_STR, 0); + } + + WRITE_COMMAND32(GP3_BLT_SRC_OFFSET, srcoffset); + WRITE_COMMAND32(GP3_BLT_WID_HEIGHT, size); + WRITE_COMMAND32(GP3_BLT_BASE_OFFSET, base); + } + + /* START THE BLT */ + + WRITE_COMMAND32(GP3_BLT_CMD_HEADER, gp3_cmd_header); + WRITE_COMMAND32(GP3_BLT_MODE, blt_mode); + WRITE_GP32(GP3_CMD_WRITE, gp3_cmd_next); + gp3_cmd_current = gp3_cmd_next; +} + + +/*--------------------------------------------------------------------------- + * gp_screen_to_screen_convert + * + * This routine is called to color-convert a rectangular region of the frame + * buffer into the current BPP. The format of the source region is programmed + * by gp_set_source_format. + *-------------------------------------------------------------------------*/ + +void +gp_screen_to_screen_convert(unsigned long dstoffset, unsigned long srcoffset, + unsigned long width, unsigned long height, int nibble) +{ + unsigned long size = ((width << 16) | height); + unsigned long ch3_offset = srcoffset & 0x3FFFFF; + unsigned long ch3_size, base; + + base = ((gp3_fb_base << 24) + (dstoffset & 0xFFC00000)) | + ((gp3_fb_base << 4) + ((srcoffset & 0xFFC00000) >> 20)) | + (gp3_base_register & GP3_BASE_OFFSET_SRCMASK); + + /* SET NIBBLE FOR 4BPP */ + /* 4BPP is a special case in that it requires subpixel addressing. The */ + /* user must supply this information via the nibble parameter. This */ + /* parameter is ignored for every other source format. */ + + ch3_size = size; + if (gp3_src_pix_shift == 3) + ch3_offset |= ((nibble & 1) << 25); + else if ((gp3_src_format & GP3_CH3_SRC_MASK) == GP3_CH3_SRC_24BPP_PACKED) + ch3_size = ((((width * 3) + 3) >> 2) << 16) | height; + + /* SET APPROPRIATE ENABLES */ + + gp3_cmd_header |= GP3_BLT_HDR_DST_OFF_ENABLE | + GP3_BLT_HDR_WIDHI_ENABLE | + GP3_BLT_HDR_CH3_OFF_ENABLE | + GP3_BLT_HDR_CH3_STR_ENABLE | + GP3_BLT_HDR_CH3_WIDHI_ENABLE | + GP3_BLT_HDR_BASE_OFFSET_ENABLE | GP3_BLT_HDR_BLT_MODE_ENABLE; + + /* WRITE ALL BLT REGISTERS */ + + WRITE_COMMAND32(GP3_BLT_DST_OFFSET, + (dstoffset & 0x3FFFFF) | gp3_pat_origin); + WRITE_COMMAND32(GP3_BLT_WID_HEIGHT, size); + WRITE_COMMAND32(GP3_BLT_CH3_WIDHI, ch3_size); + WRITE_COMMAND32(GP3_BLT_CH3_OFFSET, ch3_offset); + WRITE_COMMAND32(GP3_BLT_CH3_MODE_STR, + GP3_CH3_C3EN | GP3_CH3_REPLACE_SOURCE | gp3_src_format | + ((gp3_blt_flags & CIMGP_BLTFLAGS_PRES_LUT) << 20) | + ((gp3_blt_flags & CIMGP_ENABLE_PREFETCH) << 17) | gp3_src_stride); + WRITE_COMMAND32(GP3_BLT_BASE_OFFSET, base); + + /* START THE BLT */ + + WRITE_COMMAND32(GP3_BLT_CMD_HEADER, gp3_cmd_header); + WRITE_COMMAND32(GP3_BLT_MODE, gp3_blt_mode); + WRITE_GP32(GP3_CMD_WRITE, gp3_cmd_next); + gp3_cmd_current = gp3_cmd_next; +} + +/*--------------------------------------------------------------------------- + * gp_color_bitmap_to_screen_blt + * + * This routine is called to BLT data from system memory into the frame + * buffer. 'srcy' is deliberately omitted to prevent extra calculations for + * simple applications that have no source indexes. + *-------------------------------------------------------------------------*/ + +void +gp_color_bitmap_to_screen_blt(unsigned long dstoffset, unsigned long srcx, + unsigned long width, unsigned long height, unsigned char *data, + long pitch) +{ + unsigned long indent, temp; + unsigned long total_dwords, size_dwords; + unsigned long dword_count, byte_count; + unsigned long size = ((width << 16) | height); + unsigned long srcoffset; + + /* ASSUME BITMAPS ARE DWORD ALIGNED */ + /* We will offset into the source data in DWORD increments. We */ + /* set the source index to the remaining byte offset and */ + /* increment the size of each line to account for the dont-care */ + /* pixel(s). */ + + indent = srcx << gp3_pix_shift; + srcoffset = (indent & ~3L); + indent &= 3; + + /* PROGRAM THE NORMAL SOURCE CHANNEL REGISTERS */ + /* We assume that a color pattern is being ROPed with source */ + /* data if the pattern type is color and the preserve pattern */ + /* was set. */ + + gp3_cmd_header |= GP3_BLT_HDR_SRC_OFF_ENABLE | + GP3_BLT_HDR_DST_OFF_ENABLE | + GP3_BLT_HDR_WIDHI_ENABLE | + GP3_BLT_HDR_CH3_STR_ENABLE | + GP3_BLT_HDR_BASE_OFFSET_ENABLE | GP3_BLT_HDR_BLT_MODE_ENABLE; + + if (gp3_ch3_pat) { + gp3_cmd_header |= GP3_BLT_HDR_CH3_OFF_ENABLE | + GP3_BLT_HDR_CH3_WIDHI_ENABLE; + + WRITE_COMMAND32(GP3_BLT_CH3_OFFSET, gp3_pat_origin); + WRITE_COMMAND32(GP3_BLT_DST_OFFSET, (dstoffset & 0x3FFFFF)); + WRITE_COMMAND32(GP3_BLT_CH3_MODE_STR, gp3_pat_format); + WRITE_COMMAND32(GP3_BLT_CH3_WIDHI, size); + } else { + WRITE_COMMAND32(GP3_BLT_DST_OFFSET, + ((dstoffset & 0x3FFFFF) | gp3_pat_origin)); + WRITE_COMMAND32(GP3_BLT_CH3_MODE_STR, 0); + } + + WRITE_COMMAND32(GP3_BLT_SRC_OFFSET, indent); + WRITE_COMMAND32(GP3_BLT_WID_HEIGHT, size); + WRITE_COMMAND32(GP3_BLT_BASE_OFFSET, + ((gp3_fb_base << 24) + (dstoffset & 0xFFC00000))); + WRITE_COMMAND32(GP3_BLT_MODE, gp3_blt_mode | GP3_BM_SRC_HOST); + + /* START THE BLT */ + + WRITE_COMMAND32(GP3_BLT_CMD_HEADER, gp3_cmd_header); + WRITE_GP32(GP3_CMD_WRITE, gp3_cmd_next); + gp3_cmd_current = gp3_cmd_next; + + /* CALCULATE THE SIZE OF ONE LINE */ + + size = (width << gp3_pix_shift) + indent; + total_dwords = (size + 3) >> 2; + size_dwords = (total_dwords << 2) + 8; + dword_count = (size >> 2); + byte_count = (size & 3); + + /* CHECK FOR SMALL BLT CASE */ + + if (((total_dwords << 2) * height) <= GP3_BLT_1PASS_SIZE && + (gp3_cmd_bottom - gp3_cmd_current) > (GP3_BLT_1PASS_SIZE + 72)) { + /* UPDATE THE COMMAND POINTER */ + + cim_cmd_ptr = cim_cmd_base_ptr + gp3_cmd_current; + + /* CHECK IF A WRAP WILL BE NEEDED */ + + gp3_cmd_next = gp3_cmd_current + ((total_dwords << 2) * height) + 8; + + if ((gp3_cmd_bottom - gp3_cmd_next) <= GP3_MAX_COMMAND_SIZE) { + gp3_cmd_next = gp3_cmd_top; + + GP3_WAIT_WRAP(temp); + WRITE_COMMAND32(0, + GP3_DATA_LOAD_HDR_TYPE | GP3_DATA_LOAD_HDR_WRAP | + GP3_DATA_LOAD_HDR_ENABLE); + } else { + GP3_WAIT_PRIMITIVE(temp); + WRITE_COMMAND32(0, + GP3_DATA_LOAD_HDR_TYPE | GP3_DATA_LOAD_HDR_ENABLE); + } + + /* WRITE DWORD COUNT */ + + WRITE_COMMAND32(4, GP3_HOST_SOURCE_TYPE | (total_dwords * height)); + + while (height--) { + /* WRITE DATA */ + + WRITE_COMMAND_STRING32(8, data, srcoffset, dword_count); + WRITE_COMMAND_STRING8(8 + (dword_count << 2), data, + srcoffset + (dword_count << 2), byte_count); + + srcoffset += pitch; + cim_cmd_ptr += total_dwords << 2; + } + + WRITE_GP32(GP3_CMD_WRITE, gp3_cmd_next); + gp3_cmd_current = gp3_cmd_next; + } else { + /* + * Each line will be created as a separate command buffer entry to + * allow line-by-line wrapping and to allow simultaneous rendering + * by the HW. + */ + + while (height--) { + /* UPDATE THE COMMAND POINTER + * The WRITE_COMMANDXX macros use a pointer to the current buffer + * space. This is created by adding gp3_cmd_current to the base + * pointer. + */ + + cim_cmd_ptr = cim_cmd_base_ptr + gp3_cmd_current; + + /* CHECK IF A WRAP WILL BE NEEDED */ + + gp3_cmd_next = gp3_cmd_current + size_dwords; + if ((gp3_cmd_bottom - gp3_cmd_next) <= GP3_MAX_COMMAND_SIZE) { + gp3_cmd_next = gp3_cmd_top; + + /* WAIT FOR HARDWARE */ + + GP3_WAIT_WRAP(temp); + WRITE_COMMAND32(0, GP3_DATA_LOAD_HDR_TYPE | + GP3_DATA_LOAD_HDR_WRAP | GP3_DATA_LOAD_HDR_ENABLE); + } else { + /* WAIT FOR AVAILABLE SPACE */ + + GP3_WAIT_PRIMITIVE(temp); + WRITE_COMMAND32(0, GP3_DATA_LOAD_HDR_TYPE | + GP3_DATA_LOAD_HDR_ENABLE); + } + + /* WRITE DWORD COUNT */ + + WRITE_COMMAND32(4, GP3_HOST_SOURCE_TYPE | total_dwords); + + /* WRITE DATA */ + + WRITE_COMMAND_STRING32(8, data, srcoffset, dword_count); + WRITE_COMMAND_STRING8(8 + (dword_count << 2), data, + srcoffset + (dword_count << 2), byte_count); + + /* UPDATE POINTERS */ + + srcoffset += pitch; + WRITE_GP32(GP3_CMD_WRITE, gp3_cmd_next); + gp3_cmd_current = gp3_cmd_next; + } + } +} + +/*--------------------------------------------------------------------------- + * gp_color_convert_blt + * + * This routine is called to convert data that is stored in system memory + * into the current graphics BPP. The source format is programmed in + * gp_set_source_format. + *-------------------------------------------------------------------------*/ + +void +gp_color_convert_blt(unsigned long dstoffset, unsigned long srcx, + unsigned long width, unsigned long height, + unsigned char *data, long pitch) +{ + unsigned long indent, temp; + unsigned long total_dwords, size_dwords; + unsigned long dword_count, byte_count; + unsigned long size = ((width << 16) | height); + unsigned long ch3_size; + unsigned long ch3_offset, srcoffset; + unsigned long base; + + /* ASSUME BITMAPS ARE DWORD ALIGNED */ + /* We will offset into the source data in DWORD increments. We */ + /* set the source index to the remaining byte offset and */ + /* increment the size of each line to account for the dont-care */ + /* pixel(s). For 4BPP source data, we also set the appropriate */ + /* nibble index. */ + + /* CALCULATE THE SIZE OF ONE LINE */ + + if ((gp3_src_format & GP3_CH3_SRC_MASK) == GP3_CH3_SRC_24BPP_PACKED) { + /* HANDLE 24BPP + * Note that we do not do anything to guarantee that the source data + * is DWORD aligned. The logic here is that the source data will be + * cacheable, in which case Geode LX will not lose any clocks for + * unaligned moves. Also note that the channel 3 width is + * programmed as the number of dwords, while the normal width is + * programmed as the number of pixels. + */ + + srcoffset = srcx * 3; + ch3_offset = 0; + temp = width * 3; + ch3_size = (((temp + 3) >> 2) << 16) | height; + } else { + ch3_size = size; + + if (gp3_src_pix_shift == 3) { + /* CALCULATE INDENT AND SOURCE OFFSET */ + + indent = (srcx >> 1); + srcoffset = (indent & ~3L); + indent &= 3; + ch3_offset = indent | ((srcx & 1) << 25); + + temp = ((width + (srcx & 1) + 1) >> 1) + indent; + } else { + indent = (srcx << gp3_src_pix_shift); + srcoffset = (indent & ~3L); + indent &= 3; + ch3_offset = indent; + + temp = (width << gp3_src_pix_shift) + indent; + } + } + + total_dwords = (temp + 3) >> 2; + size_dwords = (total_dwords << 2) + 8; + dword_count = (temp >> 2); + byte_count = (temp & 3); + + base = ((gp3_fb_base << 24) + (dstoffset & 0xFFC00000)) | + (gp3_base_register & ~GP3_BASE_OFFSET_DSTMASK); + + /* SET APPROPRIATE ENABLES */ + + gp3_cmd_header |= GP3_BLT_HDR_DST_OFF_ENABLE | + GP3_BLT_HDR_WIDHI_ENABLE | + GP3_BLT_HDR_CH3_STR_ENABLE | + GP3_BLT_HDR_CH3_OFF_ENABLE | + GP3_BLT_HDR_CH3_WIDHI_ENABLE | + GP3_BLT_HDR_BASE_OFFSET_ENABLE | GP3_BLT_HDR_BLT_MODE_ENABLE; + + WRITE_COMMAND32(GP3_BLT_DST_OFFSET, + (dstoffset & 0x3FFFFF) | gp3_pat_origin); + WRITE_COMMAND32(GP3_BLT_CH3_OFFSET, ch3_offset); + WRITE_COMMAND32(GP3_BLT_WID_HEIGHT, size); + WRITE_COMMAND32(GP3_BLT_CH3_WIDHI, ch3_size); + WRITE_COMMAND32(GP3_BLT_BASE_OFFSET, base); + WRITE_COMMAND32(GP3_BLT_CH3_MODE_STR, GP3_CH3_C3EN | + GP3_CH3_REPLACE_SOURCE | GP3_CH3_HST_SRC_ENABLE | + gp3_src_format | ((gp3_blt_flags & CIMGP_BLTFLAGS_PRES_LUT) << 20)); + WRITE_COMMAND32(GP3_BLT_MODE, gp3_blt_mode); + + /* START THE BLT */ + + WRITE_COMMAND32(GP3_BLT_CMD_HEADER, gp3_cmd_header); + WRITE_GP32(GP3_CMD_WRITE, gp3_cmd_next); + gp3_cmd_current = gp3_cmd_next; + + if (((total_dwords << 2) * height) <= GP3_BLT_1PASS_SIZE && + (gp3_cmd_bottom - gp3_cmd_current) > (GP3_BLT_1PASS_SIZE + 72)) { + /* UPDATE THE COMMAND POINTER */ + + cim_cmd_ptr = cim_cmd_base_ptr + gp3_cmd_current; + + /* CHECK IF A WRAP WILL BE NEEDED */ + + gp3_cmd_next = gp3_cmd_current + ((total_dwords << 2) * height) + 8; + + if ((gp3_cmd_bottom - gp3_cmd_next) <= GP3_MAX_COMMAND_SIZE) { + gp3_cmd_next = gp3_cmd_top; + + GP3_WAIT_WRAP(temp); + WRITE_COMMAND32(0, GP3_DATA_LOAD_HDR_TYPE | + GP3_DATA_LOAD_HDR_WRAP | GP3_DATA_LOAD_HDR_ENABLE); + } else { + GP3_WAIT_PRIMITIVE(temp); + WRITE_COMMAND32(0, + GP3_DATA_LOAD_HDR_TYPE | GP3_DATA_LOAD_HDR_ENABLE); + } + + /* WRITE DWORD COUNT */ + + WRITE_COMMAND32(4, GP3_CH3_HOST_SOURCE_TYPE | + (total_dwords * height)); + + while (height--) { + /* WRITE DATA */ + + WRITE_COMMAND_STRING32(8, data, srcoffset, dword_count); + WRITE_COMMAND_STRING8(8 + (dword_count << 2), data, + srcoffset + (dword_count << 2), byte_count); + + srcoffset += pitch; + cim_cmd_ptr += total_dwords << 2; + } + + WRITE_GP32(GP3_CMD_WRITE, gp3_cmd_next); + gp3_cmd_current = gp3_cmd_next; + } else { + /* WRITE DATA LINE BY LINE + * Each line will be created as a separate command buffer entry to + * allow line-by-line wrapping and to allow simultaneous rendering + * by the HW. + */ + + while (height--) { + /* UPDATE THE COMMAND POINTER + * The WRITE_COMMANDXX macros use a pointer to the current buffer + * space. This is created by adding gp3_cmd_current to the base + * pointer. + */ + + cim_cmd_ptr = cim_cmd_base_ptr + gp3_cmd_current; + + /* CHECK IF A WRAP WILL BE NEEDED */ + + gp3_cmd_next = gp3_cmd_current + size_dwords; + if ((gp3_cmd_bottom - gp3_cmd_next) <= GP3_MAX_COMMAND_SIZE) { + gp3_cmd_next = gp3_cmd_top; + + /* WAIT FOR HARDWARE */ + + GP3_WAIT_WRAP(temp); + WRITE_COMMAND32(0, GP3_DATA_LOAD_HDR_TYPE | + GP3_DATA_LOAD_HDR_WRAP | GP3_DATA_LOAD_HDR_ENABLE); + } else { + /* WAIT FOR AVAILABLE SPACE */ + + GP3_WAIT_PRIMITIVE(temp); + WRITE_COMMAND32(0, GP3_DATA_LOAD_HDR_TYPE | + GP3_DATA_LOAD_HDR_ENABLE); + } + + /* WRITE DWORD COUNT */ + + WRITE_COMMAND32(4, GP3_CH3_HOST_SOURCE_TYPE | total_dwords); + + /* WRITE DATA */ + + WRITE_COMMAND_STRING32(8, data, srcoffset, dword_count); + WRITE_COMMAND_STRING8(8 + (dword_count << 2), data, + srcoffset + (dword_count << 2), byte_count); + + /* UPDATE POINTERS */ + + srcoffset += pitch; + WRITE_GP32(GP3_CMD_WRITE, gp3_cmd_next); + gp3_cmd_current = gp3_cmd_next; + } + } +} + +/*--------------------------------------------------------------------------- + * gp_custom_convert_blt + * + * This routine is identical to gp_color_convert_blt, except that the macro + * to write data to the frame buffer has been replaced with a new macro. This + * allows a user to implement custom behavior when sending data, such as + * manually converting 24BPP to 32BPP, converting 2BPP to 4BPP or + * premultiplying alpha data. + *-------------------------------------------------------------------------*/ + +void +gp_custom_convert_blt(unsigned long dstoffset, unsigned long srcx, + unsigned long width, unsigned long height, + unsigned char *data, long pitch) +{ + unsigned long indent, temp; + unsigned long total_dwords, size_dwords; + unsigned long dword_count, byte_count; + unsigned long size = ((width << 16) | height); + unsigned long ch3_offset, srcoffset; + unsigned long ch3_size, base; + + /* ASSUME BITMAPS ARE DWORD ALIGNED */ + /* We will offset into the source data in DWORD increments. We */ + /* set the source index to the remaining byte offset and */ + /* increment the size of each line to account for the dont-care */ + /* pixel(s). For 4BPP source data, we also set the appropriate */ + /* nibble index. */ + + /* CALCULATE THE SIZE OF ONE LINE */ + + if ((gp3_src_format & GP3_CH3_SRC_MASK) == GP3_CH3_SRC_24BPP_PACKED) { + /* HANDLE 24BPP + * Note that we do not do anything to guarantee that the source data + * is DWORD aligned. The logic here is that the source data will be + * cacheable, in which case Geode LX will not lose any clocks for + * unaligned moves. Also note that the channel 3 width is programmed + * as the number of dwords, while the normal width is programmed as + * the number of pixels. + */ + + srcoffset = srcx * 3; + ch3_offset = 0; + temp = width * 3; + ch3_size = (((temp + 3) >> 2) << 16) | height; + } else { + ch3_size = size; + + if (gp3_src_pix_shift == 3) { + /* CALCULATE INDENT AND SOURCE OFFSET */ + + indent = (srcx >> 1); + srcoffset = (indent & ~3L); + indent &= 3; + ch3_offset = indent | ((srcx & 1) << 25); + + temp = ((width + (srcx & 1) + 1) >> 1) + indent; + } else { + indent = (srcx << gp3_src_pix_shift); + srcoffset = (indent & ~3L); + indent &= 3; + ch3_offset = indent; + + temp = (width << gp3_src_pix_shift) + indent; + } + } + + total_dwords = (temp + 3) >> 2; + size_dwords = (total_dwords << 2) + 8; + dword_count = (temp >> 2); + byte_count = (temp & 3); + + base = ((gp3_fb_base << 24) + (dstoffset & 0xFFC00000)) | + (gp3_base_register & ~GP3_BASE_OFFSET_DSTMASK); + + /* SET APPROPRIATE ENABLES */ + + gp3_cmd_header |= GP3_BLT_HDR_DST_OFF_ENABLE | + GP3_BLT_HDR_WIDHI_ENABLE | + GP3_BLT_HDR_CH3_STR_ENABLE | + GP3_BLT_HDR_CH3_OFF_ENABLE | + GP3_BLT_HDR_CH3_WIDHI_ENABLE | + GP3_BLT_HDR_BASE_OFFSET_ENABLE | GP3_BLT_HDR_BLT_MODE_ENABLE; + + WRITE_COMMAND32(GP3_BLT_DST_OFFSET, + (dstoffset & 0x3FFFFF) | gp3_pat_origin); + WRITE_COMMAND32(GP3_BLT_CH3_OFFSET, ch3_offset); + WRITE_COMMAND32(GP3_BLT_WID_HEIGHT, size); + WRITE_COMMAND32(GP3_BLT_CH3_WIDHI, ch3_size); + WRITE_COMMAND32(GP3_BLT_BASE_OFFSET, base); + WRITE_COMMAND32(GP3_BLT_CH3_MODE_STR, GP3_CH3_C3EN | + GP3_CH3_REPLACE_SOURCE | GP3_CH3_HST_SRC_ENABLE | + gp3_src_format | ((gp3_blt_flags & CIMGP_BLTFLAGS_PRES_LUT) << 20)); + WRITE_COMMAND32(GP3_BLT_MODE, gp3_blt_mode); + + /* START THE BLT */ + + WRITE_COMMAND32(GP3_BLT_CMD_HEADER, gp3_cmd_header); + WRITE_GP32(GP3_CMD_WRITE, gp3_cmd_next); + gp3_cmd_current = gp3_cmd_next; + + if (((total_dwords << 2) * height) <= GP3_BLT_1PASS_SIZE && + (gp3_cmd_bottom - gp3_cmd_current) > (GP3_BLT_1PASS_SIZE + 72)) { + /* UPDATE THE COMMAND POINTER */ + + cim_cmd_ptr = cim_cmd_base_ptr + gp3_cmd_current; + + /* CHECK IF A WRAP WILL BE NEEDED */ + + gp3_cmd_next = gp3_cmd_current + ((total_dwords << 2) * height) + 8; + + if ((gp3_cmd_bottom - gp3_cmd_next) <= GP3_MAX_COMMAND_SIZE) { + gp3_cmd_next = gp3_cmd_top; + + GP3_WAIT_WRAP(temp); + WRITE_COMMAND32(0, + GP3_DATA_LOAD_HDR_TYPE | GP3_DATA_LOAD_HDR_WRAP | + GP3_DATA_LOAD_HDR_ENABLE); + } else { + GP3_WAIT_PRIMITIVE(temp); + WRITE_COMMAND32(0, + GP3_DATA_LOAD_HDR_TYPE | GP3_DATA_LOAD_HDR_ENABLE); + } + + /* WRITE DWORD COUNT */ + + WRITE_COMMAND32(4, + GP3_CH3_HOST_SOURCE_TYPE | (total_dwords * height)); + + while (height--) { + /* WRITE DATA */ + + WRITE_CUSTOM_COMMAND_STRING32(8, data, srcoffset, dword_count); + WRITE_CUSTOM_COMMAND_STRING8(8 + (dword_count << 2), data, + srcoffset + (dword_count << 2), byte_count); + + srcoffset += pitch; + cim_cmd_ptr += total_dwords << 2; + } + + WRITE_GP32(GP3_CMD_WRITE, gp3_cmd_next); + gp3_cmd_current = gp3_cmd_next; + } else { + /* WRITE DATA LINE BY LINE + * Each line will be created as a separate command buffer entry to + * allow line-by-line wrapping and to allow simultaneous rendering + * by the HW. + */ + + while (height--) { + /* UPDATE THE COMMAND POINTER + * The WRITE_COMMANDXX macros use a pointer to the current buffer + * space. This is created by adding gp3_cmd_current to the base + * pointer. + */ + + cim_cmd_ptr = cim_cmd_base_ptr + gp3_cmd_current; + + /* CHECK IF A WRAP WILL BE NEEDED */ + + gp3_cmd_next = gp3_cmd_current + size_dwords; + if ((gp3_cmd_bottom - gp3_cmd_next) <= GP3_MAX_COMMAND_SIZE) { + gp3_cmd_next = gp3_cmd_top; + + /* WAIT FOR HARDWARE */ + + GP3_WAIT_WRAP(temp); + WRITE_COMMAND32(0, + GP3_DATA_LOAD_HDR_TYPE | GP3_DATA_LOAD_HDR_WRAP | + GP3_DATA_LOAD_HDR_ENABLE); + } else { + /* WAIT FOR AVAILABLE SPACE */ + + GP3_WAIT_PRIMITIVE(temp); + WRITE_COMMAND32(0, + GP3_DATA_LOAD_HDR_TYPE | GP3_DATA_LOAD_HDR_ENABLE); + } + + /* WRITE DWORD COUNT */ + + WRITE_COMMAND32(4, GP3_CH3_HOST_SOURCE_TYPE | total_dwords); + + /* WRITE DATA */ + + WRITE_CUSTOM_COMMAND_STRING32(8, data, srcoffset, dword_count); + WRITE_CUSTOM_COMMAND_STRING8(8 + (dword_count << 2), data, + srcoffset + (dword_count << 2), byte_count); + + /* UPDATE POINTERS */ + + srcoffset += pitch; + WRITE_GP32(GP3_CMD_WRITE, gp3_cmd_next); + gp3_cmd_current = gp3_cmd_next; + } + } +} + +/*--------------------------------------------------------------------------- + * gp_rotate_blt + * + * This routine is called to rotate a rectangular area of video memory. The + * data may be color converted during the rotation. 'Degrees' must be a + * multiple of 90 and indicates a clockwise rotation. Width and height + * refer to the width and the height of the source. The output + * destinations will be equal to the rotated dimensions. + *-------------------------------------------------------------------------*/ + +void +gp_rotate_blt(unsigned long dstoffset, unsigned long srcoffset, + unsigned long width, unsigned long height, int degrees) +{ + unsigned long sizein, sizeout; + unsigned long ch3_flags; + unsigned long base; + + base = ((gp3_fb_base << 24) + (dstoffset & 0xFFC00000)) | + ((gp3_fb_base << 4) + ((srcoffset & 0xFFC00000) >> 20)) | + (gp3_base_register & GP3_BASE_OFFSET_SRCMASK); + + srcoffset &= 0x3FFFFF; + dstoffset &= 0x3FFFFF; + + /* SET ROTATION PARAMETERS */ + + switch (degrees) { + case 90: + srcoffset += (height - 1) * gp3_src_stride; + sizein = ((width << 16) | height); + sizeout = ((height << 16) | width); + ch3_flags = GP3_CH3_C3EN | GP3_CH3_REPLACE_SOURCE | + GP3_CH3_ROTATE_ENABLE | GP3_CH3_NEG_YDIR; + break; + + case 180: + srcoffset += (height - 1) * gp3_src_stride; + srcoffset += (width << gp3_src_pix_shift) - 1; + sizein = sizeout = ((width << 16) | height); + ch3_flags = GP3_CH3_C3EN | GP3_CH3_REPLACE_SOURCE | + GP3_CH3_NEG_YDIR | GP3_CH3_NEG_XDIR; + break; + + case 270: + srcoffset += (width << gp3_src_pix_shift) - 1; + sizein = ((width << 16) | height); + sizeout = ((height << 16) | width); + ch3_flags = GP3_CH3_C3EN | GP3_CH3_REPLACE_SOURCE | + GP3_CH3_ROTATE_ENABLE | GP3_CH3_NEG_XDIR; + break; + + default: + sizein = sizeout = ((width << 16) | height); + ch3_flags = GP3_CH3_C3EN | GP3_CH3_REPLACE_SOURCE; + break; + } + + /* SET APPROPRIATE ENABLES */ + /* We override the raster mode setting with a source */ + /* copy ROP. */ + + gp3_cmd_header |= GP3_BLT_HDR_RASTER_ENABLE | + GP3_BLT_HDR_DST_OFF_ENABLE | + GP3_BLT_HDR_WIDHI_ENABLE | + GP3_BLT_HDR_CH3_OFF_ENABLE | + GP3_BLT_HDR_CH3_STR_ENABLE | + GP3_BLT_HDR_CH3_WIDHI_ENABLE | + GP3_BLT_HDR_BASE_OFFSET_ENABLE | GP3_BLT_HDR_BLT_MODE_ENABLE; + + /* WRITE ALL BLT REGISTERS */ + + WRITE_COMMAND32(GP3_BLT_RASTER_MODE, gp3_bpp | 0xCC); + WRITE_COMMAND32(GP3_BLT_DST_OFFSET, dstoffset); + WRITE_COMMAND32(GP3_BLT_WID_HEIGHT, sizeout); + WRITE_COMMAND32(GP3_BLT_CH3_WIDHI, sizein); + WRITE_COMMAND32(GP3_BLT_CH3_OFFSET, srcoffset); + WRITE_COMMAND32(GP3_BLT_CH3_MODE_STR, ch3_flags | gp3_src_format | + ((gp3_blt_flags & CIMGP_BLTFLAGS_PRES_LUT) << 20) | + ((gp3_blt_flags & CIMGP_ENABLE_PREFETCH) << 17) | gp3_src_stride); + WRITE_COMMAND32(GP3_BLT_BASE_OFFSET, base); + + /* START THE BLT */ + + WRITE_COMMAND32(GP3_BLT_CMD_HEADER, gp3_cmd_header); + WRITE_COMMAND32(GP3_BLT_MODE, gp3_blt_mode); + WRITE_GP32(GP3_CMD_WRITE, gp3_cmd_next); + gp3_cmd_current = gp3_cmd_next; +} + +/*--------------------------------------------------------------------------- + * gp_mono_bitmap_to_screen_blt + * + * This routine expands and BLTs a monchrome bitmap that is stored in system + * memory into the framebuffer. 'data' points to an array of monochrome data. + * 'stride' indicates the pitch between successive lines of monochrome data. + * 'srcx' indicates the x coordinate within each line of blend data + * corresponding to the first pixel. A y coordinate for the source is + * deliberately omitted to avoid extra calculation for simple cases that have + * no y index. The calling program must adjust the data pointer accordingly. + *-------------------------------------------------------------------------*/ + +void +gp_mono_bitmap_to_screen_blt(unsigned long dstoffset, unsigned long srcx, + unsigned long width, unsigned long height, + unsigned char *data, long stride) +{ + unsigned long indent, temp; + unsigned long total_dwords, size_dwords; + unsigned long dword_count, byte_count; + unsigned long size = ((width << 16) | height); + unsigned long srcoffset, src_value; + + /* ASSUME BITMAPS ARE DWORD ALIGNED */ + /* We will offset into the source data in DWORD increments. We */ + /* set the source index to the remaining byte offset and */ + /* increment the size of each line to account for the dont-care */ + /* pixel(s). */ + + indent = (srcx >> 3); + srcoffset = (indent & ~3L); + indent &= 3; + src_value = (indent | ((srcx & 7) << 26)); + + /* PROGRAM THE NORMAL SOURCE CHANNEL REGISTERS */ + /* We assume that a color pattern is being ROPed with source */ + /* data if the pattern type is color and the preserve pattern */ + /* was set. */ + + gp3_cmd_header |= GP3_BLT_HDR_SRC_OFF_ENABLE | + GP3_BLT_HDR_DST_OFF_ENABLE | + GP3_BLT_HDR_WIDHI_ENABLE | + GP3_BLT_HDR_CH3_STR_ENABLE | + GP3_BLT_HDR_BASE_OFFSET_ENABLE | + GP3_BLT_HDR_RASTER_ENABLE | GP3_BLT_HDR_BLT_MODE_ENABLE; + + if (gp3_ch3_pat) { + gp3_cmd_header |= + GP3_BLT_HDR_CH3_OFF_ENABLE | GP3_BLT_HDR_CH3_WIDHI_ENABLE; + + WRITE_COMMAND32(GP3_BLT_CH3_OFFSET, gp3_pat_origin); + WRITE_COMMAND32(GP3_BLT_DST_OFFSET, (dstoffset & 0x3FFFFF)); + WRITE_COMMAND32(GP3_BLT_CH3_MODE_STR, gp3_pat_format); + WRITE_COMMAND32(GP3_BLT_CH3_WIDHI, size); + } else { + WRITE_COMMAND32(GP3_BLT_DST_OFFSET, + ((dstoffset & 0x3FFFFF) | gp3_pat_origin)); + WRITE_COMMAND32(GP3_BLT_CH3_MODE_STR, 0); + } + if (gp3_blt_flags & CIMGP_BLTFLAGS_INVERTMONO) { + WRITE_COMMAND32(GP3_BLT_RASTER_MODE, + gp3_raster_mode | GP3_RM_SOURCE_INVERT); + } else { + WRITE_COMMAND32(GP3_BLT_RASTER_MODE, + gp3_raster_mode & ~GP3_RM_SOURCE_INVERT); + } + WRITE_COMMAND32(GP3_BLT_SRC_OFFSET, src_value); + WRITE_COMMAND32(GP3_BLT_WID_HEIGHT, size); + WRITE_COMMAND32(GP3_BLT_BASE_OFFSET, + ((gp3_fb_base << 24) + (dstoffset & 0xFFC00000))); + WRITE_COMMAND32(GP3_BLT_MODE, + gp3_blt_mode | GP3_BM_SRC_HOST | GP3_BM_SRC_MONO); + + /* START THE BLT */ + + WRITE_COMMAND32(GP3_BLT_CMD_HEADER, gp3_cmd_header); + WRITE_GP32(GP3_CMD_WRITE, gp3_cmd_next); + gp3_cmd_current = gp3_cmd_next; + + /* CALCULATE THE SIZE OF ONE LINE */ + + size = ((width + (srcx & 7) + 7) >> 3) + indent; + total_dwords = (size + 3) >> 2; + size_dwords = (total_dwords << 2) + 8; + dword_count = (size >> 2); + byte_count = (size & 3); + + /* CHECK FOR SMALL BLT CASE */ + /* If the total amount of monochrome data is less than 50K and we have */ + /* room in the command buffer, we will do all data writes in a single */ + /* data packet. */ + + if (((total_dwords << 2) * height) <= GP3_BLT_1PASS_SIZE && + (gp3_cmd_bottom - gp3_cmd_current) > (GP3_BLT_1PASS_SIZE + 72)) { + /* UPDATE THE COMMAND POINTER */ + + cim_cmd_ptr = cim_cmd_base_ptr + gp3_cmd_current; + + /* CHECK IF A WRAP WILL BE NEEDED */ + + gp3_cmd_next = gp3_cmd_current + ((total_dwords << 2) * height) + 8; + + if ((gp3_cmd_bottom - gp3_cmd_next) <= GP3_MAX_COMMAND_SIZE) { + gp3_cmd_next = gp3_cmd_top; + + GP3_WAIT_WRAP(temp); + WRITE_COMMAND32(0, + GP3_DATA_LOAD_HDR_TYPE | GP3_DATA_LOAD_HDR_WRAP | + GP3_DATA_LOAD_HDR_ENABLE); + } else { + GP3_WAIT_PRIMITIVE(temp); + WRITE_COMMAND32(0, + GP3_DATA_LOAD_HDR_TYPE | GP3_DATA_LOAD_HDR_ENABLE); + } + + /* WRITE DWORD COUNT */ + + WRITE_COMMAND32(4, GP3_HOST_SOURCE_TYPE | (total_dwords * height)); + + while (height--) { + /* WRITE DATA */ + + WRITE_COMMAND_STRING32(8, data, srcoffset, dword_count); + WRITE_COMMAND_STRING8(8 + (dword_count << 2), data, + srcoffset + (dword_count << 2), byte_count); + + srcoffset += stride; + cim_cmd_ptr += total_dwords << 2; + } + + WRITE_GP32(GP3_CMD_WRITE, gp3_cmd_next); + gp3_cmd_current = gp3_cmd_next; + } else { + /* WRITE DATA LINE BY LINE + * Each line will be created as a separate command buffer entry to + * allow line-by-line wrapping and to allow simultaneous rendering + * by the HW. + */ + + while (height--) { + /* UPDATE THE COMMAND POINTER + * The WRITE_COMMANDXX macros use a pointer to the current buffer + * space. This is created by adding gp3_cmd_current to the base + * pointer. + */ + + cim_cmd_ptr = cim_cmd_base_ptr + gp3_cmd_current; + + /* CHECK IF A WRAP WILL BE NEEDED */ + + gp3_cmd_next = gp3_cmd_current + size_dwords; + if ((gp3_cmd_bottom - gp3_cmd_next) <= GP3_MAX_COMMAND_SIZE) { + gp3_cmd_next = gp3_cmd_top; + + /* WAIT FOR HARDWARE */ + + GP3_WAIT_WRAP(temp); + WRITE_COMMAND32(0, + GP3_DATA_LOAD_HDR_TYPE | GP3_DATA_LOAD_HDR_WRAP | + GP3_DATA_LOAD_HDR_ENABLE); + } else { + /* WAIT FOR AVAILABLE SPACE */ + + GP3_WAIT_PRIMITIVE(temp); + WRITE_COMMAND32(0, + GP3_DATA_LOAD_HDR_TYPE | GP3_DATA_LOAD_HDR_ENABLE); + } + + /* WRITE DWORD COUNT */ + + WRITE_COMMAND32(4, GP3_HOST_SOURCE_TYPE | total_dwords); + + /* WRITE DATA */ + + WRITE_COMMAND_STRING32(8, data, srcoffset, dword_count); + WRITE_COMMAND_STRING8(8 + (dword_count << 2), data, + srcoffset + (dword_count << 2), byte_count); + + /* UPDATE POINTERS */ + + srcoffset += stride; + WRITE_GP32(GP3_CMD_WRITE, gp3_cmd_next); + gp3_cmd_current = gp3_cmd_next; + } + } +} + +/*--------------------------------------------------------------------------- + * gp_text_blt + * + * This routine expands and BLTs byte-packed monochrome data to the screen. + * There is assumed to be no x clipping involved in the BLT. + *-------------------------------------------------------------------------*/ + +void +gp_text_blt(unsigned long dstoffset, unsigned long width, + unsigned long height, unsigned char *data) +{ + unsigned long temp, dwords_total; + unsigned long dword_count, byte_count; + unsigned long size = ((width << 16) | height); + unsigned long srcoffset = 0; + + /* PROGRAM THE NORMAL SOURCE CHANNEL REGISTERS */ + /* We assume that a color pattern is being ROPed with source */ + /* data if the pattern type is color and the preserve pattern */ + /* was set. */ + + gp3_cmd_header |= GP3_BLT_HDR_SRC_OFF_ENABLE | + GP3_BLT_HDR_DST_OFF_ENABLE | + GP3_BLT_HDR_WIDHI_ENABLE | + GP3_BLT_HDR_CH3_STR_ENABLE | + GP3_BLT_HDR_BASE_OFFSET_ENABLE | + GP3_BLT_HDR_RASTER_ENABLE | GP3_BLT_HDR_BLT_MODE_ENABLE; + + if (gp3_ch3_pat) { + gp3_cmd_header |= + GP3_BLT_HDR_CH3_OFF_ENABLE | GP3_BLT_HDR_CH3_WIDHI_ENABLE; + + WRITE_COMMAND32(GP3_BLT_CH3_OFFSET, gp3_pat_origin); + WRITE_COMMAND32(GP3_BLT_DST_OFFSET, (dstoffset & 0x3FFFFF)); + WRITE_COMMAND32(GP3_BLT_CH3_MODE_STR, gp3_pat_format); + WRITE_COMMAND32(GP3_BLT_CH3_WIDHI, size); + } else { + WRITE_COMMAND32(GP3_BLT_DST_OFFSET, + ((dstoffset & 0x3FFFFF) | gp3_pat_origin)); + WRITE_COMMAND32(GP3_BLT_CH3_MODE_STR, 0); + } + if (gp3_blt_flags & CIMGP_BLTFLAGS_INVERTMONO) { + WRITE_COMMAND32(GP3_BLT_RASTER_MODE, + gp3_raster_mode | GP3_RM_SOURCE_INVERT); + } else { + WRITE_COMMAND32(GP3_BLT_RASTER_MODE, + gp3_raster_mode & ~GP3_RM_SOURCE_INVERT); + } + + WRITE_COMMAND32(GP3_BLT_SRC_OFFSET, 0); + WRITE_COMMAND32(GP3_BLT_WID_HEIGHT, size); + WRITE_COMMAND32(GP3_BLT_BASE_OFFSET, + ((gp3_fb_base << 24) + (dstoffset & 0xFFC00000))); + WRITE_COMMAND32(GP3_BLT_MODE, + gp3_blt_mode | GP3_BM_SRC_HOST | GP3_BM_SRC_BP_MONO); + + /* START THE BLT */ + + WRITE_COMMAND32(GP3_BLT_CMD_HEADER, gp3_cmd_header); + WRITE_GP32(GP3_CMD_WRITE, gp3_cmd_next); + gp3_cmd_current = gp3_cmd_next; + + /* CALCULATE THE TOTAL NUMBER OF BYTES */ + + size = ((width + 7) >> 3) * height; + + /* WRITE ALL DATA IN CHUNKS */ + + do { + /* UPDATE THE COMMAND POINTER */ + + cim_cmd_ptr = cim_cmd_base_ptr + gp3_cmd_current; + + if (size > 8192) { + dword_count = 2048; + byte_count = 0; + dwords_total = 2048; + size -= 8192; + } else { + dword_count = (size >> 2); + byte_count = (size & 3); + dwords_total = (size + 3) >> 2; + size = 0; + } + gp3_cmd_next = gp3_cmd_current + (dwords_total << 2) + 8; + + /* CHECK IF A WRAP WILL BE NEEDED */ + + if ((gp3_cmd_bottom - gp3_cmd_next) <= GP3_MAX_COMMAND_SIZE) { + gp3_cmd_next = gp3_cmd_top; + + /* WAIT FOR HARDWARE */ + + GP3_WAIT_WRAP(temp); + WRITE_COMMAND32(0, + GP3_DATA_LOAD_HDR_TYPE | GP3_DATA_LOAD_HDR_WRAP | + GP3_DATA_LOAD_HDR_ENABLE); + } else { + /* WAIT FOR AVAILABLE SPACE */ + + GP3_WAIT_PRIMITIVE(temp); + WRITE_COMMAND32(0, + GP3_DATA_LOAD_HDR_TYPE | GP3_DATA_LOAD_HDR_ENABLE); + } + + /* WRITE DWORD COUNT */ + + WRITE_COMMAND32(4, GP3_HOST_SOURCE_TYPE | dwords_total); + + /* WRITE DATA */ + + WRITE_COMMAND_STRING32(8, data, srcoffset, dword_count); + WRITE_COMMAND_STRING8(8 + (dword_count << 2), data, + srcoffset + (dword_count << 2), byte_count); + + WRITE_GP32(GP3_CMD_WRITE, gp3_cmd_next); + gp3_cmd_current = gp3_cmd_next; + + /* UPDATE THE SOURCE OFFSET */ + /* We add a constant value because the code will loop only if the */ + /* data exceeds 8192 bytes. */ + + srcoffset += 8192; + + } while (size); +} + +/*--------------------------------------------------------------------------- + * gp_mono_expand_blt + * + * This routine expands monochrome data that is stored in video memory into + * the current BPP. The source and destination regions are assumed not to + * overlap. The pitch of the source data is specified in gp_set_strides. + * 'srcy' is deliberately omitted to prevent extra calculations for simple + * applications that have no source indexes. + *-------------------------------------------------------------------------*/ + +void +gp_mono_expand_blt(unsigned long dstoffset, unsigned long srcoffset, + unsigned long srcx, unsigned long width, + unsigned long height, int byte_packed) +{ + unsigned long base; + unsigned long blt_mode; + unsigned long size = ((width << 16) | height); + + /* ADJUST SOURCE OFFSET */ + + srcoffset += (srcx >> 3); + srcx &= 7; + + /* CALCULATE BASE OFFSET REGISTER */ + + base = ((gp3_fb_base << 24) + (dstoffset & 0xFFC00000)) | + ((gp3_fb_base << 14) + ((srcoffset & 0xFFC00000) >> 10)) | + (gp3_base_register & GP3_BASE_OFFSET_CH3MASK); + + /* SET THE SOURCE TYPE */ + + if (byte_packed) + blt_mode = gp3_blt_mode | GP3_BM_SRC_FB | GP3_BM_SRC_BP_MONO; + else + blt_mode = gp3_blt_mode | GP3_BM_SRC_FB | GP3_BM_SRC_MONO; + + /* SET HEADER ENABLES */ + + gp3_cmd_header |= GP3_BLT_HDR_SRC_OFF_ENABLE | + GP3_BLT_HDR_DST_OFF_ENABLE | + GP3_BLT_HDR_WIDHI_ENABLE | + GP3_BLT_HDR_CH3_STR_ENABLE | + GP3_BLT_HDR_BASE_OFFSET_ENABLE | + GP3_BLT_HDR_RASTER_ENABLE | GP3_BLT_HDR_BLT_MODE_ENABLE; + + /* ENABLE COLOR PATTERN IF APPLICABLE */ + + if (gp3_ch3_pat) { + gp3_cmd_header |= + GP3_BLT_HDR_CH3_OFF_ENABLE | GP3_BLT_HDR_CH3_WIDHI_ENABLE; + + WRITE_COMMAND32(GP3_BLT_CH3_OFFSET, gp3_pat_origin); + WRITE_COMMAND32(GP3_BLT_DST_OFFSET, (dstoffset & 0x3FFFFF)); + WRITE_COMMAND32(GP3_BLT_CH3_MODE_STR, gp3_pat_format); + WRITE_COMMAND32(GP3_BLT_CH3_WIDHI, size); + } else { + WRITE_COMMAND32(GP3_BLT_DST_OFFSET, + ((dstoffset & 0x3FFFFF) | gp3_pat_origin)); + WRITE_COMMAND32(GP3_BLT_CH3_MODE_STR, 0); + } + if (gp3_blt_flags & CIMGP_BLTFLAGS_INVERTMONO) { + WRITE_COMMAND32(GP3_BLT_RASTER_MODE, + gp3_raster_mode | GP3_RM_SOURCE_INVERT); + } else { + WRITE_COMMAND32(GP3_BLT_RASTER_MODE, + gp3_raster_mode & ~GP3_RM_SOURCE_INVERT); + } + + WRITE_COMMAND32(GP3_BLT_BASE_OFFSET, base); + WRITE_COMMAND32(GP3_BLT_SRC_OFFSET, + (srcoffset & 0x3FFFFF) | (srcx << 26)); + WRITE_COMMAND32(GP3_BLT_WID_HEIGHT, size); + + /* WORKAROUND FOR SIBZ #3744 + * Under extremely rare conditions, very narrow byte-packed mono BLTs + * can hang the GP. Even under the rare case, the bad condition will + * only happen once every 16 lines. The workaround is to break the + * offending BLT into a series of safer BLTs. This method is preferred + * over a two-pass approach because it does not require saving and + * restoring any GP state, such as the ROP or mono colors. + */ + + if ((gp3_blt_mode & GP3_BM_DST_REQ) && byte_packed && (gp3_pix_shift < 2) + && (width < 5) && ((srcoffset & 0x1F) == 0x1F) + && ((srcx + width) > 8)) { + unsigned long dstoff1, size1, org1; + unsigned long dstoff2, size2, org2; + unsigned long tempheight; + + size1 = ((8 - srcx) << 16) | 1; + size2 = ((width + srcx - 8) << 16) | 1; + org1 = gp3_pat_origin; + org2 = (org1 & 0xE0000000) | + ((org1 + ((8 - srcx) << 26)) & 0x1C000000); + dstoff1 = dstoffset & 0x3FFFFF; + dstoff2 = (dstoff1 + 8 - srcx) << gp3_pix_shift; + + while (height) { + /* DIVIDE THE FIRST LINE INTO TWO SINGLE LINE BLTS */ + + WRITE_COMMAND32(GP3_BLT_WID_HEIGHT, size1); + WRITE_COMMAND32(GP3_BLT_CH3_WIDHI, size1); + WRITE_COMMAND32(GP3_BLT_SRC_OFFSET, + (srcoffset & 0x3FFFFF) | (srcx << 26)); + WRITE_COMMAND32(GP3_BLT_DST_OFFSET, dstoff1 | org1); + WRITE_COMMAND32(GP3_BLT_CH3_OFFSET, org1); + WRITE_COMMAND32(GP3_BLT_CMD_HEADER, gp3_cmd_header); + WRITE_COMMAND32(GP3_BLT_MODE, blt_mode); + WRITE_GP32(GP3_CMD_WRITE, gp3_cmd_next); + gp3_cmd_current = gp3_cmd_next; + gp_wait_until_idle(); + + gp_declare_blt(gp3_blt_flags); + gp3_cmd_header |= GP3_BLT_HDR_SRC_OFF_ENABLE | + GP3_BLT_HDR_DST_OFF_ENABLE | + GP3_BLT_HDR_WIDHI_ENABLE | + GP3_BLT_HDR_BLT_MODE_ENABLE | + GP3_BLT_HDR_CH3_OFF_ENABLE | GP3_BLT_HDR_CH3_WIDHI_ENABLE; + WRITE_COMMAND32(GP3_BLT_WID_HEIGHT, size2); + WRITE_COMMAND32(GP3_BLT_CH3_WIDHI, size2); + WRITE_COMMAND32(GP3_BLT_SRC_OFFSET, ((srcoffset + 1) & 0x3FFFFF)); + WRITE_COMMAND32(GP3_BLT_DST_OFFSET, dstoff2 | org2); + WRITE_COMMAND32(GP3_BLT_CH3_OFFSET, org2); + WRITE_COMMAND32(GP3_BLT_CMD_HEADER, gp3_cmd_header); + WRITE_COMMAND32(GP3_BLT_MODE, blt_mode); + WRITE_GP32(GP3_CMD_WRITE, gp3_cmd_next); + gp3_cmd_current = gp3_cmd_next; + gp_wait_until_idle(); + + if (--height) { + org1 += 0x20000000; + org2 += 0x20000000; + dstoff1 += gp3_dst_stride; + dstoff2 += gp3_dst_stride; + srcoffset += 2; + + /* THE NEXT 15 LINES ARE NOW 'SAFE' - THEY DO NOT SHOW THE + * PROBLEM */ + + tempheight = 15; + if (tempheight > height) + tempheight = height; + + gp_declare_blt(gp3_blt_flags); + gp3_cmd_header |= GP3_BLT_HDR_SRC_OFF_ENABLE | + GP3_BLT_HDR_DST_OFF_ENABLE | + GP3_BLT_HDR_WIDHI_ENABLE | + GP3_BLT_HDR_BLT_MODE_ENABLE | + GP3_BLT_HDR_CH3_OFF_ENABLE | GP3_BLT_HDR_CH3_WIDHI_ENABLE; + WRITE_COMMAND32(GP3_BLT_WID_HEIGHT, + (width << 16) | tempheight); + WRITE_COMMAND32(GP3_BLT_CH3_WIDHI, + (width << 16) | tempheight); + WRITE_COMMAND32(GP3_BLT_SRC_OFFSET, + (srcoffset & 0x3FFFFF) | (srcx << 26)); + WRITE_COMMAND32(GP3_BLT_DST_OFFSET, dstoff1 | org1); + WRITE_COMMAND32(GP3_BLT_CH3_OFFSET, org1); + WRITE_COMMAND32(GP3_BLT_CMD_HEADER, gp3_cmd_header); + WRITE_COMMAND32(GP3_BLT_MODE, blt_mode); + WRITE_GP32(GP3_CMD_WRITE, gp3_cmd_next); + gp3_cmd_current = gp3_cmd_next; + gp_wait_until_idle(); + + height -= tempheight; + + if (height) { + gp_declare_blt(gp3_blt_flags); + gp3_cmd_header |= GP3_BLT_HDR_SRC_OFF_ENABLE | + GP3_BLT_HDR_DST_OFF_ENABLE | + GP3_BLT_HDR_WIDHI_ENABLE | + GP3_BLT_HDR_BLT_MODE_ENABLE | + GP3_BLT_HDR_CH3_OFF_ENABLE | + GP3_BLT_HDR_CH3_WIDHI_ENABLE; + + /* ADJUST ORIGIN */ + /* If we get here, we added a full 15 lines which is + * equivalent to subtracting one from the pattern y origin + * (adding 15). */ + + org1 -= 0x20000000; + org2 -= 0x20000000; + dstoff1 += (gp3_dst_stride * 15); + dstoff2 += (gp3_dst_stride * 15); + srcoffset += 30; + } + } + } + return; + } + + /* START THE BLT */ + + WRITE_COMMAND32(GP3_BLT_CMD_HEADER, gp3_cmd_header); + WRITE_COMMAND32(GP3_BLT_MODE, blt_mode); + WRITE_GP32(GP3_CMD_WRITE, gp3_cmd_next); + gp3_cmd_current = gp3_cmd_next; +} + +/*--------------------------------------------------------------------------- + * gp_antialiased_text + * + * This routine implements alpha blending between a constant source color and + * a destination region. The degree of the blend is controlled by an array + * of 4BPP/8BPP values specified in 'data'. 'stride' indicates the pitch + * between successive lines of blend data. 'srcx' indicates the x + * coordinate within each line of blend data corresponding to the first + * pixel. A y coordinate for the source is deliberately omitted to avoid + * extra calculation for simple cases that have no y index. The calling + * program must adjust the data pointer accordingly. 'fourbpp' selects + * between 4BPP and 8BPP alpha. + *-------------------------------------------------------------------------*/ + +void +gp_antialiased_text(unsigned long dstoffset, unsigned long srcx, + unsigned long width, unsigned long height, + unsigned char *data, long stride, int fourbpp) +{ + unsigned long indent, temp; + unsigned long total_dwords, size_dwords; + unsigned long dword_count, byte_count; + unsigned long size = ((width << 16) | height); + unsigned long ch3_offset, srcoffset; + unsigned long base, depth_flag; + + base = ((gp3_fb_base << 24) + (dstoffset & 0xFFC00000)) | + (gp3_base_register & ~GP3_BASE_OFFSET_DSTMASK); + + /* ENABLE ALL RELEVANT REGISTERS */ + /* We override the raster mode register to force the */ + /* correct alpha blend */ + + gp3_cmd_header |= GP3_BLT_HDR_RASTER_ENABLE | + GP3_BLT_HDR_DST_OFF_ENABLE | + GP3_BLT_HDR_WIDHI_ENABLE | + GP3_BLT_HDR_CH3_OFF_ENABLE | + GP3_BLT_HDR_CH3_STR_ENABLE | + GP3_BLT_HDR_CH3_WIDHI_ENABLE | + GP3_BLT_HDR_BASE_OFFSET_ENABLE | GP3_BLT_HDR_BLT_MODE_ENABLE; + + /* CALCULATIONS BASED ON ALPHA DEPTH */ + /* Although most antialiased text is 4BPP, the hardware supports */ + /* a full 8BPP. Either case is supported by this routine. */ + + if (fourbpp) { + depth_flag = GP3_CH3_SRC_4BPP_ALPHA; + indent = (srcx >> 1); + srcoffset = (indent & ~3L); + indent &= 3; + ch3_offset = indent | ((srcx & 1) << 25); + + temp = ((width + (srcx & 1) + 1) >> 1) + indent; + } else { + depth_flag = GP3_CH3_SRC_8BPP_ALPHA; + indent = srcx; + srcoffset = (indent & ~3L); + indent &= 3; + ch3_offset = indent; + + temp = width + indent; + } + + total_dwords = (temp + 3) >> 2; + size_dwords = (total_dwords << 2) + 8; + dword_count = (temp >> 2); + byte_count = (temp & 3); + + /* SET RASTER MODE REGISTER */ + /* Alpha blending will only apply to RGB when no alpha component is present. */ + /* As 8BPP is not supported for this routine, the only alpha-less mode is */ + /* 5:6:5. */ + + if (gp3_bpp == GP3_RM_BPPFMT_565) { + WRITE_COMMAND32(GP3_BLT_RASTER_MODE, + gp3_bpp | + GP3_RM_ALPHA_TO_RGB | + GP3_RM_ALPHA_A_PLUS_BETA_B | GP3_RM_SELECT_ALPHA_CHAN_3); + } else { + WRITE_COMMAND32(GP3_BLT_RASTER_MODE, + gp3_bpp | + GP3_RM_ALPHA_ALL | + GP3_RM_ALPHA_A_PLUS_BETA_B | GP3_RM_SELECT_ALPHA_CHAN_3); + } + + /* WRITE ALL REMAINING REGISTERS */ + + WRITE_COMMAND32(GP3_BLT_DST_OFFSET, (dstoffset & 0x3FFFFF)); + WRITE_COMMAND32(GP3_BLT_CH3_OFFSET, ch3_offset); + WRITE_COMMAND32(GP3_BLT_WID_HEIGHT, size); + WRITE_COMMAND32(GP3_BLT_CH3_WIDHI, size); + WRITE_COMMAND32(GP3_BLT_BASE_OFFSET, base); + WRITE_COMMAND32(GP3_BLT_CH3_MODE_STR, GP3_CH3_C3EN | + GP3_CH3_HST_SRC_ENABLE | + depth_flag | ((gp3_blt_flags & CIMGP_BLTFLAGS_PRES_LUT) << 20)); + WRITE_COMMAND32(GP3_BLT_MODE, gp3_blt_mode | GP3_BM_DST_REQ); + + /* START THE BLT */ + + WRITE_COMMAND32(GP3_BLT_CMD_HEADER, gp3_cmd_header); + WRITE_GP32(GP3_CMD_WRITE, gp3_cmd_next); + gp3_cmd_current = gp3_cmd_next; + + /* WRITE DATA LINE BY LINE + * Each line will be created as a separate command buffer entry to allow + * line-by-line wrapping and to allow simultaneous rendering by the HW. + */ + + if (((total_dwords << 2) * height) <= GP3_BLT_1PASS_SIZE && + (gp3_cmd_bottom - gp3_cmd_current) > (GP3_BLT_1PASS_SIZE + 72)) { + /* UPDATE THE COMMAND POINTER */ + + cim_cmd_ptr = cim_cmd_base_ptr + gp3_cmd_current; + + /* CHECK IF A WRAP WILL BE NEEDED */ + + gp3_cmd_next = gp3_cmd_current + ((total_dwords << 2) * height) + 8; + + if ((gp3_cmd_bottom - gp3_cmd_next) <= GP3_MAX_COMMAND_SIZE) { + gp3_cmd_next = gp3_cmd_top; + + GP3_WAIT_WRAP(temp); + WRITE_COMMAND32(0, + GP3_DATA_LOAD_HDR_TYPE | GP3_DATA_LOAD_HDR_WRAP | + GP3_DATA_LOAD_HDR_ENABLE); + } else { + GP3_WAIT_PRIMITIVE(temp); + WRITE_COMMAND32(0, + GP3_DATA_LOAD_HDR_TYPE | GP3_DATA_LOAD_HDR_ENABLE); + } + + /* WRITE DWORD COUNT */ + + WRITE_COMMAND32(4, + GP3_CH3_HOST_SOURCE_TYPE | (total_dwords * height)); + + while (height--) { + /* WRITE DATA */ + + WRITE_COMMAND_STRING32(8, data, srcoffset, dword_count); + WRITE_COMMAND_STRING8(8 + (dword_count << 2), data, + srcoffset + (dword_count << 2), byte_count); + + srcoffset += stride; + cim_cmd_ptr += total_dwords << 2; + } + + WRITE_GP32(GP3_CMD_WRITE, gp3_cmd_next); + gp3_cmd_current = gp3_cmd_next; + } else { + while (height--) { + /* UPDATE THE COMMAND POINTER + * The WRITE_COMMANDXX macros use a pointer to the current buffer + * space. This is created by adding gp3_cmd_current to the base + * pointer. + */ + + cim_cmd_ptr = cim_cmd_base_ptr + gp3_cmd_current; + + /* CHECK IF A WRAP WILL BE NEEDED */ + + gp3_cmd_next = gp3_cmd_current + size_dwords; + if ((gp3_cmd_bottom - gp3_cmd_next) <= GP3_MAX_COMMAND_SIZE) { + gp3_cmd_next = gp3_cmd_top; + + /* WAIT FOR HARDWARE */ + + GP3_WAIT_WRAP(temp); + WRITE_COMMAND32(0, + GP3_DATA_LOAD_HDR_TYPE | GP3_DATA_LOAD_HDR_WRAP | + GP3_DATA_LOAD_HDR_ENABLE); + } else { + /* WAIT FOR AVAILABLE SPACE */ + + GP3_WAIT_PRIMITIVE(temp); + WRITE_COMMAND32(0, + GP3_DATA_LOAD_HDR_TYPE | GP3_DATA_LOAD_HDR_ENABLE); + } + + /* WRITE DWORD COUNT */ + + WRITE_COMMAND32(4, GP3_CH3_HOST_SOURCE_TYPE | total_dwords); + + /* WRITE DATA */ + + WRITE_COMMAND_STRING32(8, data, srcoffset, dword_count); + WRITE_COMMAND_STRING8(8 + (dword_count << 2), data, + srcoffset + (dword_count << 2), byte_count); + + /* UPDATE POINTERS */ + + srcoffset += stride; + WRITE_GP32(GP3_CMD_WRITE, gp3_cmd_next); + gp3_cmd_current = gp3_cmd_next; + } + } +} + +/*--------------------------------------------------------------------------- + * gp_masked_blt + * + * This routine copies source data to the screen. A monochrome mask is used + * to specify source transparency. + *-------------------------------------------------------------------------*/ + +void +gp_masked_blt(unsigned long dstoffset, unsigned long width, + unsigned long height, unsigned long mono_srcx, + unsigned long color_srcx, unsigned char *mono_mask, + unsigned char *color_data, long mono_pitch, long color_pitch) +{ + unsigned long indent, temp; + unsigned long total_dwords, size_dwords; + unsigned long dword_count, byte_count; + unsigned long srcoffset, size; + unsigned long i, ch3_offset, base; + unsigned long flags = 0; + + if (gp3_blt_flags & CIMGP_BLTFLAGS_INVERTMONO) + flags = GP3_RM_SOURCE_INVERT; + + /* MONO CALCULATIONS */ + + indent = (mono_srcx >> 3); + srcoffset = (indent & ~3L); + indent &= 3; + + size = ((width + (mono_srcx & 7) + 7) >> 3) + indent; + total_dwords = (size + 3) >> 2; + size_dwords = (total_dwords << 2) + 8; + dword_count = (size >> 2); + byte_count = (size & 3); + + base = ((gp3_fb_base << 24) + (gp3_scratch_base & 0xFFC00000)) | + (gp3_base_register & ~GP3_BASE_OFFSET_DSTMASK); + + gp3_cmd_header |= GP3_BLT_HDR_RASTER_ENABLE | + GP3_BLT_HDR_STRIDE_ENABLE | GP3_BLT_HDR_DST_OFF_ENABLE | + GP3_BLT_HDR_WIDHI_ENABLE | GP3_BLT_HDR_CH3_STR_ENABLE | + GP3_BLT_HDR_CH3_OFF_ENABLE | GP3_BLT_HDR_CH3_WIDHI_ENABLE | + GP3_BLT_HDR_BASE_OFFSET_ENABLE | GP3_BLT_HDR_BLT_MODE_ENABLE; + + WRITE_COMMAND32(GP3_BLT_RASTER_MODE, GP3_RM_BPPFMT_8888 | 0xCC); + WRITE_COMMAND32(GP3_BLT_STRIDE, (total_dwords << 2)); + WRITE_COMMAND32(GP3_BLT_DST_OFFSET, gp3_scratch_base & 0x3FFFFF); + WRITE_COMMAND32(GP3_BLT_WID_HEIGHT, (total_dwords << 16) | height); + WRITE_COMMAND32(GP3_BLT_CH3_WIDHI, (total_dwords << 16) | height); + WRITE_COMMAND32(GP3_BLT_CH3_OFFSET, 0); + WRITE_COMMAND32(GP3_BLT_BASE_OFFSET, base); + WRITE_COMMAND32(GP3_BLT_CH3_MODE_STR, GP3_CH3_C3EN | + GP3_CH3_REPLACE_SOURCE | GP3_CH3_HST_SRC_ENABLE | + GP3_CH3_SRC_8_8_8_8 | + ((gp3_blt_flags & CIMGP_BLTFLAGS_PRES_LUT) << 20)); + WRITE_COMMAND32(GP3_BLT_MODE, 0); + WRITE_COMMAND32(GP3_BLT_CMD_HEADER, gp3_cmd_header); + + /* START THE BLT */ + + WRITE_GP32(GP3_CMD_WRITE, gp3_cmd_next); + gp3_cmd_current = gp3_cmd_next; + + for (i = 0; i < height; i++) { + /* UPDATE THE COMMAND POINTER + * The WRITE_COMMANDXX macros use a pointer to the current buffer + * space. This is created by adding gp3_cmd_current to the base + * pointer. + */ + + cim_cmd_ptr = cim_cmd_base_ptr + gp3_cmd_current; + + /* CHECK IF A WRAP WILL BE NEEDED */ + + gp3_cmd_next = gp3_cmd_current + size_dwords; + if ((gp3_cmd_bottom - gp3_cmd_next) <= GP3_MAX_COMMAND_SIZE) { + gp3_cmd_next = gp3_cmd_top; + + /* WAIT FOR HARDWARE */ + + GP3_WAIT_WRAP(temp); + WRITE_COMMAND32(0, + GP3_DATA_LOAD_HDR_TYPE | GP3_DATA_LOAD_HDR_WRAP | + GP3_DATA_LOAD_HDR_ENABLE); + } else { + /* WAIT FOR AVAILABLE SPACE */ + + GP3_WAIT_PRIMITIVE(temp); + WRITE_COMMAND32(0, GP3_DATA_LOAD_HDR_TYPE | + GP3_DATA_LOAD_HDR_ENABLE); + } + + /* WRITE DWORD COUNT */ + + WRITE_COMMAND32(4, GP3_CH3_HOST_SOURCE_TYPE | total_dwords); + + /* WRITE DATA */ + + WRITE_COMMAND_STRING32(8, mono_mask, srcoffset, dword_count); + WRITE_COMMAND_STRING8(8 + (dword_count << 2), mono_mask, + srcoffset + (dword_count << 2), byte_count); + + /* UPDATE POINTERS */ + + srcoffset += mono_pitch; + WRITE_GP32(GP3_CMD_WRITE, gp3_cmd_next); + gp3_cmd_current = gp3_cmd_next; + } + + /* SECOND BLT */ + + gp_declare_blt(gp3_blt_flags | CIMGP_BLTFLAGS_HAZARD); + + base = ((gp3_fb_base << 24) + (dstoffset & 0xFFC00000)) | + ((gp3_fb_base << 14) + (((gp3_scratch_base + + indent) & 0xFFC00000) >> 10)) | (gp3_base_register & + GP3_BASE_OFFSET_CH3MASK); + + gp3_cmd_header |= GP3_BLT_HDR_RASTER_ENABLE | + GP3_BLT_HDR_STRIDE_ENABLE | GP3_BLT_HDR_DST_OFF_ENABLE | + GP3_BLT_HDR_SRC_OFF_ENABLE | GP3_BLT_HDR_WIDHI_ENABLE | + GP3_BLT_HDR_CH3_STR_ENABLE | + GP3_BLT_HDR_CH3_WIDHI_ENABLE | + GP3_BLT_HDR_BASE_OFFSET_ENABLE | + GP3_BLT_HDR_CH3_OFF_ENABLE | GP3_BLT_HDR_BLT_MODE_ENABLE; + + /* ENABLE TRANSPARENCY AND PATTERN COPY ROP + * The monochrome data is used as a mask but is otherwise not involved in + * the BLT. The color data is routed through the pattern channel. + */ + + WRITE_COMMAND32(GP3_BLT_RASTER_MODE, + gp3_bpp | 0xF0 | GP3_RM_SRC_TRANS | flags); + WRITE_COMMAND32(GP3_BLT_STRIDE, (total_dwords << 18) | gp3_dst_stride); + WRITE_COMMAND32(GP3_BLT_DST_OFFSET, dstoffset & 0x3FFFFF); + WRITE_COMMAND32(GP3_BLT_SRC_OFFSET, + ((gp3_scratch_base + indent) & 0x3FFFFF) | ((mono_srcx & 7) << 26)); + WRITE_COMMAND32(GP3_BLT_WID_HEIGHT, (width << 16) | height); + WRITE_COMMAND32(GP3_BLT_CH3_WIDHI, (width << 16) | height); + WRITE_COMMAND32(GP3_BLT_BASE_OFFSET, base); + + /* PROGRAM PARAMETERS FOR COLOR SOURCE DATA */ + /* Data may be color converted along the way. */ + + if ((gp3_src_format & GP3_CH3_SRC_MASK) == GP3_CH3_SRC_24BPP_PACKED) { + srcoffset = color_srcx * 3; + ch3_offset = 0; + size = width * 3; + + WRITE_COMMAND32(GP3_BLT_CH3_WIDHI, + (((size + 3) >> 2) << 16) | height); + } else if (gp3_src_pix_shift == 3) { + /* CALCULATE INDENT AND SOURCE OFFSET */ + + indent = (color_srcx >> 1); + srcoffset = (indent & ~3L); + indent &= 3; + ch3_offset = indent | ((color_srcx & 1) << 25); + + size = ((width + (color_srcx & 1) + 1) >> 1) + indent; + } else { + indent = (color_srcx << gp3_src_pix_shift); + srcoffset = (indent & ~3L); + indent &= 3; + ch3_offset = indent; + + size = (width << gp3_src_pix_shift) + indent; + } + + total_dwords = (size + 3) >> 2; + size_dwords = (total_dwords << 2) + 8; + dword_count = (size >> 2); + byte_count = (size & 3); + + WRITE_COMMAND32(GP3_BLT_CH3_OFFSET, ch3_offset); + WRITE_COMMAND32(GP3_BLT_CH3_MODE_STR, GP3_CH3_C3EN | + GP3_CH3_HST_SRC_ENABLE | + gp3_src_format | ((gp3_blt_flags & CIMGP_BLTFLAGS_PRES_LUT) << 20)); + WRITE_COMMAND32(GP3_BLT_MODE, + gp3_blt_mode | GP3_BM_SRC_MONO | GP3_BM_SRC_FB); + + /* START THE BLT */ + + WRITE_COMMAND32(GP3_BLT_CMD_HEADER, gp3_cmd_header); + WRITE_GP32(GP3_CMD_WRITE, gp3_cmd_next); + gp3_cmd_current = gp3_cmd_next; + + /* WRITE DATA LINE BY LINE */ + + while (height--) { + /* UPDATE THE COMMAND POINTER */ + + cim_cmd_ptr = cim_cmd_base_ptr + gp3_cmd_current; + + /* CHECK IF A WRAP WILL BE NEEDED */ + + gp3_cmd_next = gp3_cmd_current + size_dwords; + if ((gp3_cmd_bottom - gp3_cmd_next) <= GP3_MAX_COMMAND_SIZE) { + gp3_cmd_next = gp3_cmd_top; + + GP3_WAIT_WRAP(temp); + WRITE_COMMAND32(0, + GP3_DATA_LOAD_HDR_TYPE | GP3_DATA_LOAD_HDR_WRAP | + GP3_DATA_LOAD_HDR_ENABLE); + } else { + GP3_WAIT_PRIMITIVE(temp); + WRITE_COMMAND32(0, + GP3_DATA_LOAD_HDR_TYPE | GP3_DATA_LOAD_HDR_ENABLE); + } + + /* WRITE DWORD COUNT */ + + WRITE_COMMAND32(4, GP3_CH3_HOST_SOURCE_TYPE | total_dwords); + + /* WRITE COLOR DATA TO THE COMMAND BUFFER */ + + WRITE_COMMAND_STRING32(8, color_data, srcoffset, dword_count); + WRITE_COMMAND_STRING8(8 + (dword_count << 2), color_data, + srcoffset + (dword_count << 2), byte_count); + + /* UPDATE COMMAND BUFFER POINTERS */ + /* We do this before writing the monochrome data because otherwise */ + /* the GP could throttle the writes to the host source register */ + /* waiting for color data. If the command buffer has not been */ + /* updated to load the color data... */ + + srcoffset += color_pitch; + WRITE_GP32(GP3_CMD_WRITE, gp3_cmd_next); + gp3_cmd_current = gp3_cmd_next; + } +} + +/*--------------------------------------------------------------------------- + * gp_screen_to_screen_masked + * + * This routine performs a screen to screen BLT, using a monochrome mask to + * specify source transparency. The source data is assumed to be in the + * current destination format and to not overlap the destination. + *-------------------------------------------------------------------------*/ + +void +gp_screen_to_screen_masked(unsigned long dstoffset, unsigned long srcoffset, + unsigned long width, unsigned long height, + unsigned long mono_srcx, unsigned char *mono_mask, long mono_pitch) +{ + unsigned long indent, temp; + unsigned long total_dwords, size_dwords; + unsigned long dword_count, byte_count; + unsigned long srcoff, size; + unsigned long i, base; + unsigned long flags = 0; + + if (gp3_blt_flags & CIMGP_BLTFLAGS_INVERTMONO) + flags = GP3_RM_SOURCE_INVERT; + + /* MONO CALCULATIONS */ + + indent = (mono_srcx >> 3); + srcoff = (indent & ~3L); + indent &= 3; + + size = ((width + (mono_srcx & 7) + 7) >> 3) + indent; + total_dwords = (size + 3) >> 2; + size_dwords = (total_dwords << 2) + 8; + dword_count = (size >> 2); + byte_count = (size & 3); + + base = ((gp3_fb_base << 24) + (gp3_scratch_base & 0xFFC00000)) | + (gp3_base_register & ~GP3_BASE_OFFSET_DSTMASK); + + gp3_cmd_header |= GP3_BLT_HDR_RASTER_ENABLE | GP3_BLT_HDR_STRIDE_ENABLE | + GP3_BLT_HDR_DST_OFF_ENABLE | GP3_BLT_HDR_WIDHI_ENABLE | + GP3_BLT_HDR_CH3_STR_ENABLE | GP3_BLT_HDR_CH3_OFF_ENABLE | + GP3_BLT_HDR_CH3_WIDHI_ENABLE | + GP3_BLT_HDR_BASE_OFFSET_ENABLE | GP3_BLT_HDR_BLT_MODE_ENABLE; + + WRITE_COMMAND32(GP3_BLT_RASTER_MODE, GP3_RM_BPPFMT_8888 | 0xCC); + WRITE_COMMAND32(GP3_BLT_STRIDE, (total_dwords << 2)); + WRITE_COMMAND32(GP3_BLT_DST_OFFSET, gp3_scratch_base & 0x3FFFFF); + WRITE_COMMAND32(GP3_BLT_WID_HEIGHT, (total_dwords << 16) | height); + WRITE_COMMAND32(GP3_BLT_CH3_WIDHI, (total_dwords << 16) | height); + WRITE_COMMAND32(GP3_BLT_CH3_OFFSET, 0); + WRITE_COMMAND32(GP3_BLT_BASE_OFFSET, base); + WRITE_COMMAND32(GP3_BLT_CH3_MODE_STR, GP3_CH3_C3EN | + GP3_CH3_REPLACE_SOURCE | GP3_CH3_HST_SRC_ENABLE | + GP3_CH3_SRC_8_8_8_8 | + ((gp3_blt_flags & CIMGP_BLTFLAGS_PRES_LUT) << 20)); + WRITE_COMMAND32(GP3_BLT_MODE, 0); + WRITE_COMMAND32(GP3_BLT_CMD_HEADER, gp3_cmd_header); + + /* START THE BLT */ + + WRITE_GP32(GP3_CMD_WRITE, gp3_cmd_next); + gp3_cmd_current = gp3_cmd_next; + + for (i = 0; i < height; i++) { + /* UPDATE THE COMMAND POINTER + * The WRITE_COMMANDXX macros use a pointer to the current buffer + * space. This is created by adding gp3_cmd_current to the base + * pointer. + */ + + cim_cmd_ptr = cim_cmd_base_ptr + gp3_cmd_current; + + /* CHECK IF A WRAP WILL BE NEEDED */ + + gp3_cmd_next = gp3_cmd_current + size_dwords; + if ((gp3_cmd_bottom - gp3_cmd_next) <= GP3_MAX_COMMAND_SIZE) { + gp3_cmd_next = gp3_cmd_top; + + /* WAIT FOR HARDWARE */ + + GP3_WAIT_WRAP(temp); + WRITE_COMMAND32(0, GP3_DATA_LOAD_HDR_TYPE | + GP3_DATA_LOAD_HDR_WRAP | GP3_DATA_LOAD_HDR_ENABLE); + } else { + /* WAIT FOR AVAILABLE SPACE */ + + GP3_WAIT_PRIMITIVE(temp); + WRITE_COMMAND32(0, GP3_DATA_LOAD_HDR_TYPE | + GP3_DATA_LOAD_HDR_ENABLE); + } + + /* WRITE DWORD COUNT */ + + WRITE_COMMAND32(4, GP3_CH3_HOST_SOURCE_TYPE | total_dwords); + + /* WRITE DATA */ + + WRITE_COMMAND_STRING32(8, mono_mask, srcoff, dword_count); + WRITE_COMMAND_STRING8(8 + (dword_count << 2), mono_mask, + srcoff + (dword_count << 2), byte_count); + + /* UPDATE POINTERS */ + + srcoff += mono_pitch; + WRITE_GP32(GP3_CMD_WRITE, gp3_cmd_next); + gp3_cmd_current = gp3_cmd_next; + } + + /* SECOND BLT */ + + gp_declare_blt(gp3_blt_flags | CIMGP_BLTFLAGS_HAZARD); + + base = ((gp3_fb_base << 24) + (dstoffset & 0xFFC00000)) | + ((gp3_fb_base << 14) + (((gp3_scratch_base + + indent) & 0xFFC00000) >> 10)) | ((gp3_fb_base << 4) + + ((srcoffset & 0xFFC00000) >> 20)); + + gp3_cmd_header |= GP3_BLT_HDR_RASTER_ENABLE | + GP3_BLT_HDR_STRIDE_ENABLE | GP3_BLT_HDR_DST_OFF_ENABLE | + GP3_BLT_HDR_SRC_OFF_ENABLE | GP3_BLT_HDR_WIDHI_ENABLE | + GP3_BLT_HDR_CH3_STR_ENABLE | + GP3_BLT_HDR_CH3_WIDHI_ENABLE | + GP3_BLT_HDR_BASE_OFFSET_ENABLE | + GP3_BLT_HDR_CH3_OFF_ENABLE | GP3_BLT_HDR_BLT_MODE_ENABLE; + + /* ENABLE TRANSPARENCY AND PATTERN COPY ROP + * The monochrome data is used as a mask but is otherwise not involved + * in the BLT. The color data is routed through the pattern channel. + */ + + WRITE_COMMAND32(GP3_BLT_RASTER_MODE, + gp3_bpp | 0xF0 | GP3_RM_SRC_TRANS | flags); + WRITE_COMMAND32(GP3_BLT_STRIDE, (total_dwords << 18) | gp3_dst_stride); + WRITE_COMMAND32(GP3_BLT_DST_OFFSET, dstoffset & 0x3FFFFF); + WRITE_COMMAND32(GP3_BLT_SRC_OFFSET, + ((gp3_scratch_base + indent) & 0x3FFFFF) | ((mono_srcx & 7) << 26)); + WRITE_COMMAND32(GP3_BLT_WID_HEIGHT, (width << 16) | height); + WRITE_COMMAND32(GP3_BLT_CH3_WIDHI, (width << 16) | height); + WRITE_COMMAND32(GP3_BLT_BASE_OFFSET, base); + + /* PROGRAM PARAMETERS FOR COLOR SOURCE DATA */ + + WRITE_COMMAND32(GP3_BLT_CH3_OFFSET, srcoffset & 0x3FFFFF); + WRITE_COMMAND32(GP3_BLT_CH3_MODE_STR, GP3_CH3_C3EN | gp3_ch3_bpp | + gp3_src_stride | ((gp3_blt_flags & CIMGP_BLTFLAGS_PRES_LUT) << 20)); + WRITE_COMMAND32(GP3_BLT_MODE, + gp3_blt_mode | GP3_BM_SRC_MONO | GP3_BM_SRC_FB); + + /* START THE BLT */ + + WRITE_COMMAND32(GP3_BLT_CMD_HEADER, gp3_cmd_header); + WRITE_GP32(GP3_CMD_WRITE, gp3_cmd_next); + gp3_cmd_current = gp3_cmd_next; +} + +/*--------------------------------------------------------------------------- + * gp_bresenham_line + * + * This routine draws a vector using the specified Bresenham parameters. + * Currently this file does not support a routine that accepts the two + * endpoints of a vector and calculates the Bresenham parameters. If it + * ever does, this routine is still required for vectors that have been + * clipped. + *-------------------------------------------------------------------------*/ + +void +gp_bresenham_line(unsigned long dstoffset, unsigned short length, + unsigned short initerr, unsigned short axialerr, + unsigned short diagerr, unsigned long flags) +{ + unsigned long base; + long offset; + + /* HANDLE NEGATIVE VECTORS */ + /* We have to be very careful with vectors that increment negatively */ + /* Our framebuffer scheme tries to align the destination of every */ + /* BLT or vector to the nearest 4MB-aligned boundary. This is */ + /* necessary because the GP only supports offsets up to 16MB, but the */ + /* framebuffer can be over 128MB. To solve this problem, the GP */ + /* base address registers are alignable to 4MB regions. However, we */ + /* cannot simply align the dest offset when the vector goes negative. */ + /* The vector offset could underflow, causing the offset to jump from */ + /* near 0 to 16MB. As we cannot accurately determine the last address */ + /* that will be written in a vector short of walking the algorithm in */ + /* software, we do a worst case approximation. */ + + offset = dstoffset; + if (!(flags & CIMGP_POSMAJOR)) { + if (flags & CIMGP_YMAJOR) + offset -= length * gp3_dst_stride; + else + offset -= (length << gp3_pix_shift); + + if (offset < 0) + offset = 0; + } + if (!(flags & CIMGP_POSMINOR)) { + if (flags & CIMGP_YMAJOR) + offset -= (length << gp3_pix_shift); + else + offset -= length * gp3_dst_stride; + + if (offset < 0) + offset = 0; + } + + offset &= 0xFFC00000; + dstoffset -= offset; + + base = ((gp3_fb_base << 24) + offset) | + (gp3_base_register & ~GP3_BASE_OFFSET_DSTMASK); + + /* ENABLE RELEVANT REGISTERS */ + /* Note that we always enable and write the channel 3 mode, if only */ + /* to turn it off. Cimarron also always writes the base offset */ + /* register to allow operation with frame buffers larger than 16MB. */ + + gp3_cmd_header |= GP3_VEC_HDR_DST_OFF_ENABLE | + GP3_VEC_HDR_VEC_ERR_ENABLE | + GP3_VEC_HDR_VEC_LEN_ENABLE | + GP3_VEC_HDR_BASE_OFFSET_ENABLE | + GP3_VEC_HDR_CH3_STR_ENABLE | GP3_VEC_HDR_VEC_MODE_ENABLE; + + /* WRITE THE REGISTERS COMMON TO ALL PATTERN TYPES */ + /* The destination base is the frame buffer base plus whatever */ + /* 4MB segment we happen to be drawing to. */ + + WRITE_COMMAND32(GP3_VECTOR_VEC_ERR, + (((unsigned long)axialerr << 16) | (unsigned long)diagerr)); + WRITE_COMMAND32(GP3_VECTOR_VEC_LEN, + (((unsigned long)length << 16) | (unsigned long)initerr)); + WRITE_COMMAND32(GP3_VECTOR_BASE_OFFSET, base); + + /* CHECK VECTOR PATTERN CASE */ + + if (gp3_ch3_pat) { + /* SET THE SOLID COLOR */ + /* The color for vector patterns from channel 3 comes from */ + /* the regular pattern registers. */ + + gp3_cmd_header |= GP3_VEC_HDR_PAT_CLR0_ENABLE; + + WRITE_COMMAND32(GP3_VECTOR_PAT_COLOR_0, gp3_vector_pattern_color); + + /* INITIALIZE CHANNEL 3 PARAMETERS + * We route the channel 3 output to the old source channel. If the + * user sets a ROP that involves source, they will get unexpected + * results. + */ + + WRITE_COMMAND32(GP3_VECTOR_DST_OFFSET, dstoffset); + WRITE_COMMAND32(GP3_VECTOR_CH3_MODE_STR, + GP3_CH3_C3EN | GP3_CH3_REPLACE_SOURCE | + GP3_CH3_COLOR_PAT_ENABLE | GP3_CH3_SRC_8_8_8_8); + } else { + /* DISABLE CHANNEL 3 AND USE NORMAL PATTERN ORIGINS */ + + WRITE_COMMAND32(GP3_VECTOR_CH3_MODE_STR, 0); + WRITE_COMMAND32(GP3_VECTOR_DST_OFFSET, (dstoffset | gp3_pat_origin)); + } + + /* START THE VECTOR */ + + WRITE_COMMAND32(GP3_VEC_CMD_HEADER, gp3_cmd_header); + WRITE_COMMAND32(GP3_VECTOR_MODE, (gp3_vec_mode | flags)); + WRITE_GP32(GP3_CMD_WRITE, gp3_cmd_next); + + gp3_cmd_current = gp3_cmd_next; + + /* ADD A SECOND VECTOR TO CLEAR THE BYTE ENABLES */ + /* We set a transparent pattern to clear the byte enables. */ + /* We then restore the previous pattern. (SiBZ #4001) */ + + if (gp3_ch3_pat) { + cim_cmd_ptr = cim_cmd_base_ptr + gp3_cmd_current; + + WRITE_COMMAND32(0, GP3_LUT_HDR_TYPE | GP3_LUT_HDR_DATA_ENABLE); + WRITE_COMMAND32(4, 0x100); + WRITE_COMMAND32(8, (1 | GP3_LUT_DATA_TYPE)); + WRITE_COMMAND32(12, 0); + + /* DUMMY VECTOR */ + /* We shouldn't need to write anything but vector mode and the length + */ + + WRITE_COMMAND32(16, GP3_VEC_HDR_TYPE | GP3_VEC_HDR_VEC_MODE_ENABLE | + GP3_VEC_HDR_VEC_LEN_ENABLE); + WRITE_COMMAND32(16 + GP3_VECTOR_MODE, (gp3_vec_mode | flags)); + WRITE_COMMAND32(16 + GP3_VECTOR_VEC_LEN, + (1 << 16) | (unsigned long)initerr); + + WRITE_COMMAND32(16 + GP3_VECTOR_COMMAND_SIZE, + GP3_LUT_HDR_TYPE | GP3_LUT_HDR_DATA_ENABLE); + WRITE_COMMAND32(20 + GP3_VECTOR_COMMAND_SIZE, 0x100); + WRITE_COMMAND32(24 + GP3_VECTOR_COMMAND_SIZE, + (1 | GP3_LUT_DATA_TYPE)); + WRITE_COMMAND32(28 + GP3_VECTOR_COMMAND_SIZE, gp3_vec_pat); + + gp3_cmd_current += 32 + GP3_VECTOR_COMMAND_SIZE; + } +} + +/*--------------------------------------------------------------------------- + * gp_line_from_endpoints + * + * This routine draws a vector from a set of rectangular coordinates. The + * rectangle is assumed to use the currently specified destination stride. + *-------------------------------------------------------------------------*/ + +void +gp_line_from_endpoints(unsigned long dstoffset, unsigned long x0, + unsigned long y0, unsigned long x1, unsigned long y1, int inclusive) +{ + unsigned long base; + unsigned long length; + unsigned long flags; + unsigned short initerr, axialerr, diagerr; + long dx, dy, dmaj, dmin; + long offset; + + /* ADJUST DESTINATION OFFSET BASED ON STARTING COORDINATE */ + + dstoffset += (x0 << gp3_pix_shift) + (y0 * gp3_dst_stride); + + /* CALCULATE BRESENHAM TERMS */ + + dx = (long)x1 - (long)x0; + dy = (long)y1 - (long)y0; + if (dx < 0) + dx = -dx; + if (dy < 0) + dy = -dy; + + if (dx >= dy) { + dmaj = dx; + dmin = dy; + flags = 0; + if (x1 > x0) + flags |= CIMGP_POSMAJOR; + if (y1 > y0) + flags |= CIMGP_POSMINOR; + } else { + dmaj = dy; + dmin = dx; + flags = CIMGP_YMAJOR; + if (x1 > x0) + flags |= CIMGP_POSMINOR; + if (y1 > y0) + flags |= CIMGP_POSMAJOR; + } + + axialerr = (unsigned short)(dmin << 1); + diagerr = (unsigned short)((dmin - dmaj) << 1); + initerr = (unsigned short)((dmin << 1) - dmaj); + if (!(flags & CIMGP_POSMINOR)) + initerr--; + + /* CHECK FOR NO WORK */ + + if (!dmaj) + return; + + /* CHECK INCLUSIVE OR EXCLUSIVE */ + /* An inclusive line can be accomplished by simply adding 1 to the */ + /* line length. */ + + length = dmaj; + if (inclusive) + length++; + + /* HANDLE NEGATIVE VECTORS */ + + offset = dstoffset; + if (!(flags & CIMGP_POSMAJOR)) { + if (flags & CIMGP_YMAJOR) + offset -= length * gp3_dst_stride; + else + offset -= (length << gp3_pix_shift); + + if (offset < 0) + offset = 0; + } + if (!(flags & CIMGP_POSMINOR)) { + if (flags & CIMGP_YMAJOR) + offset -= (length << gp3_pix_shift); + else + offset -= length * gp3_dst_stride; + + if (offset < 0) + offset = 0; + } + + offset &= 0xFFC00000; + dstoffset -= offset; + + base = ((gp3_fb_base << 24) + offset) | + (gp3_base_register & ~GP3_BASE_OFFSET_DSTMASK); + + /* ENABLE RELEVANT REGISTERS */ + /* Note that we always enable and write the channel 3 mode, if only */ + /* to turn it off. Cimarron also always writes the base offset */ + /* register to allow operation with frame buffers larger than 16MB. */ + + gp3_cmd_header |= GP3_VEC_HDR_DST_OFF_ENABLE | + GP3_VEC_HDR_VEC_ERR_ENABLE | + GP3_VEC_HDR_VEC_LEN_ENABLE | + GP3_VEC_HDR_BASE_OFFSET_ENABLE | + GP3_VEC_HDR_CH3_STR_ENABLE | GP3_VEC_HDR_VEC_MODE_ENABLE; + + /* WRITE THE REGISTERS COMMON TO ALL PATTERN TYPES */ + /* The destination base is the frame buffer base plus whatever */ + /* 4MB segment we happen to be drawing to. */ + + WRITE_COMMAND32(GP3_VECTOR_VEC_ERR, + (((unsigned long)axialerr << 16) | (unsigned long)diagerr)); + WRITE_COMMAND32(GP3_VECTOR_VEC_LEN, + (((unsigned long)length << 16) | (unsigned long)initerr)); + WRITE_COMMAND32(GP3_VECTOR_BASE_OFFSET, base); + + /* CHECK VECTOR PATTERN CASE */ + + if (gp3_ch3_pat) { + /* SET THE SOLID COLOR */ + /* The color for vector patterns from channel 3 comes from */ + /* the regular pattern registers. */ + + gp3_cmd_header |= GP3_VEC_HDR_PAT_CLR0_ENABLE; + + WRITE_COMMAND32(GP3_VECTOR_PAT_COLOR_0, gp3_vector_pattern_color); + + /* INITIALIZE CHANNEL 3 PARAMETERS */ + /* We route the channel 3 output to the old source channel. If the + * user sets a ROP that involves source, they will get unexpected + * results. + */ + + WRITE_COMMAND32(GP3_VECTOR_DST_OFFSET, dstoffset); + WRITE_COMMAND32(GP3_VECTOR_CH3_MODE_STR, + GP3_CH3_C3EN | GP3_CH3_REPLACE_SOURCE | + GP3_CH3_COLOR_PAT_ENABLE | GP3_CH3_SRC_8_8_8_8); + } else { + /* DISABLE CHANNEL 3 AND USE NORMAL PATTERN ORIGINS */ + + WRITE_COMMAND32(GP3_VECTOR_CH3_MODE_STR, 0); + WRITE_COMMAND32(GP3_VECTOR_DST_OFFSET, (dstoffset | gp3_pat_origin)); + } + + /* START THE VECTOR */ + + WRITE_COMMAND32(GP3_VEC_CMD_HEADER, gp3_cmd_header); + WRITE_COMMAND32(GP3_VECTOR_MODE, (gp3_vec_mode | flags)); + WRITE_GP32(GP3_CMD_WRITE, gp3_cmd_next); + gp3_cmd_current = gp3_cmd_next; + + /* ADD A SECOND VECTOR TO CLEAR THE BYTE ENABLES */ + /* We set a transparent pattern to clear the byte enables. */ + /* We then restore the previous pattern. (SiBZ #4001) */ + + if (gp3_ch3_pat) { + cim_cmd_ptr = cim_cmd_base_ptr + gp3_cmd_current; + + WRITE_COMMAND32(0, GP3_LUT_HDR_TYPE | GP3_LUT_HDR_DATA_ENABLE); + WRITE_COMMAND32(4, 0x100); + WRITE_COMMAND32(8, (1 | GP3_LUT_DATA_TYPE)); + WRITE_COMMAND32(12, 0); + + /* DUMMY VECTOR */ + /* We shouldn't need to write anything but vector mode and the length + */ + + WRITE_COMMAND32(16, GP3_VEC_HDR_TYPE | GP3_VEC_HDR_VEC_MODE_ENABLE | + GP3_VEC_HDR_VEC_LEN_ENABLE); + WRITE_COMMAND32(16 + GP3_VECTOR_MODE, (gp3_vec_mode | flags)); + WRITE_COMMAND32(16 + GP3_VECTOR_VEC_LEN, + (1 << 16) | (unsigned long)initerr); + + WRITE_COMMAND32(16 + GP3_VECTOR_COMMAND_SIZE, + GP3_LUT_HDR_TYPE | GP3_LUT_HDR_DATA_ENABLE); + WRITE_COMMAND32(20 + GP3_VECTOR_COMMAND_SIZE, 0x100); + WRITE_COMMAND32(24 + GP3_VECTOR_COMMAND_SIZE, + (1 | GP3_LUT_DATA_TYPE)); + WRITE_COMMAND32(28 + GP3_VECTOR_COMMAND_SIZE, gp3_vec_pat); + + gp3_cmd_current += 32 + GP3_VECTOR_COMMAND_SIZE; + } +} + +/*--------------------------------------------------------------------------- + * gp_wait_until_idle + * + * This routine stalls execution until the GP is no longer actively rendering. + *-------------------------------------------------------------------------*/ + +void +gp_wait_until_idle(void) +{ + unsigned long temp; + + while (((temp = READ_GP32(GP3_BLT_STATUS)) & GP3_BS_BLT_BUSY) || + !(temp & GP3_BS_CB_EMPTY)) { + ; + } +} + +/*--------------------------------------------------------------------------- + * gp_test_blt_busy + *-------------------------------------------------------------------------*/ + +int +gp_test_blt_busy(void) +{ + unsigned long temp; + + if (((temp = READ_GP32(GP3_BLT_STATUS)) & GP3_BS_BLT_BUSY) || + !(temp & GP3_BS_CB_EMPTY)) + return 1; + + return 0; +} + +/*--------------------------------------------------------------------------- + * gp_test_blt_pending + *-------------------------------------------------------------------------*/ + +int +gp_test_blt_pending(void) +{ + if ((READ_GP32(GP3_BLT_STATUS)) & GP3_BS_BLT_PENDING) + return 1; + + return 0; +} + +/*--------------------------------------------------------------------------- + * gp_wait_blt_pending + *-------------------------------------------------------------------------*/ + +void +gp_wait_blt_pending(void) +{ + while ((READ_GP32(GP3_BLT_STATUS)) & GP3_BS_BLT_PENDING) ; +} + +/*--------------------------------------------------------------------------- + * gp_save_state + * + * This routine saves all persistent GP information. + *-------------------------------------------------------------------------*/ + +void +gp_save_state(GP_SAVE_RESTORE * gp_state) +{ + Q_WORD msr_value; + + gp_wait_until_idle(); + + msr_read64(MSR_DEVICE_GEODELX_GP, MSR_GEODELINK_CONFIG, &msr_value); + gp_state->cmd_bottom = READ_GP32(GP3_CMD_BOT) & 0xFFFFFF; + gp_state->cmd_top = READ_GP32(GP3_CMD_TOP) & 0xFFFFFF; + gp_state->cmd_base = (msr_value.low << 4) & 0xFFF00000; + gp_state->base_offset = READ_GP32(GP3_BASE_OFFSET); + + /* RESET THE READ POINTER */ + + gp_set_command_buffer_base(gp_state->cmd_base, gp_state->cmd_top, + gp_state->cmd_bottom); +} + +/*--------------------------------------------------------------------------- + * gp_restore_state + * + * This routine restores all persistent GP information. + *-------------------------------------------------------------------------*/ + +void +gp_restore_state(GP_SAVE_RESTORE * gp_state) +{ + gp_wait_until_idle(); + + WRITE_GP32(GP3_BASE_OFFSET, gp_state->base_offset); + + gp_set_command_buffer_base(gp_state->cmd_base, gp_state->cmd_top, + gp_state->cmd_bottom); +} + +/* This is identical to gp_antialiased_text, except we support all one + pass alpha operations similar to gp_set_alpha_operation */ + + +void +gp_blend_mask_blt(unsigned long dstoffset, unsigned long srcx, + unsigned long width, unsigned long height, + unsigned long dataoffset, long stride, int operation, + int fourbpp) +{ + unsigned long indent; + unsigned long size = ((width << 16) | height); + unsigned long base, depth_flag; + + base = ((gp3_fb_base << 24) + (dstoffset & 0xFFC00000)) | + ((gp3_fb_base << 4) + (dataoffset >> 20)) | + (gp3_base_register & GP3_BASE_OFFSET_SRCMASK); + + /* ENABLE ALL RELEVANT REGISTERS */ + /* We override the raster mode register to force the */ + /* correct alpha blend */ + + gp3_cmd_header |= GP3_BLT_HDR_RASTER_ENABLE | + GP3_BLT_HDR_DST_OFF_ENABLE | + GP3_BLT_HDR_WIDHI_ENABLE | + GP3_BLT_HDR_CH3_OFF_ENABLE | + GP3_BLT_HDR_CH3_STR_ENABLE | + GP3_BLT_HDR_CH3_WIDHI_ENABLE | + GP3_BLT_HDR_BASE_OFFSET_ENABLE | GP3_BLT_HDR_BLT_MODE_ENABLE; + + /* CALCULATIONS BASED ON ALPHA DEPTH */ + /* Although most antialiased text is 4BPP, the hardware supports */ + /* a full 8BPP. Either case is supported by this routine. */ + + if (fourbpp) { + depth_flag = GP3_CH3_SRC_4BPP_ALPHA; + indent = (srcx >> 1) & 3; + dataoffset += indent | ((srcx & 1) << 25); + } else { + depth_flag = GP3_CH3_SRC_8BPP_ALPHA; + indent = srcx & 3; + dataoffset += indent; + } + + /* SET RASTER MODE REGISTER */ + /* Alpha blending will only apply to RGB when no alpha component is present. */ + /* As 8BPP is not supported for this routine, the only alpha-less mode is */ + /* 5:6:5. */ + + if (gp3_bpp == GP3_RM_BPPFMT_565) { + WRITE_COMMAND32(GP3_BLT_RASTER_MODE, + gp3_bpp | + GP3_RM_ALPHA_TO_RGB | + ((unsigned long) (operation << 20)) | GP3_RM_SELECT_ALPHA_CHAN_3); + } else { + WRITE_COMMAND32(GP3_BLT_RASTER_MODE, + gp3_bpp | + GP3_RM_ALPHA_ALL | ((unsigned long) (operation << 20)) | + GP3_RM_SELECT_ALPHA_CHAN_3); + } + + /* WRITE ALL REMAINING REGISTERS */ + + WRITE_COMMAND32(GP3_BLT_DST_OFFSET, (dstoffset & 0x3FFFFF)); + + /* Set the offset of the CH3 data in memory */ + WRITE_COMMAND32(GP3_BLT_CH3_OFFSET, dataoffset & 0x3FFFFF); + + WRITE_COMMAND32(GP3_BLT_WID_HEIGHT, size); + WRITE_COMMAND32(GP3_BLT_CH3_WIDHI, size); + WRITE_COMMAND32(GP3_BLT_BASE_OFFSET, base); + + WRITE_COMMAND32(GP3_BLT_CH3_MODE_STR, GP3_CH3_C3EN | (stride & 0xFFFF) | + depth_flag | ((gp3_blt_flags & CIMGP_BLTFLAGS_PRES_LUT) << 20)); + + WRITE_COMMAND32(GP3_BLT_MODE, GP3_BM_DST_REQ); + + /* START THE BLT */ + + WRITE_COMMAND32(GP3_BLT_CMD_HEADER, gp3_cmd_header); + WRITE_GP32(GP3_CMD_WRITE, gp3_cmd_next); + gp3_cmd_current = gp3_cmd_next; +} diff --git a/driver/xf86-video-geode/src/cim/cim_init.c b/driver/xf86-video-geode/src/cim/cim_init.c new file mode 100644 index 000000000..71f20b6ec --- /dev/null +++ b/driver/xf86-video-geode/src/cim/cim_init.c @@ -0,0 +1,223 @@ +/* + * Copyright (c) 2006 Advanced Micro Devices, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + * Neither the name of the Advanced Micro Devices, Inc. nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + */ + + /* + * Cimarron initialization routines. These routines detect a Geode LX and + * read all hardware base addresses. + */ + +CIMARRON_STATIC unsigned long init_video_base = 0x80000900; + +/*--------------------------------------------------------------------------- + * init_detect_cpu + * + * This routine verifies that a Geode LX is present and returns the processor + * revision ID. For compatibility, this routine can also detect a Redcloud + * processor. + * bits[24:16] = minor version + * bits[15:8] = major version + * bits[7:0] = type (1 = Geode GX, 2 = Geode LX) + *---------------------------------------------------------------------------*/ + +int +init_detect_cpu(unsigned long *cpu_revision, + unsigned long *companion_revision) +{ + unsigned long bus, device, i; + unsigned long cpu_bus = 0, cpu_device = 0; + unsigned long address, data; + unsigned long num_bars, function; + int cpu_found, sb_found; + Q_WORD msr_value; + + /* SEARCH THROUGH PCI BUS */ + /* We search the PCI bus for the Geode LX or Geode GX northbridge. */ + /* We then verify that one of its functions is the graphics */ + /* controller and that all bars are filled in. */ + + cpu_found = sb_found = 0; + for (bus = 0; bus < 256; bus++) { + for (device = 0; device < 21; device++) { + address = 0x80000000 | (bus << 16) | (device << 11); + + data = init_read_pci(address); + + if (data == PCI_VENDOR_DEVICE_GEODEGX + || data == PCI_VENDOR_DEVICE_GEODELX) { + cpu_found = 1; + cpu_device = device; + cpu_bus = bus; + if (data == PCI_VENDOR_DEVICE_GEODEGX) + *cpu_revision = CIM_CPU_GEODEGX; + else + *cpu_revision = CIM_CPU_GEODELX; + } else if (data == PCI_VENDOR_5535 || data == PCI_VENDOR_5536) { + sb_found = 1; + if (data == PCI_VENDOR_5535) + *companion_revision = CIM_SB_5535; + else + *companion_revision = CIM_SB_5536; + } + + if (cpu_found && sb_found) + break; + } + if (device != 21) + break; + } + + if (bus == 256) { + *cpu_revision = 0; + return CIM_STATUS_CPUNOTFOUND; + } + + msr_init_table(); + + if (msr_read64(MSR_DEVICE_GEODELX_GLCP, GLCP_REVID, + &msr_value) != CIM_STATUS_OK) { + *cpu_revision = 0; + return CIM_STATUS_CPUNOTFOUND; + } + + *cpu_revision |= ((msr_value.low & 0xF0) << 4) | + ((msr_value.low & 0x0F) << 16); + + if (msr_read64(MSR_DEVICE_5535_GLCP, GLCP_REVID, + &msr_value) != CIM_STATUS_OK) { + *cpu_revision = 0; + return CIM_STATUS_CPUNOTFOUND; + } + + *companion_revision |= ((msr_value.low & 0xF0) << 4) | + ((msr_value.low & 0x0F) << 16); + + /* SEARCH ALL FUNCTIONS FOR INTEGRATED GRAPHICS */ + + num_bars = 0; + for (function = 0; function < 7; function++) { + address = 0x80000000 | (cpu_bus << 16) | (cpu_device << 11) | + (function << 8); + data = init_read_pci(address); + + if (data == PCI_VENDOR_DEVICE_GEODEGX_VIDEO) { + num_bars = 4; + break; + } else if (data == PCI_VENDOR_DEVICE_GEODELX_VIDEO) { + num_bars = 5; + break; + } + } + + /* VERIFY THAT ALL BARS ARE PRESENT */ + + if (function == 7) + return CIM_STATUS_DISPLAYUNAVAILABLE; + + for (i = 0; i < num_bars; i++) { + data = init_read_pci(address + 0x10 + (i << 2)); + + if (data == 0 || data == 0xFFFFFFFF) + break; + } + + if (i != num_bars) + return CIM_STATUS_DISPLAYUNAVAILABLE; + + /* SAVE VIDEO BASE ADDRESS FOR FUTURE CALLS */ + + init_video_base = address; + + return CIM_STATUS_OK; +} + +/*--------------------------------------------------------------------------- + * init_read_pci + * + * This routine reads an unsigned long value from a PCI address. + *---------------------------------------------------------------------------*/ + +unsigned long +init_read_pci(unsigned long address) +{ + OUTD(0xCF8, address); + return IND(0xCFC); +} + +/*--------------------------------------------------------------------------- + * init_read_base_addresses + * + * This routine reads all base addresses for the peripherals from the PCI + * BARs. + *---------------------------------------------------------------------------*/ + +int +init_read_base_addresses(INIT_BASE_ADDRESSES * base_addresses) +{ + unsigned long value; + + /* READ ALL BASE ADDRESSES */ + + base_addresses->framebuffer_base = init_read_pci(init_video_base + 0x10); + base_addresses->gp_register_base = init_read_pci(init_video_base + 0x14); + base_addresses->vg_register_base = init_read_pci(init_video_base + 0x18); + base_addresses->df_register_base = init_read_pci(init_video_base + 0x1C); + base_addresses->vip_register_base = init_read_pci(init_video_base + 0x20); + + /* READ FRAME BUFFER SIZE */ + /* The frame buffer size is reported by a VSM in VSA II */ + /* Virtual Register Class = 0x02 */ + /* VG_MEM_SIZE (1MB units) = 0x00 */ + + OUTW(0xAC1C, 0xFC53); + OUTW(0xAC1C, 0x0200); + + value = (unsigned long)(INW(0xAC1E)) & 0xFE; + + base_addresses->framebuffer_size = value << 20; + + return CIM_STATUS_OK; +} + +/*--------------------------------------------------------------------------- + * init_read_cpu_frequency + * + * This routine returns the current CPU core frequency, in MHz. + *---------------------------------------------------------------------------*/ + +int +init_read_cpu_frequency(unsigned long *cpu_frequency) +{ + /* CPU SPEED IS REPORTED BY A VSM IN VSA II */ + /* Virtual Register Class = 0x12 (Sysinfo) */ + /* CPU Speed Register = 0x01 */ + + OUTW(0xAC1C, 0xFC53); + OUTW(0xAC1C, 0x1201); + + *cpu_frequency = (unsigned long)(INW(0xAC1E)); + + return CIM_STATUS_OK; +} diff --git a/driver/xf86-video-geode/src/cim/cim_modes.c b/driver/xf86-video-geode/src/cim/cim_modes.c new file mode 100644 index 000000000..0e51caa68 --- /dev/null +++ b/driver/xf86-video-geode/src/cim/cim_modes.c @@ -0,0 +1,1905 @@ +/* + * Copyright (c) 2006 Advanced Micro Devices, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + * Neither the name of the Advanced Micro Devices, Inc. nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + */ + + /* + * Cimarron mode tables. + */ + +/*-------------------------------*/ +/* PREDEFINED DISPLAY TIMINGS */ +/*-------------------------------*/ + +static const VG_DISPLAY_MODE CimarronDisplayModes[] = { + /* 320 x 240 PANEL */ + + {VG_SUPPORTFLAG_75HZ | /* refresh rate = 75 */ + VG_SUPPORTFLAG_8BPP | VG_SUPPORTFLAG_12BPP | VG_SUPPORTFLAG_15BPP | VG_SUPPORTFLAG_16BPP | VG_SUPPORTFLAG_24BPP | VG_SUPPORTFLAG_32BPP | VG_SUPPORTFLAG_PANEL, /* Panel Mode. */ + VG_MODEFLAG_LOW_BAND | /* Low bandwidth mode. */ + VG_MODEFLAG_PANELOUT | /* Panel output. */ + VG_MODEFLAG_NEG_HSYNC | VG_MODEFLAG_NEG_VSYNC | /* negative syncs */ + VG_MODEFLAG_QVGA, /* QVGA Panel size. */ + 320, 240, /* No scaling. */ + 320, 240, /* 320x240 active */ + 320, 240, /* 320x240 panel */ + 0, 0, 0, 0, 0, /* No panel registers */ + 0x0140, 0x0148, 0x0162, 0x0180, 0x0188, 0x0190, /* horiz timings */ + 0x00F0, 0x00F4, 0x00F9, 0x00FD, 0x00FF, 0x0104, /* vertical timings */ + (31L << 16) | ((2000L * 65536L) / 10000L), /* freq = 31.2000 MHz */ + } + , + + /* 640 x 400 */ + + {VG_SUPPORTFLAG_70HZ | /* refresh rate = 60 */ + VG_SUPPORTFLAG_8BPP | VG_SUPPORTFLAG_12BPP | VG_SUPPORTFLAG_15BPP + | VG_SUPPORTFLAG_16BPP | VG_SUPPORTFLAG_24BPP | + VG_SUPPORTFLAG_32BPP, + VG_MODEFLAG_LOW_BAND | /* Low bandwidth mode. */ + VG_MODEFLAG_NEG_HSYNC, /* negative HSYNC */ + 640, 400, /* No scaling. */ + 0, 0, /* No mode dimensions. */ + 0, 0, /* No panel dimensions. */ + 0, 0, 0, 0, 0, /* No panel registers */ + 0x280, 0x288, 0x290, 0x2F0, 0x318, 0x320, /* horiz timings */ + 0x190, 0x197, 0x19C, 0x19E, 0x1BA, 0x1C1, /* vertical timings */ + 0, 0, 0, 0, 0, 0, /* No even timings */ + (25L << 16) | ((1750L * 65536L) / 10000L), /* freq = 25.175 MHz */ + } + , + + /* 640x480 */ + + {VG_SUPPORTFLAG_60HZ | /* refresh rate = 60 */ + VG_SUPPORTFLAG_8BPP | VG_SUPPORTFLAG_12BPP | VG_SUPPORTFLAG_15BPP + | VG_SUPPORTFLAG_16BPP | VG_SUPPORTFLAG_24BPP | + VG_SUPPORTFLAG_32BPP, + VG_MODEFLAG_LOW_BAND | /* Low bandwidth mode. */ + VG_MODEFLAG_NEG_HSYNC | VG_MODEFLAG_NEG_VSYNC, /* negative syncs */ + 640, 480, /* No scaling. */ + 0, 0, /* No mode dimensions. */ + 0, 0, /* No panel dimensions. */ + 0, 0, 0, 0, 0, /* No panel registers */ + 0x0280, 0x0288, 0x0290, 0x02E8, 0x0318, 0x0320, /* horiz timings */ + 0x01E0, 0x01E8, 0x01EA, 0x01EC, 0x0205, 0x020D, /* vertical timings */ + 0, 0, 0, 0, 0, 0, /* No even timings */ + (25L << 16) | ((1750L * 65536L) / 10000L), /* freq = 25.175 MHz */ + } + , + + {VG_SUPPORTFLAG_70HZ | /* refresh rate = 70 */ + VG_SUPPORTFLAG_8BPP | VG_SUPPORTFLAG_12BPP | VG_SUPPORTFLAG_15BPP + | VG_SUPPORTFLAG_16BPP | VG_SUPPORTFLAG_24BPP | + VG_SUPPORTFLAG_32BPP, + VG_MODEFLAG_LOW_BAND | /* Low bandwidth mode. */ + 0, + 640, 480, /* No scaling. */ + 0, 0, /* No mode dimensions. */ + 0, 0, /* No panel dimensions. */ + 0, 0, 0, 0, 0, /* No panel registers */ + 0x0280, 0x0280, 0x0298, 0x02D8, 0x0330, 0x0330, /* horiz timings */ + 0x01E0, 0x01E0, 0x01E2, 0x01E5, 0x01F4, 0x01F4, /* vertical timings */ + 0, 0, 0, 0, 0, 0, /* No even timings */ + (28L << 16) | ((5600L * 65536L) / 10000L), /* freq = 28.560 MHz */ + } + , + + {VG_SUPPORTFLAG_72HZ | /* refresh rate = 72 */ + VG_SUPPORTFLAG_8BPP | VG_SUPPORTFLAG_12BPP | VG_SUPPORTFLAG_15BPP + | VG_SUPPORTFLAG_16BPP | VG_SUPPORTFLAG_24BPP | + VG_SUPPORTFLAG_32BPP, + VG_MODEFLAG_LOW_BAND | /* Low bandwidth mode. */ + VG_MODEFLAG_NEG_HSYNC | VG_MODEFLAG_NEG_VSYNC, /* negative syncs */ + 640, 480, /* No scaling. */ + 0, 0, /* No mode dimensions. */ + 0, 0, /* No panel dimensions. */ + 0, 0, 0, 0, 0, /* No panel registers */ + 0x0280, 0x0288, 0x0298, 0x02c0, 0x0338, 0x0340, /* horiz timings */ + 0x01e0, 0x01e8, 0x01e9, 0x01ec, 0x0200, 0x0208, /* vertical timings */ + 0, 0, 0, 0, 0, 0, /* No even timings */ + (31L << 16) | ((5000L * 65536L) / 10000L), /* freq = 31.5 MHz */ + } + , + + {VG_SUPPORTFLAG_75HZ | /* refresh rate = 75 */ + VG_SUPPORTFLAG_8BPP | VG_SUPPORTFLAG_12BPP | VG_SUPPORTFLAG_15BPP + | VG_SUPPORTFLAG_16BPP | VG_SUPPORTFLAG_24BPP | + VG_SUPPORTFLAG_32BPP, + VG_MODEFLAG_LOW_BAND | /* Low bandwidth mode. */ + VG_MODEFLAG_NEG_HSYNC | VG_MODEFLAG_NEG_VSYNC, /* negative syncs */ + 640, 480, /* No scaling. */ + 0, 0, /* No mode dimensions. */ + 0, 0, /* No panel dimensions. */ + 0, 0, 0, 0, 0, /* No panel registers */ + 0x0280, 0x0280, 0x0290, 0x02D0, 0x0348, 0x0348, /* horiz timings */ + 0x01E0, 0x01E0, 0x01E1, 0x01E4, 0x01F4, 0x01F4, /* vertical timings */ + 0, 0, 0, 0, 0, 0, /* No even timings */ + (31L << 16) | ((5000L * 65536L) / 10000L), /* freq = 31.5 MHz */ + } + , + + {VG_SUPPORTFLAG_85HZ | /* refresh rate = 85 */ + VG_SUPPORTFLAG_8BPP | VG_SUPPORTFLAG_12BPP | VG_SUPPORTFLAG_15BPP + | VG_SUPPORTFLAG_16BPP | VG_SUPPORTFLAG_24BPP | + VG_SUPPORTFLAG_32BPP, + VG_MODEFLAG_LOW_BAND | /* Low bandwidth mode. */ + VG_MODEFLAG_NEG_HSYNC | VG_MODEFLAG_NEG_VSYNC, /* negative syncs */ + 640, 480, /* No scaling. */ + 0, 0, /* No mode dimensions. */ + 0, 0, /* No panel dimensions. */ + 0, 0, 0, 0, 0, /* No panel registers */ + 0x0280, 0x0280, 0x02B8, 0x02F0, 0x0340, 0x0340, /* horiz timings */ + 0x01E0, 0x01E0, 0x01E1, 0x01E4, 0x01FD, 0x01FD, /* vertical timings */ + 0, 0, 0, 0, 0, 0, /* No even timings */ + (36L << 16) | ((0000L * 65536L) / 10000L), /* freq = 36.0 MHz */ + } + , + + {VG_SUPPORTFLAG_90HZ | /* refresh rate = 90 */ + VG_SUPPORTFLAG_8BPP | VG_SUPPORTFLAG_12BPP | VG_SUPPORTFLAG_15BPP + | VG_SUPPORTFLAG_16BPP | VG_SUPPORTFLAG_24BPP | + VG_SUPPORTFLAG_32BPP, + VG_MODEFLAG_LOW_BAND | /* Low bandwidth mode. */ + 0, + 640, 480, /* No scaling. */ + 0, 0, /* No mode dimensions. */ + 0, 0, /* No panel dimensions. */ + 0, 0, 0, 0, 0, /* No panel registers */ + 0x0280, 0x0280, 0x02A0, 0x02E0, 0x0340, 0x0340, /* horiz timings */ + 0x01E0, 0x01E0, 0x01E1, 0x01E4, 0x01FA, 0x01FA, /* vertical timings */ + 0, 0, 0, 0, 0, 0, /* No even timings */ + (37L << 16) | ((8890L * 65536L) / 10000L), /* freq = 37.889 MHz */ + } + , + + {VG_SUPPORTFLAG_100HZ | /* refresh rate = 100 */ + VG_SUPPORTFLAG_8BPP | VG_SUPPORTFLAG_12BPP | VG_SUPPORTFLAG_15BPP + | VG_SUPPORTFLAG_16BPP | VG_SUPPORTFLAG_24BPP | + VG_SUPPORTFLAG_32BPP, + VG_MODEFLAG_LOW_BAND | /* Low bandwidth mode. */ + 0, + 640, 480, /* No scaling. */ + 0, 0, /* No mode dimensions. */ + 0, 0, /* No panel dimensions. */ + 0, 0, 0, 0, 0, /* No panel registers */ + 0x0280, 0x0280, 0x02A8, 0x02E8, 0x0350, 0x0350, /* horiz timings */ + 0x01E0, 0x01E0, 0x01E1, 0x01E4, 0x01FD, 0x01FD, /* vertical timings */ + 0, 0, 0, 0, 0, 0, /* No even timings */ + (43L << 16) | ((1630L * 65536L) / 10000L), /* freq = 43.163 MHz */ + } + , + + /* 640 x 480 PANEL */ + + {VG_SUPPORTFLAG_60HZ | /* refresh rate = 60 */ + VG_SUPPORTFLAG_8BPP | VG_SUPPORTFLAG_12BPP | VG_SUPPORTFLAG_15BPP | VG_SUPPORTFLAG_16BPP | VG_SUPPORTFLAG_24BPP | VG_SUPPORTFLAG_32BPP | VG_SUPPORTFLAG_PANEL, /* Panel Mode. */ + VG_MODEFLAG_LOW_BAND | /* Low bandwidth mode. */ + VG_MODEFLAG_PANELOUT | /* Panel output. */ + VG_MODEFLAG_NEG_HSYNC | VG_MODEFLAG_NEG_VSYNC, /* negative syncs */ + 640, 480, /* No scaling. */ + 640, 480, /* 640x480 active */ + 640, 480, /* 640x480 panel */ + 0, 0, 0, 0, 0, /* No panel registers */ + 0x0280, 0x0280, 0x0290, 0x02E8, 0x0318, 0x0320, /* horiz timings */ + 0x01E0, 0x01E0, 0x01EA, 0x01EC, 0x0205, 0x020D, /* vertical timings */ + 0, 0, 0, 0, 0, 0, /* No even timings */ + (25L << 16) | ((1750L * 65536L) / 10000L), /* freq = 25.175 MHz */ + } + , + + /* 800x600 */ + + {VG_SUPPORTFLAG_56HZ | /* refresh rate = 56 */ + VG_SUPPORTFLAG_8BPP | VG_SUPPORTFLAG_12BPP | VG_SUPPORTFLAG_15BPP + | VG_SUPPORTFLAG_16BPP | VG_SUPPORTFLAG_24BPP | + VG_SUPPORTFLAG_32BPP, + VG_MODEFLAG_LOW_BAND | /* Low bandwidth mode. */ + 0, + 800, 600, /* No scaling. */ + 0, 0, /* No mode dimensions. */ + 0, 0, /* No panel dimensions. */ + 0, 0, 0, 0, 0, /* No panel registers */ + 0x0320, 0x0320, 0x0338, 0x0380, 0x0400, 0x0400, /* horiz timings */ + 0x0258, 0x0258, 0x0259, 0x025B, 0x0271, 0x0271, /* vertical timings */ + 0, 0, 0, 0, 0, 0, /* No even timings */ + (36L << 16) | ((0000L * 65536L) / 10000L), /* freq = 36.0 MHz */ + } + , + + {VG_SUPPORTFLAG_60HZ | /* refresh rate = 60 */ + VG_SUPPORTFLAG_8BPP | VG_SUPPORTFLAG_12BPP | VG_SUPPORTFLAG_15BPP + | VG_SUPPORTFLAG_16BPP | VG_SUPPORTFLAG_24BPP | + VG_SUPPORTFLAG_32BPP, + VG_MODEFLAG_LOW_BAND | /* Low bandwidth mode. */ + 0, + 800, 600, /* No scaling. */ + 0, 0, /* No mode dimensions. */ + 0, 0, /* No panel dimensions. */ + 0, 0, 0, 0, 0, /* No panel registers */ + 0x0320, 0x0328, 0x0348, 0x03D0, 0x0418, 0x0420, /* horiz timings */ + 0x0258, 0x0258, 0x0259, 0x025D, 0x0274, 0x0274, /* vertical timings */ + 0, 0, 0, 0, 0, 0, /* No even timings */ + (40L << 16) | ((0000L * 65536L) / 10000L), /* freq = 40.00 MHz */ + } + , + + {VG_SUPPORTFLAG_70HZ | /* refresh rate = 70 */ + VG_SUPPORTFLAG_8BPP | VG_SUPPORTFLAG_12BPP | VG_SUPPORTFLAG_15BPP + | VG_SUPPORTFLAG_16BPP | VG_SUPPORTFLAG_24BPP | + VG_SUPPORTFLAG_32BPP, + VG_MODEFLAG_LOW_BAND | /* Low bandwidth mode. */ + 0, + 800, 600, /* No scaling. */ + 0, 0, /* No mode dimensions. */ + 0, 0, /* No panel dimensions. */ + 0, 0, 0, 0, 0, /* No panel registers */ + 0x0320, 0x0320, 0x0348, 0x0398, 0x0410, 0x0410, /* horiz timings */ + 0x0258, 0x0258, 0x025c, 0x025F, 0x0274, 0x0274, /* vertical timings */ + 0, 0, 0, 0, 0, 0, /* No even timings */ + (45L << 16) | ((7200L * 65536L) / 10000L), /* freq = 45.72 MHz */ + } + , + + {VG_SUPPORTFLAG_72HZ | /* refresh rate = 72 */ + VG_SUPPORTFLAG_8BPP | VG_SUPPORTFLAG_12BPP | VG_SUPPORTFLAG_15BPP + | VG_SUPPORTFLAG_16BPP | VG_SUPPORTFLAG_24BPP | + VG_SUPPORTFLAG_32BPP, + VG_MODEFLAG_LOW_BAND | /* Low bandwidth mode. */ + 0, + 800, 600, /* No scaling. */ + 0, 0, /* No mode dimensions. */ + 0, 0, /* No panel dimensions. */ + 0, 0, 0, 0, 0, /* No panel registers */ + 0x0320, 0x0320, 0x0358, 0x03D0, 0x0410, 0x0410, /* horiz timings */ + 0x0258, 0x0258, 0x027D, 0x0283, 0x029A, 0x029A, /* vertical timings */ + 0, 0, 0, 0, 0, 0, /* No even timings */ + (49L << 16) | ((5000L * 65536L) / 10000L), /* freq = 49.5 MHz */ + } + , + + {VG_SUPPORTFLAG_75HZ | /* refresh rate = 75 */ + VG_SUPPORTFLAG_8BPP | VG_SUPPORTFLAG_12BPP | VG_SUPPORTFLAG_15BPP + | VG_SUPPORTFLAG_16BPP | VG_SUPPORTFLAG_24BPP | + VG_SUPPORTFLAG_32BPP, + VG_MODEFLAG_LOW_BAND | /* Low bandwidth mode. */ + 0, + 800, 600, /* No scaling. */ + 0, 0, /* No mode dimensions. */ + 0, 0, /* No panel dimensions. */ + 0, 0, 0, 0, 0, /* No panel registers */ + 0x0320, 0x0320, 0x0330, 0x0380, 0x0420, 0x0420, /* horiz timings */ + 0x0258, 0x0258, 0x0259, 0x025C, 0x0271, 0x0271, /* vertical timings */ + 0, 0, 0, 0, 0, 0, /* No even timings */ + (49L << 16) | ((5000L * 65536L) / 10000L), /* freq = 49.5 MHz */ + } + , + + {VG_SUPPORTFLAG_85HZ | /* refresh rate = 85 */ + VG_SUPPORTFLAG_8BPP | VG_SUPPORTFLAG_12BPP | VG_SUPPORTFLAG_15BPP + | VG_SUPPORTFLAG_16BPP | VG_SUPPORTFLAG_24BPP | + VG_SUPPORTFLAG_32BPP, + VG_MODEFLAG_LOW_BAND | /* Low bandwidth mode. */ + 0, + 800, 600, /* No scaling. */ + 0, 0, /* No mode dimensions. */ + 0, 0, /* No panel dimensions. */ + 0, 0, 0, 0, 0, /* No panel registers */ + 0x0320, 0x0320, 0x0340, 0x0380, 0x0418, 0x0418, /* horiz timings */ + 0x0258, 0x0258, 0x0259, 0x025C, 0x0277, 0x0277, /* vertical timings */ + 0, 0, 0, 0, 0, 0, /* No even timings */ + (56L << 16) | ((2500L * 65536L) / 10000L), /* freq = 56.25 MHz */ + } + , + + {VG_SUPPORTFLAG_90HZ | /* refresh rate = 90 */ + VG_SUPPORTFLAG_8BPP | VG_SUPPORTFLAG_12BPP | VG_SUPPORTFLAG_15BPP + | VG_SUPPORTFLAG_16BPP | VG_SUPPORTFLAG_24BPP | + VG_SUPPORTFLAG_32BPP, + VG_MODEFLAG_LOW_BAND | /* Low bandwidth mode. */ + 0, + 800, 600, /* No scaling. */ + 0, 0, /* No mode dimensions. */ + 0, 0, /* No panel dimensions. */ + 0, 0, 0, 0, 0, /* No panel registers */ + 0x0320, 0x0320, 0x0348, 0x03A0, 0x0420, 0x0420, /* horiz timings */ + 0x0258, 0x0258, 0x0259, 0x025C, 0x0278, 0x0278, /* vertical timings */ + 0, 0, 0, 0, 0, 0, /* No even timings */ + (60L << 16) | ((650L * 65536L) / 10000L), /* freq = 60.065 MHz */ + } + , + + {VG_SUPPORTFLAG_100HZ | /* refresh rate = 100 */ + VG_SUPPORTFLAG_8BPP | VG_SUPPORTFLAG_12BPP | VG_SUPPORTFLAG_15BPP + | VG_SUPPORTFLAG_16BPP | VG_SUPPORTFLAG_24BPP | + VG_SUPPORTFLAG_32BPP, + VG_MODEFLAG_LOW_BAND | /* Low bandwidth mode. */ + 0, + 800, 600, /* No scaling. */ + 0, 0, /* No mode dimensions. */ + 0, 0, /* No panel dimensions. */ + 0, 0, 0, 0, 0, /* No panel registers */ + 0x0320, 0x0320, 0x0350, 0x03A8, 0x0430, 0x0430, /* horiz timings */ + 0x0258, 0x0258, 0x0259, 0x025C, 0x0277, 0x027C, /* vertical timings */ + 0, 0, 0, 0, 0, 0, /* No even timings */ + (68L << 16) | ((1790L * 65536L) / 10000L), /* freq = 68.179 MHz */ + } + , + + /* 800x600 PANEL */ + + {VG_SUPPORTFLAG_60HZ | /* refresh rate = 60 */ + VG_SUPPORTFLAG_8BPP | VG_SUPPORTFLAG_12BPP | VG_SUPPORTFLAG_15BPP | VG_SUPPORTFLAG_16BPP | VG_SUPPORTFLAG_24BPP | VG_SUPPORTFLAG_32BPP | VG_SUPPORTFLAG_PANEL, /* Panel Mode. */ + VG_MODEFLAG_LOW_BAND | /* Low bandwidth mode. */ + VG_MODEFLAG_PANELOUT | /* Panel output. */ + VG_MODEFLAG_NEG_HSYNC | VG_MODEFLAG_NEG_VSYNC, /* negative syncs */ + 800, 600, /* No scaling. */ + 800, 600, /* 800x600 active. */ + 800, 600, /* 800x600 panel */ + 0, 0, 0, 0, 0, /* No panel registers */ + 0x0320, 0x0320, 0x0348, 0x03C8, 0x0420, 0x0420, /* horiz timings */ + 0x0258, 0x0258, 0x0259, 0x025D, 0x0274, 0x0274, /* vertical timings */ + 0, 0, 0, 0, 0, 0, /* No even timings */ + (40L << 16) | ((0000L * 65536L) / 10000L), /* freq = 40.00 MHz */ + } + , + + /* 1024x768 */ + + {VG_SUPPORTFLAG_60HZ | /* refresh rate = 60 */ + VG_SUPPORTFLAG_8BPP | VG_SUPPORTFLAG_12BPP | VG_SUPPORTFLAG_15BPP + | VG_SUPPORTFLAG_16BPP | VG_SUPPORTFLAG_24BPP | + VG_SUPPORTFLAG_32BPP, + VG_MODEFLAG_AVG_BAND | /* Avg bandwidth mode. */ + VG_MODEFLAG_NEG_HSYNC | VG_MODEFLAG_NEG_VSYNC, /* negative syncs */ + 1024, 768, /* No scaling. */ + 0, 0, /* No mode dimensions. */ + 0, 0, /* No panel dimensions. */ + 0, 0, 0, 0, 0, /* No panel registers */ + 0x0400, 0x0400, 0x0418, 0x04A0, 0x0540, 0x0540, /* horiz timings */ + 0x0300, 0x0300, 0x0303, 0x0309, 0x0326, 0x0326, /* vertical timings */ + 0, 0, 0, 0, 0, 0, /* No even timings */ + (65L << 16) | ((0000L * 65536L) / 10000L), /* freq = 65.00 MHz */ + } + , + + {VG_SUPPORTFLAG_70HZ | /* refresh rate = 70 */ + VG_SUPPORTFLAG_8BPP | VG_SUPPORTFLAG_12BPP | VG_SUPPORTFLAG_15BPP + | VG_SUPPORTFLAG_16BPP | VG_SUPPORTFLAG_24BPP | + VG_SUPPORTFLAG_32BPP, + VG_MODEFLAG_AVG_BAND | /* Avg bandwidth mode. */ + VG_MODEFLAG_NEG_HSYNC | VG_MODEFLAG_NEG_VSYNC, /* negative syncs */ + 1024, 768, /* No scaling. */ + 0, 0, /* No mode dimensions. */ + 0, 0, /* No panel dimensions. */ + 0, 0, 0, 0, 0, /* No panel registers */ + 0x0400, 0x0400, 0x0418, 0x04A0, 0x0530, 0x0530, /* horiz timings */ + 0x0300, 0x0300, 0x0303, 0x0309, 0x0326, 0x0326, /* vertical timings */ + 0, 0, 0, 0, 0, 0, /* No even timings */ + (75L << 16) | ((0000L * 65536L) / 10000L), /* freq = 75.0 MHz */ + } + , + + {VG_SUPPORTFLAG_72HZ | /* refresh rate = 72 */ + VG_SUPPORTFLAG_8BPP | VG_SUPPORTFLAG_12BPP | VG_SUPPORTFLAG_15BPP + | VG_SUPPORTFLAG_16BPP | VG_SUPPORTFLAG_24BPP | + VG_SUPPORTFLAG_32BPP, + VG_MODEFLAG_AVG_BAND | /* Avg bandwidth mode. */ + 0, + 1024, 768, /* No scaling. */ + 0, 0, /* No mode dimensions. */ + 0, 0, /* No panel dimensions. */ + 0, 0, 0, 0, 0, /* No panel registers */ + 0x0400, 0x0400, 0x0438, 0x04A8, 0x0550, 0x0550, /* horiz timings */ + 0x0300, 0x0300, 0x0304, 0x0307, 0x0324, 0x0324, /* vertical timings */ + 0, 0, 0, 0, 0, 0, /* No even timings */ + (78L << 16) | ((7500L * 65536L) / 10000L), /* freq = 78.75 MHz */ + } + , + + {VG_SUPPORTFLAG_75HZ | /* refresh rate = 75 */ + VG_SUPPORTFLAG_8BPP | VG_SUPPORTFLAG_12BPP | VG_SUPPORTFLAG_15BPP + | VG_SUPPORTFLAG_16BPP | VG_SUPPORTFLAG_24BPP | + VG_SUPPORTFLAG_32BPP, + VG_MODEFLAG_AVG_BAND | /* Avg bandwidth mode. */ + 0, + 1024, 768, /* No scaling. */ + 0, 0, /* No mode dimensions. */ + 0, 0, /* No panel dimensions. */ + 0, 0, 0, 0, 0, /* No panel registers */ + 0x0400, 0x0400, 0x0410, 0x0470, 0x0520, 0x0520, /* horiz timings */ + 0x0300, 0x0300, 0x0301, 0x0304, 0x0320, 0x0320, /* vertical timings */ + 0, 0, 0, 0, 0, 0, /* No even timings */ + (78L << 16) | ((7500L * 65536L) / 10000L), /* freq = 78.75 MHz */ + } + , + + {VG_SUPPORTFLAG_85HZ | /* refresh rate = 85 */ + VG_SUPPORTFLAG_8BPP | VG_SUPPORTFLAG_12BPP | VG_SUPPORTFLAG_15BPP + | VG_SUPPORTFLAG_16BPP | VG_SUPPORTFLAG_24BPP | + VG_SUPPORTFLAG_32BPP, + VG_MODEFLAG_AVG_BAND | /* Avg bandwidth mode. */ + 0, + 1024, 768, /* No scaling. */ + 0, 0, /* No mode dimensions. */ + 0, 0, /* No panel dimensions. */ + 0, 0, 0, 0, 0, /* No panel registers */ + 0x0400, 0x0400, 0x0430, 0x0490, 0x0560, 0x0560, /* horiz timings */ + 0x0300, 0x0300, 0x0301, 0x0304, 0x0328, 0x0328, /* vertical timings */ + 0, 0, 0, 0, 0, 0, /* No even timings */ + (94L << 16) | ((5000L * 65536L) / 10000L), /* freq = 94.50 MHz */ + } + , + + {VG_SUPPORTFLAG_90HZ | /* refresh rate = 90 */ + VG_SUPPORTFLAG_8BPP | VG_SUPPORTFLAG_12BPP | VG_SUPPORTFLAG_15BPP + | VG_SUPPORTFLAG_16BPP | VG_SUPPORTFLAG_24BPP | + VG_SUPPORTFLAG_32BPP, + VG_MODEFLAG_AVG_BAND | /* Avg bandwidth mode. */ + 0, + 1024, 768, /* No scaling. */ + 0, 0, /* No mode dimensions. */ + 0, 0, /* No panel dimensions. */ + 0, 0, 0, 0, 0, /* No panel registers */ + 0x0400, 0x0400, 0x0440, 0x04B0, 0x0560, 0x0560, /* horiz timings */ + 0x0300, 0x0300, 0x0301, 0x0304, 0x0329, 0x0329, /* vertical timings */ + 0, 0, 0, 0, 0, 0, /* No even timings */ + (100L << 16) | ((1870L * 65536L) / 10000L), /* freq = 100.187 MHz */ + } + , + + {VG_SUPPORTFLAG_100HZ | /* refresh rate = 100 */ + VG_SUPPORTFLAG_8BPP | VG_SUPPORTFLAG_12BPP | VG_SUPPORTFLAG_15BPP + | VG_SUPPORTFLAG_16BPP | VG_SUPPORTFLAG_24BPP | + VG_SUPPORTFLAG_32BPP, + VG_MODEFLAG_AVG_BAND | /* Avg bandwidth mode. */ + 0, + 1024, 768, /* No scaling. */ + 0, 0, /* No mode dimensions. */ + 0, 0, /* No panel dimensions. */ + 0, 0, 0, 0, 0, /* No panel registers */ + 0x0400, 0x0400, 0x0448, 0x04B8, 0x0570, 0x0570, /* horiz timings */ + 0x0300, 0x0300, 0x0301, 0x0304, 0x032E, 0x032E, /* vertical timings */ + 0, 0, 0, 0, 0, 0, /* No even timings */ + (113L << 16) | ((3100L * 65536L) / 10000L), /* freq = 113.31 MHz */ + } + , + + /* 1024x768 PANEL */ + + {VG_SUPPORTFLAG_60HZ | /* refresh rate = 60 */ + VG_SUPPORTFLAG_8BPP | VG_SUPPORTFLAG_12BPP | VG_SUPPORTFLAG_15BPP | VG_SUPPORTFLAG_16BPP | VG_SUPPORTFLAG_24BPP | VG_SUPPORTFLAG_32BPP | VG_SUPPORTFLAG_PANEL, /* Panel Mode. */ + VG_MODEFLAG_AVG_BAND | /* Avg bandwidth mode. */ + VG_MODEFLAG_PANELOUT | /* Panel output. */ + VG_MODEFLAG_NEG_HSYNC | VG_MODEFLAG_NEG_VSYNC, /* negative syncs */ + 1024, 768, /* No scaling. */ + 1024, 768, /* 1024x768 active. */ + 1024, 768, /* 1024x768 panel */ + 0, 0, 0, 0, 0, /* No panel registers */ + 0x0400, 0x0400, 0x0418, 0x04A0, 0x0540, 0x0540, /* horiz timings */ + 0x0300, 0x0300, 0x0303, 0x0309, 0x0326, 0x0326, /* vertical timings */ + 0, 0, 0, 0, 0, 0, /* No even timings */ + (65L << 16) | ((0000L * 65536L) / 10000L), /* freq = 65.00 MHz */ + } + , + + /* 1152x864 */ + + {VG_SUPPORTFLAG_60HZ | /* refresh rate = 60 */ + VG_SUPPORTFLAG_8BPP | VG_SUPPORTFLAG_12BPP | VG_SUPPORTFLAG_15BPP + | VG_SUPPORTFLAG_16BPP | VG_SUPPORTFLAG_24BPP | + VG_SUPPORTFLAG_32BPP, + VG_MODEFLAG_AVG_BAND | /* Avg bandwidth mode. */ + 0, + 1152, 864, /* No scaling. */ + 0, 0, /* No mode dimensions. */ + 0, 0, /* No panel dimensions. */ + 0, 0, 0, 0, 0, /* No panel registers */ + 0x0480, 0x0480, 0x04C0, 0x0538, 0x05F0, 0x05F0, /* horiz timings */ + 0x0360, 0x0360, 0x0361, 0x0364, 0x037F, 0x037F, /* vertical timings */ + 0, 0, 0, 0, 0, 0, /* No even timings */ + (81L << 16) | ((6000L * 65536L) / 10000L), /* freq = 81.60 MHz */ + } + , + + {VG_SUPPORTFLAG_70HZ | /* refresh rate = 70 */ + VG_SUPPORTFLAG_8BPP | VG_SUPPORTFLAG_12BPP | VG_SUPPORTFLAG_15BPP + | VG_SUPPORTFLAG_16BPP | VG_SUPPORTFLAG_24BPP | + VG_SUPPORTFLAG_32BPP, + VG_MODEFLAG_AVG_BAND | /* Avg bandwidth mode. */ + 0, + 1152, 864, /* No scaling. */ + 0, 0, /* No mode dimensions. */ + 0, 0, /* No panel dimensions. */ + 0, 0, 0, 0, 0, /* No panel registers */ + 0x0480, 0x0480, 0x04C8, 0x0540, 0x0600, 0x0600, /* horiz timings */ + 0x0360, 0x0360, 0x0368, 0x036B, 0x038B, 0x038B, /* vertical timings */ + 0, 0, 0, 0, 0, 0, /* No even timings */ + (97L << 16) | ((5200L * 65536L) / 10000L), /* freq = 97.52 MHz */ + } + , + + {VG_SUPPORTFLAG_72HZ | /* refresh rate = 72 */ + VG_SUPPORTFLAG_8BPP | VG_SUPPORTFLAG_12BPP | VG_SUPPORTFLAG_15BPP + | VG_SUPPORTFLAG_16BPP | VG_SUPPORTFLAG_24BPP | + VG_SUPPORTFLAG_32BPP, + VG_MODEFLAG_AVG_BAND | /* Avg bandwidth mode. */ + 0, + 1152, 864, /* No scaling. */ + 0, 0, /* No mode dimensions. */ + 0, 0, /* No panel dimensions. */ + 0, 0, 0, 0, 0, /* No panel registers */ + 0x0480, 0x0480, 0x04C8, 0x0548, 0x0610, 0x0610, /* horiz timings */ + 0x0360, 0x0360, 0x0367, 0x036A, 0x038B, 0x038B, /* vertical timings */ + 0, 0, 0, 0, 0, 0, /* No even timings */ + (101L << 16) | ((4200L * 65536L) / 10000L), /* freq = 101.42 MHz */ + } + , + + {VG_SUPPORTFLAG_75HZ | /* refresh rate = 75 */ + VG_SUPPORTFLAG_8BPP | VG_SUPPORTFLAG_12BPP | VG_SUPPORTFLAG_15BPP + | VG_SUPPORTFLAG_16BPP | VG_SUPPORTFLAG_24BPP | + VG_SUPPORTFLAG_32BPP, + VG_MODEFLAG_AVG_BAND | /* Avg bandwidth mode. */ + 0, + 1152, 864, /* No scaling. */ + 0, 0, /* No mode dimensions. */ + 0, 0, /* No panel dimensions. */ + 0, 0, 0, 0, 0, /* No panel registers */ + 0x0480, 0x0480, 0x04C0, 0x0540, 0x0640, 0x0640, /* horiz timings */ + 0x0360, 0x0360, 0x0361, 0x0364, 0x0384, 0x0384, /* vertical timings */ + 0, 0, 0, 0, 0, 0, /* No even timings */ + (108L << 16) | ((0000L * 65536L) / 10000L), /* freq = 108.00 MHz */ + } + , + + {VG_SUPPORTFLAG_85HZ | /* refresh rate = 85 */ + VG_SUPPORTFLAG_8BPP | VG_SUPPORTFLAG_12BPP | VG_SUPPORTFLAG_15BPP + | VG_SUPPORTFLAG_16BPP | VG_SUPPORTFLAG_24BPP | + VG_SUPPORTFLAG_32BPP, + VG_MODEFLAG_AVG_BAND | /* Avg bandwidth mode. */ + 0, + 1152, 864, /* No scaling. */ + 0, 0, /* No mode dimensions. */ + 0, 0, /* No panel dimensions. */ + 0, 0, 0, 0, 0, /* No panel registers */ + 0x0480, 0x0480, 0x04C8, 0x0548, 0x0610, 0x0610, /* horiz timings */ + 0x0360, 0x0360, 0x0363, 0x0366, 0x038B, 0x038B, /* vertical timings */ + 0, 0, 0, 0, 0, 0, /* No even timings */ + (119L << 16) | ((6500L * 65536L) / 10000L), /* freq = 119.65 MHz */ + } + , + + {VG_SUPPORTFLAG_90HZ | /* refresh rate = 90 */ + VG_SUPPORTFLAG_8BPP | VG_SUPPORTFLAG_12BPP | VG_SUPPORTFLAG_15BPP + | VG_SUPPORTFLAG_16BPP | VG_SUPPORTFLAG_24BPP | + VG_SUPPORTFLAG_32BPP, + VG_MODEFLAG_AVG_BAND | /* Avg bandwidth mode. */ + 0, + 1152, 864, /* No scaling. */ + 0, 0, /* No mode dimensions. */ + 0, 0, /* No panel dimensions. */ + 0, 0, 0, 0, 0, /* No panel registers */ + 0x0480, 0x0480, 0x04D0, 0x0550, 0x0620, 0x0620, /* horiz timings */ + 0x0360, 0x0360, 0x0369, 0x036C, 0x0396, 0x0396, /* vertical timings */ + 0, 0, 0, 0, 0, 0, /* No even timings */ + (129L << 16) | ((6000L * 65536L) / 10000L), /* freq = 129.60 MHz */ + } + , + + {VG_SUPPORTFLAG_100HZ | /* refresh rate = 100 */ + VG_SUPPORTFLAG_8BPP | VG_SUPPORTFLAG_12BPP | VG_SUPPORTFLAG_15BPP + | VG_SUPPORTFLAG_16BPP | VG_SUPPORTFLAG_24BPP | + VG_SUPPORTFLAG_32BPP, + VG_MODEFLAG_AVG_BAND | /* Avg bandwidth mode. */ + 0, + 1152, 864, /* No scaling. */ + 0, 0, /* No mode dimensions. */ + 0, 0, /* No panel dimensions. */ + 0, 0, 0, 0, 0, /* No panel registers */ + 0x0480, 0x0480, 0x04D0, 0x0550, 0x0620, 0x0620, /* horiz timings */ + 0x0360, 0x0360, 0x0363, 0x0366, 0x0396, 0x0396, /* vertical timings */ + 0, 0, 0, 0, 0, 0, /* No even timings */ + (144L << 16) | ((0000L * 65536L) / 10000L), /* freq = 144.00 MHz */ + } + , + + /* 1152x864 PANEL */ + + {VG_SUPPORTFLAG_60HZ | /* refresh rate = 60 */ + VG_SUPPORTFLAG_8BPP | VG_SUPPORTFLAG_12BPP | VG_SUPPORTFLAG_15BPP | VG_SUPPORTFLAG_16BPP | VG_SUPPORTFLAG_24BPP | VG_SUPPORTFLAG_32BPP | VG_SUPPORTFLAG_PANEL, /* Panel Mode. */ + VG_MODEFLAG_AVG_BAND | /* Avg bandwidth mode. */ + VG_MODEFLAG_PANELOUT | /* Panel output. */ + VG_MODEFLAG_NEG_HSYNC | VG_MODEFLAG_NEG_VSYNC, /* negative syncs */ + 1152, 864, /* No scaling. */ + 1152, 864, /* 1152x864 active. */ + 1152, 864, /* 1152x864 panel. */ + 0, 0, 0, 0, 0, /* No panel registers */ + 0x0480, 0x0480, 0x04C0, 0x0538, 0x05F0, 0x05F0, /* horiz timings */ + 0x0360, 0x0360, 0x0361, 0x0364, 0x037F, 0x037F, /* vertical timings */ + 0, 0, 0, 0, 0, 0, /* No even timings */ + (81L << 16) | ((6000L * 65536L) / 10000L), /* freq = 81.60 MHz */ + } + , + + /* 1280x1024 */ + + {VG_SUPPORTFLAG_60HZ | /* refresh rate = 60 */ + VG_SUPPORTFLAG_8BPP | VG_SUPPORTFLAG_12BPP | VG_SUPPORTFLAG_15BPP + | VG_SUPPORTFLAG_16BPP | VG_SUPPORTFLAG_24BPP | + VG_SUPPORTFLAG_32BPP, + VG_MODEFLAG_AVG_BAND | /* Avg bandwidth mode. */ + 0, + 1280, 1024, /* No scaling. */ + 0, 0, /* No mode dimensions. */ + 0, 0, /* No panel dimensions. */ + 0, 0, 0, 0, 0, /* No panel registers */ + 0x0500, 0x0500, 0x0530, 0x05A0, 0x0698, 0x0698, /* horiz timings */ + 0x0400, 0x0400, 0x0401, 0x0404, 0x042A, 0x042A, /* vertical timings */ + 0, 0, 0, 0, 0, 0, /* No even timings */ + (108L << 16) | ((0000L * 65536L) / 10000L), /* freq = 108.00 MHz */ + } + , + + {VG_SUPPORTFLAG_70HZ | /* refresh rate = 70 */ + VG_SUPPORTFLAG_8BPP | VG_SUPPORTFLAG_12BPP | VG_SUPPORTFLAG_15BPP + | VG_SUPPORTFLAG_16BPP | VG_SUPPORTFLAG_24BPP | + VG_SUPPORTFLAG_32BPP, + VG_MODEFLAG_AVG_BAND | /* Avg bandwidth mode. */ + 0, + 1280, 1024, /* No scaling. */ + 0, 0, /* No mode dimensions. */ + 0, 0, /* No panel dimensions. */ + 0, 0, 0, 0, 0, /* No panel registers */ + 0x0500, 0x0500, 0x0558, 0x05E0, 0x06C0, 0x06C0, /* horiz timings */ + 0x0400, 0x0400, 0x0406, 0x0409, 0x042F, 0x042F, /* vertical timings */ + 0, 0, 0, 0, 0, 0, /* No even timings */ + (129L << 16) | ((6000L * 65536L) / 10000L), /* freq = 129.60 MHz */ + } + , + + {VG_SUPPORTFLAG_72HZ | /* refresh rate = 72 */ + VG_SUPPORTFLAG_8BPP | VG_SUPPORTFLAG_12BPP | VG_SUPPORTFLAG_15BPP + | VG_SUPPORTFLAG_16BPP | VG_SUPPORTFLAG_24BPP | + VG_SUPPORTFLAG_32BPP, + VG_MODEFLAG_AVG_BAND | /* Avg bandwidth mode. */ + 0, + 1280, 1024, /* No scaling. */ + 0, 0, /* No mode dimensions. */ + 0, 0, /* No panel dimensions. */ + 0, 0, 0, 0, 0, /* No panel registers */ + 0x0500, 0x0500, 0x0558, 0x05E0, 0x06C0, 0x06C0, /* horiz timings */ + 0x0400, 0x0400, 0x0407, 0x040A, 0x0431, 0x0431, /* vertical timings */ + 0, 0, 0, 0, 0, 0, /* No even timings */ + (133L << 16) | ((5000L * 65536L) / 10000L), /* freq = 133.50 MHz */ + } + , + + {VG_SUPPORTFLAG_75HZ | /* refresh rate = 75 */ + VG_SUPPORTFLAG_8BPP | VG_SUPPORTFLAG_12BPP | VG_SUPPORTFLAG_15BPP + | VG_SUPPORTFLAG_16BPP | VG_SUPPORTFLAG_24BPP | + VG_SUPPORTFLAG_32BPP, + VG_MODEFLAG_AVG_BAND | /* Avg bandwidth mode. */ + 0, + 1280, 1024, /* No scaling. */ + 0, 0, /* No mode dimensions. */ + 0, 0, /* No panel dimensions. */ + 0, 0, 0, 0, 0, /* No panel registers */ + 0x0500, 0x0500, 0x0510, 0x05A0, 0x0698, 0x0698, /* horiz timings */ + 0x0400, 0x0400, 0x0401, 0x0404, 0x042A, 0x042A, /* vertical timings */ + 0, 0, 0, 0, 0, 0, /* No even timings */ + (135L << 16) | ((0000L * 65536L) / 10000L), /* freq = 135.0 MHz */ + } + , + + {VG_SUPPORTFLAG_85HZ | /* refresh rate = 85 */ + VG_SUPPORTFLAG_8BPP | VG_SUPPORTFLAG_12BPP | VG_SUPPORTFLAG_15BPP + | VG_SUPPORTFLAG_16BPP | VG_SUPPORTFLAG_24BPP | + VG_SUPPORTFLAG_32BPP, + VG_MODEFLAG_AVG_BAND | /* Avg bandwidth mode. */ + 0, + 1280, 1024, /* No scaling. */ + 0, 0, /* No mode dimensions. */ + 0, 0, /* No panel dimensions. */ + 0, 0, 0, 0, 0, /* No panel registers */ + 0x0500, 0x0500, 0x0540, 0x05E0, 0x06C0, 0x06C0, /* horiz timings */ + 0x0400, 0x0400, 0x0401, 0x0404, 0x0430, 0x0430, /* vertical timings */ + 0, 0, 0, 0, 0, 0, /* No even timings */ + (157L << 16) | ((5000L * 65536L) / 10000L), /* freq = 157.5 MHz */ + } + , + + {VG_SUPPORTFLAG_90HZ | /* refresh rate = 90 */ + VG_SUPPORTFLAG_8BPP | VG_SUPPORTFLAG_12BPP | VG_SUPPORTFLAG_15BPP + | VG_SUPPORTFLAG_16BPP | VG_SUPPORTFLAG_24BPP | + VG_SUPPORTFLAG_32BPP, + VG_MODEFLAG_AVG_BAND | /* Avg bandwidth mode. */ + 0, + 1280, 1024, /* No scaling. */ + 0, 0, /* No mode dimensions. */ + 0, 0, /* No panel dimensions. */ + 0, 0, 0, 0, 0, /* No panel registers */ + 0x0500, 0x0500, 0x0560, 0x05F0, 0x06E0, 0x06E0, /* horiz timings */ + 0x0400, 0x0400, 0x040C, 0x040F, 0x0442, 0x0442, /* vertical timings */ + 0, 0, 0, 0, 0, 0, /* No even timings */ + (172L << 16) | ((8000L * 65536L) / 10000L), /* freq = 172.80 MHz */ + } + , + + {VG_SUPPORTFLAG_100HZ | /* refresh rate = 100 */ + VG_SUPPORTFLAG_8BPP | VG_SUPPORTFLAG_12BPP | VG_SUPPORTFLAG_15BPP + | VG_SUPPORTFLAG_16BPP | VG_SUPPORTFLAG_24BPP | + VG_SUPPORTFLAG_32BPP, + VG_MODEFLAG_AVG_BAND | /* Avg bandwidth mode. */ + 0, + 1280, 1024, /* No scaling. */ + 0, 0, /* No mode dimensions. */ + 0, 0, /* No panel dimensions. */ + 0, 0, 0, 0, 0, /* No panel registers */ + 0x0500, 0x0500, 0x0560, 0x05F0, 0x06E0, 0x06E0, /* horiz timings */ + 0x0400, 0x0400, 0x0406, 0x0409, 0x0442, 0x0442, /* vertical timings */ + 0, 0, 0, 0, 0, 0, /* No even timings */ + (192L << 16) | ((0000L * 65536L) / 10000L), /* freq = 192.00 MHz */ + } + , + + /* 1280x1024 PANEL */ + + {VG_SUPPORTFLAG_60HZ | /* refresh rate = 60 */ + VG_SUPPORTFLAG_8BPP | VG_SUPPORTFLAG_12BPP | VG_SUPPORTFLAG_15BPP | VG_SUPPORTFLAG_16BPP | VG_SUPPORTFLAG_24BPP | VG_SUPPORTFLAG_32BPP | VG_SUPPORTFLAG_PANEL, /* Panel Mode. */ + VG_MODEFLAG_AVG_BAND | /* Avg bandwidth mode. */ + VG_MODEFLAG_PANELOUT | /* Panel output. */ + VG_MODEFLAG_NEG_HSYNC | VG_MODEFLAG_NEG_VSYNC, /* negative syncs */ + 1280, 1024, /* No scaling. */ + 1280, 1024, /* 1280x1024 active. */ + 1280, 1024, /* 1280x1024 panel */ + 0, 0, 0, 0, 0, /* No panel registers */ + 0x0500, 0x0500, 0x0530, 0x05A0, 0x0698, 0x0698, /* horiz timings */ + 0x0400, 0x0400, 0x0401, 0x0404, 0x042A, 0x042A, /* vertical timings */ + 0, 0, 0, 0, 0, 0, /* No even timings */ + (108L << 16) | ((0000L * 65536L) / 10000L), /* freq = 108.00 MHz */ + } + , + + /* 1600 x 1200 */ + + {VG_SUPPORTFLAG_60HZ | /* refresh rate = 60 */ + VG_SUPPORTFLAG_8BPP | VG_SUPPORTFLAG_12BPP | VG_SUPPORTFLAG_15BPP + | VG_SUPPORTFLAG_16BPP | VG_SUPPORTFLAG_24BPP | + VG_SUPPORTFLAG_32BPP, + VG_MODEFLAG_HIGH_BAND | /* High bandwidth mode. */ + 0, + 1600, 1200, /* No scaling. */ + 0, 0, /* No mode dimensions. */ + 0, 0, /* No panel dimensions. */ + 0, 0, 0, 0, 0, /* No panel registers */ + 0x0640, 0x0640, 0x0680, 0x0740, 0x0870, 0x0870, /* horiz timings */ + 0x04B0, 0x04B0, 0x04B1, 0x04B4, 0x04E2, 0x04E2, /* vertical timings */ + 0, 0, 0, 0, 0, 0, /* No even timings */ + (162L << 16) | ((0000L * 65536L) / 10000L), /* freq = 162.0 MHz */ + } + , + + {VG_SUPPORTFLAG_70HZ | /* refresh rate = 70 */ + VG_SUPPORTFLAG_8BPP | VG_SUPPORTFLAG_12BPP | VG_SUPPORTFLAG_15BPP + | VG_SUPPORTFLAG_16BPP | VG_SUPPORTFLAG_24BPP | + VG_SUPPORTFLAG_32BPP, + VG_MODEFLAG_HIGH_BAND | /* High bandwidth mode. */ + 0, + 1600, 1200, /* No scaling. */ + 0, 0, /* No mode dimensions. */ + 0, 0, /* No panel dimensions. */ + 0, 0, 0, 0, 0, /* No panel registers */ + 0x0640, 0x0640, 0x0680, 0x0740, 0x0870, 0x0870, /* horiz timings */ + 0x04B0, 0x04B0, 0x04B1, 0x04B4, 0x04E2, 0x04E2, /* vertical timings */ + 0, 0, 0, 0, 0, 0, /* No even timings */ + (189L << 16) | ((0000L * 65536L) / 10000L), /* freq = 189.0 MHz */ + } + , + + {VG_SUPPORTFLAG_72HZ | /* refresh rate = 72 */ + VG_SUPPORTFLAG_8BPP | VG_SUPPORTFLAG_12BPP | VG_SUPPORTFLAG_15BPP + | VG_SUPPORTFLAG_16BPP | VG_SUPPORTFLAG_24BPP | + VG_SUPPORTFLAG_32BPP, + VG_MODEFLAG_HIGH_BAND | /* High bandwidth mode. */ + 0, + 1600, 1200, /* No scaling. */ + 0, 0, /* No mode dimensions. */ + 0, 0, /* No panel dimensions. */ + 0, 0, 0, 0, 0, /* No panel registers */ + 0x0640, 0x0640, 0x06B0, 0x0760, 0x0880, 0x0880, /* horiz timings */ + 0x04B0, 0x04B0, 0x04BD, 0x04C0, 0x04EF, 0x04EF, /* vertical timings */ + 0, 0, 0, 0, 0, 0, /* No even timings */ + (198L << 16) | ((0000L * 65536L) / 10000L), /* freq = 198.0 MHz */ + } + , + + {VG_SUPPORTFLAG_75HZ | /* refresh rate = 75 */ + VG_SUPPORTFLAG_8BPP | VG_SUPPORTFLAG_12BPP | VG_SUPPORTFLAG_15BPP + | VG_SUPPORTFLAG_16BPP | VG_SUPPORTFLAG_24BPP | + VG_SUPPORTFLAG_32BPP, + VG_MODEFLAG_HIGH_BAND | /* High bandwidth mode. */ + 0, + 1600, 1200, /* No scaling. */ + 0, 0, /* No mode dimensions. */ + 0, 0, /* No panel dimensions. */ + 0, 0, 0, 0, 0, /* No panel registers */ + 0x0640, 0x0640, 0x0680, 0x0740, 0x0870, 0x0870, /* horiz timings */ + 0x04B0, 0x04B0, 0x04B1, 0x04B4, 0x04E2, 0x04E2, /* vertical timings */ + 0, 0, 0, 0, 0, 0, /* No even timings */ + (202L << 16) | ((5000L * 65536L) / 10000L), /* freq = 202.5 MHz */ + } + , + + {VG_SUPPORTFLAG_85HZ | /* refresh rate = 85 */ + VG_SUPPORTFLAG_8BPP | VG_SUPPORTFLAG_12BPP | VG_SUPPORTFLAG_15BPP + | VG_SUPPORTFLAG_16BPP | VG_SUPPORTFLAG_24BPP | + VG_SUPPORTFLAG_32BPP, + VG_MODEFLAG_HIGH_BAND | /* High bandwidth mode. */ + 0, + 1600, 1200, /* No scaling. */ + 0, 0, /* No mode dimensions. */ + 0, 0, /* No panel dimensions. */ + 0, 0, 0, 0, 0, /* No panel registers */ + 0x0640, 0x0640, 0x0680, 0x0740, 0x0870, 0x0870, /* horiz timings */ + 0x04B0, 0x04B0, 0x04B1, 0x04B4, 0x04E2, 0x04E2, /* vertical timings */ + 0, 0, 0, 0, 0, 0, /* No even timings */ + (229L << 16) | ((5000L * 65536L) / 10000L), /* freq = 229.5 MHz */ + } + , + + {VG_SUPPORTFLAG_90HZ | /* refresh rate = 90 */ + VG_SUPPORTFLAG_8BPP | VG_SUPPORTFLAG_12BPP | VG_SUPPORTFLAG_15BPP + | VG_SUPPORTFLAG_16BPP | VG_SUPPORTFLAG_24BPP | + VG_SUPPORTFLAG_32BPP, + VG_MODEFLAG_HIGH_BAND | /* High bandwidth mode. */ + 0, + 1600, 1200, /* No scaling. */ + 0, 0, /* No mode dimensions. */ + 0, 0, /* No panel dimensions. */ + 0, 0, 0, 0, 0, /* No panel registers */ + 0x0640, 0x0640, 0x06C0, 0x0770, 0x08A0, 0x08A0, /* horiz timings */ + 0x04B0, 0x04B0, 0x04B1, 0x04B4, 0x04F0, 0x04F0, /* vertical timings */ + 0, 0, 0, 0, 0, 0, /* No even timings */ + (251L << 16) | ((1820L * 65536L) / 10000L), /* freq = 251.182 MHz */ + } + , + + {VG_SUPPORTFLAG_100HZ | /* refresh rate = 100 */ + VG_SUPPORTFLAG_8BPP | VG_SUPPORTFLAG_12BPP | VG_SUPPORTFLAG_15BPP + | VG_SUPPORTFLAG_16BPP | VG_SUPPORTFLAG_24BPP | + VG_SUPPORTFLAG_32BPP, + VG_MODEFLAG_HIGH_BAND | /* High bandwidth mode. */ + 0, + 1600, 1200, /* No scaling. */ + 0, 0, /* No mode dimensions. */ + 0, 0, /* No panel dimensions. */ + 0, 0, 0, 0, 0, /* No panel registers */ + 0x0640, 0x0640, 0x06C0, 0x0770, 0x08A0, 0x08A0, /* horiz timings */ + 0x04B0, 0x04B0, 0x04B1, 0x04B4, 0x04F7, 0x04F7, /* vertical timings */ + 0, 0, 0, 0, 0, 0, /* No even timings */ + (280L << 16) | ((6400L * 65536L) / 10000L), /* freq = 280.64 MHz */ + } + , + + /* 1600 x 1200 PANEL */ + + {VG_SUPPORTFLAG_60HZ | /* refresh rate = 60 */ + VG_SUPPORTFLAG_8BPP | VG_SUPPORTFLAG_12BPP | VG_SUPPORTFLAG_15BPP | VG_SUPPORTFLAG_16BPP | VG_SUPPORTFLAG_24BPP | VG_SUPPORTFLAG_32BPP | VG_SUPPORTFLAG_PANEL, /* Panel Mode. */ + VG_MODEFLAG_HIGH_BAND | /* High bandwidth mode. */ + VG_MODEFLAG_PANELOUT | /* Panel output. */ + VG_MODEFLAG_NEG_HSYNC | VG_MODEFLAG_NEG_VSYNC, /* negative syncs */ + 1600, 1200, /* No scaling. */ + 1600, 1200, /* 1600x1200 Active. */ + 1600, 1200, /* 1600x1200 Panel. */ + 0, 0, 0, 0, 0, /* No panel registers */ + 0x0640, 0x0640, 0x0680, 0x0740, 0x0870, 0x0870, /* horiz timings */ + 0x04B0, 0x04B0, 0x04B1, 0x04B4, 0x04E2, 0x04E2, /* vertical timings */ + 0, 0, 0, 0, 0, 0, /* No even timings */ + (162L << 16) | ((0000L * 65536L) / 10000L), /* freq = 162.0 MHz */ + } + , + + /* 1920x1440 */ + + {VG_SUPPORTFLAG_60HZ | /* refresh rate = 60 */ + VG_SUPPORTFLAG_8BPP | VG_SUPPORTFLAG_12BPP | VG_SUPPORTFLAG_15BPP + | VG_SUPPORTFLAG_16BPP | VG_SUPPORTFLAG_24BPP | + VG_SUPPORTFLAG_32BPP, + VG_MODEFLAG_HIGH_BAND | /* High bandwidth mode. */ + 0, + 1920, 1440, /* No scaling. */ + 0, 0, /* No mode dimensions. */ + 0, 0, /* No panel dimensions. */ + 0, 0, 0, 0, 0, /* No panel registers */ + 0x0780, 0x0780, 0x0800, 0x08D0, 0x0A28, 0x0A28, /* horiz timings */ + 0x05A0, 0x05A0, 0x05A1, 0x05A4, 0x05DC, 0x05DC, /* vertical timings */ + 0, 0, 0, 0, 0, 0, /* No even timings */ + (234L << 16) | ((0000L * 65536L) / 10000L), /* freq = 234.0 MHz */ + } + , + + {VG_SUPPORTFLAG_70HZ | /* refresh rate = 70 */ + VG_SUPPORTFLAG_8BPP | VG_SUPPORTFLAG_12BPP | VG_SUPPORTFLAG_15BPP + | VG_SUPPORTFLAG_16BPP | VG_SUPPORTFLAG_24BPP | + VG_SUPPORTFLAG_32BPP, + VG_MODEFLAG_HIGH_BAND | /* High bandwidth mode. */ + 0, + 1920, 1440, /* No scaling. */ + 0, 0, /* No mode dimensions. */ + 0, 0, /* No panel dimensions. */ + 0, 0, 0, 0, 0, /* No panel registers */ + 0x0780, 0x0780, 0x0818, 0x08E8, 0x0A50, 0x0A50, /* horiz timings */ + 0x05A0, 0x05A0, 0x05A8, 0x05AB, 0x05E2, 0x05E2, /* vertical timings */ + 0, 0, 0, 0, 0, 0, /* No even timings */ + (278L << 16) | ((4000L * 65536L) / 10000L), /* freq = 278.4 MHz */ + } + , + + {VG_SUPPORTFLAG_72HZ | /* refresh rate = 70 */ + VG_SUPPORTFLAG_8BPP | VG_SUPPORTFLAG_12BPP | VG_SUPPORTFLAG_15BPP + | VG_SUPPORTFLAG_16BPP | VG_SUPPORTFLAG_24BPP | + VG_SUPPORTFLAG_32BPP, + VG_MODEFLAG_HIGH_BAND | /* High bandwidth mode. */ + 0, + 1920, 1440, /* No scaling. */ + 0, 0, /* No mode dimensions. */ + 0, 0, /* No panel dimensions. */ + 0, 0, 0, 0, 0, /* No panel registers */ + 0x0780, 0x0780, 0x0818, 0x08E8, 0x0A50, 0x0A50, /* horiz timings */ + 0x05A0, 0x05A0, 0x05A4, 0x05A7, 0x05EB, 0x05EB, /* vertical timings */ + 0, 0, 0, 0, 0, 0, /* No even timings */ + (288L << 16) | ((0000L * 65536L) / 10000L), /* freq = 288.0 MHz */ + } + , + + {VG_SUPPORTFLAG_75HZ | /* refresh rate = 75 */ + VG_SUPPORTFLAG_8BPP | VG_SUPPORTFLAG_12BPP | VG_SUPPORTFLAG_15BPP + | VG_SUPPORTFLAG_16BPP | VG_SUPPORTFLAG_24BPP | + VG_SUPPORTFLAG_32BPP, + VG_MODEFLAG_HIGH_BAND | /* High bandwidth mode. */ + 0, + 1920, 1440, /* No scaling. */ + 0, 0, /* No mode dimensions. */ + 0, 0, /* No panel dimensions. */ + 0, 0, 0, 0, 0, /* No panel registers */ + 0x0780, 0x0780, 0x0810, 0x08F0, 0x0A50, 0x0A50, /* horiz timings */ + 0x05A0, 0x05A0, 0x05A1, 0x05A4, 0x05DC, 0x05DC, /* vertical timings */ + 0, 0, 0, 0, 0, 0, /* No even timings */ + (297L << 16) | ((0000L * 65536L) / 10000L), /* freq = 297.0 MHz */ + } + , + + {VG_SUPPORTFLAG_85HZ | /* refresh rate = 85 */ + VG_SUPPORTFLAG_8BPP | VG_SUPPORTFLAG_12BPP | VG_SUPPORTFLAG_15BPP + | VG_SUPPORTFLAG_16BPP | VG_SUPPORTFLAG_24BPP | + VG_SUPPORTFLAG_32BPP, + VG_MODEFLAG_HIGH_BAND | /* High bandwidth mode. */ + 0, + 1920, 1440, /* No scaling. */ + 0, 0, /* No mode dimensions. */ + 0, 0, /* No panel dimensions. */ + 0, 0, 0, 0, 0, /* No panel registers */ + 0x0780, 0x0780, 0x0818, 0x08F0, 0x0A60, 0x0A60, /* horiz timings */ + 0x05A0, 0x05A0, 0x05A1, 0x05A4, 0x05E8, 0x05E8, /* vertical timings */ + 0, 0, 0, 0, 0, 0, /* No even timings */ + (341L << 16) | ((3490L * 65536L) / 10000L), /* freq = 341.35 MHz */ + } + , + +/*-------------------------------*/ +/* PREDEFINED TV TIMINGS */ +/*-------------------------------*/ + + /* 720 x 480i NTSC */ + + {VG_SUPPORTFLAG_60HZ | /* refresh rate = 60 */ + VG_SUPPORTFLAG_8BPP | VG_SUPPORTFLAG_12BPP | VG_SUPPORTFLAG_15BPP | VG_SUPPORTFLAG_16BPP | VG_SUPPORTFLAG_24BPP | VG_SUPPORTFLAG_32BPP | VG_SUPPORTFLAG_NTSC | /* NTSC Mode. */ + VG_SUPPORTFLAG_ADV7171 | VG_SUPPORTFLAG_SAA7127 | + VG_SUPPORTFLAG_ADV7300 | VG_SUPPORTFLAG_TVOUT, + VG_MODEFLAG_LOW_BAND | /* Low bandwidth mode. */ + VG_MODEFLAG_INTERLACED | VG_MODEFLAG_TVOUT | /* Interlaced TV output */ + VG_MODEFLAG_HALFCLOCK | /* DotPLL = 1/2 VOP */ + VG_MODEFLAG_INT_FLICKER, /* Flicker Filter Out */ + 720, 480, /* No downscaling. */ + 0, 0, /* No mode dimensions. */ + 0, 0, /* No panel dimensions. */ + 0, 0, 0, 0, 0, /* No panel registers */ + 0x02D0, 0x02D0, 0x02E1, 0x0320, 0x035A, 0x035A, /* horiz timings */ + 0x00F0, 0x00F0, 0x00F4, 0x00F8, 0x0107, 0x0107, /* vertical timings */ + 0x00F0, 0x00F0, 0x00F4, 0x00F8, 0x0106, 0x0106, /*Even field timings */ + (27L << 16) | ((0000L * 65536L) / 10000L), /* freq = 27.0 MHz */ + } + , + + {VG_SUPPORTFLAG_60HZ | /* refresh rate = 60 */ + VG_SUPPORTFLAG_8BPP | VG_SUPPORTFLAG_12BPP | VG_SUPPORTFLAG_15BPP | VG_SUPPORTFLAG_16BPP | VG_SUPPORTFLAG_24BPP | VG_SUPPORTFLAG_32BPP | VG_SUPPORTFLAG_NTSC | /* NTSC Mode. */ + VG_SUPPORTFLAG_FS454 | VG_SUPPORTFLAG_TVOUT, /* TV Mode. */ + VG_MODEFLAG_LOW_BAND | /* Low bandwidth mode. */ + VG_MODEFLAG_NEG_HSYNC | VG_MODEFLAG_NEG_VSYNC | /* negative syncs */ + VG_MODEFLAG_PANELOUT | VG_MODEFLAG_INVERT_SHFCLK, /* TFT Output. */ + 640, 480, /* No downscaling. */ + 640, 480, /* 640x480 active. */ + 640, 480, /* 640x480 panel. */ + 0, 0, 0, 0, 0, /* No panel registers */ + 0x0280, 0x0280, 0x0333, 0x0373, 0x03A8, 0x03A8, /* horiz timings */ + 0x01E0, 0x01E0, 0x01F5, 0x01F7, 0x020D, 0x020D, /* vertical timings */ + 0, 0, 0, 0, 0, 0, /* No even timings. */ + (25L << 16) | ((1750L * 65536L) / 10000L), /* freq = 25.175 MHz */ + } + , + + /* 800 x 600 NTSC */ + + {VG_SUPPORTFLAG_60HZ | /* refresh rate = 60 */ + VG_SUPPORTFLAG_8BPP | VG_SUPPORTFLAG_12BPP | VG_SUPPORTFLAG_15BPP | VG_SUPPORTFLAG_16BPP | VG_SUPPORTFLAG_24BPP | VG_SUPPORTFLAG_32BPP | VG_SUPPORTFLAG_8X6_NTSC | /* 800x600 NTSC. */ + VG_SUPPORTFLAG_FS454 | VG_SUPPORTFLAG_TVOUT, /* TV Mode. */ + VG_MODEFLAG_LOW_BAND | /* Low bandwidth mode. */ + VG_MODEFLAG_NEG_HSYNC | VG_MODEFLAG_NEG_VSYNC | /* negative syncs */ + VG_MODEFLAG_PANELOUT | VG_MODEFLAG_INVERT_SHFCLK, /* Panel output */ + 800, 600, /* No downscaling. */ + 800, 600, /* 800x600 active. */ + 800, 600, /* 800x600 active. */ + 0, 0, 0, 0, 0, /* No panel registers */ + 0x0320, 0x0320, 0x03A7, 0x03E7, 0x03F0, 0x03F0, /* horiz timings */ + 0x0258, 0x0258, 0x026A, 0x0272, 0x028A, 0x028A, /* vertical timings */ + 0, 0, 0, 0, 0, 0, /* No even timings. */ + (40L << 16) | ((0000L * 65536L) / 10000L), /* freq = 40.000 MHz */ + } + , + + /* 1024 x 768 NTSC */ + + {VG_SUPPORTFLAG_60HZ | /* refresh rate = 60 */ + VG_SUPPORTFLAG_8BPP | VG_SUPPORTFLAG_12BPP | VG_SUPPORTFLAG_15BPP | VG_SUPPORTFLAG_16BPP | VG_SUPPORTFLAG_24BPP | VG_SUPPORTFLAG_32BPP | VG_SUPPORTFLAG_10X7_NTSC | /* 1024x768 NTSC. */ + VG_SUPPORTFLAG_FS454 | VG_SUPPORTFLAG_TVOUT, /* TV Mode. */ + VG_MODEFLAG_AVG_BAND | /* Low bandwidth mode. */ + VG_MODEFLAG_NEG_HSYNC | VG_MODEFLAG_NEG_VSYNC | /* negative syncs */ + VG_MODEFLAG_PANELOUT | VG_MODEFLAG_INVERT_SHFCLK, /* Panel output */ + 1024, 768, /* No downscaling. */ + 1024, 768, /* 1024x768 active. */ + 1024, 768, /* 1024x768 active. */ + 0, 0, 0, 0, 0, /* No panel registers */ + 0x0400, 0x0400, 0x0490, 0x04D0, 0x04E0, 0x04E0, /* horiz timings */ + 0x0300, 0x0300, 0x031B, 0x031D, 0x0339, 0x0339, /* vertical timings */ + 0, 0, 0, 0, 0, 0, /* No even timings. */ + (65L << 16) | ((0000L * 65536L) / 10000L), /* freq = 65.00 MHz */ + } + , + + /* 720 x 576i PAL */ + + {VG_SUPPORTFLAG_8BPP | VG_SUPPORTFLAG_12BPP | VG_SUPPORTFLAG_15BPP | VG_SUPPORTFLAG_16BPP | VG_SUPPORTFLAG_24BPP | VG_SUPPORTFLAG_32BPP | VG_SUPPORTFLAG_PAL | /* PAL Mode. */ + VG_SUPPORTFLAG_ADV7171 | VG_SUPPORTFLAG_SAA7127 | VG_SUPPORTFLAG_ADV7300 | VG_SUPPORTFLAG_TVOUT, /* TV Mode. */ + VG_MODEFLAG_LOW_BAND | /* Low bandwidth mode. */ + VG_MODEFLAG_TVOUT | VG_MODEFLAG_INTERLACED | /* Interlaced TV out. */ + VG_MODEFLAG_HALFCLOCK | /* DotPLL = 1/2 VOP */ + VG_MODEFLAG_INT_FLICKER, /* Flicker Filter Out */ + 720, 576, /* No downscaling. */ + 0, 0, /* No mode dimensions. */ + 0, 0, /* No panel dimensions. */ + 0, 0, 0, 0, 0, /* No panel registers */ + 0x02D0, 0x02D0, 0x02E4, 0x0324, 0x0360, 0x0360, /* horiz timings */ + 0x0120, 0x0120, 0x0123, 0x0127, 0x0139, 0x0139, /* vertical timings */ + 0x0120, 0x0120, 0x0123, 0x0127, 0x0138, 0x0138, /* Even timings */ + (27L << 16) | ((0000L * 65536L) / 10000L), /* freq = 27.0 MHz */ + } + , + + {VG_SUPPORTFLAG_8BPP | VG_SUPPORTFLAG_12BPP | VG_SUPPORTFLAG_15BPP | VG_SUPPORTFLAG_16BPP | VG_SUPPORTFLAG_24BPP | VG_SUPPORTFLAG_32BPP | VG_SUPPORTFLAG_PAL | /* PAL Mode. */ + VG_SUPPORTFLAG_FS454 | VG_SUPPORTFLAG_TVOUT, /* TV Mode. */ + VG_MODEFLAG_LOW_BAND | /* Low bandwidth mode. */ + VG_MODEFLAG_NEG_HSYNC | VG_MODEFLAG_NEG_VSYNC | /* negative syncs */ + VG_MODEFLAG_PANELOUT | VG_MODEFLAG_INVERT_SHFCLK, /* Panel output */ + 640, 480, /* No downscaling. */ + 640, 480, /* No mode dimensions. */ + 640, 480, /* 640x480 active. */ + 0, 0, 0, 0, 0, /* 640x480 panel. */ + 0x0280, 0x0280, 0x030F, 0x034F, 0x0360, 0x0360, /* horiz timings */ + 0x01E0, 0x01E0, 0x01F5, 0x01F7, 0x020D, 0x020D, /* vertical timings */ + 0, 0, 0, 0, 0, 0, /* No even timings. */ + (25L << 16) | ((1750L * 65536L) / 10000L), /* freq = 25.175 MHz */ + } + , + + /* 800 x 600 PAL */ + + {VG_SUPPORTFLAG_60HZ | /* refresh rate = 60 */ + VG_SUPPORTFLAG_8BPP | VG_SUPPORTFLAG_12BPP | VG_SUPPORTFLAG_15BPP | VG_SUPPORTFLAG_16BPP | VG_SUPPORTFLAG_24BPP | VG_SUPPORTFLAG_32BPP | VG_SUPPORTFLAG_8X6_PAL | /* 800x600 PAL. */ + VG_SUPPORTFLAG_FS454 | VG_SUPPORTFLAG_TVOUT, /* TV Mode. */ + VG_MODEFLAG_LOW_BAND | /* Low bandwidth mode. */ + VG_MODEFLAG_NEG_HSYNC | VG_MODEFLAG_NEG_VSYNC | /* negative syncs */ + VG_MODEFLAG_PANELOUT | VG_MODEFLAG_INVERT_SHFCLK, /* Panel output */ + 800, 600, /* No downscaling. */ + 800, 600, /* 800x600 active. */ + 800, 600, /* 800x600 active. */ + 0, 0, 0, 0, 0, /* No panel registers */ + 0x0320, 0x0320, 0x03A7, 0x03E7, 0x03F0, 0x03F0, /* horiz timings */ + 0x0258, 0x0258, 0x0270, 0x0272, 0x028A, 0x028A, /* vertical timings */ + 0, 0, 0, 0, 0, 0, /* No even timings. */ + (40L << 16) | ((0000L * 65536L) / 10000L), /* freq = 40.000 MHz */ + } + , + + /* 1024 x 768 PAL */ + + {VG_SUPPORTFLAG_60HZ | /* refresh rate = 60 */ + VG_SUPPORTFLAG_8BPP | VG_SUPPORTFLAG_12BPP | VG_SUPPORTFLAG_15BPP | VG_SUPPORTFLAG_16BPP | VG_SUPPORTFLAG_24BPP | VG_SUPPORTFLAG_32BPP | VG_SUPPORTFLAG_10X7_PAL | /* 1024x768 NTSC. */ + VG_SUPPORTFLAG_FS454 | VG_SUPPORTFLAG_TVOUT, /* TV Mode. */ + VG_MODEFLAG_AVG_BAND | /* Low bandwidth mode. */ + VG_MODEFLAG_NEG_HSYNC | VG_MODEFLAG_NEG_VSYNC | /* negative syncs */ + VG_MODEFLAG_PANELOUT | VG_MODEFLAG_INVERT_SHFCLK, /* Panel output */ + 1024, 768, /* No downscaling. */ + 1024, 768, /* 1024x768 active. */ + 1024, 768, /* 1024x768 active. */ + 0, 0, 0, 0, 0, /* No panel registers */ + 0x0400, 0x0400, 0x0490, 0x04d0, 0x04e0, 0x04e0, /* horiz timings */ + 0x0300, 0x0300, 0x031b, 0x031d, 0x0339, 0x0339, /* vertical timings */ + 0, 0, 0, 0, 0, 0, /* No even timings. */ + (65L << 16) | ((0000L * 65536L) / 10000L), /* freq = 65.00 MHz */ + } + , + + /* 720 x 480p HDTV */ + + {VG_SUPPORTFLAG_60HZ | /* refresh rate = 60 */ + VG_SUPPORTFLAG_8BPP | VG_SUPPORTFLAG_12BPP | VG_SUPPORTFLAG_15BPP | VG_SUPPORTFLAG_16BPP | VG_SUPPORTFLAG_24BPP | VG_SUPPORTFLAG_32BPP | VG_SUPPORTFLAG_480P | /* 720x480P. */ + VG_SUPPORTFLAG_ADV7300 | VG_SUPPORTFLAG_TVOUT, /* TV Mode. */ + VG_MODEFLAG_LOW_BAND | /* Low bandwidth mode. */ + VG_MODEFLAG_TVOUT, /* Progressive TV out. */ + 720, 480, /* No scaling. */ + 0, 0, /* No mode dimensions. */ + 0, 0, /* No panel dimensions. */ + 0, 0, 0, 0, 0, /* No panel registers */ + 0x02D0, 0x02D0, 0x02E0, 0x0328, 0x035A, 0x035A, /* horiz timings */ + 0x01E0, 0x01E0, 0x01E1, 0x01E3, 0x020D, 0x020D, /* vertical timings */ + 0, 0, 0, 0, 0, 0, /* No even timings. */ + (27L << 16) | ((0000L * 65536L) / 10000L), /* freq = 27.0 MHz */ + } + , + + {VG_SUPPORTFLAG_60HZ | /* refresh rate = 60 */ + VG_SUPPORTFLAG_8BPP | VG_SUPPORTFLAG_12BPP | VG_SUPPORTFLAG_15BPP | VG_SUPPORTFLAG_16BPP | VG_SUPPORTFLAG_24BPP | VG_SUPPORTFLAG_32BPP | VG_SUPPORTFLAG_480P | /* 720x480P. */ + VG_SUPPORTFLAG_FS454 | VG_SUPPORTFLAG_TVOUT, /* TV Mode. */ + VG_MODEFLAG_LOW_BAND | /* Low bandwidth mode. */ + VG_MODEFLAG_PANELOUT | VG_MODEFLAG_INVERT_SHFCLK, /* Panel output */ + 720, 480, /* No scaling. */ + 720, 480, /* 720x480 active. */ + 720, 480, /* 720x480 panel. */ + 0, 0, 0, 0, 0, /* No panel registers */ + 0x02D0, 0x02D0, 0x02E3, 0x0323, 0x035A, 0x035A, /* horiz timings */ + 0x01E0, 0x01E0, 0x01E4, 0x01EA, 0x020D, 0x020D, /* vertical timings */ + 0, 0, 0, 0, 0, 0, /* No even timings. */ + (27L << 16) | ((0000L * 65536L) / 10000L), /* freq = 27.0 MHz */ + } + , + + /* 1280x720p HDTV */ + + {VG_SUPPORTFLAG_8BPP | VG_SUPPORTFLAG_12BPP | VG_SUPPORTFLAG_15BPP | VG_SUPPORTFLAG_16BPP | VG_SUPPORTFLAG_24BPP | VG_SUPPORTFLAG_32BPP | VG_SUPPORTFLAG_720P | /* 1280x720P */ + VG_SUPPORTFLAG_ADV7300 | VG_SUPPORTFLAG_TVOUT, /* TV Mode. */ + VG_MODEFLAG_AVG_BAND | /* Avg bandwidth mode. */ + VG_MODEFLAG_TVOUT, /* Progressive TV out */ + 1280, 720, /* No scaling. */ + 0, 0, /* No mode dimensions. */ + 0, 0, /* No panel dimensions. */ + 0, 0, 0, 0, 0, /* No panel registers */ + 0x0500, 0x0500, 0x0546, 0x0596, 0x0672, 0x0672, /* horiz timings */ + 0x02D0, 0x02D0, 0x02D3, 0x02D8, 0x02EE, 0x02EE, /* vertical timings */ + 0, 0, 0, 0, 0, 0, /* even timings */ + (74L << 16) | ((2500L * 65536L) / 10000L), /* freq = 74.25 MHz */ + } + , + + {VG_SUPPORTFLAG_8BPP | VG_SUPPORTFLAG_12BPP | VG_SUPPORTFLAG_15BPP | VG_SUPPORTFLAG_16BPP | VG_SUPPORTFLAG_24BPP | VG_SUPPORTFLAG_32BPP | VG_SUPPORTFLAG_720P | /* 1280x720P */ + VG_SUPPORTFLAG_FS454 | VG_SUPPORTFLAG_TVOUT, /* TV Mode. */ + VG_MODEFLAG_AVG_BAND | /* Avg bandwidth mode. */ + VG_MODEFLAG_PANELOUT | VG_MODEFLAG_INVERT_SHFCLK, /* Panel output */ + 1280, 720, /* No scaling. */ + 1280, 720, /* 1280x720 active. */ + 1280, 720, /* 1280x720 panel. */ + 0, 0, 0, 0, 0, /* No panel registers */ + 0x0500, 0x0500, 0x0547, 0x0597, 0x0672, 0x0672, /* horiz timings */ + 0x02D0, 0x02D0, 0x02D4, 0x02D9, 0x02EE, 0x02EE, /* vertical timings */ + 0, 0, 0, 0, 0, 0, /* No even timings. */ + (74L << 16) | ((2500L * 65536L) / 10000L), /* freq = 74.25 MHz */ + } + , + + /* 1920x1080i HDTV */ + + {VG_SUPPORTFLAG_60HZ | /* refresh rate = 60 */ + VG_SUPPORTFLAG_8BPP | VG_SUPPORTFLAG_12BPP | VG_SUPPORTFLAG_15BPP | VG_SUPPORTFLAG_16BPP | VG_SUPPORTFLAG_24BPP | VG_SUPPORTFLAG_32BPP | VG_SUPPORTFLAG_1080I | /* 1920x1080i Mode. */ + VG_SUPPORTFLAG_ADV7300 | VG_SUPPORTFLAG_FS454 | + VG_SUPPORTFLAG_TVOUT, + VG_MODEFLAG_HIGH_BAND | /* High bandwidth mode. */ + VG_MODEFLAG_INTERLACED | VG_MODEFLAG_TVOUT | /* Interlaced TV out */ + /* Interlaced addressing */ + VG_MODEFLAG_INT_ADDRESS | VG_MODEFLAG_INVERT_SHFCLK, + 1920, 1080, /* 2:1 downscaling. */ + 0, 0, /* No mode dimensions. */ + 0, 0, /* No panel dimensions. */ + 0, 0, 0, 0, 0, /* No panel registers */ + 0x0780, 0x0780, 0x07AD, 0x0805, 0x0898, 0x0898, /* horiz timings */ + 0x021C, 0x021C, 0x021E, 0x0226, 0x0233, 0x0233, /* vertical timings */ + 0x021C, 0x021C, 0x021E, 0x0226, 0x0232, 0x0232, /*even field timings */ + (74L << 16) | ((2500L * 65536L) / 10000L), /* freq = 74.25 MHz */ + } + , +}; + +#define NUM_CIMARRON_DISPLAY_MODES sizeof(CimarronDisplayModes) / \ + sizeof(VG_DISPLAY_MODE) + +/*-----------------------------------*/ +/* PREDEFINED PLL FREQUENCIES */ +/*-----------------------------------*/ + +static const PLL_FREQUENCY CimarronPLLFrequencies[] = { + {0x000031AC, (24L << 16) | ((9230L * 65536L) / 10000L)} + , /* 24.9230, - 4,27,13 */ + {0x0000215D, (25L << 16) | ((1750L * 65536L) / 10000L)} + , /* 25.1750, - 3,22,14 */ + {0x00001087, (27L << 16) | ((0000L * 65536L) / 10000L)} + , /* 27.0000, - 2, 9, 8 */ + {0x0000216C, (28L << 16) | ((3220L * 65536L) / 10000L)} + , /* 28.3220, - 3,23,13 */ + {0x0000218D, (28L << 16) | ((5600L * 65536L) / 10000L)} + , /* 28.5600, - 3,25,14 */ + {0x000010C9, (31L << 16) | ((2000L * 65536L) / 10000L)} + , /* 31.2000, - 2,13,10 */ + {0x00003147, (31L << 16) | ((5000L * 65536L) / 10000L)} + , /* 31.5000, - 4,21, 8 */ + {0x000010A7, (33L << 16) | ((320L * 65536L) / 10000L)} + , /* 33.0320, - 2,11, 8 */ + {0x00002159, (35L << 16) | ((1120L * 65536L) / 10000L)} + , /* 35.1120, - 3,22,10 */ + {0x00004249, (35L << 16) | ((5000L * 65536L) / 10000L)} + , /* 35.5000, - 5,37,10 */ + {0x00000057, (36L << 16) | ((0000L * 65536L) / 10000L)} + , /* 36.0000, - 1, 6, 8 */ + {0x0000219A, (37L << 16) | ((8890L * 65536L) / 10000L)} + , /* 37.8890, - 3,26,11 */ + {0x00002158, (39L << 16) | ((1680L * 65536L) / 10000L)} + , /* 39.1680, - 3,22, 9 */ + {0x00000045, (40L << 16) | ((0000L * 65536L) / 10000L)} + , /* 40.0000, - 1, 5, 6 */ + {0x00000089, (43L << 16) | ((1630L * 65536L) / 10000L)} + , /* 43.1630, - 1, 9,10 */ + {0x000010E7, (44L << 16) | ((9000L * 65536L) / 10000L)} + , /* 44.9000, - 2,15, 8 */ + {0x00002136, (45L << 16) | ((7200L * 65536L) / 10000L)} + , /* 45.7200, - 3,20, 7 */ + {0x00003207, (49L << 16) | ((5000L * 65536L) / 10000L)} + , /* 49.5000, - 4,33, 8 */ + {0x00002187, (50L << 16) | ((0000L * 65536L) / 10000L)} + , /* 50.0000, - 3,25, 8 */ + {0x00004286, (56L << 16) | ((2500L * 65536L) / 10000L)} + , /* 56.2500, - 5,41, 7 */ + {0x000010E5, (60L << 16) | ((650L * 65536L) / 10000L)} + , /* 60.0650, - 2,15, 6 */ + {0x00004214, (65L << 16) | ((0000L * 65536L) / 10000L)} + , /* 65.0000, - 5,34, 5 */ + {0x00001105, (68L << 16) | ((1790L * 65536L) / 10000L)} + , /* 68.1790, - 2,17, 6 */ + {0x000031E4, (74L << 16) | ((2500L * 65536L) / 10000L)} + , /* 74.2500, - 4,31, 5 */ + {0x00003183, (75L << 16) | ((0000L * 65536L) / 10000L)} + , /* 75.0000, - 4,25, 4 */ + {0x00004284, (78L << 16) | ((7500L * 65536L) / 10000L)} + , /* 78.7500, - 5,41, 5 */ + {0x00001104, (81L << 16) | ((6000L * 65536L) / 10000L)} + , /* 81.6000, - 2,17, 5 */ + {0x00006363, (94L << 16) | ((5000L * 65536L) / 10000L)} + , /* 94.5000, - 7,55, 4 */ + {0x00005303, (97L << 16) | ((5200L * 65536L) / 10000L)} + , /* 97.5200, - 6,49, 4 */ + {0x00002183, (100L << 16) | ((1870L * 65536L) / 10000L)} + , /* 100.187, - 3,25, 4 */ + {0x00002122, (101L << 16) | ((4200L * 65536L) / 10000L)} + , /* 101.420, - 3,19, 3 */ + {0x00001081, (108L << 16) | ((0000L * 65536L) / 10000L)} + , /* 108.00, - 2, 9, 2 */ + {0x00006201, (113L << 16) | ((3100L * 65536L) / 10000L)} + , /* 113.31, - 7,33, 2 */ + {0x00000041, (119L << 16) | ((6500L * 65536L) / 10000L)} + , /* 119.65, - 1, 5, 2 */ + {0x000041A1, (129L << 16) | ((6000L * 65536L) / 10000L)} + , /* 129.60, - 5,27, 2 */ + {0x00002182, (133L << 16) | ((5000L * 65536L) / 10000L)} + , /* 133.50, - 3,25, 3 */ + {0x000041B1, (135L << 16) | ((0000L * 65536L) / 10000L)} + , /* 135.00, - 5,28, 2 */ + {0x00000051, (144L << 16) | ((0000L * 65536L) / 10000L)} + , /* 144.00, - 1, 6, 2 */ + {0x000041E1, (148L << 16) | ((5000L * 65536L) / 10000L)} + , /* 148.50, - 5,31, 2 */ + {0x000062D1, (157L << 16) | ((5000L * 65536L) / 10000L)} + , /* 157.50, - 7,46, 2 */ + {0x000031A1, (162L << 16) | ((0000L * 65536L) / 10000L)} + , /* 162.00, - 4,27, 2 */ + {0x00000061, (169L << 16) | ((2030L * 65536L) / 10000L)} + , /* 169.203, - 1, 7, 2 */ + {0x00004231, (172L << 16) | ((8000L * 65536L) / 10000L)} + , /* 172.800, - 5,36, 2 */ + {0x00002151, (175L << 16) | ((5000L * 65536L) / 10000L)} + , /* 175.50, - 3,22, 2 */ + {0x000052E1, (189L << 16) | ((0000L * 65536L) / 10000L)} + , /* 189.00, - 6,47, 2 */ + {0x00000071, (192L << 16) | ((0000L * 65536L) / 10000L)} + , /* 192.00, - 1, 8, 2 */ + {0x00003201, (198L << 16) | ((0000L * 65536L) / 10000L)} + , /* 198.00, - 4,33, 2 */ + {0x00004291, (202L << 16) | ((5000L * 65536L) / 10000L)} + , /* 202.50, - 5,42, 2 */ + {0x00001101, (204L << 16) | ((7500L * 65536L) / 10000L)} + , /* 204.75, - 2,17, 2 */ + {0x00007481, (218L << 16) | ((2500L * 65536L) / 10000L)} + , /* 218.25, - 8,73, 2 */ + {0x00004170, (229L << 16) | ((5000L * 65536L) / 10000L)} + , /* 229.50, - 5,24, 1 */ + {0x00006210, (234L << 16) | ((0000L * 65536L) / 10000L)} + , /* 234.00, - 7,34, 1 */ + {0x00003140, (251L << 16) | ((1820L * 65536L) / 10000L)} + , /* 251.182, - 4,21, 1 */ + {0x00006250, (261L << 16) | ((0000L * 65536L) / 10000L)} + , /* 261.00, - 7,38, 1 */ + {0x000041C0, (278L << 16) | ((4000L * 65536L) / 10000L)} + , /* 278.40, - 5,29, 1 */ + {0x00005220, (280L << 16) | ((6400L * 65536L) / 10000L)} + , /* 280.64, - 6,35, 1 */ + {0x00000050, (288L << 16) | ((0000L * 65536L) / 10000L)} + , /* 288.00, - 1, 6, 1 */ + {0x000041E0, (297L << 16) | ((0000L * 65536L) / 10000L)} + , /* 297.00, - 5,31, 1 */ + {0x00002130, (320L << 16) | ((2070L * 65536L) / 10000L)} + , /* 320.207, - 3,20, 1 */ + {0x00006310, (341L << 16) | ((3490L * 65536L) / 10000L)} + /* 341.349, - 7,50, 1 */ +}; + +#define NUM_CIMARRON_PLL_FREQUENCIES sizeof(CimarronPLLFrequencies) / \ + sizeof(PLL_FREQUENCY) + +/*-----------------------------------*/ +/* PREDEFINED FILTER COEFFICIENTS */ +/*-----------------------------------*/ + +static const unsigned long CimarronHorizontalGraphicsFilter[][2] = { + {0x1284A7D5, 0x000017D5}, /* -43, 297, 296, -43, 5 */ + {0x12A497D7, 0x000013D6}, /* -41, 293, 298, -42, 4 */ + {0x12D48BD7, 0x000013D6}, /* -41, 290, 301, -42, 4 */ + {0x13147FD7, 0x000013D5}, /* -41, 287, 305, -43, 4 */ + {0x133473D8, 0x000013D5}, /* -40, 284, 307, -43, 4 */ + {0x136467D8, 0x000013D5}, /* -40, 281, 310, -43, 4 */ + {0x13945FD8, 0x000013D4}, /* -40, 279, 313, -44, 4 */ + {0x13B453D9, 0x000013D4}, /* -39, 276, 315, -44, 4 */ + {0x13E447D9, 0x000013D4}, /* -39, 273, 318, -44, 4 */ + {0x14143BDA, 0x000013D3}, /* -38, 270, 321, -45, 4 */ + {0x143433DA, 0x000013D3}, /* -38, 268, 323, -45, 4 */ + {0x146427DA, 0x000013D3}, /* -38, 265, 326, -45, 4 */ + {0x14941BDB, 0x000013D2}, /* -37, 262, 329, -46, 4 */ + {0x14C40FDB, 0x000013D2}, /* -37, 259, 332, -46, 4 */ + {0x14F407DA, 0x000017D1}, /* -38, 257, 335, -47, 5 */ + {0x1503FBDC, 0x000013D2}, /* -36, 254, 336, -46, 4 */ + {0x1543F3DB, 0x000017D0}, /* -37, 252, 340, -48, 5 */ + {0x1563E3DD, 0x000013D1}, /* -35, 248, 342, -47, 4 */ + {0x1593D7DD, 0x000013D1}, /* -35, 245, 345, -47, 4 */ + {0x15B3CFDD, 0x000013D1}, /* -35, 243, 347, -47, 4 */ + {0x15E3C3DE, 0x000013D0}, /* -34, 240, 350, -48, 4 */ + {0x1613B7DE, 0x000013D0}, /* -34, 237, 353, -48, 4 */ + {0x1633ABDF, 0x000013D0}, /* -33, 234, 355, -48, 4 */ + {0x16639FDF, 0x000013D0}, /* -33, 231, 358, -48, 4 */ + {0x167397E0, 0x000013D0}, /* -32, 229, 359, -48, 4 */ + {0x16B38BE0, 0x000013CF}, /* -32, 226, 363, -49, 4 */ + {0x16E383DF, 0x000017CE}, /* -33, 224, 366, -50, 5 */ + {0x170373E1, 0x000013CF}, /* -31, 220, 368, -49, 4 */ + {0x17236BE1, 0x000013CF}, /* -31, 218, 370, -49, 4 */ + {0x17435FE2, 0x000013CF}, /* -30, 215, 372, -49, 4 */ + {0x177353E2, 0x000013CF}, /* -30, 212, 375, -49, 4 */ + {0x17B34BE1, 0x000017CD}, /* -31, 210, 379, -51, 5 */ + {0x17C33FE3, 0x000013CE}, /* -29, 207, 380, -50, 4 */ + {0x17F333E3, 0x000013CE}, /* -29, 204, 383, -50, 4 */ + {0x181327E4, 0x000013CE}, /* -28, 201, 385, -50, 4 */ + {0x18431FE3, 0x000017CD}, /* -29, 199, 388, -51, 5 */ + {0x186313E4, 0x000013CE}, /* -28, 196, 390, -50, 4 */ + {0x188307E5, 0x000013CE}, /* -27, 193, 392, -50, 4 */ + {0x18B2FBE5, 0x000013CE}, /* -27, 190, 395, -50, 4 */ + {0x18C2F3E6, 0x000013CE}, /* -26, 188, 396, -50, 4 */ + {0x18F2E7E6, 0x000013CE}, /* -26, 185, 399, -50, 4 */ + {0x1912DBE7, 0x000013CE}, /* -25, 182, 401, -50, 4 */ + {0x1952D3E6, 0x000017CC}, /* -26, 180, 405, -52, 5 */ + {0x1972CBE6, 0x000017CC}, /* -26, 178, 407, -52, 5 */ + {0x1992BFE7, 0x000017CC}, /* -25, 175, 409, -52, 5 */ + {0x19C2B3E7, 0x000017CC}, /* -25, 172, 412, -52, 5 */ + {0x19D2A7E9, 0x000013CD}, /* -23, 169, 413, -51, 4 */ + {0x1A029FE8, 0x000017CC}, /* -24, 167, 416, -52, 5 */ + {0x1A1293E9, 0x000013CE}, /* -23, 164, 417, -50, 4 */ + {0x1A3287EA, 0x000013CE}, /* -22, 161, 419, -50, 4 */ + {0x1A627FE9, 0x000017CD}, /* -23, 159, 422, -51, 5 */ + {0x1A7273EB, 0x000013CE}, /* -21, 156, 423, -50, 4 */ + {0x1AA267EB, 0x000013CE}, /* -21, 153, 426, -50, 4 */ + {0x1AC25FEB, 0x000013CE}, /* -21, 151, 428, -50, 4 */ + {0x1AE253EC, 0x000013CE}, /* -20, 148, 430, -50, 4 */ + {0x1B124BEB, 0x000017CD}, /* -21, 146, 433, -51, 5 */ + {0x1B223FED, 0x000013CE}, /* -19, 143, 434, -50, 4 */ + {0x1B5237EC, 0x000017CD}, /* -20, 141, 437, -51, 5 */ + {0x1B622BED, 0x000013CF}, /* -19, 138, 438, -49, 4 */ + {0x1B821FEE, 0x000013CF}, /* -18, 135, 440, -49, 4 */ + {0x1BA217EE, 0x000013CF}, /* -18, 133, 442, -49, 4 */ + {0x1BC20BEF, 0x000013CF}, /* -17, 130, 444, -49, 4 */ + {0x1BE203EF, 0x000013CF}, /* -17, 128, 446, -49, 4 */ + {0x1C01FBEE, 0x000017CF}, /* -18, 126, 448, -49, 5 */ + {0x1C11EFF0, 0x000013D0}, /* -16, 123, 449, -48, 4 */ + {0x1C41E7EF, 0x000017CF}, /* -17, 121, 452, -49, 5 */ + {0x1C61DFEF, 0x000017CF}, /* -17, 119, 454, -49, 5 */ + {0x1C61D3F1, 0x000013D1}, /* -15, 116, 454, -47, 4 */ + {0x1C91CBF0, 0x000017D0}, /* -16, 114, 457, -48, 5 */ + {0x1CA1BFF2, 0x000013D1}, /* -14, 111, 458, -47, 4 */ + {0x1CC1B3F2, 0x000013D2}, /* -14, 108, 460, -46, 4 */ + {0x1CE1AFF1, 0x000017D1}, /* -15, 107, 462, -47, 5 */ + {0x1CF1A3F3, 0x000013D2}, /* -13, 104, 463, -46, 4 */ + {0x1D1197F3, 0x000013D3}, /* -13, 101, 465, -45, 4 */ + {0x1D3197F2, 0x000013D2}, /* -14, 101, 467, -46, 4 */ + {0x1D518BF3, 0x000013D2}, /* -13, 98, 469, -46, 4 */ + {0x1D6183F3, 0x000013D3}, /* -13, 96, 470, -45, 4 */ + {0x1D817BF3, 0x000013D3}, /* -13, 94, 472, -45, 4 */ + {0x1D916FF4, 0x000013D4}, /* -12, 91, 473, -44, 4 */ + {0x1DB167F4, 0x000013D4}, /* -12, 89, 475, -44, 4 */ + {0x1DC15FF4, 0x000013D5}, /* -12, 87, 476, -43, 4 */ + {0x1DE153F5, 0x000013D5}, /* -11, 84, 478, -43, 4 */ + {0x1DF14BF5, 0x000013D6}, /* -11, 82, 479, -42, 4 */ + {0x1E1143F5, 0x000013D6}, /* -11, 80, 481, -42, 4 */ + {0x1E1137F7, 0x00000FD8}, /* -9, 77, 481, -40, 3 */ + {0x1E3133F6, 0x000013D7}, /* -10, 76, 483, -41, 4 */ + {0x1E412BF6, 0x000013D8}, /* -10, 74, 484, -40, 4 */ + {0x1E611FF7, 0x000013D8}, /* -9, 71, 486, -40, 4 */ + {0x1E7117F7, 0x000013D9}, /* -9, 69, 487, -39, 4 */ + {0x1E810FF7, 0x000013DA}, /* -9, 67, 488, -38, 4 */ + {0x1E9107F8, 0x000013DA}, /* -8, 65, 489, -38, 4 */ + {0x1EA0FFF8, 0x000013DB}, /* -8, 63, 490, -37, 4 */ + {0x1EB0F3F9, 0x00000FDD}, /* -7, 60, 491, -35, 3 */ + {0x1ED0EFF8, 0x000013DC}, /* -8, 59, 493, -36, 4 */ + {0x1EE0E7F9, 0x00000FDD}, /* -7, 57, 494, -35, 3 */ + {0x1EF0DFF9, 0x00000FDE}, /* -7, 55, 495, -34, 3 */ + {0x1F00D7F9, 0x00000FDF}, /* -7, 53, 496, -33, 3 */ + {0x1F10CFFA, 0x00000FDF}, /* -6, 51, 497, -33, 3 */ + {0x1F20C7FA, 0x00000FE0}, /* -6, 49, 498, -32, 3 */ + {0x1F20C3FA, 0x00000FE1}, /* -6, 48, 498, -31, 3 */ + {0x1F30BBFA, 0x00000FE2}, /* -6, 46, 499, -30, 3 */ + {0x1F40AFFB, 0x00000FE3}, /* -5, 43, 500, -29, 3 */ + {0x1F50A7FB, 0x00000FE4}, /* -5, 41, 501, -28, 3 */ + {0x1F60A3FB, 0x00000FE4}, /* -5, 40, 502, -28, 3 */ + {0x1F709BFB, 0x00000FE5}, /* -5, 38, 503, -27, 3 */ + {0x1F7093FC, 0x00000FE6}, /* -4, 36, 503, -26, 3 */ + {0x1F808FFC, 0x00000BE7}, /* -4, 35, 504, -25, 2 */ + {0x1F9087FC, 0x00000BE8}, /* -4, 33, 505, -24, 2 */ + {0x1F9083FC, 0x00000BE9}, /* -4, 32, 505, -23, 2 */ + {0x1FA077FD, 0x00000BEA}, /* -3, 29, 506, -22, 2 */ + {0x1FA073FD, 0x00000BEB}, /* -3, 28, 506, -21, 2 */ + {0x1FB06BFD, 0x00000BEC}, /* -3, 26, 507, -20, 2 */ + {0x1FC063FD, 0x00000BED}, /* -3, 24, 508, -19, 2 */ + {0x1FC05BFE, 0x00000BEE}, /* -2, 22, 508, -18, 2 */ + {0x1FC057FE, 0x00000BEF}, /* -2, 21, 508, -17, 2 */ + {0x1FD053FE, 0x000007F0}, /* -2, 20, 509, -16, 1 */ + {0x1FD04BFE, 0x000007F2}, /* -2, 18, 509, -14, 1 */ + {0x1FE043FE, 0x000007F3}, /* -2, 16, 510, -13, 1 */ + {0x1FE03BFF, 0x000007F4}, /* -1, 14, 510, -12, 1 */ + {0x1FE037FF, 0x000007F5}, /* -1, 13, 510, -11, 1 */ + {0x1FE033FF, 0x000007F6}, /* -1, 12, 510, -10, 1 */ + {0x1FF02BFF, 0x000007F7}, /* -1, 10, 511, -9, 1 */ + {0x1FF027FF, 0x000003F9}, /* -1, 9, 511, -7, 0 */ + {0x1FF01C00, 0x000003FA}, /* 0, 7, 511, -6, 0 */ + {0x1FF01800, 0x000003FB}, /* 0, 6, 511, -5, 0 */ + {0x1FF01400, 0x000003FC}, /* 0, 5, 511, -4, 0 */ + {0x1FF00C00, 0x000003FE}, /* 0, 3, 511, -2, 0 */ + {0x1FF00800, 0x000003FF}, /* 0, 2, 511, -1, 0 */ + {0x1FF00400, 0x00000000}, /* 0, 1, 511, 0, 0 */ + {0x1FFFFC00, 0x00000002}, /* 0, -1, 511, 2, 0 */ + {0x1FFFF800, 0x00000003}, /* 0, -2, 511, 3, 0 */ + {0x1FFFF000, 0x00000005}, /* 0, -4, 511, 5, 0 */ + {0x1FFFEC00, 0x00000006}, /* 0, -5, 511, 6, 0 */ + {0x1FFFE800, 0x00000007}, /* 0, -6, 511, 7, 0 */ + {0x1FFFE400, 0x000FFC09}, /* 0, -7, 511, 9, -1 */ + {0x1FFFDC01, 0x000FFC0A}, /* 1, -9, 511, 10, -1 */ + {0x1FEFDC01, 0x000FFC0B}, /* 1, -9, 510, 11, -1 */ + {0x1FEFD401, 0x000FFC0D}, /* 1, -11, 510, 13, -1 */ + {0x1FEFD001, 0x000FFC0E}, /* 1, -12, 510, 14, -1 */ + {0x1FEFCC01, 0x000FF810}, /* 1, -13, 510, 16, -2 */ + {0x1FDFCC01, 0x000FF811}, /* 1, -13, 509, 17, -2 */ + {0x1FDFC401, 0x000FF813}, /* 1, -15, 509, 19, -2 */ + {0x1FCFC002, 0x000FF814}, /* 2, -16, 508, 20, -2 */ + {0x1FCFB802, 0x000FF816}, /* 2, -18, 508, 22, -2 */ + {0x1FCFB402, 0x000FF418}, /* 2, -19, 508, 24, -3 */ + {0x1FBFB402, 0x000FF419}, /* 2, -19, 507, 25, -3 */ + {0x1FAFB002, 0x000FF41B}, /* 2, -20, 506, 27, -3 */ + {0x1FAFA802, 0x000FF41D}, /* 2, -22, 506, 29, -3 */ + {0x1F9FA802, 0x000FF01F}, /* 2, -22, 505, 31, -4 */ + {0x1F9FA402, 0x000FF020}, /* 2, -23, 505, 32, -4 */ + {0x1F8FA002, 0x000FF022}, /* 2, -24, 504, 34, -4 */ + {0x1F7F9803, 0x000FF024}, /* 3, -26, 503, 36, -4 */ + {0x1F7F9403, 0x000FEC26}, /* 3, -27, 503, 38, -5 */ + {0x1F6F9003, 0x000FEC28}, /* 3, -28, 502, 40, -5 */ + {0x1F5F9003, 0x000FEC29}, /* 3, -28, 501, 41, -5 */ + {0x1F4F8C03, 0x000FEC2B}, /* 3, -29, 500, 43, -5 */ + {0x1F3F8C03, 0x000FE82D}, /* 3, -29, 499, 45, -6 */ + {0x1F2F8803, 0x000FE82F}, /* 3, -30, 498, 47, -6 */ + {0x1F2F8003, 0x000FE831}, /* 3, -32, 498, 49, -6 */ + {0x1F1F7C03, 0x000FE833}, /* 3, -33, 497, 51, -6 */ + {0x1F0F7C03, 0x000FE435}, /* 3, -33, 496, 53, -7 */ + {0x1EFF7803, 0x000FE437}, /* 3, -34, 495, 55, -7 */ + {0x1EEF7403, 0x000FE439}, /* 3, -35, 494, 57, -7 */ + {0x1EDF7004, 0x000FE03B}, /* 4, -36, 493, 59, -8 */ + {0x1EBF7403, 0x000FE43C}, /* 3, -35, 491, 60, -7 */ + {0x1EAF6C04, 0x000FE03F}, /* 4, -37, 490, 63, -8 */ + {0x1E9F6804, 0x000FE041}, /* 4, -38, 489, 65, -8 */ + {0x1E8F6804, 0x000FDC43}, /* 4, -38, 488, 67, -9 */ + {0x1E7F6404, 0x000FDC45}, /* 4, -39, 487, 69, -9 */ + {0x1E6F6004, 0x000FDC47}, /* 4, -40, 486, 71, -9 */ + {0x1E4F6404, 0x000FD849}, /* 4, -39, 484, 73, -10 */ + {0x1E3F6004, 0x000FD84B}, /* 4, -40, 483, 75, -10 */ + {0x1E1F6003, 0x000FDC4D}, /* 3, -40, 481, 77, -9 */ + {0x1E1F5804, 0x000FD450}, /* 4, -42, 481, 80, -11 */ + {0x1DFF5804, 0x000FD452}, /* 4, -42, 479, 82, -11 */ + {0x1DEF5404, 0x000FD454}, /* 4, -43, 478, 84, -11 */ + {0x1DCF5804, 0x000FD056}, /* 4, -42, 476, 86, -12 */ + {0x1DBF5004, 0x000FD059}, /* 4, -44, 475, 89, -12 */ + {0x1D9F5004, 0x000FD05B}, /* 4, -44, 473, 91, -12 */ + {0x1D8F5004, 0x000FCC5D}, /* 4, -44, 472, 93, -13 */ + {0x1D6F5004, 0x000FCC5F}, /* 4, -44, 470, 95, -13 */ + {0x1D5F4804, 0x000FCC62}, /* 4, -46, 469, 98, -13 */ + {0x1D3F4C04, 0x000FC864}, /* 4, -45, 467, 100, -14 */ + {0x1D1F4C04, 0x000FCC65}, /* 4, -45, 465, 101, -13 */ + {0x1CFF4804, 0x000FCC68}, /* 4, -46, 463, 104, -13 */ + {0x1CEF4405, 0x000FC46B}, /* 5, -47, 462, 107, -15 */ + {0x1CCF4804, 0x000FC86C}, /* 4, -46, 460, 108, -14 */ + {0x1CAF4404, 0x000FC86F}, /* 4, -47, 458, 111, -14 */ + {0x1C9F4005, 0x000FC072}, /* 5, -48, 457, 114, -16 */ + {0x1C6F4404, 0x000FC474}, /* 4, -47, 454, 116, -15 */ + {0x1C6F3C05, 0x000FBC77}, /* 5, -49, 454, 119, -17 */ + {0x1C4F3C05, 0x000FBC79}, /* 5, -49, 452, 121, -17 */ + {0x1C1F4004, 0x000FC07B}, /* 4, -48, 449, 123, -16 */ + {0x1C0F3C05, 0x000FB87E}, /* 5, -49, 448, 126, -18 */ + {0x1BEF3C04, 0x000FBC80}, /* 4, -49, 446, 128, -17 */ + {0x1BCF3C04, 0x000FBC82}, /* 4, -49, 444, 130, -17 */ + {0x1BAF3C04, 0x000FB885}, /* 4, -49, 442, 133, -18 */ + {0x1B8F3C04, 0x000FB887}, /* 4, -49, 440, 135, -18 */ + {0x1B6F3C04, 0x000FB48A}, /* 4, -49, 438, 138, -19 */ + {0x1B5F3405, 0x000FB08D}, /* 5, -51, 437, 141, -20 */ + {0x1B2F3804, 0x000FB48F}, /* 4, -50, 434, 143, -19 */ + {0x1B1F3405, 0x000FAC92}, /* 5, -51, 433, 146, -21 */ + {0x1AEF3804, 0x000FB094}, /* 4, -50, 430, 148, -20 */ + {0x1ACF3804, 0x000FAC97}, /* 4, -50, 428, 151, -21 */ + {0x1AAF3804, 0x000FAC99}, /* 4, -50, 426, 153, -21 */ + {0x1A7F3804, 0x000FAC9C}, /* 4, -50, 423, 156, -21 */ + {0x1A6F3405, 0x000FA49F}, /* 5, -51, 422, 159, -23 */ + {0x1A3F3804, 0x000FA8A1}, /* 4, -50, 419, 161, -22 */ + {0x1A1F3804, 0x000FA4A4}, /* 4, -50, 417, 164, -23 */ + {0x1A0F3005, 0x000FA0A7}, /* 5, -52, 416, 167, -24 */ + {0x19DF3404, 0x000FA4A9}, /* 4, -51, 413, 169, -23 */ + {0x19CF3005, 0x000F9CAC}, /* 5, -52, 412, 172, -25 */ + {0x199F3005, 0x000F9CAF}, /* 5, -52, 409, 175, -25 */ + {0x197F3005, 0x000F98B2}, /* 5, -52, 407, 178, -26 */ + {0x195F3005, 0x000F98B4}, /* 5, -52, 405, 180, -26 */ + {0x191F3804, 0x000F9CB6}, /* 4, -50, 401, 182, -25 */ + {0x18FF3804, 0x000F98B9}, /* 4, -50, 399, 185, -26 */ + {0x18CF3804, 0x000F98BC}, /* 4, -50, 396, 188, -26 */ + {0x18BF3804, 0x000F94BE}, /* 4, -50, 395, 190, -27 */ + {0x188F3804, 0x000F94C1}, /* 4, -50, 392, 193, -27 */ + {0x186F3804, 0x000F90C4}, /* 4, -50, 390, 196, -28 */ + {0x184F3405, 0x000F8CC7}, /* 5, -51, 388, 199, -29 */ + {0x181F3804, 0x000F90C9}, /* 4, -50, 385, 201, -28 */ + {0x17FF3804, 0x000F8CCC}, /* 4, -50, 383, 204, -29 */ + {0x17CF3804, 0x000F8CCF}, /* 4, -50, 380, 207, -29 */ + {0x17BF3405, 0x000F84D2}, /* 5, -51, 379, 210, -31 */ + {0x177F3C04, 0x000F88D4}, /* 4, -49, 375, 212, -30 */ + {0x174F3C04, 0x000F88D7}, /* 4, -49, 372, 215, -30 */ + {0x172F3C04, 0x000F84DA}, /* 4, -49, 370, 218, -31 */ + {0x170F3C04, 0x000F84DC}, /* 4, -49, 368, 220, -31 */ + {0x16EF3805, 0x000F7CE0}, /* 5, -50, 366, 224, -33 */ + {0x16BF3C04, 0x000F80E2}, /* 4, -49, 363, 226, -32 */ + {0x167F4004, 0x000F80E5}, /* 4, -48, 359, 229, -32 */ + {0x166F4004, 0x000F7CE7}, /* 4, -48, 358, 231, -33 */ + {0x163F4004, 0x000F7CEA}, /* 4, -48, 355, 234, -33 */ + {0x161F4004, 0x000F78ED}, /* 4, -48, 353, 237, -34 */ + {0x15EF4004, 0x000F78F0}, /* 4, -48, 350, 240, -34 */ + {0x15BF4404, 0x000F74F3}, /* 4, -47, 347, 243, -35 */ + {0x159F4404, 0x000F74F5}, /* 4, -47, 345, 245, -35 */ + {0x156F4404, 0x000F74F8}, /* 4, -47, 342, 248, -35 */ + {0x154F4005, 0x000F6CFC}, /* 5, -48, 340, 252, -37 */ + {0x150F4804, 0x000F70FE}, /* 4, -46, 336, 254, -36 */ + {0x14FF4405, 0x000F6901}, /* 5, -47, 335, 257, -38 */ + {0x14CF4804, 0x000F6D03}, /* 4, -46, 332, 259, -37 */ + {0x149F4804, 0x000F6D06}, /* 4, -46, 329, 262, -37 */ + {0x146F4C04, 0x000F6909}, /* 4, -45, 326, 265, -38 */ + {0x143F4C04, 0x000F690C}, /* 4, -45, 323, 268, -38 */ + {0x141F4C04, 0x000F690E}, /* 4, -45, 321, 270, -38 */ + {0x13EF5004, 0x000F6511}, /* 4, -44, 318, 273, -39 */ + {0x13BF5004, 0x000F6514}, /* 4, -44, 315, 276, -39 */ + {0x139F5004, 0x000F6117}, /* 4, -44, 313, 279, -40 */ + {0x136F5404, 0x000F6119}, /* 4, -43, 310, 281, -40 */ + {0x133F5404, 0x000F611C}, /* 4, -43, 307, 284, -40 */ + {0x131F5404, 0x000F5D1F}, /* 4, -43, 305, 287, -41 */ + {0x12DF5C04, 0x000F5D21}, /* 4, -41, 301, 289, -41 */ + {0x12AF5C04, 0x000F5D24}, /* 4, -41, 298, 292, -41 */ +}; + +static const unsigned long CimarronVerticalGraphicsFilter[] = { + 0x3F840D05, /* 261, 259, -8 */ + 0x3F841D01, /* 257, 263, -8 */ + 0x3F8428FE, /* 254, 266, -8 */ + 0x3F8438FA, /* 250, 270, -8 */ + 0x3F8444F7, /* 247, 273, -8 */ + 0x3F8450F4, /* 244, 276, -8 */ + 0x3F845CF1, /* 241, 279, -8 */ + 0x3F8468EE, /* 238, 282, -8 */ + 0x3F8474EB, /* 235, 285, -8 */ + 0x3F8480E8, /* 232, 288, -8 */ + 0x3F7490E5, /* 229, 292, -9 */ + 0x3F749CE2, /* 226, 295, -9 */ + 0x3F74ACDE, /* 222, 299, -9 */ + 0x3F74B8DB, /* 219, 302, -9 */ + 0x3F74C0D9, /* 217, 304, -9 */ + 0x3F74CCD6, /* 214, 307, -9 */ + 0x3F74D8D3, /* 211, 310, -9 */ + 0x3F74E8CF, /* 207, 314, -9 */ + 0x3F74F4CC, /* 204, 317, -9 */ + 0x3F7500C9, /* 201, 320, -9 */ + 0x3F750CC6, /* 198, 323, -9 */ + 0x3F7518C3, /* 195, 326, -9 */ + 0x3F7520C1, /* 193, 328, -9 */ + 0x3F7530BD, /* 189, 332, -9 */ + 0x3F753CBA, /* 186, 335, -9 */ + 0x3F7548B7, /* 183, 338, -9 */ + 0x3F6558B4, /* 180, 342, -10 */ + 0x3F6560B2, /* 178, 344, -10 */ + 0x3F656CAF, /* 175, 347, -10 */ + 0x3F6578AC, /* 172, 350, -10 */ + 0x3F6584A9, /* 169, 353, -10 */ + 0x3F658CA7, /* 167, 355, -10 */ + 0x3F6598A4, /* 164, 358, -10 */ + 0x3F65A8A0, /* 160, 362, -10 */ + 0x3F65B09E, /* 158, 364, -10 */ + 0x3F65BC9B, /* 155, 367, -10 */ + 0x3F65C499, /* 153, 369, -10 */ + 0x3F65D096, /* 150, 372, -10 */ + 0x3F55E093, /* 147, 376, -11 */ + 0x3F55E891, /* 145, 378, -11 */ + 0x3F55F48E, /* 142, 381, -11 */ + 0x3F56008B, /* 139, 384, -11 */ + 0x3F560C88, /* 136, 387, -11 */ + 0x3F561486, /* 134, 389, -11 */ + 0x3F562083, /* 131, 392, -11 */ + 0x3F562881, /* 129, 394, -11 */ + 0x3F56347E, /* 126, 397, -11 */ + 0x3F56407B, /* 123, 400, -11 */ + 0x3F564879, /* 121, 402, -11 */ + 0x3F465876, /* 118, 406, -12 */ + 0x3F466074, /* 116, 408, -12 */ + 0x3F466872, /* 114, 410, -12 */ + 0x3F46746F, /* 111, 413, -12 */ + 0x3F467C6D, /* 109, 415, -12 */ + 0x3F46846B, /* 107, 417, -12 */ + 0x3F468C69, /* 105, 419, -12 */ + 0x3F469866, /* 102, 422, -12 */ + 0x3F46A064, /* 100, 424, -12 */ + 0x3F46AC61, /* 97, 427, -12 */ + 0x3F46B45F, /* 95, 429, -12 */ + 0x3F46BC5D, /* 93, 431, -12 */ + 0x3F46C45B, /* 91, 433, -12 */ + 0x3F46CC59, /* 89, 435, -12 */ + 0x3F36DC56, /* 86, 439, -13 */ + 0x3F36E454, /* 84, 441, -13 */ + 0x3F36EC52, /* 82, 443, -13 */ + 0x3F36F450, /* 80, 445, -13 */ + 0x3F36FC4E, /* 78, 447, -13 */ + 0x3F37004D, /* 77, 448, -13 */ + 0x3F370C4A, /* 74, 451, -13 */ + 0x3F371448, /* 72, 453, -13 */ + 0x3F371C46, /* 70, 455, -13 */ + 0x3F372444, /* 68, 457, -13 */ + 0x3F372C42, /* 66, 459, -13 */ + 0x3F373440, /* 64, 461, -13 */ + 0x3F37383F, /* 63, 462, -13 */ + 0x3F37403D, /* 61, 464, -13 */ + 0x3F37483B, /* 59, 466, -13 */ + 0x3F375039, /* 57, 468, -13 */ + 0x3F375438, /* 56, 469, -13 */ + 0x3F375C36, /* 54, 471, -13 */ + 0x3F376434, /* 52, 473, -13 */ + 0x3F376833, /* 51, 474, -13 */ + 0x3F377031, /* 49, 476, -13 */ + 0x3F377430, /* 48, 477, -13 */ + 0x3F377C2E, /* 46, 479, -13 */ + 0x3F37842C, /* 44, 481, -13 */ + 0x3F37882B, /* 43, 482, -13 */ + 0x3F47882A, /* 42, 482, -12 */ + 0x3F479028, /* 40, 484, -12 */ + 0x3F479427, /* 39, 485, -12 */ + 0x3F479C25, /* 37, 487, -12 */ + 0x3F47A024, /* 36, 488, -12 */ + 0x3F47A822, /* 34, 490, -12 */ + 0x3F47AC21, /* 33, 491, -12 */ + 0x3F47B020, /* 32, 492, -12 */ + 0x3F57B01F, /* 31, 492, -11 */ + 0x3F57B81D, /* 29, 494, -11 */ + 0x3F57BC1C, /* 28, 495, -11 */ + 0x3F57C01B, /* 27, 496, -11 */ + 0x3F57C41A, /* 26, 497, -11 */ + 0x3F67C818, /* 24, 498, -10 */ + 0x3F67CC17, /* 23, 499, -10 */ + 0x3F67D016, /* 22, 500, -10 */ + 0x3F67D415, /* 21, 501, -10 */ + 0x3F67D814, /* 20, 502, -10 */ + 0x3F77D813, /* 19, 502, -9 */ + 0x3F77DC12, /* 18, 503, -9 */ + 0x3F77E011, /* 17, 504, -9 */ + 0x3F87E010, /* 16, 504, -8 */ + 0x3F87E40F, /* 15, 505, -8 */ + 0x3F87E80E, /* 14, 506, -8 */ + 0x3F97E80D, /* 13, 506, -7 */ + 0x3F97EC0C, /* 12, 507, -7 */ + 0x3F97F00B, /* 11, 508, -7 */ + 0x3FA7F00A, /* 10, 508, -6 */ + 0x3FA7F409, /* 9, 509, -6 */ + 0x3FB7F408, /* 8, 509, -5 */ + 0x3FB7F408, /* 8, 509, -5 */ + 0x3FC7F806, /* 6, 510, -4 */ + 0x3FC7F806, /* 6, 510, -4 */ + 0x3FD7F805, /* 5, 510, -3 */ + 0x3FD7FC04, /* 4, 511, -3 */ + 0x3FE7FC03, /* 3, 511, -2 */ + 0x3FE7FC03, /* 3, 511, -2 */ + 0x3FF7FC02, /* 2, 511, -1 */ + 0x3FF7FC02, /* 2, 511, -1 */ + 0x0007FC01, /* 1, 511, 0 */ + 0x0007FC01, /* 1, 511, 0 */ + 0x0007FC01, /* 1, 511, 0 */ + 0x0027FFFF, /* -1, 511, 2 */ + 0x0027FFFF, /* -1, 511, 2 */ + 0x0037FFFE, /* -2, 511, 3 */ + 0x0037FFFE, /* -2, 511, 3 */ + 0x0047FFFD, /* -3, 511, 4 */ + 0x0047FBFE, /* -2, 510, 4 */ + 0x0057FBFD, /* -3, 510, 5 */ + 0x0067FBFC, /* -4, 510, 6 */ + 0x0077F7FC, /* -4, 509, 7 */ + 0x0077F7FC, /* -4, 509, 7 */ + 0x0087F7FB, /* -5, 509, 8 */ + 0x0097F3FB, /* -5, 508, 9 */ + 0x00A7F3FA, /* -6, 508, 10 */ + 0x00B7EFFA, /* -6, 507, 11 */ + 0x00C7EBFA, /* -6, 506, 12 */ + 0x00D7EBF9, /* -7, 506, 13 */ + 0x00E7E7F9, /* -7, 505, 14 */ + 0x00F7E3F9, /* -7, 504, 15 */ + 0x0107E3F8, /* -8, 504, 16 */ + 0x0117DFF8, /* -8, 503, 17 */ + 0x0127DBF8, /* -8, 502, 18 */ + 0x0137DBF7, /* -9, 502, 19 */ + 0x0147D7F7, /* -9, 501, 20 */ + 0x0157D3F7, /* -9, 500, 21 */ + 0x0167CFF7, /* -9, 499, 22 */ + 0x0177CBF7, /* -9, 498, 23 */ + 0x0197C7F6, /* -10, 497, 25 */ + 0x01A7C3F6, /* -10, 496, 26 */ + 0x01B7BFF6, /* -10, 495, 27 */ + 0x01C7BBF6, /* -10, 494, 28 */ + 0x01E7B3F6, /* -10, 492, 30 */ + 0x01F7B3F5, /* -11, 492, 31 */ + 0x0207AFF5, /* -11, 491, 32 */ + 0x0217ABF5, /* -11, 490, 33 */ + 0x0237A3F5, /* -11, 488, 35 */ + 0x02479FF5, /* -11, 487, 36 */ + 0x026797F5, /* -11, 485, 38 */ + 0x027793F5, /* -11, 484, 39 */ + 0x02978BF5, /* -11, 482, 41 */ + 0x02A78BF4, /* -12, 482, 42 */ + 0x02B787F4, /* -12, 481, 43 */ + 0x02D77FF4, /* -12, 479, 45 */ + 0x02F777F4, /* -12, 477, 47 */ + 0x030773F4, /* -12, 476, 48 */ + 0x03276BF4, /* -12, 474, 50 */ + 0x033767F4, /* -12, 473, 51 */ + 0x03575FF4, /* -12, 471, 53 */ + 0x037757F4, /* -12, 469, 55 */ + 0x038753F4, /* -12, 468, 56 */ + 0x03A74BF4, /* -12, 466, 58 */ + 0x03C743F4, /* -12, 464, 60 */ + 0x03E73BF4, /* -12, 462, 62 */ + 0x040737F3, /* -13, 461, 64 */ + 0x04272FF3, /* -13, 459, 66 */ + 0x044727F3, /* -13, 457, 68 */ + 0x04671FF3, /* -13, 455, 70 */ + 0x048717F3, /* -13, 453, 72 */ + 0x04A70FF3, /* -13, 451, 74 */ + 0x04C703F4, /* -12, 448, 76 */ + 0x04D6FFF4, /* -12, 447, 77 */ + 0x04F6F7F4, /* -12, 445, 79 */ + 0x0516EFF4, /* -12, 443, 81 */ + 0x0536E7F4, /* -12, 441, 83 */ + 0x0556DFF4, /* -12, 439, 85 */ + 0x0586CFF5, /* -11, 435, 88 */ + 0x05A6C7F5, /* -11, 433, 90 */ + 0x05C6BFF5, /* -11, 431, 92 */ + 0x05F6B7F4, /* -12, 429, 95 */ + 0x0616AFF4, /* -12, 427, 97 */ + 0x0636A3F5, /* -11, 424, 99 */ + 0x06569BF5, /* -11, 422, 101 */ + 0x06868FF5, /* -11, 419, 104 */ + 0x06A687F5, /* -11, 417, 106 */ + 0x06C67FF5, /* -11, 415, 108 */ + 0x06E677F5, /* -11, 413, 110 */ + 0x07166BF5, /* -11, 410, 113 */ + 0x073663F5, /* -11, 408, 115 */ + 0x07665BF4, /* -12, 406, 118 */ + 0x07964BF5, /* -11, 402, 121 */ + 0x07B643F5, /* -11, 400, 123 */ + 0x07D637F6, /* -10, 397, 125 */ + 0x08062BF6, /* -10, 394, 128 */ + 0x082623F6, /* -10, 392, 130 */ + 0x085617F6, /* -10, 389, 133 */ + 0x08760FF6, /* -10, 387, 135 */ + 0x08B603F5, /* -11, 384, 139 */ + 0x08D5F7F6, /* -10, 381, 141 */ + 0x0905EBF6, /* -10, 378, 144 */ + 0x0925E3F6, /* -10, 376, 146 */ + 0x0955D3F7, /* -9, 372, 149 */ + 0x0985C7F7, /* -9, 369, 152 */ + 0x09A5BFF7, /* -9, 367, 154 */ + 0x09D5B3F7, /* -9, 364, 157 */ + 0x0A05ABF6, /* -10, 362, 160 */ + 0x0A359BF7, /* -9, 358, 163 */ + 0x0A658FF7, /* -9, 355, 166 */ + 0x0A9587F6, /* -10, 353, 169 */ + 0x0AB57BF7, /* -9, 350, 171 */ + 0x0AE56FF7, /* -9, 347, 174 */ + 0x0B1563F7, /* -9, 344, 177 */ + 0x0B455BF6, /* -10, 342, 180 */ + 0x0B754BF7, /* -9, 338, 183 */ + 0x0BA53FF7, /* -9, 335, 186 */ + 0x0BD533F7, /* -9, 332, 189 */ + 0x0C0523F8, /* -8, 328, 192 */ + 0x0C251BF8, /* -8, 326, 194 */ + 0x0C550FF8, /* -8, 323, 197 */ + 0x0C9503F7, /* -9, 320, 201 */ + 0x0CC4F7F7, /* -9, 317, 204 */ + 0x0CF4EBF7, /* -9, 314, 207 */ + 0x0D24DBF8, /* -8, 310, 210 */ + 0x0D54CFF8, /* -8, 307, 213 */ + 0x0D84C3F8, /* -8, 304, 216 */ + 0x0DB4BBF7, /* -9, 302, 219 */ + 0x0DE4AFF7, /* -9, 299, 222 */ + 0x0E149FF8, /* -8, 295, 225 */ + 0x0E4493F8, /* -8, 292, 228 */ + 0x0E7483F9, /* -7, 288, 231 */ + 0x0EA477F9, /* -7, 285, 234 */ + 0x0ED46BF9, /* -7, 282, 237 */ + 0x0F045FF9, /* -7, 279, 240 */ + 0x0F4453F8, /* -8, 276, 244 */ + 0x0F7447F8, /* -8, 273, 247 */ + 0x0FA43BF8, /* -8, 270, 250 */ + 0x0FD42BF9, /* -7, 266, 253 */ + 0x10041FF9, /* -7, 263, 256 */ +}; diff --git a/driver/xf86-video-geode/src/cim/cim_msr.c b/driver/xf86-video-geode/src/cim/cim_msr.c new file mode 100644 index 000000000..4a6b72dfd --- /dev/null +++ b/driver/xf86-video-geode/src/cim/cim_msr.c @@ -0,0 +1,434 @@ +/* + * Copyright (c) 2006 Advanced Micro Devices, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + * Neither the name of the Advanced Micro Devices, Inc. nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + */ + + /* + * Cimarron MSR access routines. These routines allow the user to query the + * state of the GeodeLink Bus and read and write model-specfic registers. + */ + +/*--------------------------------------------------------------*/ +/* MSR GLOBALS */ +/* These variables hold a local copy of the GeodeLink mapping */ +/* as well as a lookup table for easy device addressing. */ +/*--------------------------------------------------------------*/ + +GEODELINK_NODE gliu_nodes[24]; +GEODELINK_NODE msr_dev_lookup[MSR_DEVICE_EMPTY]; + +#define GET_DEVICE_ID(macrohigh, macrolow) ((macrolow >> 12) & 0xFF) + +/*--------------------------------------------------------------------------- + * msr_init_table + * + * This routine intializes the internal MSR table in Cimarron. This table is + * used for any MSR device accesses. + *--------------------------------------------------------------------------*/ + +int +msr_init_table(void) +{ + Q_WORD msr_value = {0, 0}; + unsigned int i, j; + int return_value = CIM_STATUS_OK; + + /* CHECK FOR VALID GEODELINK CONFIGURATION + * The CPU and the three GLIUs are assumed to be at known static + * addresses, so we will check the device IDs at these addresses as proof + * of a valid GeodeLink configuration + */ + + MSR_READ(MSR_GEODELINK_CAP, MSR_ADDRESS_VAIL, &msr_value); + if (GET_DEVICE_ID(msr_value.high, msr_value.low) != MSR_CLASS_CODE_VAIL) + return_value = CIM_STATUS_ERROR; + + MSR_READ(MSR_GEODELINK_CAP, MSR_ADDRESS_GLIU0, &msr_value); + if (GET_DEVICE_ID(msr_value.high, msr_value.low) != MSR_CLASS_CODE_GLIU) + return_value = CIM_STATUS_ERROR; + + MSR_READ(MSR_GEODELINK_CAP, MSR_ADDRESS_GLIU1, &msr_value); + if (GET_DEVICE_ID(msr_value.high, msr_value.low) != MSR_CLASS_CODE_GLIU) + return_value = CIM_STATUS_ERROR; + + MSR_READ(MSR_GEODELINK_CAP, MSR_ADDRESS_GLIU2, &msr_value); + if (GET_DEVICE_ID(msr_value.high, msr_value.low) != MSR_CLASS_CODE_GLIU) + return_value = CIM_STATUS_ERROR; + + if (return_value == CIM_STATUS_OK) { + /* BUILD LOCAL COPY OF THE GEODELINK BUS */ + + msr_create_geodelink_table(gliu_nodes); + + /* CLEAR TABLE STATUS */ + + for (i = 0; i < MSR_DEVICE_EMPTY; i++) + msr_dev_lookup[i].device_id = MSR_DEVICE_NOTFOUND; + + /* CREATE EASY LOOKUP TABLE FOR FUTURE HARDWARE ACCESS */ + /* Note that MSR_DEVICE_EMPTY is the index after the last */ + /* available device. Also note that we fill in known */ + /* devices before filling in the rest of the table. */ + + msr_dev_lookup[MSR_DEVICE_GEODELX_GLIU0].address_from_cpu = + MSR_ADDRESS_GLIU0; + msr_dev_lookup[MSR_DEVICE_GEODELX_GLIU0].device_id = + MSR_DEVICE_PRESENT; + msr_dev_lookup[MSR_DEVICE_GEODELX_GLIU1].address_from_cpu = + MSR_ADDRESS_GLIU1; + msr_dev_lookup[MSR_DEVICE_GEODELX_GLIU1].device_id = + MSR_DEVICE_PRESENT; + msr_dev_lookup[MSR_DEVICE_5535_GLIU].address_from_cpu = + MSR_ADDRESS_GLIU2; + msr_dev_lookup[MSR_DEVICE_5535_GLIU].device_id = MSR_DEVICE_PRESENT; + msr_dev_lookup[MSR_DEVICE_GEODELX_VAIL].address_from_cpu = + MSR_ADDRESS_VAIL; + msr_dev_lookup[MSR_DEVICE_GEODELX_VAIL].device_id = + MSR_DEVICE_PRESENT; + + for (i = 0; i < MSR_DEVICE_EMPTY; i++) { + if (msr_dev_lookup[i].device_id == MSR_DEVICE_NOTFOUND) { + for (j = 0; j < 24; j++) { + if (gliu_nodes[j].device_id == i) + break; + } + + if (j == 24) + msr_dev_lookup[i].device_id = MSR_DEVICE_NOTFOUND; + else { + msr_dev_lookup[i].device_id = MSR_DEVICE_PRESENT; + msr_dev_lookup[i].address_from_cpu = + gliu_nodes[j].address_from_cpu; + } + } + } + } else { + /* ERROR OUT THE GEODELINK TABLES */ + + for (i = 0; i < 24; i++) { + gliu_nodes[i].address_from_cpu = 0xFFFFFFFF; + gliu_nodes[i].device_id = MSR_DEVICE_EMPTY; + } + + for (i = 0; i < MSR_DEVICE_EMPTY; i++) { + msr_dev_lookup[i].address_from_cpu = 0xFFFFFFFF; + msr_dev_lookup[i].device_id = MSR_DEVICE_NOTFOUND; + } + } + return return_value; +} + +/*--------------------------------------------------------------------------- + * msr_create_geodelink_table + * + * This routine dumps the contents of the GeodeLink bus into an array of + * 24 GEODELINK_NODE structures. Indexes 0-7 represent ports 0-7 of GLIU0, + * indexes 8-15 represent ports 0-7 of GLIU1 and indexes 16-23 represent + * ports 0-7 of GLIU2 (5535). + *--------------------------------------------------------------------------*/ + +int +msr_create_geodelink_table(GEODELINK_NODE * gliu_nodes) +{ + unsigned long mbiu_port_count, reflective; + unsigned long port, index; + unsigned long gliu_count = 0; + int glcp_count = 0; + int usb_count = 0; + int mpci_count = 0; + Q_WORD msr_value = {0, 0}; + + /* ALL THREE GLIUS ARE IN ONE ARRAY */ + /* Entries 0-7 contain the port information for GLIU0, entries */ + /* 8-15 contain GLIU1 and 15-23 contain GLIU2. We perform the */ + /* enumeration in two passes. The first simply fills in the */ + /* addresses and class codes at each node. The second pass */ + /* translates the class codes into indexes into Cimarron's device */ + /* lookup table. */ + + /* COUNT GLIU0 PORTS */ + + MSR_READ(MSR_GLIU_CAP, MSR_ADDRESS_GLIU0, &msr_value); + mbiu_port_count = (msr_value.high >> NUM_PORTS_SHIFT) & 7; + + /* FIND REFLECTIVE PORT */ + /* Query the GLIU for the port through which we are communicating. */ + /* We will avoid accesses to this port to avoid a self-reference. */ + + MSR_READ(MSR_GLIU_WHOAMI, MSR_ADDRESS_GLIU0, &msr_value); + reflective = msr_value.low & WHOAMI_MASK; + + /* SPECIAL CASE FOR PORT 0 */ + /* GLIU0 port 0 is a special case, as it points back to GLIU0. GLIU0 */ + /* responds at address 0x10000xxx, which does not equal 0 << 29. */ + + gliu_nodes[0].address_from_cpu = MSR_ADDRESS_GLIU0; + gliu_nodes[0].device_id = MSR_CLASS_CODE_GLIU; + + /* ENUMERATE ALL PORTS */ + + for (port = 1; port < 8; port++) { + /* FILL IN ADDRESS */ + + gliu_nodes[port].address_from_cpu = port << 29; + + if (port == reflective) + gliu_nodes[port].device_id = MSR_CLASS_CODE_REFLECTIVE; + else if (port > mbiu_port_count) + gliu_nodes[port].device_id = MSR_CLASS_CODE_UNPOPULATED; + else { + MSR_READ(MSR_GEODELINK_CAP, gliu_nodes[port].address_from_cpu, + &msr_value); + gliu_nodes[port].device_id = + GET_DEVICE_ID(msr_value.high, msr_value.low); + } + } + + /* COUNT GLIU1 PORTS */ + + MSR_READ(MSR_GLIU_CAP, MSR_ADDRESS_GLIU1, &msr_value); + mbiu_port_count = (msr_value.high >> NUM_PORTS_SHIFT) & 7; + + /* FIND REFLECTIVE PORT */ + + MSR_READ(MSR_GLIU_WHOAMI, MSR_ADDRESS_GLIU1, &msr_value); + reflective = msr_value.low & WHOAMI_MASK; + + /* ENUMERATE ALL PORTS */ + + for (port = 0; port < 8; port++) { + index = port + 8; + + /* FILL IN ADDRESS */ + + gliu_nodes[index].address_from_cpu = (0x02l << 29) + (port << 26); + + if (port == reflective) + gliu_nodes[index].device_id = MSR_CLASS_CODE_REFLECTIVE; + else if (port > mbiu_port_count) + gliu_nodes[index].device_id = MSR_CLASS_CODE_UNPOPULATED; + else { + MSR_READ(MSR_GEODELINK_CAP, gliu_nodes[index].address_from_cpu, + &msr_value); + gliu_nodes[index].device_id = + GET_DEVICE_ID(msr_value.high, msr_value.low); + } + } + + /* COUNT GLIU2 PORTS */ + + MSR_READ(MSR_GLIU_CAP, MSR_ADDRESS_GLIU2, &msr_value); + mbiu_port_count = (msr_value.high >> NUM_PORTS_SHIFT) & 7; + + /* FIND REFLECTIVE PORT */ + + MSR_READ(MSR_GLIU_WHOAMI, MSR_ADDRESS_GLIU2, &msr_value); + reflective = msr_value.low & WHOAMI_MASK; + + /* FILL IN PORT 0 AND 1 */ + /* Port 0 on 5535 is MBIU2. Port 1 is MPCI, but it is referenced at */ + /* a special address. */ + + gliu_nodes[16].address_from_cpu = MSR_ADDRESS_GLIU2; + gliu_nodes[16].device_id = MSR_CLASS_CODE_GLIU; + + gliu_nodes[17].address_from_cpu = MSR_ADDRESS_5535MPCI; + gliu_nodes[17].device_id = MSR_CLASS_CODE_MPCI; + + /* ENUMERATE ALL PORTS */ + + for (port = 2; port < 8; port++) { + index = port + 16; + + /* FILL IN ADDRESS */ + + gliu_nodes[index].address_from_cpu = + (0x02l << 29) + (0x04l << 26) + (0x02l << 23) + (port << 20); + + if (port == reflective) + gliu_nodes[index].device_id = MSR_CLASS_CODE_REFLECTIVE; + else if (port > mbiu_port_count) + gliu_nodes[index].device_id = MSR_CLASS_CODE_UNPOPULATED; + else { + MSR_READ(MSR_GEODELINK_CAP, gliu_nodes[index].address_from_cpu, + &msr_value); + gliu_nodes[index].device_id = + GET_DEVICE_ID(msr_value.high, msr_value.low); + } + } + + /* SECOND PASS - TRANSLATION */ + /* Now that the class codes for each device are stored in the */ + /* array, we walk through the array and translate the class */ + /* codes to table indexes. For class codes that have multiple */ + /* instances, the table indexes are sequential. */ + + for (port = 0; port < 24; port++) { + /* SPECIAL CASE FOR GLIU UNITS */ + /* A GLIU can be both on another port and on its own port. These */ + /* end up as the same address, but are shown as duplicate nodes in */ + /* the GeodeLink table. */ + + if ((port & 7) == 0) + gliu_count = port >> 3; + + switch (gliu_nodes[port].device_id) { + /* UNPOPULATED OR REFLECTIVE NODES */ + + case MSR_CLASS_CODE_UNPOPULATED: + index = MSR_DEVICE_EMPTY; + break; + case MSR_CLASS_CODE_REFLECTIVE: + index = MSR_DEVICE_REFLECTIVE; + break; + + /* KNOWN CLASS CODES */ + + case MSR_CLASS_CODE_GLIU: + index = MSR_DEVICE_GEODELX_GLIU0 + gliu_count++; + break; + case MSR_CLASS_CODE_GLCP: + index = MSR_DEVICE_GEODELX_GLCP + glcp_count++; + break; + case MSR_CLASS_CODE_MPCI: + index = MSR_DEVICE_GEODELX_MPCI + mpci_count++; + break; + case MSR_CLASS_CODE_USB: + index = MSR_DEVICE_5535_USB2 + usb_count++; + break; + case MSR_CLASS_CODE_USB2: + index = MSR_DEVICE_5536_USB_2_0; + break; + case MSR_CLASS_CODE_ATAC: + index = MSR_DEVICE_5535_ATAC; + break; + case MSR_CLASS_CODE_MDD: + index = MSR_DEVICE_5535_MDD; + break; + case MSR_CLASS_CODE_ACC: + index = MSR_DEVICE_5535_ACC; + break; + case MSR_CLASS_CODE_MC: + index = MSR_DEVICE_GEODELX_MC; + break; + case MSR_CLASS_CODE_GP: + index = MSR_DEVICE_GEODELX_GP; + break; + case MSR_CLASS_CODE_VG: + index = MSR_DEVICE_GEODELX_VG; + break; + case MSR_CLASS_CODE_DF: + index = MSR_DEVICE_GEODELX_DF; + break; + case MSR_CLASS_CODE_FG: + index = MSR_DEVICE_GEODELX_FG; + break; + case MSR_CLASS_CODE_VIP: + index = MSR_DEVICE_GEODELX_VIP; + break; + case MSR_CLASS_CODE_AES: + index = MSR_DEVICE_GEODELX_AES; + break; + case MSR_CLASS_CODE_VAIL: + index = MSR_DEVICE_GEODELX_VAIL; + break; + default: + index = MSR_DEVICE_EMPTY; + break; + } + + gliu_nodes[port].device_id = index; + } + + return CIM_STATUS_OK; +} + +/*--------------------------------------------------------------------------- + * msr_create_device_list + * + * This routine dumps a list of all known GeodeLX/5535 devices as well as their + * respective status and address. + *--------------------------------------------------------------------------*/ + +int +msr_create_device_list(GEODELINK_NODE * gliu_nodes, int max_devices) +{ + int i, count; + + if (max_devices < MSR_DEVICE_EMPTY) + count = max_devices; + else + count = MSR_DEVICE_EMPTY; + + for (i = 0; i < count; i++) { + gliu_nodes[i].address_from_cpu = msr_dev_lookup[i].address_from_cpu; + gliu_nodes[i].device_id = msr_dev_lookup[i].device_id; + } + + return CIM_STATUS_OK; +} + +/*-------------------------------------------------------------------- + * msr_read64 + * + * Performs a 64-bit read from 'msr_register' in device 'device'. 'device' is + * an index into Cimarron's table of known GeodeLink devices. + *-------------------------------------------------------------------*/ + +int +msr_read64(unsigned long device, unsigned long msr_register, + Q_WORD * msr_value) +{ + if (device < MSR_DEVICE_EMPTY) { + if (msr_dev_lookup[device].device_id == MSR_DEVICE_PRESENT) { + MSR_READ(msr_register, msr_dev_lookup[device].address_from_cpu, + msr_value); + return CIM_STATUS_OK; + } + } + + msr_value->low = msr_value->high = 0; + return CIM_STATUS_DEVNOTFOUND; +} + +/*-------------------------------------------------------------------- + * msr_write64 + * + * Performs a 64-bit write to 'msr_register' in device 'device'. 'device' is + * an index into Cimarron's table of known GeodeLink devices. + *-------------------------------------------------------------------*/ + +int +msr_write64(unsigned long device, unsigned long msr_register, + Q_WORD * msr_value) +{ + if (device < MSR_DEVICE_EMPTY) { + if (msr_dev_lookup[device].device_id == MSR_DEVICE_PRESENT) { + MSR_WRITE(msr_register, msr_dev_lookup[device].address_from_cpu, + msr_value); + return CIM_STATUS_OK; + } + } + return CIM_STATUS_DEVNOTFOUND; +} diff --git a/driver/xf86-video-geode/src/cim/cim_parm.h b/driver/xf86-video-geode/src/cim/cim_parm.h new file mode 100644 index 000000000..ed1df8bd0 --- /dev/null +++ b/driver/xf86-video-geode/src/cim/cim_parm.h @@ -0,0 +1,1284 @@ +/* + * Copyright (c) 2006 Advanced Micro Devices, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + * Neither the name of the Advanced Micro Devices, Inc. nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + */ + + /* + * Cimarron user definitions. + */ + +#ifndef _cim_parm_h +#define _cim_parm_h + +/*===================================================*/ +/* CIMARRON RETURN VALUE DEFINITIONS */ +/*===================================================*/ + +#define CIM_STATUS_OK 0x00000000 +#define CIM_STATUS_ERROR 0x00000001 +#define CIM_STATUS_INVALIDPARAMS 0x00000002 +#define CIM_STATUS_DEVNOTFOUND 0x00000004 +#define CIM_STATUS_INVALIDSCALE 0x00000008 +#define CIM_STATUS_INEXACTMATCH 0x00000010 +#define CIM_STATUS_NOLOCK 0x00000020 +#define CIM_STATUS_CPUNOTFOUND 0x00000040 +#define CIM_STATUS_DISPLAYUNAVAILABLE 0x00000080 +#define CIM_STATUS_NOTFOUND 0x00000100 + +/*===================================================*/ +/* CIMARRON CPU DEFINITIONS */ +/*===================================================*/ + +#define CIM_CPU_GEODEGX 0x00000001 +#define CIM_CPU_GEODELX 0x00000002 + +#define CIM_SB_5535 0x00000001 +#define CIM_SB_5536 0x00000002 + +/*===================================================*/ +/* MSR PARAMETERS */ +/*===================================================*/ + +/*-------------------------------------------------------------*/ +/* GEODELINK DEVICE IDS */ +/* These values uniquely identify all known GeodeLink devices */ +/* in GeodeLX and its companion, 5535/6. For multiple devices */ +/* of the same class (GLIU, USB, etc.) the table order is used */ +/* to to identify the expected device order, in terms of on */ +/* which GLIU the device is found, and on which port. */ +/*-------------------------------------------------------------*/ + +#define MSR_DEVICE_GEODELX_GLIU0 0x00 +#define MSR_DEVICE_GEODELX_GLIU1 0x01 +#define MSR_DEVICE_5535_GLIU 0x02 +#define MSR_DEVICE_GEODELX_GLCP 0x03 +#define MSR_DEVICE_5535_GLCP 0x04 +#define MSR_DEVICE_GEODELX_MPCI 0x05 +#define MSR_DEVICE_5535_MPCI 0x06 +#define MSR_DEVICE_GEODELX_MC 0x07 +#define MSR_DEVICE_GEODELX_GP 0x08 +#define MSR_DEVICE_GEODELX_VG 0x09 +#define MSR_DEVICE_GEODELX_VIP 0x0A +#define MSR_DEVICE_GEODELX_AES 0x0B +#define MSR_DEVICE_GEODELX_DF 0x0C +#define MSR_DEVICE_GEODELX_FG 0x0D +#define MSR_DEVICE_GEODELX_VAIL 0x0E +#define MSR_DEVICE_5536_USB_2_0 0x0F +#define MSR_DEVICE_5535_USB2 0x10 +#define MSR_DEVICE_5535_USB1 0x11 +#define MSR_DEVICE_5535_ATAC 0x12 +#define MSR_DEVICE_5535_MDD 0x13 +#define MSR_DEVICE_5535_ACC 0x14 +#define MSR_DEVICE_EMPTY 0x15 +#define MSR_DEVICE_REFLECTIVE 0x16 +#define MSR_DEVICE_PRESENT 0x17 +#define MSR_DEVICE_NOTFOUND 0x18 + +/*---------------------------------------------*/ +/* GEODELINK TABLE ENTRY */ +/* The following structure represents one port */ +/* on a GeodeLink Interface Unit (GLIU) */ +/*---------------------------------------------*/ + +typedef struct tagGeodeLinkNode +{ + unsigned long address_from_cpu; + unsigned long device_id; + +} GEODELINK_NODE; + +/*---------------------------------------------*/ +/* QWORD DATA STRUCTURE */ +/* 64-bit data structure for MSR acess. */ +/*---------------------------------------------*/ + +typedef struct tagQ_WORD +{ + unsigned long high; + unsigned long low; + +} Q_WORD; + +/*===================================================*/ +/* INITIALIZATION USER PARAMETERS */ +/*===================================================*/ + +typedef struct tagInitBaseAddresses +{ + unsigned long framebuffer_base; + unsigned long gp_register_base; + unsigned long vg_register_base; + unsigned long df_register_base; + unsigned long vip_register_base; + unsigned long framebuffer_size; + +} INIT_BASE_ADDRESSES; + +/*===================================================*/ +/* GP USER PARAMETER DEFINITIONS */ +/*===================================================*/ + +/*---------------------------*/ +/* GP_DECLARE_BLT PARAMETERS */ +/*---------------------------*/ + +#define CIMGP_BLTFLAGS_PRES_LUT 0x0001 +#define CIMGP_BLTFLAGS_PRES_COLOR_PAT 0x0002 +#define CIMGP_ENABLE_PREFETCH 0x0004 +#define CIMGP_BLTFLAGS_HAZARD 0x0008 +#define CIMGP_BLTFLAGS_INVERTMONO 0x0010 +#define CIMGP_BLTFLAGS_LIMITBUFFER 0x0020 + +/*-----------------------------------*/ +/* GP_SET_ALPHA_OPERATION PARAMETERS */ +/*-----------------------------------*/ + +#define CIMGP_APPLY_BLEND_TO_RGB 1 +#define CIMGP_APPLY_BLEND_TO_ALPHA 2 +#define CIMGP_APPLY_BLEND_TO_ALL 3 + +#define CIMGP_ALPHA_TIMES_A 0 +#define CIMGP_BETA_TIMES_B 1 +#define CIMGP_A_PLUS_BETA_B 2 +#define CIMGP_ALPHA_A_PLUS_BETA_B 3 + +#define CIMGP_CHANNEL_A_ALPHA 0 +#define CIMGP_CHANNEL_B_ALPHA 1 +#define CIMGP_CONSTANT_ALPHA 2 +#define CIMGP_ALPHA_EQUALS_ONE 3 +#define CIMGP_ALPHA_FROM_RGB_A 4 +#define CIMGP_ALPHA_FROM_RGB_B 5 +#define CIMGP_CONVERTED_ALPHA 6 + +#define CIMGP_CHANNEL_A_SOURCE 0 +#define CIMGP_CHANNEL_A_DEST 1 + +/*---------------------------------*/ +/* GP_SET_SOURCE_FORMAT PARAMETERS */ +/*---------------------------------*/ + +#define CIMGP_SOURCE_FMT_3_3_2 0x00 +#define CIMGP_SOURCE_FMT_8BPP_INDEXED 0x01 +#define CIMGP_SOURCE_FMT_4_4_4_4 0x04 +#define CIMGP_SOURCE_FMT_12BPP_BGR 0x14 +#define CIMGP_SOURCE_FMT_1_5_5_5 0x05 +#define CIMGP_SOURCE_FMT_15BPP_BGR 0x15 +#define CIMGP_SOURCE_FMT_0_5_6_5 0x06 +#define CIMGP_SOURCE_FMT_16BPP_BGR 0x16 +#define CIMGP_SOURCE_FMT_YUYV 0x07 +#define CIMGP_SOURCE_FMT_UYVY 0x17 +#define CIMGP_SOURCE_FMT_8_8_8_8 0x08 +#define CIMGP_SOURCE_FMT_32BPP_BGR 0x18 +#define CIMGP_SOURCE_FMT_24BPP 0x0B +#define CIMGP_SOURCE_FMT_4BPP_INDEXED 0x0D + +/*------------------------------------*/ +/* GP_SCREEN_TO_SCREEN_BLT PARAMETERS */ +/*------------------------------------*/ + +#define CIMGP_NEGXDIR 1 +#define CIMGP_NEGYDIR 2 + +/*------------------------------------*/ +/* GP_BRESENHAM_LINE PARAMETERS */ +/*------------------------------------*/ + +#define CIMGP_YMAJOR 1 +#define CIMGP_POSMAJOR 2 +#define CIMGP_POSMINOR 4 + +/*----------------------------------------------*/ +/* USER STRUCTURE FOR SAVING/RESTORING GP STATE */ +/*----------------------------------------------*/ + +typedef struct tagGPSaveRestore +{ + unsigned long base_offset; + unsigned long cmd_top; + unsigned long cmd_bottom; + unsigned long cmd_base; + unsigned long cmd_read; + +} GP_SAVE_RESTORE; + +/*===================================================*/ +/* VG USER PARAMETER DEFINITIONS */ +/*===================================================*/ + +/*-------------------------------------------*/ +/* SUPPORTED TV ENCODERS */ +/*-------------------------------------------*/ + +#define VG_ENCODER_ADV7171 0x0001 +#define VG_ENCODER_SAA7127 0x0002 +#define VG_ENCODER_FS454 0x0003 +#define VG_ENCODER_ADV7300 0x0004 + +/*-------------------------------------------*/ +/* SUPPORTED TV RESOLUTIONS */ +/*-------------------------------------------*/ + +#define VG_TVMODE_NTSC 0x00000000 +#define VG_TVMODE_PAL 0x00000001 +#define VG_TVMODE_480P 0x00000002 +#define VG_TVMODE_720P 0x00000003 +#define VG_TVMODE_1080I 0x00000004 +#define VG_TVMODE_6X4_NTSC 0x00000005 +#define VG_TVMODE_8X6_NTSC 0x00000006 +#define VG_TVMODE_10X7_NTSC 0x00000007 +#define VG_TVMODE_6X4_PAL 0x00000008 +#define VG_TVMODE_8X6_PAL 0x00000009 +#define VG_TVMODE_10X7_PAL 0x0000000A + +/*-------------------------------------------*/ +/* USER STRUCTURE FOR SETTING A DISPLAY MODE */ +/*-------------------------------------------*/ + +#define VG_SUPPORTFLAG_8BPP 0x00000001 +#define VG_SUPPORTFLAG_12BPP 0x00000002 +#define VG_SUPPORTFLAG_15BPP 0x00000004 +#define VG_SUPPORTFLAG_16BPP 0x00000008 +#define VG_SUPPORTFLAG_24BPP 0x00000010 +#define VG_SUPPORTFLAG_32BPP 0x00000020 +#define VG_SUPPORTFLAG_56HZ 0x00000040 +#define VG_SUPPORTFLAG_60HZ 0x00000080 +#define VG_SUPPORTFLAG_70HZ 0x00000100 +#define VG_SUPPORTFLAG_72HZ 0x00000200 +#define VG_SUPPORTFLAG_75HZ 0x00000400 +#define VG_SUPPORTFLAG_85HZ 0x00000800 +#define VG_SUPPORTFLAG_90HZ 0x00001000 +#define VG_SUPPORTFLAG_100HZ 0x00002000 +#define VG_SUPPORTFLAG_HZMASK 0x00003FC0 +#define VG_SUPPORTFLAG_ADV7171 0x00004000 +#define VG_SUPPORTFLAG_SAA7127 0x00008000 +#define VG_SUPPORTFLAG_FS454 0x00010000 +#define VG_SUPPORTFLAG_ADV7300 0x00020000 +#define VG_SUPPORTFLAG_ENCODERMASK 0x0003C000 +#define VG_SUPPORTFLAG_PANEL 0x00040000 +#define VG_SUPPORTFLAG_TVOUT 0x00080000 +#define VG_SUPPORTFLAG_NTSC 0x00000000 +#define VG_SUPPORTFLAG_PAL 0x00100000 +#define VG_SUPPORTFLAG_480P 0x00200000 +#define VG_SUPPORTFLAG_720P 0x00300000 +#define VG_SUPPORTFLAG_1080I 0x00400000 +#define VG_SUPPORTFLAG_6X4_NTSC 0x00500000 +#define VG_SUPPORTFLAG_8X6_NTSC 0x00600000 +#define VG_SUPPORTFLAG_10X7_NTSC 0x00700000 +#define VG_SUPPORTFLAG_6X4_PAL 0x00800000 +#define VG_SUPPORTFLAG_8X6_PAL 0x00900000 +#define VG_SUPPORTFLAG_10X7_PAL 0x00A00000 +#define VG_SUPPORTFLAG_TVMODEMASK 0x00F00000 + +#define VG_MODEFLAG_NEG_HSYNC 0x00000001 +#define VG_MODEFLAG_NEG_VSYNC 0x00000002 +#define VG_MODEFLAG_INTERLACED 0x00000004 +#define VG_MODEFLAG_PANELOUT 0x00000008 +#define VG_MODEFLAG_CENTERED 0x00000010 +#define VG_MODEFLAG_LINEARPITCH 0x00000020 +#define VG_MODEFLAG_TVOUT 0x00000040 +#define VG_MODEFLAG_HALFCLOCK 0x00000080 +#define VG_MODEFLAG_QVGA 0x00000100 +#define VG_MODEFLAG_EXCLUDEPLL 0x00000200 +#define VG_MODEFLAG_NOPANELTIMINGS 0x00000400 +#define VG_MODEFLAG_XVGA_TFT 0x00000800 +#define VG_MODEFLAG_CUSTOM_PANEL 0x00001000 +#define VG_MODEFLAG_CRT_AND_FP 0x00002000 +#define VG_MODEFLAG_LOW_BAND 0x00000000 +#define VG_MODEFLAG_AVG_BAND 0x00004000 +#define VG_MODEFLAG_HIGH_BAND 0x00008000 +#define VG_MODEFLAG_LEGACY_BAND 0x0000C000 +#define VG_MODEFLAG_BANDWIDTHMASK 0x0000C000 +#define VG_MODEFLAG_OVERRIDE_BAND 0x00010000 +#define VG_MODEFLAG_INT_ADDRESS 0x00000000 +#define VG_MODEFLAG_INT_LINEDOUBLE 0x00020000 +#define VG_MODEFLAG_INT_FLICKER 0x00040000 +#define VG_MODEFLAG_INT_MASK 0x00060000 +#define VG_MODEFLAG_INT_OVERRIDE 0x00080000 +#define VG_MODEFLAG_INVERT_SHFCLK 0x00100000 +#define VG_MODEFLAG_MANUAL_FREQUENCY 0x00200000 +#define VG_MODEFLAG_PLL_BYPASS 0x00400000 +#define VG_MODEFLAG_VIP_TO_DOT_CLOCK 0x00800000 + +#define VG_MODEFLAG_VALIDUSERFLAGS (VG_MODEFLAG_CRT_AND_FP | \ + VG_MODEFLAG_XVGA_TFT | \ + VG_MODEFLAG_NOPANELTIMINGS | \ + VG_MODEFLAG_EXCLUDEPLL | \ + VG_MODEFLAG_LINEARPITCH) + +typedef struct tagVGDisplayMode +{ + /* DISPLAY MODE FLAGS */ + /* Includes BPP, refresh rate information, interlacing, etc. */ + + unsigned long internal_flags; + unsigned long flags; + + /* SOURCE RESOLUTION */ + /* The following values reflect the resolution of the data in the frame */ + /* buffer. These values are used to enable scaling and filtering. */ + + unsigned long src_width; + unsigned long src_height; + + /* PANEL SETTINGS + * These allow a user to set a panel mode through the vg_set_custom_mode + * routine. These values are only relevant if the VG_MODEFLAG_PANEL is + * also set. + */ + + unsigned long mode_width; + unsigned long mode_height; + unsigned long panel_width; + unsigned long panel_height; + unsigned long panel_tim1; + unsigned long panel_tim2; + unsigned long panel_dither_ctl; + unsigned long panel_pad_sel_low; + unsigned long panel_pad_sel_high; + + /* OUTPUT TIMINGS */ + /* If the active width and height do not match the source */ + /* dimensions the graphics data will be scaled. */ + + unsigned long hactive; + unsigned long hblankstart; + unsigned long hsyncstart; + unsigned long hsyncend; + unsigned long hblankend; + unsigned long htotal; + + unsigned long vactive; + unsigned long vblankstart; + unsigned long vsyncstart; + unsigned long vsyncend; + unsigned long vblankend; + unsigned long vtotal; + + unsigned long vactive_even; + unsigned long vblankstart_even; + unsigned long vsyncstart_even; + unsigned long vsyncend_even; + unsigned long vblankend_even; + unsigned long vtotal_even; + + /* CLOCK FREQUENCY */ + + unsigned long frequency; + +} VG_DISPLAY_MODE; + +/*-------------------------------------------*/ +/* PLL FLAGS */ +/*-------------------------------------------*/ + +#define VG_PLL_DIVIDE_BY_2 0x00000001 +#define VG_PLL_DIVIDE_BY_4 0x00000002 +#define VG_PLL_BYPASS 0x00000004 +#define VG_PLL_MANUAL 0x00000008 +#define VG_PLL_VIP_CLOCK 0x00000010 + +/*-------------------------------------------*/ +/* USER STRUCTURE FOR QUERYING DISPLAY MODES */ +/*-------------------------------------------*/ + +typedef struct tagQueryDisplayMode +{ + int interlaced; + int halfclock; + unsigned long active_width; + unsigned long active_height; + unsigned long panel_width; + unsigned long panel_height; + unsigned long total_width; + unsigned long total_height; + unsigned long bpp; + unsigned long hz; + unsigned long frequency; + unsigned long query_flags; + unsigned long encoder; + unsigned long tvmode; + +} VG_QUERY_MODE; + +/*-------------------------------------------*/ +/* USER STRUCTURE FOR QUERYING CURSOR DATA */ +/*-------------------------------------------*/ + +typedef struct tagCursorData +{ + int enable; + int color_cursor; + unsigned long cursor_offset; + unsigned long cursor_x; + unsigned long cursor_y; + unsigned long clipx; + unsigned long clipy; + unsigned long mono_color0; + unsigned long mono_color1; + unsigned long flags; + +} VG_CURSOR_DATA; + +/*------------------------------------------------*/ +/* VG INTERRUPT STATUS SOURCES */ +/*------------------------------------------------*/ + +#define VG_INT_LINE_MATCH 0x00010000 +#define VG_INT_VSYNC_LOSS 0x00020000 + +/*------------------------------------------------*/ +/* USER STRUCTURE FOR SETTING COMPRESSION DATA */ +/*------------------------------------------------*/ + +typedef struct tagCompressionData +{ + unsigned long compression_offset; + unsigned long pitch; + unsigned long size; + unsigned long flags; + +} VG_COMPRESSION_DATA; + +/*-------------------------------------------------*/ +/* USER STRUCTURE FOR CONFIGURING LINE INTERRUPTS */ +/*-------------------------------------------------*/ + +typedef struct tagInterruptInfo +{ + unsigned long line; + unsigned long flags; + int enable; + +} VG_INTERRUPT_PARAMS; + +/*-------------------------------------------------*/ +/* USER STRUCTURE FOR PANNING THE DESKTOP */ +/*-------------------------------------------------*/ + +typedef struct tagPanningInfo +{ + unsigned long start_x; + unsigned long start_y; + int start_updated; + +} VG_PANNING_COORDINATES; + +/*--------------------------------------------------*/ +/* USER STRUCTURE FOR SAVING/RESTORING THE VG STATE */ +/*--------------------------------------------------*/ + +typedef struct tagVGSaveRestore +{ + /* VG REGISTERS */ + + unsigned long unlock; + unsigned long gcfg; + unsigned long dcfg; + unsigned long arb_cfg; + unsigned long fb_offset; + unsigned long cb_offset; + unsigned long cursor_offset; + unsigned long video_y_offset; + unsigned long video_u_offset; + unsigned long video_v_offset; + unsigned long dv_top; + unsigned long line_size; + unsigned long gfx_pitch; + unsigned long video_yuv_pitch; + unsigned long h_active; + unsigned long h_blank; + unsigned long h_sync; + unsigned long v_active; + unsigned long v_blank; + unsigned long v_sync; + unsigned long fb_active; + unsigned long cursor_x; + unsigned long cursor_y; + unsigned long vid_ds_delta; + unsigned long fb_base; + unsigned long dv_ctl; + unsigned long gfx_scale; + unsigned long irq_ctl; + unsigned long vbi_even_ctl; + unsigned long vbi_odd_ctl; + unsigned long vbi_hor_ctl; + unsigned long vbi_odd_line_enable; + unsigned long vbi_even_line_enable; + unsigned long vbi_pitch; + unsigned long color_key; + unsigned long color_key_mask; + unsigned long color_key_x; + unsigned long color_key_y; + unsigned long irq; + unsigned long genlk_ctl; + unsigned long vid_y_even_offset; + unsigned long vid_u_even_offset; + unsigned long vid_v_even_offset; + unsigned long vactive_even; + unsigned long vblank_even; + unsigned long vsync_even; + unsigned long h_coeff[512]; + unsigned long v_coeff[256]; + unsigned long palette[261]; + unsigned long cursor_data[3072]; + unsigned long dot_pll; + unsigned long pll_flags; + + /* VG MSRS */ + + Q_WORD msr_cap; + Q_WORD msr_config; + Q_WORD msr_smi; + Q_WORD msr_error; + Q_WORD msr_pm; + Q_WORD msr_diag; + Q_WORD msr_spare; + Q_WORD msr_ram_ctl; + +} VG_SAVE_RESTORE; + +/*-------------------------------------------*/ +/* VG_GET_DISPLAY_MODE_INDEX PARAMETERS */ +/*-------------------------------------------*/ + +#define VG_QUERYFLAG_ACTIVEWIDTH 0x00000001 +#define VG_QUERYFLAG_ACTIVEHEIGHT 0x00000002 +#define VG_QUERYFLAG_TOTALWIDTH 0x00000004 +#define VG_QUERYFLAG_TOTALHEIGHT 0x00000008 +#define VG_QUERYFLAG_BPP 0x00000010 +#define VG_QUERYFLAG_REFRESH 0x00000020 +#define VG_QUERYFLAG_PIXELCLOCK 0x00000040 +#define VG_QUERYFLAG_PIXELCLOCK_APPROX 0x00000080 +#define VG_QUERYFLAG_PANEL 0x00000100 +#define VG_QUERYFLAG_PANELWIDTH 0x00000200 +#define VG_QUERYFLAG_PANELHEIGHT 0x00000400 +#define VG_QUERYFLAG_TVOUT 0x00000800 +#define VG_QUERYFLAG_INTERLACED 0x00001000 +#define VG_QUERYFLAG_HALFCLOCK 0x00002000 +#define VG_QUERYFLAG_ENCODER 0x00004000 +#define VG_QUERYFLAG_TVMODE 0x00008000 + +/*-----------------------------------------------*/ +/* VG FLICKER FILTER SETTINGS */ +/*-----------------------------------------------*/ + +#define VG_FLICKER_FILTER_NONE 0x00000000 +#define VG_FLICKER_FILTER_1_16 0x10000000 +#define VG_FLICKER_FILTER_1_8 0x20000000 +#define VG_FLICKER_FILTER_1_4 0x40000000 +#define VG_FLICKER_FILTER_5_16 0x50000000 +#define VG_FLICKER_FILTER_MASK 0xF0000000 + +/*-----------------------------------------------*/ +/* VG CRC SOURCES */ +/*-----------------------------------------------*/ + +#define VG_CRC_SOURCE_PREFILTER 0x00000000 +#define VG_CRC_SOURCE_PREFLICKER 0x00000001 +#define VG_CRC_SOURCE_POSTFLICKER 0x00000002 +#define VG_CRC_SOURCE_PREFILTER_EVEN 0x00000010 +#define VG_CRC_SOURCE_PREFLICKER_EVEN 0x00000011 +#define VG_CRC_SOURCE_POSTFLICKER_EVEN 0x00000012 +#define VG_CRC_SOURCE_EVEN 0x00000010 + +/*===================================================*/ +/* DISPLAY FILTER PARAMETERS */ +/*===================================================*/ + +/*-----------------------------------------------*/ +/* VIDEO FORMAT DEFINITIONS */ +/*-----------------------------------------------*/ + +#define DF_VIDFMT_UYVY 0x0000 +#define DF_VIDFMT_Y2YU 0x0001 +#define DF_VIDFMT_YUYV 0x0002 +#define DF_VIDFMT_YVYU 0x0003 +#define DF_VIDFMT_Y0Y1Y2Y3 0x0004 +#define DF_VIDFMT_Y3Y2Y1Y0 0x0005 +#define DF_VIDFMT_Y1Y0Y3Y2 0x0006 +#define DF_VIDFMT_Y1Y2Y3Y0 0x0007 +#define DF_VIDFMT_RGB 0x0008 +#define DF_VIDFMT_P2M_P2L_P1M_P1L 0x0009 +#define DF_VIDFMT_P1M_P1L_P2M_P2L 0x000A +#define DF_VIDFMT_P1M_P2L_P2M_P1L 0x000B + +/*-----------------------------------------------*/ +/* CRT ENABLE STATES */ +/*-----------------------------------------------*/ + +#define DF_CRT_DISABLE 0x0000 +#define DF_CRT_ENABLE 0x0001 +#define DF_CRT_STANDBY 0x0002 +#define DF_CRT_SUSPEND 0x0003 + +/*-----------------------------------------------*/ +/* VIDEO SCALING FLAGS */ +/*-----------------------------------------------*/ + +#define DF_SCALEFLAG_CHANGEX 0x0001 +#define DF_SCALEFLAG_CHANGEY 0x0002 + +/*-----------------------------------------------*/ +/* DISPLAY FILTER COLOR SPACES */ +/*-----------------------------------------------*/ + +#define DF_OUTPUT_RGB 0x0001 +#define DF_OUTPUT_ARGB 0x0002 +#define DF_OUTPUT_SDTV 0x0003 +#define DF_OUTPUT_HDTV 0x0004 + +/*-----------------------------------------------*/ +/* DISPLAY FILTER OUTPUT PATHS */ +/*-----------------------------------------------*/ + +#define DF_DISPLAY_CRT 0x0001 +#define DF_DISPLAY_FP 0x0002 +#define DF_DISPLAY_CRT_FP 0x0003 +#define DF_DISPLAY_VOP 0x0004 +#define DF_DISPLAY_DRGB 0x0005 +#define DF_DISPLAY_CRT_DRGB 0x0006 + +/*-----------------------------------------------*/ +/* WINDOWED CRC DATA SOURCES */ +/*-----------------------------------------------*/ + +#define DF_CRC_SOURCE_GFX_DATA 0x0000 +#define DF_CRC_SOURCE_CRT_RGB 0x0001 +#define DF_CRC_SOURCE_FP_DATA 0x0002 + +/*-----------------------------------------------*/ +/* VIDEO ENABLE FLAGS */ +/*-----------------------------------------------*/ + +#define DF_ENABLEFLAG_NOCOLORKEY 0x0001 + +/*-----------------------------------------------*/ +/* USER STRUCTURE FOR CONFIGURING A VIDEO SOURCE */ +/*-----------------------------------------------*/ + +#define DF_SOURCEFLAG_HDTVSOURCE 0x0001 +#define DF_SOURCEFLAG_IMPLICITSCALING 0x0002 + +typedef struct tagVideoSourceInfo +{ + unsigned long video_format; + unsigned long y_offset; + unsigned long u_offset; + unsigned long v_offset; + unsigned long y_pitch; + unsigned long uv_pitch; + unsigned long width; + unsigned long height; + unsigned long flags; + +} DF_VIDEO_SOURCE_PARAMS; + +/*---------------------------------------------------*/ +/* USER STRUCTURE FOR CONFIGURING THE VIDEO POSITION */ +/*---------------------------------------------------*/ + +#define DF_POSFLAG_DIRECTCLIP 0x0001 +#define DF_POSFLAG_INCLUDEBORDER 0x0002 + +typedef struct tagVideoPosition +{ + long x; + long y; + unsigned long width; + unsigned long height; + unsigned long left_clip; + unsigned long dst_clip; + unsigned long flags; + +} DF_VIDEO_POSITION; + +/*-------------------------------------------------*/ +/* USER STRUCTURE FOR CONFIGURING THE VIDEO CURSOR */ +/*-------------------------------------------------*/ + +typedef struct tagVideoCursorInfo +{ + unsigned long key; + unsigned long mask; + unsigned long color1; + unsigned long color2; + unsigned long select_color2; + unsigned long flags; + +} DF_VIDEO_CURSOR_PARAMS; + +/*-------------------------------------------------*/ +/* USER STRUCTURE FOR CONFIGURING AN ALPHA REGION */ +/*-------------------------------------------------*/ + +#define DF_ALPHAFLAG_COLORENABLED 0x0001 +#define DF_ALPHAFLAG_PERPIXELENABLED 0x0002 + +typedef struct tagAlphaRegionInfo +{ + unsigned long x; + unsigned long y; + unsigned long width; + unsigned long height; + unsigned long alpha_value; + unsigned long priority; + unsigned long color; + unsigned long flags; + long delta; + +} DF_ALPHA_REGION_PARAMS; + +/*-------------------------------------------------*/ +/* USER STRUCTURE FOR SAVING/RESTORING DF DATA */ +/*-------------------------------------------------*/ + +typedef struct tagDFSaveRestore +{ + unsigned long vcfg; + unsigned long dcfg; + unsigned long video_x; + unsigned long video_y; + unsigned long video_scaler; + unsigned long video_color_key; + unsigned long video_color_mask; + unsigned long sat_limit; + unsigned long vid_misc; + unsigned long video_yscale; + unsigned long video_xscale; + unsigned long vid_alpha_control; + unsigned long cursor_key; + unsigned long cursor_mask; + unsigned long cursor_color1; + unsigned long cursor_color2; + unsigned long alpha_xpos1; + unsigned long alpha_ypos1; + unsigned long alpha_color1; + unsigned long alpha_control1; + unsigned long alpha_xpos2; + unsigned long alpha_ypos2; + unsigned long alpha_color2; + unsigned long alpha_control2; + unsigned long alpha_xpos3; + unsigned long alpha_ypos3; + unsigned long alpha_color3; + unsigned long alpha_control3; + unsigned long vid_request; + unsigned long vid_ypos_even; + unsigned long alpha_ypos_even1; + unsigned long alpha_ypos_even2; + unsigned long alpha_ypos_even3; + unsigned long panel_tim1; + unsigned long panel_tim2; + unsigned long panel_pm; + unsigned long panel_dither; + + unsigned long palette[256]; + unsigned long coefficients[512]; + + /* DF MSRS */ + + Q_WORD msr_cap; + Q_WORD msr_config; + Q_WORD msr_smi; + Q_WORD msr_error; + Q_WORD msr_pm; + Q_WORD msr_diag; + Q_WORD msr_df_diag; + Q_WORD msr_pad_sel; + +} DF_SAVE_RESTORE; + +/*-----------------------------------------------*/ +/* DF CRC SOURCES */ +/*-----------------------------------------------*/ + +#define DF_CRC_SOURCE_ODD_FIELD 0x00000100 +#define DF_CRC_SOURCE_EVEN_FIELD 0x00001000 +#define DF_CRC_SOURCE_EVEN 0x00001000 + +/*===================================================*/ +/* VIP USER PARAMETER DEFINITIONS */ +/*===================================================*/ + +#define VIP_MODEFLAG_VSYNCACTIVEHIGH 0x00000001 +#define VIP_MODEFLAG_HSYNCACTIVEHIGH 0x00000002 + +/*---------------------------------------------*/ +/* USER STRUCTURE FOR CONFIGURING 601 SETTINGS */ +/*---------------------------------------------*/ + +typedef struct _TAG_VIP601PARAMS +{ + unsigned long flags; + unsigned long horz_start; + unsigned long width; + unsigned long vert_start_even; + unsigned long even_height; + unsigned long vert_start_odd; + unsigned long odd_height; + unsigned long vbi_start; + unsigned long vbi_height; + unsigned long odd_detect_start; + unsigned long odd_detect_end; + +} VIP_601PARAMS; + +/*-------------------------------------------*/ +/* USER STRUCTURE FOR CONFIGURING A VIP MODE */ +/*-------------------------------------------*/ + +/* VIP MODE FLAGS */ + +#define VIP_MODEFLAG_PLANARCAPTURE 0x00000001 +#define VIP_MODEFLAG_INVERTPOLARITY 0x00000002 +#define VIP_MODEFLAG_PROGRESSIVE 0x00000004 +#define VIP_MODEFLAG_DISABLEZERODETECT 0x00000008 +#define VIP_MODEFLAG_ENABLEREPEATFLAG 0x00000010 +#define VIP_MODEFLAG_10BITANCILLARY 0x00000020 +#define VIP_MODEFLAG_TOGGLEEACHFIELD 0x00000040 +#define VIP_MODEFLAG_INVERTTASKPOLARITY 0x00000080 +#define VIP_MODEFLAG_FLIPMESSAGEWHENFULL 0x00000100 + +/* VIP CAPTURE ENABLE FLAGS */ + +#define VIP_ENABLE_TASKA 0x00000100 +#define VIP_ENABLE_TASKA_VBI 0x00000200 +#define VIP_ENABLE_TASKB 0x00000400 +#define VIP_ENABLE_TASKB_VBI 0x00000800 +#define VIP_ENABLE_ANCILLARY 0x00001000 +#define VIP_ENABLE_ALL 0x00001F00 + +/* VIP CAPTURE MODE FLAGS */ + +#define VIP_MODE_IDLE 0x00000000 +#define VIP_MODE_VIP2_8BIT 0x00000002 +#define VIP_MODE_VIP2_16BIT 0x00000004 +#define VIP_MODE_VIP1_8BIT 0x00000006 +#define VIP_MODE_MSG 0x00000008 +#define VIP_MODE_DATA 0x0000000A +#define VIP_MODE_8BIT601 0x0000000C +#define VIP_MODE_16BIT601 0x0000000E + +/* 4:2:0 PLANAR CAPTURE METHODS */ + +#define VIP_420CAPTURE_EVERYLINE 0x00000001 +#define VIP_420CAPTURE_ALTERNATINGLINES 0x00000002 +#define VIP_420CAPTURE_ALTERNATINGFIELDS 0x00000003 + +typedef struct _TAG_SETMODEBUFFER +{ + unsigned long flags; + unsigned long stream_enables; + unsigned long operating_mode; + unsigned long planar_capture; + VIP_601PARAMS vip601_settings; + +} VIPSETMODEBUFFER; + +/*-----------------------------------------------*/ +/* USER STRUCTURE FOR CONFIGURING VG/VIP GENLOCK */ +/*-----------------------------------------------*/ + +/* LOSS OF VIDEO DETECTION FLAGS */ + +#define VIP_VDE_RUNAWAY_LINE 0x00800000 +#define VIP_VDE_VERTICAL_TIMING 0x00400000 +#define VIP_VDE_CLOCKS_PER_LINE 0x00200000 +#define VIP_VDE_LOST_CLOCK 0x00100000 + +/* VIP VSYNC SELECT FOR THE VG */ + +#define VIP_VGSYNC_NONE 0x00000000 +#define VIP_VGSYNC_START_FRAME 0x00000001 +#define VIP_VGSYNC_FALLING_EDGE_VBLANK 0x00000002 +#define VIP_VGSYNC_RISING_EDGE_VBLANK 0x00000003 +#define VIP_VGSYNC_FALLING_EDGE_FIELD 0x00000004 +#define VIP_VGSYNC_RISING_EDGE_FIELD 0x00000005 +#define VIP_VGSYNC_VIP_CURRENT_LINE 0x00000006 +#define VIP_VGSYNC_MSG_INT 0x00000007 + +/* VIP FIELD SELECT FOR THE VG */ + +#define VIP_VGFIELD_INPUT 0x00000000 +#define VIP_VGFIELD_INPUT_INV 0x00000008 +#define VIP_VGFIELD_ACTIVE_PAGE 0x00000010 +#define VIP_VGFIELD_ACTIVE_PAGE_IN 0x00000018 + +/*--------------------------------------------------------*/ +/* USER STRUCTURE FOR CONFIGURING THE VG VSYNC GENLOCK */ +/*--------------------------------------------------------*/ + +typedef struct _TAG_GENLOCKBUFFER +{ + unsigned long vip_signal_loss; + unsigned long vsync_to_vg; + unsigned long field_to_vg; + unsigned long genlock_skew; + int enable_timeout; + +} VIPGENLOCKBUFFER; + +/*------------------------------------------------------*/ +/* USER STRUCTURE FOR CONFIGURING VIP ANCILLARY CAPTURE */ +/*------------------------------------------------------*/ + +typedef struct _TAG_ANCILLARYBUFFER +{ + unsigned long msg1_base; + unsigned long msg2_base; + unsigned long msg_size; + +} VIPANCILLARYBUFFER; + +/*----------------------------------------------------*/ +/* USER STRUCTURE FOR CONFIGURING VIP CAPTURE BUFFERS */ +/*----------------------------------------------------*/ + +#define VIP_INPUTFLAG_VBI 0x00000001 +#define VIP_INPUTFLAG_INVERTPOLARITY 0x00000002 +#define VIP_INPUTFLAG_PLANAR 0x00000004 + +#define VIP_MAX_BUFFERS 10 + +#define VIP_BUFFER_TASK_A 0x0000 +#define VIP_BUFFER_TASK_B 0x0001 +#define VIP_BUFFER_MAX_TASKS 0x0002 + +#define VIP_BUFFER_A 0x0000 +#define VIP_BUFFER_B 0x0001 +#define VIP_BUFFER_ANC 0x0002 +#define VIP_BUFFER_MSG 0x0003 +#define VIP_BUFFER_601 0x0004 +#define VIP_BUFFER_A_ODD 0x0005 +#define VIP_BUFFER_A_EVEN 0x0006 +#define VIP_BUFFER_B_ODD 0x0007 +#define VIP_BUFFER_B_EVEN 0x0008 + +typedef struct _TAG_INPUTBUFFER_ADDR +{ + unsigned long even_base[VIP_MAX_BUFFERS]; + unsigned long odd_base[VIP_MAX_BUFFERS]; + unsigned long y_pitch; + unsigned long uv_pitch; + unsigned long odd_uoffset; + unsigned long odd_voffset; + unsigned long even_uoffset; + unsigned long even_voffset; + unsigned long vbi_even_base; + unsigned long vbi_odd_base; + +} VIPINPUTBUFFER_ADDR; + +typedef struct _TAG_SETINPUTBUFFER +{ + unsigned long flags; + VIPINPUTBUFFER_ADDR offsets[VIP_BUFFER_MAX_TASKS]; + unsigned long current_buffer; + + VIPANCILLARYBUFFER ancillaryData; + +} VIPINPUTBUFFER; + +/*------------------------------------------------------*/ +/* USER STRUCTURE FOR CONFIGURING VIP SUBWINDOW CAPTURE */ +/*------------------------------------------------------*/ + +typedef struct _TAG_SUBWINDOWBUFFER +{ + int enable; + unsigned long start; + unsigned long stop; + +} VIPSUBWINDOWBUFFER; + +/*--------------------------------------------------------*/ +/* USER STRUCTURE FOR SAVING/RESTORING VIP REGISTERS */ +/*--------------------------------------------------------*/ + +typedef struct _TAG_VIPSTATEBUFFER +{ + unsigned long control1; + unsigned long control2; + unsigned long vip_int; + unsigned long current_target; + unsigned long max_address; + unsigned long taska_evenbase; + unsigned long taska_oddbase; + unsigned long taska_vbi_evenbase; + unsigned long taska_vbi_oddbase; + unsigned long taska_data_pitch; + unsigned long control3; + unsigned long taska_v_oddoffset; + unsigned long taska_u_oddoffset; + unsigned long taskb_evenbase; + unsigned long taskb_oddbase; + unsigned long taskb_vbi_evenbase; + unsigned long taskb_vbi_oddbase; + unsigned long taskb_pitch; + unsigned long taskb_voffset; + unsigned long taskb_uoffset; + unsigned long msg1_base; + unsigned long msg2_base; + unsigned long msg_size; + unsigned long page_offset; + unsigned long vert_start_stop; + unsigned long vsync_err_count; + unsigned long taska_u_evenoffset; + unsigned long taska_v_evenoffset; + + Q_WORD msr_config; + Q_WORD msr_smi; + Q_WORD msr_pm; + Q_WORD msr_diag; + +} VIPSTATEBUFFER; + +/*--------------------------------------------------------*/ +/* VIP_SET_CAPTURE_STATE USER PARAMETERS */ +/*--------------------------------------------------------*/ + +#define VIP_STOPCAPTURE 0x0000 +#define VIP_STOPCAPTUREATLINEEND 0x0001 +#define VIP_STOPCAPTUREATFIELDEND 0x0002 +#define VIP_STOPCAPTUREATFRAMEEND 0x0003 +#define VIP_STARTCAPTUREATNEXTLINE 0x0004 +#define VIP_STARTCAPTUREATNEXTFIELD 0x0005 +#define VIP_STARTCAPTUREATNEXTFRAME 0x0006 +#define VIP_STARTCAPTURE 0x0007 + +/*--------------------------------------------------------*/ +/* VIP_CONFIGURE_FIFO USER PARAMETERS */ +/*--------------------------------------------------------*/ + +#define VIP_VIDEOTHRESHOLD 0x3000 +#define VIP_ANCILLARYTHRESHOLD 0x3001 +#define VIP_VIDEOFLUSH 0x3002 +#define VIP_ANCILLARYFLUSH 0x3003 + +/*--------------------------------------------------------*/ +/* VIP_SET_INTERRUPT_ENABLE USER DEFINITIONS */ +/*--------------------------------------------------------*/ + +#define VIP_INT_FIFO_ERROR 0x80000000 +#define VIP_INT_FIFO_WRAP 0x40000000 +#define VIP_INT_FIFO_OVERFLOW 0x20000000 +#define VIP_INT_FIFO_THRESHOLD 0x10000000 +#define VIP_INT_LONGLINE 0x08000000 +#define VIP_INT_VERTICAL_TIMING 0x04000000 +#define VIP_INT_ACTIVE_PIXELS 0x02000000 +#define VIP_INT_CLOCK_INPUT 0x01000000 +#define VIP_INT_ANC_CHECKSUM_PARITY 0x00800000 +#define VIP_INT_MSG_BUFFER_FULL 0x00400000 +#define VIP_INT_END_VBLANK 0x00200000 +#define VIP_INT_START_VBLANK 0x00100000 +#define VIP_INT_START_EVEN 0x00080000 +#define VIP_INT_START_ODD 0x00040000 +#define VIP_INT_LINE_MATCH_TARGET 0x00020000 +#define VIP_ALL_INTERRUPTS 0xFFFE0000 + +/*--------------------------------------------------------*/ +/* VIP_GET_CURRENT_FIELD RETURN VALUES */ +/*--------------------------------------------------------*/ + +#define VIP_ODD_FIELD 1 +#define VIP_EVEN_FIELD 0 + +/*-------------------------------------------------*/ +/* USER STRUCTURE FOR QUERYING VIP CAPABILITIES */ +/*-------------------------------------------------*/ + +typedef struct _TAG_CAPABILITIESBUFFER +{ + unsigned long revision_id; + unsigned long device_id; + unsigned long n_clock_domains; + unsigned long n_smi_registers; + +} VIPCAPABILITIESBUFFER; + +/*-------------------------------------------------*/ +/* USER STRUCTURE FOR CONFIGURING VIP POWER */ +/*-------------------------------------------------*/ + +typedef struct _TAG_POWERBUFFER +{ + int glink_clock_mode; + int vip_clock_mode; + +} VIPPOWERBUFFER; + +/*-------------------------------------------------*/ +/* USER STRUCTURE FOR CONFIGURING VIP PRIORITIES */ +/*-------------------------------------------------*/ + +typedef struct _TAG_PRIORITYBUFFER +{ + unsigned long secondary; + unsigned long primary; + unsigned long pid; + +} VIPPRIORITYBUFFER; + +/*--------------------------------------------------*/ +/* USER STRUCTURE FOR CONFIGURING VIP DEBUG OUTPUTS */ +/*--------------------------------------------------*/ + +#define VIP_DIAG_UPPER_GLINK_MASTER 0x00010000 +#define VIP_DIAG_UPPER_GLINK_SLAVE 0x00020000 +#define VIP_DIAG_UPPER_GLINK_SLAVE_MMREG 0x00040000 +#define VIP_DIAG_UPPER_Y_BUFFER 0x00080000 +#define VIP_DIAG_UPPER_A_BUFFER 0x00100000 +#define VIP_DIAG_UPPER_FIFO_OUTPUT 0x00200000 +#define VIP_DIAG_UPPER_FIFO_INPUT 0x01000000 +#define VIP_DIAG_UPPER_FORMATTER 0x02000000 +#define VIP_DIAG_UPPER_INPUT_CONTROL 0x04000000 + +#define VIP_DIAG_LOWER_GLINK_MASTER 0x00000001 +#define VIP_DIAG_LOWER_GLINK_SLAVE 0x00000002 +#define VIP_DIAG_LOWER_GLINK_SLAVE_MMREG 0x00000004 +#define VIP_DIAG_LOWER_Y_BUFFER 0x00000008 +#define VIP_DIAG_LOWER_A_BUFFER 0x00000010 +#define VIP_DIAG_LOWER_FIFO_OUTPUT 0x00000020 +#define VIP_DIAG_LOWER_FIFO_INPUT 0x00000100 +#define VIP_DIAG_LOWER_FORMATTER 0x00000200 +#define VIP_DIAG_LOWER_INPUT_CONTROL 0x00000400 + +typedef struct _TAG_DEBUGBUFFER +{ + unsigned long bist; + unsigned long enable_upper; + unsigned long select_upper; + unsigned long enable_lower; + unsigned long select_lower; + +} VIPDEBUGBUFFER; + +/*===================================================*/ +/* VOP USER PARAMETER DEFINITIONS */ +/*===================================================*/ + +/*------------------------------------------------------*/ +/* USER STRUCTURE FOR CONFIGURING VBI CAPTURE */ +/*------------------------------------------------------*/ + +typedef struct _TAG_VBIWINDOWBUFFER +{ + long horz_start; + unsigned long vbi_width; + unsigned long odd_line_capture_mask; + unsigned long even_line_capture_mask; + unsigned long odd_line_offset; + unsigned long even_line_offset; + unsigned long even_address_offset; + unsigned long odd_address_offset; + unsigned long data_size; + unsigned long data_pitch; + int enable_upscale; + int horz_from_hsync; + +} VOPVBIWINDOWBUFFER; + +/*------------------------------------------------------*/ +/* USER STRUCTURE FOR CONFIGURING 601 FOR VOP */ +/*------------------------------------------------------*/ + +#define VOP_601_INVERT_DISPE 0x00080000 +#define VOP_601_INVERT_VSYNC 0x00040000 +#define VOP_601_INVERT_HSYNC 0x00020000 + +#define VOP_VSYNC_EARLIER_BY4 0x00000000 +#define VOP_VSYNC_EARLIER_BY2 0x00004000 +#define VOP_VSYNC_NOSHIFT 0x00008000 +#define VOP_VSYNC_LATER_BY_X 0x0000C000 + +#define VOP_601_YUV_8BIT 0x00000000 +#define VOP_601_YUV_16BIT 0x00000001 +#define VOP_601_RGB_8_8_8 0x00000002 +#define VOP_601_YUV_4_4_4 0x00000003 + +typedef struct _TAG_VOP601 +{ + unsigned long flags; + unsigned long vsync_shift; + unsigned long vsync_shift_count; + unsigned long output_mode; + +} VOP_601DATA; + +/*------------------------------------------------------*/ +/* USER STRUCTURE FOR CONFIGURING VOP OUTPUT */ +/*------------------------------------------------------*/ + +/* VOP FLAGS */ + +#define VOP_FLAG_SINGLECHIPCOMPAT 0x00000001 +#define VOP_FLAG_EXTENDEDSAV 0x00000002 +#define VOP_FLAG_VBI 0x00000008 +#define VOP_FLAG_TASK 0x00000010 +#define VOP_FLAG_SWAP_UV 0x00000020 +#define VOP_FLAG_SWAP_VBI 0x00000040 + +/* 4:4:2 TO 4:2:2 DECIMATION */ + +#define VOP_422MODE_COSITED 0x00000000 +#define VOP_422MODE_INTERSPERSED 0x00000010 +#define VOP_422MODE_ALTERNATING 0x00000020 + +/* VOP OPERATING MODES */ + +#define VOP_MODE_DISABLED 0x00000000 +#define VOP_MODE_VIP11 0x00000001 +#define VOP_MODE_CCIR656 0x00000002 +#define VOP_MODE_VIP20_8BIT 0x00000003 +#define VOP_MODE_VIP20_16BIT 0x00000004 +#define VOP_MODE_601 0x00000005 + +/* VSYNC OUT SELECT FLAGS */ + +#define VOP_MB_SYNCSEL_DISABLED 0x00000000 +#define VOP_MB_SYNCSEL_VG 0x00000020 +#define VOP_MB_SYNCSEL_VG_INV 0x00000040 +#define VOP_MB_SYNCSEL_STATREG17 0x00000060 +#define VOP_MB_SYNCSEL_STATREG17_INV 0x00000080 + +typedef struct _TAG_VOPMODECONFIGURATIONBUFFER +{ + unsigned long flags; + unsigned long mode; + unsigned long conversion_mode; + unsigned long vsync_out; + VOP_601DATA vop601; + +} VOPCONFIGURATIONBUFFER; + +/*--------------------------------------------------------*/ +/* USER STRUCTURE FOR SAVING/RESTORING VOP REGISTERS */ +/*--------------------------------------------------------*/ + +typedef struct _TAG_VOPSTATEBUFFER +{ + unsigned long config; +} VOPSTATEBUFFER; + +#endif diff --git a/driver/xf86-video-geode/src/cim/cim_regs.h b/driver/xf86-video-geode/src/cim/cim_regs.h new file mode 100644 index 000000000..6d434a22d --- /dev/null +++ b/driver/xf86-video-geode/src/cim/cim_regs.h @@ -0,0 +1,1252 @@ +/* + * Copyright (c) 2006 Advanced Micro Devices, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + * Neither the name of the Advanced Micro Devices, Inc. nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + */ + + /* + * Cimarron register definitions + */ + +#ifndef _cim_regs_h +#define _cim_regs_h + +/*----------------------------------------------------------------*/ +/* GRAPHICS PROCESSOR DEFINITIONS */ +/*----------------------------------------------------------------*/ + +/*----------------------------*/ +/* COMMAND BUFFER DEFINITIONS */ +/*----------------------------*/ + +#define GP3_BLT_COMMAND_SIZE 68 /* 18 DWORDS */ +#define GP3_VECTOR_COMMAND_SIZE 56 /* 14 DWORDS */ +#define GP3_4BPP_LUT_COMMAND_SIZE 76 /* 16 DWORDS + 3 CMD DWORDS */ +#define GP3_8BPP_LUT_COMMAND_SIZE 1036 /* 256 DWORDS + + * 3 CMD DWORDS */ +#define GP3_VECTOR_PATTERN_COMMAND_SIZE 20 /* 2 DWORDS + 3 CMD DWORDS */ +#define GP3_MAX_COMMAND_SIZE 9000 /* 8K + + * WORKAROUND SPACE */ +#define GP3_SCRATCH_BUFFER_SIZE 0x100000 /* 1MB SCRATCH + * BUFFER */ +#define GP3_BLT_1PASS_SIZE 0xC7F8 /* (50K - 8) is largest + * 1-Pass load size */ + +/*-------------------------------------*/ +/* BLT COMMAND BUFFER REGISTER OFFSETS */ +/*-------------------------------------*/ + +#define GP3_BLT_CMD_HEADER 0x00000000 +#define GP3_BLT_RASTER_MODE 0x00000004 +#define GP3_BLT_DST_OFFSET 0x00000008 +#define GP3_BLT_SRC_OFFSET 0x0000000C +#define GP3_BLT_STRIDE 0x00000010 +#define GP3_BLT_WID_HEIGHT 0x00000014 +#define GP3_BLT_SRC_COLOR_FG 0x00000018 +#define GP3_BLT_SRC_COLOR_BG 0x0000001C +#define GP3_BLT_PAT_COLOR_0 0x00000020 +#define GP3_BLT_PAT_COLOR_1 0x00000024 +#define GP3_BLT_PAT_DATA_0 0x00000028 +#define GP3_BLT_PAT_DATA_1 0x0000002C +#define GP3_BLT_CH3_OFFSET 0x00000030 +#define GP3_BLT_CH3_MODE_STR 0x00000034 +#define GP3_BLT_CH3_WIDHI 0x00000038 +#define GP3_BLT_BASE_OFFSET 0x0000003C +#define GP3_BLT_MODE 0x00000040 + +/*-----------------------------------------------------------------*/ +/* VECTOR COMMAND BUFFER REGISTER OFFSETS */ +/* Some of these are identical to the BLT registers (and we will */ +/* be assumed to be such in the Cimarron code, but they are listed */ +/* here for clarity and for future changes. */ +/*-----------------------------------------------------------------*/ + +#define GP3_VEC_CMD_HEADER 0x00000000 +#define GP3_VECTOR_RASTER_MODE 0x00000004 +#define GP3_VECTOR_DST_OFFSET 0x00000008 +#define GP3_VECTOR_VEC_ERR 0x0000000C +#define GP3_VECTOR_STRIDE 0x00000010 +#define GP3_VECTOR_VEC_LEN 0x00000014 +#define GP3_VECTOR_SRC_COLOR_FG 0x00000018 +#define GP3_VECTOR_PAT_COLOR_0 0x0000001C +#define GP3_VECTOR_PAT_COLOR_1 0x00000020 +#define GP3_VECTOR_PAT_DATA_0 0x00000024 +#define GP3_VECTOR_PAT_DATA_1 0x00000028 +#define GP3_VECTOR_CH3_MODE_STR 0x0000002C +#define GP3_VECTOR_BASE_OFFSET 0x00000030 +#define GP3_VECTOR_MODE 0x00000034 + +/*---------------------------------------------------*/ +/* GP REGISTER DEFINITIONS */ +/* Addresses for writing or reading directly to/from */ +/* the graphics processor. */ +/*---------------------------------------------------*/ + +#define GP3_DST_OFFSET 0x00000000 +#define GP3_SRC_OFFSET 0x00000004 +#define GP3_VEC_ERR 0x00000004 +#define GP3_STRIDE 0x00000008 +#define GP3_WID_HEIGHT 0x0000000C +#define GP3_VEC_LEN 0x0000000C +#define GP3_SRC_COLOR_FG 0x00000010 +#define GP3_SRC_COLOR_BG 0x00000014 +#define GP3_PAT_COLOR_0 0x00000018 +#define GP3_PAT_COLOR_1 0x0000001C +#define GP3_PAT_COLOR_2 0x00000020 +#define GP3_PAT_COLOR_3 0x00000024 +#define GP3_PAT_COLOR_4 0x00000028 +#define GP3_PAT_COLOR_5 0x0000002C +#define GP3_PAT_DATA_0 0x00000030 +#define GP3_PAT_DATA_1 0x00000034 +#define GP3_RASTER_MODE 0x00000038 +#define GP3_VEC_MODE 0x0000003C +#define GP3_BLT_MODE 0x00000040 +#define GP3_BLT_STATUS 0x00000044 +#define GP3_HST_SRC 0x00000048 +#define GP3_BASE_OFFSET 0x0000004C +#define GP3_CMD_TOP 0x00000050 +#define GP3_CMD_BOT 0x00000054 +#define GP3_CMD_READ 0x00000058 +#define GP3_CMD_WRITE 0x0000005C +#define GP3_CH3_OFFSET 0x00000060 +#define GP3_CH3_MODE_STR 0x00000064 +#define GP3_CH3_WIDHI 0x00000068 +#define GP3_CH3_HST_SRC 0x0000006C +#define GP3_LUT_ADDRESS 0x00000070 +#define GP3_LUT_DATA 0x00000074 +#define GP3_INT_CTL 0x00000078 +#define GP3_HST_SRC_RANGE 0x00000100 + +/*------------------------*/ +/* REGISTER BIT FIELDS */ +/*------------------------*/ + +/* GP3_BLT_CMD_HEADER BIT DEFINITIONS */ + +#define GP3_BLT_HDR_WRAP 0x80000000 +#define GP3_BLT_HDR_TYPE 0x00000000 +#define GP3_BLT_HDR_HAZARD_ENABLE 0x10000000 +#define GP3_BLT_HDR_RASTER_ENABLE 0x00000001 +#define GP3_BLT_HDR_DST_OFF_ENABLE 0x00000002 +#define GP3_BLT_HDR_SRC_OFF_ENABLE 0x00000004 +#define GP3_BLT_HDR_STRIDE_ENABLE 0x00000008 +#define GP3_BLT_HDR_WIDHI_ENABLE 0x00000010 +#define GP3_BLT_HDR_SRC_FG_ENABLE 0x00000020 +#define GP3_BLT_HDR_SRC_BG_ENABLE 0x00000040 +#define GP3_BLT_HDR_PAT_CLR0_ENABLE 0x00000080 +#define GP3_BLT_HDR_PAT_CLR1_ENABLE 0x00000100 +#define GP3_BLT_HDR_PAT_DATA0_ENABLE 0x00000200 +#define GP3_BLT_HDR_PAT_DATA1_ENABLE 0x00000400 +#define GP3_BLT_HDR_CH3_OFF_ENABLE 0x00000800 +#define GP3_BLT_HDR_CH3_STR_ENABLE 0x00001000 +#define GP3_BLT_HDR_CH3_WIDHI_ENABLE 0x00002000 +#define GP3_BLT_HDR_BASE_OFFSET_ENABLE 0x00004000 +#define GP3_BLT_HDR_BLT_MODE_ENABLE 0x00008000 + +/* GP3_VEC_CMD_HEADER BIT DEFINITIONS */ + +#define GP3_VEC_HDR_WRAP 0x80000000 +#define GP3_VEC_HDR_TYPE 0x20000000 +#define GP3_VEC_HDR_HAZARD_ENABLE 0x10000000 +#define GP3_VEC_HDR_RASTER_ENABLE 0x00000001 +#define GP3_VEC_HDR_DST_OFF_ENABLE 0x00000002 +#define GP3_VEC_HDR_VEC_ERR_ENABLE 0x00000004 +#define GP3_VEC_HDR_STRIDE_ENABLE 0x00000008 +#define GP3_VEC_HDR_VEC_LEN_ENABLE 0x00000010 +#define GP3_VEC_HDR_SRC_FG_ENABLE 0x00000020 +#define GP3_VEC_HDR_PAT_CLR0_ENABLE 0x00000040 +#define GP3_VEC_HDR_PAT_CLR1_ENABLE 0x00000080 +#define GP3_VEC_HDR_PAT_DATA0_ENABLE 0x00000100 +#define GP3_VEC_HDR_PAT_DATA1_ENABLE 0x00000200 +#define GP3_VEC_HDR_CH3_STR_ENABLE 0x00000400 +#define GP3_VEC_HDR_BASE_OFFSET_ENABLE 0x00000800 +#define GP3_VEC_HDR_VEC_MODE_ENABLE 0x00001000 + +/* GP3_RASTER_MODE BIT DEFINITIONS */ + +#define GP3_RM_BPPFMT_332 0x00000000 /* 8 BPP, palettized */ +#define GP3_RM_BPPFMT_4444 0x40000000 /* 16 BPP, 4:4:4:4 */ +#define GP3_RM_BPPFMT_1555 0x50000000 /* 16 BPP, 1:5:5:5 */ +#define GP3_RM_BPPFMT_565 0x60000000 /* 16 BPP, 5:6:5 */ +#define GP3_RM_BPPFMT_8888 0x80000000 /* 32 BPP, 8:8:8:8 */ +#define GP3_RM_ALPHA_ALL 0x00C00000 /* Alpha enable */ +#define GP3_RM_ALPHA_TO_RGB 0x00400000 /* Alpha applies to RGB */ +#define GP3_RM_ALPHA_TO_ALPHA 0x00800000 /* Alpha applies to alpha */ +#define GP3_RM_ALPHA_OP_MASK 0x00300000 /* Alpha operation */ +#define GP3_RM_ALPHA_TIMES_A 0x00000000 /* Alpha * A */ +#define GP3_RM_BETA_TIMES_B 0x00100000 /* (1-alpha) * B */ +#define GP3_RM_A_PLUS_BETA_B 0x00200000 /* A + (1-alpha) * B */ +#define GP3_RM_ALPHA_A_PLUS_BETA_B 0x00300000 /* alpha * A + (1 - alpha)B */ +#define GP3_RM_ALPHA_SELECT 0x000E0000 /* Alpha Select */ +#define GP3_RM_SELECT_ALPHA_A 0x00000000 /* Alpha from channel A */ +#define GP3_RM_SELECT_ALPHA_B 0x00020000 /* Alpha from channel B */ +#define GP3_RM_SELECT_ALPHA_R 0x00040000 /* Registered alpha */ +#define GP3_RM_SELECT_ALPHA_1 0x00060000 /* Constant 1 */ +#define GP3_RM_SELECT_ALPHA_CHAN_A 0x00080000 /* RGB Values from A */ +#define GP3_RM_SELECT_ALPHA_CHAN_B 0x000A0000 /* RGB Values from B */ +#define GP3_RM_SELECT_ALPHA_CHAN_3 0x000C0000 /* Alpha from channel 3 */ +#define GP3_RM_DEST_FROM_CHAN_A 0x00010000 /* Alpha channel select */ +#define GP3_RM_PATTERN_INVERT 0x00001000 /* Invert monochrome pat */ +#define GP3_RM_SOURCE_INVERT 0x00002000 /* Invert monochrome src */ +#define GP3_RM_PAT_FLAGS 0x00000700 /* pattern related bits */ +#define GP3_RM_PAT_MONO 0x00000100 /* monochrome pattern */ +#define GP3_RM_PAT_COLOR 0x00000200 /* color pattern */ +#define GP3_RM_PAT_TRANS 0x00000400 /* pattern transparency */ +#define GP3_RM_SRC_TRANS 0x00000800 /* source transparency */ + +/* GP3_VECTOR_MODE REGISTER DESCRIPTIONS */ + +#define GP3_VM_DST_REQ 0x00000008 /* dst data required */ +#define GP3_VM_THROTTLE 0x00000010 /* sync to VBLANK */ + +/* GP3_BLT_MODE REGISTER DEFINITIONS */ + +#define GP3_BM_SRC_FB 0x00000001 /* src = frame buffer */ +#define GP3_BM_SRC_HOST 0x00000002 /* src = host register */ +#define GP3_BM_DST_REQ 0x00000004 /* dst data required */ +#define GP3_BM_SRC_MONO 0x00000040 /* monochrome source data */ +#define GP3_BM_SRC_BP_MONO 0x00000080 /* Byte-packed monochrome */ +#define GP3_BM_NEG_YDIR 0x00000100 /* negative Y direction */ +#define GP3_BM_NEG_XDIR 0x00000200 /* negative X direction */ +#define GP3_BM_THROTTLE 0x00000400 /* sync to VBLANK */ + +/* GP3_BLT_STATUS REGISTER DEFINITIONS */ + +#define GP3_BS_BLT_BUSY 0x00000001 /* GP is not idle */ +#define GP3_BS_BLT_PENDING 0x00000004 /* second BLT is pending */ +#define GP3_BS_HALF_EMPTY 0x00000008 /* src FIFO half empty */ +#define GP3_BS_CB_EMPTY 0x00000010 /* Command buffer empty. */ + +/* GP3_CH3_MODE_STR REGISTER DEFINITIONS */ + +#define GP3_CH3_C3EN 0x80000000 +#define GP3_CH3_REPLACE_SOURCE 0x40000000 +#define GP3_CH3_NEG_XDIR 0x20000000 +#define GP3_CH3_NEG_YDIR 0x10000000 +#define GP3_CH3_SRC_FMT_MASK 0x0f000000 +#define GP3_CH3_SRC_3_3_2 0x00000000 +#define GP3_CH3_SRC_8BPP_INDEXED 0x01000000 +#define GP3_CH3_SRC_8BPP_ALPHA 0x02000000 +#define GP3_CH3_SRC_4_4_4_4 0x04000000 +#define GP3_CH3_SRC_1_5_5_5 0x05000000 +#define GP3_CH3_SRC_0_5_6_5 0x06000000 +#define GP3_CH3_SRC_Y_U_V 0x07000000 +#define GP3_CH3_SRC_8_8_8_8 0x08000000 +#define GP3_CH3_SRC_24BPP_PACKED 0x0B000000 +#define GP3_CH3_SRC_4BPP_INDEXED 0x0D000000 +#define GP3_CH3_SRC_4BPP_ALPHA 0x0E000000 +#define GP3_CH3_SRC_MASK 0x0F000000 +#define GP3_CH3_ROTATE_ENABLE 0x00800000 +#define GP3_CH3_BGR_ORDER 0x00400000 +#define GP3_CH3_COLOR_PAT_ENABLE 0x00200000 +#define GP3_CH3_PRESERVE_LUT 0x00100000 +#define GP3_CH3_PREFETCH_ENABLE 0x00080000 +#define GP3_CH3_HST_SRC_ENABLE 0x00040000 +#define GP3_CH3_STRIDE_MASK 0x0000FFFF + +/* DATA AND LUT LOAD BIT DEFINITIONS */ + +#define GP3_LUT_HDR_WRAP 0x80000000 +#define GP3_LUT_HDR_TYPE 0x40000000 +#define GP3_LUT_HDR_DATA_ENABLE 0x00000003 +#define GP3_DATA_LOAD_HDR_WRAP 0x80000000 +#define GP3_DATA_LOAD_HDR_TYPE 0x60000000 +#define GP3_DATA_LOAD_HDR_ENABLE 0x00000001 + +#define GP3_HOST_SOURCE_TYPE 0x00000000 +#define GP3_CH3_HOST_SOURCE_TYPE 0x20000000 +#define GP3_OLD_PATTERN_COLORS 0x40000000 +#define GP3_LUT_DATA_TYPE 0x60000000 + +#define GP3_BASE_OFFSET_DSTMASK 0xFFC00000 +#define GP3_BASE_OFFSET_SRCMASK 0x003FF000 +#define GP3_BASE_OFFSET_CH3MASK 0x00000FFC + +/*----------------------------------------------------------------*/ +/* VIDEO GENERATOR DEFINITIONS */ +/*----------------------------------------------------------------*/ + +#define DC3_UNLOCK 0x00000000 /* Unlock register */ +#define DC3_GENERAL_CFG 0x00000004 /* Config registers */ +#define DC3_DISPLAY_CFG 0x00000008 +#define DC3_ARB_CFG 0x0000000C + +#define DC3_FB_ST_OFFSET 0x00000010 /* Frame buffer start offset */ +#define DC3_CB_ST_OFFSET 0x00000014 /* Compression start offset */ +#define DC3_CURS_ST_OFFSET 0x00000018 /* Cursor buffer start offset */ +#define DC3_VID_Y_ST_OFFSET 0x00000020 /* Video Y Buffer start offset */ +#define DC3_VID_U_ST_OFFSET 0x00000024 /* Video U Buffer start offset */ +#define DC3_VID_V_ST_OFFSET 0x00000028 /* Video V Buffer start offset */ +#define DC3_DV_TOP 0x0000002C /* DV Ram Limit Register */ +#define DC3_LINE_SIZE 0x00000030 /* Video, CB, and FB line sizes */ +#define DC3_GFX_PITCH 0x00000034 /* FB and DB skip counts */ +#define DC3_VID_YUV_PITCH 0x00000038 /* Y, U and V buffer skip counts */ + +#define DC3_H_ACTIVE_TIMING 0x00000040 /* Horizontal timings */ +#define DC3_H_BLANK_TIMING 0x00000044 +#define DC3_H_SYNC_TIMING 0x00000048 +#define DC3_V_ACTIVE_TIMING 0x00000050 /* Vertical Timings */ +#define DC3_V_BLANK_TIMING 0x00000054 +#define DC3_V_SYNC_TIMING 0x00000058 +#define DC3_FB_ACTIVE 0x0000005C + +#define DC3_CURSOR_X 0x00000060 /* Cursor X position */ +#define DC3_CURSOR_Y 0x00000064 /* Cursor Y Position */ +#define DC3_LINE_CNT_STATUS 0x0000006C + +#define DC3_PAL_ADDRESS 0x00000070 /* Palette Address */ +#define DC3_PAL_DATA 0x00000074 /* Palette Data */ +#define DC3_DFIFO_DIAG 0x00000078 /* Display FIFO diagnostic */ +#define DC3_CFIFO_DIAG 0x0000007C /* Compression FIFO diagnostic */ + +#define DC3_VID_DS_DELTA 0x00000080 /* Vertical Downscaling fraction */ + +#define DC3_PHY_MEM_OFFSET 0x00000084 /* VG Base Address Register */ +#define DC3_DV_CTL 0x00000088 /* Dirty-Valid Control Register */ +#define DC3_DV_ACC 0x0000008C /* Dirty-Valid RAM Access */ + +#define DC3_GFX_SCALE 0x00000090 /* Graphics Scaling */ +#define DC3_IRQ_FILT_CTL 0x00000094 /* VBlank interrupt and filters */ +#define DC3_FILT_COEFF1 0x00000098 +#define DC3_FILT_COEFF2 0x0000009C + +#define DC3_VBI_EVEN_CTL 0x000000A0 /* VBI Data Buffer Controls */ +#define DC3_VBI_ODD_CTL 0x000000A4 +#define DC3_VBI_HOR 0x000000A8 +#define DC3_VBI_LN_ODD 0x000000AC +#define DC3_VBI_LN_EVEN 0x000000B0 +#define DC3_VBI_PITCH 0x000000B4 + +#define DC3_COLOR_KEY 0x000000B8 /* Graphics color key */ +#define DC3_COLOR_MASK 0x000000BC /* Graphics color key mask */ +#define DC3_CLR_KEY_X 0x000000C0 +#define DC3_CLR_KEY_Y 0x000000C4 + +#define DC3_IRQ 0x000000C8 +#define DC3_GENLK_CTL 0x000000D4 + +#define DC3_VID_EVEN_Y_ST_OFFSET 0x000000D8 /* Even field video buffers */ +#define DC3_VID_EVEN_U_ST_OFFSET 0x000000DC +#define DC3_VID_EVEN_V_ST_OFFSET 0x000000E0 + +#define DC3_V_ACTIVE_EVEN 0x000000E4 /* Even field timing registers */ +#define DC3_V_BLANK_EVEN 0x000000E8 +#define DC3_V_SYNC_EVEN 0x000000EC + +/* UNLOCK VALUE */ + +#define DC3_UNLOCK_VALUE 0x00004758 /* used to unlock DC regs */ + +/* VG GEODELINK DEVICE SMI MSR FIELDS */ + +#define DC3_VG_BL_MASK 0x00000001 +#define DC3_MISC_MASK 0x00000002 +#define DC3_ISR0_MASK 0x00000004 +#define DC3_VGA_BL_MASK 0x00000008 +#define DC3_CRTCIO_MSK 0x00000010 +#define DC3_VG_BLANK_SMI 0x00000001 +#define DC3_MISC_SMI 0x00000002 +#define DC3_ISR0_SMI 0x00000004 +#define DC3_VGA_BLANK_SMI 0x00000008 +#define DC3_CRTCIO_SMI 0x00000010 + +/* DC3_GENERAL_CFG BIT FIELDS */ + +#define DC3_GCFG_DBUG 0x80000000 +#define DC3_GCFG_DBSL 0x40000000 +#define DC3_GCFG_CFRW 0x20000000 +#define DC3_GCFG_DIAG 0x10000000 +#define DC3_GCFG_CRC_MODE 0x08000000 +#define DC3_GCFG_SGFR 0x04000000 +#define DC3_GCFG_SGRE 0x02000000 +#define DC3_GCFG_SIGE 0x01000000 +#define DC3_GCFG_SIG_SEL 0x00800000 +#define DC3_GCFG_YUV_420 0x00100000 +#define DC3_GCFG_VDSE 0x00080000 +#define DC3_GCFG_VGAFT 0x00040000 +#define DC3_GCFG_FDTY 0x00020000 +#define DC3_GCFG_STFM 0x00010000 +#define DC3_GCFG_DFHPEL_MASK 0x0000F000 +#define DC3_GCFG_DFHPSL_MASK 0x00000F00 +#define DC3_GCFG_VGAE 0x00000080 +#define DC3_GCFG_DECE 0x00000040 +#define DC3_GCFG_CMPE 0x00000020 +#define DC3_GCFG_FILT_SIG_SEL 0x00000010 +#define DC3_GCFG_VIDE 0x00000008 +#define DC3_GCFG_CLR_CUR 0x00000004 +#define DC3_GCFG_CURE 0x00000002 +#define DC3_GCFG_DFLE 0x00000001 + +/* DC3_DISPLAY_CFG BIT FIELDS */ + +#define DC3_DCFG_VISL 0x08000000 +#define DC3_DCFG_FRLK 0x04000000 +#define DC3_DCFG_PALB 0x02000000 +#define DC3_DCFG_DCEN 0x01000000 +#define DC3_DCFG_VFHPEL_MASK 0x000F0000 +#define DC3_DCFG_VFHPSL_MASK 0x0000F000 +#define DC3_DCFG_16BPP_MODE_MASK 0x00000C00 +#define DC3_DCFG_16BPP 0x00000000 +#define DC3_DCFG_15BPP 0x00000400 +#define DC3_DCFG_12BPP 0x00000800 +#define DC3_DCFG_DISP_MODE_MASK 0x00000300 +#define DC3_DCFG_DISP_MODE_8BPP 0x00000000 +#define DC3_DCFG_DISP_MODE_16BPP 0x00000100 +#define DC3_DCFG_DISP_MODE_24BPP 0x00000200 +#define DC3_DCFG_DISP_MODE_32BPP 0x00000300 +#define DC3_DCFG_TRUP 0x00000040 +#define DC3_DCFG_VDEN 0x00000010 +#define DC3_DCFG_GDEN 0x00000008 +#define DC3_DCFG_TGEN 0x00000001 + +/* DC3_ARB_CFG BIT FIELDS */ + +#define DC3_ACFG_LB_LOAD_WM_EN 0x00100000 +#define DC3_ACFG_LB_LOAD_WM_MASK 0x000F0000 +#define DC3_ACFG_LPEN_END_COUNT_MASK 0x0000FE00 +#define DC3_ACFG_HPEN_SBINV 0x00000100 +#define DC3_ACFG_HPEN_FB_INV_HALFSB 0x00000080 +#define DC3_ACFG_HPEN_FB_INV_SBRD 0x00000040 +#define DC3_ACFG_HPEN_FB_INV 0x00000020 +#define DC3_ACFG_HPEN_1LB_INV 0x00000010 +#define DC3_ACFG_HPEN_2LB_INV 0x00000008 +#define DC3_ACFG_HPEN_3LB_INV 0x00000004 +#define DC3_ACFG_HPEN_LB_FILL 0x00000002 +#define DC3_ACFG_LPEN_VSYNC 0x00000001 + +/* DC3_FB_ST_OFFSET BIT FIELDS */ + +#define DC3_FB_ST_OFFSET_MASK 0x0FFFFFFF + +/* DC3_CB_ST_OFFSET BIT FIELDS */ + +#define DC3_CB_ST_OFFSET_MASK 0x0FFFFFFF + +/* DC3_CURS_ST_OFFSET BIT FIELDS */ + +#define DC3_CURS_ST_OFFSET_MASK 0x0FFFFFFF + +/* DC3_ICON_ST_OFFSET BIT FIELDS */ + +#define DC3_ICON_ST_OFFSET_MASK 0x0FFFFFFF + +/* DC3_VID_Y_ST_OFFSET BIT FIELDS */ + +#define DC3_VID_Y_ST_OFFSET_MASK 0x0FFFFFFF + +/* DC3_VID_U_ST_OFFSET BIT FIELDS */ + +#define DC3_VID_U_ST_OFFSET_MASK 0x0FFFFFFF + +/* DC3_VID_V_ST_OFFSET BIT FIELDS */ + +#define DC3_VID_V_ST_OFFSET_MASK 0x0FFFFFFF + +/* DC3_DV_TOP BIT FIELDS */ + +#define DC3_DVTOP_ENABLE 0x00000001 +#define DC3_DVTOP_MAX_MASK 0x00FFFC00 +#define DC3_DVTOP_MAX_SHIFT 10 + +/* DC3_LINE_SIZE BIT FIELDS */ + +#define DC3_LINE_SIZE_VLS_MASK 0x3FF00000 +#define DC3_LINE_SIZE_CBLS_MASK 0x0007F000 +#define DC3_LINE_SIZE_FBLS_MASK 0x000003FF +#define DC3_LINE_SIZE_CB_SHIFT 12 +#define DC3_LINE_SIZE_VB_SHIFT 20 + +/* DC3_GFX_PITCH BIT FIELDS */ + +#define DC3_GFX_PITCH_CBP_MASK 0xFFFF0000 +#define DC3_GFX_PITCH_FBP_MASK 0x0000FFFF + +/* DC3_VID_YUV_PITCH BIT FIELDS */ + +#define DC3_YUV_PITCH_UVP_MASK 0xFFFF0000 +#define DC3_YUV_PITCH_YBP_MASK 0x0000FFFF + +/* DC3_H_ACTIVE_TIMING BIT FIELDS */ + +#define DC3_HAT_HT_MASK 0x0FF80000 +#define DC3_HAT_HA_MASK 0x00000FF8 + +/* DC3_H_BLANK_TIMING BIT FIELDS */ + +#define DC3_HBT_HBE_MASK 0x0FF80000 +#define DC3_HBT_HBS_MASK 0x00000FF8 + +/* DC3_H_SYNC_TIMING BIT FIELDS */ + +#define DC3_HST_HSE_MASK 0x0FF80000 +#define DC3_HST_HSS_MASK 0x00000FF8 + +/* DC3_V_ACTIVE_TIMING BIT FIELDS */ + +#define DC3_VAT_VT_MASK 0x07FF0000 +#define DC3_VAT_VA_MASK 0x000007FF + +/* DC3_V_BLANK_TIMING BIT FIELDS */ + +#define DC3_VBT_VBE_MASK 0x07FF0000 +#define DC3_VBT_VBS_MASK 0x000007FF + +/* DC3_V_SYNC_TIMING BIT FIELDS */ + +#define DC3_VST_VSE_MASK 0x07FF0000 +#define DC3_VST_VSS_MASK 0x000007FF + +/* DC3_LINE_CNT_STATUS BIT FIELDS */ + +#define DC3_LNCNT_DNA 0x80000000 +#define DC3_LNCNT_VNA 0x40000000 +#define DC3_LNCNT_VSA 0x20000000 +#define DC3_LNCNT_VINT 0x10000000 +#define DC3_LNCNT_FLIP 0x08000000 +#define DC3_LNCNT_V_LINE_CNT 0x07FF0000 +#define DC3_LNCNT_VFLIP 0x00008000 +#define DC3_LNCNT_SIGC 0x00004000 +#define DC3_LNCNT_EVEN_FIELD 0x00002000 +#define DC3_LNCNT_SS_LINE_CMP 0x000007FF + +/* DC3_VID_DS_DELTA BIT FIELDS */ + +#define DC3_DS_DELTA_MASK 0xFFFC0000 +#define DC3_601_VSYNC_SHIFT_MASK 0x00000FFF +#define DC3_601_VSYNC_SHIFT_ENABLE 0x00008000 + +/* DC3_DV_CTL BIT DEFINITIONS */ + +#define DC3_DV_LINE_SIZE_MASK 0x00000C00 +#define DC3_DV_LINE_SIZE_1024 0x00000000 +#define DC3_DV_LINE_SIZE_2048 0x00000400 +#define DC3_DV_LINE_SIZE_4096 0x00000800 +#define DC3_DV_LINE_SIZE_8192 0x00000C00 + +/* DC3_IRQ_FILT_CTL DEFINITIONS */ + +#define DC3_IRQFILT_LB_MASK 0x80000200 +#define DC3_IRQFILT_LB_COEFF 0x00000000 +#define DC3_IRQFILT_SCALER_FILTER 0x00000200 +#define DC3_IRQFILT_SYNCHRONIZER 0x80000000 +#define DC3_IRQFILT_FLICKER_FILTER 0x80000200 +#define DC3_IRQFILT_LB_SEL_MASK 0x60000000 +#define DC3_IRQFILT_INTL_ADDR 0x10000000 +#define DC3_IRQFILT_LINE_MASK 0x07FF0000 +#define DC3_IRQFILT_ALPHA_FILT_EN 0x00004000 +#define DC3_IRQFILT_GFX_FILT_EN 0x00001000 +#define DC3_IRQFILT_INTL_EN 0x00000800 +#define DC3_IRQFILT_H_FILT_SEL 0x00000400 +#define DC3_IRQFILT_LB_ADDR 0x00000100 + +/* DC3_VBI_EVEN_CTL DEFINITIONS */ + +#define DC3_VBI_EVEN_ENABLE_CRC (1L << 31) +#define DC3_VBI_EVEN_CTL_ENABLE_16 (1L << 30) +#define DC3_VBI_EVEN_CTL_UPSCALE (1L << 29) +#define DC3_VBI_ENABLE (1L << 28) +#define DC3_VBI_EVEN_CTL_OFFSET_MASK 0x0FFFFFFF + +/* DC3_VBI_ODD_CTL DEFINITIONS */ + +#define DC3_VBI_ODD_CTL_OFFSET_MASK 0x0FFFFFFF + +/* DC3_VBI_HOR BIT DEFINITIONS */ + +#define DC3_VBI_HOR_END_SHIFT 16 +#define DC3_VBI_HOR_END_MASK 0x0FFF0000 +#define DC3_VBI_HOR_START_MASK 0x00000FFF + +/* DC3_VBI_LN_ODD BIT DEFINITIONS */ + +#define DC3_VBI_ODD_ENABLE_SHIFT 2 +#define DC3_VBI_ODD_ENABLE_MASK 0x01FFFFFC +#define DC3_VBI_ODD_LINE_SHIFT 25 +#define DC3_VBI_ODD_LINE_MASK 0xFE000000 + +/* DC3_VBI_LN_EVEN BIT DEFINITIONS */ + +#define DC3_VBI_EVEN_ENABLE_SHIFT 2 +#define DC3_VBI_EVEN_ENABLE_MASK 0x01FFFFFC +#define DC3_VBI_EVEN_LINE_SHIFT 25 +#define DC3_VBI_EVEN_LINE_MASK 0xFE000000 + +/* DC3_COLOR_KEY DEFINITIONS */ + +#define DC3_CLR_KEY_DATA_MASK 0x00FFFFFF +#define DC3_CLR_KEY_ENABLE 0x01000000 + +/* DC3_IRQ DEFINITIONS */ + +#define DC3_IRQ_MASK 0x00000001 +#define DC3_VSYNC_IRQ_MASK 0x00000002 +#define DC3_IRQ_STATUS 0x00010000 +#define DC3_VSYNC_IRQ_STATUS 0x00020000 + +/* DC3_GENLK_CTL DEFINITIONS */ + +#define DC3_GC_FLICKER_FILTER_NONE 0x00000000 +#define DC3_GC_FLICKER_FILTER_1_16 0x10000000 +#define DC3_GC_FLICKER_FILTER_1_8 0x20000000 +#define DC3_GC_FLICKER_FILTER_1_4 0x40000000 +#define DC3_GC_FLICKER_FILTER_5_16 0x50000000 +#define DC3_GC_FLICKER_FILTER_MASK 0xF0000000 +#define DC3_GC_ALPHA_FLICK_ENABLE 0x02000000 +#define DC3_GC_FLICKER_FILTER_ENABLE 0x01000000 +#define DC3_GC_VIP_VID_OK 0x00800000 +#define DC3_GC_GENLK_ACTIVE 0x00400000 +#define DC3_GC_SKEW_WAIT 0x00200000 +#define DC3_GC_VSYNC_WAIT 0x00100000 +#define DC3_GC_GENLOCK_TO_ENABLE 0x00080000 +#define DC3_GC_GENLOCK_ENABLE 0x00040000 +#define DC3_GC_GENLOCK_SKEW_MASK 0x0003FFFF + +/* VGA DEFINITIONS */ + +#define DC3_SEQUENCER_INDEX 0x03C4 +#define DC3_SEQUENCER_DATA 0x03C5 +#define DC3_SEQUENCER_RESET 0x00 +#define DC3_SEQUENCER_CLK_MODE 0x01 + +#define DC3_RESET_VGA_DISP_ENABLE 0x03 +#define DC3_CLK_MODE_SCREEN_OFF 0x20 + +/* DOT CLOCK FREQUENCY STRUCTURE */ +/* Note that m, n and p refer to the register m, n and p */ +/* and not the m, n and p from the PLL equation. The PLL */ +/* equation adds 1 to each value. */ + +typedef struct tagPLLFrequency +{ + unsigned long pll_value; + unsigned long frequency; + +} PLL_FREQUENCY; + +/* VG MSRS */ + +#define DC3_SPARE_MSR 0x2011 +#define DC3_RAM_CTL 0x2012 + +/* DC3_SPARE_MSR DEFINITIONS */ + +#define DC3_SPARE_DISABLE_CFIFO_HGO 0x00000800 +#define DC3_SPARE_VFIFO_ARB_SELECT 0x00000400 +#define DC3_SPARE_WM_LPEN_OVRD 0x00000200 +#define DC3_SPARE_LOAD_WM_LPEN_MASK 0x00000100 +#define DC3_SPARE_DISABLE_INIT_VID_PRI 0x00000080 +#define DC3_SPARE_DISABLE_VFIFO_WM 0x00000040 +#define DC3_SPARE_DISABLE_CWD_CHECK 0x00000020 +#define DC3_SPARE_PIX8_PAN_FIX 0x00000010 +#define DC3_SPARE_FIRST_REQ_MASK 0x00000002 + +/* VG DIAG DEFINITIONS */ + +#define DC3_MBD_DIAG_EN0 0x00008000 +#define DC3_MBD_DIAG_EN1 0x80000000 +#define DC3_DIAG_DOT_CRTC_DP 0x00000082 +#define DC3_DIAG_DOT_CRTC_DP_HIGH 0x00820000 +#define DC3_DIAG_EVEN_FIELD 0x00002000 + +/*----------------------------------------------------------------*/ +/* DISPLAY FILTER DEFINITIONS */ +/*----------------------------------------------------------------*/ + +#define DF_VIDEO_CONFIG 0x00000000 +#define DF_DISPLAY_CONFIG 0x00000008 +#define DF_VIDEO_X_POS 0x00000010 +#define DF_VIDEO_Y_POS 0x00000018 +#define DF_VIDEO_SCALER 0x00000020 +#define DF_VIDEO_COLOR_KEY 0x00000028 +#define DF_VIDEO_COLOR_MASK 0x00000030 +#define DF_PALETTE_ADDRESS 0x00000038 +#define DF_PALETTE_DATA 0x00000040 +#define DF_SATURATION_LIMIT 0x00000048 +#define DF_VID_MISC 0x00000050 +#define DF_VIDEO_YSCALE 0x00000060 +#define DF_VIDEO_XSCALE 0x00000068 +#define DF_VID_CRC 0x00000088 +#define DF_VID_CRC32 0x00000090 +#define DF_VID_ALPHA_CONTROL 0x00000098 +#define DF_CURSOR_COLOR_KEY 0x000000A0 +#define DF_CURSOR_COLOR_MASK 0x000000A8 +#define DF_CURSOR_COLOR_1 0x000000B0 +#define DF_CURSOR_COLOR_2 0x000000B8 +#define DF_ALPHA_XPOS_1 0x000000C0 +#define DF_ALPHA_YPOS_1 0x000000C8 +#define DF_ALPHA_COLOR_1 0x000000D0 +#define DF_ALPHA_CONTROL_1 0x000000D8 +#define DF_ALPHA_XPOS_2 0x000000E0 +#define DF_ALPHA_YPOS_2 0x000000E8 +#define DF_ALPHA_COLOR_2 0x000000F0 +#define DF_ALPHA_CONTROL_2 0x000000F8 +#define DF_ALPHA_XPOS_3 0x00000100 +#define DF_ALPHA_YPOS_3 0x00000108 +#define DF_ALPHA_COLOR_3 0x00000110 +#define DF_ALPHA_CONTROL_3 0x00000118 +#define DF_VIDEO_REQUEST 0x00000120 +#define DF_ALPHA_WATCH 0x00000128 +#define DF_VIDEO_TEST_MODE 0x00000130 +#define DF_VID_YPOS_EVEN 0x00000138 +#define DF_VID_ALPHA_Y_EVEN_1 0x00000140 +#define DF_VID_ALPHA_Y_EVEN_2 0x00000148 +#define DF_VID_ALPHA_Y_EVEN_3 0x00000150 +#define DF_VIDEO_PANEL_TIM1 0x00000400 +#define DF_VIDEO_PANEL_TIM2 0x00000408 +#define DF_POWER_MANAGEMENT 0x00000410 +#define DF_DITHER_CONTROL 0x00000418 +#define DF_DITHER_ACCESS 0x00000448 +#define DF_DITHER_DATA 0x00000450 +#define DF_PANEL_CRC 0x00000458 +#define DF_PANEL_CRC32 0x00000468 +#define DF_COEFFICIENT_BASE 0x00001000 + +/* DF_VIDEO_CONFIG BIT DEFINITIONS */ + +#define DF_VCFG_VID_EN 0x00000001 +#define DF_VCFG_VID_INP_FORMAT 0x0000000C +#define DF_VCFG_SC_BYP 0x00000020 +#define DF_VCFG_LINE_SIZE_LOWER_MASK 0x0000FF00 +#define DF_VCFG_INIT_READ_MASK 0x01FF0000 +#define DF_VCFG_LINE_SIZE_BIT8 0x08000000 +#define DF_VCFG_LINE_SIZE_BIT9 0x04000000 +#define DF_VCFG_4_2_0_MODE 0x10000000 +#define DF_VCFG_UYVY_FORMAT 0x00000000 +#define DF_VCFG_Y2YU_FORMAT 0x00000004 +#define DF_VCFG_YUYV_FORMAT 0x00000008 +#define DF_VCFG_YVYU_FORMAT 0x0000000C + +/* DF_DISPLAY_CONFIG BIT DEFINITIONS */ + +#define DF_DCFG_DIS_EN 0x00000001 +#define DF_DCFG_HSYNC_EN 0x00000002 +#define DF_DCFG_VSYNC_EN 0x00000004 +#define DF_DCFG_DAC_BL_EN 0x00000008 +#define DF_DCFG_CRT_HSYNC_POL 0x00000100 +#define DF_DCFG_CRT_VSYNC_POL 0x00000200 +#define DF_DCFG_CRT_SYNC_SKW_MASK 0x0001C000 +#define DF_DCFG_CRT_SYNC_SKW_INIT 0x00010000 +#define DF_DCFG_PWR_SEQ_DLY_MASK 0x000E0000 +#define DF_DCFG_PWR_SEQ_DLY_INIT 0x00080000 +#define DF_DCFG_VG_CK 0x00100000 +#define DF_DCFG_GV_PAL_BYP 0x00200000 +#define DF_DAC_VREF 0x04000000 + +/* DF_VID_MISC BIT DEFINITIONS */ + +#define DF_GAMMA_BYPASS_BOTH 0x00000001 +#define DF_DAC_POWER_DOWN 0x00000400 +#define DF_ANALOG_POWER_DOWN 0x00000800 +#define DF_USER_IMPLICIT_SCALING 0x00001000 + +/* DF_VID_ALPHA_CONTROL DEFINITIONS */ + +#define DF_HD_VIDEO 0x00000040 +#define DF_YUV_CSC_EN 0x00000080 +#define DF_NO_CK_OUTSIDE_ALPHA 0x00000100 +#define DF_HD_GRAPHICS 0x00000200 +#define DF_CSC_VIDEO_YUV_TO_RGB 0x00000400 +#define DF_CSC_GRAPHICS_RGB_TO_YUV 0x00000800 +#define DF_CSC_VOP_RGB_TO_YUV 0x00001000 +#define DF_VIDEO_INPUT_IS_RGB 0x00002000 +#define DF_VID_ALPHA_EN 0x00004000 +#define DF_ALPHA_DRGB 0x00008000 + +/* VIDEO CURSOR COLOR KEY DEFINITIONS */ + +#define DF_CURSOR_COLOR_KEY_ENABLE 0x20000000 + +/* ALPHA COLOR BIT DEFINITION */ + +#define DF_ALPHA_COLOR_ENABLE 0x01000000 + +/* ALPHA CONTROL BIT DEFINITIONS */ + +#define DF_ACTRL_WIN_ENABLE 0x00010000 +#define DF_ACTRL_LOAD_ALPHA 0x00020000 +#define DF_ACTRL_PERPIXEL_EN 0x00040000 + +/* DF_VIDEO_SCALER DEFINITIONS */ + +#define DF_SCALE_128_PHASES 0x00002000 +#define DF_SCALE_DOUBLE_H_DOWNSCALE 0x00004000 + +/* DEFAULT PANEL TIMINGS DEFINITIONS */ + +#define DF_DEFAULT_TFT_PMTIM1 0x00000000 +#define DF_DEFAULT_XVGA_PMTIM1 0x00000000 +#define DF_DEFAULT_TFT_PMTIM2 0x08C00000 +#define DF_DEFAULT_XVGA_PMTIM2 0x08C10000 +#define DF_DEFAULT_TFT_PAD_SEL_LOW 0xDFFFFFFF +#define DF_DEFAULT_TFT_PAD_SEL_HIGH 0x0000003F +#define DF_DEFAULT_XVGA_PAD_SEL_LOW 0x00000000 +#define DF_DEFAULT_XVGA_PAD_SEL_HIGH 0x00000000 +#define DF_DEFAULT_DITHCTL 0x00000070 +#define DF_DEFAULT_TV_PAD_SEL_HIGH 0x000000BF +#define DF_DEFAULT_TV_PAD_SEL_LOW 0xDFFFFFFF +#define DF_INVERT_VOP_CLOCK 0x00000080 + +/* DF_VIDEO_PANEL_TIM2 DEFINITIONS */ + +#define DF_PMTIM2_TFT_PASSHTHROUGH 0x40000000 + +/* DF_POWER_MANAGEMENT DEFINITIONS */ + +#define DF_PM_PANEL_ON 0x01000000 +#define DF_PM_INVERT_SHFCLK 0x00002000 + +/* DISPLAY FILTER MSRS */ + +#define DF_MBD_MSR_DIAG_DF 0x2010 +#define DF_MSR_PAD_SEL 0x2011 +#define DF_DIAG_32BIT_CRC 0x80000000 + +#define DF_OUTPUT_CRT 0x00000000 +#define DF_OUTPUT_PANEL 0x00000008 +#define DF_OUTPUT_VOP 0x00000030 +#define DF_OUTPUT_DRGB 0x00000038 +#define DF_SIMULTANEOUS_CRT_FP 0x00008000 +#define DF_CONFIG_OUTPUT_MASK 0x00000038 + +/*----------------------------------------------------------------*/ +/* MSR DEFINITIONS */ +/*----------------------------------------------------------------*/ + +/*----------------------------*/ +/* STATIC GEODELINK ADRESSES */ +/*----------------------------*/ + +#define MSR_ADDRESS_GLIU0 0x10000000 +#define MSR_ADDRESS_GLIU1 0x40000000 +#define MSR_ADDRESS_GLIU2 0x51010000 +#define MSR_ADDRESS_5535MPCI 0x51000000 +#define MSR_ADDRESS_VAIL 0x00000000 + +/*----------------------------*/ +/* UNIVERSAL DEVICE MSRS */ +/*----------------------------*/ + +#define MSR_GEODELINK_CAP 0x2000 +#define MSR_GEODELINK_CONFIG 0x2001 +#define MSR_GEODELINK_SMI 0x2002 +#define MSR_GEODELINK_ERROR 0x2003 +#define MSR_GEODELINK_PM 0x2004 +#define MSR_GEODELINK_DIAG 0x2005 + +/*----------------------------*/ +/* DEVICE CLASS CODES */ +/*----------------------------*/ + +#define MSR_CLASS_CODE_GLIU 0x01 +#define MSR_CLASS_CODE_GLCP 0x02 +#define MSR_CLASS_CODE_MPCI 0x05 +#define MSR_CLASS_CODE_MC 0x20 +#define MSR_CLASS_CODE_GP 0x3D +#define MSR_CLASS_CODE_VG 0x3E +#define MSR_CLASS_CODE_DF 0x3F +#define MSR_CLASS_CODE_FG 0xF0 +#define MSR_CLASS_CODE_VAIL 0x86 +#define MSR_CLASS_CODE_USB 0x42 +#define MSR_CLASS_CODE_USB2 0x43 +#define MSR_CLASS_CODE_ATAC 0x47 +#define MSR_CLASS_CODE_MDD 0xDF +#define MSR_CLASS_CODE_ACC 0x33 +#define MSR_CLASS_CODE_AES 0x30 +#define MSR_CLASS_CODE_VIP 0x3C +#define MSR_CLASS_CODE_REFLECTIVE 0xFFF +#define MSR_CLASS_CODE_UNPOPULATED 0x7FF + +/*----------------------------*/ +/* GLIU MSR DEFINITIONS */ +/*----------------------------*/ + +#define MSR_GLIU_CAP 0x0086 +#define MSR_GLIU_WHOAMI 0x008B + +#define NUM_PORTS_MASK 0x00380000 +#define NUM_PORTS_SHIFT 19 +#define WHOAMI_MASK 0x07 + +/*----------------------------*/ +/* GLCP MSR DEFINITIONS */ +/*----------------------------*/ + +#define GLCP_CLKOFF 0x0010 +#define GLCP_CLKACTIVE 0x0011 +#define GLCP_CLKDISABLE 0x0012 +#define GLCP_CLK4ACK 0x0013 +#define GLCP_SYS_RSTPLL 0x0014 +#define GLCP_DOTPLL 0x0015 +#define GLCP_DBGCLKCTL 0x0016 +#define GLCP_REVID 0x0017 +#define GLCP_RAW_DIAG 0x0028 +#define GLCP_SETM0CTL 0x0040 +#define GLCP_SETN0CTL 0x0048 +#define GLCP_CMPVAL0 0x0050 +#define GLCP_CMPMASK0 0x0051 +#define GLCP_REGA 0x0058 +#define GLCP_REGB 0x0059 +#define GLCP_REGAMASK 0x005A +#define GLCP_REGAVAL 0x005B +#define GLCP_REGBMASK 0x005C +#define GLCP_REGBVAL 0x005D +#define GLCP_FIFOCTL 0x005E +#define GLCP_DIAGCTL 0x005F +#define GLCP_H0CTL 0x0060 +#define GLCP_XSTATE 0x0066 +#define GLCP_YSTATE 0x0067 +#define GLCP_ACTION0 0x0068 + +/* GLCP_DOTPLL DEFINITIONS */ + +#define GLCP_DOTPLL_RESET 0x00000001 +#define GLCP_DOTPLL_BYPASS 0x00008000 +#define GLCP_DOTPLL_HALFPIX 0x01000000 +#define GLCP_DOTPLL_LOCK 0x02000000 +#define GLCP_DOTPLL_VIPCLK 0x00008000 +#define GLCP_DOTPLL_DIV4 0x00010000 + +/* GLCP DIAG DEFINITIONS */ + +#define GLCP_MBD_DIAG_SEL0 0x00000007 +#define GLCP_MBD_DIAG_EN0 0x00008000 +#define GLCP_MBD_DIAG_SEL1 0x00070000 +#define GLCP_MBD_DIAG_EN1 0x80000000 + +/*--------------------------------*/ +/* DISPLAY FILTER MSR DEFINITIONS */ +/*--------------------------------*/ + +/* DISPLAY FILTER MBD_MSR_DIAG DEFINITIONS */ + +#define DF_MBD_DIAG_SEL0 0x00007FFF +#define DF_MBD_DIAG_EN0 0x00008000 +#define DF_MBD_DIAG_SEL1 0x7FFF0000 +#define DF_MBD_DIAG_EN1 0x80000000 + +/* DISPLAY FILTER MBD_MSR_CONFIG DEFINITIONS */ + +#define DF_CONFIG_FMT_MASK 0x00000038 +#define DF_CONFIG_FMT_CRT 0x00000000 +#define DF_CONFIG_FMT_FP 0x00000008 + +/*----------------------------------------------------------------*/ +/* PCI DEFINITIONS */ +/*----------------------------------------------------------------*/ + +#define PCI_VENDOR_DEVICE_GEODEGX 0x0028100B +#define PCI_VENDOR_DEVICE_GEODEGX_VIDEO 0x0030100B +#define PCI_VENDOR_DEVICE_GEODELX 0x20801022 +#define PCI_VENDOR_DEVICE_GEODELX_VIDEO 0x20811022 +#define PCI_VENDOR_5535 0x002B100B +#define PCI_VENDOR_5536 0x20901022 + +/*----------------------------------------------------------------*/ +/* VIP DEFINITIONS */ +/*----------------------------------------------------------------*/ + +#define VIP_CONTROL1 0x00000000 +#define VIP_CONTROL2 0x00000004 +#define VIP_STATUS 0x00000008 +#define VIP_INTERRUPT 0x0000000C +#define VIP_CURRENT_TARGET 0x00000010 +#define VIP_MAX_ADDRESS 0x00000014 +#define VIP_TASKA_VID_EVEN_BASE 0x00000018 +#define VIP_TASKA_VID_ODD_BASE 0x0000001C +#define VIP_TASKA_VBI_EVEN_BASE 0x00000020 +#define VIP_TASKA_VBI_ODD_BASE 0x00000024 +#define VIP_TASKA_VID_PITCH 0x00000028 +#define VIP_CONTROL3 0x0000002C +#define VIP_TASKA_V_OFFSET 0x00000030 +#define VIP_TASKA_U_OFFSET 0x00000034 +#define VIP_TASKB_VID_EVEN_BASE 0x00000038 +#define VIP_601_HORZ_END 0x00000038 +#define VIP_TASKB_VID_ODD_BASE 0x0000003C +#define VIP_601_HORZ_START 0x0000003C +#define VIP_TASKB_VBI_EVEN_BASE 0x00000040 +#define VIP_601_VBI_END 0x00000040 +#define VIP_TASKB_VBI_ODD_BASE 0x00000044 +#define VIP_601_VBI_START 0x00000044 +#define VIP_TASKB_VID_PITCH 0x00000048 +#define VIP_601_EVEN_START_STOP 0x00000048 +#define VIP_TASKB_V_OFFSET 0x00000050 +#define VIP_ODD_FIELD_DETECT 0x00000050 +#define VIP_TASKB_U_OFFSET 0x00000054 +#define VIP_ANC_MSG1_BASE 0x00000058 +#define VIP_ANC_MSG2_BASE 0x0000005C +#define VIP_ANC_MSG_SIZE 0x00000060 +#define VIP_PAGE_OFFSET 0x00000068 +#define VIP_VERTICAL_START_STOP 0x0000006C +#define VIP_601_ODD_START_STOP 0x0000006C +#define VIP_FIFO_ADDRESS 0x00000070 +#define VIP_FIFO_DATA 0x00000074 +#define VIP_VSYNC_ERR_COUNT 0x00000078 +#define VIP_TASKA_U_EVEN_OFFSET 0x0000007C +#define VIP_TASKA_V_EVEN_OFFSET 0x00000080 + +/* INDIVIDUAL REGISTER BIT DEFINITIONS */ +/* Multibit register subsets are expressed as a mask and shift. */ +/* Single bit values are represented as a mask. */ + +/* VIP_CONTROL1 REGISTER DEFINITIONS */ + +#define VIP_CONTROL1_DEFAULT_ANC_FF 2 +#define VIP_CONTROL1_ANC_FF_MASK 0xE0000000 +#define VIP_CONTROL1_ANC_FF_SHIFT 29 + +#define VIP_CONTROL1_DEFAULT_VID_FF 2 +#define VIP_CONTROL1_VID_FF_MASK 0x1F000000 +#define VIP_CONTROL1_VID_FF_SHIFT 24 + +#define VIP_CONTROL1_VDE_FF_MASK 0x00F00000 +#define VIP_CONTROL1_VDE_FF_SHIFT 20 + +#define VIP_CONTROL1_NON_INTERLACED (1L << 19) +#define VIP_CONTROL1_MSG_STRM_CTRL (1L << 18) +#define VIP_CONTROL1_DISABLE_ZERO_DETECT (1L << 17) +#define VIP_CONTROL1_DISABLE_DECIMATION (1L << 16) + +#define VIP_CONTROL1_CAPTURE_ENABLE_MASK 0x0000FF00 +#define VIP_CONTROL1_CAPTURE_ENABLE_SHIFT 8 + +#define VIP_CONTROL1_RUNMODE_MASK 0x000000E0 +#define VIP_CONTROL1_RUNMODE_SHIFT 5 + +#define VIP_CONTROL1_PLANAR (1L << 4) + +#define VIP_CONTROL1_MODE_MASK 0x0000000E +#define VIP_CONTROL1_MODE_SHIFT 1 + +#define VIP_CONTROL1_RESET 0x00000001 + +/* VIP_CONTROL2 REGISTER DEFINITIONS */ + +#define VIP_CONTROL2_INVERT_POLARITY (1L << 31) +#define VIP_CONTROL2_ADD_ERROR_ENABLE (1L << 30) +#define VIP_CONTROL2_REPEAT_ENABLE (1L << 29) +#define VIP_CONTROL2_SWC_ENABLE (1L << 28) +#define VIP_CONTROL2_ANC10 (1L << 27) +#define VIP_CONTROL2_ANCPEN (1L << 26) +#define VIP_CONTROL2_LOOPBACK_ENABLE (1L << 25) +#define VIP_CONTROL2_FIFO_ACCESS (1L << 24) +#define VIP_CONTROL2_VERTERROR_ENABLE (1L << 15) + +#define VIP_CONTROL2_PAGECNT_MASK 0x00E00000 +#define VIP_CONTROL2_PAGECNT_SHIFT 21 + +#define VIP_CONTROL2_DEFAULT_ANCTH 5 +#define VIP_CONTROL2_ANCTH_MASK 0x001F0000 +#define VIP_CONTROL2_ANCTH_SHIFT 16 + +#define VIP_CONTROL2_DEFAULT_VIDTH_420 19 +#define VIP_CONTROL2_DEFAULT_VIDTH_422 19 +#define VIP_CONTROL2_VIDTH_MASK 0x00007F00 +#define VIP_CONTROL2_VIDTH_SHIFT 8 + +#define VIP_CONTROL2_SYNC2PIN_MASK 0x000000E0 +#define VIP_CONTROL2_SYNC2PIN_SHIFT 5 + +#define VIP_CONTROL2_FIELD2VG_MASK 0x00000018 +#define VIP_CONTROL2_FIELD2VG_SHIFT 3 + +#define VIP_CONTROL2_SYNC2VG_MASK 0x00000007 +#define VIP_CONTROL2_SYNC2VG_SHIFT 0 + +/* VIP_CONTROL3 REGISTER DEFINITIONS */ + +#define VIP_CONTROL3_PLANAR_DEINT 0x00000400 +#define VIP_CONTROL3_BASE_UPDATE 0x00000200 +#define VIP_CONTROL3_DISABLE_OVERFLOW 0x00000100 +#define VIP_CONTROL3_DECIMATE_EVEN 0x00000080 +#define VIP_CONTROL3_TASK_POLARITY 0x00000040 +#define VIP_CONTROL3_VSYNC_POLARITY 0x00000020 +#define VIP_CONTROL3_HSYNC_POLARITY 0x00000010 +#define VIP_CONTROL3_FIFO_RESET 0x00000001 + +/* VIP_STATUS REGISTER DEFINITIONS */ + +#define VIP_STATUS_ANC_COUNT_MASK 0xFF000000 +#define VIP_STATUS_ANC_COUNT_SHIFT 24 + +#define VIP_STATUS_FIFO_ERROR 0x00700000 +#define VIP_STATUS_ERROR_SHIFT 20 +#define VIP_STATUS_DEC_COUNT (1L << 18) +#define VIP_STATUS_SYNCOUT (1L << 17) +#define VIP_STATUS_BASEREG_NOTUPDT (1L << 16) +#define VIP_STATUS_MSGBUFF_ERR (1L << 14) +#define VIP_STATUS_MSGBUFF2_FULL (1L << 13) +#define VIP_STATUS_MSGBUFF1_FULL (1L << 12) +#define VIP_STATUS_WRITES_COMPLETE (1L << 9) +#define VIP_STATUS_FIFO_EMPTY (1L << 8) +#define VIP_STATUS_FIELD (1L << 4) +#define VIP_STATUS_VBLANK (1L << 3) + +#define VIP_STATUS_RUN_MASK 0x00000007 +#define VIP_STATUS_RUN_SHIFT 0 + +/* VIP_CURRENT_TARGET REGISTER DEFINITIONS */ + +#define VIP_CTARGET_TLINE_MASK 0xFFFF0000 +#define VIP_CTARGET_TLINE_SHIFT 16 + +#define VIP_CTARGET_CLINE_MASK 0x0000FFFF +#define VIP_CTARGET_CLINE_SHIFT 0 + +/* VIP_MAX_ADDRESS REGISTER DEFINITIONS */ + +#define VIP_MAXADDR_MASK 0xFFFFFFFF +#define VIP_MAXADDR_SHIFT 0 + +/* VIP BUFFER PITCH DEFINITIONS */ + +#define VIP_TASK_PITCH_MASK 0x0000FFFF +#define VIP_TASK_PITCH_SHIFT 0 + +/* VERTICAL START/STOP */ + +#define VIP_VSTART_VERTEND_MASK 0x0FFF0000 +#define VIP_VSTART_VERTEND_SHIFT 16 + +#define VIP_VSTART_VERTSTART_MASK 0x00000FFF +#define VIP_VSTART_VERTSTART_SHIFT 0 + +/* VIP FIFO ADDRESS DEFINITIONS */ + +#define VIP_FIFO_ADDRESS_MASK 0x000000FF +#define VIP_FIFO_ADDRESS_SHIFT 0 + +/* VIP VSYNC ERROR DEFINITIONS */ + +#define VIP_VSYNC_ERR_WINDOW_MASK 0xFF000000 +#define VIP_VSYNC_ERR_WINDOW_SHIFT 24 + +#define VIP_VSYNC_ERR_COUNT_MASK 0x00FFFFFF +#define VIP_VSYNC_ERR_COUNT_SHIFT 0 + +/*---------------------*/ +/* VIP MSR DEFINITIONS */ +/*---------------------*/ + +/* CAPABILITIES */ + +#define VIP_MSR_CAP_NSMI_MASK 0xF8000000 +#define VIP_MSR_CAP_NSMI_SHIFT 27 +#define VIP_MSR_CAP_NCLK_MASK 0x07000000 +#define VIP_MSR_CAP_NCLK_SHIFT 24 +#define VIP_MSR_CAP_DEVID_MASK 0x00FFFF00 +#define VIP_MSR_CAP_DEVID_SHIFT 8 +#define VIP_MSR_CAP_REVID_MASK 0x000000FF +#define VIP_MSR_CAP_REVID_SHIFT 0 + +/* MASTER CONFIG */ + +#define VIP_MSR_MCR_SECOND_PRIORITY_MASK 0x00000700 +#define VIP_MSR_MCR_SECOND_PRIORITY_SHIFT 8 +#define VIP_MSR_MCR_PRIMARY_PRIORITY_MASK 0x00000070 +#define VIP_MSR_MCR_PRIMARY_PRIORITY_SHIFT 4 +#define VIP_MSR_MCR_PID_MASK 0x00000007 +#define VIP_MSR_MCR_PID_SHIFT 0 + +/* VIP SMI */ + +#define VIP_MSR_SMI_FIFO_OVERFLOW (1L << 29) +#define VIP_MSR_SMI_FIFO_THRESHOLD (1L << 28) +#define VIP_MSR_SMI_LONGLINE (1L << 27) +#define VIP_MSR_SMI_VERTICAL_TIMING (1L << 26) +#define VIP_MSR_SMI_ACTIVE_PIXELS (1L << 25) +#define VIP_MSR_SMI_CLOCK_INPUT (1L << 24) +#define VIP_MSR_SMI_ANC_CHECKSUM_PARITY (1L << 23) +#define VIP_MSR_SMI_MSG_BUFFER_FULL (1L << 22) +#define VIP_MSR_SMI_END_VBLANK (1L << 21) +#define VIP_MSR_SMI_START_VBLANK (1L << 20) +#define VIP_MSR_SMI_START_EVEN (1L << 19) +#define VIP_MSR_SMI_START_ODD (1L << 18) +#define VIP_MSR_SMI_LINE_MATCH_TARGET (1L << 17) +#define VIP_MSR_SMI_GLINK (1L << 16) + +/* VIP ERROR */ + +#define VIP_MSR_ERROR_ADDRESS_MASK (1L << 17) +#define VIP_MSR_ERROR_ADDRESS_SHIFT 17 +#define VIP_MSR_ERROR_ADDRESS_ENABLE (1L << 1) +#define VIP_MSR_ERROR_ADDRESS_EN_SHIFT 1 +#define VIP_MSR_ERROR_TYPE_MASK (1L << 16) +#define VIP_MSR_ERROR_TYPE_SHIFT 16 +#define VIP_MSR_ERROR_TYPE_ENABLE 1 +#define VIP_MSR_ERROR_TYPE_EN_SHIFT 0 + +/* VIP POWER */ + +#define VIP_MSR_POWER_GLINK (1L << 0) +#define VIP_MSR_POWER_CLOCK (1L << 2) + +/* VIP DIAG */ + +#define VIP_MSR_DIAG_BIST_WMASK 0x00000003 +#define VIP_MSR_DIAG_BIST_RMASK 0x00000007 +#define VIP_MSR_DIAG_BIST_SHIFT 0 + +#define VIP_MSR_DIAG_MSB_ENABLE (1L << 31) +#define VIP_MSR_DIAG_SEL_UPPER_MASK 0x7FFF0000 +#define VIP_MSR_DIAG_SEL_UPPER_SHIFT 16 +#define VIP_MSR_DIAG_LSB_ENABLE (1L << 15) +#define VIP_MSR_DIAG_SEL_LOWER_MASK 0x00007FFF +#define VIP_MSR_DIAG_SEL_LOWER_SHIFT 0 + +/*----------------------------------------------------------------*/ +/* VOP DEFINITIONS */ +/*----------------------------------------------------------------*/ + +#define VOP_CONFIGURATION 0x00000800 +#define VOP_SIGNATURE 0x00000808 + +/* VOP_CONFIGURATION BIT DEFINITIONS */ + +#define VOP_CONFIG_SWAPVBI 0x01000000 +#define VOP_CONFIG_RGBMODE 0x00200000 +#define VOP_CONFIG_SIGVAL 0x00100000 +#define VOP_CONFIG_INVERT_DISPE 0x00080000 +#define VOP_CONFIG_INVERT_VSYNC 0x00040000 +#define VOP_CONFIG_INVERT_HSYNC 0x00020000 +#define VOP_CONFIG_SWAPUV 0x00010000 +#define VOP_CONFIG_VSYNC_MASK 0x0000C000 +#define VOP_CONFIG_DISABLE_DECIMATE 0x00002000 +#define VOP_CONFIG_ENABLE_601 0x00001000 +#define VOP_CONFIG_VBI 0x00000800 +#define VOP_CONFIG_TASK 0x00000200 +#define VOP_CONFIG_SIG_FREE_RUN 0x00000100 +#define VOP_CONFIG_ENABLE_SIGNATURE 0x00000080 +#define VOP_CONFIG_SC_COMPATIBLE 0x00000040 +#define VOP_CONFIG_422_COSITED 0x00000000 +#define VOP_CONFIG_422_INTERSPERSED 0x00000010 +#define VOP_CONFIG_422_ALTERNATING 0x00000020 +#define VOP_CONFIG_422_MASK 0x00000030 +#define VOP_CONFIG_EXTENDED_SAV 0x00000008 +#define VOP_CONFIG_VIP2_16BIT 0x00000004 +#define VOP_CONFIG_DISABLED 0x00000000 +#define VOP_CONFIG_VIP1_1 0x00000001 +#define VOP_CONFIG_VIP2_0 0x00000002 +#define VOP_CONFIG_CCIR656 0x00000003 +#define VOP_CONFIG_MODE_MASK 0x00000003 + +#endif diff --git a/driver/xf86-video-geode/src/cim/cim_rtns.h b/driver/xf86-video-geode/src/cim/cim_rtns.h new file mode 100644 index 000000000..60bdcd1c1 --- /dev/null +++ b/driver/xf86-video-geode/src/cim/cim_rtns.h @@ -0,0 +1,395 @@ +/* + * Copyright (c) 2006 Advanced Micro Devices, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + * Neither the name of the Advanced Micro Devices, Inc. nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + */ + + /* + * Cimarron function prototypes. + */ + +#ifndef _cim_rtns_h +#define _cim_rtns_h + +/* INCLUDE USER PARAMETER DEFINITIONS */ + +#include "cim_parm.h" + +/* COMPILER OPTION FOR C++ PROGRAMS */ + +#ifdef __cplusplus +extern "C" +{ +#endif + +/*--------------------------*/ +/* CIMARRON MEMORY POINTERS */ +/*--------------------------*/ + + extern unsigned char *cim_gp_ptr; + extern unsigned char *cim_fb_ptr; + extern unsigned char *cim_cmd_base_ptr; + extern unsigned char *cim_cmd_ptr; + extern unsigned char *cim_vid_ptr; + extern unsigned char *cim_vip_ptr; + extern unsigned char *cim_vg_ptr; + +/*----------------------------------------*/ +/* INITIALIZATION ROUTINE DEFINITIONS */ +/*----------------------------------------*/ + + int init_detect_cpu(unsigned long *cpu_revision, + unsigned long *companion_revision); + unsigned long init_read_pci(unsigned long address); + int init_read_base_addresses(INIT_BASE_ADDRESSES * base_addresses); + int init_read_cpu_frequency(unsigned long *cpu_frequency); + +/*----------------------------------------*/ +/* GRAPHICS PROCESSOR ROUTINE DEFINITIONS */ +/*----------------------------------------*/ + + void gp_set_limit_on_buffer_lead(unsigned long lead); + void gp_set_command_buffer_base(unsigned long address, + unsigned long start, unsigned long stop); + void gp_set_frame_buffer_base(unsigned long address, unsigned long size); + void gp_set_bpp(int bpp); + void gp_declare_blt(unsigned long flags); + void gp_declare_vector(unsigned long flags); + void gp_write_parameters(void); + void gp_set_raster_operation(unsigned char ROP); + void gp_set_alpha_operation(int alpha_operation, int alpha_type, + int channel, int apply_alpha, unsigned char alpha); + void gp_set_solid_pattern(unsigned long color); + void gp_set_mono_pattern(unsigned long bgcolor, unsigned long fgcolor, + unsigned long data0, unsigned long data1, int transparent, int x, + int y); + void gp_set_pattern_origin(int x, int y); + void gp_set_color_pattern(unsigned long *pattern, int format, int x, + int y); + void gp_set_mono_source(unsigned long bgcolor, unsigned long fgcolor, + int transparent); + void gp_set_solid_source(unsigned long color); + void gp_set_source_transparency(unsigned long color, unsigned long mask); + void gp_program_lut(unsigned long *colors, int full_lut); + void gp_set_vector_pattern(unsigned long pattern, unsigned long color, + int length); + void gp_set_strides(unsigned long dst_stride, unsigned long src_stride); + void gp_set_source_format(int format); + void gp_pattern_fill(unsigned long dstoffset, unsigned long width, + unsigned long height); + void gp_screen_to_screen_blt(unsigned long dstoffset, + unsigned long srcoffset, unsigned long width, + unsigned long height, int flags); + void gp_screen_to_screen_convert(unsigned long dstoffset, + unsigned long srcoffset, unsigned long width, + unsigned long height, int nibble); + void gp_color_bitmap_to_screen_blt(unsigned long dstoffset, + unsigned long srcx, unsigned long width, unsigned long height, + unsigned char *data, long pitch); + void gp_color_convert_blt(unsigned long dstoffset, unsigned long srcx, + unsigned long width, unsigned long height, unsigned char *data, + long pitch); + void gp_custom_convert_blt(unsigned long dstoffset, unsigned long srcx, + unsigned long width, unsigned long height, unsigned char *data, + long pitch); + void gp_rotate_blt(unsigned long dstoffset, unsigned long srcoffset, + unsigned long width, unsigned long height, int degrees); + void gp_mono_bitmap_to_screen_blt(unsigned long dstoffset, + unsigned long srcx, unsigned long width, unsigned long height, + unsigned char *data, long stride); + void gp_text_blt(unsigned long dstoffset, unsigned long width, + unsigned long height, unsigned char *data); + void gp_mono_expand_blt(unsigned long dstoffset, unsigned long srcoffset, + unsigned long srcx, unsigned long width, unsigned long height, + int byte_packed); + void gp_antialiased_text(unsigned long dstoffset, unsigned long srcx, + unsigned long width, unsigned long height, unsigned char *data, + long stride, int fourbpp); + void gp_blend_mask_blt(unsigned long dstoffset, unsigned long srcx, + unsigned long width, unsigned long height, unsigned long, + long stride, int operation, int fourbpp); + void gp_masked_blt(unsigned long dstoffset, unsigned long width, + unsigned long height, unsigned long mono_srcx, + unsigned long color_srcx, unsigned char *mono_mask, + unsigned char *color_data, long mono_pitch, long color_pitch); + void gp_screen_to_screen_masked(unsigned long dstoffset, + unsigned long srcoffset, unsigned long width, + unsigned long height, unsigned long mono_srcx, + unsigned char *mono_mask, long mono_pitch); + void gp_bresenham_line(unsigned long dstoffset, unsigned short length, + unsigned short initerr, unsigned short axialerr, + unsigned short diagerr, unsigned long flags); + void gp_line_from_endpoints(unsigned long dstoffset, unsigned long x0, + unsigned long y0, unsigned long x1, unsigned long y1, int inclusive); + + int gp_test_blt_pending(void); + void gp_wait_blt_pending(void); + void gp_wait_until_idle(void); + int gp_test_blt_busy(void); + void gp_save_state(GP_SAVE_RESTORE * gp_state); + void gp_restore_state(GP_SAVE_RESTORE * gp_state); + +/*----------------------------------------*/ +/* VIDEO GENERATOR ROUTINE DEFINITIONS */ +/*----------------------------------------*/ + + int vg_delay_milliseconds(unsigned long ms); + int vg_set_display_mode(unsigned long src_width, unsigned long src_height, + unsigned long dst_width, unsigned long dst_height, int bpp, int hz, + unsigned long flags); + int vg_set_panel_mode(unsigned long src_width, unsigned long src_height, + unsigned long dst_width, unsigned long dst_height, + unsigned long panel_width, unsigned long panel_height, + int bpp, unsigned long flags); + int vg_set_tv_mode(unsigned long *src_width, unsigned long *src_height, + unsigned long encoder, unsigned long tvres, int bpp, + unsigned long flags, unsigned long h_overscan, + unsigned long v_overscan); + int vg_set_custom_mode(VG_DISPLAY_MODE * mode_params, int bpp); + int vg_set_display_bpp(int bpp); + int vg_get_display_mode_index(VG_QUERY_MODE * query); + int vg_get_display_mode_information(unsigned int index, + VG_DISPLAY_MODE * vg_mode); + int vg_get_display_mode_count(void); + int vg_get_current_display_mode(VG_DISPLAY_MODE * current_display, + int *bpp); + int vg_set_scaler_filter_coefficients(long h_taps[][5], long v_taps[][3]); + int vg_configure_flicker_filter(unsigned long flicker_strength, + int flicker_alpha); + int vg_set_clock_frequency(unsigned long frequency, + unsigned long pll_flags); + int vg_set_border_color(unsigned long border_color); + int vg_set_cursor_enable(int enable); + int vg_set_mono_cursor_colors(unsigned long bkcolor, + unsigned long fgcolor); + int vg_set_cursor_position(long xpos, long ypos, + VG_PANNING_COORDINATES * panning); + int vg_set_mono_cursor_shape32(unsigned long memoffset, + unsigned long *andmask, unsigned long *xormask, + unsigned long x_hotspot, unsigned long y_hotspot); + int vg_set_mono_cursor_shape64(unsigned long memoffset, + unsigned long *andmask, unsigned long *xormask, + unsigned long x_hotspot, unsigned long y_hotspot); + int vg_set_color_cursor_shape(unsigned long memoffset, + unsigned char *data, unsigned long width, unsigned long height, + long pitch, unsigned long x_hotspot, unsigned long y_hotspot); + int vg_pan_desktop(unsigned long x, unsigned long y, + VG_PANNING_COORDINATES * panning); + int vg_set_display_offset(unsigned long address); + int vg_set_display_pitch(unsigned long pitch); + int vg_set_display_palette_entry(unsigned long index, + unsigned long palette); + int vg_set_display_palette(unsigned long *palette); + int vg_set_compression_enable(int enable); + int vg_configure_compression(VG_COMPRESSION_DATA * comp_data); + int vg_test_timing_active(void); + int vg_test_vertical_active(void); + int vg_wait_vertical_blank(void); + int vg_test_even_field(void); + int vg_configure_line_interrupt(VG_INTERRUPT_PARAMS * interrupt_info); + unsigned long vg_test_and_clear_interrupt(void); + unsigned long vg_test_flip_status(void); + int vg_save_state(VG_SAVE_RESTORE * vg_state); + int vg_restore_state(VG_SAVE_RESTORE * vg_state); + +/*----------------------------------------*/ +/* VIDEO GENERATOR READ ROUTINES */ +/*----------------------------------------*/ + + unsigned long vg_read_graphics_crc(int crc_source); + unsigned long vg_read_window_crc(int crc_source, unsigned long x, + unsigned long y, unsigned long width, unsigned long height); + int vg_get_scaler_filter_coefficients(long h_taps[][5], long v_taps[][3]); + int vg_get_flicker_filter_configuration(unsigned long *strength, + int *flicker_alpha); + unsigned long vg_get_display_pitch(void); + unsigned long vg_get_frame_buffer_line_size(void); + unsigned long vg_get_current_vline(void); + unsigned long vg_get_display_offset(void); + int vg_get_cursor_info(VG_CURSOR_DATA * cursor_data); + int vg_get_display_palette_entry(unsigned long index, + unsigned long *entry); + unsigned long vg_get_border_color(void); + int vg_get_display_palette(unsigned long *palette); + int vg_get_compression_info(VG_COMPRESSION_DATA * comp_data); + int vg_get_compression_enable(void); + int vg_get_valid_bit(int line); + +/*----------------------------------------*/ +/* DISPLAY FILTER ROUTINE DEFINITIONS */ +/*----------------------------------------*/ + + int df_set_crt_enable(int crt_output); + int df_set_panel_enable(int panel_output); + int df_configure_video_source(DF_VIDEO_SOURCE_PARAMS * video_source_odd, + DF_VIDEO_SOURCE_PARAMS * video_source_even); + int df_set_video_offsets(int even, unsigned long y_offset, + unsigned long u_offset, unsigned long v_offset); + int df_set_video_scale(unsigned long src_width, unsigned long src_height, + unsigned long dst_width, unsigned long dst_height, + unsigned long flags); + int df_set_video_position(DF_VIDEO_POSITION * video_window); + int df_set_video_filter_coefficients(long taps[][4], int phase256); + int df_set_video_enable(int enable, unsigned long flags); + int df_set_video_color_key(unsigned long key, unsigned long mask, + int graphics); + int df_set_video_palette(unsigned long *palette); + int df_set_video_palette_entry(unsigned long index, + unsigned long palette); + int df_configure_video_cursor_color_key(DF_VIDEO_CURSOR_PARAMS * + cursor_color_key); + int df_set_video_cursor_color_key_enable(int enable); + int df_configure_alpha_window(int window, + DF_ALPHA_REGION_PARAMS * alpha_data); + int df_set_alpha_window_enable(int window, int enable); + int df_set_no_ck_outside_alpha(int enable); + int df_set_video_request(unsigned long x, unsigned long y); + int df_set_output_color_space(int color_space); + int df_set_output_path(int format); + unsigned long df_test_video_flip_status(void); + int df_save_state(DF_SAVE_RESTORE * gp_state); + int df_restore_state(DF_SAVE_RESTORE * gp_state); + +/*----------------------------------------*/ +/* DISPLAY FILTER READ ROUTINES */ +/*----------------------------------------*/ + + unsigned long df_read_composite_crc(int crc_source); + unsigned long df_read_composite_window_crc(unsigned long x, + unsigned long y, unsigned long width, unsigned long height, + int source); + unsigned long df_read_panel_crc(void); + int df_get_video_enable(int *enable, unsigned long *flags); + int df_get_video_source_configuration(DF_VIDEO_SOURCE_PARAMS * + video_source_odd, DF_VIDEO_SOURCE_PARAMS * video_source_even); + int df_get_video_position(DF_VIDEO_POSITION * video_window); + int df_get_video_scale(unsigned long *x_scale, unsigned long *y_scale); + int df_get_video_filter_coefficients(long taps[][4], int *phase256); + int df_get_video_color_key(unsigned long *key, unsigned long *mask, + int *graphics); + int df_get_video_palette_entry(unsigned long index, + unsigned long *palette); + int df_get_video_palette(unsigned long *palette); + int df_get_video_cursor_color_key(DF_VIDEO_CURSOR_PARAMS * + cursor_color_key); + int df_get_video_cursor_color_key_enable(void); + int df_get_alpha_window_configuration(int window, + DF_ALPHA_REGION_PARAMS * alpha_data); + int df_get_alpha_window_enable(int window); + int df_get_video_request(unsigned long *x, unsigned long *y); + int df_get_output_color_space(int *color_space); + +/*----------------------------------------*/ +/* MSR ROUTINE DEFINITIONS */ +/*----------------------------------------*/ + + int msr_init_table(void); + int msr_create_geodelink_table(GEODELINK_NODE * gliu_nodes); + int msr_create_device_list(GEODELINK_NODE * gliu_nodes, int max_devices); + int msr_read64(unsigned long device, unsigned long msr_register, + Q_WORD * msr_value); + int msr_write64(unsigned long device, unsigned long msr_register, + Q_WORD * msr_value); + +/*----------------------------------------*/ +/* VIP ROUTINE DEFINITIONS */ +/*----------------------------------------*/ + + int vip_initialize(VIPSETMODEBUFFER * buffer); + int vip_update_601_params(VIP_601PARAMS * buffer); + int vip_terminate(void); + int vip_configure_capture_buffers(int buffer_type, + VIPINPUTBUFFER * buffer); + int vip_toggle_video_offsets(int buffer_type, VIPINPUTBUFFER * buffer); + int vip_max_address_enable(unsigned long max_address, int enable); + int vip_set_interrupt_enable(unsigned long mask, int enable); + unsigned long vip_get_interrupt_state(void); + int vip_set_capture_state(unsigned long state); + int vip_set_vsync_error(unsigned long vertical_count, + unsigned long window_before, unsigned long window_after, int enable); + int vip_configure_fifo(unsigned long fifo_type, unsigned long fifo_size); + int vip_set_loopback_enable(int bEnable); + int vip_configure_genlock(VIPGENLOCKBUFFER * buffer); + int vip_set_genlock_enable(int bEnable); + int vip_configure_pages(int page_count, unsigned long page_offset); + int vip_set_interrupt_line(int line); + int vip_reset(void); + int vip_set_subwindow_enable(VIPSUBWINDOWBUFFER * buffer); + int vip_reset_interrupt_state(unsigned long interrupt_mask); + + int vip_save_state(VIPSTATEBUFFER * save_buffer); + int vip_restore_state(VIPSTATEBUFFER * restore_buffer); + int vip_set_power_characteristics(VIPPOWERBUFFER * buffer); + int vip_set_priority_characteristics(VIPPRIORITYBUFFER * buffer); + int vip_set_debug_characteristics(VIPDEBUGBUFFER * buffer); + int vip_test_genlock_active(void); + int vip_test_signal_status(void); + unsigned long vip_get_current_field(void); + +/*----------------------------------------*/ +/* VIP READ ROUTINES */ +/*----------------------------------------*/ + + int vip_get_current_mode(VIPSETMODEBUFFER * buffer); + int vip_get_601_configuration(VIP_601PARAMS * buffer); + int vip_get_buffer_configuration(int buffer_type, + VIPINPUTBUFFER * buffer); + int vip_get_genlock_configuration(VIPGENLOCKBUFFER * buffer); + int vip_get_genlock_enable(void); + int vip_is_buffer_update_latched(void); + unsigned long vip_get_capture_state(void); + unsigned long vip_get_current_line(void); + unsigned long vip_read_fifo(unsigned long fifo_address); + int vip_write_fifo(unsigned long fifo_address, unsigned long fifo_data); + int vip_enable_fifo_access(int enable); + int vip_get_capability_characteristics(VIPCAPABILITIESBUFFER * buffer); + int vip_get_power_characteristics(VIPPOWERBUFFER * buffer); + int vip_get_priority_characteristics(VIPPRIORITYBUFFER * buffer); + +/*----------------------------------------*/ +/* VOP ROUTINE DEFINITIONS */ +/*----------------------------------------*/ + + int vop_set_vbi_window(VOPVBIWINDOWBUFFER * buffer); + int vop_enable_vbi_output(int enable); + int vop_set_configuration(VOPCONFIGURATIONBUFFER * config); + int vop_save_state(VOPSTATEBUFFER * save_buffer); + int vop_restore_state(VOPSTATEBUFFER * save_buffer); + +/*----------------------------------------*/ +/* VOP READ ROUTINES */ +/*----------------------------------------*/ + + int vop_get_current_mode(VOPCONFIGURATIONBUFFER * config); + int vop_get_vbi_configuration(VOPVBIWINDOWBUFFER * buffer); + int vop_get_vbi_enable(void); + unsigned long vop_get_crc(void); + unsigned long vop_read_vbi_crc(void); + +/* CLOSE BRACKET FOR C++ COMPLILATION */ + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/driver/xf86-video-geode/src/cim/cim_version.h b/driver/xf86-video-geode/src/cim/cim_version.h new file mode 100644 index 000000000..ee02b2d6e --- /dev/null +++ b/driver/xf86-video-geode/src/cim/cim_version.h @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2006 Advanced Micro Devices, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + * Neither the name of the Advanced Micro Devices, Inc. nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + */ + + /* + * Cimarron Version information + */ + +#define CIMARRON_REVISION 30103 diff --git a/driver/xf86-video-geode/src/cim/cim_vg.c b/driver/xf86-video-geode/src/cim/cim_vg.c new file mode 100644 index 000000000..6a8ea4973 --- /dev/null +++ b/driver/xf86-video-geode/src/cim/cim_vg.c @@ -0,0 +1,3711 @@ +/* + * Copyright (c) 2006 Advanced Micro Devices, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + * Neither the name of the Advanced Micro Devices, Inc. nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + */ + + /* + * Cimarron display controller routines. These routines program the display + * mode and configure the hardware cursor and video buffers. + */ + +/*---------------------*/ +/* CIMARRON VG GLOBALS */ +/*---------------------*/ + +CIMARRON_STATIC unsigned long vg3_x_hotspot = 0; +CIMARRON_STATIC unsigned long vg3_y_hotspot = 0; +CIMARRON_STATIC unsigned long vg3_cursor_offset = 0; +CIMARRON_STATIC unsigned long vg3_mode_width = 0; +CIMARRON_STATIC unsigned long vg3_mode_height = 0; +CIMARRON_STATIC unsigned long vg3_panel_width = 0; +CIMARRON_STATIC unsigned long vg3_panel_height = 0; +CIMARRON_STATIC unsigned long vg3_delta_x = 0; +CIMARRON_STATIC unsigned long vg3_delta_y = 0; +CIMARRON_STATIC unsigned long vg3_bpp = 0; + +CIMARRON_STATIC unsigned long vg3_color_cursor = 0; +CIMARRON_STATIC unsigned long vg3_panel_enable = 0; + +/*--------------------------------------------------------------------------- + * vg_delay_milliseconds + * + * This routine delays for a number of milliseconds based on a crude + * delay loop. + *--------------------------------------------------------------------------*/ + +int +vg_delay_milliseconds(unsigned long ms) +{ + /* ASSUME 500 MHZ 20 CLOCKS PER READ */ + + unsigned long loop = ms * 25000; + + while (loop-- > 0) { + READ_REG32(DC3_UNLOCK); + } + return CIM_STATUS_OK; +} + +/*--------------------------------------------------------------------------- + * vg_set_display_mode + * + * This routine sets a CRT display mode using predefined Cimarron timings. + * The source width and height are specified to allow scaling. + *--------------------------------------------------------------------------*/ + +int +vg_set_display_mode(unsigned long src_width, unsigned long src_height, + unsigned long dst_width, unsigned long dst_height, + int bpp, int hz, unsigned long flags) +{ + VG_QUERY_MODE crt_query; + VG_DISPLAY_MODE crt_mode; + int mode; + + crt_query.active_width = dst_width; + crt_query.active_height = dst_height; + crt_query.bpp = bpp; + crt_query.hz = hz; + crt_query.query_flags = VG_QUERYFLAG_ACTIVEWIDTH | + VG_QUERYFLAG_ACTIVEHEIGHT | VG_QUERYFLAG_BPP | VG_QUERYFLAG_REFRESH; + + mode = vg_get_display_mode_index(&crt_query); + if (mode >= 0) { + crt_mode = CimarronDisplayModes[mode]; + crt_mode.src_width = src_width; + crt_mode.src_height = src_height; + + /* ADD USER-REQUESTED FLAGS */ + + crt_mode.flags |= (flags & VG_MODEFLAG_VALIDUSERFLAGS); + + if (flags & VG_MODEFLAG_OVERRIDE_BAND) { + crt_mode.flags &= ~VG_MODEFLAG_BANDWIDTHMASK; + crt_mode.flags |= (flags & VG_MODEFLAG_BANDWIDTHMASK); + } + if (flags & VG_MODEFLAG_INT_OVERRIDE) { + crt_mode.flags &= ~VG_MODEFLAG_INT_MASK; + crt_mode.flags |= (flags & VG_MODEFLAG_INT_MASK); + } + + return vg_set_custom_mode(&crt_mode, bpp); + } + return CIM_STATUS_ERROR; +} + +/*--------------------------------------------------------------------------- + * vg_set_panel_mode + * + * This routine sets a panel mode using predefined Cimarron fixed timings. + * The source width and height specify the width and height of the data in + * the frame buffer. The destination width and height specify the width and + * height of the active data to be displayed. The panel width and height + * specify the dimensions of the panel. This interface allows the user to + * scale or center graphics data or both. To perform scaling, the src width + * or height should be different than the destination width or height. To + * perform centering or panning, the destination width and height should be + * different than the panel resolution. + *--------------------------------------------------------------------------*/ + +int +vg_set_panel_mode(unsigned long src_width, unsigned long src_height, + unsigned long dst_width, unsigned long dst_height, + unsigned long panel_width, unsigned long panel_height, + int bpp, unsigned long flags) +{ + unsigned long sync_width; + unsigned long sync_offset; + VG_QUERY_MODE panel_query; + VG_DISPLAY_MODE panel_mode; + int mode; + + /* SEARCH CIMARRON'S TABLE OF PREDEFINED PANEL MODES */ + /* If the destination resolution is larger than the panel resolution, */ + /* panning will be performed. However, the timings for a panned mode */ + /* are identical to the timings without panning. To save space in the */ + /* mode tables, there are no additional table entries for modes with */ + /* panning. Instead, we read the timings for a mode without panning */ + /* and override the structure entries that specify the width and */ + /* height of the mode. We perform a similar procedure for centered */ + /* modes, except that certain timing parameters are dynamically */ + /* calculated. */ + + panel_query.active_width = panel_width; + panel_query.active_height = panel_height; + panel_query.panel_width = panel_width; + panel_query.panel_height = panel_height; + panel_query.bpp = bpp; + panel_query.query_flags = VG_QUERYFLAG_ACTIVEWIDTH | + VG_QUERYFLAG_ACTIVEHEIGHT | + VG_QUERYFLAG_PANELWIDTH | + VG_QUERYFLAG_PANELHEIGHT | VG_QUERYFLAG_PANEL | VG_QUERYFLAG_BPP; + + mode = vg_get_display_mode_index(&panel_query); + + /* COPY THE DATA FROM THE MODE TABLE TO A TEMPORARY STRUCTURE */ + + if (mode >= 0) { + panel_mode = CimarronDisplayModes[mode]; + panel_mode.mode_width = dst_width; + panel_mode.mode_height = dst_height; + panel_mode.src_width = src_width; + panel_mode.src_height = src_height; + + /* ADD USER-REQUESTED FLAGS */ + + panel_mode.flags |= (flags & VG_MODEFLAG_VALIDUSERFLAGS); + + if (flags & VG_MODEFLAG_OVERRIDE_BAND) { + panel_mode.flags &= ~VG_MODEFLAG_BANDWIDTHMASK; + panel_mode.flags |= (flags & VG_MODEFLAG_BANDWIDTHMASK); + } + if (flags & VG_MODEFLAG_INT_OVERRIDE) { + panel_mode.flags &= ~VG_MODEFLAG_INT_MASK; + panel_mode.flags |= (flags & VG_MODEFLAG_INT_MASK); + } + + /* DYNAMICALLY CALCULATE CENTERED TIMINGS */ + /* For centered timings the blank start and blank end are set to */ + /* half the difference between the mode dimension and the panel */ + /* dimension. The sync pulse preserves the width and offset from */ + /* blanking whenever possible. */ + + if (dst_width < panel_width) { + sync_width = panel_mode.hsyncend - panel_mode.hsyncstart; + sync_offset = panel_mode.hsyncstart - panel_mode.hblankstart; + + panel_mode.hactive = dst_width; + panel_mode.hblankstart = + panel_mode.hactive + ((panel_width - dst_width) >> 1); + panel_mode.hblankend = + panel_mode.htotal - ((panel_width - dst_width) >> 1); + panel_mode.hsyncstart = panel_mode.hblankstart + sync_offset; + panel_mode.hsyncend = panel_mode.hsyncstart + sync_width; + + panel_mode.flags |= VG_MODEFLAG_CENTERED; + } + if (dst_height < panel_height) { + sync_width = panel_mode.vsyncend - panel_mode.vsyncstart; + sync_offset = panel_mode.vsyncstart - panel_mode.vblankstart; + + panel_mode.vactive = dst_height; + panel_mode.vblankstart = + panel_mode.vactive + ((panel_height - dst_height) >> 1); + panel_mode.vblankend = + panel_mode.vtotal - ((panel_height - dst_height) >> 1); + panel_mode.vsyncstart = panel_mode.vblankstart + sync_offset; + panel_mode.vsyncend = panel_mode.vsyncstart + sync_width; + + panel_mode.flags |= VG_MODEFLAG_CENTERED; + } + return vg_set_custom_mode(&panel_mode, bpp); + } + return CIM_STATUS_ERROR; +} + +/*--------------------------------------------------------------------------- + * vg_set_tv_mode + * + * This routine sets a TV display mode using predefined Cimarron timings. The + * source width and height are specified to allow scaling. + *--------------------------------------------------------------------------*/ + +int +vg_set_tv_mode(unsigned long *src_width, unsigned long *src_height, + unsigned long encoder, unsigned long tvres, int bpp, + unsigned long flags, unsigned long h_overscan, unsigned long v_overscan) +{ + unsigned long sync_width; + unsigned long sync_offset; + VG_QUERY_MODE tv_query; + VG_DISPLAY_MODE tv_mode; + int mode; + + if (!src_width || !src_height) + return CIM_STATUS_INVALIDPARAMS; + + tv_query.bpp = bpp; + tv_query.encoder = encoder; + tv_query.tvmode = tvres; + tv_query.query_flags = VG_QUERYFLAG_BPP | VG_QUERYFLAG_TVOUT | + VG_QUERYFLAG_ENCODER | VG_QUERYFLAG_TVMODE; + + mode = vg_get_display_mode_index(&tv_query); + if (mode >= 0) { + /* RETRIEVE THE UNSCALED RESOLUTION + * As we are indexing here simply by a mode and encoder, the actual + * timings may vary. A 0 value for source or height will thus query + * the unscaled resolution. + */ + + if (!(*src_width) || !(*src_height)) { + *src_width = CimarronDisplayModes[mode].hactive - + (h_overscan << 1); + *src_height = CimarronDisplayModes[mode].vactive; + + if (CimarronDisplayModes[mode].flags & VG_MODEFLAG_INTERLACED) { + if (((flags & VG_MODEFLAG_INT_OVERRIDE) && + (flags & VG_MODEFLAG_INT_MASK) == + VG_MODEFLAG_INT_LINEDOUBLE) + || (!(flags & VG_MODEFLAG_INT_OVERRIDE) + && (CimarronDisplayModes[mode]. + flags & VG_MODEFLAG_INT_MASK) == + VG_MODEFLAG_INT_LINEDOUBLE)) { + if (CimarronDisplayModes[mode].vactive_even > + CimarronDisplayModes[mode].vactive) + *src_height = CimarronDisplayModes[mode].vactive_even; + + /* ONLY 1/2 THE OVERSCAN FOR LINE DOUBLED MODES */ + + *src_height -= v_overscan; + } else { + *src_height += CimarronDisplayModes[mode].vactive_even; + *src_height -= v_overscan << 1; + } + } else { + *src_height -= v_overscan << 1; + } + + return CIM_STATUS_OK; + } + + tv_mode = CimarronDisplayModes[mode]; + tv_mode.src_width = *src_width; + tv_mode.src_height = *src_height; + + /* ADD USER-REQUESTED FLAGS */ + + tv_mode.flags |= (flags & VG_MODEFLAG_VALIDUSERFLAGS); + + if (flags & VG_MODEFLAG_OVERRIDE_BAND) { + tv_mode.flags &= ~VG_MODEFLAG_BANDWIDTHMASK; + tv_mode.flags |= (flags & VG_MODEFLAG_BANDWIDTHMASK); + } + if (flags & VG_MODEFLAG_INT_OVERRIDE) { + tv_mode.flags &= ~VG_MODEFLAG_INT_MASK; + tv_mode.flags |= (flags & VG_MODEFLAG_INT_MASK); + } + + /* ADJUST FOR OVERSCAN */ + + if (h_overscan) { + sync_width = tv_mode.hsyncend - tv_mode.hsyncstart; + sync_offset = tv_mode.hsyncstart - tv_mode.hblankstart; + + tv_mode.hactive -= h_overscan << 1; + tv_mode.hblankstart = tv_mode.hactive + h_overscan; + tv_mode.hblankend = tv_mode.htotal - h_overscan; + tv_mode.hsyncstart = tv_mode.hblankstart + sync_offset; + tv_mode.hsyncend = tv_mode.hsyncstart + sync_width; + + tv_mode.flags |= VG_MODEFLAG_CENTERED; + } + if (v_overscan) { + sync_width = tv_mode.vsyncend - tv_mode.vsyncstart; + sync_offset = tv_mode.vsyncstart - tv_mode.vblankstart; + + if (tv_mode.flags & VG_MODEFLAG_INTERLACED) { + tv_mode.vactive -= v_overscan; + tv_mode.vblankstart = tv_mode.vactive + (v_overscan >> 1); + tv_mode.vblankend = tv_mode.vtotal - (v_overscan >> 1); + tv_mode.vsyncstart = tv_mode.vblankstart + sync_offset; + tv_mode.vsyncend = tv_mode.vsyncstart + sync_width; + + sync_width = tv_mode.vsyncend_even - tv_mode.vsyncstart_even; + sync_offset = tv_mode.vsyncstart_even - + tv_mode.vblankstart_even; + + tv_mode.vactive_even -= v_overscan; + tv_mode.vblankstart_even = + tv_mode.vactive_even + (v_overscan >> 1); + tv_mode.vblankend_even = + tv_mode.vtotal_even - (v_overscan >> 1); + tv_mode.vsyncstart_even = + tv_mode.vblankstart_even + sync_offset; + tv_mode.vsyncend_even = tv_mode.vsyncstart_even + sync_width; + } else { + tv_mode.vactive -= v_overscan << 1; + tv_mode.vblankstart = tv_mode.vactive + v_overscan; + tv_mode.vblankend = tv_mode.vtotal - v_overscan; + tv_mode.vsyncstart = tv_mode.vblankstart + sync_offset; + tv_mode.vsyncend = tv_mode.vsyncstart + sync_width; + } + + tv_mode.flags |= VG_MODEFLAG_CENTERED; + } + + /* TV MODES WILL NEVER ALLOW PANNING */ + + tv_mode.panel_width = tv_mode.hactive; + tv_mode.panel_height = tv_mode.vactive; + tv_mode.mode_width = tv_mode.hactive; + tv_mode.mode_height = tv_mode.vactive; + + return vg_set_custom_mode(&tv_mode, bpp); + } + return CIM_STATUS_ERROR; +} + +/*--------------------------------------------------------------------------- + * vg_set_custom_mode + * + * This routine sets a display mode. The API is structured such that this + * routine can be called from four sources: + * - vg_set_display_mode + * - vg_set_panel_mode + * - vg_set_tv_mode + * - directly by the user for a custom mode. + *--------------------------------------------------------------------------*/ + +int +vg_set_custom_mode(VG_DISPLAY_MODE * mode_params, int bpp) +{ + unsigned long config, misc, temp; + unsigned long irq_ctl, genlk_ctl; + unsigned long unlock, flags; + unsigned long acfg, gcfg, dcfg; + unsigned long size, line_size, pitch; + unsigned long bpp_mask, dv_size; + unsigned long hscale, vscale, starting_width; + unsigned long starting_height, output_height; + Q_WORD msr_value; + + /* DETERMINE DIMENSIONS FOR SCALING */ + /* Scaling is performed before flicker filtering and interlacing */ + + output_height = mode_params->vactive; + + if (mode_params->flags & VG_MODEFLAG_INTERLACED) { + /* EVEN AND ODD FIELDS ARE SEPARATE + * The composite image height is the sum of the height of both + * fields + */ + + if ((mode_params->flags & VG_MODEFLAG_INT_MASK) == + VG_MODEFLAG_INT_FLICKER + || (mode_params->flags & VG_MODEFLAG_INT_MASK) == + VG_MODEFLAG_INT_ADDRESS) { + output_height += mode_params->vactive_even; + } + + /* LINE DOUBLING + * The composite image height is the greater of the two field + * heights. + */ + + else if (mode_params->vactive_even > output_height) + output_height = mode_params->vactive_even; + } + + /* CHECK FOR VALID SCALING FACTOR + * GeodeLX supports only 2:1 vertical downscale (before interlacing) and + * 2:1 horizontal downscale. The source width when scaling must be + * less than or equal to 1024 pixels. The destination can be any size, + * except when flicker filtering is enabled. + */ + + irq_ctl = 0; + if (mode_params->flags & VG_MODEFLAG_PANELOUT) { + if (mode_params->src_width != mode_params->mode_width) { + starting_width = (mode_params->hactive * mode_params->src_width) / + mode_params->mode_width; + hscale = (mode_params->src_width << 14) / + (mode_params->mode_width - 1); + irq_ctl |= (DC3_IRQFILT_ALPHA_FILT_EN | DC3_IRQFILT_GFX_FILT_EN); + } else { + starting_width = mode_params->hactive; + hscale = 0x4000; + } + if (mode_params->src_height != mode_params->mode_height) { + starting_height = (output_height * mode_params->src_height) / + mode_params->mode_height; + vscale = (mode_params->src_height << 14) / + (mode_params->mode_height - 1); + irq_ctl |= (DC3_IRQFILT_ALPHA_FILT_EN | DC3_IRQFILT_GFX_FILT_EN); + } else { + starting_height = output_height; + vscale = 0x4000; + } + } else { + starting_width = mode_params->src_width; + starting_height = mode_params->src_height; + if (mode_params->src_width != mode_params->hactive) { + hscale = (mode_params->src_width << 14) / + (mode_params->hactive - 1); + irq_ctl |= (DC3_IRQFILT_ALPHA_FILT_EN | DC3_IRQFILT_GFX_FILT_EN); + } else { + hscale = 0x4000; + } + if (mode_params->src_height != output_height) { + vscale = (mode_params->src_height << 14) / (output_height - 1); + irq_ctl |= (DC3_IRQFILT_ALPHA_FILT_EN | DC3_IRQFILT_GFX_FILT_EN); + } else { + vscale = 0x4000; + } + } + + starting_width = (starting_width + 7) & 0xFFFF8; + + if (mode_params->hactive < (starting_width >> 1) || + output_height < (starting_height >> 1) || + (irq_ctl && (starting_width > 1024))) { + return CIM_STATUS_INVALIDSCALE; + } + + /* VERIFY INTERLACED SCALING */ + /* The output width must be less than or equal to 1024 pixels when the */ + /* flicker filter is enabled. Also, scaling should be disabled when */ + /* the interlacing mode is set to interlaced addressing. */ + + if (mode_params->flags & VG_MODEFLAG_INTERLACED) { + if ((((mode_params->flags & VG_MODEFLAG_INT_MASK) == + VG_MODEFLAG_INT_FLICKER) && (mode_params->hactive > 1024)) + || (((mode_params->flags & VG_MODEFLAG_INT_MASK) == + VG_MODEFLAG_INT_ADDRESS) && irq_ctl)) { + return CIM_STATUS_INVALIDSCALE; + } + } + + /* CHECK FOR VALID BPP */ + + switch (bpp) { + case 8: + bpp_mask = DC3_DCFG_DISP_MODE_8BPP; + break; + case 24: + bpp_mask = DC3_DCFG_DISP_MODE_24BPP; + break; + case 32: + bpp_mask = DC3_DCFG_DISP_MODE_32BPP; + break; + case 12: + bpp_mask = DC3_DCFG_DISP_MODE_16BPP | DC3_DCFG_12BPP; + break; + case 15: + bpp_mask = DC3_DCFG_DISP_MODE_16BPP | DC3_DCFG_15BPP; + break; + case 16: + bpp_mask = DC3_DCFG_DISP_MODE_16BPP | DC3_DCFG_16BPP; + break; + default: + return CIM_STATUS_INVALIDPARAMS; + } + + vg3_bpp = bpp; + + /* CLEAR PANNING OFFSETS */ + + vg3_delta_x = 0; + vg3_delta_y = 0; + + /* SAVE PANEL PARAMETERS */ + + if (mode_params->flags & VG_MODEFLAG_PANELOUT) { + vg3_panel_enable = 1; + vg3_panel_width = mode_params->panel_width; + vg3_panel_height = mode_params->panel_height; + vg3_mode_width = mode_params->mode_width; + vg3_mode_height = mode_params->mode_height; + + /* INVERT THE SHIFT CLOCK IF REQUESTED */ + /* Note that we avoid writing the power management register if */ + /* we can help it. */ + + temp = READ_VID32(DF_POWER_MANAGEMENT); + if ((mode_params->flags & VG_MODEFLAG_INVERT_SHFCLK) && + !(temp & DF_PM_INVERT_SHFCLK)) { + WRITE_VID32(DF_POWER_MANAGEMENT, (temp | DF_PM_INVERT_SHFCLK)); + } else if (!(mode_params->flags & VG_MODEFLAG_INVERT_SHFCLK) && + (temp & DF_PM_INVERT_SHFCLK)) { + WRITE_VID32(DF_POWER_MANAGEMENT, (temp & ~DF_PM_INVERT_SHFCLK)); + } + + /* SET PANEL TIMING VALUES */ + + if (!(mode_params->flags & VG_MODEFLAG_NOPANELTIMINGS)) { + unsigned long pmtim1, pmtim2, dith_ctl; + + if (mode_params->flags & VG_MODEFLAG_XVGA_TFT) { + pmtim1 = DF_DEFAULT_XVGA_PMTIM1; + pmtim2 = DF_DEFAULT_XVGA_PMTIM2; + dith_ctl = DF_DEFAULT_DITHCTL; + msr_value.low = DF_DEFAULT_XVGA_PAD_SEL_LOW; + msr_value.high = DF_DEFAULT_XVGA_PAD_SEL_HIGH; + } else if (mode_params->flags & VG_MODEFLAG_CUSTOM_PANEL) { + pmtim1 = mode_params->panel_tim1; + pmtim2 = mode_params->panel_tim2; + dith_ctl = mode_params->panel_dither_ctl; + msr_value.low = mode_params->panel_pad_sel_low; + msr_value.high = mode_params->panel_pad_sel_high; + } else { + pmtim1 = DF_DEFAULT_TFT_PMTIM1; + pmtim2 = DF_DEFAULT_TFT_PMTIM2; + dith_ctl = DF_DEFAULT_DITHCTL; + msr_value.low = DF_DEFAULT_TFT_PAD_SEL_LOW; + msr_value.high = DF_DEFAULT_TFT_PAD_SEL_HIGH; + + } + WRITE_VID32(DF_VIDEO_PANEL_TIM1, pmtim1); + WRITE_VID32(DF_VIDEO_PANEL_TIM2, pmtim2); + WRITE_VID32(DF_DITHER_CONTROL, dith_ctl); + msr_write64(MSR_DEVICE_GEODELX_DF, DF_MSR_PAD_SEL, &msr_value); + } + + /* SET APPROPRIATE PANEL OUTPUT MODE */ + + msr_read64(MSR_DEVICE_GEODELX_DF, MSR_GEODELINK_CONFIG, &msr_value); + + msr_value.low &= ~DF_CONFIG_OUTPUT_MASK; + msr_value.low |= DF_OUTPUT_PANEL; + if (mode_params->flags & VG_MODEFLAG_CRT_AND_FP) + msr_value.low |= DF_SIMULTANEOUS_CRT_FP; + else + msr_value.low &= ~DF_SIMULTANEOUS_CRT_FP; + + msr_write64(MSR_DEVICE_GEODELX_DF, MSR_GEODELINK_CONFIG, &msr_value); + + } else if (mode_params->flags & VG_MODEFLAG_TVOUT) { + vg3_panel_enable = 0; + + /* SET APPROPRIATE TV OUTPUT MODE */ + + msr_read64(MSR_DEVICE_GEODELX_DF, MSR_GEODELINK_CONFIG, &msr_value); + + msr_value.low &= ~DF_CONFIG_OUTPUT_MASK; + msr_value.low |= DF_OUTPUT_PANEL; + if (mode_params->flags & VG_MODEFLAG_CRT_AND_FP) + msr_value.low |= DF_SIMULTANEOUS_CRT_FP; + else + msr_value.low &= ~DF_SIMULTANEOUS_CRT_FP; + + msr_write64(MSR_DEVICE_GEODELX_DF, MSR_GEODELINK_CONFIG, &msr_value); + + /* CONFIGURE PADS FOR VOP OUTPUT */ + /* Note that the VOP clock is currently always inverted. */ + + msr_value.low = DF_DEFAULT_TV_PAD_SEL_LOW; + msr_value.high = DF_DEFAULT_TV_PAD_SEL_HIGH; + msr_write64(MSR_DEVICE_GEODELX_DF, DF_MSR_PAD_SEL, &msr_value); + } else { + vg3_panel_enable = 0; + + /* SET OUTPUT TO CRT ONLY */ + + msr_read64(MSR_DEVICE_GEODELX_DF, MSR_GEODELINK_CONFIG, &msr_value); + msr_value.low &= ~DF_CONFIG_OUTPUT_MASK; + msr_value.low |= DF_OUTPUT_CRT; + msr_write64(MSR_DEVICE_GEODELX_DF, MSR_GEODELINK_CONFIG, &msr_value); + } + + /* SET UNLOCK VALUE */ + + unlock = READ_REG32(DC3_UNLOCK); + WRITE_REG32(DC3_UNLOCK, DC3_UNLOCK_VALUE); + + /*-------------------------------------------------------------------*/ + /* MAKE THE SYSTEM "SAFE" */ + /* Before setting a mode, we first ensure that the system is in a */ + /* benign quiescent state. This involves disabling compression and */ + /* all interrupt sources. It also involves terminating all accesses */ + /* to memory, including video, FIFO load, VIP and the GP. */ + /*-------------------------------------------------------------------*/ + + /* DISABLE VGA + * VGA *MUST* be turned off before TGEN is enabled. If not, a condition + * will result where VGA Enable is waiting for a VSync to be latched but + * a VSync will not be generated until VGA is disabled. + */ + + temp = READ_REG32(DC3_GENERAL_CFG) & ~DC3_GCFG_VGAE; + + /* DISABLE VIDEO (INCLUDING ALPHA WINDOWS) */ + + WRITE_VID32(DF_ALPHA_CONTROL_1, 0); + WRITE_VID32(DF_ALPHA_CONTROL_1 + 32, 0); + WRITE_VID32(DF_ALPHA_CONTROL_1 + 64, 0); + + WRITE_REG32(DC3_GENERAL_CFG, (temp & ~DC3_GCFG_VIDE)); + temp = READ_VID32(DF_VIDEO_CONFIG); + WRITE_VID32(DF_VIDEO_CONFIG, (temp & ~DF_VCFG_VID_EN)); + + /* DISABLE VG INTERRUPTS */ + + WRITE_REG32(DC3_IRQ, DC3_IRQ_MASK | DC3_VSYNC_IRQ_MASK | + DC3_IRQ_STATUS | DC3_VSYNC_IRQ_STATUS); + + /* DISABLE GENLOCK */ + + genlk_ctl = READ_REG32(DC3_GENLK_CTL); + WRITE_REG32(DC3_GENLK_CTL, (genlk_ctl & ~DC3_GC_GENLOCK_ENABLE)); + + /* DISABLE VIP CAPTURE AND VIP INTERRUPTS */ + + WRITE_VIP32(VIP_CONTROL1, 0); + WRITE_VIP32(VIP_CONTROL2, 0); + WRITE_VIP32(VIP_INTERRUPT, + VIP_ALL_INTERRUPTS | (VIP_ALL_INTERRUPTS >> 16)); + + /* DISABLE COLOR KEYING + * The color key mechanism should be disabled whenever a mode switch + * occurs. + */ + + temp = READ_REG32(DC3_COLOR_KEY); + WRITE_REG32(DC3_COLOR_KEY, (temp & ~DC3_CLR_KEY_ENABLE)); + + /* BLANK THE DISPLAY + * Note that we never blank the panel. Most flat panels have very long + * latency requirements when setting their power low. Some panels require + * upwards of 500ms before VDD goes high again. Needless to say, we are + * not planning to take over one half a second inside this routine. + */ + + misc = READ_VID32(DF_VID_MISC); + config = READ_VID32(DF_DISPLAY_CONFIG); + + WRITE_VID32(DF_VID_MISC, (misc | DF_DAC_POWER_DOWN)); + WRITE_VID32(DF_DISPLAY_CONFIG, + (config & ~(DF_DCFG_DIS_EN | DF_DCFG_HSYNC_EN | + DF_DCFG_VSYNC_EN | DF_DCFG_DAC_BL_EN))); + + /* DISABLE COMPRESSION */ + + gcfg = READ_REG32(DC3_GENERAL_CFG); + gcfg &= ~(DC3_GCFG_CMPE | DC3_GCFG_DECE); + WRITE_REG32(DC3_GENERAL_CFG, gcfg); + + /* DISABLE THE TIMING GENERATOR */ + + dcfg = READ_REG32(DC3_DISPLAY_CFG); + dcfg &= ~DC3_DCFG_TGEN; + WRITE_REG32(DC3_DISPLAY_CFG, dcfg); + + /* WAIT FOR PENDING MEMORY REQUESTS */ + + vg_delay_milliseconds(1); + + /* DISABLE DISPLAY FIFO LOAD */ + + gcfg &= ~DC3_GCFG_DFLE; + WRITE_REG32(DC3_GENERAL_CFG, gcfg); + gcfg = 0; + dcfg = 0; + + /* WAIT FOR THE GP TO BE IDLE (JUST IN CASE) */ + + while (((temp = READ_GP32(GP3_BLT_STATUS)) & GP3_BS_BLT_BUSY) || + !(temp & GP3_BS_CB_EMPTY)) { + ; + } + + /* SET THE DOT CLOCK FREQUENCY */ + + if (!(mode_params->flags & VG_MODEFLAG_EXCLUDEPLL)) { + if (mode_params->flags & VG_MODEFLAG_HALFCLOCK) + flags = VG_PLL_DIVIDE_BY_2; + else if (mode_params->flags & VG_MODEFLAG_QVGA) + flags = VG_PLL_DIVIDE_BY_4; + else + flags = 0; + + /* ALLOW DOTREF TO BE USED AS THE PLL */ + /* This is useful for some external TV encoders. */ + + if (mode_params->flags & VG_MODEFLAG_PLL_BYPASS) + flags |= VG_PLL_BYPASS; + + /* ALLOW THE USER TO MANUALLY ENTER THE MSR VALUE */ + + if (mode_params->flags & VG_MODEFLAG_MANUAL_FREQUENCY) + flags |= VG_PLL_MANUAL; + if (mode_params->flags & VG_MODEFLAG_VIP_TO_DOT_CLOCK) + flags |= VG_PLL_VIP_CLOCK; + + vg_set_clock_frequency(mode_params->frequency, flags); + } + + /* CLEAR ALL BUFFER OFFSETS */ + + WRITE_REG32(DC3_FB_ST_OFFSET, 0); + WRITE_REG32(DC3_CB_ST_OFFSET, 0); + WRITE_REG32(DC3_CURS_ST_OFFSET, 0); + + genlk_ctl = READ_REG32(DC3_GENLK_CTL) & ~(DC3_GC_ALPHA_FLICK_ENABLE | + DC3_GC_FLICKER_FILTER_ENABLE | DC3_GC_FLICKER_FILTER_MASK); + + /* ENABLE INTERLACING */ + + if (mode_params->flags & VG_MODEFLAG_INTERLACED) { + irq_ctl |= DC3_IRQFILT_INTL_EN; + + if ((mode_params->flags & VG_MODEFLAG_INT_MASK) == + VG_MODEFLAG_INT_ADDRESS) + irq_ctl |= DC3_IRQFILT_INTL_ADDR; + else if ((mode_params->flags & VG_MODEFLAG_INT_MASK) == + VG_MODEFLAG_INT_FLICKER) { + genlk_ctl |= DC3_GC_FLICKER_FILTER_1_8 | + DC3_GC_FLICKER_FILTER_ENABLE | DC3_GC_ALPHA_FLICK_ENABLE; + } + } + + WRITE_REG32(DC3_GFX_SCALE, (vscale << 16) | (hscale & 0xFFFF)); + WRITE_REG32(DC3_IRQ_FILT_CTL, irq_ctl); + WRITE_REG32(DC3_GENLK_CTL, genlk_ctl); + + /* SET LINE SIZE AND PITCH + * The line size and pitch are calculated from the src_width parameter + * passed in to this routine. All other parameters are ignored. + * The pitch is set either to a power of 2 to allow efficient + * compression or to a linear value to allow efficient memory management. + */ + + switch (bpp) { + case 8: + size = mode_params->src_width; + line_size = starting_width; + break; + + case 12: + case 15: + case 16: + + size = mode_params->src_width << 1; + line_size = starting_width << 1; + break; + + case 24: + case 32: + default: + + size = mode_params->src_width << 2; + line_size = starting_width << 2; + break; + } + + /* CALCULATE DV RAM SETTINGS AND POWER OF 2 PITCH */ + + pitch = 1024; + dv_size = DC3_DV_LINE_SIZE_1024; + + if (size > 1024) { + pitch = 2048; + dv_size = DC3_DV_LINE_SIZE_2048; + } + if (size > 2048) { + pitch = 4096; + dv_size = DC3_DV_LINE_SIZE_4096; + } + if (size > 4096) { + pitch = 8192; + dv_size = DC3_DV_LINE_SIZE_8192; + } + + /* OVERRIDE SETTINGS FOR LINEAR PITCH */ + + if (mode_params->flags & VG_MODEFLAG_LINEARPITCH) { + unsigned long max; + + if (pitch != size) { + /* CALCULATE MAXIMUM ADDRESS (1K ALIGNED) */ + + max = size * output_height; + max = (max + 0x3FF) & 0xFFFFFC00; + WRITE_REG32(DC3_DV_TOP, max | DC3_DVTOP_ENABLE); + + gcfg |= DC3_GCFG_FDTY; + pitch = size; + } else { + WRITE_REG32(DC3_DV_TOP, 0); + } + } + + /* WRITE PITCH AND DV RAM SETTINGS */ + /* The DV RAM line length is programmed at a power of 2 boundary */ + /* in case the user wants to toggle back to a power of 2 pitch */ + /* later. It could happen... */ + + temp = READ_REG32(DC3_DV_CTL); + WRITE_REG32(DC3_GFX_PITCH, pitch >> 3); + WRITE_REG32(DC3_DV_CTL, (temp & ~DC3_DV_LINE_SIZE_MASK) | dv_size); + + /* SET THE LINE SIZE */ + + WRITE_REG32(DC3_LINE_SIZE, (line_size + 7) >> 3); + + /* ALWAYS ENABLE VIDEO AND GRAPHICS DATA */ + /* These bits are relics from a previous design and */ + /* should always be enabled. */ + + dcfg |= (DC3_DCFG_VDEN | DC3_DCFG_GDEN); + + /* SET PIXEL FORMAT */ + + dcfg |= bpp_mask; + + /* ENABLE TIMING GENERATOR, TIM. REG. UPDATES, PALETTE BYPASS */ + /* AND VERT. INT. SELECT */ + + dcfg |= (unsigned long)(DC3_DCFG_TGEN | DC3_DCFG_TRUP | DC3_DCFG_PALB | + DC3_DCFG_VISL); + + /* SET FIFO PRIORITIES AND DISPLAY FIFO LOAD ENABLE + * Note that the bandwidth setting gets upgraded when scaling or flicker + * filtering are enabled, as they require more data throughput. + */ + + msr_read64(MSR_DEVICE_GEODELX_VG, DC3_SPARE_MSR, &msr_value); + msr_value.low &= ~(DC3_SPARE_DISABLE_CFIFO_HGO | + DC3_SPARE_VFIFO_ARB_SELECT | + DC3_SPARE_LOAD_WM_LPEN_MASK | DC3_SPARE_WM_LPEN_OVRD | + DC3_SPARE_DISABLE_INIT_VID_PRI | DC3_SPARE_DISABLE_VFIFO_WM); + + if ((mode_params->flags & VG_MODEFLAG_BANDWIDTHMASK) == + VG_MODEFLAG_HIGH_BAND + || ((mode_params->flags & VG_MODEFLAG_INTERLACED) + && (mode_params->flags & VG_MODEFLAG_INT_MASK) == + VG_MODEFLAG_INT_FLICKER) || (irq_ctl & DC3_IRQFILT_GFX_FILT_EN)) { + /* HIGH BANDWIDTH */ + /* Set agressive watermarks and disallow forced low priority */ + + gcfg |= 0x0000BA01; + dcfg |= 0x000EA000; + acfg = 0x001A0201; + + msr_value.low |= DC3_SPARE_DISABLE_CFIFO_HGO | + DC3_SPARE_VFIFO_ARB_SELECT | DC3_SPARE_WM_LPEN_OVRD; + } else if ((mode_params->flags & VG_MODEFLAG_BANDWIDTHMASK) == + VG_MODEFLAG_AVG_BAND) { + /* AVERAGE BANDWIDTH + * Set average watermarks and allow small regions of forced low + * priority. + */ + + gcfg |= 0x0000B601; + dcfg |= 0x00009000; + acfg = 0x00160001; + + msr_value.low |= DC3_SPARE_DISABLE_CFIFO_HGO | + DC3_SPARE_VFIFO_ARB_SELECT | DC3_SPARE_WM_LPEN_OVRD; + + /* SET THE NUMBER OF LOW PRIORITY LINES TO 1/2 THE TOTAL AVAILABLE */ + + temp = ((READ_REG32(DC3_V_ACTIVE_TIMING) >> 16) & 0x7FF) + 1; + temp -= (READ_REG32(DC3_V_SYNC_TIMING) & 0x7FF) + 1; + temp >>= 1; + if (temp > 127) + temp = 127; + + acfg |= temp << 9; + } else if ((mode_params->flags & VG_MODEFLAG_BANDWIDTHMASK) == + VG_MODEFLAG_LOW_BAND) { + /* LOW BANDWIDTH + * Set low watermarks and allow larger regions of forced low priority + */ + + gcfg |= 0x00009501; + dcfg |= 0x00008000; + acfg = 0x00150001; + + msr_value.low |= DC3_SPARE_DISABLE_CFIFO_HGO | + DC3_SPARE_VFIFO_ARB_SELECT | DC3_SPARE_WM_LPEN_OVRD; + + /* SET THE NUMBER OF LOW PRIORITY LINES TO 3/4 THE TOTAL AVAILABLE */ + + temp = ((READ_REG32(DC3_V_ACTIVE_TIMING) >> 16) & 0x7FF) + 1; + temp -= (READ_REG32(DC3_V_SYNC_TIMING) & 0x7FF) + 1; + temp = (temp * 3) >> 2; + if (temp > 127) + temp = 127; + + acfg |= temp << 9; + } else { + /* LEGACY CHARACTERISTICS */ + /* Arbitration from a single set of watermarks. */ + + gcfg |= 0x0000B601; + msr_value.low |= DC3_SPARE_DISABLE_VFIFO_WM | + DC3_SPARE_DISABLE_INIT_VID_PRI; + acfg = 0; + } + + msr_write64(MSR_DEVICE_GEODELX_VG, DC3_SPARE_MSR, &msr_value); + + /* ENABLE FLAT PANEL CENTERING */ + /* For panel modes having a resolution smaller than the */ + /* panel resolution, turn on data centering. */ + + if (mode_params->flags & VG_MODEFLAG_CENTERED) + dcfg |= DC3_DCFG_DCEN; + + /* COMBINE AND SET TIMING VALUES */ + + temp = (mode_params->hactive - 1) | ((mode_params->htotal - 1) << 16); + WRITE_REG32(DC3_H_ACTIVE_TIMING, temp); + temp = (mode_params->hblankstart - 1) | + ((mode_params->hblankend - 1) << 16); + WRITE_REG32(DC3_H_BLANK_TIMING, temp); + temp = (mode_params->hsyncstart - 1) | + ((mode_params->hsyncend - 1) << 16); + WRITE_REG32(DC3_H_SYNC_TIMING, temp); + temp = (mode_params->vactive - 1) | ((mode_params->vtotal - 1) << 16); + WRITE_REG32(DC3_V_ACTIVE_TIMING, temp); + temp = (mode_params->vblankstart - 1) | + ((mode_params->vblankend - 1) << 16); + WRITE_REG32(DC3_V_BLANK_TIMING, temp); + temp = (mode_params->vsyncstart - 1) | + ((mode_params->vsyncend - 1) << 16); + WRITE_REG32(DC3_V_SYNC_TIMING, temp); + temp = (mode_params->vactive_even - 1) | ((mode_params->vtotal_even - + 1) << 16); + WRITE_REG32(DC3_V_ACTIVE_EVEN, temp); + temp = (mode_params->vblankstart_even - 1) | + ((mode_params->vblankend_even - 1) << 16); + WRITE_REG32(DC3_V_BLANK_EVEN, temp); + temp = (mode_params->vsyncstart_even - 1) | + ((mode_params->vsyncend_even - 1) << 16); + WRITE_REG32(DC3_V_SYNC_EVEN, temp); + + /* SET THE VIDEO REQUEST REGISTER */ + + WRITE_VID32(DF_VIDEO_REQUEST, 0); + + /* SET SOURCE DIMENSIONS */ + + WRITE_REG32(DC3_FB_ACTIVE, ((starting_width - 1) << 16) | + (starting_height - 1)); + + /* SET SYNC POLARITIES */ + + temp = READ_VID32(DF_DISPLAY_CONFIG); + + temp &= ~(DF_DCFG_CRT_SYNC_SKW_MASK | DF_DCFG_PWR_SEQ_DLY_MASK | + DF_DCFG_CRT_HSYNC_POL | DF_DCFG_CRT_VSYNC_POL); + + temp |= (DF_DCFG_CRT_SYNC_SKW_INIT | + DF_DCFG_PWR_SEQ_DLY_INIT | DF_DCFG_GV_PAL_BYP); + + if (mode_params->flags & VG_MODEFLAG_NEG_HSYNC) + temp |= DF_DCFG_CRT_HSYNC_POL; + if (mode_params->flags & VG_MODEFLAG_NEG_VSYNC) + temp |= DF_DCFG_CRT_VSYNC_POL; + + WRITE_VID32(DF_DISPLAY_CONFIG, temp); + + WRITE_REG32(DC3_DISPLAY_CFG, dcfg); + WRITE_REG32(DC3_ARB_CFG, acfg); + WRITE_REG32(DC3_GENERAL_CFG, gcfg); + + /* RESTORE VALUE OF DC3_UNLOCK */ + + WRITE_REG32(DC3_UNLOCK, unlock); + + return CIM_STATUS_OK; +} + +/*--------------------------------------------------------------------------- + * vg_set_bpp + * + * This routine changes the display BPP on the fly. It is intended only to + * switch between pixel depths of the same pixel size 24<->32 or 15<->16, NOT + * between pixel depths of differing sizes 16<->32 + *--------------------------------------------------------------------------*/ + +int +vg_set_display_bpp(int bpp) +{ + unsigned long unlock, dcfg, bpp_mask; + + switch (bpp) { + case 8: + bpp_mask = DC3_DCFG_DISP_MODE_8BPP; + break; + case 24: + bpp_mask = DC3_DCFG_DISP_MODE_24BPP; + break; + case 32: + bpp_mask = DC3_DCFG_DISP_MODE_32BPP; + break; + case 12: + bpp_mask = DC3_DCFG_DISP_MODE_16BPP | DC3_DCFG_12BPP; + break; + case 15: + bpp_mask = DC3_DCFG_DISP_MODE_16BPP | DC3_DCFG_15BPP; + break; + case 16: + bpp_mask = DC3_DCFG_DISP_MODE_16BPP | DC3_DCFG_16BPP; + break; + default: + return CIM_STATUS_INVALIDPARAMS; + } + + unlock = READ_REG32(DC3_UNLOCK); + dcfg = READ_REG32(DC3_DISPLAY_CFG) & ~(DC3_DCFG_DISP_MODE_MASK | + DC3_DCFG_16BPP_MODE_MASK); + dcfg |= bpp_mask; + + WRITE_REG32(DC3_UNLOCK, DC3_UNLOCK_VALUE); + WRITE_REG32(DC3_DISPLAY_CFG, dcfg); + WRITE_REG32(DC3_UNLOCK, unlock); + + return CIM_STATUS_OK; +} + +/*--------------------------------------------------------------------------- + * vg_get_display_mode_index + * + * This routine searches the Cimarron mode table for a mode that matches the + * input parameters. If a match is found, the return value is the index into + * the mode table. If no match is found, the return value is -1. + *--------------------------------------------------------------------------*/ + +int +vg_get_display_mode_index(VG_QUERY_MODE * query) +{ + unsigned int mode; + unsigned long hz_flag = 0xFFFFFFFF; + unsigned long bpp_flag = 0xFFFFFFFF; + unsigned long enc_flag = 0xFFFFFFFF; + unsigned long tv_flag = 0; + unsigned long interlaced = 0; + unsigned long halfclock = 0; + long minimum = 0x7FFFFFFF; + long diff; + int match = -1; + + if (!query || !query->query_flags) + return -1; + + if (query->query_flags & VG_QUERYFLAG_REFRESH) { + /* SET FLAGS TO MATCH REFRESH RATE */ + + if (query->hz == 56) + hz_flag = VG_SUPPORTFLAG_56HZ; + else if (query->hz == 60) + hz_flag = VG_SUPPORTFLAG_60HZ; + else if (query->hz == 70) + hz_flag = VG_SUPPORTFLAG_70HZ; + else if (query->hz == 72) + hz_flag = VG_SUPPORTFLAG_72HZ; + else if (query->hz == 75) + hz_flag = VG_SUPPORTFLAG_75HZ; + else if (query->hz == 85) + hz_flag = VG_SUPPORTFLAG_85HZ; + else if (query->hz == 90) + hz_flag = VG_SUPPORTFLAG_90HZ; + else if (query->hz == 100) + hz_flag = VG_SUPPORTFLAG_100HZ; + else + hz_flag = 0; + } + + if (query->query_flags & VG_QUERYFLAG_BPP) { + /* SET BPP FLAGS TO LIMIT MODE SELECTION */ + + if (query->bpp == 8) + bpp_flag = VG_SUPPORTFLAG_8BPP; + else if (query->bpp == 12) + bpp_flag = VG_SUPPORTFLAG_12BPP; + else if (query->bpp == 15) + bpp_flag = VG_SUPPORTFLAG_15BPP; + else if (query->bpp == 16) + bpp_flag = VG_SUPPORTFLAG_16BPP; + else if (query->bpp == 24) + bpp_flag = VG_SUPPORTFLAG_24BPP; + else if (query->bpp == 32) + bpp_flag = VG_SUPPORTFLAG_32BPP; + else + bpp_flag = 0; + } + + if (query->query_flags & VG_QUERYFLAG_ENCODER) { + /* SET ENCODER FLAGS TO LIMIT MODE SELECTION */ + + if (query->encoder == VG_ENCODER_ADV7171) + enc_flag = VG_SUPPORTFLAG_ADV7171; + else if (query->encoder == VG_ENCODER_SAA7127) + enc_flag = VG_SUPPORTFLAG_SAA7127; + else if (query->encoder == VG_ENCODER_FS454) + enc_flag = VG_SUPPORTFLAG_FS454; + else if (query->encoder == VG_ENCODER_ADV7300) + enc_flag = VG_SUPPORTFLAG_ADV7300; + else + enc_flag = 0; + } + + if (query->query_flags & VG_QUERYFLAG_TVMODE) { + /* SET ENCODER FLAGS TO LIMIT MODE SELECTION */ + + if (query->tvmode == VG_TVMODE_NTSC) + tv_flag = VG_SUPPORTFLAG_NTSC; + else if (query->tvmode == VG_TVMODE_PAL) + tv_flag = VG_SUPPORTFLAG_PAL; + else if (query->tvmode == VG_TVMODE_480P) + tv_flag = VG_SUPPORTFLAG_480P; + else if (query->tvmode == VG_TVMODE_720P) + tv_flag = VG_SUPPORTFLAG_720P; + else if (query->tvmode == VG_TVMODE_1080I) + tv_flag = VG_SUPPORTFLAG_1080I; + else if (query->tvmode == VG_TVMODE_6X4_NTSC) + tv_flag = VG_SUPPORTFLAG_6X4_NTSC; + else if (query->tvmode == VG_TVMODE_8X6_NTSC) + tv_flag = VG_SUPPORTFLAG_8X6_NTSC; + else if (query->tvmode == VG_TVMODE_10X7_NTSC) + tv_flag = VG_SUPPORTFLAG_10X7_NTSC; + else if (query->tvmode == VG_TVMODE_6X4_PAL) + tv_flag = VG_SUPPORTFLAG_6X4_PAL; + else if (query->tvmode == VG_TVMODE_8X6_PAL) + tv_flag = VG_SUPPORTFLAG_8X6_PAL; + else if (query->tvmode == VG_TVMODE_10X7_PAL) + tv_flag = VG_SUPPORTFLAG_10X7_PAL; + else + tv_flag = 0xFFFFFFFF; + } + + /* SET APPROPRIATE TV AND VOP FLAGS */ + + if (query->query_flags & VG_QUERYFLAG_INTERLACED) + interlaced = query->interlaced ? VG_MODEFLAG_INTERLACED : 0; + if (query->query_flags & VG_QUERYFLAG_HALFCLOCK) + halfclock = query->halfclock ? VG_MODEFLAG_HALFCLOCK : 0; + + /* CHECK FOR INVALID REQUEST */ + + if (!hz_flag || !bpp_flag || !enc_flag || tv_flag == 0xFFFFFFFF) + return -1; + + /* LOOP THROUGH THE AVAILABLE MODES TO FIND A MATCH */ + + for (mode = 0; mode < NUM_CIMARRON_DISPLAY_MODES; mode++) { + if ((!(query->query_flags & VG_QUERYFLAG_PANEL) || + (CimarronDisplayModes[mode]. + internal_flags & VG_SUPPORTFLAG_PANEL)) + && (!(query->query_flags & VG_QUERYFLAG_TVOUT) + || (CimarronDisplayModes[mode]. + internal_flags & VG_SUPPORTFLAG_TVOUT)) + && (!(query->query_flags & VG_QUERYFLAG_INTERLACED) + || (CimarronDisplayModes[mode]. + flags & VG_MODEFLAG_INTERLACED) == interlaced) + && (!(query->query_flags & VG_QUERYFLAG_HALFCLOCK) + || (CimarronDisplayModes[mode]. + flags & VG_MODEFLAG_HALFCLOCK) == halfclock) + && (!(query->query_flags & VG_QUERYFLAG_PANELWIDTH) + || (CimarronDisplayModes[mode].panel_width == + query->panel_width)) + && (!(query->query_flags & VG_QUERYFLAG_PANELHEIGHT) + || (CimarronDisplayModes[mode].panel_height == + query->panel_height)) + && (!(query->query_flags & VG_QUERYFLAG_ACTIVEWIDTH) + || (CimarronDisplayModes[mode].hactive == + query->active_width)) + && (!(query->query_flags & VG_QUERYFLAG_ACTIVEHEIGHT) + || (CimarronDisplayModes[mode].vactive == + query->active_height)) + && (!(query->query_flags & VG_QUERYFLAG_TOTALWIDTH) + || (CimarronDisplayModes[mode].htotal == query->total_width)) + && (!(query->query_flags & VG_QUERYFLAG_TOTALHEIGHT) + || (CimarronDisplayModes[mode].vtotal == query->total_height)) + && (!(query->query_flags & VG_QUERYFLAG_BPP) + || (CimarronDisplayModes[mode].internal_flags & bpp_flag)) + && (!(query->query_flags & VG_QUERYFLAG_REFRESH) + || (CimarronDisplayModes[mode].internal_flags & hz_flag)) + && (!(query->query_flags & VG_QUERYFLAG_ENCODER) + || (CimarronDisplayModes[mode].internal_flags & enc_flag)) + && (!(query->query_flags & VG_QUERYFLAG_TVMODE) + || ((CimarronDisplayModes[mode]. + internal_flags & VG_SUPPORTFLAG_TVMODEMASK) == + tv_flag)) + && (!(query->query_flags & VG_QUERYFLAG_PIXELCLOCK) + || (CimarronDisplayModes[mode].frequency == + query->frequency))) { + /* ALLOW SEARCHING BASED ON AN APPROXIMATE PIXEL CLOCK */ + + if (query->query_flags & VG_QUERYFLAG_PIXELCLOCK_APPROX) { + diff = query->frequency - + CimarronDisplayModes[mode].frequency; + if (diff < 0) + diff = -diff; + + if (diff < minimum) { + minimum = diff; + match = mode; + } + } else { + match = mode; + break; + } + } + } + + /* RETURN DISPLAY MODE INDEX */ + + return match; +} + +/*--------------------------------------------------------------------------- + * vg_get_display_mode_information + * + * This routine retrieves all information for a display mode contained + * within Cimarron's mode tables. + *--------------------------------------------------------------------------*/ + +int +vg_get_display_mode_information(unsigned int index, VG_DISPLAY_MODE * vg_mode) +{ + if (index > NUM_CIMARRON_DISPLAY_MODES) + return CIM_STATUS_INVALIDPARAMS; + + *vg_mode = CimarronDisplayModes[index]; + return CIM_STATUS_OK; +} + +/*--------------------------------------------------------------------------- + * vg_get_display_mode_count + * + * This routine retrieves the count of all predefined Cimarron modes. + *--------------------------------------------------------------------------*/ + +int +vg_get_display_mode_count(void) +{ + return NUM_CIMARRON_DISPLAY_MODES; +} + +/*--------------------------------------------------------------------------- + * vg_get_current_display_mode + * + * This routine retrieves the settings for the current display. This includes + * any panel settings. + *--------------------------------------------------------------------------*/ + +int +vg_get_current_display_mode(VG_DISPLAY_MODE * current_display, int *bpp) +{ + Q_WORD msr_value; + unsigned long active, blank, sync; + unsigned long i, m, n, p; + unsigned long genlk, irq, temp; + unsigned long flags = 0; + unsigned long iflags = 0; + + /* READ THE CURRENT HORIZONTAL DISPLAY TIMINGS */ + + active = READ_REG32(DC3_H_ACTIVE_TIMING); + blank = READ_REG32(DC3_H_BLANK_TIMING); + sync = READ_REG32(DC3_H_SYNC_TIMING); + + current_display->hactive = (active & 0xFFF) + 1; + current_display->hblankstart = (blank & 0xFFF) + 1; + current_display->hsyncstart = (sync & 0xFFF) + 1; + + current_display->htotal = ((active >> 16) & 0xFFF) + 1; + current_display->hblankend = ((blank >> 16) & 0xFFF) + 1; + current_display->hsyncend = ((sync >> 16) & 0xFFF) + 1; + + /* READ THE CURRENT VERTICAL DISPLAY TIMINGS */ + + active = READ_REG32(DC3_V_ACTIVE_TIMING); + blank = READ_REG32(DC3_V_BLANK_TIMING); + sync = READ_REG32(DC3_V_SYNC_TIMING); + + current_display->vactive = (active & 0x7FF) + 1; + current_display->vblankstart = (blank & 0x7FF) + 1; + current_display->vsyncstart = (sync & 0x7FF) + 1; + + current_display->vtotal = ((active >> 16) & 0x7FF) + 1; + current_display->vblankend = ((blank >> 16) & 0x7FF) + 1; + current_display->vsyncend = ((sync >> 16) & 0x7FF) + 1; + + /* READ THE CURRENT EVEN FIELD VERTICAL DISPLAY TIMINGS */ + + active = READ_REG32(DC3_V_ACTIVE_EVEN); + blank = READ_REG32(DC3_V_BLANK_EVEN); + sync = READ_REG32(DC3_V_SYNC_EVEN); + + current_display->vactive_even = (active & 0x7FF) + 1; + current_display->vblankstart_even = (blank & 0x7FF) + 1; + current_display->vsyncstart_even = (sync & 0x7FF) + 1; + + current_display->vtotal_even = ((active >> 16) & 0x7FF) + 1; + current_display->vblankend_even = ((blank >> 16) & 0x7FF) + 1; + current_display->vsyncend_even = ((sync >> 16) & 0x7FF) + 1; + + /* READ THE CURRENT SOURCE DIMENSIONS */ + /* The DC3_FB_ACTIVE register is only used when scaling is enabled. */ + /* As the goal of this routine is to return a structure that can be */ + /* passed to vg_set_custom_mode to exactly recreate the current mode, */ + /* we must check the status of the scaler/filter. */ + + genlk = READ_REG32(DC3_GENLK_CTL); + irq = READ_REG32(DC3_IRQ_FILT_CTL); + temp = READ_REG32(DC3_FB_ACTIVE); + + current_display->src_height = (temp & 0xFFFF) + 1; + current_display->src_width = ((temp >> 16) & 0xFFF8) + 8; + + /* READ THE CURRENT PANEL CONFIGURATION */ + /* We can only infer some of the panel settings based on hardware */ + /* (like when panning). We will instead assume that the current */ + /* mode was set using Cimarron and use the panel variables inside */ + /* Cimarron when returning the current mode information. */ + + if (vg3_panel_enable) { + Q_WORD msr_value; + + flags |= VG_MODEFLAG_PANELOUT; + + current_display->panel_width = vg3_panel_width; + current_display->panel_height = vg3_panel_height; + current_display->mode_width = vg3_mode_width; + current_display->mode_height = vg3_mode_height; + + if (READ_REG32(DC3_DISPLAY_CFG) & DC3_DCFG_DCEN) + flags |= VG_MODEFLAG_CENTERED; + + msr_read64(MSR_DEVICE_GEODELX_DF, DF_MSR_PAD_SEL, &msr_value); + current_display->panel_tim1 = READ_VID32(DF_VIDEO_PANEL_TIM1); + current_display->panel_tim2 = READ_VID32(DF_VIDEO_PANEL_TIM2); + current_display->panel_dither_ctl = READ_VID32(DF_DITHER_CONTROL); + current_display->panel_pad_sel_low = msr_value.low; + current_display->panel_pad_sel_high = msr_value.high; + } + + /* SET MISCELLANEOUS MODE FLAGS */ + + /* INTERLACED */ + + if (irq & DC3_IRQFILT_INTL_EN) { + flags |= VG_MODEFLAG_INTERLACED; + if (irq & DC3_IRQFILT_INTL_ADDR) + flags |= VG_MODEFLAG_INT_ADDRESS; + else if (genlk & DC3_GC_FLICKER_FILTER_ENABLE) + flags |= VG_MODEFLAG_INT_FLICKER; + else + flags |= VG_MODEFLAG_INT_LINEDOUBLE; + } + + /* POLARITIES */ + + temp = READ_VID32(DF_DISPLAY_CONFIG); + if (temp & DF_DCFG_CRT_HSYNC_POL) + flags |= VG_MODEFLAG_NEG_HSYNC; + if (temp & DF_DCFG_CRT_VSYNC_POL) + flags |= VG_MODEFLAG_NEG_VSYNC; + + /* BPP */ + + temp = READ_REG32(DC3_DISPLAY_CFG) & DC3_DCFG_DISP_MODE_MASK; + if (temp == DC3_DCFG_DISP_MODE_8BPP) { + iflags |= VG_SUPPORTFLAG_8BPP; + *bpp = 8; + } else if (temp == DC3_DCFG_DISP_MODE_24BPP) { + iflags |= VG_SUPPORTFLAG_24BPP; + *bpp = 24; + } else if (temp == DC3_DCFG_DISP_MODE_32BPP) { + iflags |= VG_SUPPORTFLAG_32BPP; + *bpp = 32; + } else if (temp == DC3_DCFG_DISP_MODE_16BPP) { + temp = READ_REG32(DC3_DISPLAY_CFG) & DC3_DCFG_16BPP_MODE_MASK; + if (temp == DC3_DCFG_16BPP) { + iflags |= VG_SUPPORTFLAG_16BPP; + *bpp = 16; + } else if (temp == DC3_DCFG_15BPP) { + iflags |= VG_SUPPORTFLAG_15BPP; + *bpp = 15; + } else if (temp == DC3_DCFG_12BPP) { + iflags |= VG_SUPPORTFLAG_12BPP; + *bpp = 12; + } + } + + /* TV RELATED FLAGS */ + + msr_read64(MSR_DEVICE_GEODELX_DF, DF_MSR_PAD_SEL, &msr_value); + if (msr_value.high & DF_INVERT_VOP_CLOCK) + flags |= VG_MODEFLAG_TVOUT; + + /* LINEAR PITCH */ + + temp = (READ_REG32(DC3_GFX_PITCH) & 0x0000FFFF) << 3; + if (temp != 1024 && temp != 2048 && temp != 4096 && temp != 8192) + flags |= VG_MODEFLAG_LINEARPITCH; + + /* SIMULTANEOUS CRT/FP */ + + msr_read64(MSR_DEVICE_GEODELX_DF, MSR_GEODELINK_CONFIG, &msr_value); + if (msr_value.low & DF_SIMULTANEOUS_CRT_FP) + flags |= VG_MODEFLAG_CRT_AND_FP; + + /* SET PLL-RELATED FLAGS */ + + msr_read64(MSR_DEVICE_GEODELX_GLCP, GLCP_DOTPLL, &msr_value); + if (msr_value.high & GLCP_DOTPLL_DIV4) + flags |= VG_MODEFLAG_QVGA; + if (msr_value.low & GLCP_DOTPLL_HALFPIX) + flags |= VG_MODEFLAG_HALFCLOCK; + + /* SAVE THE FLAGS IN THE MODE STRUCTURE */ + + current_display->internal_flags = iflags; + current_display->flags = flags; + + /* READ PIXEL CLOCK FREQUENCY */ + /* We first search for an exact match. If none is found, we try */ + /* a fixed point calculation and return CIM_STATUS_INEXACTMATCH. */ + + for (i = 0; i < NUM_CIMARRON_PLL_FREQUENCIES; i++) { + if (CimarronPLLFrequencies[i].pll_value == msr_value.high) + break; + } + + if (i == NUM_CIMARRON_PLL_FREQUENCIES) { + /* ATTEMPT 16.16 CALCULATION */ + /* We assume the input frequency is 48 MHz, which is represented */ + /* in 16.16 fixed point as 0x300000. The PLL calculation is: */ + /* n + 1 */ + /* Fout = 48.000 * -------------- */ + /* m + 1 * p + 1 */ + + p = msr_value.high & 0xF; + n = (msr_value.high >> 4) & 0xFF; + m = (msr_value.high >> 12) & 0x7; + current_display->frequency = + (0x300000 * (n + 1)) / ((p + 1) * (m + 1)); + + return CIM_STATUS_INEXACTMATCH; + } + + current_display->frequency = CimarronPLLFrequencies[i].frequency; + + /* NOW SEARCH FOR AN IDENTICAL MODE */ + /* This is just to inform the user that an exact match was found. */ + /* With an exact match, the user can use the refresh rate flag that */ + /* is returned in the VG_DISPLAY_MODE structure. */ + + for (i = 0; i < NUM_CIMARRON_DISPLAY_MODES; i++) { + if ((CimarronDisplayModes[i].flags & current_display->flags) && + CimarronDisplayModes[i].frequency == + current_display->frequency && + CimarronDisplayModes[i].hactive == current_display->hactive && + CimarronDisplayModes[i].hblankstart == + current_display->hblankstart + && CimarronDisplayModes[i].hsyncstart == + current_display->hsyncstart + && CimarronDisplayModes[i].hsyncend == + current_display->hsyncend + && CimarronDisplayModes[i].hblankend == + current_display->hblankend + && CimarronDisplayModes[i].htotal == current_display->htotal + && CimarronDisplayModes[i].vactive == current_display->vactive + && CimarronDisplayModes[i].vblankstart == + current_display->vblankstart + && CimarronDisplayModes[i].vsyncstart == + current_display->vsyncstart + && CimarronDisplayModes[i].vsyncend == + current_display->vsyncend + && CimarronDisplayModes[i].vblankend == + current_display->vblankend + && CimarronDisplayModes[i].vtotal == current_display->vtotal) { + break; + } + } + + if (i == NUM_CIMARRON_DISPLAY_MODES) + return CIM_STATUS_INEXACTMATCH; + + current_display->internal_flags |= + (CimarronDisplayModes[i].internal_flags & VG_SUPPORTFLAG_HZMASK); + return CIM_STATUS_OK; +} + +/*--------------------------------------------------------------------------- + * vg_set_scaler_filter_coefficients + * + * This routine sets the vertical and horizontal filter coefficients for + * graphics scaling. If either of the input arrays is specified as NULL, a + * set of default coeffecients will be used. + *--------------------------------------------------------------------------*/ + +int +vg_set_scaler_filter_coefficients(long h_taps[][5], long v_taps[][3]) +{ + unsigned long irqfilt, i; + unsigned long temp0, temp1; + unsigned long lock; + + /* ENABLE ACCESS TO THE HORIZONTAL COEFFICIENTS */ + + irqfilt = READ_REG32(DC3_IRQ_FILT_CTL); + irqfilt |= DC3_IRQFILT_H_FILT_SEL; + + /* UNLOCK THE COEFFICIENT REGISTERS */ + + lock = READ_REG32(DC3_UNLOCK); + WRITE_REG32(DC3_UNLOCK, DC3_UNLOCK_VALUE); + + /* WRITE COEFFICIENTS */ + /* Coefficient indexes do not auto-increment, so we must */ + /* write the address for every phase */ + + for (i = 0; i < 256; i++) { + WRITE_REG32(DC3_IRQ_FILT_CTL, ((irqfilt & 0xFFFFFF00L) | i)); + + if (!h_taps) { + temp0 = CimarronHorizontalGraphicsFilter[i][0]; + temp1 = CimarronHorizontalGraphicsFilter[i][1]; + } else { + temp0 = ((unsigned long)h_taps[i][0] & 0x3FF) | + (((unsigned long)h_taps[i][1] & 0x3FF) << 10) | + (((unsigned long)h_taps[i][2] & 0x3FF) << 20); + + temp1 = ((unsigned long)h_taps[i][3] & 0x3FF) | + (((unsigned long)h_taps[i][4] & 0x3FF) << 10); + } + WRITE_REG32(DC3_FILT_COEFF1, temp0); + WRITE_REG32(DC3_FILT_COEFF2, temp1); + } + + /* ENABLE ACCESS TO THE VERTICAL COEFFICIENTS */ + + irqfilt &= ~DC3_IRQFILT_H_FILT_SEL; + + /* WRITE COEFFICIENTS */ + + for (i = 0; i < 256; i++) { + WRITE_REG32(DC3_IRQ_FILT_CTL, ((irqfilt & 0xFFFFFF00L) | i)); + + if (!v_taps) { + temp0 = CimarronVerticalGraphicsFilter[i]; + } else { + temp0 = ((unsigned long)v_taps[i][0] & 0x3FF) | + (((unsigned long)v_taps[i][1] & 0x3FF) << 10) | + (((unsigned long)v_taps[i][2] & 0x3FF) << 20); + } + + WRITE_REG32(DC3_FILT_COEFF1, temp0); + } + + WRITE_REG32(DC3_UNLOCK, lock); + + return CIM_STATUS_OK; +} + +/*--------------------------------------------------------------------------- + * vg_configure_flicker_filter + * + * This routine updates the VG flicker filter settings when in an interlaced + * mode. Note that flicker filtering is enabled inside a mode set. This routine + * is provided to change from the default flicker filter setting of + * 1/4, 1/2, 1/4. + *--------------------------------------------------------------------------*/ + +int +vg_configure_flicker_filter(unsigned long flicker_strength, int flicker_alpha) +{ + unsigned long unlock; + unsigned long genlk_ctl; + + /* CHECK FOR VALID FLICKER SETTING */ + + if (flicker_strength != VG_FLICKER_FILTER_NONE && + flicker_strength != VG_FLICKER_FILTER_1_16 && + flicker_strength != VG_FLICKER_FILTER_1_8 && + flicker_strength != VG_FLICKER_FILTER_1_4 && + flicker_strength != VG_FLICKER_FILTER_5_16) { + return CIM_STATUS_INVALIDPARAMS; + } + + unlock = READ_REG32(DC3_UNLOCK); + genlk_ctl = READ_REG32(DC3_GENLK_CTL) & ~(DC3_GC_FLICKER_FILTER_MASK | + DC3_GC_ALPHA_FLICK_ENABLE); + genlk_ctl |= flicker_strength; + if (flicker_alpha) + genlk_ctl |= DC3_GC_ALPHA_FLICK_ENABLE; + + WRITE_REG32(DC3_UNLOCK, DC3_UNLOCK_VALUE); + WRITE_REG32(DC3_GENLK_CTL, genlk_ctl); + WRITE_REG32(DC3_UNLOCK, unlock); + + return CIM_STATUS_OK; +} + +/*--------------------------------------------------------------------------- + * vg_set_clock_frequency + * + * This routine sets the frequency of the dot clock. The input to this + * routine is a 16.16 fraction. If an exact match is not found, this + * routine will program the closest available frequency and return + * CIM_STATUS_INEXACTMATCH. + *--------------------------------------------------------------------------*/ + +int +vg_set_clock_frequency(unsigned long frequency, unsigned long pll_flags) +{ + Q_WORD msr_value; + unsigned long timeout; + unsigned long index = 0; + unsigned long unlock, i; + unsigned long pll_high, pll_low; + long diff, min = 0; + + /* FIND THE REGISTER VALUES FOR THE DESIRED FREQUENCY */ + /* Search the table for the closest frequency (16.16 format). */ + /* This search is skipped if the user is manually specifying */ + /* the MSR value. */ + + pll_low = 0; + if (!(pll_flags & VG_PLL_MANUAL)) { + min = (long)CimarronPLLFrequencies[0].frequency - (long)frequency; + if (min < 0L) + min = -min; + + for (i = 1; i < NUM_CIMARRON_PLL_FREQUENCIES; i++) { + diff = (long)CimarronPLLFrequencies[i].frequency - + (long)frequency; + if (diff < 0L) + diff = -diff; + + if (diff < min) { + min = diff; + index = i; + } + } + + pll_high = CimarronPLLFrequencies[index].pll_value & 0x00007FFF; + } else { + pll_high = frequency; + } + + if (pll_flags & VG_PLL_DIVIDE_BY_2) + pll_low |= GLCP_DOTPLL_HALFPIX; + if (pll_flags & VG_PLL_DIVIDE_BY_4) + pll_high |= GLCP_DOTPLL_DIV4; + if (pll_flags & VG_PLL_BYPASS) + pll_low |= GLCP_DOTPLL_BYPASS; + if (pll_flags & VG_PLL_VIP_CLOCK) + pll_high |= GLCP_DOTPLL_VIPCLK; + + /* VERIFY THAT WE ARE NOT WRITING WHAT IS ALREADY IN THE REGISTERS */ + /* The Dot PLL reset bit is tied to VDD for flat panels. This can */ + /* cause a brief drop in flat panel power, which can cause serious */ + /* glitches on some panels. */ + + msr_read64(MSR_DEVICE_GEODELX_GLCP, GLCP_DOTPLL, &msr_value); + + if ((msr_value.low & GLCP_DOTPLL_LOCK) && + ((msr_value.low & (GLCP_DOTPLL_HALFPIX | GLCP_DOTPLL_BYPASS)) == + pll_low) && (msr_value.high == pll_high)) { + return CIM_STATUS_OK; + } + + /* PROGRAM THE SETTINGS WITH THE RESET BIT SET */ + /* Clear the bypass bit to ensure that the programmed */ + /* M, N and P values are being used. */ + + msr_value.high = pll_high; + msr_value.low &= ~(GLCP_DOTPLL_BYPASS | GLCP_DOTPLL_HALFPIX); + msr_value.low |= (pll_low | 0x00000001); + msr_write64(MSR_DEVICE_GEODELX_GLCP, GLCP_DOTPLL, &msr_value); + + /* WAIT FOR THE LOCK BIT */ + /* The PLL spec states that the PLL may take up to 100 us to */ + /* properly lock. Furthermore, the lock signal is not 100% */ + /* reliable. To address this, we add a hefty delay followed */ + /* by a polling loop that times out after a 1000 reads. */ + + unlock = READ_REG32(DC3_UNLOCK); + for (timeout = 0; timeout < 1280; timeout++) + WRITE_REG32(DC3_UNLOCK, unlock); + + for (timeout = 0; timeout < 1000; timeout++) { + msr_read64(MSR_DEVICE_GEODELX_GLCP, GLCP_DOTPLL, &msr_value); + if (msr_value.low & GLCP_DOTPLL_LOCK) + break; + } + + /* CLEAR THE RESET BIT */ + + msr_value.low &= 0xFFFFFFFE; + msr_write64(MSR_DEVICE_GEODELX_GLCP, GLCP_DOTPLL, &msr_value); + + /* DID THE PLL SUCCESSFULLY LOCK? */ + + if (!(msr_value.low & GLCP_DOTPLL_LOCK)) + return CIM_STATUS_NOLOCK; + + /* RETURN THE APPROPRIATE CODE */ + + if (min == 0) + return CIM_STATUS_OK; + else + return CIM_STATUS_INEXACTMATCH; +} + +/*--------------------------------------------------------------------------- + * vg_set_border_color + * + * This routine sets the color used as the border in centered panel modes. + *--------------------------------------------------------------------------*/ + +int +vg_set_border_color(unsigned long border_color) +{ + unsigned long lock = READ_REG32(DC3_UNLOCK); + + WRITE_REG32(DC3_UNLOCK, DC3_UNLOCK_VALUE); + WRITE_REG32(DC3_PAL_ADDRESS, 0x104); + WRITE_REG32(DC3_PAL_DATA, border_color); + WRITE_REG32(DC3_UNLOCK, lock); + + return CIM_STATUS_OK; +} + +/*--------------------------------------------------------------------------- + * vg_set_cursor_enable + * + * This routine enables or disables the hardware cursor. This routine should + * only be called after the hardware cursor has been completely configured. + *--------------------------------------------------------------------------*/ + +int +vg_set_cursor_enable(int enable) +{ + unsigned long unlock, gcfg; + + /* SET OR CLEAR CURSOR ENABLE BIT */ + + unlock = READ_REG32(DC3_UNLOCK); + gcfg = READ_REG32(DC3_GENERAL_CFG); + if (enable) + gcfg |= DC3_GCFG_CURE; + else + gcfg &= ~(DC3_GCFG_CURE); + + /* WRITE NEW REGISTER VALUE */ + + WRITE_REG32(DC3_UNLOCK, DC3_UNLOCK_VALUE); + WRITE_REG32(DC3_GENERAL_CFG, gcfg); + WRITE_REG32(DC3_UNLOCK, unlock); + + return CIM_STATUS_OK; +} + +/*--------------------------------------------------------------------------- + * vg_set_mono_cursor_colors + * + * This routine sets the colors of the hardware monochrome cursor. + *--------------------------------------------------------------------------*/ + +int +vg_set_mono_cursor_colors(unsigned long bkcolor, unsigned long fgcolor) +{ + unsigned long lock = READ_REG32(DC3_UNLOCK); + + /* SET CURSOR COLORS */ + + WRITE_REG32(DC3_UNLOCK, DC3_UNLOCK_VALUE); + WRITE_REG32(DC3_PAL_ADDRESS, 0x100); + WRITE_REG32(DC3_PAL_DATA, bkcolor); + WRITE_REG32(DC3_PAL_DATA, fgcolor); + WRITE_REG32(DC3_UNLOCK, lock); + + return CIM_STATUS_OK; +} + +/*--------------------------------------------------------------------------- + * vg_set_cursor_position + * + * This routine sets the position of the hardware cursor. The cursor hotspots + * and memory offset must have been specified in an earlier call to + * a vg_set_cursor_shape_XX routine. The coordinates passed to this routine + * generally specify the focal point of the cursor, NOT the upper left + * coordinate of the cursor pattern. However, for operating systems that do + * not include a hotspot the input parameters may be negative. + *--------------------------------------------------------------------------*/ + +int +vg_set_cursor_position(long xpos, long ypos, VG_PANNING_COORDINATES * panning) +{ + unsigned long unlock, memoffset; + unsigned long gcfg; + long x, xoffset; + long y, yoffset; + + memoffset = vg3_cursor_offset; + x = xpos - (long)vg3_x_hotspot; + y = ypos - (long)vg3_y_hotspot; + + /* HANDLE NEGATIVE COORDINATES */ + /* This routine supports operating systems that use negative */ + /* coordinates, instead of positive coordinates with an appropriate */ + /* hotspot. */ + + if (xpos < 0) + xpos = 0; + if (ypos < 0) + ypos = 0; + + if (x < -63) + return CIM_STATUS_INVALIDPARAMS; + if (y < -63) + return CIM_STATUS_INVALIDPARAMS; + + if (vg3_panel_enable) { + if ((vg3_mode_width > vg3_panel_width) + || (vg3_mode_height > vg3_panel_height)) { + vg_pan_desktop(xpos, ypos, panning); + x = x - (unsigned short)vg3_delta_x; + y = y - (unsigned short)vg3_delta_y; + } else { + panning->start_x = 0; + panning->start_y = 0; + panning->start_updated = 0; + } + } + + /* ADJUST OFFSETS */ + /* Cursor movement and panning work as follows: The cursor position */ + /* refers to where the hotspot of the cursor is located. However, for */ + /* non-zero hotspots, the cursor buffer actually begins before the */ + /* specified position. */ + + if (x < 0) { + xoffset = -x; + x = 0; + } else { + xoffset = 0; + } + if (y < 0) { + yoffset = -y; + y = 0; + } else { + yoffset = 0; + } + + if (vg3_color_cursor) + memoffset += (unsigned long)yoffset *192; + + else + memoffset += (unsigned long)yoffset << 4; + + /* SET COLOR CURSOR BIT */ + + gcfg = READ_REG32(DC3_GENERAL_CFG); + if (vg3_color_cursor) + gcfg |= DC3_GCFG_CLR_CUR; + else + gcfg &= ~DC3_GCFG_CLR_CUR; + + /* SET CURSOR POSITION */ + + unlock = READ_REG32(DC3_UNLOCK); + WRITE_REG32(DC3_UNLOCK, DC3_UNLOCK_VALUE); + WRITE_REG32(DC3_CURS_ST_OFFSET, memoffset); + WRITE_REG32(DC3_GENERAL_CFG, gcfg); + WRITE_REG32(DC3_CURSOR_X, (unsigned long)x | + (((unsigned long)xoffset) << 11)); + WRITE_REG32(DC3_CURSOR_Y, (unsigned long)y | + (((unsigned long)yoffset) << 11)); + WRITE_REG32(DC3_UNLOCK, unlock); + + return CIM_STATUS_OK; +} + +/*--------------------------------------------------------------------------- + * vg_set_mono_cursor_shape32 + * + * This routine loads 32x32 cursor data into the cursor buffer in graphics + * memory. The outside of the GeodeLX cursor buffer is padded with + * transparency. + *--------------------------------------------------------------------------*/ + +int +vg_set_mono_cursor_shape32(unsigned long memoffset, unsigned long *andmask, + unsigned long *xormask, unsigned long x_hotspot, unsigned long y_hotspot) +{ + int i; + + /* SAVE THE CURSOR OFFSET AND HOTSPOTS */ + /* These are reused later when updating the cursor position, panning */ + /* and clipping the cursor pointer. */ + + vg3_x_hotspot = x_hotspot; + vg3_y_hotspot = y_hotspot; + vg3_cursor_offset = memoffset; + vg3_color_cursor = 0; + + for (i = 0; i < 32; i++) { + /* EVEN QWORDS CONTAIN THE AND MASK */ + + WRITE_FB32(memoffset, 0xFFFFFFFF); + WRITE_FB32(memoffset + 4, andmask[i]); + + /* ODD QWORDS CONTAIN THE XOR MASK */ + + WRITE_FB32(memoffset + 8, 0x00000000); + WRITE_FB32(memoffset + 12, xormask[i]); + + memoffset += 16; + } + + /* FILL THE LOWER HALF OF THE BUFFER WITH TRANSPARENT PIXELS */ + + for (i = 0; i < 32; i++) { + WRITE_FB32(memoffset, 0xFFFFFFFF); + WRITE_FB32(memoffset + 4, 0xFFFFFFFF); + WRITE_FB32(memoffset + 8, 0x00000000); + WRITE_FB32(memoffset + 12, 0x00000000); + + memoffset += 16; + } + + return CIM_STATUS_OK; +} + +/*--------------------------------------------------------------------------- + * vg_set_mono_cursor_shape64 + * + * This routine loads 64x64 cursor data into the cursor buffer in graphics + * memory. + *--------------------------------------------------------------------------*/ + +int +vg_set_mono_cursor_shape64(unsigned long memoffset, unsigned long *andmask, + unsigned long *xormask, unsigned long x_hotspot, unsigned long y_hotspot) +{ + int i; + + /* SAVE THE CURSOR OFFSET AND HOTSPOTS */ + /* These are reused later when updating the cursor position, panning */ + /* and clipping the cursor pointer. */ + + vg3_x_hotspot = x_hotspot; + vg3_y_hotspot = y_hotspot; + vg3_cursor_offset = memoffset; + vg3_color_cursor = 0; + + for (i = 0; i < 128; i += 2) { + /* EVEN QWORDS CONTAIN THE AND MASK */ + /* We invert the dwords to prevent the calling */ + /* application from having to think in terms of Qwords. */ + /* The hardware data order is actually 63:0, or 31:0 of */ + /* the second dword followed by 31:0 of the first dword. */ + + WRITE_FB32(memoffset, andmask[i + 1]); + WRITE_FB32(memoffset + 4, andmask[i]); + + /* ODD QWORDS CONTAIN THE XOR MASK */ + + WRITE_FB32(memoffset + 8, xormask[i + 1]); + WRITE_FB32(memoffset + 12, xormask[i]); + + memoffset += 16; + } + + return CIM_STATUS_OK; +} + +/*--------------------------------------------------------------------------- + * vg_set_color_cursor_shape + * + * This routine loads 8:8:8:8 cursor data into the color cursor buffer. + *--------------------------------------------------------------------------*/ + +int +vg_set_color_cursor_shape(unsigned long memoffset, unsigned char *data, + unsigned long width, unsigned long height, long pitch, + unsigned long x_hotspot, unsigned long y_hotspot) +{ + unsigned long y; + + /* SAVE THE CURSOR OFFSET AND HOTSPOTS */ + /* These are reused later when updating the cursor position, panning */ + /* and clipping the cursor pointer. */ + + vg3_x_hotspot = x_hotspot; + vg3_y_hotspot = y_hotspot; + vg3_cursor_offset = memoffset; + vg3_color_cursor = 1; + + /* WRITE THE CURSOR DATA */ + /* The outside edges of the color cursor are filled with transparency */ + /* The cursor buffer dimensions are 48x64. */ + + for (y = 0; y < height; y++) { + /* WRITE THE ACTIVE AND TRANSPARENT DATA */ + /* We implement this as a macro in our dedication to squeaking */ + /* every ounce of performance out of our code... */ + + WRITE_FB_STRING32(memoffset, data, width); + WRITE_FB_CONSTANT((memoffset + (width << 2)), 0, (48 - width)); + + /* INCREMENT PAST THE LINE */ + + memoffset += 192; + data += pitch; + } + + /* WRITE THE EXTRA TRANSPARENT LINES */ + /* Write the lines in one big bulk setting. */ + + WRITE_FB_CONSTANT(memoffset, 0, ((64 - height) * 48)); + + return CIM_STATUS_OK; +} + +/*--------------------------------------------------------------------------- + * vg_pan_desktop + * + * This routine sets the correct display offset based on the current cursor + * position. + *--------------------------------------------------------------------------*/ + +int +vg_pan_desktop(unsigned long x, unsigned long y, + VG_PANNING_COORDINATES * panning) +{ + unsigned long modeShiftPerPixel; + unsigned long modeBytesPerScanline; + unsigned long startAddress; + + /* TEST FOR NO-WORK */ + + if (x >= vg3_delta_x && x < (vg3_panel_width + vg3_delta_x) && + y >= vg3_delta_y && y < (vg3_panel_height + vg3_delta_y)) { + panning->start_x = vg3_delta_x; + panning->start_y = vg3_delta_y; + panning->start_updated = 0; + return CIM_STATUS_OK; + } + + if (vg3_bpp == 24) + modeShiftPerPixel = 2; + else + modeShiftPerPixel = (vg3_bpp + 7) >> 4; + + modeBytesPerScanline = (READ_REG32(DC3_GFX_PITCH) & 0x0000FFFF) << 3; + + /* ADJUST PANNING VARIABLES WHEN CURSOR EXCEEDS BOUNDARY */ + /* Test the boundary conditions for each coordinate and update */ + /* all variables and the starting offset accordingly. */ + + if (x < vg3_delta_x) + vg3_delta_x = x; + else if (x >= (vg3_delta_x + vg3_panel_width)) + vg3_delta_x = x - vg3_panel_width + 1; + + if (y < vg3_delta_y) + vg3_delta_y = y; + else if (y >= (vg3_delta_y + vg3_panel_height)) + vg3_delta_y = y - vg3_panel_height + 1; + + /* CALCULATE THE START OFFSET */ + + startAddress = (vg3_delta_x << modeShiftPerPixel) + + (vg3_delta_y * modeBytesPerScanline); + + vg_set_display_offset(startAddress); + + panning->start_updated = 1; + panning->start_x = vg3_delta_x; + panning->start_y = vg3_delta_y; + return CIM_STATUS_OK; +} + +/*--------------------------------------------------------------------------- + * vg_set_display_offset + * + * This routine sets the start address of the frame buffer. It is + * typically used to pan across a virtual desktop (frame buffer larger than + * the displayed screen) or to flip the display between multiple buffers. + *--------------------------------------------------------------------------*/ + +int +vg_set_display_offset(unsigned long address) +{ + unsigned long lock, gcfg; + + lock = READ_REG32(DC3_UNLOCK); + WRITE_REG32(DC3_UNLOCK, DC3_UNLOCK_VALUE); + + /* DISABLE COMPRESSION */ + /* When setting a non-zero display offset, we must disable display */ + /* compression. We could maintain a variable and re-enable */ + /* compression when the offset returns to zero. However, that */ + /* creates additional complexity for applications that perform */ + /* graphics animation. Re-enabling compression each time would */ + /* be tedious and slow for such applications, implying that they */ + /* would have to disable compression before starting the animation. */ + /* We will instead disable compression and force the user to */ + /* re-enable compression when they are ready. */ + + if (address != 0) { + if (READ_REG32(DC3_GENERAL_CFG) & DC3_GCFG_CMPE) { + gcfg = READ_REG32(DC3_GENERAL_CFG); + WRITE_REG32(DC3_GENERAL_CFG, + (gcfg & ~(DC3_GCFG_CMPE | DC3_GCFG_DECE))); + } + } + + WRITE_REG32(DC3_FB_ST_OFFSET, address); + WRITE_REG32(DC3_UNLOCK, lock); + + return CIM_STATUS_OK; +} + +/*--------------------------------------------------------------------------- + * vg_set_display_pitch + * + * This routine sets the stride between successive lines of data in the frame + * buffer. + *--------------------------------------------------------------------------*/ + +int +vg_set_display_pitch(unsigned long pitch) +{ + unsigned long temp, dvsize, dvtop, value; + unsigned long lock = READ_REG32(DC3_UNLOCK); + + value = READ_REG32(DC3_GFX_PITCH) & 0xFFFF0000; + value |= (pitch >> 3); + + /* PROGRAM THE DISPLAY PITCH */ + + WRITE_REG32(DC3_UNLOCK, DC3_UNLOCK_VALUE); + WRITE_REG32(DC3_GFX_PITCH, value); + + /* SET THE COMPRESSION BEHAVIOR BASED ON THE PITCH */ + /* Strides that are not a power of two will not work with line */ + /* by line compression. For these cases, we enable full-screen */ + /* compression. In this mode, any write to the frame buffer */ + /* region marks the entire frame as dirty. Also, the DV line */ + /* size must be updated when the pitch is programmed outside of */ + /* the power of 2 range specified in a mode set. */ + + if (pitch > 4096) { + dvsize = DC3_DV_LINE_SIZE_8192; + } else if (pitch > 2048) { + dvsize = DC3_DV_LINE_SIZE_4096; + } else if (pitch > 1024) { + dvsize = DC3_DV_LINE_SIZE_2048; + } else { + dvsize = DC3_DV_LINE_SIZE_1024; + } + + temp = READ_REG32(DC3_DV_CTL); + WRITE_REG32(DC3_DV_CTL, + (temp & ~DC3_DV_LINE_SIZE_MASK) | dvsize | 0x00000001); + + value = READ_REG32(DC3_GENERAL_CFG); + + if (pitch == 1024 || pitch == 2048 || pitch == 4096 || pitch == 8192) { + value &= ~DC3_GCFG_FDTY; + dvtop = 0; + } else { + value |= DC3_GCFG_FDTY; + + dvtop = (READ_REG32(DC3_FB_ACTIVE) & 0xFFF) + 1; + dvtop = ((dvtop * pitch) + 0x3FF) & 0xFFFFFC00; + dvtop |= DC3_DVTOP_ENABLE; + } + + WRITE_REG32(DC3_GENERAL_CFG, value); + WRITE_REG32(DC3_DV_TOP, dvtop); + WRITE_REG32(DC3_UNLOCK, lock); + + return CIM_STATUS_OK; +} + +/*--------------------------------------------------------------------------- + * vg_set_display_palette_entry + * + * This routine sets a single 8BPP palette entry in the display controller. + *--------------------------------------------------------------------------*/ + +int +vg_set_display_palette_entry(unsigned long index, unsigned long palette) +{ + unsigned long dcfg, unlock; + + if (index > 0xFF) + return CIM_STATUS_INVALIDPARAMS; + + unlock = READ_REG32(DC3_UNLOCK); + dcfg = READ_REG32(DC3_DISPLAY_CFG); + + WRITE_REG32(DC3_UNLOCK, DC3_UNLOCK_VALUE); + WRITE_REG32(DC3_DISPLAY_CFG, dcfg & ~DC3_DCFG_PALB); + WRITE_REG32(DC3_UNLOCK, unlock); + + WRITE_REG32(DC3_PAL_ADDRESS, index); + WRITE_REG32(DC3_PAL_DATA, palette); + + return CIM_STATUS_OK; +} + +/*--------------------------------------------------------------------------- + * vg_set_display_palette + * + * This routine sets the entire palette in the display controller. + * A pointer is provided to a 256 entry table of 32-bit X:R:G:B values. + *--------------------------------------------------------------------------*/ + +int +vg_set_display_palette(unsigned long *palette) +{ + unsigned long unlock, dcfg, i; + + WRITE_REG32(DC3_PAL_ADDRESS, 0); + + if (palette) { + unlock = READ_REG32(DC3_UNLOCK); + dcfg = READ_REG32(DC3_DISPLAY_CFG); + + WRITE_REG32(DC3_UNLOCK, DC3_UNLOCK_VALUE); + WRITE_REG32(DC3_DISPLAY_CFG, dcfg & ~DC3_DCFG_PALB); + WRITE_REG32(DC3_UNLOCK, unlock); + + for (i = 0; i < 256; i++) + WRITE_REG32(DC3_PAL_DATA, palette[i]); + + return CIM_STATUS_OK; + } + return CIM_STATUS_INVALIDPARAMS; +} + +/*--------------------------------------------------------------------------- + * vg_set_compression_enable + * + * This routine enables or disables display compression. + *--------------------------------------------------------------------------*/ + +int +vg_set_compression_enable(int enable) +{ + Q_WORD msr_value; + unsigned long unlock, gcfg; + unsigned long temp; + + unlock = READ_REG32(DC3_UNLOCK); + gcfg = READ_REG32(DC3_GENERAL_CFG); + WRITE_REG32(DC3_UNLOCK, DC3_UNLOCK_VALUE); + + if (enable) { + /* DO NOT ENABLE IF THE DISPLAY OFFSET IS NOT ZERO */ + + if (READ_REG32(DC3_FB_ST_OFFSET) & 0x0FFFFFFF) + return CIM_STATUS_ERROR; + + /* ENABLE BIT 1 IN THE VG SPARE MSR + * The bus can hang when the VG attempts to merge compression writes. + * No performance is lost due to the GeodeLink QUACK features in + * GeodeLX. We also enable the command word check for a valid + * compression header. + */ + + msr_read64(MSR_DEVICE_GEODELX_VG, DC3_SPARE_MSR, &msr_value); + msr_value.low |= DC3_SPARE_FIRST_REQ_MASK; + msr_value.low &= ~DC3_SPARE_DISABLE_CWD_CHECK; + msr_write64(MSR_DEVICE_GEODELX_VG, DC3_SPARE_MSR, &msr_value); + + /* CLEAR DIRTY/VALID BITS IN MEMORY CONTROLLER + * We don't want the controller to think that old lines are still + * valid. Writing a 1 to bit 0 of the DV Control register will force + * the hardware to clear all the valid bits. + */ + + temp = READ_REG32(DC3_DV_CTL); + WRITE_REG32(DC3_DV_CTL, temp | 0x00000001); + + /* ENABLE COMPRESSION BITS */ + + gcfg |= DC3_GCFG_CMPE | DC3_GCFG_DECE; + } else { + gcfg &= ~(DC3_GCFG_CMPE | DC3_GCFG_DECE); + } + + WRITE_REG32(DC3_GENERAL_CFG, gcfg); + WRITE_REG32(DC3_UNLOCK, unlock); + + return CIM_STATUS_OK; +} + +/*--------------------------------------------------------------------------- + * vg_configure_compression + * + * This routine configures all aspects of display compression, including + * pitch, size and the offset of the compression buffer. + *--------------------------------------------------------------------------*/ + +int +vg_configure_compression(VG_COMPRESSION_DATA * comp_data) +{ + unsigned long delta, size; + unsigned long comp_size, unlock; + + /* CHECK FOR VALID PARAMETERS */ + /* The maximum size for the compression buffer is 544 bytes (with */ + /* the header) Also, the pitch cannot be less than the line size */ + /* and the compression buffer offset must be 16-byte aligned. */ + + if (comp_data->size > 544 || comp_data->pitch < comp_data->size || + comp_data->compression_offset & 0x0F) { + return CIM_STATUS_INVALIDPARAMS; + } + + /* SUBTRACT 32 FROM SIZE */ + /* The display controller will actually write 4 extra QWords. So, */ + /* if we assume that "size" refers to the allocated size, we must */ + /* subtract 32 bytes. */ + + comp_size = comp_data->size - 32; + + /* CALCULATE REGISTER VALUES */ + + unlock = READ_REG32(DC3_UNLOCK); + size = READ_REG32(DC3_LINE_SIZE) & ~DC3_LINE_SIZE_CBLS_MASK; + delta = READ_REG32(DC3_GFX_PITCH) & ~DC3_GFX_PITCH_CBP_MASK; + + size |= ((comp_size >> 3) + 1) << DC3_LINE_SIZE_CB_SHIFT; + delta |= ((comp_data->pitch >> 3) << 16); + + /* WRITE COMPRESSION PARAMETERS */ + + WRITE_REG32(DC3_UNLOCK, DC3_UNLOCK_VALUE); + WRITE_REG32(DC3_CB_ST_OFFSET, comp_data->compression_offset); + WRITE_REG32(DC3_LINE_SIZE, size); + WRITE_REG32(DC3_GFX_PITCH, delta); + WRITE_REG32(DC3_UNLOCK, unlock); + + return CIM_STATUS_OK; +} + +/*--------------------------------------------------------------------------- + * vg_test_timing_active + * + * This routine checks the status of the display timing generator. + *--------------------------------------------------------------------------*/ + +int +vg_test_timing_active(void) +{ + if (READ_REG32(DC3_DISPLAY_CFG) & DC3_DCFG_TGEN) + return 1; + + return 0; +} + +/*--------------------------------------------------------------------------- + * vg_test_vertical_active + * + * This routine checks if the display is currently in the middle of a frame + * (not in the VBlank interval) + *--------------------------------------------------------------------------*/ + +int +vg_test_vertical_active(void) +{ + if (READ_REG32(DC3_LINE_CNT_STATUS) & DC3_LNCNT_VNA) + return 0; + + return 1; +} + +/*--------------------------------------------------------------------------- + * vg_wait_vertical_blank + * + * This routine waits until the beginning of the vertical blank interval. + * When the display is already in vertical blank, this routine will wait until + * the beginning of the next vertical blank. + *--------------------------------------------------------------------------*/ + +int +vg_wait_vertical_blank(void) +{ + if (vg_test_timing_active()) { + while (!vg_test_vertical_active()) ; + while (vg_test_vertical_active()) ; + } + return CIM_STATUS_OK; +} + +/*--------------------------------------------------------------------------- + * vg_test_even_field + * + * This routine tests the odd/even status of the current VG output field. + *--------------------------------------------------------------------------*/ + +int +vg_test_even_field(void) +{ + if (READ_REG32(DC3_LINE_CNT_STATUS) & DC3_LNCNT_EVEN_FIELD) + return 1; + + return 0; +} + +/*--------------------------------------------------------------------------- + * vg_configure_line_interrupt + * + * This routine configures the display controller's line count interrupt. + * This interrupt can be used to interrupt mid-frame or to interrupt at the + * beginning of vertical blank. + *--------------------------------------------------------------------------*/ + +int +vg_configure_line_interrupt(VG_INTERRUPT_PARAMS * interrupt_info) +{ + unsigned long irq_line, irq_enable; + unsigned long lock; + + irq_line = READ_REG32(DC3_IRQ_FILT_CTL); + irq_enable = READ_REG32(DC3_IRQ); + lock = READ_REG32(DC3_UNLOCK); + + irq_line = (irq_line & ~DC3_IRQFILT_LINE_MASK) | + ((interrupt_info->line << 16) & DC3_IRQFILT_LINE_MASK); + + /* ENABLE OR DISABLE THE INTERRUPT */ + /* The line count is set before enabling and after disabling to */ + /* minimize spurious interrupts. The line count is set even */ + /* when interrupts are disabled to allow polling-based or debug */ + /* applications. */ + + WRITE_REG32(DC3_UNLOCK, DC3_UNLOCK_VALUE); + if (interrupt_info->enable) { + WRITE_REG32(DC3_IRQ_FILT_CTL, irq_line); + WRITE_REG32(DC3_IRQ, ((irq_enable & ~DC3_IRQ_MASK) | DC3_IRQ_STATUS)); + } else { + WRITE_REG32(DC3_IRQ, (irq_enable | DC3_IRQ_MASK)); + WRITE_REG32(DC3_IRQ_FILT_CTL, irq_line); + } + WRITE_REG32(DC3_UNLOCK, lock); + return CIM_STATUS_OK; +} + +/*--------------------------------------------------------------------------- + * vg_test_and_clear_interrupt + * + * This routine resets any pending interrupt in the video generator. The + * return value indicates the interrupt status prior to the reset. + *--------------------------------------------------------------------------*/ + +unsigned long +vg_test_and_clear_interrupt(void) +{ + unsigned long irq_enable; + unsigned long lock; + + irq_enable = READ_REG32(DC3_IRQ); + lock = READ_REG32(DC3_UNLOCK); + + /* NO ACTION IF INTERRUPTS ARE MASKED */ + /* We are assuming that a driver or application will not want to receive */ + /* the status of the interrupt when it is masked. */ + + if ((irq_enable & (DC3_IRQ_MASK | DC3_VSYNC_IRQ_MASK)) == + (DC3_IRQ_MASK | DC3_VSYNC_IRQ_MASK)) + return 0; + + WRITE_REG32(DC3_UNLOCK, DC3_UNLOCK_VALUE); + WRITE_REG32(DC3_IRQ, irq_enable); + WRITE_REG32(DC3_UNLOCK, lock); + + return (irq_enable & (DC3_IRQ_STATUS | DC3_VSYNC_IRQ_STATUS)); +} + +/*--------------------------------------------------------------------------- + * vg_test_flip_status + * + * This routine tests if a new display offset has been latched. + *--------------------------------------------------------------------------*/ + +unsigned long +vg_test_flip_status(void) +{ + return (READ_REG32(DC3_LINE_CNT_STATUS) & DC3_LNCNT_FLIP); +} + +/*--------------------------------------------------------------------------- + * vg_save_state + * + * This routine saves all persistent VG state information. + *--------------------------------------------------------------------------*/ + +int +vg_save_state(VG_SAVE_RESTORE * vg_state) +{ + Q_WORD msr_value; + unsigned long irqfilt; + unsigned long offset, i; + unsigned long lock; + + /* READ ALL CURRENT REGISTER SETTINGS */ + + vg_state->unlock = READ_REG32(DC3_UNLOCK); + vg_state->gcfg = READ_REG32(DC3_GENERAL_CFG); + vg_state->dcfg = READ_REG32(DC3_DISPLAY_CFG); + vg_state->arb_cfg = READ_REG32(DC3_ARB_CFG); + vg_state->fb_offset = READ_REG32(DC3_FB_ST_OFFSET); + vg_state->cb_offset = READ_REG32(DC3_CB_ST_OFFSET); + vg_state->cursor_offset = READ_REG32(DC3_CURS_ST_OFFSET); + vg_state->video_y_offset = READ_REG32(DC3_VID_Y_ST_OFFSET); + vg_state->video_u_offset = READ_REG32(DC3_VID_U_ST_OFFSET); + vg_state->video_v_offset = READ_REG32(DC3_VID_V_ST_OFFSET); + vg_state->dv_top = READ_REG32(DC3_DV_TOP); + vg_state->line_size = READ_REG32(DC3_LINE_SIZE); + vg_state->gfx_pitch = READ_REG32(DC3_GFX_PITCH); + vg_state->video_yuv_pitch = READ_REG32(DC3_VID_YUV_PITCH); + vg_state->h_active = READ_REG32(DC3_H_ACTIVE_TIMING); + vg_state->h_blank = READ_REG32(DC3_H_BLANK_TIMING); + vg_state->h_sync = READ_REG32(DC3_H_SYNC_TIMING); + vg_state->v_active = READ_REG32(DC3_V_ACTIVE_TIMING); + vg_state->v_blank = READ_REG32(DC3_V_BLANK_TIMING); + vg_state->v_sync = READ_REG32(DC3_V_SYNC_TIMING); + vg_state->fb_active = READ_REG32(DC3_FB_ACTIVE); + vg_state->cursor_x = READ_REG32(DC3_CURSOR_X); + vg_state->cursor_y = READ_REG32(DC3_CURSOR_Y); + vg_state->vid_ds_delta = READ_REG32(DC3_VID_DS_DELTA); + vg_state->fb_base = READ_REG32(DC3_PHY_MEM_OFFSET); + vg_state->dv_ctl = READ_REG32(DC3_DV_CTL); + vg_state->gfx_scale = READ_REG32(DC3_GFX_SCALE); + vg_state->irq_ctl = READ_REG32(DC3_IRQ_FILT_CTL); + vg_state->vbi_even_ctl = READ_REG32(DC3_VBI_EVEN_CTL); + vg_state->vbi_odd_ctl = READ_REG32(DC3_VBI_ODD_CTL); + vg_state->vbi_hor_ctl = READ_REG32(DC3_VBI_HOR); + vg_state->vbi_odd_line_enable = READ_REG32(DC3_VBI_LN_ODD); + vg_state->vbi_even_line_enable = READ_REG32(DC3_VBI_LN_EVEN); + vg_state->vbi_pitch = READ_REG32(DC3_VBI_PITCH); + vg_state->color_key = READ_REG32(DC3_COLOR_KEY); + vg_state->color_key_mask = READ_REG32(DC3_COLOR_MASK); + vg_state->color_key_x = READ_REG32(DC3_CLR_KEY_X); + vg_state->color_key_y = READ_REG32(DC3_CLR_KEY_Y); + vg_state->irq = READ_REG32(DC3_IRQ); + vg_state->genlk_ctl = READ_REG32(DC3_GENLK_CTL); + vg_state->vid_y_even_offset = READ_REG32(DC3_VID_EVEN_Y_ST_OFFSET); + vg_state->vid_u_even_offset = READ_REG32(DC3_VID_EVEN_U_ST_OFFSET); + vg_state->vid_v_even_offset = READ_REG32(DC3_VID_EVEN_V_ST_OFFSET); + vg_state->vactive_even = READ_REG32(DC3_V_ACTIVE_EVEN); + vg_state->vblank_even = READ_REG32(DC3_V_BLANK_EVEN); + vg_state->vsync_even = READ_REG32(DC3_V_SYNC_EVEN); + + /* READ THE CURRENT PALETTE */ + + lock = READ_REG32(DC3_UNLOCK); + WRITE_REG32(DC3_UNLOCK, DC3_UNLOCK_VALUE); + WRITE_REG32(DC3_PAL_ADDRESS, 0); + for (i = 0; i < 261; i++) + vg_state->palette[i] = READ_REG32(DC3_PAL_DATA); + + /* READ THE CURRENT FILTER COEFFICIENTS */ + + /* ENABLE ACCESS TO THE HORIZONTAL COEFFICIENTS */ + + irqfilt = READ_REG32(DC3_IRQ_FILT_CTL); + irqfilt |= DC3_IRQFILT_H_FILT_SEL; + + /* READ HORIZONTAL COEFFICIENTS */ + + for (i = 0; i < 256; i++) { + WRITE_REG32(DC3_IRQ_FILT_CTL, ((irqfilt & 0xFFFFFF00L) | i)); + + vg_state->h_coeff[(i << 1)] = READ_REG32(DC3_FILT_COEFF1); + vg_state->h_coeff[(i << 1) + 1] = READ_REG32(DC3_FILT_COEFF2); + } + + /* ENABLE ACCESS TO THE VERTICAL COEFFICIENTS */ + + irqfilt &= ~DC3_IRQFILT_H_FILT_SEL; + + /* READ COEFFICIENTS */ + + for (i = 0; i < 256; i++) { + WRITE_REG32(DC3_IRQ_FILT_CTL, ((irqfilt & 0xFFFFFF00L) | i)); + + vg_state->v_coeff[i] = READ_REG32(DC3_FILT_COEFF1); + } + + /* READ THE CURSOR DATA */ + + offset = READ_REG32(DC3_CURS_ST_OFFSET) & 0x0FFFFFFF; + for (i = 0; i < 3072; i++) + vg_state->cursor_data[i] = READ_FB32(offset + (i << 2)); + + /* READ THE CURRENT PLL */ + + msr_read64(MSR_DEVICE_GEODELX_GLCP, GLCP_DOTPLL, &msr_value); + + vg_state->pll_flags = 0; + for (i = 0; i < NUM_CIMARRON_PLL_FREQUENCIES; i++) { + if (CimarronPLLFrequencies[i].pll_value == (msr_value.high & 0x7FFF)) { + vg_state->dot_pll = CimarronPLLFrequencies[i].frequency; + break; + } + } + + if (i == NUM_CIMARRON_PLL_FREQUENCIES) { + /* NO MATCH */ + /* Enter the frequency as a manual frequency. */ + + vg_state->dot_pll = msr_value.high; + vg_state->pll_flags |= VG_PLL_MANUAL; + } + if (msr_value.low & GLCP_DOTPLL_HALFPIX) + vg_state->pll_flags |= VG_PLL_DIVIDE_BY_2; + if (msr_value.low & GLCP_DOTPLL_BYPASS) + vg_state->pll_flags |= VG_PLL_BYPASS; + if (msr_value.high & GLCP_DOTPLL_DIV4) + vg_state->pll_flags |= VG_PLL_DIVIDE_BY_4; + if (msr_value.high & GLCP_DOTPLL_VIPCLK) + vg_state->pll_flags |= VG_PLL_VIP_CLOCK; + + /* READ ALL VG MSRS */ + + msr_read64(MSR_DEVICE_GEODELX_VG, MSR_GEODELINK_CAP, + &(vg_state->msr_cap)); + msr_read64(MSR_DEVICE_GEODELX_VG, MSR_GEODELINK_CONFIG, + &(vg_state->msr_config)); + msr_read64(MSR_DEVICE_GEODELX_VG, MSR_GEODELINK_SMI, + &(vg_state->msr_smi)); + msr_read64(MSR_DEVICE_GEODELX_VG, MSR_GEODELINK_ERROR, + &(vg_state->msr_error)); + msr_read64(MSR_DEVICE_GEODELX_VG, MSR_GEODELINK_PM, &(vg_state->msr_pm)); + msr_read64(MSR_DEVICE_GEODELX_VG, MSR_GEODELINK_DIAG, + &(vg_state->msr_diag)); + msr_read64(MSR_DEVICE_GEODELX_VG, DC3_SPARE_MSR, &(vg_state->msr_spare)); + msr_read64(MSR_DEVICE_GEODELX_VG, DC3_RAM_CTL, &(vg_state->msr_ram_ctl)); + + WRITE_REG32(DC3_UNLOCK, lock); + + return CIM_STATUS_OK; +} + +/*--------------------------------------------------------------------------- + * vg_restore_state + * + * This routine restores all persistent VG state information. + *--------------------------------------------------------------------------*/ + +int +vg_restore_state(VG_SAVE_RESTORE * vg_state) +{ + unsigned long irqfilt, i; + unsigned long memoffset; + + /* TEMPORARILY UNLOCK ALL REGISTERS */ + + WRITE_REG32(DC3_UNLOCK, DC3_UNLOCK_VALUE); + + /* RESTORE THE FRAME BUFFER OFFSET */ + + WRITE_REG32(DC3_PHY_MEM_OFFSET, vg_state->fb_base); + + /* BLANK GCFG AND DCFG */ + + WRITE_REG32(DC3_GENERAL_CFG, 0); + WRITE_REG32(DC3_DISPLAY_CFG, 0); + + /* RESTORE ALL REGISTERS */ + + WRITE_REG32(DC3_ARB_CFG, vg_state->arb_cfg); + WRITE_REG32(DC3_FB_ST_OFFSET, vg_state->fb_offset); + WRITE_REG32(DC3_CB_ST_OFFSET, vg_state->cb_offset); + WRITE_REG32(DC3_CURS_ST_OFFSET, vg_state->cursor_offset); + WRITE_REG32(DC3_VID_Y_ST_OFFSET, vg_state->video_y_offset); + WRITE_REG32(DC3_VID_U_ST_OFFSET, vg_state->video_u_offset); + WRITE_REG32(DC3_VID_V_ST_OFFSET, vg_state->video_v_offset); + WRITE_REG32(DC3_DV_TOP, vg_state->dv_top); + WRITE_REG32(DC3_LINE_SIZE, vg_state->line_size); + WRITE_REG32(DC3_GFX_PITCH, vg_state->gfx_pitch); + WRITE_REG32(DC3_VID_YUV_PITCH, vg_state->video_yuv_pitch); + WRITE_REG32(DC3_H_ACTIVE_TIMING, vg_state->h_active); + WRITE_REG32(DC3_H_BLANK_TIMING, vg_state->h_blank); + WRITE_REG32(DC3_H_SYNC_TIMING, vg_state->h_sync); + WRITE_REG32(DC3_V_ACTIVE_TIMING, vg_state->v_active); + WRITE_REG32(DC3_V_BLANK_TIMING, vg_state->v_blank); + WRITE_REG32(DC3_V_SYNC_TIMING, vg_state->v_sync); + WRITE_REG32(DC3_FB_ACTIVE, vg_state->fb_active); + WRITE_REG32(DC3_CURSOR_X, vg_state->cursor_x); + WRITE_REG32(DC3_CURSOR_Y, vg_state->cursor_y); + WRITE_REG32(DC3_VID_DS_DELTA, vg_state->vid_ds_delta); + WRITE_REG32(DC3_PHY_MEM_OFFSET, vg_state->fb_base); + WRITE_REG32(DC3_DV_CTL, vg_state->dv_ctl | 0x00000001); + WRITE_REG32(DC3_GFX_SCALE, vg_state->gfx_scale); + WRITE_REG32(DC3_IRQ_FILT_CTL, vg_state->irq_ctl); + WRITE_REG32(DC3_VBI_EVEN_CTL, vg_state->vbi_even_ctl); + WRITE_REG32(DC3_VBI_ODD_CTL, vg_state->vbi_odd_ctl); + WRITE_REG32(DC3_VBI_HOR, vg_state->vbi_hor_ctl); + WRITE_REG32(DC3_VBI_LN_ODD, vg_state->vbi_odd_line_enable); + WRITE_REG32(DC3_VBI_LN_EVEN, vg_state->vbi_even_line_enable); + WRITE_REG32(DC3_VBI_PITCH, vg_state->vbi_pitch); + WRITE_REG32(DC3_COLOR_KEY, vg_state->color_key); + WRITE_REG32(DC3_COLOR_MASK, vg_state->color_key_mask); + WRITE_REG32(DC3_CLR_KEY_X, vg_state->color_key_x); + WRITE_REG32(DC3_CLR_KEY_Y, vg_state->color_key_y); + WRITE_REG32(DC3_IRQ, vg_state->irq); + WRITE_REG32(DC3_GENLK_CTL, vg_state->genlk_ctl); + WRITE_REG32(DC3_VID_EVEN_Y_ST_OFFSET, vg_state->vid_y_even_offset); + WRITE_REG32(DC3_VID_EVEN_U_ST_OFFSET, vg_state->vid_u_even_offset); + WRITE_REG32(DC3_VID_EVEN_V_ST_OFFSET, vg_state->vid_v_even_offset); + WRITE_REG32(DC3_V_ACTIVE_EVEN, vg_state->vactive_even); + WRITE_REG32(DC3_V_BLANK_EVEN, vg_state->vblank_even); + WRITE_REG32(DC3_V_SYNC_EVEN, vg_state->vsync_even); + + /* RESTORE THE PALETTE */ + + WRITE_REG32(DC3_PAL_ADDRESS, 0); + for (i = 0; i < 261; i++) + WRITE_REG32(DC3_PAL_DATA, vg_state->palette[i]); + + /* RESTORE THE HORIZONTAL FILTER COEFFICIENTS */ + + irqfilt = READ_REG32(DC3_IRQ_FILT_CTL); + irqfilt |= DC3_IRQFILT_H_FILT_SEL; + + for (i = 0; i < 256; i++) { + WRITE_REG32(DC3_IRQ_FILT_CTL, ((irqfilt & 0xFFFFFF00L) | i)); + WRITE_REG32(DC3_FILT_COEFF1, vg_state->h_coeff[(i << 1)]); + WRITE_REG32(DC3_FILT_COEFF2, vg_state->h_coeff[(i << 1) + 1]); + } + + /* RESTORE VERTICAL COEFFICIENTS */ + + irqfilt &= ~DC3_IRQFILT_H_FILT_SEL; + + for (i = 0; i < 256; i++) { + WRITE_REG32(DC3_IRQ_FILT_CTL, ((irqfilt & 0xFFFFFF00L) | i)); + WRITE_REG32(DC3_FILT_COEFF1, vg_state->v_coeff[i]); + } + + /* RESTORE THE CURSOR DATA */ + + memoffset = READ_REG32(DC3_CURS_ST_OFFSET) & 0x0FFFFFFF; + WRITE_FB_STRING32(memoffset, (unsigned char *)&(vg_state->cursor_data[0]), + 3072); + + /* RESTORE THE PLL */ + /* Use a common routine to use common code to poll for lock bit */ + + vg_set_clock_frequency(vg_state->dot_pll, vg_state->pll_flags); + + /* RESTORE ALL VG MSRS */ + + msr_write64(MSR_DEVICE_GEODELX_VG, MSR_GEODELINK_CAP, + &(vg_state->msr_cap)); + msr_write64(MSR_DEVICE_GEODELX_VG, MSR_GEODELINK_CONFIG, + &(vg_state->msr_config)); + msr_write64(MSR_DEVICE_GEODELX_VG, MSR_GEODELINK_SMI, + &(vg_state->msr_smi)); + msr_write64(MSR_DEVICE_GEODELX_VG, MSR_GEODELINK_ERROR, + &(vg_state->msr_error)); + msr_write64(MSR_DEVICE_GEODELX_VG, MSR_GEODELINK_PM, &(vg_state->msr_pm)); + msr_write64(MSR_DEVICE_GEODELX_VG, MSR_GEODELINK_DIAG, + &(vg_state->msr_diag)); + msr_write64(MSR_DEVICE_GEODELX_VG, DC3_SPARE_MSR, &(vg_state->msr_spare)); + msr_write64(MSR_DEVICE_GEODELX_VG, DC3_RAM_CTL, &(vg_state->msr_ram_ctl)); + + /* NOW RESTORE GCFG AND DCFG */ + + WRITE_REG32(DC3_DISPLAY_CFG, vg_state->dcfg); + WRITE_REG32(DC3_GENERAL_CFG, vg_state->gcfg); + + /* FINALLY RESTORE UNLOCK */ + + WRITE_REG32(DC3_UNLOCK, vg_state->unlock); + + return CIM_STATUS_OK; +} + +/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + * CIMARRON VG READ ROUTINES + * These routines are included for use in diagnostics or when debugging. They + * can be optionally excluded from a project. + *++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ + +#if CIMARRON_INCLUDE_VG_READ_ROUTINES + +/*--------------------------------------------------------------------------- + * vg_read_graphics_crc + * + * This routine reads the Cyclic Redundancy Check (CRC) value for the graphics + * frame. + *--------------------------------------------------------------------------*/ + +unsigned long +vg_read_graphics_crc(int crc_source) +{ + unsigned long gcfg, unlock; + unsigned long crc, vbi_even; + unsigned long interlaced; + unsigned long line, field; + + if (!(READ_REG32(DC3_DISPLAY_CFG) & DC3_DCFG_TGEN)) + return 0xFFFFFFFF; + + unlock = READ_REG32(DC3_UNLOCK); + gcfg = READ_REG32(DC3_GENERAL_CFG); + vbi_even = READ_REG32(DC3_VBI_EVEN_CTL); + + vbi_even &= ~DC3_VBI_EVEN_ENABLE_CRC; + + gcfg |= DC3_GCFG_SGRE | DC3_GCFG_CRC_MODE; + gcfg &= ~(DC3_GCFG_SGFR | DC3_GCFG_SIG_SEL | DC3_GCFG_FILT_SIG_SEL); + + switch (crc_source) { + case VG_CRC_SOURCE_PREFILTER_EVEN: + case VG_CRC_SOURCE_PREFILTER: + gcfg |= DC3_GCFG_SIG_SEL; + break; + case VG_CRC_SOURCE_PREFLICKER: + case VG_CRC_SOURCE_PREFLICKER_EVEN: + gcfg |= DC3_GCFG_FILT_SIG_SEL; + break; + case VG_CRC_SOURCE_POSTFLICKER: + case VG_CRC_SOURCE_POSTFLICKER_EVEN: /* NO WORK */ + break; + + default: + return 0xFFFFFFFF; + } + + if (crc_source & VG_CRC_SOURCE_EVEN) + field = 0; + else + field = DC3_LNCNT_EVEN_FIELD; + + if ((interlaced = (READ_REG32(DC3_IRQ_FILT_CTL) & DC3_IRQFILT_INTL_EN))) { + /* WAIT FOR THE BEGINNING OF THE FIELD (LINE 1-5) */ + /* Note that we wait for the field to be odd when CRCing the even */ + /* field and vice versa. This is because the CRC will not begin */ + /* until the following field. */ + + do { + line = READ_REG32(DC3_LINE_CNT_STATUS); + } while ((line & DC3_LNCNT_EVEN_FIELD) != field || + ((line & DC3_LNCNT_V_LINE_CNT) >> 16) < 10 || + ((line & DC3_LNCNT_V_LINE_CNT) >> 16) > 15); + } else { + /* NON-INTERLACED - EVEN FIELD CRCS ARE INVALID */ + + if (crc_source & VG_CRC_SOURCE_EVEN) + return 0xFFFFFFFF; + } + + WRITE_REG32(DC3_UNLOCK, DC3_UNLOCK_VALUE); + WRITE_REG32(DC3_VBI_EVEN_CTL, vbi_even); + WRITE_REG32(DC3_GENERAL_CFG, gcfg & ~DC3_GCFG_SIGE); + WRITE_REG32(DC3_GENERAL_CFG, gcfg | DC3_GCFG_SIGE); + + /* WAIT FOR THE CRC TO BE COMPLETED */ + + while (!(READ_REG32(DC3_LINE_CNT_STATUS) & DC3_LNCNT_SIGC)) ; + + /* READ THE COMPLETED CRC */ + + crc = READ_REG32(DC3_PAL_DATA); + + /* RESTORE THE PALETTE SETTINGS */ + + gcfg &= ~DC3_GCFG_SGRE; + WRITE_REG32(DC3_GENERAL_CFG, gcfg); + WRITE_REG32(DC3_UNLOCK, unlock); + + return crc; +} + +/*--------------------------------------------------------------------------- + * vg_read_window_crc + * + * This routine reads the Cyclic Redundancy Check (CRC) value for a sub- + * section of the frame. + *--------------------------------------------------------------------------*/ + +unsigned long +vg_read_window_crc(int crc_source, unsigned long x, unsigned long y, + unsigned long width, unsigned long height) +{ + Q_WORD msr_value; + unsigned long crc = 0; + unsigned long hactive, hblankstart; + unsigned long htotal, hblankend; + unsigned long line, field; + unsigned long diag; + + hactive = ((READ_REG32(DC3_H_ACTIVE_TIMING)) & 0xFFF) + 1; + hblankstart = ((READ_REG32(DC3_H_BLANK_TIMING)) & 0xFFF) + 1; + htotal = ((READ_REG32(DC3_H_ACTIVE_TIMING) >> 16) & 0xFFF) + 1; + hblankend = ((READ_REG32(DC3_H_BLANK_TIMING) >> 16) & 0xFFF) + 1; + + /* TIMINGS MUST BE ACTIVE */ + + if (!(READ_REG32(DC3_DISPLAY_CFG) & DC3_DCFG_TGEN)) + return 0xFFFFFFFF; + + /* DISABLE GLCP ACTIONS */ + + msr_value.low = 0; + msr_value.high = 0; + msr_write64(MSR_DEVICE_GEODELX_GLCP, GLCP_DIAGCTL, &msr_value); + + if ((x == 0 && width == 1) || x == 1) { + /* SPECIAL CASE FOR X == 0 */ + /* The comparator output is a clock late in the MCP, so we cannot */ + /* easily catch the first pixel. If the first pixel is desired, */ + /* we will insert a special state machine to CRC just the first */ + /* pixel. */ + + /* N2 - DISPE HIGH AND Y == 1 */ + /* Goto state YState = 2 */ + + msr_value.high = 0x00000002; + msr_value.low = 0x00000C00; + msr_write64(MSR_DEVICE_GEODELX_GLCP, GLCP_SETN0CTL + 2, &msr_value); + + /* M3 - DISPE HIGH AND Y == 0 */ + /* Goto YState = 1 */ + + msr_value.high = 0x00000002; + msr_value.low = 0x00000A00; + msr_write64(MSR_DEVICE_GEODELX_GLCP, GLCP_SETM0CTL + 3, &msr_value); + + /* N3 - DISPE LOW */ + /* Goto YState = 0 */ + + msr_value.high = 0x00080000; + msr_value.low = 0x00000000; + msr_write64(MSR_DEVICE_GEODELX_GLCP, GLCP_SETN0CTL + 3, &msr_value); + + /* Y0 -> Y1 (SET M3) */ + + msr_value.high = 0x00000000; + msr_value.low = 0x0000C000; + msr_write64(MSR_DEVICE_GEODELX_GLCP, GLCP_ACTION0 + 18, &msr_value); + + /* Y1 -> Y0 (SET N3) */ + + msr_value.low = 0x0000A000; + msr_write64(MSR_DEVICE_GEODELX_GLCP, GLCP_ACTION0 + 17, &msr_value); + + /* Y1 -> Y2 (SET N2) */ + + msr_value.low = 0x00000A00; + msr_write64(MSR_DEVICE_GEODELX_GLCP, GLCP_ACTION0 + 19, &msr_value); + + /* N5 (XSTATE = 10 && CMP2 <= V. COUNTER <= CMP3) &&DISPE&& Y == 0 */ + /* CRC into REGB */ + + msr_value.high = 0x00000002; + msr_value.low = 0x10800B20; + msr_write64(MSR_DEVICE_GEODELX_GLCP, GLCP_SETN0CTL + 5, &msr_value); + + /* N6 (XSTATE = 10 && CMP2 <= V. COUNTER <= CMP3) && DISPE&&Y == 1 */ + /* CRC into REGB */ + + msr_value.high = 0x00000002; + msr_value.low = 0x10800D20; + msr_write64(MSR_DEVICE_GEODELX_GLCP, GLCP_SETN0CTL + 6, &msr_value); + } + + /* M4 (XSTATE = 00 AND VSYNC HIGH) */ + /* Goto state 01 */ + /* Note: VSync = H3A */ + + msr_value.high = 0x00000001; + msr_value.low = 0x000000A0; + msr_write64(MSR_DEVICE_GEODELX_GLCP, GLCP_SETM0CTL + 4, &msr_value); + + /* N0 (XSTATE = 01 AND VSYNC LOW) */ + /* Goto state 02 */ + /* Note: VSync low = H3B */ + + msr_value.high = 0x00040000; + msr_value.low = 0x000000C0; + msr_write64(MSR_DEVICE_GEODELX_GLCP, GLCP_SETN0CTL, &msr_value); + + /* M5 (XSTATE = 10 AND VSYNC HIGH) */ + /* Goto state 11 */ + + msr_value.high = 0x00000001; + msr_value.low = 0x00000120; + msr_write64(MSR_DEVICE_GEODELX_GLCP, GLCP_SETM0CTL + 5, &msr_value); + + /* N1 (XSTATE = 10 and DISPE HIGH) */ + /* Increment H. Counter */ + /* Note: DispE = H4 */ + + msr_value.high = 0x00000002; + msr_value.low = 0x00000120; + msr_write64(MSR_DEVICE_GEODELX_GLCP, GLCP_SETN0CTL + 1, &msr_value); + + /* M0 (XSTATE = 10 and H. COUNTER == LIMIT) */ + /* Clear H. Counter and increment V. Counter */ + + msr_value.high = 0x00000000; + msr_value.low = 0x00000122; + msr_write64(MSR_DEVICE_GEODELX_GLCP, GLCP_SETM0CTL, &msr_value); + + /* N4 (XSTATE = 10 && CMP0 <= H. COUNTER <= CMP1 && CMP2 <= V. COUNTER + * <= CMP3) && DISPE + * CRC into REGB + */ + + msr_value.high = 0x00000002; + msr_value.low = 0x10C20120; + msr_write64(MSR_DEVICE_GEODELX_GLCP, GLCP_SETN0CTL + 4, &msr_value); + + /* COMPARATOR 0 VALUE */ + /* We subtract 1 to account for a pipeline delay in the GLCP. */ + /* When the x coordinate is 0, we must play a special game. */ + /* If the width is exactly 1, we will set up a state machine */ + /* to only CRC the first pixel. Otherwise, we will set it */ + /* as an OR combination of a state that CRCs the first pixel */ + /* and a state that CRCs 1 clock delayed width (width - 1) */ + + msr_value.high = 0; + if (x > 1) + msr_value.low = (x - 1) & 0xFFFF; + else + msr_value.low = x; + msr_write64(MSR_DEVICE_GEODELX_GLCP, GLCP_CMPVAL0, &msr_value); + + /* COMPARATOR 1 VALUE */ + + if ((x == 0 || x == 1) && width > 1) + msr_value.low += width - 2; + else + msr_value.low += width - 1; + msr_write64(MSR_DEVICE_GEODELX_GLCP, GLCP_CMPVAL0 + 2, &msr_value); + + /* COMPARATOR 2 VALUE */ + + msr_value.low = y << 16; + msr_write64(MSR_DEVICE_GEODELX_GLCP, GLCP_CMPVAL0 + 4, &msr_value); + + /* COMPARATOR 3 VALUE */ + + msr_value.low += (height - 1) << 16; + msr_write64(MSR_DEVICE_GEODELX_GLCP, GLCP_CMPVAL0 + 6, &msr_value); + + /* COMPARATOR MASKS */ + /* Comparators 0 and 1 refer to lower 16 bits of RegB */ + + msr_value.low = 0x0000FFFF; + msr_write64(MSR_DEVICE_GEODELX_GLCP, GLCP_CMPMASK0, &msr_value); + msr_write64(MSR_DEVICE_GEODELX_GLCP, GLCP_CMPMASK0 + 2, &msr_value); + + /* Comparators 2 and 3 refer to upper 16 bits of RegB */ + + msr_value.low = 0xFFFF0000; + msr_write64(MSR_DEVICE_GEODELX_GLCP, GLCP_CMPMASK0 + 4, &msr_value); + msr_write64(MSR_DEVICE_GEODELX_GLCP, GLCP_CMPMASK0 + 6, &msr_value); + + /* SET REGB MASK */ + /* We set the mask such that all all 32 bits of data are CRCed */ + + msr_value.low = 0xFFFFFFFF; + msr_write64(MSR_DEVICE_GEODELX_GLCP, GLCP_REGBMASK, &msr_value); + + /* ACTIONS */ + + /* STATE 00->01 (SET 4M) */ + + msr_value.low = 0x000C0000; + msr_write64(MSR_DEVICE_GEODELX_GLCP, GLCP_ACTION0 + 14, &msr_value); + + /* STATE 01->10 (SET 0N) */ + + msr_value.low = 0x0000000A; + msr_write64(MSR_DEVICE_GEODELX_GLCP, GLCP_ACTION0 + 15, &msr_value); + + /* STATE 10->11 (SET 5M) */ + + msr_value.low = 0x00C00000; + msr_write64(MSR_DEVICE_GEODELX_GLCP, GLCP_ACTION0 + 16, &msr_value); + + /* CLEAR REGA WHEN TRANSITIONING TO STATE 10 */ + /* Do not clear RegB as the initial value must be 0x00000001 */ + + msr_value.low = 0x0000000A; + msr_write64(MSR_DEVICE_GEODELX_GLCP, GLCP_ACTION0, &msr_value); + + /* REGISTER ACTION 1 + * CRC into RegB if cmp0 <= h.counter <= cmp1 && cmp2 <= v. counter < + * cmp3 && 7 xstate = 10 + * Increment h.counter if xstate = 10 and HSync is low. + */ + + msr_value.low = 0x000A00A0; + if (x == 0 && width == 1) + msr_value.low = 0x00A000A0; + else if (x == 1 && width == 1) + msr_value.low = 0x0A0000A0; + else if (x == 1 && width > 1) + msr_value.low |= 0x0A000000; + + msr_write64(MSR_DEVICE_GEODELX_GLCP, GLCP_ACTION0 + 1, &msr_value); + + /* REGISTER ACTION 2 */ + /* Increment V. Counter in REGA */ + + msr_value.low = 0x0000000C; + msr_write64(MSR_DEVICE_GEODELX_GLCP, GLCP_ACTION0 + 2, &msr_value); + + /* SET REGB TO 0x00000001 */ + + msr_value.low = 0x00000001; + msr_write64(MSR_DEVICE_GEODELX_GLCP, GLCP_REGB, &msr_value); + + /* SET XSTATE TO 0 */ + + msr_value.low = 0x00000000; + msr_write64(MSR_DEVICE_GEODELX_GLCP, GLCP_XSTATE, &msr_value); + + /* SET YSTATE TO 0 */ + + msr_write64(MSR_DEVICE_GEODELX_GLCP, GLCP_YSTATE, &msr_value); + + /* CLEAR ALL OTHER ACTIONS */ + /* This prevents side-effects from previous accesses to the GLCP */ + /* debug logic. */ + + msr_value.low = 0x00000000; + msr_value.high = 0x00000000; + msr_write64(MSR_DEVICE_GEODELX_GLCP, GLCP_ACTION0 + 3, &msr_value); + msr_write64(MSR_DEVICE_GEODELX_GLCP, GLCP_ACTION0 + 4, &msr_value); + msr_write64(MSR_DEVICE_GEODELX_GLCP, GLCP_ACTION0 + 5, &msr_value); + msr_write64(MSR_DEVICE_GEODELX_GLCP, GLCP_ACTION0 + 6, &msr_value); + msr_write64(MSR_DEVICE_GEODELX_GLCP, GLCP_ACTION0 + 7, &msr_value); + msr_write64(MSR_DEVICE_GEODELX_GLCP, GLCP_ACTION0 + 8, &msr_value); + msr_write64(MSR_DEVICE_GEODELX_GLCP, GLCP_ACTION0 + 9, &msr_value); + msr_write64(MSR_DEVICE_GEODELX_GLCP, GLCP_ACTION0 + 10, &msr_value); + msr_write64(MSR_DEVICE_GEODELX_GLCP, GLCP_ACTION0 + 11, &msr_value); + msr_write64(MSR_DEVICE_GEODELX_GLCP, GLCP_ACTION0 + 12, &msr_value); + msr_write64(MSR_DEVICE_GEODELX_GLCP, GLCP_ACTION0 + 13, &msr_value); + msr_write64(MSR_DEVICE_GEODELX_GLCP, GLCP_ACTION0 + 20, &msr_value); + + /* SET DIAG SETTINGS BASED ON DESIRED CRC */ + + if (crc_source == VG_CRC_SOURCE_POSTFLICKER + || crc_source == VG_CRC_SOURCE_POSTFLICKER_EVEN) { + diag = 0x80808086; + + /* ENABLE HW CLOCK GATING AND SET GLCP CLOCK TO DOT CLOCK */ + + msr_value.high = 0; + msr_value.low = 5; + msr_write64(MSR_DEVICE_GEODELX_GLCP, MSR_GEODELINK_PM, &msr_value); + msr_value.low = 0; + msr_write64(MSR_DEVICE_GEODELX_GLCP, GLCP_DBGCLKCTL, &msr_value); + msr_value.low = 3; + msr_write64(MSR_DEVICE_GEODELX_GLCP, GLCP_DBGCLKCTL, &msr_value); + + /* SET REGA LIMITS */ + /* Lower counter uses pixels/line */ + /* Upper counter is 0xFFFF to prevent rollover. */ + + msr_value.low = 0xFFFF0000 | (hactive - 1); + if (READ_REG32(DC3_DISPLAY_CFG) & DC3_DCFG_DCEN) { + msr_value.low += hblankstart - hactive; + msr_value.low += htotal - hblankend; + } + msr_write64(MSR_DEVICE_GEODELX_GLCP, GLCP_REGAVAL, &msr_value); + + /* USE H4 FUNCTION A FOR DISPE AND H4 FUNCTION B FOR NOT DISPE */ + /* DISPE is bit 34 */ + + msr_value.high = 0x00000002; + msr_value.low = 0x20000FF0; + msr_write64(MSR_DEVICE_GEODELX_GLCP, GLCP_H0CTL + 4, &msr_value); + + /* USE H3 FUNCTION A FOR VSYNC AND H3 FUNCTION B FOR NOT VSYNC */ + /* VSYNC is bit 32. */ + + msr_value.high = 0x00000000; + msr_value.low = 0x002055AA; + msr_write64(MSR_DEVICE_GEODELX_GLCP, GLCP_H0CTL + 3, &msr_value); + } else if (crc_source == VG_CRC_SOURCE_PREFLICKER + || crc_source == VG_CRC_SOURCE_PREFLICKER_EVEN) { + diag = 0x801F8032; + + /* ENABLE HW CLOCK GATING AND SET GLCP CLOCK TO GEODELINK CLOCK */ + + msr_value.high = 0; + msr_value.low = 5; + msr_write64(MSR_DEVICE_GEODELX_GLCP, MSR_GEODELINK_PM, &msr_value); + msr_value.low = 0; + msr_write64(MSR_DEVICE_GEODELX_GLCP, GLCP_DBGCLKCTL, &msr_value); + msr_value.low = 2; + msr_write64(MSR_DEVICE_GEODELX_GLCP, GLCP_DBGCLKCTL, &msr_value); + + /* SET REGA LIMITS */ + /* Lower counter uses pixels/line */ + /* Upper counter is 0xFFFF to prevent rollover. */ + + msr_value.low = 0xFFFF0000 | (hactive - 1); + msr_write64(MSR_DEVICE_GEODELX_GLCP, GLCP_REGAVAL, &msr_value); + + /* USE H4 FUNCTION A FOR DISPE AND H4 FUNCTION B FOR NOT DISPE */ + /* DISPE is bit 47 */ + + msr_value.high = 0x00000002; + msr_value.low = 0xF0000FF0; + msr_write64(MSR_DEVICE_GEODELX_GLCP, GLCP_H0CTL + 4, &msr_value); + + /* USE H3 FUNCTION A FOR VSYNC AND H3 FUNCTION B FOR NOT VSYNC */ + /* VSYNC is bit 45. */ + + msr_value.high = 0x00000000; + msr_value.low = 0x002D55AA; + msr_write64(MSR_DEVICE_GEODELX_GLCP, GLCP_H0CTL + 3, &msr_value); + } else { + /* PREFILTER CRC */ + + diag = 0x80138048; + msr_write64(MSR_DEVICE_GEODELX_VG, MSR_GEODELINK_DIAG, &msr_value); + + /* ENABLE HW CLOCK GATING AND SET GLCP CLOCK TO GEODELINK CLOCK */ + + msr_value.high = 0; + msr_value.low = 5; + msr_write64(MSR_DEVICE_GEODELX_GLCP, MSR_GEODELINK_PM, &msr_value); + msr_value.low = 0; + msr_write64(MSR_DEVICE_GEODELX_GLCP, GLCP_DBGCLKCTL, &msr_value); + msr_value.low = 2; + msr_write64(MSR_DEVICE_GEODELX_GLCP, GLCP_DBGCLKCTL, &msr_value); + + /* SET REGA LIMITS */ + /* Lower counter uses pixels/line */ + /* Upper counter is 0xFFFF to prevent rollover. */ + /* Note that we are assuming that the number of */ + /* source pixels is specified in the FB_ACTIVE register */ + + msr_value.low = + 0xFFFF0000 | ((READ_REG32(DC3_FB_ACTIVE) >> 16) & 0xFFF); + msr_write64(MSR_DEVICE_GEODELX_GLCP, GLCP_REGAVAL, &msr_value); + + /* USE H4 FUNCTION A FOR DISPE AND H4 FUNCTION B FOR NOT DISPE */ + /* DISPE is bit 55 */ + + msr_value.high = 0x00000003; + msr_value.low = 0x70000FF0; + msr_write64(MSR_DEVICE_GEODELX_GLCP, GLCP_H0CTL + 4, &msr_value); + + /* USE H3 FUNCTION A FOR VSYNC AND H3 FUNCTION B FOR NOT VSYNC */ + /* VSYNC is bit 53. */ + + msr_value.high = 0x00000000; + msr_value.low = 0x003555AA; + msr_write64(MSR_DEVICE_GEODELX_GLCP, GLCP_H0CTL + 3, &msr_value); + } + + /* WAIT FOR THE CORRECT FIELD */ + /* We use the VG line count and field indicator to determine when */ + /* to kick off a CRC. */ + + if (crc_source & VG_CRC_SOURCE_EVEN) + field = 0; + else + field = DC3_LNCNT_EVEN_FIELD; + + if (READ_REG32(DC3_IRQ_FILT_CTL) & DC3_IRQFILT_INTL_EN) { + /* WAIT FOR THE BEGINNING OF THE FIELD (LINE 1-5) */ + /* Note that we wait for the field to be odd when CRCing the even */ + /* field and vice versa. This is because the CRC will not begin */ + /* until the following field. */ + + do { + line = READ_REG32(DC3_LINE_CNT_STATUS); + } while ((line & DC3_LNCNT_EVEN_FIELD) != field || + ((line & DC3_LNCNT_V_LINE_CNT) >> 16) < 1 || + ((line & DC3_LNCNT_V_LINE_CNT) >> 16) > 5); + } else { + /* NON-INTERLACED - EVEN FIELD CRCS ARE INVALID */ + + if (crc_source & VG_CRC_SOURCE_EVEN) + return 0xFFFFFFFF; + } + + /* UPDATE VG DIAG OUTPUT */ + + msr_value.high = 0; + msr_value.low = diag; + msr_write64(MSR_DEVICE_GEODELX_VG, MSR_GEODELINK_DIAG, &msr_value); + + /* CONFIGURE DIAG CONTROL */ + /* Set RegA action1 to increment lower 16 bits and clear at limit. (5) */ + /* Set RegA action2 to increment upper 16 bits. (6) */ + /* Set RegB action1 to CRC32 (1) */ + /* Set all comparators to REGA override (0,1 lower mbus, 2,3 upper mbus) */ + /* Enable all actions */ + + msr_value.low = 0x80EA20A0; + msr_write64(MSR_DEVICE_GEODELX_GLCP, GLCP_DIAGCTL, &msr_value); + + /* DELAY TWO FRAMES */ + + while (READ_REG32(DC3_LINE_CNT_STATUS) & DC3_LNCNT_VNA) ; + while (!(READ_REG32(DC3_LINE_CNT_STATUS) & DC3_LNCNT_VNA)) ; + while (READ_REG32(DC3_LINE_CNT_STATUS) & DC3_LNCNT_VNA) ; + while (!(READ_REG32(DC3_LINE_CNT_STATUS) & DC3_LNCNT_VNA)) ; + while (READ_REG32(DC3_LINE_CNT_STATUS) & DC3_LNCNT_VNA) ; + + /* VERIFY THAT XSTATE = 11 */ + + msr_read64(MSR_DEVICE_GEODELX_GLCP, GLCP_XSTATE, &msr_value); + if ((msr_value.low & 3) == 3) { + msr_read64(MSR_DEVICE_GEODELX_GLCP, GLCP_REGB, &msr_value); + + crc = msr_value.low; + } + + /* DISABLE VG DIAG BUS OUTPUTS */ + + msr_value.low = 0x00000000; + msr_value.high = 0x00000000; + msr_write64(MSR_DEVICE_GEODELX_VG, MSR_GEODELINK_DIAG, &msr_value); + + /* DISABLE GLCP ACTIONS */ + + msr_write64(MSR_DEVICE_GEODELX_GLCP, GLCP_DIAGCTL, &msr_value); + + return crc; +} + +/*--------------------------------------------------------------------------- + * vg_get_scaler_filter_coefficients + * + * This routine gets the vertical and horizontal filter coefficients for + * graphics scaling. The coefficients are sign extended to 32-bit values. + *--------------------------------------------------------------------------*/ + +int +vg_get_scaler_filter_coefficients(long h_taps[][5], long v_taps[][3]) +{ + unsigned long irqfilt, i; + unsigned long temp; + long coeff0, coeff1, coeff2; + unsigned long lock; + + /* ENABLE ACCESS TO THE HORIZONTAL COEFFICIENTS */ + + lock = READ_REG32(DC3_UNLOCK); + irqfilt = READ_REG32(DC3_IRQ_FILT_CTL); + irqfilt |= DC3_IRQFILT_H_FILT_SEL; + + /* WRITE COEFFICIENTS */ + /* Coefficient indexes do not auto-increment, so we must */ + /* write the address for every phase */ + + WRITE_REG32(DC3_UNLOCK, DC3_UNLOCK_VALUE); + + for (i = 0; i < 256; i++) { + WRITE_REG32(DC3_IRQ_FILT_CTL, ((irqfilt & 0xFFFFFF00L) | i)); + + temp = READ_REG32(DC3_FILT_COEFF1); + coeff0 = (temp & 0x3FF); + coeff1 = (temp >> 10) & 0x3FF; + coeff2 = (temp >> 20) & 0x3FF; + + h_taps[i][0] = (coeff0 << 22) >> 22; + h_taps[i][1] = (coeff1 << 22) >> 22; + h_taps[i][2] = (coeff2 << 22) >> 22; + + temp = READ_REG32(DC3_FILT_COEFF2); + coeff0 = (temp & 0x3FF); + coeff1 = (temp >> 10) & 0x3FF; + + h_taps[i][3] = (coeff0 << 22) >> 22; + h_taps[i][4] = (coeff1 << 22) >> 22; + } + + /* ENABLE ACCESS TO THE VERTICAL COEFFICIENTS */ + + irqfilt &= ~DC3_IRQFILT_H_FILT_SEL; + + /* WRITE COEFFICIENTS */ + + for (i = 0; i < 256; i++) { + WRITE_REG32(DC3_IRQ_FILT_CTL, ((irqfilt & 0xFFFFFF00L) | i)); + + temp = READ_REG32(DC3_FILT_COEFF1); + coeff0 = (temp & 0x3FF); + coeff1 = (temp >> 10) & 0x3FF; + coeff2 = (temp >> 20) & 0x3FF; + + v_taps[i][0] = (coeff0 << 22) >> 22; + v_taps[i][1] = (coeff1 << 22) >> 22; + v_taps[i][2] = (coeff2 << 22) >> 22; + } + + WRITE_REG32(DC3_UNLOCK, lock); + + return CIM_STATUS_OK; +} + +/*--------------------------------------------------------------------------- + * vg_get_flicker_filter_configuration + * + * This routine returns the current VG flicker filter configuration. + *--------------------------------------------------------------------------*/ + +int +vg_get_flicker_filter_configuration(unsigned long *strength, + int *flicker_alpha) +{ + unsigned long genlk_ctl; + + if (!strength || !flicker_alpha) + return CIM_STATUS_INVALIDPARAMS; + + genlk_ctl = READ_REG32(DC3_GENLK_CTL); + *strength = genlk_ctl & DC3_GC_FLICKER_FILTER_MASK; + if (genlk_ctl & DC3_GC_ALPHA_FLICK_ENABLE) + *flicker_alpha = 1; + else + *flicker_alpha = 0; + + return CIM_STATUS_OK; +} + +/*--------------------------------------------------------------------------- + * vg_get_display_pitch + * + * This routine returns the current stride between successive lines of frame + * buffer data. + *--------------------------------------------------------------------------*/ + +unsigned long +vg_get_display_pitch(void) +{ + return ((READ_REG32(DC3_GFX_PITCH) & 0x0000FFFF) << 3); +} + +/*--------------------------------------------------------------------------- + * vg_get_frame_buffer_line_size + * + * This routine returns the current size in bytes of one line of frame buffer + * data. + *--------------------------------------------------------------------------*/ + +unsigned long +vg_get_frame_buffer_line_size(void) +{ + return ((READ_REG32(DC3_LINE_SIZE) & 0x3FF) << 3); +} + +/*--------------------------------------------------------------------------- + * vg_get_current_vline + * + * This routine returns the number of the current line that is being displayed + * by the display controller. + *--------------------------------------------------------------------------*/ + +unsigned long +vg_get_current_vline(void) +{ + unsigned long current_line; + + /* READ THE REGISTER TWICE TO ENSURE THAT THE VALUE IS NOT TRANSITIONING */ + + do { + current_line = READ_REG32(DC3_LINE_CNT_STATUS) & DC3_LNCNT_V_LINE_CNT; + } + while (current_line != + (READ_REG32(DC3_LINE_CNT_STATUS) & DC3_LNCNT_V_LINE_CNT)); + + return (current_line >> 16); +} + +/*--------------------------------------------------------------------------- + * vg_get_display_offset + * + * This routine returns the offset into the frame buffer for the first pixel + * of the display. + *--------------------------------------------------------------------------*/ + +unsigned long +vg_get_display_offset(void) +{ + return (READ_REG32(DC3_FB_ST_OFFSET) & 0x0FFFFFFF); +} + +/*--------------------------------------------------------------------------- + * vg_get_cursor_info + * + * This routine returns the current settings for the hardware cursor. + *--------------------------------------------------------------------------*/ + +int +vg_get_cursor_info(VG_CURSOR_DATA * cursor_data) +{ + unsigned long temp; + + /* CURSOR OFFSET */ + + cursor_data->cursor_offset = READ_REG32(DC3_CURS_ST_OFFSET) & 0x0FFFFFFF; + + /* CURSOR X POSITION */ + + temp = READ_REG32(DC3_CURSOR_X); + cursor_data->cursor_x = temp & 0x7FF; + cursor_data->clipx = (temp >> 11) & 0x3F; + + /* CURSOR Y POSITION */ + + temp = READ_REG32(DC3_CURSOR_Y); + cursor_data->cursor_y = temp & 0x7FF; + cursor_data->clipy = (temp >> 11) & 0x3F; + + /* CURSOR COLORS */ + + WRITE_REG32(DC3_PAL_ADDRESS, 0x100); + cursor_data->mono_color0 = READ_REG32(DC3_PAL_DATA); + cursor_data->mono_color1 = READ_REG32(DC3_PAL_DATA); + + /* CURSOR ENABLES */ + + temp = READ_REG32(DC3_GENERAL_CFG); + if (temp & DC3_GCFG_CURE) + cursor_data->enable = 1; + else + cursor_data->enable = 0; + if (temp & DC3_GCFG_CLR_CUR) + cursor_data->color_cursor = 1; + else + cursor_data->color_cursor = 0; + + return CIM_STATUS_OK; +} + +/*---------------------------------------------------------------------------- + * vg_get_display_palette_entry + * + * This routine reads a single entry in the 8BPP display palette. + *--------------------------------------------------------------------------*/ + +int +vg_get_display_palette_entry(unsigned long index, unsigned long *entry) +{ + if (index > 0xFF) + return CIM_STATUS_INVALIDPARAMS; + + WRITE_REG32(DC3_PAL_ADDRESS, index); + *entry = READ_REG32(DC3_PAL_DATA); + + return CIM_STATUS_OK; +} + +/*---------------------------------------------------------------------------- + * vg_get_border_color + * + * This routine reads the current border color for centered displays. + *--------------------------------------------------------------------------*/ + +unsigned long +vg_get_border_color(void) +{ + WRITE_REG32(DC3_PAL_ADDRESS, 0x104); + return READ_REG32(DC3_PAL_DATA); +} + +/*---------------------------------------------------------------------------- + * vg_get_display_palette + * + * This routines reads the entire contents of the display palette into a + * buffer. The display palette consists of 256 X:R:G:B values. + *--------------------------------------------------------------------------*/ + +int +vg_get_display_palette(unsigned long *palette) +{ + unsigned long i; + + if (palette) { + WRITE_REG32(DC3_PAL_ADDRESS, 0); + for (i = 0; i < 256; i++) { + palette[i] = READ_REG32(DC3_PAL_DATA); + } + return CIM_STATUS_OK; + } + return CIM_STATUS_INVALIDPARAMS; +} + +/*---------------------------------------------------------------------------- + * vg_get_compression_info + * + * This routines reads the current status of the display compression hardware. + *--------------------------------------------------------------------------*/ + +int +vg_get_compression_info(VG_COMPRESSION_DATA * comp_data) +{ + comp_data->compression_offset = READ_REG32(DC3_CB_ST_OFFSET) & 0x0FFFFFFF; + comp_data->pitch = (READ_REG32(DC3_GFX_PITCH) >> 13) & 0x7FFF8; + comp_data->size = ((READ_REG32(DC3_LINE_SIZE) >> (DC3_LINE_SIZE_CB_SHIFT - + 3)) & 0x3F8) + 24; + + return CIM_STATUS_OK; +} + +/*---------------------------------------------------------------------------- + * vg_get_compression_enable + * + * This routines reads the current enable status of the display compression + * hardware. + *--------------------------------------------------------------------------*/ + +int +vg_get_compression_enable(void) +{ + if (READ_REG32(DC3_GENERAL_CFG) & DC3_GCFG_CMPE) + return 1; + + return 0; +} + +/*---------------------------------------------------------------------------- + * vg_get_valid_bit + *--------------------------------------------------------------------------*/ + +int +vg_get_valid_bit(int line) +{ + unsigned long offset; + unsigned long valid; + unsigned long lock; + + lock = READ_REG32(DC3_UNLOCK); + offset = READ_REG32(DC3_PHY_MEM_OFFSET) & 0xFF000000; + offset |= line; + + WRITE_REG32(DC3_UNLOCK, DC3_UNLOCK_VALUE); + WRITE_REG32(DC3_PHY_MEM_OFFSET, offset); + WRITE_REG32(DC3_UNLOCK, lock); + valid = READ_REG32(DC3_DV_ACC) & 2; + + if (valid) + return 1; + return 0; +} + +#endif diff --git a/driver/xf86-video-geode/src/cim/cim_vip.c b/driver/xf86-video-geode/src/cim/cim_vip.c new file mode 100644 index 000000000..025449bad --- /dev/null +++ b/driver/xf86-video-geode/src/cim/cim_vip.c @@ -0,0 +1,1640 @@ +/* + * Copyright (c) 2006 Advanced Micro Devices, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + * Neither the name of the Advanced Micro Devices, Inc. nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + */ + + /* + * Cimarron VIP configuration routines. + */ + +/*--------------------------------------------------------------------------- + * vip_initialize + * + * This routine initializes the internal module state and prepares the + * module for subsequent VIP orientated activities. + *--------------------------------------------------------------------------*/ + +int +vip_initialize(VIPSETMODEBUFFER * buffer) +{ + unsigned long vip_control1, vip_control2, vip_control3; + + if (!buffer) + return CIM_STATUS_INVALIDPARAMS; + + vip_control1 = 0; + vip_control2 = 0; + vip_control3 = 0; + + /* CONFIGURE CONTROL WORDS BASED ON MODE STRUCTURE */ + /* Note that some of the input parameters match the register fields */ + /* they represent. */ + + /* STREAM ENABLES */ + + vip_control1 |= buffer->stream_enables; + + /* VIP CAPTURE MODE */ + + vip_control1 |= buffer->operating_mode; + + /* HANDLE PLANAR CAPTURE */ + + if (buffer->flags & VIP_MODEFLAG_PLANARCAPTURE) { + vip_control1 |= VIP_CONTROL1_PLANAR; + + if (buffer->planar_capture == VIP_420CAPTURE_EVERYLINE) { + vip_control1 |= VIP_CONTROL1_DISABLE_DECIMATION; + } else if (buffer->planar_capture == VIP_420CAPTURE_ALTERNATINGFIELDS) { + if (buffer->flags & VIP_MODEFLAG_PROGRESSIVE) + return CIM_STATUS_INVALIDPARAMS; + + vip_control1 |= VIP_CONTROL1_DISABLE_DECIMATION; + vip_control3 |= VIP_CONTROL3_DECIMATE_EVEN; + } else if (buffer->planar_capture != VIP_420CAPTURE_ALTERNATINGLINES) + return CIM_STATUS_INVALIDPARAMS; + + /* CONFIGURE THE VIDEO FIFO THRESHOLD BASED ON THE FIFO DEPTH */ + + vip_control2 |= VIP_CONTROL2_DEFAULT_VIDTH_420 << + VIP_CONTROL2_VIDTH_SHIFT; + + } else { + vip_control2 |= VIP_CONTROL2_DEFAULT_VIDTH_422 << + VIP_CONTROL2_VIDTH_SHIFT; + } + + /* CONFIGURE DEFAULT ANCILARRY THRESHOLD AND VIDEO FLUSH VALUES */ + + vip_control2 |= VIP_CONTROL2_DEFAULT_ANCTH << VIP_CONTROL2_ANCTH_SHIFT; + vip_control1 |= VIP_CONTROL1_DEFAULT_ANC_FF << VIP_CONTROL1_ANC_FF_SHIFT; + vip_control1 |= VIP_CONTROL1_DEFAULT_VID_FF << VIP_CONTROL1_VID_FF_SHIFT; + + /* PROGRAM VIP OPTIONS */ + /* The options are sanitized based on the current configuration. */ + + if (buffer->flags & VIP_MODEFLAG_PROGRESSIVE) + vip_control1 |= VIP_CONTROL1_NON_INTERLACED; + else { + if (buffer->flags & VIP_MODEFLAG_TOGGLEEACHFIELD) + vip_control3 |= VIP_CONTROL3_BASE_UPDATE; + if (buffer->flags & VIP_MODEFLAG_INVERTPOLARITY) + vip_control2 |= VIP_CONTROL2_INVERT_POLARITY; + } + + if ((buffer->operating_mode == VIP_MODE_MSG || + buffer->operating_mode == VIP_MODE_DATA) && + (buffer->flags & VIP_MODEFLAG_FLIPMESSAGEWHENFULL)) { + vip_control1 |= VIP_CONTROL1_MSG_STRM_CTRL; + } + + else if (buffer->operating_mode == VIP_MODE_VIP2_8BIT || + buffer->operating_mode == VIP_MODE_VIP2_16BIT) { + if (buffer->flags & VIP_MODEFLAG_ENABLEREPEATFLAG) + vip_control2 |= VIP_CONTROL2_REPEAT_ENABLE; + if (buffer->flags & VIP_MODEFLAG_INVERTTASKPOLARITY) + vip_control3 |= VIP_CONTROL3_TASK_POLARITY; + } + + if (buffer->flags & VIP_MODEFLAG_DISABLEZERODETECT) + vip_control1 |= VIP_CONTROL1_DISABLE_ZERO_DETECT; + if (buffer->flags & VIP_MODEFLAG_10BITANCILLARY) + vip_control2 |= VIP_CONTROL2_ANC10; + + /* WRITE THE CONTROL REGISTERS */ + /* The control registers are kept 'live' to allow separate instances of */ + /* Cimarron to control the VIP hardware. */ + + WRITE_VIP32(VIP_CONTROL1, vip_control1); + WRITE_VIP32(VIP_CONTROL2, vip_control2); + WRITE_VIP32(VIP_CONTROL3, vip_control3); + + /* CONFIGURE 601 PARAMETERS */ + + if (buffer->operating_mode == VIP_MODE_8BIT601 || + buffer->operating_mode == VIP_MODE_16BIT601) { + vip_update_601_params(&buffer->vip601_settings); + } + + return CIM_STATUS_OK; +} + +/*--------------------------------------------------------------------------- + * vip_update_601_params + * + * This routine configures all aspects of 601 VIP data capture, including + * start and stop timings and input polarities. + *--------------------------------------------------------------------------*/ + +int +vip_update_601_params(VIP_601PARAMS * buffer) +{ + unsigned long vip_control3, vip_control1; + + if (!buffer) + return CIM_STATUS_INVALIDPARAMS; + + vip_control1 = READ_VIP32(VIP_CONTROL3); + vip_control3 = READ_VIP32(VIP_CONTROL3); + + if (buffer->flags & VIP_MODEFLAG_VSYNCACTIVEHIGH) + vip_control3 |= VIP_CONTROL3_VSYNC_POLARITY; + else + vip_control3 &= ~VIP_CONTROL3_VSYNC_POLARITY; + if (buffer->flags & VIP_MODEFLAG_HSYNCACTIVEHIGH) + vip_control3 |= VIP_CONTROL3_HSYNC_POLARITY; + else + vip_control3 &= ~VIP_CONTROL3_HSYNC_POLARITY; + + WRITE_VIP32(VIP_CONTROL3, vip_control3); + WRITE_VIP32(VIP_601_HORZ_START, buffer->horz_start); + WRITE_VIP32(VIP_601_VBI_START, buffer->vbi_start); + WRITE_VIP32(VIP_601_VBI_END, buffer->vbi_start + buffer->vbi_height - 1); + WRITE_VIP32(VIP_601_EVEN_START_STOP, + buffer->vert_start_even | ((buffer->vert_start_even + + buffer->even_height - 1) << 16)); + WRITE_VIP32(VIP_601_ODD_START_STOP, + buffer->vert_start_odd | ((buffer->vert_start_odd + + buffer->odd_height - 1) << 16)); + WRITE_VIP32(VIP_ODD_FIELD_DETECT, + buffer->odd_detect_start | (buffer->odd_detect_end << 16)); + + /* SPECIAL CASE FOR HORIZONTAL DATA + * 601 horizontal parameters are based on the number of clocks and not + * the number of pixels. + */ + + if ((vip_control1 & VIP_CONTROL1_MODE_MASK) == VIP_MODE_16BIT601) + WRITE_VIP32(VIP_601_HORZ_END, + buffer->horz_start + (buffer->width << 1) + 3); + else + WRITE_VIP32(VIP_601_HORZ_END, buffer->horz_start + buffer->width + 3); + + return CIM_STATUS_OK; +} + +/*--------------------------------------------------------------------------- + * vip_configure_capture_buffers + * + * This routine configures the base offsets for video, ancillary or message + * mode capture. The input structure can also contain multiple offsets, such + * that the calling application can avoid updating the structure for each + * flip. + * + * The new buffer addresses are written to the hardware registers although + * they may not be latched immediately. Calling vip_is_buffer_update_latched + * allows the determination of whether the update has occured. + * + * Review the Cimarron VIP API documentation to determine which buffer + * addresses are latched immediately. + *--------------------------------------------------------------------------*/ + +int +vip_configure_capture_buffers(int buffer_type, VIPINPUTBUFFER * buffer) +{ + VIPINPUTBUFFER_ADDR *offsets; + unsigned long cur_buffer = buffer->current_buffer; + + if (!buffer) + return CIM_STATUS_INVALIDPARAMS; + + if (buffer_type == VIP_BUFFER_A || buffer_type == VIP_BUFFER_601) { + offsets = &buffer->offsets[VIP_BUFFER_TASK_A]; + + /* SET VIDEO PITCH */ + + WRITE_VIP32(VIP_TASKA_VID_PITCH, + offsets->y_pitch | (offsets->uv_pitch << 16)); + + /* SET BASE OFFSETS */ + + if (buffer->flags & VIP_INPUTFLAG_INVERTPOLARITY) { + WRITE_VIP32(VIP_TASKA_VID_ODD_BASE, + offsets->even_base[cur_buffer]); + WRITE_VIP32(VIP_TASKA_VID_EVEN_BASE, + offsets->odd_base[cur_buffer]); + if (buffer->flags & VIP_INPUTFLAG_VBI) { + WRITE_VIP32(VIP_TASKA_VBI_ODD_BASE, offsets->vbi_even_base); + WRITE_VIP32(VIP_TASKA_VBI_EVEN_BASE, offsets->vbi_odd_base); + } + } else { + WRITE_VIP32(VIP_TASKA_VID_ODD_BASE, + offsets->odd_base[cur_buffer]); + WRITE_VIP32(VIP_TASKA_VID_EVEN_BASE, + offsets->even_base[cur_buffer]); + if (buffer->flags & VIP_INPUTFLAG_VBI) { + WRITE_VIP32(VIP_TASKA_VBI_ODD_BASE, offsets->vbi_odd_base); + WRITE_VIP32(VIP_TASKA_VBI_EVEN_BASE, offsets->vbi_even_base); + } + } + + /* SET 4:2:0 OFFSETS */ + + if (buffer->flags & VIP_INPUTFLAG_PLANAR) { + WRITE_VIP32(VIP_TASKA_U_OFFSET, offsets->odd_uoffset); + WRITE_VIP32(VIP_TASKA_V_OFFSET, offsets->odd_voffset); + WRITE_VIP32(VIP_TASKA_U_EVEN_OFFSET, offsets->even_uoffset); + WRITE_VIP32(VIP_TASKA_V_EVEN_OFFSET, offsets->even_voffset); + } + } else if (buffer_type == VIP_BUFFER_B) { + offsets = &buffer->offsets[VIP_BUFFER_TASK_B]; + + /* SET VIDEO PITCH */ + + WRITE_VIP32(VIP_TASKB_VID_PITCH, + offsets->y_pitch | (offsets->uv_pitch << 16)); + + /* SET BASE OFFSETS */ + + if (buffer->flags & VIP_INPUTFLAG_INVERTPOLARITY) { + WRITE_VIP32(VIP_TASKB_VID_ODD_BASE, + offsets->even_base[cur_buffer]); + WRITE_VIP32(VIP_TASKB_VID_EVEN_BASE, + offsets->odd_base[cur_buffer]); + if (buffer->flags & VIP_INPUTFLAG_VBI) { + WRITE_VIP32(VIP_TASKB_VBI_ODD_BASE, offsets->vbi_even_base); + WRITE_VIP32(VIP_TASKB_VBI_EVEN_BASE, offsets->vbi_odd_base); + } + } else { + WRITE_VIP32(VIP_TASKB_VID_ODD_BASE, + offsets->odd_base[cur_buffer]); + WRITE_VIP32(VIP_TASKB_VID_EVEN_BASE, + offsets->even_base[cur_buffer]); + if (buffer->flags & VIP_INPUTFLAG_VBI) { + WRITE_VIP32(VIP_TASKB_VBI_ODD_BASE, offsets->vbi_odd_base); + WRITE_VIP32(VIP_TASKB_VBI_EVEN_BASE, offsets->vbi_even_base); + } + } + + /* SET 4:2:0 OFFSETS */ + + if (buffer->flags & VIP_INPUTFLAG_PLANAR) { + WRITE_VIP32(VIP_TASKB_U_OFFSET, offsets->odd_uoffset); + WRITE_VIP32(VIP_TASKB_V_OFFSET, offsets->odd_voffset); + } + } else if (buffer_type == VIP_BUFFER_ANC || buffer_type == VIP_BUFFER_MSG) { + WRITE_VIP32(VIP_ANC_MSG1_BASE, buffer->ancillaryData.msg1_base); + WRITE_VIP32(VIP_ANC_MSG2_BASE, buffer->ancillaryData.msg2_base); + WRITE_VIP32(VIP_ANC_MSG_SIZE, buffer->ancillaryData.msg_size); + } else { + return CIM_STATUS_INVALIDPARAMS; + } + + return CIM_STATUS_OK; +} + +/*--------------------------------------------------------------------------- + * vip_toggle_vip_video_offsets + * + * This routine updates the offsets for video capture. It is a simplified + * version of vip_configure_capture_buffers that is designed to be called from + * interrupt service routines or other buffer flipping applications that + * require low latency. + *--------------------------------------------------------------------------*/ + +int +vip_toggle_video_offsets(int buffer_type, VIPINPUTBUFFER * buffer) +{ + unsigned long cur_buffer = buffer->current_buffer; + VIPINPUTBUFFER_ADDR *offsets; + + if (buffer_type == VIP_BUFFER_A) { + offsets = &buffer->offsets[VIP_BUFFER_TASK_A]; + + /* SET BASE OFFSETS */ + + if (buffer->flags & VIP_INPUTFLAG_INVERTPOLARITY) { + WRITE_VIP32(VIP_TASKA_VID_ODD_BASE, + offsets->even_base[cur_buffer]); + WRITE_VIP32(VIP_TASKA_VID_EVEN_BASE, + offsets->odd_base[cur_buffer]); + } else { + WRITE_VIP32(VIP_TASKA_VID_ODD_BASE, + offsets->odd_base[cur_buffer]); + WRITE_VIP32(VIP_TASKA_VID_EVEN_BASE, + offsets->even_base[cur_buffer]); + } + } else if (buffer_type == VIP_BUFFER_B) { + offsets = &buffer->offsets[VIP_BUFFER_TASK_B]; + + /* SET BASE OFFSETS */ + + if (buffer->flags & VIP_INPUTFLAG_INVERTPOLARITY) { + WRITE_VIP32(VIP_TASKB_VID_ODD_BASE, + offsets->even_base[cur_buffer]); + WRITE_VIP32(VIP_TASKB_VID_EVEN_BASE, + offsets->odd_base[cur_buffer]); + } else { + WRITE_VIP32(VIP_TASKB_VID_ODD_BASE, + offsets->odd_base[cur_buffer]); + WRITE_VIP32(VIP_TASKB_VID_EVEN_BASE, + offsets->even_base[cur_buffer]); + } + } else if (buffer_type == VIP_BUFFER_A_ODD) { + offsets = &buffer->offsets[VIP_BUFFER_TASK_A]; + + /* SET BASE OFFSETS */ + + if (buffer->flags & VIP_INPUTFLAG_INVERTPOLARITY) + WRITE_VIP32(VIP_TASKA_VID_ODD_BASE, + offsets->even_base[cur_buffer]); + else + WRITE_VIP32(VIP_TASKA_VID_ODD_BASE, + offsets->odd_base[cur_buffer]); + } else if (buffer_type == VIP_BUFFER_A_EVEN) { + offsets = &buffer->offsets[VIP_BUFFER_TASK_A]; + + /* SET BASE OFFSETS */ + + if (buffer->flags & VIP_INPUTFLAG_INVERTPOLARITY) + WRITE_VIP32(VIP_TASKA_VID_EVEN_BASE, + offsets->odd_base[cur_buffer]); + else + WRITE_VIP32(VIP_TASKA_VID_EVEN_BASE, + offsets->even_base[cur_buffer]); + } else if (buffer_type == VIP_BUFFER_B_ODD) { + offsets = &buffer->offsets[VIP_BUFFER_TASK_B]; + + /* SET BASE OFFSETS */ + + if (buffer->flags & VIP_INPUTFLAG_INVERTPOLARITY) + WRITE_VIP32(VIP_TASKB_VID_ODD_BASE, + offsets->even_base[cur_buffer]); + else + WRITE_VIP32(VIP_TASKB_VID_ODD_BASE, + offsets->odd_base[cur_buffer]); + } else if (buffer_type == VIP_BUFFER_B_EVEN) { + offsets = &buffer->offsets[VIP_BUFFER_TASK_B]; + + /* SET BASE OFFSETS */ + + if (buffer->flags & VIP_INPUTFLAG_INVERTPOLARITY) + WRITE_VIP32(VIP_TASKB_VID_EVEN_BASE, + offsets->odd_base[cur_buffer]); + else + WRITE_VIP32(VIP_TASKB_VID_EVEN_BASE, + offsets->even_base[cur_buffer]); + } else + return CIM_STATUS_INVALIDPARAMS; + + return CIM_STATUS_OK; +} + +/*--------------------------------------------------------------------------- + * vip_set_capture_state + * + * This routine takes the current control word definition ( stored in locals ) + * adds in the specified state, and writes the control word. + *--------------------------------------------------------------------------*/ + +int +vip_set_capture_state(unsigned long state) +{ + unsigned long vip_control1, vip_control3; + + /* UPDATE THE CURRENT CAPTURE MODE */ + + vip_control1 = READ_VIP32(VIP_CONTROL1); + vip_control3 = READ_VIP32(VIP_CONTROL3); + vip_control1 &= ~VIP_CONTROL1_RUNMODE_MASK; + vip_control1 |= (state << VIP_CONTROL1_RUNMODE_SHIFT); + + WRITE_VIP32(VIP_CONTROL1, vip_control1); + + if (state >= VIP_STARTCAPTUREATNEXTLINE) { + /* WHACK VIP RESET + * The VIP can get confused when switching between capture settings, + * such as between linear and planar. We will thus whack VIP reset + * when enabling capture to ensure a pristine VIP state. + */ + + WRITE_VIP32(VIP_CONTROL1, vip_control1 | VIP_CONTROL1_RESET); + WRITE_VIP32(VIP_CONTROL1, vip_control1 & ~VIP_CONTROL1_RESET); + WRITE_VIP32(VIP_CONTROL3, vip_control3 | VIP_CONTROL3_FIFO_RESET); + } + + return CIM_STATUS_OK; +} + +/*--------------------------------------------------------------------------- + * vip_terminate + * + * This routine stops VIP capture and resets the VIP internal state. + *--------------------------------------------------------------------------*/ + +int +vip_terminate(void) +{ + unsigned long timeout = 50000; + + /* DISABLE AND CLEAR ALL VIP INTERRUPTS */ + + WRITE_VIP32(VIP_INTERRUPT, VIP_ALL_INTERRUPTS | + (VIP_ALL_INTERRUPTS >> 16)); + + /* DISABLE VIP CAPTURE */ + /* We will try to let the VIP FIFO flush before shutting it down. */ + + WRITE_VIP32(VIP_CONTROL1, 0); + while (timeout) { + timeout--; + if (READ_VIP32(VIP_STATUS) & VIP_STATUS_WRITES_COMPLETE) + break; + } + + /* RESET THE HARDWARE REGISTERS */ + /* Note that we enable VIP reset to allow clock gating to lower VIP */ + /* power consumption. */ + + WRITE_VIP32(VIP_CONTROL1, VIP_CONTROL1_RESET); + WRITE_VIP32(VIP_CONTROL3, VIP_CONTROL3_FIFO_RESET); + WRITE_VIP32(VIP_CONTROL2, 0); + + return CIM_STATUS_OK; +} + +/*--------------------------------------------------------------------------- + * vip_configure_fifo + * + * This routine sets the desired threshold or flush for the specified fifo. + *--------------------------------------------------------------------------*/ + +int +vip_configure_fifo(unsigned long fifo_type, unsigned long fifo_size) +{ + unsigned long vip_control1, vip_control2; + + vip_control1 = READ_VIP32(VIP_CONTROL1); + vip_control2 = READ_VIP32(VIP_CONTROL2); + + switch (fifo_type) { + case VIP_VIDEOTHRESHOLD: + vip_control2 &= ~VIP_CONTROL2_VIDTH_MASK; + vip_control2 |= + (fifo_size << VIP_CONTROL2_VIDTH_SHIFT) & VIP_CONTROL2_VIDTH_MASK; + break; + + case VIP_ANCILLARYTHRESHOLD: + vip_control2 &= ~VIP_CONTROL2_ANCTH_MASK; + vip_control2 |= + (fifo_size << VIP_CONTROL2_ANCTH_SHIFT) & VIP_CONTROL2_ANCTH_MASK; + break; + + case VIP_VIDEOFLUSH: + vip_control1 &= ~VIP_CONTROL1_VID_FF_MASK; + vip_control1 |= + ((fifo_size >> 2) << VIP_CONTROL1_VID_FF_SHIFT) & + VIP_CONTROL1_VID_FF_MASK; + break; + + case VIP_ANCILLARYFLUSH: + vip_control1 &= ~VIP_CONTROL1_ANC_FF_MASK; + vip_control1 |= + ((fifo_size >> 2) << VIP_CONTROL1_ANC_FF_SHIFT) & + VIP_CONTROL1_ANC_FF_MASK; + break; + + default: + return CIM_STATUS_INVALIDPARAMS; + } + + WRITE_VIP32(VIP_CONTROL1, vip_control1); + WRITE_VIP32(VIP_CONTROL2, vip_control2); + + return CIM_STATUS_OK; +} + +/*--------------------------------------------------------------------------- + * vip_set_interrupt_enable + * + * This routine accepts a mask of interrupts to be enabled/disabled and + * an enable flag. + * + * For each mask match, the interrupt will be enabled or disabled based on + * enable + *--------------------------------------------------------------------------*/ + +int +vip_set_interrupt_enable(unsigned long mask, int enable) +{ + /* CHECK IF ANY VALID INTERRUPTS ARE BEING CHANGED */ + + if (mask & VIP_ALL_INTERRUPTS) { + unsigned long int_enable = READ_VIP32(VIP_INTERRUPT) & 0xFFFF; + + /* SET OR CLEAR THE MASK BITS */ + /* Note that the upper 16-bits of the register are 0 after this */ + /* operation. This prevents us from indadvertently clearing a */ + /* pending interrupt by enabling/disabling another one. */ + + if (enable) + int_enable &= ~(mask >> 16); + else + int_enable |= (mask >> 16); + + WRITE_VIP32(VIP_INTERRUPT, int_enable); + } + + return CIM_STATUS_OK; +} + +/*--------------------------------------------------------------------------- + * vip_set_vsync_error + * + * This routine defines a region that is used to determine if the vsync is + * within an acceptable range. This definition is accomplished using + * a count and a vertical window. The count specifies the exact number + * of clocks expected for one field. The window parameters specify the number + * of clocks variation allowed before and after the expected vsync. For + * example, if vertical_count is 1000, window_before is 5 and window_after + * is 12, VSync will be considered valid if it occurs between 995 and 1012 + * clocks after the last VSync. The total window size (window_before + + * window_after) cannot exceed 255. + *--------------------------------------------------------------------------*/ + +int +vip_set_vsync_error(unsigned long vertical_count, unsigned long window_before, + unsigned long window_after, int enable) +{ + unsigned long vip_control2 = READ_VIP32(VIP_CONTROL2); + unsigned long temp; + + if (enable) { + /* CREATE THE VERTICAL WINDOW + * The VIP uses two counters. The first counter defines the minimum + * clock count before a valid VSync can occur. The second counter + * starts after the first completes and defines the acceptable + * region of variation. + */ + + temp = ((window_before + + window_after) << VIP_VSYNC_ERR_WINDOW_SHIFT) & + VIP_VSYNC_ERR_WINDOW_MASK; + temp |= (vertical_count - window_before) & VIP_VSYNC_ERR_COUNT_MASK; + + vip_control2 |= VIP_CONTROL2_VERTERROR_ENABLE; + + WRITE_VIP32(VIP_VSYNC_ERR_COUNT, temp); + } else { + vip_control2 &= ~VIP_CONTROL2_VERTERROR_ENABLE; + } + WRITE_VIP32(VIP_CONTROL2, vip_control2); + + return CIM_STATUS_OK; +} + +/*--------------------------------------------------------------------------- + * vip_max_address_enable + * + * This routine specifies the maximum address to which the the hardware should + * write during data storage. If this value is exceeded an error is generated, + * (this may be monitored using the appropriate interrupt flags - see + * vip_set_interrupt_enable) + *--------------------------------------------------------------------------*/ + +int +vip_max_address_enable(unsigned long max_address, int enable) +{ + unsigned long vip_control2 = READ_VIP32(VIP_CONTROL2); + + if (enable) { + /* ENABLE THE CONTROL BIT */ + + vip_control2 |= VIP_CONTROL2_ADD_ERROR_ENABLE; + + WRITE_VIP32(VIP_MAX_ADDRESS, max_address & VIP_MAXADDR_MASK); + } else { + /* DISABLE DETECTION */ + + vip_control2 &= ~VIP_CONTROL2_ADD_ERROR_ENABLE; + } + WRITE_VIP32(VIP_CONTROL2, vip_control2); + + return CIM_STATUS_OK; +} + +/*--------------------------------------------------------------------------- + * vip_set_loopback_enable + * + * This routine enables/disables internal loopback functionality. When + * loopback is enabled, the VOP outputs are rerouted to the VIP inputs + * internal to the chip. No loopback connector is required. + *--------------------------------------------------------------------------*/ + +int +vip_set_loopback_enable(int enable) +{ + unsigned long vip_control2 = READ_VIP32(VIP_CONTROL2); + + if (enable) + vip_control2 |= VIP_CONTROL2_LOOPBACK_ENABLE; + else + vip_control2 &= ~VIP_CONTROL2_LOOPBACK_ENABLE; + + WRITE_VIP32(VIP_CONTROL2, vip_control2); + + return CIM_STATUS_OK; +} + +/*--------------------------------------------------------------------------- + * vip_configure_genlock + * + * This routine configures genlock functionality. + *---------------------------------------------------------------------------*/ + +int +vip_configure_genlock(VIPGENLOCKBUFFER * buffer) +{ + unsigned long vip_control1, vip_control2; + unsigned long unlock, genlk_ctl; + + if (!buffer) + return CIM_STATUS_INVALIDPARAMS; + + unlock = READ_REG32(DC3_UNLOCK); + genlk_ctl = READ_REG32(DC3_GENLK_CTL); + vip_control1 = READ_VIP32(VIP_CONTROL1); + vip_control2 = READ_VIP32(VIP_CONTROL2); + + /* UPDATE VIDEO DETECTION */ + /* These flags are used to indicate the ways in which the VIP signal */ + /* can be considered 'lost'. */ + + vip_control1 &= ~VIP_CONTROL1_VDE_FF_MASK; + vip_control2 &= ~(VIP_CONTROL2_FIELD2VG_MASK | VIP_CONTROL2_SYNC2VG_MASK); + vip_control1 |= buffer->vip_signal_loss; + + /* UPDATE FIELD AND VSYNC INFORMATION */ + /* These flags control how and when the even/odd field and Vsync */ + /* information is communicated to the VG. */ + + vip_control2 |= buffer->field_to_vg; + vip_control2 |= buffer->vsync_to_vg; + + /* ENABLE OR DISABLE GENLOCK TIMEOUT */ + /* Enabling genlock timeout allows the VG to revert to its own sync */ + /* timings when the VIP input is lost. Note that the VIP will not */ + /* know the signal is lost unless the appropriate error detection */ + /* flags have been enabled inside vip_initialize. */ + + if (buffer->enable_timeout) + genlk_ctl |= DC3_GC_GENLOCK_TO_ENABLE; + else + genlk_ctl &= ~DC3_GC_GENLOCK_TO_ENABLE; + + genlk_ctl &= ~DC3_GC_GENLOCK_SKEW_MASK; + genlk_ctl |= buffer->genlock_skew & DC3_GC_GENLOCK_SKEW_MASK; + + WRITE_REG32(DC3_UNLOCK, DC3_UNLOCK_VALUE); + WRITE_REG32(DC3_GENLK_CTL, genlk_ctl); + WRITE_VIP32(VIP_CONTROL1, vip_control1); + WRITE_VIP32(VIP_CONTROL2, vip_control2); + WRITE_REG32(DC3_UNLOCK, unlock); + + return CIM_STATUS_OK; +} + +/*--------------------------------------------------------------------------- + * vip_set_genlock_enable + * + * This routine enables/disables genlock inside the VG. + *--------------------------------------------------------------------------*/ + +int +vip_set_genlock_enable(int enable) +{ + unsigned long unlock, temp; + + unlock = READ_REG32(DC3_UNLOCK); + temp = READ_REG32(DC3_GENLK_CTL); + + if (enable) + temp |= DC3_GC_GENLOCK_ENABLE; + else + temp &= ~DC3_GC_GENLOCK_ENABLE; + + WRITE_REG32(DC3_UNLOCK, DC3_UNLOCK_VALUE); + WRITE_REG32(DC3_GENLK_CTL, temp); + WRITE_REG32(DC3_UNLOCK, unlock); + + return CIM_STATUS_OK; +} + +/*--------------------------------------------------------------------------- + * vip_set_power_characteristics + * + * This routine takes a VIPPOWERBUFFER structure, and selectively sets the + * GeodeLink power and/or Vip clock power states. + *--------------------------------------------------------------------------*/ + +int +vip_set_power_characteristics(VIPPOWERBUFFER * buffer) +{ + Q_WORD q_word; + + if (!buffer) + return CIM_STATUS_INVALIDPARAMS; + + q_word.low = q_word.high = 0; + + /* ENABLE GEODELINK CLOCK GATING */ + + if (buffer->glink_clock_mode) + q_word.low |= VIP_MSR_POWER_GLINK; + + /* ENABLE VIP CLOCK GATING */ + + if (buffer->vip_clock_mode) + q_word.low |= VIP_MSR_POWER_CLOCK; + + /* WRITE THE NEW VALUE */ + + msr_write64(MSR_DEVICE_GEODELX_VIP, MSR_GEODELINK_PM, &q_word); + + return CIM_STATUS_OK; +} + +/*--------------------------------------------------------------------------- + * vip_set_priority_characteristics + * + * This routine programs the VIP GeodeLink priority characteristics + *--------------------------------------------------------------------------*/ + +int +vip_set_priority_characteristics(VIPPRIORITYBUFFER * buffer) +{ + Q_WORD q_word; + + if (!buffer) + return CIM_STATUS_INVALIDPARAMS; + + q_word.low = q_word.high = 0; + + q_word.low |= (buffer->secondary << + VIP_MSR_MCR_SECOND_PRIORITY_SHIFT) & VIP_MSR_MCR_SECOND_PRIORITY_MASK; + q_word.low |= (buffer->primary << + VIP_MSR_MCR_PRIMARY_PRIORITY_SHIFT) & + VIP_MSR_MCR_PRIMARY_PRIORITY_MASK; + q_word.low |= (buffer->pid << VIP_MSR_MCR_PID_SHIFT) & + VIP_MSR_MCR_PID_MASK; + + msr_write64(MSR_DEVICE_GEODELX_VIP, MSR_GEODELINK_CONFIG, &q_word); + + return CIM_STATUS_OK; +} + +/*--------------------------------------------------------------------------- + * vip_set_debug_characteristics + * + * This routine configures the debug data that is exposed over the diag bus. + *--------------------------------------------------------------------------*/ + +int +vip_set_debug_characteristics(VIPDEBUGBUFFER * buffer) +{ + Q_WORD q_word; + + if (!buffer) + return CIM_STATUS_INVALIDPARAMS; + + q_word.low = q_word.high = 0; + + q_word.high |= (buffer->bist << VIP_MSR_DIAG_BIST_SHIFT) & + VIP_MSR_DIAG_BIST_WMASK; + q_word.low |= (buffer->enable_upper ? + VIP_MSR_DIAG_MSB_ENABLE : 0x00000000); + q_word.low |= (buffer->select_upper << VIP_MSR_DIAG_SEL_UPPER_SHIFT) & + VIP_MSR_DIAG_SEL_UPPER_MASK; + q_word.low |= (buffer->enable_lower ? + VIP_MSR_DIAG_LSB_ENABLE : 0x00000000); + q_word.low |= (buffer->select_lower << VIP_MSR_DIAG_SEL_LOWER_SHIFT) & + VIP_MSR_DIAG_SEL_LOWER_MASK; + + msr_write64(MSR_DEVICE_GEODELX_VIP, MSR_GEODELINK_DIAG, &q_word); + + return CIM_STATUS_OK; +} + +/*--------------------------------------------------------------------------- + * vip_configure_pages + * + * This routine sets the number of pages, and their offset from each other. + *--------------------------------------------------------------------------*/ + +int +vip_configure_pages(int page_count, unsigned long page_offset) +{ + unsigned long vip_control2 = READ_VIP32(VIP_CONTROL2); + + /* SET THE NEW PAGE COUNT */ + + vip_control2 &= ~VIP_CONTROL2_PAGECNT_MASK; + vip_control2 |= (page_count << VIP_CONTROL2_PAGECNT_SHIFT) & + VIP_CONTROL2_PAGECNT_MASK; + + /* WRITE THE PAGE OFFSET */ + + WRITE_VIP32(VIP_CONTROL2, vip_control2); + WRITE_VIP32(VIP_PAGE_OFFSET, page_offset); + + return CIM_STATUS_OK; +} + +/*--------------------------------------------------------------------------- + * vip_set_interrupt_line + * + * This routine sets the line at which a line interrupt should be generated. + *--------------------------------------------------------------------------*/ + +int +vip_set_interrupt_line(int line) +{ + WRITE_VIP32(VIP_CURRENT_TARGET, + (line << VIP_CTARGET_TLINE_SHIFT) & VIP_CTARGET_TLINE_MASK); + + return CIM_STATUS_OK; +} + +/*--------------------------------------------------------------------------- + * vip_reset + * + * This routine does a one-shot enable of the VIP hardware. It is useful + * for handling unrecoverable VIP errors. + *--------------------------------------------------------------------------*/ + +int +vip_reset(void) +{ + unsigned long vip_control1, vip_control3; + + /* INVERT THE PAUSE BIT */ + + vip_control1 = READ_VIP32(VIP_CONTROL1); + vip_control3 = READ_VIP32(VIP_CONTROL3); + + WRITE_VIP32(VIP_CONTROL1, vip_control1 | VIP_CONTROL1_RESET); + WRITE_VIP32(VIP_CONTROL1, vip_control1 & ~VIP_CONTROL1_RESET); + WRITE_VIP32(VIP_CONTROL3, vip_control3 | VIP_CONTROL3_FIFO_RESET); + + return CIM_STATUS_OK; +} + +/*--------------------------------------------------------------------------- + * vip_set_subwindow_enable + * + * This routine turns on SubWindow capture, that is a portion of the incoming + * signal is captured rather than the entire frame. The window always has + * the same width as the frame, only the vertical component can be + * modified. + *--------------------------------------------------------------------------*/ + +int +vip_set_subwindow_enable(VIPSUBWINDOWBUFFER * buffer) +{ + unsigned long vip_control2; + + if (!buffer) + return CIM_STATUS_INVALIDPARAMS; + + vip_control2 = READ_VIP32(VIP_CONTROL2); + if (buffer->enable) { + /* WRITE THE WINDOW VALUE */ + + WRITE_VIP32(VIP_VERTICAL_START_STOP, ((buffer->stop << + VIP_VSTART_VERTEND_SHIFT) & + VIP_VSTART_VERTEND_MASK) | ((buffer->start << + VIP_VSTART_VERTSTART_SHIFT) & VIP_VSTART_VERTSTART_MASK)); + + /* ENABLE IN THE CONTROL REGISTER */ + + vip_control2 |= VIP_CONTROL2_SWC_ENABLE; + } else { + /* DISABLE SUBWINDOW CAPTURE IN THE CONTROL REGISTER */ + + vip_control2 &= ~VIP_CONTROL2_SWC_ENABLE; + } + WRITE_VIP32(VIP_CONTROL2, vip_control2); + + return CIM_STATUS_OK; +} + +/*--------------------------------------------------------------------------- + * vip_reset_interrupt_state + * + * This routine resets the state of one or more interrupts. + *--------------------------------------------------------------------------*/ + +int +vip_reset_interrupt_state(unsigned long interrupt_mask) +{ + unsigned long temp; + + temp = READ_VIP32(VIP_INTERRUPT); + WRITE_VIP32(VIP_INTERRUPT, temp | (interrupt_mask & VIP_ALL_INTERRUPTS)); + + return CIM_STATUS_OK; +} + +/*--------------------------------------------------------------------------- + * vip_save_state + * + * This routine saves the necessary register contents in order to restore + * at a later point to the same state. + * + * NOTE: Capture state is forced to OFF in this routine + *--------------------------------------------------------------------------*/ + +int +vip_save_state(VIPSTATEBUFFER * save_buffer) +{ + if (!save_buffer) + return CIM_STATUS_INVALIDPARAMS; + + /* FORCE CAPTURE TO BE DISABLED */ + + vip_set_capture_state(VIP_STOPCAPTURE); + + /* READ AND SAVE THE REGISTER CONTENTS */ + + save_buffer->control1 = READ_VIP32(VIP_CONTROL1); + save_buffer->control2 = READ_VIP32(VIP_CONTROL2); + save_buffer->vip_int = READ_VIP32(VIP_INTERRUPT); + save_buffer->current_target = READ_VIP32(VIP_CURRENT_TARGET); + save_buffer->max_address = READ_VIP32(VIP_MAX_ADDRESS); + save_buffer->taska_evenbase = READ_VIP32(VIP_TASKA_VID_EVEN_BASE); + save_buffer->taska_oddbase = READ_VIP32(VIP_TASKA_VID_ODD_BASE); + save_buffer->taska_vbi_evenbase = READ_VIP32(VIP_TASKA_VBI_EVEN_BASE); + save_buffer->taska_vbi_oddbase = READ_VIP32(VIP_TASKA_VBI_ODD_BASE); + save_buffer->taska_data_pitch = READ_VIP32(VIP_TASKA_VID_PITCH); + save_buffer->control3 = READ_VIP32(VIP_CONTROL3); + save_buffer->taska_v_oddoffset = READ_VIP32(VIP_TASKA_U_OFFSET); + save_buffer->taska_u_oddoffset = READ_VIP32(VIP_TASKA_V_OFFSET); + save_buffer->taskb_evenbase = READ_VIP32(VIP_TASKB_VID_EVEN_BASE); + save_buffer->taskb_oddbase = READ_VIP32(VIP_TASKB_VID_ODD_BASE); + save_buffer->taskb_vbi_evenbase = READ_VIP32(VIP_TASKB_VBI_EVEN_BASE); + save_buffer->taskb_vbi_oddbase = READ_VIP32(VIP_TASKB_VBI_ODD_BASE); + save_buffer->taskb_pitch = READ_VIP32(VIP_TASKB_VID_PITCH); + save_buffer->taskb_voffset = READ_VIP32(VIP_TASKB_U_OFFSET); + save_buffer->taskb_uoffset = READ_VIP32(VIP_TASKB_V_OFFSET); + save_buffer->msg1_base = READ_VIP32(VIP_ANC_MSG1_BASE); + save_buffer->msg2_base = READ_VIP32(VIP_ANC_MSG2_BASE); + save_buffer->msg_size = READ_VIP32(VIP_ANC_MSG_SIZE); + save_buffer->page_offset = READ_VIP32(VIP_PAGE_OFFSET); + save_buffer->vert_start_stop = READ_VIP32(VIP_VERTICAL_START_STOP); + save_buffer->vsync_err_count = READ_VIP32(VIP_VSYNC_ERR_COUNT); + save_buffer->taska_u_evenoffset = READ_VIP32(VIP_TASKA_U_EVEN_OFFSET); + save_buffer->taska_v_evenoffset = READ_VIP32(VIP_TASKA_V_EVEN_OFFSET); + + /* READ ALL VIP MSRS */ + + msr_read64(MSR_DEVICE_GEODELX_VIP, MSR_GEODELINK_CONFIG, + &(save_buffer->msr_config)); + msr_read64(MSR_DEVICE_GEODELX_VIP, MSR_GEODELINK_SMI, + &(save_buffer->msr_smi)); + msr_read64(MSR_DEVICE_GEODELX_VIP, MSR_GEODELINK_PM, + &(save_buffer->msr_pm)); + msr_read64(MSR_DEVICE_GEODELX_VIP, MSR_GEODELINK_DIAG, + &(save_buffer->msr_diag)); + + return CIM_STATUS_OK; +} + +/*--------------------------------------------------------------------------- + * vip_restore_state + * + * This routine restores the state of the vip registers - which were + * previously saved using vip_save_state. + *--------------------------------------------------------------------------*/ + +int +vip_restore_state(VIPSTATEBUFFER * restore_buffer) +{ + if (!restore_buffer) + return CIM_STATUS_OK; + + /* RESTORE THE REGISTERS */ + + WRITE_VIP32(VIP_CURRENT_TARGET, restore_buffer->current_target); + WRITE_VIP32(VIP_MAX_ADDRESS, restore_buffer->max_address); + WRITE_VIP32(VIP_TASKA_VID_EVEN_BASE, restore_buffer->taska_evenbase); + WRITE_VIP32(VIP_TASKA_VID_ODD_BASE, restore_buffer->taska_oddbase); + WRITE_VIP32(VIP_TASKA_VBI_EVEN_BASE, restore_buffer->taska_vbi_evenbase); + WRITE_VIP32(VIP_TASKA_VBI_ODD_BASE, restore_buffer->taska_vbi_oddbase); + WRITE_VIP32(VIP_TASKA_VID_PITCH, restore_buffer->taska_data_pitch); + WRITE_VIP32(VIP_CONTROL3, restore_buffer->control3); + WRITE_VIP32(VIP_TASKA_U_OFFSET, restore_buffer->taska_v_oddoffset); + WRITE_VIP32(VIP_TASKA_V_OFFSET, restore_buffer->taska_u_oddoffset); + WRITE_VIP32(VIP_TASKB_VID_EVEN_BASE, restore_buffer->taskb_evenbase); + WRITE_VIP32(VIP_TASKB_VID_ODD_BASE, restore_buffer->taskb_oddbase); + WRITE_VIP32(VIP_TASKB_VBI_EVEN_BASE, restore_buffer->taskb_vbi_evenbase); + WRITE_VIP32(VIP_TASKB_VBI_ODD_BASE, restore_buffer->taskb_vbi_oddbase); + WRITE_VIP32(VIP_TASKB_VID_PITCH, restore_buffer->taskb_pitch); + WRITE_VIP32(VIP_TASKB_U_OFFSET, restore_buffer->taskb_voffset); + WRITE_VIP32(VIP_TASKB_V_OFFSET, restore_buffer->taskb_uoffset); + WRITE_VIP32(VIP_ANC_MSG1_BASE, restore_buffer->msg1_base); + WRITE_VIP32(VIP_ANC_MSG2_BASE, restore_buffer->msg2_base); + WRITE_VIP32(VIP_ANC_MSG_SIZE, restore_buffer->msg_size); + WRITE_VIP32(VIP_PAGE_OFFSET, restore_buffer->page_offset); + WRITE_VIP32(VIP_VERTICAL_START_STOP, restore_buffer->vert_start_stop); + WRITE_VIP32(VIP_VSYNC_ERR_COUNT, restore_buffer->vsync_err_count); + WRITE_VIP32(VIP_TASKA_U_EVEN_OFFSET, restore_buffer->taska_u_evenoffset); + WRITE_VIP32(VIP_TASKA_V_EVEN_OFFSET, restore_buffer->taska_v_evenoffset); + + /* RESTORE THE VIP MSRS */ + + msr_write64(MSR_DEVICE_GEODELX_VIP, MSR_GEODELINK_CONFIG, + &(restore_buffer->msr_config)); + msr_write64(MSR_DEVICE_GEODELX_VIP, MSR_GEODELINK_SMI, + &(restore_buffer->msr_smi)); + msr_write64(MSR_DEVICE_GEODELX_VIP, MSR_GEODELINK_PM, + &(restore_buffer->msr_pm)); + msr_write64(MSR_DEVICE_GEODELX_VIP, MSR_GEODELINK_DIAG, + &(restore_buffer->msr_diag)); + + /* RESTORE THE CONTROL WORDS LAST */ + + WRITE_VIP32(VIP_CONTROL1, restore_buffer->control1); + WRITE_VIP32(VIP_CONTROL2, restore_buffer->control2); + WRITE_VIP32(VIP_CONTROL3, restore_buffer->control3); + + return CIM_STATUS_OK; +} + +/*--------------------------------------------------------------------------- + * vip_get_interrupt_state + * + * This routine returns the current interrupt state of the system. The + * rv can be tested with the following flags to determine if the appropriate + * event has occured. + *--------------------------------------------------------------------------*/ + +unsigned long +vip_get_interrupt_state(void) +{ + unsigned long interrupt_mask = READ_VIP32(VIP_INTERRUPT); + + return (~(interrupt_mask << 16) & interrupt_mask & VIP_ALL_INTERRUPTS); +} + +/*--------------------------------------------------------------------------- + * vip_test_genlock_active + * + * This routine reads the live status of the genlock connection between the + * VIP and VG blocks. + *--------------------------------------------------------------------------*/ + +int +vip_test_genlock_active(void) +{ + if (READ_REG32(DC3_GENLK_CTL) & DC3_GC_GENLK_ACTIVE) + return 1; + + return 0; +} + +/*--------------------------------------------------------------------------- + * vip_test_signal_status + * + * This routine reads the live signal status coming into the VIP block. + *--------------------------------------------------------------------------*/ + +int +vip_test_signal_status(void) +{ + if (READ_REG32(DC3_GENLK_CTL) & DC3_GC_VIP_VID_OK) + return 1; + + return 0; +} + +/*--------------------------------------------------------------------------- + * vip_get_current_field + * + * This routine returns the current field being received. + *--------------------------------------------------------------------------*/ + +unsigned long +vip_get_current_field(void) +{ + if (READ_VIP32(VIP_STATUS) & VIP_STATUS_FIELD) + return VIP_EVEN_FIELD; + + return VIP_ODD_FIELD; +} + +/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + * CIMARRON VIP READ ROUTINES + * These routines are included for use in diagnostics or when debugging. They + * can be optionally excluded from a project. + *++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ + +#if CIMARRON_INCLUDE_VIP_READ_ROUTINES + +/*--------------------------------------------------------------------------- + * vip_get_current_mode + * + * This routine reads the current VIP operating mode. + *--------------------------------------------------------------------------*/ + +int +vip_get_current_mode(VIPSETMODEBUFFER * buffer) +{ + unsigned long vip_control1, vip_control2, vip_control3; + + if (!buffer) + return CIM_STATUS_INVALIDPARAMS; + + vip_control1 = READ_VIP32(VIP_CONTROL1); + vip_control2 = READ_VIP32(VIP_CONTROL2); + vip_control3 = READ_VIP32(VIP_CONTROL3); + + /* READ CURRENT OPERATING MODE AND ENABLES */ + + buffer->stream_enables = vip_control1 & VIP_ENABLE_ALL; + buffer->operating_mode = vip_control1 & VIP_CONTROL1_MODE_MASK; + + /* READ CURRENT PLANAR CAPTURE SETTINGS */ + + buffer->flags = 0; + buffer->planar_capture = 0; + if (vip_control1 & VIP_CONTROL1_PLANAR) { + buffer->flags |= VIP_MODEFLAG_PLANARCAPTURE; + if (vip_control1 & VIP_CONTROL1_DISABLE_DECIMATION) { + if (vip_control3 & VIP_CONTROL3_DECIMATE_EVEN) + buffer->planar_capture = VIP_420CAPTURE_ALTERNATINGFIELDS; + else + buffer->planar_capture = VIP_420CAPTURE_EVERYLINE; + } else + buffer->planar_capture = VIP_420CAPTURE_ALTERNATINGLINES; + } + + /* READ MISCELLANEOUS FLAGS */ + + if (vip_control1 & VIP_CONTROL1_NON_INTERLACED) + buffer->flags |= VIP_MODEFLAG_PROGRESSIVE; + if (vip_control3 & VIP_CONTROL3_BASE_UPDATE) + buffer->flags |= VIP_MODEFLAG_TOGGLEEACHFIELD; + if (vip_control2 & VIP_CONTROL2_INVERT_POLARITY) + buffer->flags |= VIP_MODEFLAG_INVERTPOLARITY; + if (vip_control1 & VIP_CONTROL1_MSG_STRM_CTRL) + buffer->flags |= VIP_MODEFLAG_FLIPMESSAGEWHENFULL; + if (vip_control2 & VIP_CONTROL2_REPEAT_ENABLE) + buffer->flags |= VIP_MODEFLAG_ENABLEREPEATFLAG; + if (vip_control3 & VIP_CONTROL3_TASK_POLARITY) + buffer->flags |= VIP_MODEFLAG_INVERTTASKPOLARITY; + if (vip_control1 & VIP_CONTROL1_DISABLE_ZERO_DETECT) + buffer->flags |= VIP_MODEFLAG_DISABLEZERODETECT; + if (vip_control2 & VIP_CONTROL2_ANC10) + buffer->flags |= VIP_MODEFLAG_10BITANCILLARY; + + /* READ THE CURRENT VIP 601 SETTINGS */ + + vip_get_601_configuration(&buffer->vip601_settings); + + return CIM_STATUS_OK; +} + +/*--------------------------------------------------------------------------- + * vip_get_601_configuration + * + * This routine returns the current 601 configuration information. + *--------------------------------------------------------------------------*/ + +int +vip_get_601_configuration(VIP_601PARAMS * buffer) +{ + unsigned long vip_control3, vip_control1; + + if (!buffer) + return CIM_STATUS_INVALIDPARAMS; + + vip_control1 = READ_VIP32(VIP_CONTROL3); + vip_control3 = READ_VIP32(VIP_CONTROL3); + + buffer->flags = 0; + if (vip_control3 & VIP_CONTROL3_VSYNC_POLARITY) + buffer->flags |= VIP_MODEFLAG_VSYNCACTIVEHIGH; + if (vip_control3 & VIP_CONTROL3_HSYNC_POLARITY) + buffer->flags |= VIP_MODEFLAG_HSYNCACTIVEHIGH; + + buffer->horz_start = READ_VIP32(VIP_601_HORZ_START); + buffer->vbi_start = READ_VIP32(VIP_601_VBI_START); + buffer->vbi_height = READ_VIP32(VIP_601_VBI_END) - buffer->vbi_start + 1; + buffer->vert_start_even = READ_VIP32(VIP_601_EVEN_START_STOP) & 0xFFFF; + buffer->even_height = (READ_VIP32(VIP_601_EVEN_START_STOP) >> 16) - + buffer->vert_start_even + 1; + buffer->vert_start_odd = READ_VIP32(VIP_601_ODD_START_STOP) & 0xFFFF; + buffer->odd_height = (READ_VIP32(VIP_601_ODD_START_STOP) >> 16) - + buffer->vert_start_odd + 1; + buffer->odd_detect_start = READ_VIP32(VIP_ODD_FIELD_DETECT) & 0xFFFF; + buffer->odd_detect_end = READ_VIP32(VIP_ODD_FIELD_DETECT) >> 16; + + /* SPECIAL CASE FOR HORIZONTAL DATA + * 601 horizontal parameters are based on the number of clocks and not + * the number of pixels. + */ + + if ((vip_control1 & VIP_CONTROL1_MODE_MASK) == VIP_MODE_16BIT601) + buffer->width = (READ_VIP32(VIP_601_HORZ_END) - + buffer->horz_start - 3) >> 1; + else + buffer->width = (READ_VIP32(VIP_601_HORZ_END) - + buffer->horz_start - 3); + + return CIM_STATUS_OK; +} + +/*--------------------------------------------------------------------------- + * vip_get_buffer_configuration + * + * This routine reads the current buffer configuration for Task A, Task B, + * ancillary or message data. The current_buffer member indicates which + * array index should hold the new values for Task A or Task B data. + *--------------------------------------------------------------------------*/ + +int +vip_get_buffer_configuration(int buffer_type, VIPINPUTBUFFER * buffer) +{ + unsigned long cur_buffer = buffer->current_buffer; + VIPINPUTBUFFER_ADDR *offsets; + + if (!buffer) + return CIM_STATUS_INVALIDPARAMS; + + if (buffer_type == VIP_BUFFER_A) { + offsets = &buffer->offsets[VIP_BUFFER_TASK_A]; + + /* READ VIDEO PITCH */ + + offsets->y_pitch = READ_VIP32(VIP_TASKA_VID_PITCH) & 0xFFFF; + offsets->uv_pitch = READ_VIP32(VIP_TASKA_VID_PITCH) >> 16; + + /* READ BASE OFFSETS */ + + if (buffer->flags & VIP_INPUTFLAG_INVERTPOLARITY) { + offsets->even_base[cur_buffer] = + READ_VIP32(VIP_TASKA_VID_ODD_BASE); + offsets->odd_base[cur_buffer] = + READ_VIP32(VIP_TASKA_VID_EVEN_BASE); + + if (buffer->flags & VIP_INPUTFLAG_VBI) { + offsets->vbi_even_base = READ_VIP32(VIP_TASKA_VBI_ODD_BASE); + offsets->vbi_odd_base = READ_VIP32(VIP_TASKA_VBI_EVEN_BASE); + } + } else { + offsets->even_base[cur_buffer] = + READ_VIP32(VIP_TASKA_VID_EVEN_BASE); + offsets->odd_base[cur_buffer] = + READ_VIP32(VIP_TASKA_VID_ODD_BASE); + + if (buffer->flags & VIP_INPUTFLAG_VBI) { + offsets->vbi_even_base = READ_VIP32(VIP_TASKA_VBI_EVEN_BASE); + offsets->vbi_odd_base = READ_VIP32(VIP_TASKA_VBI_ODD_BASE); + } + } + + /* READ 4:2:0 OFFSETS */ + + if (buffer->flags & VIP_INPUTFLAG_PLANAR) { + offsets->odd_uoffset = READ_VIP32(VIP_TASKA_U_OFFSET); + offsets->odd_voffset = READ_VIP32(VIP_TASKA_V_OFFSET); + offsets->even_uoffset = READ_VIP32(VIP_TASKA_U_EVEN_OFFSET); + offsets->even_voffset = READ_VIP32(VIP_TASKA_V_EVEN_OFFSET); + } + } else if (buffer_type == VIP_BUFFER_B) { + offsets = &buffer->offsets[VIP_BUFFER_TASK_B]; + + /* READ VIDEO PITCH */ + + offsets->y_pitch = READ_VIP32(VIP_TASKB_VID_PITCH) & 0xFFFF; + offsets->uv_pitch = READ_VIP32(VIP_TASKB_VID_PITCH) >> 16; + + /* READ BASE OFFSETS */ + + if (buffer->flags & VIP_INPUTFLAG_INVERTPOLARITY) { + offsets->even_base[cur_buffer] = + READ_VIP32(VIP_TASKB_VID_ODD_BASE); + offsets->odd_base[cur_buffer] = + READ_VIP32(VIP_TASKB_VID_EVEN_BASE); + + if (buffer->flags & VIP_INPUTFLAG_VBI) { + offsets->vbi_even_base = READ_VIP32(VIP_TASKB_VBI_ODD_BASE); + offsets->vbi_odd_base = READ_VIP32(VIP_TASKB_VBI_EVEN_BASE); + } + } else { + offsets->even_base[cur_buffer] = + READ_VIP32(VIP_TASKB_VID_EVEN_BASE); + offsets->odd_base[cur_buffer] = + READ_VIP32(VIP_TASKB_VID_ODD_BASE); + + if (buffer->flags & VIP_INPUTFLAG_VBI) { + offsets->vbi_even_base = READ_VIP32(VIP_TASKB_VBI_EVEN_BASE); + offsets->vbi_odd_base = READ_VIP32(VIP_TASKB_VBI_ODD_BASE); + } + } + + /* READ 4:2:0 OFFSETS */ + + if (buffer->flags & VIP_INPUTFLAG_PLANAR) { + offsets->odd_uoffset = READ_VIP32(VIP_TASKB_U_OFFSET); + offsets->odd_voffset = READ_VIP32(VIP_TASKB_V_OFFSET); + } + } else if (buffer_type == VIP_BUFFER_ANC || buffer_type == VIP_BUFFER_MSG) { + buffer->ancillaryData.msg1_base = READ_VIP32(VIP_ANC_MSG1_BASE); + buffer->ancillaryData.msg2_base = READ_VIP32(VIP_ANC_MSG2_BASE); + buffer->ancillaryData.msg_size = READ_VIP32(VIP_ANC_MSG_SIZE); + } else { + return CIM_STATUS_INVALIDPARAMS; + } + + return CIM_STATUS_OK; +} + +/*--------------------------------------------------------------------------- + * vip_get_genlock_configuration + * + * This routine reads the current genlock configuration. + *--------------------------------------------------------------------------*/ + +int +vip_get_genlock_configuration(VIPGENLOCKBUFFER * buffer) +{ + unsigned long vip_control1, vip_control2; + unsigned long genlk_ctl; + + if (!buffer) + return CIM_STATUS_INVALIDPARAMS; + + genlk_ctl = READ_REG32(DC3_GENLK_CTL); + vip_control1 = READ_VIP32(VIP_CONTROL1); + vip_control2 = READ_VIP32(VIP_CONTROL2); + + /* READ ERROR DETECTION, CURRENT FIELD AND CURRENT VSYNC + * These flags are used to indicate the ways in which the VIP signal can + * be considered 'lost'. + */ + + buffer->vip_signal_loss = vip_control1 & VIP_CONTROL1_VDE_FF_MASK; + buffer->field_to_vg = vip_control2 & VIP_CONTROL2_FIELD2VG_MASK; + buffer->vsync_to_vg = vip_control2 & VIP_CONTROL2_SYNC2VG_MASK; + + /* GENLOCK TIMEOUT ENABLE */ + + buffer->enable_timeout = 0; + if (genlk_ctl & DC3_GC_GENLOCK_TO_ENABLE) + buffer->enable_timeout = 1; + + /* GENLOCK SKEW */ + + buffer->genlock_skew = genlk_ctl & DC3_GC_GENLOCK_SKEW_MASK; + + return CIM_STATUS_OK; +} + +/*--------------------------------------------------------------------------- + * vip_get_genlock_enable + * + * This routine returns the current enable status of genlock in the VG. + *--------------------------------------------------------------------------*/ + +int +vip_get_genlock_enable(void) +{ + if (READ_REG32(DC3_GENLK_CTL) & DC3_GC_GENLOCK_ENABLE) + return 1; + + return 0; +} + +/*--------------------------------------------------------------------------- + * vip_is_buffer_update_latched + * + * This routine indicates whether changes to the VIP offsets have been + * latched by the hardware. + *--------------------------------------------------------------------------*/ + +int +vip_is_buffer_update_latched(void) +{ + return (!(READ_VIP32(VIP_STATUS) & VIP_STATUS_BASEREG_NOTUPDT)); +} + +/*--------------------------------------------------------------------------- + * vip_get_capture_state + * + * This routine reads the current capture status of the VIP hardware. + *--------------------------------------------------------------------------*/ + +unsigned long +vip_get_capture_state(void) +{ + return ((READ_VIP32(VIP_CONTROL1) & VIP_CONTROL1_RUNMODE_MASK) >> + VIP_CONTROL1_RUNMODE_SHIFT); +} + +/*--------------------------------------------------------------------------- + * vip_get_current_line + * + * This routine returns the current line that is being processed. + *--------------------------------------------------------------------------*/ + +unsigned long +vip_get_current_line(void) +{ + return (READ_VIP32(VIP_CURRENT_TARGET) & VIP_CTARGET_CLINE_MASK); +} + +/*--------------------------------------------------------------------------- + * vip_read_fifo + * + * This routine reads from the specified fifo address. As the fifo access + * enable should be disabled when running in normal vip mode, this routine + * enables and disables access around the read. + * DIAGNOSTIC USE ONLY + *--------------------------------------------------------------------------*/ + +unsigned long +vip_read_fifo(unsigned long dwFifoAddress) +{ + unsigned long fifo_data; + + /* ENABLE FIFO ACCESS */ + + vip_enable_fifo_access(1); + + /* NOW READ THE DATA */ + + WRITE_VIP32(VIP_FIFO_ADDRESS, dwFifoAddress); + fifo_data = READ_VIP32(VIP_FIFO_DATA); + + /* DISABLE FIFO ACCESS */ + + vip_enable_fifo_access(0); + + return fifo_data; +} + +/*--------------------------------------------------------------------------- + * vip_write_fifo + * + * SYNOPSIS: + * This routine writes to the specified fifo address. As the fifo access + * enable should be disabled when running in normal vip mode, this routine + * enables and disables access around the write. + * DIAGNOSTIC USE ONLY + *--------------------------------------------------------------------------*/ + +int +vip_write_fifo(unsigned long dwFifoAddress, unsigned long dwFifoData) +{ + /* ENABLE FIFO ACCESS */ + + vip_enable_fifo_access(1); + + /* WRITE THE FIFO DATA */ + + WRITE_VIP32(VIP_FIFO_ADDRESS, dwFifoAddress); + WRITE_VIP32(VIP_FIFO_DATA, dwFifoData); + + /* DISABLE FIFO ACCESS */ + + vip_enable_fifo_access(0); + + return CIM_STATUS_OK; +} + +/*--------------------------------------------------------------------------- + * vip_enable_fifo_access + * + * This routine enables/disables access to the vip fifo. + * DIAGNOSTIC USE ONLY + *--------------------------------------------------------------------------*/ + +int +vip_enable_fifo_access(int enable) +{ + unsigned long cw2; + + cw2 = READ_VIP32(VIP_CONTROL2); + + if (enable) + cw2 |= VIP_CONTROL2_FIFO_ACCESS; + else + cw2 &= ~VIP_CONTROL2_FIFO_ACCESS; + + WRITE_VIP32(VIP_CONTROL2, cw2); + + return CIM_STATUS_OK; +} + +/*--------------------------------------------------------------------------- + * vip_get_power_characteristics + * + * This routine returns the current VIP clock gating state in a + * VIPPOWERBUFFER. + *--------------------------------------------------------------------------*/ + +int +vip_get_power_characteristics(VIPPOWERBUFFER * buffer) +{ + Q_WORD q_word; + + if (!buffer) + return CIM_STATUS_INVALIDPARAMS; + + /* READ THE EXISTING STATE */ + + msr_read64(MSR_DEVICE_GEODELX_VIP, MSR_GEODELINK_PM, &q_word); + + /* DECODE THE CLOCK GATING BITS */ + + buffer->glink_clock_mode = (int)(q_word.low & VIP_MSR_POWER_GLINK); + buffer->vip_clock_mode = (int)(q_word.low & VIP_MSR_POWER_CLOCK); + + return CIM_STATUS_OK; +} + +/*--------------------------------------------------------------------------- + * vip_get_priority_characteristics + * + * This routine returns the priority characteristics in the supplied + * VIPPRIORITYBUFFER. + *--------------------------------------------------------------------------*/ + +int +vip_get_priority_characteristics(VIPPRIORITYBUFFER * buffer) +{ + Q_WORD q_word; + + if (!buffer) + return CIM_STATUS_INVALIDPARAMS; + + /* READ THE CURRENT STATE */ + + msr_read64(MSR_DEVICE_GEODELX_VIP, MSR_GEODELINK_CONFIG, &q_word); + + /* DECODE THE PRIORITIES */ + + buffer->secondary = (q_word.low & VIP_MSR_MCR_SECOND_PRIORITY_MASK) >> + VIP_MSR_MCR_SECOND_PRIORITY_SHIFT; + buffer->primary = (q_word.low & VIP_MSR_MCR_PRIMARY_PRIORITY_MASK) >> + VIP_MSR_MCR_PRIMARY_PRIORITY_SHIFT; + buffer->pid = q_word.low & VIP_MSR_MCR_PID_MASK; + + return CIM_STATUS_OK; +} + +/*--------------------------------------------------------------------------- + * vip_get_capability_characteristics + * + * This routine returns revision information for the device. + *--------------------------------------------------------------------------*/ + +int +vip_get_capability_characteristics(VIPCAPABILITIESBUFFER * buffer) +{ + Q_WORD q_word; + + if (!buffer) + return CIM_STATUS_INVALIDPARAMS; + + /* READ THE CURRENT MSR CONTENTS */ + + msr_read64(MSR_DEVICE_GEODELX_VIP, MSR_GEODELINK_CAP, &q_word); + + /* DECODE THE REVISIONS */ + + buffer->revision_id = (q_word.low & VIP_MSR_CAP_REVID_MASK) >> + VIP_MSR_CAP_REVID_SHIFT; + buffer->device_id = (q_word.low & VIP_MSR_CAP_DEVID_MASK) >> + VIP_MSR_CAP_DEVID_SHIFT; + buffer->n_clock_domains = (q_word.low & VIP_MSR_CAP_NCLK_MASK) >> + VIP_MSR_CAP_NCLK_SHIFT; + buffer->n_smi_registers = (q_word.low & VIP_MSR_CAP_NSMI_MASK) >> + VIP_MSR_CAP_NSMI_SHIFT; + + return CIM_STATUS_OK; +} + +#endif diff --git a/driver/xf86-video-geode/src/cim/cim_vop.c b/driver/xf86-video-geode/src/cim/cim_vop.c new file mode 100644 index 000000000..4b83c0314 --- /dev/null +++ b/driver/xf86-video-geode/src/cim/cim_vop.c @@ -0,0 +1,604 @@ +/* + * Copyright (c) 2006 Advanced Micro Devices, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + * Neither the name of the Advanced Micro Devices, Inc. nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + */ + + /* + * Cimarron VOP configuration routines. + */ + +/*--------------------------------------------------------------------------- + * vop_set_vbi_window + * + * This routine configures the output position and location in memory of + * VBI data. + *--------------------------------------------------------------------------*/ + +int +vop_set_vbi_window(VOPVBIWINDOWBUFFER * buffer) +{ + unsigned long unlock, temp; + unsigned long hstart, hstop; + unsigned long htotal, hsyncstart; + + if (!buffer) + return CIM_STATUS_INVALIDPARAMS; + + unlock = READ_REG32(DC3_UNLOCK); + WRITE_REG32(DC3_UNLOCK, DC3_UNLOCK_VALUE); + + /* PROGRAM HORIZONTAL POSITION + * The horizontal position is a little tricky. The counter for the + * horizontal timings is reused for the VBI counter. Consequently, the + * horizontal start and stop values are based off the beginning of active + * data. However, the VG has a quirk. If the counter start position is + * before the beginning of HSync, it applies to the previous line. If + * the counter is after the beginning of HSync it applies to the current + * line. So, for one line the real range can be thought of as + * HSync_start to (HSync_start + htotal - 1). However, the counters + * must be between 0 and htotal - 1. When placing VBI data before the + * start of active data, the horizontal end position will thus be *less* + * than the horizontal start. + */ + + htotal = ((READ_REG32(DC3_H_ACTIVE_TIMING) >> 16) & 0xFFF) + 1; + hsyncstart = (READ_REG32(DC3_H_SYNC_TIMING) & 0xFFF) + 1; + + if (buffer->horz_from_hsync) { + /* VERIFY THAT THE INPUT IS VALID */ + + if (buffer->horz_start < 0 + || (buffer->horz_start + buffer->vbi_width) > htotal) + return CIM_STATUS_INVALIDPARAMS; + + hstart = buffer->horz_start + hsyncstart; + } else { + /* VERIFY THAT THE INPUT IS VALID */ + + if (buffer->horz_start < ((long)hsyncstart - (long)htotal) || + buffer->horz_start > (long)hsyncstart || + buffer->vbi_width > htotal) { + return CIM_STATUS_INVALIDPARAMS; + } + + hstart = buffer->horz_start + htotal; + } + + hstop = hstart + buffer->vbi_width; + if (hstart > htotal) + hstart -= htotal; + if (hstop > htotal) + hstop -= htotal; + hstart--; + hstop--; + WRITE_REG32(DC3_VBI_HOR, ((hstop << DC3_VBI_HOR_END_SHIFT) & + DC3_VBI_HOR_END_MASK) | (hstart & DC3_VBI_HOR_START_MASK)); + + /* WRITE LINE CAPTURE MASKS */ + + WRITE_REG32(DC3_VBI_LN_ODD, ((buffer->odd_line_offset << + DC3_VBI_ODD_LINE_SHIFT) & DC3_VBI_ODD_LINE_MASK) | + (buffer->odd_line_capture_mask & DC3_VBI_ODD_ENABLE_MASK)); + + WRITE_REG32(DC3_VBI_LN_EVEN, ((buffer->even_line_offset << + DC3_VBI_EVEN_LINE_SHIFT) & DC3_VBI_EVEN_LINE_MASK) | + (buffer->even_line_capture_mask & DC3_VBI_EVEN_ENABLE_MASK)); + + /* PROGRAM SOURCE OFFSETS + * Start with the even offsets. Note that we always enable 16-bit VBI, + * as this is the only way to get VBI data on each VOP clock. + */ + + temp = READ_REG32(DC3_VBI_EVEN_CTL) & ~DC3_VBI_EVEN_CTL_OFFSET_MASK; + temp |= DC3_VBI_EVEN_CTL_ENABLE_16; + if (buffer->enable_upscale) + temp |= DC3_VBI_EVEN_CTL_UPSCALE; + WRITE_REG32(DC3_VBI_EVEN_CTL, temp | + (buffer->even_address_offset & DC3_VBI_EVEN_CTL_OFFSET_MASK)); + + /* ODD OFFSET */ + + temp = READ_REG32(DC3_VBI_ODD_CTL) & ~DC3_VBI_ODD_CTL_OFFSET_MASK; + WRITE_REG32(DC3_VBI_ODD_CTL, temp | + (buffer->odd_address_offset & DC3_VBI_ODD_CTL_OFFSET_MASK)); + + /* PITCH */ + + temp = ((buffer->data_size >> 3) << 16) | ((buffer->data_pitch >> 3) & + 0x0000FFFF); + WRITE_REG32(DC3_VBI_PITCH, temp); + + WRITE_REG32(DC3_UNLOCK, unlock); + + return CIM_STATUS_OK; +} + +/*--------------------------------------------------------------------------- + * vop_enable_vbi_output + * + * This routine enables/disables VBI fetching inside the video generator. + *--------------------------------------------------------------------------*/ + +int +vop_enable_vbi_output(int enable) +{ + unsigned long unlock, temp; + + unlock = READ_REG32(DC3_UNLOCK); + temp = READ_REG32(DC3_VBI_EVEN_CTL); + + if (enable) + temp |= DC3_VBI_ENABLE; + else + temp &= ~DC3_VBI_ENABLE; + + WRITE_REG32(DC3_UNLOCK, DC3_UNLOCK_VALUE); + WRITE_REG32(DC3_VBI_EVEN_CTL, temp); + WRITE_REG32(DC3_UNLOCK, unlock); + + return CIM_STATUS_OK; +} + +/*--------------------------------------------------------------------------- + * vop_set_configuration + * + * This routine is passed a VOP_CONFIGURATION structure that contains all + * the necessary information to configure VOP output. + *--------------------------------------------------------------------------*/ + +int +vop_set_configuration(VOPCONFIGURATIONBUFFER * config) +{ + unsigned long vop_config = 0; + unsigned long alpha, control2; + unsigned long unlock; + unsigned long delta; + Q_WORD msr_value; + int rgb = 0; + + if (!config) + return CIM_STATUS_INVALIDPARAMS; + + unlock = READ_REG32(DC3_UNLOCK); + delta = READ_REG32(DC3_VID_DS_DELTA) & DC3_DS_DELTA_MASK; + + /* OVERRIDE THE OUTPUT SETTINGS TO ENABLE VOP OUTPUT */ + + if (config->mode != VOP_MODE_DISABLED) { + msr_read64(MSR_DEVICE_GEODELX_DF, MSR_GEODELINK_CONFIG, &msr_value); + msr_value.low &= ~DF_CONFIG_OUTPUT_MASK; + msr_value.low |= DF_OUTPUT_VOP; + msr_write64(MSR_DEVICE_GEODELX_DF, MSR_GEODELINK_CONFIG, &msr_value); + } + + /* SET THE UNIVERSAL VOP OPTIONS */ + + if (config->flags & VOP_FLAG_SWAP_UV) + vop_config |= VOP_CONFIG_SWAPUV; + if (config->flags & VOP_FLAG_SWAP_VBI) + vop_config |= VOP_CONFIG_SWAPVBI; + + /* SET THE MODE SPECIFIC PARAMETERS */ + + if (config->mode == VOP_MODE_601) { + vop_config |= config->vop601.flags; + vop_config |= config->vop601.vsync_shift; + vop_config |= VOP_CONFIG_ENABLE_601 | VOP_CONFIG_VIP2_0; + + switch (config->vop601.output_mode) { + case VOP_601_YUV_16BIT: + vop_config |= VOP_CONFIG_VIP2_16BIT; + break; + case VOP_601_YUV_4_4_4: + vop_config |= VOP_CONFIG_DISABLE_DECIMATE; + break; + case VOP_601_RGB_8_8_8: + vop_config |= VOP_CONFIG_DISABLE_DECIMATE | VOP_CONFIG_RGBMODE; + rgb = 1; + break; + } + + if (config->vop601.vsync_shift == VOP_VSYNC_LATER_BY_X) { + delta |= (config->vop601.vsync_shift_count & + DC3_601_VSYNC_SHIFT_MASK); + delta |= DC3_601_VSYNC_SHIFT_ENABLE; + } + } else { + if (config->flags & VOP_FLAG_VBI) + vop_config |= VOP_CONFIG_VBI; + if (config->flags & VOP_FLAG_TASK) + vop_config |= VOP_CONFIG_TASK; + if (config->flags & VOP_FLAG_SINGLECHIPCOMPAT) + vop_config |= VOP_CONFIG_SC_COMPATIBLE; + if (config->flags & VOP_FLAG_EXTENDEDSAV) + vop_config |= VOP_CONFIG_EXTENDED_SAV; + + switch (config->mode) { + case VOP_MODE_DISABLED: + vop_config |= VOP_CONFIG_DISABLED; + break; + case VOP_MODE_VIP11: + vop_config |= VOP_CONFIG_VIP1_1; + break; + case VOP_MODE_CCIR656: + vop_config |= VOP_CONFIG_CCIR656; + break; + case VOP_MODE_VIP20_8BIT: + vop_config |= VOP_CONFIG_VIP2_0; + break; + case VOP_MODE_VIP20_16BIT: + vop_config |= VOP_CONFIG_VIP2_0 | VOP_CONFIG_VIP2_16BIT; + break; + } + } + + /* SET THE 4:4:4 TO 4:2:2 DECIMATION ALGORITHM */ + + vop_config |= (config->conversion_mode); + + /* SET THE VSYNC OUT OPTIONS */ + + control2 = READ_VIP32(VIP_CONTROL2) & ~VIP_CONTROL2_SYNC2PIN_MASK; + control2 |= config->vsync_out; + WRITE_VIP32(VIP_CONTROL2, control2); + + /* FORCE THE CORRECT VOP COLOR SPACE */ + /* The output of the mixer will be either RGB or YUV. We must enable */ + /* or disable the VOP CSC based on the desired output format. */ + + alpha = READ_VID32(DF_VID_ALPHA_CONTROL); + if (!(alpha & DF_CSC_GRAPHICS_RGB_TO_YUV)) { + /* RGB OUTPUT FROM THE MIXER */ + + if (!rgb) + alpha |= DF_CSC_VOP_RGB_TO_YUV; + else + alpha &= ~DF_CSC_VOP_RGB_TO_YUV; + } else { + /* YUV OUTPUT FROM THE MIXER */ + /* As there is no YUV->RGB VOP conversion, we simply disable the */ + /* VOP CSC and trust that the user is competent. */ + + alpha &= ~DF_CSC_VOP_RGB_TO_YUV; + } + + /* AND WRITE THE CONFIGURATION */ + + WRITE_VID32(DF_VID_ALPHA_CONTROL, alpha); + WRITE_VOP32(VOP_CONFIGURATION, vop_config); + WRITE_REG32(DC3_UNLOCK, DC3_UNLOCK_VALUE); + WRITE_REG32(DC3_VID_DS_DELTA, delta); + WRITE_REG32(DC3_UNLOCK, unlock); + + return CIM_STATUS_OK; +} + +/*--------------------------------------------------------------------------- + * vop_save_state + * + * This routine saves the necessary register contents in order to restore + * at a later point to the same state. Note that the capture state is + * forced to OFF in this routine. + *--------------------------------------------------------------------------*/ + +int +vop_save_state(VOPSTATEBUFFER * save_buffer) +{ + if (!save_buffer) + return CIM_STATUS_INVALIDPARAMS; + + save_buffer->config = READ_VOP32(VOP_CONFIGURATION); + + return CIM_STATUS_OK; +} + +/*--------------------------------------------------------------------------- + * vop_restore_state + * + * This routine restores the state of the vop registers - which were + * previously saved using vop_save_state. + *--------------------------------------------------------------------------*/ + +int +vop_restore_state(VOPSTATEBUFFER * restore_buffer) +{ + if (!restore_buffer) + return CIM_STATUS_INVALIDPARAMS; + + WRITE_VOP32(VOP_CONFIGURATION, restore_buffer->config); + + return CIM_STATUS_OK; +} + +/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + * CIMARRON VOP READ ROUTINES + * These routines are included for use in diagnostics or when debugging. They + * can be optionally excluded from a project. + *++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ + +#if CIMARRON_INCLUDE_VOP_READ_ROUTINES + +/*--------------------------------------------------------------------------- + * vop_get_current_mode + * + * This routine reads the current VIP operating mode and stores it in the + * passed VOP_CONFIGURATION structure. + *--------------------------------------------------------------------------*/ + +int +vop_get_current_mode(VOPCONFIGURATIONBUFFER * config) +{ + unsigned long vop_config = 0; + unsigned long alpha; + + if (!config) + return CIM_STATUS_INVALIDPARAMS; + + vop_config = READ_VOP32(VOP_CONFIGURATION); + alpha = READ_VID32(DF_VID_ALPHA_CONTROL); + + /* READ THE CURRENT MODE */ + + switch (vop_config & VOP_CONFIG_MODE_MASK) { + case VOP_CONFIG_DISABLED: + config->mode = VOP_MODE_DISABLED; + break; + case VOP_CONFIG_VIP1_1: + config->mode = VOP_MODE_VIP11; + break; + case VOP_CONFIG_CCIR656: + config->mode = VOP_MODE_CCIR656; + break; + case VOP_CONFIG_VIP2_0: + + if (vop_config & VOP_CONFIG_ENABLE_601) + config->mode = VOP_MODE_601; + else if (vop_config & VOP_CONFIG_VIP2_16BIT) + config->mode = VOP_MODE_VIP20_16BIT; + else + config->mode = VOP_MODE_VIP20_8BIT; + break; + } + + /* READ 601 SETTINGS */ + + config->vop601.flags = vop_config & (VOP_CONFIG_INVERT_DISPE | + VOP_CONFIG_INVERT_HSYNC | VOP_CONFIG_INVERT_VSYNC); + + config->vop601.vsync_shift = vop_config & VOP_CONFIG_VSYNC_MASK; + config->vop601.vsync_shift_count = + READ_REG32(DC3_VID_DS_DELTA) & DC3_601_VSYNC_SHIFT_MASK; + + if ((alpha & DF_CSC_GRAPHICS_RGB_TO_YUV) || + (alpha & DF_CSC_VOP_RGB_TO_YUV)) { + /* YUV OUTPUT */ + + if (vop_config & VOP_CONFIG_DISABLE_DECIMATE) + config->vop601.output_mode = VOP_601_YUV_4_4_4; + else if (vop_config & VOP_CONFIG_VIP2_16BIT) + config->vop601.output_mode = VOP_601_YUV_16BIT; + else + config->vop601.output_mode = VOP_601_YUV_8BIT; + } else { + config->vop601.output_mode = VOP_601_RGB_8_8_8; + } + + config->flags = 0; + + /* READ THE UNIVERSAL VOP OPTIONS */ + + if (vop_config & VOP_CONFIG_SWAPUV) + config->flags |= VOP_FLAG_SWAP_UV; + if (vop_config & VOP_CONFIG_SWAPVBI) + config->flags |= VOP_FLAG_SWAP_VBI; + if (vop_config & VOP_CONFIG_VBI) + config->flags |= VOP_FLAG_VBI; + if (vop_config & VOP_CONFIG_TASK) + config->flags |= VOP_FLAG_TASK; + if (vop_config & VOP_CONFIG_SC_COMPATIBLE) + config->flags |= VOP_FLAG_SINGLECHIPCOMPAT; + if (vop_config & VOP_CONFIG_EXTENDED_SAV) + config->flags |= VOP_FLAG_EXTENDEDSAV; + + config->conversion_mode = vop_config & VOP_CONFIG_422_MASK; + + config->vsync_out = READ_VIP32(VIP_CONTROL2) & VIP_CONTROL2_SYNC2PIN_MASK; + + return CIM_STATUS_OK; +} + +/*--------------------------------------------------------------------------- + * vop_get_vbi_window + * + * This routine reads the current VBI configuration for VOP output. + *--------------------------------------------------------------------------*/ + +int +vop_get_vbi_configuration(VOPVBIWINDOWBUFFER * buffer) +{ + unsigned long temp; + unsigned long hstart, hstop; + unsigned long htotal, hsyncstart; + + if (!buffer) + return CIM_STATUS_INVALIDPARAMS; + + htotal = ((READ_REG32(DC3_H_ACTIVE_TIMING) >> 16) & 0xFFF) + 1; + hsyncstart = (READ_REG32(DC3_H_SYNC_TIMING) & 0xFFF) + 1; + + /* DECODE HORIZONTAL POSITION */ + /* This is done according to the requested horizontal origin */ + + temp = READ_REG32(DC3_VBI_HOR); + hstart = (temp & DC3_VBI_HOR_START_MASK) + 1; + hstop = ((temp & DC3_VBI_HOR_END_MASK) >> DC3_VBI_HOR_END_SHIFT) + 1; + if (buffer->horz_from_hsync) { + buffer->horz_start = hstart + htotal - hsyncstart; + if (buffer->horz_start >= (long)htotal) + buffer->horz_start -= htotal; + } else { + if (hstart > hsyncstart) + buffer->horz_start = (long)hstart - (long)htotal; + else + buffer->horz_start = hstart; + } + + if (hstop > hstart) + buffer->vbi_width = hstop - hstart; + else + buffer->vbi_width = (htotal - hstart) + hstop; + + /* READ LINE MASKS */ + + temp = READ_REG32(DC3_VBI_LN_ODD); + buffer->odd_line_offset = (temp & DC3_VBI_ODD_LINE_MASK) >> + DC3_VBI_ODD_LINE_SHIFT; + buffer->odd_line_capture_mask = (temp & DC3_VBI_ODD_ENABLE_MASK); + + temp = READ_REG32(DC3_VBI_LN_EVEN); + buffer->even_line_offset = (temp & DC3_VBI_EVEN_LINE_MASK) >> + DC3_VBI_EVEN_LINE_SHIFT; + buffer->even_line_capture_mask = (temp & DC3_VBI_EVEN_ENABLE_MASK); + + /* READ VBI UPSCALE SETTINGS */ + + buffer->enable_upscale = 0; + temp = READ_REG32(DC3_VBI_EVEN_CTL); + if (temp & DC3_VBI_EVEN_CTL_UPSCALE) + buffer->enable_upscale = 1; + + /* READ SOURCE OFFSETS */ + + buffer->even_address_offset = temp & DC3_VBI_EVEN_CTL_OFFSET_MASK; + buffer->odd_address_offset = + READ_REG32(DC3_VBI_ODD_CTL) & DC3_VBI_ODD_CTL_OFFSET_MASK; + + /* PITCH AND SIZE */ + + temp = READ_REG32(DC3_VBI_PITCH); + buffer->data_size = (temp >> 16) << 3; + buffer->data_pitch = (temp & 0xFFFF); + + return CIM_STATUS_OK; +} + +/*--------------------------------------------------------------------------- + * vop_get_vbi_enable + * + * This routine reads the current enable status of VBI output. + *--------------------------------------------------------------------------*/ + +int +vop_get_vbi_enable(void) +{ + if (READ_REG32(DC3_VBI_EVEN_CTL) & DC3_VBI_ENABLE) + return 1; + + return 0; +} + +/*--------------------------------------------------------------------------- + * vop_get_crc + * + * This routine returns a CRC of the current VOP data + --------------------------------------------------------------------------*/ + +unsigned long +vop_get_crc(void) +{ + unsigned long crc; + unsigned long config = READ_VOP32(VOP_CONFIGURATION); + unsigned long timeout = 1000; + + if (!(READ_REG32(DC3_DISPLAY_CFG) & DC3_DCFG_TGEN)) + return 0xFFFFFFFF; + + /* RESET CRC */ + + WRITE_VOP32(VOP_CONFIGURATION, config & ~VOP_CONFIG_ENABLE_SIGNATURE); + + /* WAIT FOR THE RESET TO BE LATCHED */ + + while ((READ_VOP32(VOP_SIGNATURE) != 0x00000001) && timeout) + timeout--; + + WRITE_VOP32(VOP_CONFIGURATION, config | VOP_CONFIG_ENABLE_SIGNATURE); + + /* WAIT UNTIL NOT ACTIVE, THEN ACTIVE, NOT ACTIVE, THEN ACTIVE */ + + while (!(READ_VOP32(VOP_CONFIGURATION) & VOP_CONFIG_SIGVAL)) ; + + crc = READ_VOP32(VOP_SIGNATURE); + + return crc; +} + +/*--------------------------------------------------------------------------- + * vop_read_vbi_crc + * + * This routine returns a CRC of the current VBI data + ---------------------------------------------------------------------------*/ + +unsigned long +vop_read_vbi_crc(void) +{ + unsigned long gcfg, unlock, vbi_even; + unsigned long crc; + + if (!(READ_REG32(DC3_DISPLAY_CFG) & DC3_DCFG_TGEN) || + !(READ_REG32(DC3_VBI_EVEN_CTL) & DC3_VBI_ENABLE)) { + return 0xFFFFFFFF; + } + + unlock = READ_REG32(DC3_UNLOCK); + gcfg = READ_REG32(DC3_GENERAL_CFG); + vbi_even = READ_REG32(DC3_VBI_EVEN_CTL); + + gcfg |= DC3_GCFG_SGRE | DC3_GCFG_CRC_MODE; + gcfg &= ~(DC3_GCFG_SGFR | DC3_GCFG_SIG_SEL); + vbi_even |= DC3_VBI_EVEN_ENABLE_CRC; + + WRITE_REG32(DC3_UNLOCK, DC3_UNLOCK_VALUE); + WRITE_REG32(DC3_VBI_EVEN_CTL, vbi_even); + WRITE_REG32(DC3_GENERAL_CFG, gcfg & ~DC3_GCFG_SIGE); + WRITE_REG32(DC3_GENERAL_CFG, gcfg | DC3_GCFG_SIGE); + + /* WAIT FOR THE CRC TO BE COMPLETED */ + + while (!(READ_REG32(DC3_LINE_CNT_STATUS) & DC3_LNCNT_SIGC)) ; + + /* READ THE COMPLETED CRC */ + + crc = READ_REG32(DC3_PAL_DATA); + + /* RESTORE THE PALETTE SETTINGS */ + + gcfg &= ~DC3_GCFG_SGRE; + WRITE_REG32(DC3_GENERAL_CFG, gcfg); + WRITE_REG32(DC3_UNLOCK, unlock); + + return crc; +} + +#endif diff --git a/driver/xf86-video-geode/src/cim/doc/release.txt b/driver/xf86-video-geode/src/cim/doc/release.txt new file mode 100644 index 000000000..716e8f4f0 --- /dev/null +++ b/driver/xf86-video-geode/src/cim/doc/release.txt @@ -0,0 +1,48 @@ +Cimarron API Release Notes +Version 02.02.0100 +March 4, 2005 +Developer - + +----------------------------------------------------------------------------- +PRODUCT INFORMATION +----------------------------------------------------------------------------- +Cimarron is a graphics/video support package designed to implement common +functionality for GX3 (Castle). The design of this package is similar to its +predecessor, Durango; many of the Cimarron routines have functional +equivalents in the Durango library. However, Cimarron does not attempt to +maintain legacy by completely preserving the original Durango API. The API +has been restructured to more closely match current hardware. + +----------------------------------------------------------------------------- +INSTALLATION INSTRUCTIONS +----------------------------------------------------------------------------- +NA + +----------------------------------------------------------------------------- +BUILD INSTRUCTIONS +----------------------------------------------------------------------------- +NA + +----------------------------------------------------------------------------- +FUNCTIONAL CHANGES +----------------------------------------------------------------------------- +NA +----------------------------------------------------------------------------- +UNIT TEST +----------------------------------------------------------------------------- +NA +----------------------------------------------------------------------------- +FILE CHANGES +----------------------------------------------------------------------------- +None +----------------------------------------------------------------------------- +DEFECTS CORRECTED +----------------------------------------------------------------------------- +NA +----------------------------------------------------------------------------- +KNOWN ERRATA +----------------------------------------------------------------------------- +NA +----------------------------------------------------------------------------- +REVISION HISTORY +----------------------------------------------------------------------------- diff --git a/driver/xf86-video-geode/src/cim_dev.h b/driver/xf86-video-geode/src/cim_dev.h new file mode 100644 index 000000000..f491eaf2e --- /dev/null +++ b/driver/xf86-video-geode/src/cim_dev.h @@ -0,0 +1,58 @@ +/* + * Copyright (c) 2006 Advanced Micro Devices, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + * Neither the name of the Advanced Micro Devices, Inc. nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + */ + +#ifndef CIMDEV_H_ +#define CIMDEV_H_ + +#define CIM_RESERVE_MEM 0x01 +#define CIM_FREE_MEM 0x02 +#define CIMDEV_MINOR_DEV 156 + +/* Block flags */ +#define CIM_F_FREE 0x01 /* This block is marked as free */ +#define CIM_F_CMDBUF 0x02 /* GP command buffer flag */ +#define CIM_F_PRIVATE 0x04 /* This block is reserved only for its owner */ +#define CIM_F_PUBLIC 0x08 /* This block can be used by the world */ + +typedef struct +{ + /* These fields get populated by the client */ + char owner[10]; + char name[15]; + int flags; + int size; + + /* These fields are populated by the device */ + unsigned long offset; +} cim_mem_req_t; + +typedef struct +{ + char owner[10]; + unsigned long offset; +} cim_mem_free_t; + +#endif diff --git a/driver/xf86-video-geode/src/cimarron.c b/driver/xf86-video-geode/src/cimarron.c new file mode 100644 index 000000000..b6986feb4 --- /dev/null +++ b/driver/xf86-video-geode/src/cimarron.c @@ -0,0 +1,253 @@ +/* + * Copyright (c) 2006 Advanced Micro Devices, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + * Neither the name of the Advanced Micro Devices, Inc. nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + */ + + /* + * Base include file for the Cimarron library. This file should be modified + * and included in any Cimarron-based project. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +/*----------------------------------------------------------------------*/ +/* MODULE SETTINGS */ +/* The following #defines affect which modules are included in the */ +/* project. */ +/*----------------------------------------------------------------------*/ + +#define CIMARRON_INCLUDE_GP 1 +#define CIMARRON_INCLUDE_VG 1 +#define CIMARRON_INCLUDE_VIP 1 +#define CIMARRON_INCLUDE_VOP 1 +#define CIMARRON_INCLUDE_VIDEO 1 +#define CIMARRON_INCLUDE_INIT 1 + +#define CIMARRON_INCLUDE_VG_READ_ROUTINES 1 +#define CIMARRON_INCLUDE_DF_READ_ROUTINES 1 +#define CIMARRON_INCLUDE_VIP_READ_ROUTINES 1 +#define CIMARRON_INCLUDE_VOP_READ_ROUTINES 1 + +/*----------------------------------------------------------------------*/ +/* HARDWARE ACCESS SETTINGS */ +/* The following #defines affect how the Cimarron macros access the */ +/* hardware. The hardware access macros are broken up into groups. */ +/* Each group includes an enabling #define as well as several #define */ +/* options that modify the macro configuration that is included. */ +/* If the enabling define is deleted or all options are set to 0, the */ +/* corresponding macros must be implemented by the user. The */ +/* combinations are explained as follows: */ +/* must be manually defined by the user. This allows a user to use the */ +/* cim_defs.h file for only those macros that suit the needs of his/her */ +/* project. For example, a user may need custom implementations of the */ +/* I/O and MSR macros, but may still want to use the default macros to */ +/* read and write hardware registers. The combinations are explained as */ +/* follows: */ +/* */ +/* Register Group: */ +/* Disabling define: */ +/* CIMARRON_EXCLUDE_REGISTER_ACCESS_MACROS */ +/* Define this setting to exclude the register access macros. */ +/* This setting is the inverse of the other group settings in */ +/* that these macros are included by default. This allows the */ +/* cim_defs.h file to be included outside of cimarron.c for */ +/* basic operations. */ +/* */ +/* Memory Group: */ +/* Enabling define: */ +/* CIMARRON_INCLUDE_STRING_MACROS */ +/* Options: */ +/* CIMARRON_OPTIMIZE_ASSEMBLY */ +/* Set to 1 to allow the use of inline assembly when writing */ +/* large chunks of data to memory. Essentially, this allows */ +/* a rep movsd in place of a slower C for-loop. */ +/* CIMARRON_OPTIMIZE_FORLOOP */ +/* Define for C only data writes. */ +/* */ +/* MSR Group: */ +/* Enabling define: */ +/* CIMARRON_INCLUDE_MSR_MACROS */ +/* Options: */ +/* CIMARRON_MSR_DIRECT_ASM */ +/* Set to 1 to allow the use of the rdmsr and wrmsr opcodes in */ +/* inline assembly. */ +/* CIMARRON_MSR_VSA_IO */ +/* Set to 1 to access MSRs using a VSAII virtual register. */ +/* CIMARRON_MSR_KERNEL_ROUTINE */ +/* Set to 1 to access MSRs using a wrapper routine in the */ +/* Linux kernel. */ +/* */ +/* IO Group: */ +/* Enabling define: */ +/* CIMARRON_INCLUDE_IO_MACROS */ +/* Options: */ +/* CIMARRON_IO_DIRECT_ACCESS */ +/* Set to 1 to perform IO accesses using inline assembly. */ +/* CIMARRON_IO_ABSTRACTED_ASM */ +/* Set to 1 to perform IO using abstracted IO in Linux. */ +/* */ +/* Custom Group: */ +/* Disabling define: */ +/* CIMARRON_EXCLUDE_CUSTOM_MACROS */ +/* By default, the custom macros (the macros used by */ +/* gp_custom_convert_blt) are mapped to the normal command */ +/* string macros. Setting this to 1 allows the user to */ +/* create a custom implementation. */ +/*----------------------------------------------------------------------*/ + +/* UNCOMMENT THE FOLLOWING LINE TO EXCLUDE BASIC REGISTER ACCESS MACROS */ + +/* #define CIMARRON_EXCLUDE_REGISTER_ACCESS_MACROS */ + +#define CIMARRON_INCLUDE_STRING_MACROS +#define CIMARRON_OPTIMIZE_ASSEMBLY 0 +#define CIMARRON_OPTIMIZE_FORLOOP 0 +#define CIMARRON_OPTIMIZE_ABSTRACTED_ASM 1 + +#define CIMARRON_INCLUDE_MSR_MACROS +#define CIMARRON_MSR_DIRECT_ASM 0 +#define CIMARRON_MSR_VSA_IO 0 +#define CIMARRON_MSR_ABSTRACTED_ASM 0 +#define CIMARRON_MSR_KERNEL_ROUTINE 0 +#define CIMARRON_MSR_HOOKS 1 + +#define CIMARRON_INCLUDE_IO_MACROS +#define CIMARRON_IO_DIRECT_ACCESS 0 +#define CIMARRON_IO_ABSTRACTED_ASM 1 + +/* + * UNCOMMENT THE FOLLOWING LINE TO IMPLEMENT CUSTOM MACROS FOR + * GP_CUSTOM_CONVERT_BLT + */ + +/* #define CIMARRON_EXCLUDE_CUSTOM_MACROS */ + +/*----------------------------------------------------------------------*/ +/* MODULE VARIABLES */ +/* The following #defines affect how global variables in each Cimarron */ +/* module are defined. These variables can be made static (to prevent */ +/* naming conflicts) or they can be defined without the static keyword */ +/* (to allow extern references). */ +/*----------------------------------------------------------------------*/ + +#if 1 +#define CIMARRON_STATIC static +#else +#define CIMARRON_STATIC +#endif + +/*----------------------------------------------------------------------*/ +/* CIMARRON GLOBAL VARIABLES */ +/* These globals are used by the hardware access macros. They must be */ +/* initialized by the application to point to the memory-mapped */ +/* registers of their respective blocks. */ +/*----------------------------------------------------------------------*/ + +unsigned char *cim_gp_ptr = (unsigned char *)0; +unsigned char *cim_fb_ptr = (unsigned char *)0; +unsigned char *cim_cmd_base_ptr = (unsigned char *)0; +unsigned char *cim_cmd_ptr = (unsigned char *)0; +unsigned char *cim_vid_ptr = (unsigned char *)0; +unsigned char *cim_vip_ptr = (unsigned char *)0; +unsigned char *cim_vg_ptr = (unsigned char *)0; + +/* Define hooks for reading and writing MSRs - this is a major hack + * to share the MSR code with the GX code */ + +#ifdef CIMARRON_MSR_HOOKS +void (*cim_rdmsr) (unsigned long, unsigned long *, unsigned long *); +void (*cim_wrmsr) (unsigned long, unsigned long, unsigned long); +#endif + +/*----------------------------------------------------------------------*/ +/* INCLUDE RELEVANT CIMARRON HEADERS */ +/*----------------------------------------------------------------------*/ + +/* HARDWARE REGISTER DEFINITIONS */ + +#include "cim_regs.h" + +/* ROUTINE DEFINITIONS */ +/* All routines have a prototype, even those that are not included */ +/* via #ifdefs. This prevents the user from having to include the */ +/* correct #defines anywhere he/she wants to call a Cimarron routine. */ + +#include "cim_rtns.h" + +/* HARDWARE ACCESS MACROS */ + +#include "cim_defs.h" + +/*----------------------------------------------------------------------*/ +/* CIMARRON MODULES */ +/* Modules and sub-modules are included based on user settings. Note */ +/* that excluding one or more modules may result in functionality */ +/* holes. */ +/*----------------------------------------------------------------------*/ + +/* GRAPHICS PROCESSOR */ + +#if CIMARRON_INCLUDE_GP +#include "cim_gp.c" +#endif + +/* VIDEO GENERATOR */ + +#if CIMARRON_INCLUDE_VG +#include "cim_modes.c" +#include "cim_vg.c" +#endif + +/* DISPLAY FILTER */ + +#if CIMARRON_INCLUDE_VIDEO +#include "cim_filter.c" +#include "cim_df.c" +#endif + +/* INITIALIZATION AND DETECTION */ + +#if CIMARRON_INCLUDE_INIT +#include "cim_init.c" +#endif + +/* VIP SUPPORT */ + +#if CIMARRON_INCLUDE_VIP +#include "cim_vip.c" +#endif + +/* VOP SUPPORT */ + +#if CIMARRON_INCLUDE_VOP +#include "cim_vop.c" +#endif + +/* MSR ACCESS */ +/* This module is used to access machine-specific registers. */ +/* It cannot be excluded from a project. */ + +#include "cim_msr.c" diff --git a/driver/xf86-video-geode/src/durango.c b/driver/xf86-video-geode/src/durango.c new file mode 100644 index 000000000..9d6970b6d --- /dev/null +++ b/driver/xf86-video-geode/src/durango.c @@ -0,0 +1,234 @@ +/* Copyright (c) 2003-2006 Advanced Micro Devices, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + * + * Neither the name of the Advanced Micro Devices, Inc. nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * */ + +/* The previous version of this file was way more complex then it should have + been - remove the unnessesary #defines and routines, and concentrate on + Linux for now. +*/ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#define _LARGEFILE64_SOURCE + +#include +#include +#include +#include /* ErrorF() */ + +/* Compiler options */ + +#define GFX_DISPLAY_GU1 0 /* 1st generation display controller */ +#define GFX_DISPLAY_GU2 1 /* 2nd generation display controller */ + +#define GFX_INIT_DYNAMIC 0 /* runtime selection */ +#define GFX_INIT_GU1 0 /* SC1200/GX1 */ +#define GFX_INIT_GU2 1 /* GX */ + +#define GFX_MSR_DYNAMIC 0 /* runtime selection */ +#define GFX_MSR_REDCLOUD 1 /* GX */ + +#define GFX_2DACCEL_DYNAMIC 0 /* runtime selection */ +#define GFX_2DACCEL_GU1 0 /* 1st generation 2D accelerator */ +#define GFX_2DACCEL_GU2 1 /* 2nd generation 2D accelerator */ + +#define GFX_VIDEO_DYNAMIC 0 /* runtime selection */ +#define GFX_VIDEO_CS5530 0 /* support for CS5530 */ +#define GFX_VIDEO_SC1200 0 /* support for SC1200 */ +#define GFX_VIDEO_REDCLOUD 1 /* support for GX */ + +#define GFX_VIP_DYNAMIC 0 /* runtime selection */ +#define GFX_VIP_SC1200 0 /* support for SC1200 */ + +#define GFX_DECODER_DYNAMIC 0 /* runtime selection */ +#define GFX_DECODER_SAA7114 0 /* Philips SAA7114 decoder */ + +#define GFX_TV_DYNAMIC 0 /* runtime selection */ +#define GFX_TV_FS451 0 /* Focus Enhancements FS450 */ +#define GFX_TV_SC1200 0 /* SC1200 integrated TV encoder */ + +#define GFX_I2C_DYNAMIC 0 /* runtime selection */ +#define GFX_I2C_ACCESS 0 /* support for ACCESS.BUS */ +#define GFX_I2C_GPIO 0 /* support for CS5530 GPIOs */ + +#define GFX_VGA_DYNAMIC 0 /* runtime selection */ +#define GFX_VGA_GU1 0 /* 1st generation graphics unit */ + +#define FB4MB 1 /* Set to use 4Mb vid ram for Pyramid */ + +#define GFX_NO_IO_IN_WAIT_MACROS 1 /* Set to remove I/O accesses in GP */ +#define GFX_READ_ROUTINES 1 + +#include "gfx_rtns.h" +#include "gfx_priv.h" +#include "gfx_regs.h" +#include "gfx_defs.h" + +unsigned char *gfx_virt_regptr = (unsigned char *)0x40000000; +unsigned char *gfx_virt_fbptr = (unsigned char *)0x40800000; +unsigned char *gfx_virt_vidptr = (unsigned char *)0x40010000; +unsigned char *gfx_virt_vipptr = (unsigned char *)0x40015000; +unsigned char *gfx_virt_spptr = (unsigned char *)0x40000000; +unsigned char *gfx_virt_gpptr = (unsigned char *)0x40000000; + +unsigned char *gfx_phys_regptr = (unsigned char *)0x40000000; +unsigned char *gfx_phys_fbptr = (unsigned char *)0x40800000; +unsigned char *gfx_phys_vidptr = (unsigned char *)0x40010000; +unsigned char *gfx_phys_vipptr = (unsigned char *)0x40015000; + +#define INB(port) inb(port) +#define INW(port) inw(port) +#define IND(port) inl(port) +#define OUTB(port,data) outb(port, data) +#define OUTW(port,data) outw(port, data) +#define OUTD(port,data) outl(port, data) + +/* Squash warnings */ +unsigned char gfx_inb(unsigned short); +unsigned short gfx_inw(unsigned short); +unsigned long gfx_ind(unsigned short); + +void gfx_outb(unsigned short, unsigned char); +void gfx_outw(unsigned short, unsigned short); +void gfx_outd(unsigned short, unsigned long); + +inline unsigned char +gfx_inb(unsigned short port) +{ + return inb(port); +} + +inline unsigned short +gfx_inw(unsigned short port) +{ + return inw(port); +} + +inline unsigned long +gfx_ind(unsigned short port) +{ + return inl(port); +} + +inline void +gfx_outb(unsigned short port, unsigned char data) +{ + outb(port, data); +} + +inline void +gfx_outw(unsigned short port, unsigned short data) +{ + outw(port, data); +} + +inline void +gfx_outd(unsigned short port, unsigned long data) +{ + outl(port, data); +} + +/* These routines use VSA to read the MSRs - these are a second resort to the Linux MSR method */ + +#define vsa_msr_read(msr,adr,high,low) \ + __asm__ __volatile__( \ + " mov $0x0AC1C, %%edx\n" \ + " mov $0xFC530007, %%eax\n" \ + " out %%eax,%%dx\n" \ + " add $2,%%dl\n" \ + " in %%dx, %%ax" \ + : "=a" (*(low)), "=d" (*(high)) \ + : "c" (msr | adr)) + +#define vsa_msr_write(msr,adr,high,low) \ + { int d0, d1, d2, d3, d4; \ + __asm__ __volatile__( \ + " push %%ebx\n" \ + " mov $0x0AC1C, %%edx\n" \ + " mov $0xFC530007, %%eax\n" \ + " out %%eax,%%dx\n" \ + " add $2,%%dl\n" \ + " mov %6, %%ebx\n" \ + " mov %7, %0\n" \ + " mov %5, %3\n" \ + " xor %2, %2\n" \ + " xor %1, %1\n" \ + " out %%ax, %%dx\n" \ + " pop %%ebx\n" \ + : "=a"(d0),"=&D"(d1),"=&S"(d2), \ + "=c"(d3),"=d"(d4) \ + : "1"(msr | adr),"2"(*(high)),"3"(*(low))); \ + } + +extern int GeodeWriteMSR(unsigned long, unsigned long, unsigned long); +extern int GeodeReadMSR(unsigned long, unsigned long *, unsigned long *); + +void +gfx_msr_asm_write(unsigned short reg, unsigned long addr, + unsigned long *hi, unsigned long *lo) +{ + static int msr_method = 0; + + if (msr_method == 0) { + if (!GeodeWriteMSR(addr | reg, *lo, *hi)) + return; + + msr_method = 1; + } + + /* This is the fallback VSA method - not preferred */ + vsa_msr_write(reg, addr, hi, lo); +} + +void +gfx_msr_asm_read(unsigned short reg, unsigned long addr, + unsigned long *hi, unsigned long *lo) +{ + static int msr_method = 0; + + if (msr_method == 0) { + if (!GeodeReadMSR(addr | reg, lo, hi)) + return; + + ErrorF("Unable to read the MSR - reverting to the VSA method.\n"); + msr_method = 1; + } + + /* This is the fallback VSA method - not preferred */ + vsa_msr_read(reg, addr, hi, lo); +} + +#include "gfx_init.c" +#include "gfx_msr.c" +#include "gfx_rndr.c" +#include "gfx_mode.h" +#include "gfx_disp.c" +#include "gfx_vid.c" +#include "gfx_vip.c" +#include "gfx_dcdr.c" +#include "gfx_i2c.c" +#include "gfx_tv.c" +#include "gfx_vga.c" diff --git a/driver/xf86-video-geode/src/geode.h b/driver/xf86-video-geode/src/geode.h new file mode 100644 index 000000000..2c2ce897f --- /dev/null +++ b/driver/xf86-video-geode/src/geode.h @@ -0,0 +1,538 @@ + /* + * (c) 2006 Advanced Micro Devices, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + * Neither the name of the Advanced Micro Devices, Inc. nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + */ + +#ifndef _GEODE_H_ +#define _GEODE_H_ + +#include "geode_pcirename.h" + +#include "xaa.h" +#include "exa.h" +#include "xf86Cursor.h" + +#include "vgaHW.h" +#include "xf86int10.h" +#include +#include "randrstr.h" + +#include "xf86xv.h" + +/* We only support EXA version >=2 */ + +#if (EXA_VERSION_MAJOR >= 2) +#ifndef XF86EXA +#define XF86EXA 1 +#endif +#else +#undef XF86EXA +#endif + +#define CFB 0 +#define INT10_SUPPORT 1 + +/* Existing Processor Models */ +#define GX1 0x01 +#define GX 0x10 +#define LX 0x20 + +#define PCI_VENDOR_ID_CYRIX 0x1078 +#define PCI_VENDOR_ID_NS 0x100B +#define PCI_VENDOR_ID_AMD 0x1022 + +#define PCI_CHIP_5530 0x0104 +#define PCI_CHIP_SC1200 0x0504 +#define PCI_CHIP_SC1400 0x0104 +#define PCI_CHIP_GEODEGX 0x0030 +#define PCI_CHIP_GEODELX 0x2081 + +#define GFX_CPU_GEODELX 4 + +#ifdef HAVE_GX +#define GX_FILL_RECT_SUPPORT 1 +#define GX_BRES_LINE_SUPPORT 1 +#define GX_DASH_LINE_SUPPORT 0 /* does not do dashed lines */ +#define GX_MONO_8X8_PAT_SUPPORT 1 +#define GX_CLREXP_8X8_PAT_SUPPORT 1 +#define GX_SCR2SCREXP_SUPPORT 1 +#define GX_SCR2SCRCPY_SUPPORT 1 +#define GX_CPU2SCREXP_SUPPORT 1 +#define GX_SCANLINE_SUPPORT 1 +#define GX_USE_OFFSCRN_MEM 0 +#define GX_ONE_LINE_AT_A_TIME 1 +#define GX_WRITE_PIXMAP_SUPPORT 1 + +#define GFX(func) gfx_##func +#define GFX2(func) gfx2_##func +#endif + +#ifdef HAVE_LX +#define LX_FILL_RECT_SUPPORT 1 +#define LX_BRES_LINE_SUPPORT 1 +#define LX_DASH_LINE_SUPPORT 1 +#define LX_MONO_8X8_PAT_SUPPORT 1 +#define LX_CLREXP_8X8_PAT_SUPPORT 1 +#define LX_SCR2SCREXP_SUPPORT 1 +#define LX_SCR2SCRCPY_SUPPORT 1 +#define LX_CPU2SCREXP_SUPPORT 1 +#define LX_SCANLINE_SUPPORT 1 +#define LX_USE_OFFSCRN_MEM 1 +#define LX_WRITE_PIXMAP_SUPPORT 1 +#endif + +#define DEBUGTIM 0 +#define DEBUGLVL 0 + +#ifndef DEBUGTIM +#define DEBUGTIM 0 +#endif +#ifndef DEBUGLVL +#define DEBUGLVL 0 +#endif + +#define GEODEPTR(p) ((GeodeRec *)((p)->driverPrivate)) + +#define DEFAULT_IMG_LINE_BUFS 20 +#define DEFAULT_CLR_LINE_BUFS 20 +#define DEFAULT_EXA_SCRATCH_BFRSZ 0x40000 + +/* 64x64 cursor used as 32x32 */ +#define HW_CURSOR_W 64 +#define HW_CURSOR_H 64 + +#define MYDBG 1 +#if defined(MYDBG) +#define DEBUGMSG(cond, drv_msg) if((cond)) xf86DrvMsg drv_msg +#else +#define DEBUGMSG(cond, drv_msg) +#endif + +#ifdef HAVE_LX +extern unsigned char cim_inb(unsigned short port); +extern void cim_outb(unsigned short port, unsigned char data); +extern unsigned short cim_inw(unsigned short port); +extern void cim_outw(unsigned short port, unsigned short data); +extern unsigned long cim_ind(unsigned short port); +extern void cim_outd(unsigned short port, unsigned long data); + +#include "cim_rtns.h" + +#define CIM_CMD_BFR_SZ 0x200000L +#define CIM_CMD_BFR_MIN 0x20000L + +typedef struct tag_CIM_DISPLAYTIMING +{ + unsigned short wPitch; + unsigned short wBpp; + + VG_DISPLAY_MODE vgDisplayMode; +} +CIM_DISPLAYTIMING; +#endif + +#ifdef HAVE_GX +extern void gfx_write_reg32(int offset, int data); +extern void gfx_write_reg16(int offset, short data); +extern void gfx_write_reg8(int offset, char data); +extern int gfx_read_reg32(int offset); +extern short gfx_read_reg16(int offset); +extern void gfx_write_vid32(int offset, int data); +extern int gfx_read_vid32(int offset); +extern unsigned char gfx_inb(unsigned short port); +extern void gfx_outb(unsigned short port, unsigned char data); +extern unsigned short gfx_inw(unsigned short port); +extern void gfx_outw(unsigned short port, unsigned short data); +extern unsigned long gfx_ind(unsigned short port); +extern void gfx_outd(unsigned short port, unsigned long data); + +#define Q_WORD QQ_WORD +#include "gfx_rtns.h" +#undef Q_WORD +#include "panel.h" + +typedef struct __TVPARAMS +{ + unsigned int dwFlags; + unsigned short wWidth; + unsigned short wHeight; + unsigned short wStandard; + unsigned short wType; + unsigned short wOutput; + unsigned short wResolution; + Bool bState; +} TVPARAMS; + +typedef struct tag_GFX_DISPLAYTIMING +{ + unsigned int dwDotClock; + unsigned short wPitch; + unsigned short wBpp; + unsigned short wHTotal; + unsigned short wHActive; + unsigned short wHSyncStart; + unsigned short wHSyncEnd; + unsigned short wHBlankStart; + unsigned short wHBlankEnd; + unsigned short wVTotal; + unsigned short wVActive; + unsigned short wVSyncStart; + unsigned short wVSyncEnd; + unsigned short wVBlankStart; + unsigned short wVBlankEnd; + unsigned short wPolarity; +} GFX_DISPLAYTIMING; + +/* TV Timings */ +typedef struct __TVTIMING +{ + unsigned long HorzTim; + unsigned long HorzSync; + unsigned long VertSync; + unsigned long LineEnd; + unsigned long VertDownscale; + unsigned long HorzScaling; + unsigned long TimCtrl1; + unsigned long TimCtrl2; + unsigned long Subfreq; + unsigned long DispPos; + unsigned long DispSize; + unsigned long Debug; + unsigned long DacCtrl; + unsigned int DotClock; +} TVTIMING; +#endif + +typedef struct _VESARec +{ + xf86Int10InfoPtr pInt; +} +VESARec; + +#define OUTPUT_PANEL 0x01 +#define OUTPUT_CRT 0x02 +#define OUTPUT_TV 0x04 +#define OUTPUT_VOP 0x08 +#define OUTPUT_DCON 0x10 + +typedef struct _geodeRec +{ + /* Common */ + + int Output; /* Bitmask indicating the valid output options */ + + Bool HWCursor; + Bool NoAccel; + Bool useVGA; + Bool VGAActive; /* Flag indicating if LX VGA is active */ + Bool Compression; + Bool useEXA; + + int rotation; + int displayWidth; + Bool starting; + Bool tryCompression; + Bool tryHWCursor; + unsigned int shadowSize; + unsigned int shadowOffset; + + ExaOffscreenArea *shadowArea; + + DisplayModePtr curMode; + VG_COMPRESSION_DATA CBData; + + unsigned long CursorStartOffset; + unsigned int CursorSize; + xf86CursorInfoPtr CursorInfo; + int CursorXHot; + int CursorYHot; + + /* Geometry information */ + unsigned int maxWidth; /* Maximum possible width of the screen */ + unsigned int maxHeight; /* Maximum possible height of the screen */ + + int Pitch; /* display FB pitch */ + + int displayPitch; /* The pitch ofthe visible area */ + int displayOffset; /* The offset of the visible area */ + int displaySize; /* The size of the visibile area */ + + int PanelX; + int PanelY; + + /* Framebuffer memory */ + + unsigned long FBLinearAddr; + unsigned char *FBBase; + unsigned int FBAvail; + unsigned int FBOffset; + unsigned int FBSize; + + /* Video information */ + int video_x; + int video_y; + short video_w; + short video_h; + short video_srcw; + short video_srch; + short video_dstw; + short video_dsth; + int video_id; + int video_offset; + ScrnInfoPtr video_scrnptr; + BOOL OverlayON; + int videoKey; + + /* EXA structures */ + + ExaDriverPtr pExa; + unsigned int exaBfrOffset; + unsigned int exaBfrSz; + + /* XAA structures */ + unsigned char **AccelImageWriteBuffers; + int NoOfImgBuffers; + unsigned char **AccelColorExpandBuffers; + int NoOfColorExpandLines; + XAAInfoRecPtr AccelInfoRec; + + /* Other structures */ + + EntityInfoPtr pEnt; + ScreenBlockHandlerProcPtr BlockHandler; /* needed for video */ + XF86VideoAdaptorPtr adaptor; + + /* State save structures */ + + gfx_vga_struct FBgfxVgaRegs; + TVTIMING FBtvtiming; + GFX_DISPLAYTIMING FBgfxdisplaytiming; + CIM_DISPLAYTIMING FBcimdisplaytiming; + + unsigned int FBTVActive; + unsigned int FBSupport; + unsigned long FBDisplayOffset; + unsigned long PrevDisplayOffset; + + VESARec *vesa; + + int FBCompressionEnable; + VG_COMPRESSION_DATA FBCBData; + VG_CURSOR_DATA FBCursor; + unsigned long FBCompressionOffset; + unsigned short FBCompressionPitch; + unsigned short FBCompressionSize; + + /* Save the Cursor offset of the FB */ + unsigned long FBCursorOffset; + unsigned char FBBIOSMode; + + /* Hooks */ + + void (*WritePixmap) (ScrnInfoPtr pScrni, int x, int y, int w, int h, + unsigned char *src, int srcwidth, int rop, + unsigned int planemask, int trans, int bpp, int depth); + + void (*PointerMoved) (int index, int x, int y); + CloseScreenProcPtr CloseScreen; + Bool(*CreateScreenResources) (ScreenPtr); + + /* LX only */ + + unsigned long CmdBfrOffset; + unsigned long CmdBfrSize; + +#ifdef HAVE_TVSUPPORT + Bool TVSupport; + int tv_encoder; + int tv_bus_fmt; + int tv_flags; + int tv_601_fmt; + int tv_601_flags; + int tv_conversion; + int tv_vsync_shift; + int tv_vsync_shift_count; + int tv_vsync_select; + int tvox, tvoy; + + TVPARAMS TvParam; + + int TVOx, TVOy, TVOw, TVOh; + Bool TV_Overscan_On; +#endif + + /* To be killed! */ + + int FBVGAActive; + unsigned int cpySrcOffset; + int cpySrcPitch, cpySrcBpp; + int cpyDx, cpyDy; + unsigned int cmpSrcOffset; + int cmpSrcPitch, cmpSrcBpp; + unsigned int cmpSrcFmt, cmpDstFmt; + int cmpOp; + + Bool Panel; + +} +GeodeRec, *GeodePtr; + +/* option flags are self-explanatory */ +#ifdef HAVE_LX +enum +{ + LX_OPTION_SW_CURSOR, + LX_OPTION_HW_CURSOR, + LX_OPTION_NOCOMPRESSION, + LX_OPTION_NOACCEL, + LX_OPTION_ACCEL_METHOD, + LX_OPTION_EXA_SCRATCH_BFRSZ, + LX_OPTION_TV_SUPPORT, + LX_OPTION_TV_OUTPUT, + LX_OPTION_TV_OVERSCAN, + LX_OPTION_ROTATE, + LX_OPTION_NOPANEL, + LX_OPTION_COLOR_KEY, + LX_OPTION_FBSIZE, + LX_OPTION_PANEL_GEOMETRY, + LX_OPTION_DONT_PROGRAM +} +LX_GeodeOpts; +#endif + +#ifdef HAVE_GX +enum +{ + GX_OPTION_SW_CURSOR, + GX_OPTION_HW_CURSOR, + GX_OPTION_NOCOMPRESSION, + GX_OPTION_NOACCEL, + GX_OPTION_ACCEL_METHOD, + GX_OPTION_EXA_SCRATCH_BFRSZ, + GX_OPTION_TV_SUPPORT, + GX_OPTION_TV_OUTPUT, + GX_OPTION_TV_OVERSCAN, + GX_OPTION_ROTATE, + GX_OPTION_NOPANEL, + GX_OPTION_FLATPANEL_INFO, + GX_OPTION_FLATPANEL_IN_BIOS, + GX_OPTION_COLOR_KEY, + GX_OPTION_OSM, + GX_OPTION_OSM_IMG_BUFS, + GX_OPTION_OSM_CLR_BUFS, + GX_OPTION_FBSIZE, + GX_OPTION_PANEL_GEOMETRY, + GX_OPTION_DONT_PROGRAM +} +GX_GeodeOpts; +#endif + +/* OLPC defines */ + +#define DCON_DEFAULT_XRES 1200 +#define DCON_DEFAULT_YRES 900 +#define DCON_DEFAULT_BPP 16 +#define DCON_DEFAULT_REFRESH 50 + +/* geode_dcon.c */ +extern Bool dcon_init(ScrnInfoPtr pScrni); +extern int DCONDPMSSet(ScrnInfoPtr pScrni, int mode, int flags); + +/* geode_common.c */ + +void geode_memory_to_screen_blt(unsigned long, unsigned long, + unsigned long, unsigned long, long, long, int); +int GeodeGetRefreshRate(DisplayModePtr); +void GeodeCopyGreyscale(unsigned char *, unsigned char *, int, int, int, int); +int GeodeGetSizeFromFB(unsigned int *); + +/* gx_video.c */ + +int +GeodeQueryImageAttributes(ScrnInfoPtr, int id, unsigned short *w, + unsigned short *h, int *pitches, int *offsets); + +Bool RegionsEqual(RegionPtr A, RegionPtr B); + +/* gx_driver.c */ + +void GeodeProbeDDC(ScrnInfoPtr pScrni, int index); +xf86MonPtr GeodeDoDDC(ScrnInfoPtr pScrni, int index); +int GeodeGetFPGeometry(const char *str, int *width, int *height); +void GeodePointerMoved(int index, int x, int y); +void GeodeFreeScreen(int scrnIndex, int flags); +int GeodeCalculatePitchBytes(unsigned int width, unsigned int bpp); +void GXSetupChipsetFPtr(ScrnInfoPtr pScrn); + +/* geode_msr.c */ +int GeodeReadMSR(unsigned long addr, unsigned long *lo, unsigned long *hi); +int GeodeWriteMSR(unsigned long addr, unsigned long lo, unsigned long hi); + +/* gx_cursor.c */ +Bool GXHWCursorInit(ScreenPtr pScrn); +void GXLoadCursorImage(ScrnInfoPtr pScrni, unsigned char *src); +void GXHideCursor(ScrnInfoPtr pScrni); +void GXShowCursor(ScrnInfoPtr pScrni); + +/* gx_randr.c */ +Rotation GXGetRotation(ScreenPtr pScreen); +Bool GXRandRInit(ScreenPtr pScreen, int rotation); +Bool GXRandRSetConfig(ScreenPtr pScreen, Rotation rotation, int rate, RRScreenSizePtr pSize); + +/* gx_rotate.c */ +Bool GXRotate(ScrnInfoPtr pScrni, DisplayModePtr mode); + +/* gx_accel.c */ +Bool GXAccelInit(ScreenPtr pScrn); +void GXAccelSync(ScrnInfoPtr pScrni); + +/* gx_video.c */ +void GXInitVideo(ScreenPtr pScrn); + +/* lx_driver.c */ +void LXSetupChipsetFPtr(ScrnInfoPtr pScrn); + +/* lx_cursor.c */ +Bool LXHWCursorInit(ScreenPtr pScrn); +void LXLoadCursorImage(ScrnInfoPtr pScrni, unsigned char *src); +void LXHideCursor(ScrnInfoPtr pScrni); +void LXShowCursor(ScrnInfoPtr pScrni); + +/* lx_randr.c */ +Rotation LXGetRotation(ScreenPtr pScreen); +Bool LXRandRInit(ScreenPtr pScreen, int rotation); +Bool LXRandRSetConfig(ScreenPtr pScreen, Rotation rotation, int rate, RRScreenSizePtr pSize); + +/* lx_rotate.c */ +Bool LXSetRotatePitch(ScrnInfoPtr pScrni); +Bool LXRotate(ScrnInfoPtr pScrni, DisplayModePtr mode); +Bool LXAllocShadow(ScrnInfoPtr pScrni); + +/* lx_exa.c */ +Bool LXExaInit(ScreenPtr pScreen); + +/* lx_video.c */ +void LXInitVideo(ScreenPtr pScrn); + +#endif diff --git a/driver/xf86-video-geode/src/geode_blend.h b/driver/xf86-video-geode/src/geode_blend.h new file mode 100644 index 000000000..6748ec064 --- /dev/null +++ b/driver/xf86-video-geode/src/geode_blend.h @@ -0,0 +1,62 @@ +#ifndef AMD_BLEND_H_ +#define AMD_BLEND_H_ + +#define GEODEPTR_FROM_PIXMAP(x) \ + GEODEPTR(xf86Screens[(x)->drawable.pScreen->myNum]) +#define GEODEPTR_FROM_SCREEN(x) \ + GEODEPTR(xf86Screens[(x)->myNum]) +#define GEODEPTR_FROM_PICTURE(x) \ + GEODEPTR(xf86Screens[(x)->pDrawable->pScreen->myNum]) + +#define usesPasses(op) ((( \ + ( 1 << PictOpAtop ) | \ + ( 1 << PictOpAtopReverse ) | \ + ( 1 << PictOpXor ) | \ + 0 ) >> (op)) & 1) + +/* pass1 or pass2 */ +#define usesSrcAlpha(op) ((( \ + ( 1 << PictOpOver ) | \ + ( 1 << PictOpInReverse ) | \ + ( 1 << PictOpOutReverse ) | \ + ( 1 << PictOpAtop ) | \ + ( 1 << PictOpAtopReverse ) | \ + ( 1 << PictOpXor ) | \ + 0 ) >> (op)) & 1) + +/* pass1 or pass2 */ +#define usesDstAlpha(op) ((( \ + ( 1 << PictOpOverReverse ) | \ + ( 1 << PictOpIn ) | \ + ( 1 << PictOpOut ) | \ + ( 1 << PictOpAtop ) | \ + ( 1 << PictOpAtopReverse ) | \ + ( 1 << PictOpXor ) | \ + 0 ) >> (op)) & 1) + +/* non 2 pass ops */ +#define usesChanB0(op) ((( \ + ( 1 << PictOpOver ) | \ + ( 1 << PictOpOverReverse ) | \ + ( 1 << PictOpIn ) | \ + ( 1 << PictOpInReverse ) | \ + ( 1 << PictOpOut ) | \ + ( 1 << PictOpOutReverse ) | \ + ( 1 << PictOpAdd ) | \ + 0 ) >> (op)) & 1) + +/* pass 1 ops */ +#define usesChanB1(op) ((( \ + ( 1 << PictOpAtop ) | \ + ( 1 << PictOpAtopReverse ) | \ + ( 1 << PictOpXor ) | \ + 0 ) >> (op)) & 1) + +/* pass 2 ops */ +#define usesChanB2(op) ((( \ + ( 1 << PictOpAtop ) | \ + ( 1 << PictOpAtopReverse ) | \ + ( 1 << PictOpXor ) | \ + 0 ) >> (op)) & 1) + +#endif diff --git a/driver/xf86-video-geode/src/geode_common.c b/driver/xf86-video-geode/src/geode_common.c new file mode 100644 index 000000000..2e02af17b --- /dev/null +++ b/driver/xf86-video-geode/src/geode_common.c @@ -0,0 +1,200 @@ +/* + * Copyright (c) 2007 Advanced Micro Devices, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + * Neither the name of the Advanced Micro Devices, Inc. nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + */ + +/* We want to share as much code between GX and LX as we possibly can for obvious reasons */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include /* memcmp() */ +#include +#include +#include +#include +#include + +#include "xf86.h" +#include "geode.h" + +#define move0(d,s,n) \ + __asm__ __volatile__( \ + " rep; movsl\n" \ + : "=&c" (d0), "=&S" (d1), "=&D" (d2) \ + : "0" (n), "1" (s), "2" (d) \ + : "memory") + +#define move1(d,s,n) \ + __asm__ __volatile__( \ + " rep; movsl\n" \ + " movsb\n" \ + : "=&c" (d0), "=&S" (d1), "=&D" (d2) \ + : "0" (n), "1" (s), "2" (d) \ + : "memory") + +#define move2(d,s,n) \ + __asm__ __volatile__( \ + " rep; movsl\n" \ + " movsw\n" \ + : "=&c" (d0), "=&S" (d1), "=&D" (d2) \ + : "0" (n), "1" (s), "2" (d) \ + : "memory") + +#define move3(d,s,n) \ + __asm__ __volatile__( \ + " rep; movsl\n" \ + " movsw\n" \ + " movsb\n" \ + : "=&c" (d0), "=&S" (d1), "=&D" (d2) \ + : "0" (n), "1" (s), "2" (d) \ + : "memory") + +void +geode_memory_to_screen_blt(unsigned long src, unsigned long dst, + unsigned long sp, unsigned long dp, long w, long h, int bpp) +{ + int d0, d1, d2; + int n = w * (bpp >> 3); + int m = n >> 2; + + switch (n & 3) { + case 0: + while (--h >= 0) { + move0(dst, src, m); + src += sp; + dst += dp; + } + break; + case 1: + while (--h >= 0) { + move1(dst, src, m); + src += sp; + dst += dp; + } + break; + case 2: + while (--h >= 0) { + move2(dst, src, m); + src += sp; + dst += dp; + } + break; + case 3: + while (--h >= 0) { + move3(dst, src, m); + src += sp; + dst += dp; + } + break; + } +} + +/* I borrowed this function from the i830 driver - its much better + then what we had before +*/ + +int +GeodeGetRefreshRate(DisplayModePtr pMode) +{ + if (pMode->VRefresh) + return (int)(pMode->VRefresh + 0.5); + + return (int)(pMode->Clock * 1000.0 / pMode->HTotal / pMode->VTotal + 0.5); +} + +/* This is used by both GX and LX. It could be accelerated for LX, probably, but + that would involve a two pass blt, the first to copy the data, and the second + to copy the grey (using a pattern). That seems like a bit of work for a + very underused format - so we'll just use the slow version. +*/ + +void +GeodeCopyGreyscale(unsigned char *src, unsigned char *dst, + int dstPitch, int srcPitch, int h, int w) +{ + int i; + unsigned char *src2 = src; + unsigned char *dst2 = dst; + unsigned char *dst3; + unsigned char *src3; + + dstPitch <<= 1; + + while (h--) { + dst3 = dst2; + src3 = src2; + for (i = 0; i < w; i++) { + *dst3++ = *src3++; /* Copy Y data */ + *dst3++ = 0x80; /* Fill UV with 0x80 - greyscale */ + } + + src3 = src2; + for (i = 0; i < w; i++) { + *dst3++ = *src3++; /* Copy Y data */ + *dst3++ = 0x80; /* Fill UV with 0x80 - greyscale */ + } + + dst2 += dstPitch; + src2 += srcPitch; + } +} + +#if defined(linux) + +#include + +int +GeodeGetSizeFromFB(unsigned int *size) +{ + struct fb_fix_screeninfo fix; + int ret; + int fd = open("/dev/fb0", O_RDONLY); + + if (fd == -1) + return -1; + + ret = ioctl(fd, FBIOGET_FSCREENINFO, &fix); + close(fd); + + if (!ret) { + if (!memcmp(fix.id, "Geode", 5)) { + *size = fix.smem_len; + return 0; + } + } + + return -1; +} + +#else + +int +GeodeGetSizeFromFB(unsigned int *size) +{ + return -1; +} + +#endif diff --git a/driver/xf86-video-geode/src/geode_dcon.c b/driver/xf86-video-geode/src/geode_dcon.c new file mode 100644 index 000000000..fc887f77f --- /dev/null +++ b/driver/xf86-video-geode/src/geode_dcon.c @@ -0,0 +1,110 @@ +/* Copyright (c) 2006 Advanced Micro Devices, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + * + * Neither the name of the Advanced Micro Devices, Inc. nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +/* Includes that are used by all drivers */ +#include +#include +#include +#include + +#include "geode.h" +#include +#include + +#define DCON_SLEEP_FILE "/sys/devices/platform/dcon/sleep" + +static Bool +dcon_present(void) +{ + static int _dval = -1; + + if (_dval == -1) + _dval = (access("/sys/devices/platform/dcon", F_OK) == 0); + + return (Bool) _dval; +} + +int +DCONDPMSSet(ScrnInfoPtr pScrni, int mode, int flags) +{ + static int failed = -1; + int fd; + char value[1]; + + if (failed == -1) + failed = !dcon_present(); + + if (failed) + return 0; + + fd = open(DCON_SLEEP_FILE, O_WRONLY); + + if (fd < 0) { + failed = 1; + return 0; + } + + switch (mode) { + case DPMSModeOn: + value[0] = '0'; + break; + case DPMSModeStandby: + case DPMSModeSuspend: + case DPMSModeOff: + value[0] = '1'; + break; + } + + write(fd, value, sizeof(value)); + close(fd); + + return 1; +} + +Bool +dcon_init(ScrnInfoPtr pScrni) +{ + GeodeRec *pGeode = GEODEPTR(pScrni); + + if (!dcon_present()) { + xf86DrvMsg(pScrni->scrnIndex, X_DEFAULT, "No DCON is present\n"); + return FALSE; + } + + /* TODO: Print board revision once sysfs exports it. */ + xf86DrvMsg(pScrni->scrnIndex, X_DEFAULT, "DCON detected.\n"); + + /* Panel size setup */ + pGeode->PanelX = DCON_DEFAULT_XRES; + pGeode->PanelY = DCON_DEFAULT_YRES; + + /* FIXME: Mode setup should go here */ + /* FIXME: Controller setup should go here */ + return TRUE; +} diff --git a/driver/xf86-video-geode/src/geode_ddc.c b/driver/xf86-video-geode/src/geode_ddc.c new file mode 100644 index 000000000..419c93bd4 --- /dev/null +++ b/driver/xf86-video-geode/src/geode_ddc.c @@ -0,0 +1,188 @@ +/* Copyright (c) 2003-2007 Advanced Micro Devices, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + * + * Neither the name of the Advanced Micro Devices, Inc. nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "xf86.h" +#include "xf86Modes.h" +#include "compiler.h" +#include "geode.h" + +#ifdef XSERVER_LIBPCIACCESS +#include +#endif + +/* GPIO Register defines from the CS5536 datasheet */ + +#define GPIO_OUT 0x00 +#define GPIO_OUT_ENABLE 0x04 +#define GPIO_OUT_AUX1 0x10 +#define GPIO_IN_ENABLE 0x20 +#define GPIO_IN 0x30 +#define GPIO_IN_AUX1 0x34 + +/* The DDC pins are defined to be on GPIO pins 3 and 4 */ +#define DDC_SCL_PIN (1 << 3) +#define DDC_SDA_PIN (1 << 4) + +#define DDC_DATA_HIGH DDC_SDA_PIN +#define DDC_DATA_LOW (DDC_SDA_PIN << 16) + +#define DDC_CLK_HIGH DDC_SCL_PIN +#define DDC_CLK_LOW (DDC_SCL_PIN << 16) + +#define CS5536_ISA_DEVICE 0x20901022 + +static unsigned short +geode_gpio_iobase(void) +{ +#ifdef XSERVER_LIBPCIACCESS + struct pci_device *pci; + + /* The CS5536 GPIO device is always in the same slot: 00:0f.0 */ + pci = pci_device_find_by_slot(0, 0, 0xF, 0x0); + + if (pci == NULL) + return 0; + + /* The GPIO I/O address is in resource 1 */ + return (unsigned short)pci->regions[1].base_addr; +#else + PCITAG Tag; + + Tag = pciFindFirst(CS5536_ISA_DEVICE, 0xFFFFFFFF); + + if (Tag == PCI_NOT_FOUND) + return 0; + + /* The GPIO I/O address is in resource 1 */ + return (unsigned short)(pciReadLong(Tag, 0x14) & ~1); +#endif +} + +static void +geode_ddc_putbits(I2CBusPtr b, int scl, int sda) +{ + unsigned long iobase = (unsigned long)b->DriverPrivate.ptr; + unsigned long dat; + + dat = scl ? DDC_CLK_HIGH : DDC_CLK_LOW; + dat |= sda ? DDC_DATA_HIGH : DDC_DATA_LOW; + + outl(iobase + GPIO_OUT, dat); +} + +static void +geode_ddc_getbits(I2CBusPtr b, int *scl, int *sda) +{ + unsigned long iobase = (unsigned long)b->DriverPrivate.ptr; + unsigned long dat = inl(iobase + GPIO_IN); + + *scl = (dat & DDC_CLK_HIGH) ? 1 : 0; + *sda = (dat & DDC_DATA_HIGH) ? 1 : 0; +} + +static xf86MonPtr +GeodeGetDDC(ScrnInfoPtr pScrni) +{ + xf86MonPtr mon = NULL; + I2CBusPtr bus; + unsigned long ddciobase; + + ddciobase = geode_gpio_iobase(); + + if (ddciobase == 0) { + xf86DrvMsg(pScrni->scrnIndex, X_ERROR, + "Could not find the GPIO I/O base\n"); + return NULL; + } + + /* The GPIO pins for DDC are multiplexed with a + * serial port. If that serial port is enabled, then + * assume that there is no DDC on the board + */ + + if ((inl(ddciobase + GPIO_IN_AUX1) & DDC_CLK_HIGH) || + (inl(ddciobase + GPIO_OUT_AUX1) & DDC_DATA_HIGH)) { + xf86DrvMsg(pScrni->scrnIndex, X_ERROR, + "GPIO pins are in serial mode. Assuming no DDC\n"); + return NULL; + } + + /* Set up the pins */ + + outl(ddciobase + GPIO_OUT_ENABLE, DDC_DATA_HIGH | DDC_CLK_HIGH); + outl(ddciobase + GPIO_IN_ENABLE, DDC_DATA_HIGH | DDC_CLK_HIGH); + + bus = xf86CreateI2CBusRec(); + + if (bus == NULL) { + xf86DrvMsg(pScrni->scrnIndex, X_ERROR, + "Could not create the I2C structre\n"); + goto err; + } + + bus->BusName = "CS5536 DDC BUS"; + bus->scrnIndex = pScrni->scrnIndex; + bus->I2CGetBits = geode_ddc_getbits; + bus->I2CPutBits = geode_ddc_putbits; + bus->DriverPrivate.ptr = (void *)(ddciobase); + + if (xf86I2CBusInit(bus)) { + mon = xf86DoEDID_DDC2(pScrni->scrnIndex, bus); + +#if (XORG_VERSION_CURRENT >= XORG_VERSION_NUMERIC(1,4,99,0,0)) + if (mon) + xf86DDCApplyQuirks(pScrni->scrnIndex, mon); +#endif + } + + xf86DestroyI2CBusRec(bus, FALSE, FALSE); + + err: + outl(ddciobase + GPIO_OUT_ENABLE, DDC_DATA_LOW | DDC_CLK_LOW); + outl(ddciobase + GPIO_IN_ENABLE, DDC_DATA_LOW | DDC_CLK_LOW); + + return mon; +} + +void +GeodeProbeDDC(ScrnInfoPtr pScrni, int index) +{ + ConfiguredMonitor = GeodeGetDDC(pScrni); +} + +xf86MonPtr +GeodeDoDDC(ScrnInfoPtr pScrni, int index) +{ + xf86MonPtr info = NULL; + + info = GeodeGetDDC(pScrni); + xf86PrintEDID(info); + xf86SetDDCproperties(pScrni, info); + return info; +} diff --git a/driver/xf86-video-geode/src/geode_driver.c b/driver/xf86-video-geode/src/geode_driver.c new file mode 100644 index 000000000..8e467ec94 --- /dev/null +++ b/driver/xf86-video-geode/src/geode_driver.c @@ -0,0 +1,605 @@ +/* + * Copyright (c) 2006 Avanced Micro Devices, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + * Neither the name of the Advanced Micro Devices, Inc. nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + */ + +/* + * File Contents: This is the main module configures the interfacing + * with the X server. The individual modules will be + * loaded based upon the options selected from the + * XF86Config. This file also has modules for finding + * supported modes, turning on the modes based on options. + * + * Project: Amd Xfree Frame buffer device driver. + * + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +/* Includes that are used by all drivers */ +#include "xf86.h" +#include "xf86_OSproc.h" +#include "xf86Resources.h" +#include "compiler.h" +#include "xf86PciInfo.h" +#include "xf86Pci.h" +#include "xf86cmap.h" + +#include "geode.h" + +#define RC_MAX_DEPTH 24 + +#include "fb.h" + +/* Machine independent stuff */ +#include "mipointer.h" +#include "mibank.h" +#include "micmap.h" +/* All drivers implementing backing store need this */ +#include "mibstore.h" +#include "vgaHW.h" +#include "vbe.h" + +/* Check for some extensions */ +#ifdef XFreeXDGA +#define _XF86_DGA_SERVER_ +#include +#endif /* XFreeXDGA */ + +#ifdef DPMSExtension +#include "globals.h" +#include "opaque.h" +#define DPMS_SERVER +#include +#endif /* DPMSExtension */ + +/* A few things all drivers should have */ +#define GEODE_NAME "GEODE" +#define GEODE_DRIVER_NAME "geode" +#define GEODE_VERSION 4000 +#define GEODE_VERSION_MAJOR PACKAGE_VERSION_MAJOR +#define GEODE_VERSION_MINOR PACKAGE_VERSION_MINOR +#define GEODE_VERSION_PATCH PACKAGE_VERSION_PATCHLEVEL + +/* Forward definitions */ +static const OptionInfoRec *AmdAvailableOptions(int chipid, int busid); +static void AmdIdentify(int); + +#ifdef XSERVER_LIBPCIACCESS +static Bool AmdPciProbe(DriverPtr, int, struct pci_device *, intptr_t); +#else +static Bool AmdProbe(DriverPtr, int); +#endif + +#ifdef XSERVER_LIBPCIACCESS +static const struct pci_id_match amdDeviceMatch[] = { + {PCI_VENDOR_ID_NS, PCI_CHIP_GEODEGX, PCI_MATCH_ANY, PCI_MATCH_ANY, 0, 0, + 0}, + {PCI_VENDOR_ID_AMD, PCI_CHIP_GEODELX, PCI_MATCH_ANY, PCI_MATCH_ANY, 0, 0, + 0}, + {0, 0, 0} +}; +#endif /* XSERVER_LIBPCIACCESS */ + +/* driver record contains the functions needed by the server after loading + * the driver module. + */ +_X_EXPORT DriverRec AMD = { + GEODE_VERSION, + "amd", + AmdIdentify, +#ifdef XSERVER_LIBPCIACCESS + NULL, +#else + AmdProbe, +#endif + AmdAvailableOptions, + NULL, + 0, + NULL, +#ifdef XSERVER_LIBPCIACCESS + amdDeviceMatch, + AmdPciProbe +#endif +}; + +_X_EXPORT DriverRec GEODE = { + GEODE_VERSION, + "geode", + AmdIdentify, +#ifdef XSERVER_LIBPCIACCESS + NULL, +#else + AmdProbe, +#endif + AmdAvailableOptions, + NULL, + 0, + NULL, +#ifdef XSERVER_LIBPCIACCESS + amdDeviceMatch, + AmdPciProbe +#endif +}; + +/* Advanced Micro Devices Chip Models */ +typedef struct _DEVICE_MODEL +{ + int DeviceId; + int Model; +} +DeviceModel; + +DeviceModel ChipModel[] = { +#ifdef HAVE_LX + {PCI_CHIP_GEODELX, LX}, +#endif +#ifdef HAVE_GX + {PCI_CHIP_GEODEGX, GX}, +#endif + {-1, 0} +}; + +/* Supported chipsets */ +SymTabRec GeodeChipsets[] = { +#ifdef HAVE_LX + {PCI_CHIP_GEODELX, "Geode LX"}, +#endif +#ifdef HAVE_GX + {PCI_CHIP_GEODEGX, "Geode GX"}, +#endif + {-1, NULL} +}; + +PciChipsets GeodePCIchipsets[] = { +#ifdef HAVE_LX + {PCI_CHIP_GEODELX, PCI_CHIP_GEODELX, RES_SHARED_VGA}, +#endif +#ifdef HAVE_GX + {PCI_CHIP_GEODEGX, PCI_CHIP_GEODEGX, RES_SHARED_VGA}, +#endif + {-1, -1, RES_UNDEFINED}, +}; + +#ifdef HAVE_LX + +OptionInfoRec LX_GeodeOptions[] = { + {LX_OPTION_SW_CURSOR, "SWcursor", OPTV_BOOLEAN, {0}, FALSE}, + {LX_OPTION_HW_CURSOR, "HWcursor", OPTV_BOOLEAN, {0}, FALSE}, + {LX_OPTION_NOCOMPRESSION, "NoCompression", OPTV_BOOLEAN, {0}, FALSE}, + {LX_OPTION_NOACCEL, "NoAccel", OPTV_BOOLEAN, {0}, FALSE}, + {LX_OPTION_ACCEL_METHOD, "AccelMethod", OPTV_STRING, {0}, FALSE}, + {LX_OPTION_TV_SUPPORT, "TV", OPTV_ANYSTR, {0}, FALSE}, + {LX_OPTION_TV_OUTPUT, "TV_Output", OPTV_ANYSTR, {0}, FALSE}, + {LX_OPTION_TV_OVERSCAN, "TVOverscan", OPTV_ANYSTR, {0}, FALSE}, + {LX_OPTION_ROTATE, "Rotate", OPTV_ANYSTR, {0}, FALSE}, + {LX_OPTION_NOPANEL, "NoPanel", OPTV_BOOLEAN, {0}, FALSE}, + {LX_OPTION_COLOR_KEY, "ColorKey", OPTV_INTEGER, {0}, FALSE}, + {LX_OPTION_EXA_SCRATCH_BFRSZ, "ExaScratch", OPTV_INTEGER, {0}, FALSE}, + {LX_OPTION_FBSIZE, "FBSize", OPTV_INTEGER, {0}, FALSE}, + {LX_OPTION_PANEL_GEOMETRY, "PanelGeometry", OPTV_STRING, {0}, FALSE}, + {-1, NULL, OPTV_NONE, {0}, FALSE} +}; + +#endif + +#ifdef HAVE_GX + +OptionInfoRec GX_GeodeOptions[] = { + {GX_OPTION_SW_CURSOR, "SWcursor", OPTV_BOOLEAN, {0}, FALSE}, + {GX_OPTION_HW_CURSOR, "HWcursor", OPTV_BOOLEAN, {0}, FALSE}, + {GX_OPTION_NOCOMPRESSION, "NoCompression", OPTV_BOOLEAN, {0}, FALSE}, + {GX_OPTION_NOACCEL, "NoAccel", OPTV_BOOLEAN, {0}, FALSE}, + {GX_OPTION_ACCEL_METHOD, "AccelMethod", OPTV_STRING, {0}, FALSE}, + {GX_OPTION_TV_SUPPORT, "TV", OPTV_ANYSTR, {0}, FALSE}, + {GX_OPTION_TV_OUTPUT, "TV_Output", OPTV_ANYSTR, {0}, FALSE}, + {GX_OPTION_TV_OVERSCAN, "TVOverscan", OPTV_ANYSTR, {0}, FALSE}, + {GX_OPTION_ROTATE, "Rotate", OPTV_ANYSTR, {0}, FALSE}, + {GX_OPTION_NOPANEL, "NoPanel", OPTV_BOOLEAN, {0}, FALSE}, + {GX_OPTION_COLOR_KEY, "ColorKey", OPTV_INTEGER, {0}, FALSE}, + {GX_OPTION_OSM_IMG_BUFS, "OSMImageBuffers", OPTV_INTEGER, {0}, FALSE}, + {GX_OPTION_OSM_CLR_BUFS, "OSMColorExpBuffers", OPTV_INTEGER, {0}, FALSE}, + {GX_OPTION_FBSIZE, "FBSize", OPTV_INTEGER, {0}, FALSE}, + {GX_OPTION_PANEL_GEOMETRY, "PanelGeometry", OPTV_STRING, {0}, FALSE}, + {-1, NULL, OPTV_NONE, {0}, FALSE} +}; +#endif + +OptionInfoRec no_GeodeOptions[] = { + {-1, NULL, OPTV_NONE, {0}, FALSE} +}; + +/* List of symbols from other modules that this module references.The purpose +* is that to avoid unresolved symbol warnings +*/ +const char *amdVgahwSymbols[] = { + "vgaHWGetHWRec", + "vgaHWUnlock", + "vgaHWInit", + "vgaHWSave", + "vgaHWRestore", + "vgaHWProtect", + "vgaHWGetIOBase", + "vgaHWMapMem", + "vgaHWLock", + "vgaHWFreeHWRec", + "vgaHWSaveScreen", + NULL +}; + +const char *amdVbeSymbols[] = { + "VBEInit", + "vbeDoEDID", + "vbeFree", + NULL +}; + +const char *amdInt10Symbols[] = { + "xf86ExecX86int10", + "xf86InitInt10", + "xf86Int10AllocPages", + "xf86Int10Addr", + NULL +}; + +const char *amdFbSymbols[] = { + "fbScreenInit", + "fbPictureInit", + NULL +}; + +const char *amdXaaSymbols[] = { + "XAADestroyInfoRec", + "XAACreateInfoRec", + "XAAInit", + "XAAScreenIndex", + NULL +}; + +const char *amdExaSymbols[] = { + "exaGetVersion", + "exaDriverInit", + "exaDriverFini", + "exaOffscreenAlloc", + "exaOffscreenFree", + NULL +}; + +const char *amdRamdacSymbols[] = { + "xf86InitCursor", + "xf86CreateCursorInfoRec", + "xf86DestroyCursorInfoRec", + NULL +}; + +#ifdef XFree86LOADER + +/* Module loader interface */ + +static MODULESETUPPROTO(AmdSetup); + +static XF86ModuleVersionInfo AmdVersionRec = { + "amd", + MODULEVENDORSTRING, + MODINFOSTRING1, + MODINFOSTRING2, + XORG_VERSION_CURRENT, + GEODE_VERSION_MAJOR, GEODE_VERSION_MINOR, GEODE_VERSION_PATCH, + ABI_CLASS_VIDEODRV, /* This is a video driver */ + ABI_VIDEODRV_VERSION, + MOD_CLASS_VIDEODRV, + {0, 0, 0, 0} +}; + +static XF86ModuleVersionInfo GeodeVersionRec = { + "geode", + MODULEVENDORSTRING, + MODINFOSTRING1, + MODINFOSTRING2, + XORG_VERSION_CURRENT, + GEODE_VERSION_MAJOR, GEODE_VERSION_MINOR, GEODE_VERSION_PATCH, + ABI_CLASS_VIDEODRV, /* This is a video driver */ + ABI_VIDEODRV_VERSION, + MOD_CLASS_VIDEODRV, + {0, 0, 0, 0} +}; + +static pointer +GeodeSetup(pointer Module, pointer Options, int *ErrorMajor, int *ErrorMinor) +{ + static Bool init = FALSE; + int flag = 0; + +#ifdef XSERVER_LIBPCIACCESS + flag = HaveDriverFuncs; +#endif + if (init) { + *ErrorMajor = LDR_ONCEONLY; + return (pointer) NULL; + } + + init = TRUE; + xf86AddDriver(&GEODE, Module, flag); + + LoaderRefSymLists(amdVgahwSymbols, amdVbeSymbols, + amdFbSymbols, amdXaaSymbols, amdInt10Symbols, amdRamdacSymbols, NULL); + + return (pointer) TRUE; +} + +static pointer +AmdSetup(pointer Module, pointer Options, int *ErrorMajor, int *ErrorMinor) +{ + static Bool Initialised = FALSE; + + if (!Initialised) { + Initialised = TRUE; + xf86AddDriver(&AMD, Module, +#ifdef XSERVER_LIBPCIACCESS + HaveDriverFuncs +#else + 0 +#endif + ); + + /* Tell the loader about symbols from other modules that this + * module might refer to. + */ + LoaderRefSymLists(amdVgahwSymbols, amdVbeSymbols, + amdFbSymbols, amdXaaSymbols, + amdInt10Symbols, amdRamdacSymbols, NULL); + return (pointer) TRUE; + } + + /*The return value must be non-NULL on success */ + if (ErrorMajor) + *ErrorMajor = LDR_ONCEONLY; + return NULL; +} + +_X_EXPORT XF86ModuleData amdModuleData = { &AmdVersionRec, AmdSetup, NULL }; +_X_EXPORT XF86ModuleData geodeModuleData = + { &GeodeVersionRec, GeodeSetup, NULL }; + +#endif /*End of XFree86Loader */ + +/*------------------------------------------------------------------------- + * AmdIdentify. + * + * Description : This function identify an Amdfamily version. + * + * + * Parameters. + * flags : flags may be used in PreInit* + * + * Returns : none + * + * Comments : none + * +*------------------------------------------------------------------------ +*/ +static void +AmdIdentify(int flags) +{ + xf86PrintChipsets(GEODE_NAME, "Driver for AMD Geode Chipsets", + GeodeChipsets); +} + +/*---------------------------------------------------------------------------- + * AmdAvailableOptions. + * + * Description :This function returns the geodeoptions set geodeoption + * + * Parameters. + * chipid :This will identify the chipset. + * busid :This will identify the PCI busid + * + * Returns :ptr to GeodeOptions. + * + * Comments :none + * +*---------------------------------------------------------------------------- +*/ +static const OptionInfoRec * +AmdAvailableOptions(int chipid, int busid) +{ + switch (chipid) { +#ifdef HAVE_LX + case PCI_CHIP_GEODELX: + return LX_GeodeOptions; +#endif +#ifdef HAVE_GX + case PCI_CHIP_GEODEGX: + return GX_GeodeOptions; +#endif + } + return no_GeodeOptions; +} + +#ifdef XSERVER_LIBPCIACCESS + +static Bool +AmdPciProbe(DriverPtr driver, + int entity_num, struct pci_device *device, intptr_t match_data) +{ + ScrnInfoPtr scrn = NULL; + int cpu_detected; + + ErrorF("AmdPciProbe: Probing for supported devices!\n"); + + scrn = xf86ConfigPciEntity(scrn, 0, entity_num, GeodePCIchipsets, + NULL, NULL, NULL, NULL, NULL); + + if (scrn != NULL) { + scrn->driverName = GEODE_DRIVER_NAME; + scrn->driverVersion = GEODE_VERSION; + scrn->name = GEODE_NAME; + scrn->Probe = NULL; + + switch (device->device_id) { +#ifdef HAVE_LX + case PCI_CHIP_GEODELX: + cpu_detected = LX; + LXSetupChipsetFPtr(scrn); + break; +#endif +#ifdef HAVE_GX + case PCI_CHIP_GEODEGX: + cpu_detected = GX; + GXSetupChipsetFPtr(scrn); + break; +#endif + default: + ErrorF("AmdPciProbe: unknown device ID\n"); + return FALSE; + } + + DEBUGMSG(1, (0, X_INFO, "AmdPciProbe: CPUDetected %d!\n", + cpu_detected)); + } + return scrn != NULL; +} + +#else /* XSERVER_LIBPCIACCESS */ + +/*---------------------------------------------------------------------------- + * AmdProbe. + * + * Description :This is to find that hardware is claimed by another + * driver if not claim the slot & allocate ScreenInfoRec. + * + * Parameters. + * drv :a pointer to the geode driver + * flags :flags may passed to check the config and probe detect + * + * Returns :TRUE on success and FALSE on failure. + * + * Comments :This should ne minimal probe and it should under no + * circumstances change the state of the hardware.Don't do + * any intiallizations other than the required + * ScreenInforec. +*---------------------------------------------------------------------------- +*/ + +static Bool +AmdProbe(DriverPtr drv, int flags) +{ + Bool foundScreen = FALSE; + int numDevSections, numUsed; + GDevPtr *devSections = NULL; + int *usedChips = NULL; + int i; + void (*drvr_setup) (ScrnInfoPtr pScrni) = NULL; + int CPUDetected; + + DEBUGMSG(1, (0, X_INFO, "AmdProbe: Probing for supported devices!\n")); + /* + * * Find the config file Device sections that match this + * * driver, and return if there are none. + */ + if ((numDevSections = xf86MatchDevice(GEODE_NAME, &devSections)) <= 0) { + DEBUGMSG(1, (0, X_INFO, "AmdProbe: failed 1!\n")); + return FALSE; + } + DEBUGMSG(1, (0, X_INFO, "AmdProbe: Before MatchPciInstances!\n")); + /* PCI BUS */ + if (xf86GetPciVideoInfo()) { + numUsed = xf86MatchPciInstances(GEODE_NAME, PCI_VENDOR_ID_NS, + GeodeChipsets, GeodePCIchipsets, + devSections, numDevSections, drv, &usedChips); + + if (numUsed <= 0) + numUsed = xf86MatchPciInstances(GEODE_NAME, PCI_VENDOR_ID_AMD, + GeodeChipsets, GeodePCIchipsets, + devSections, numDevSections, drv, &usedChips); + + DEBUGMSG(1, (0, X_INFO, "AmdProbe: MatchPCI (%d)!\n", numUsed)); + + if (numUsed > 0) { + if (flags & PROBE_DETECT) + foundScreen = TRUE; + else { + /* Durango only supports one instance, */ + /* so take the first one */ + for (i = 0; i < numUsed; i++) { + /* Allocate a ScrnInfoRec */ + ScrnInfoPtr pScrni = xf86AllocateScreen(drv, 0); + + EntityInfoPtr pEnt = xf86GetEntityInfo(usedChips[i]); + PciChipsets *p_id; + + for (p_id = GeodePCIchipsets; p_id->numChipset != -1; + p_id++) { + if (pEnt->chipset == p_id->numChipset) { + switch (pEnt->chipset) { +#ifdef HAVE_LX + case PCI_CHIP_GEODELX: + CPUDetected = LX; + drvr_setup = &LXSetupChipsetFPtr; + break; +#endif +#ifdef HAVE_GX + case PCI_CHIP_GEODEGX: + CPUDetected = GX; + drvr_setup = &GXSetupChipsetFPtr; + break; +#endif + default: + break; + } + break; + } + } + xfree(pEnt); + if (drvr_setup == NULL) + return FALSE; + + DEBUGMSG(1, (0, X_INFO, "AmdProbe: CPUDetected %d!\n", + CPUDetected)); + + pScrni->driverName = GEODE_DRIVER_NAME; + pScrni->driverVersion = GEODE_VERSION; + pScrni->name = GEODE_NAME; + pScrni->Probe = AmdProbe; + drvr_setup(pScrni); + + foundScreen = TRUE; + xf86ConfigActivePciEntity(pScrni, usedChips[i], + GeodePCIchipsets, NULL, NULL, NULL, NULL, NULL); + } + } + } + } + + if (usedChips) + xfree(usedChips); + if (devSections) + xfree(devSections); + DEBUGMSG(1, (0, X_INFO, "AmdProbe: result (%d)!\n", foundScreen)); + return foundScreen; +} + +#endif /* else XSERVER_LIBPCIACCESS */ diff --git a/driver/xf86-video-geode/src/geode_fourcc.h b/driver/xf86-video-geode/src/geode_fourcc.h new file mode 100644 index 000000000..f34c2fb86 --- /dev/null +++ b/driver/xf86-video-geode/src/geode_fourcc.h @@ -0,0 +1,112 @@ +/* Xfree video macro definitions. + * + * Copyright (c) 2003-2005 Advanced Micro Devices, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + * + * Neither the name of the Advanced Micro Devices, Inc. nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + */ + +#ifndef AMD_FOURCC_H_ +#define AMD_FOURCC_H_ +#define FOURCC_Y2YU 0x55593259 +#define XVIMAGE_Y2YU \ + { \ + FOURCC_Y2YU, \ + XvYUV, \ + LSBFirst, \ + {'Y','2','Y','U', \ + 0x00,0x00,0x00,0x10,0x80,0x00,0x00,0xAA,0x00,0x38,0x9B,0x71}, \ + 16, \ + XvPacked, \ + 1, \ + 0, 0, 0, 0, \ + 8, 8, 8, \ + 1, 2, 2, \ + 1, 1, 1, \ + {'Y','V','Y','U', \ + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, \ + XvTopToBottom \ + } + +#define FOURCC_YVYU 0x55595659 +#define XVIMAGE_YVYU \ + { \ + FOURCC_YVYU, \ + XvYUV, \ + LSBFirst, \ + {'Y','V','Y','U', \ + 0x00,0x00,0x00,0x10,0x80,0x00,0x00,0xAA,0x00,0x38,0x9B,0x71}, \ + 16, \ + XvPacked, \ + 1, \ + 0, 0, 0, 0, \ + 8, 8, 8, \ + 1, 2, 2, \ + 1, 1, 1, \ + {'Y','V','Y','U', \ + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, \ + XvTopToBottom \ + } + +#define FOURCC_Y800 0x30303859 +#define XVIMAGE_Y800 \ + { \ + FOURCC_Y800, \ + XvYUV, \ + LSBFirst, \ + {'Y','8','0','0', \ + 0x00,0x00,0x00,0x10,0x80,0x00,0x00,0xAA,0x00,0x38,0x9B,0x71}, \ + 8, \ + XvPacked, \ + 1, \ + 0, 0, 0, 0, \ + 8, 0, 0, \ + 1, 0, 0, \ + 1, 0, 0, \ + {'Y','8','0','0', \ + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, \ + XvTopToBottom \ + } + +/* Borrowed from Trident */ + +#define FOURCC_RGB565 0x36315652 +#define XVIMAGE_RGB565 \ + { \ + FOURCC_RGB565, \ + XvRGB,\ + LSBFirst,\ + {'R','V','1','6',\ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},\ + 16,\ + XvPacked,\ + 1,\ + 16, 0xF800, 0x07E0, 0x001F,\ + 0, 0, 0,\ + 0, 0, 0,\ + 0, 0, 0,\ + {'R','V','B',0,\ + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},\ + XvTopToBottom\ + } + +#endif diff --git a/driver/xf86-video-geode/src/geode_msr.c b/driver/xf86-video-geode/src/geode_msr.c new file mode 100644 index 000000000..167ccd623 --- /dev/null +++ b/driver/xf86-video-geode/src/geode_msr.c @@ -0,0 +1,69 @@ +#define _LARGEFILE64_SOURCE +#include +#include +#include +#include +#include +#include "os.h" +#include "geode.h" + +static int +_msr_open(void) +{ + static int msrfd = 0; + + if (msrfd == 0) { + msrfd = open("/dev/cpu/0/msr", O_RDWR); + if (msrfd == -1) + ErrorF("Unable to open /dev/cpu/0/msr: %d\n", errno); + } + + return msrfd; +} + +int +GeodeReadMSR(unsigned long addr, unsigned long *lo, unsigned long *hi) +{ + unsigned int data[2]; + int fd = _msr_open(); + int ret; + + if (fd == -1) + return -1; + + ret = lseek64(fd, (off64_t) addr, SEEK_SET); + + if (ret == -1) + return -1; + + ret = read(fd, (void *)data, sizeof(data)); + + if (ret != 8) + return -1; + + *hi = data[1]; + *lo = data[0]; + + return 0; +} + +int +GeodeWriteMSR(unsigned long addr, unsigned long lo, unsigned long hi) +{ + unsigned int data[2]; + int fd = _msr_open(); + + if (fd == -1) + return -1; + + if (lseek64(fd, (off64_t) addr, SEEK_SET) == -1) + return -1; + + data[0] = lo; + data[1] = hi; + + if (write(fd, (void *)data, 8) != 8) + return -1; + + return 0; +} diff --git a/driver/xf86-video-geode/src/geode_pcirename.h b/driver/xf86-video-geode/src/geode_pcirename.h new file mode 100644 index 000000000..145cc0167 --- /dev/null +++ b/driver/xf86-video-geode/src/geode_pcirename.h @@ -0,0 +1,123 @@ +/* + * Copyright 2007 George Sapountzis + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +/** + * Macros for porting drivers from legacy xfree86 PCI code to the pciaccess + * library. The main purpose being to facilitate source code compatibility. + */ + +#ifndef CIRPCIRENAME_H +#define CIRPCIRENAME_H + +enum region_type +{ + REGION_MEM, + REGION_IO +}; + +#ifndef XSERVER_LIBPCIACCESS + +/* pciVideoPtr */ +#define PCI_DEV_VENDOR_ID(_pcidev) ((_pcidev)->vendor) +#define PCI_DEV_DEVICE_ID(_pcidev) ((_pcidev)->chipType) +#define PCI_DEV_REVISION(_pcidev) ((_pcidev)->chipRev) + +#define PCI_SUB_VENDOR_ID(_pcidev) ((_pcidev)->subsysVendor) +#define PCI_SUB_DEVICE_ID(_pcidev) ((_pcidev)->subsysCard) + +#define PCI_DEV_TAG(_pcidev) pciTag((_pcidev)->bus, \ + (_pcidev)->device, \ + (_pcidev)->func) +#define PCI_DEV_BUS(_pcidev) ((_pcidev)->bus) +#define PCI_DEV_DEV(_pcidev) ((_pcidev)->device) +#define PCI_DEV_FUNC(_pcidev) ((_pcidev)->func) + +/* pciConfigPtr */ +#define PCI_CFG_TAG(_pcidev) (((pciConfigPtr)(_pcidev)->thisCard)->tag) +#define PCI_CFG_BUS(_pcidev) (((pciConfigPtr)(_pcidev)->thisCard)->busnum) +#define PCI_CFG_DEV(_pcidev) (((pciConfigPtr)(_pcidev)->thisCard)->devnum) +#define PCI_CFG_FUNC(_pcidev) (((pciConfigPtr)(_pcidev)->thisCard)->funcnum) + +/* region addr: xfree86 uses different fields for memory regions and I/O ports */ +#define PCI_REGION_BASE(_pcidev, _b, _type) \ + (((_type) == REGION_MEM) ? (_pcidev)->memBase[(_b)] \ + : (_pcidev)->ioBase[(_b)]) + +/* region size: xfree86 uses the log2 of the region size, + * but with zero meaning no region, not size of one XXX */ +#define PCI_REGION_SIZE(_pcidev, _b) \ + (((_pcidev)->size[(_b)] > 0) ? (1 << (_pcidev)->size[(_b)]) : 0) + +/* read/write PCI configuration space */ +#define PCI_READ_BYTE(_pcidev, _value_ptr, _offset) \ + *(_value_ptr) = pciReadByte(PCI_CFG_TAG(_pcidev), (_offset)) + +#define PCI_READ_LONG(_pcidev, _value_ptr, _offset) \ + *(_value_ptr) = pciReadLong(PCI_CFG_TAG(_pcidev), (_offset)) + +#define PCI_WRITE_LONG(_pcidev, _value, _offset) \ + pciWriteLong(PCI_CFG_TAG(_pcidev), (_offset), (_value)) + +#else /* XSERVER_LIBPCIACCESS */ + +typedef struct pci_device *pciVideoPtr; + +#define PCI_DEV_VENDOR_ID(_pcidev) ((_pcidev)->vendor_id) +#define PCI_DEV_DEVICE_ID(_pcidev) ((_pcidev)->device_id) +#define PCI_DEV_REVISION(_pcidev) ((_pcidev)->revision) + +#define PCI_SUB_VENDOR_ID(_pcidev) ((_pcidev)->subvendor_id) +#define PCI_SUB_DEVICE_ID(_pcidev) ((_pcidev)->subdevice_id) + +/* pci-rework functions take a 'pci_device' parameter instead of a tag */ +#define PCI_DEV_TAG(_pcidev) (_pcidev) + +/* PCI_DEV macros, typically used in printf's, add domain ? XXX */ +#define PCI_DEV_BUS(_pcidev) ((_pcidev)->bus) +#define PCI_DEV_DEV(_pcidev) ((_pcidev)->dev) +#define PCI_DEV_FUNC(_pcidev) ((_pcidev)->func) + +/* pci-rework functions take a 'pci_device' parameter instead of a tag */ +#define PCI_CFG_TAG(_pcidev) (_pcidev) + +/* PCI_CFG macros, typically used in DRI init, contain the domain */ +#define PCI_CFG_BUS(_pcidev) (((_pcidev)->domain << 8) | \ + (_pcidev)->bus) +#define PCI_CFG_DEV(_pcidev) ((_pcidev)->dev) +#define PCI_CFG_FUNC(_pcidev) ((_pcidev)->func) + +#define PCI_REGION_BASE(_pcidev, _b, _type) ((_pcidev)->regions[(_b)].base_addr) +#define PCI_REGION_SIZE(_pcidev, _b) ((_pcidev)->regions[(_b)].size) + +#define PCI_READ_BYTE(_pcidev, _value_ptr, _offset) \ + pci_device_cfg_read_u8((_pcidev), (_value_ptr), (_offset)) + +#define PCI_READ_LONG(_pcidev, _value_ptr, _offset) \ + pci_device_cfg_read_u32((_pcidev), (_value_ptr), (_offset)) + +#define PCI_WRITE_LONG(_pcidev, _value, _offset) \ + pci_device_cfg_write_u32((_pcidev), (_value), (_offset)) + +#endif /* XSERVER_LIBPCIACCESS */ + +#endif /* CIRPCIRENAME_H */ diff --git a/driver/xf86-video-geode/src/gfx/disp_gu1.c b/driver/xf86-video-geode/src/gfx/disp_gu1.c new file mode 100644 index 000000000..58e42eebf --- /dev/null +++ b/driver/xf86-video-geode/src/gfx/disp_gu1.c @@ -0,0 +1,2532 @@ +/* Copyright (c) 2005 Advanced Micro Devices, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + * + * Neither the name of the Advanced Micro Devices, Inc. nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + */ + +void gu1_enable_compression(void); /* private routine definition */ +void gu1_disable_compression(void); /* private routine definition */ +void gfx_reset_video(void); /* private routine definition */ +int gfx_set_display_control(int sync_polarities); /* private routine + * definition */ +int gu1_set_specified_mode(DISPLAYMODE * pMode, int bpp); + +/* VIDEO BUFFER SIZE */ + +unsigned long vid_buf_size = 0; +int vid_enabled = 0; + +/*---------------------------------------------------------------------------- + * GU1_DELAY_APPROXIMATE (PRIVATE ROUTINE - NOT PART OF DURANGO API) + * + * Delay the requested number of milliseconds by reading a register. This + * function generally takes longer than the requested time. + *---------------------------------------------------------------------------- + */ + +#define READS_PER_MILLISECOND 60000L + +void +gu1_delay_approximate(unsigned long milliseconds) +{ + /* ASSUME 300 MHz, 5 CLOCKS PER READ */ + + unsigned long loop; + + loop = milliseconds * READS_PER_MILLISECOND; + while (loop-- > 0) { + READ_REG32(DC_UNLOCK); + } +} + +/*---------------------------------------------------------------------------- + * GU1_DELAY_PRECISE (PRIVATE ROUTINE - NOT PART OF DURANGO API) + * + * Delay the number of milliseconds on a more precise level, varying only by + * 1/10 of a ms. This function should only be called if an SC1200 is present. + *---------------------------------------------------------------------------- + */ +void +gu1_delay_precise(unsigned long milliseconds) +{ +#if GFX_VIDEO_SC1200 + +#define LOOP 1000 + unsigned long i, timer_start, timer_end, total_ticks, previous_ticks, + temp_ticks; + + /* Get current time */ + timer_start = IND(SC1200_CB_BASE_ADDR + SC1200_CB_TMVALUE); + + /* Calculate expected end time */ + if (INB(SC1200_CB_BASE_ADDR + SC1200_CB_TMCNFG) & SC1200_TMCLKSEL_27MHZ) + total_ticks = 27000 * milliseconds; /* timer resolution is 27 MHz */ + else + total_ticks = 1000 * milliseconds; /* timer resolution is 1 MHz */ + + if (total_ticks > ((unsigned long)0xffffffff - timer_start)) + /* wrap-around */ + timer_end = total_ticks - ((unsigned long)0xffffffff - timer_start); + else + timer_end = timer_start + total_ticks; + + /* in case of wrap around */ + if (timer_end < timer_start) { + previous_ticks = timer_start; + while (1) { + temp_ticks = IND(SC1200_CB_BASE_ADDR + SC1200_CB_TMVALUE); + if (temp_ticks < previous_ticks) + break; + else + previous_ticks = temp_ticks; + for (i = 0; i < LOOP; i++) + READ_REG32(DC_UNLOCK); + } + } + + /* now the non-wrap around part */ + while (1) { + for (i = 0; i < LOOP; i++) + READ_REG32(DC_UNLOCK); + if (IND(SC1200_CB_BASE_ADDR + SC1200_CB_TMVALUE) > timer_end) + break; + } +#endif /* GFX_VIDEO_SC1200 */ +} + +/*---------------------------------------------------------------------------- + * WARNING!!!! INACCURATE DELAY MECHANISM + * + * In an effort to keep the code self contained and operating system + * independent, the delay loop just performs reads of a display controller + * register. This time will vary for faster processors. The delay can always + * be longer than intended, only effecting the time of the mode switch + * (obviously want it to still be under a second). Problems with the hardware + * only arise if the delay is not long enough. + * + * For the SC1200, the high resolution timer can be used as an accurate + * mechanism for keeping time. However, in order to avoid a busy loop of IO + * reads, the timer is polled in-between busy loops, and therefore the actual + * delay might be longer than the requested delay by the time of one busy loop + * (which on a 200 MHz system took 95 us) + * + * There are thus two delay functions which are called from the main API + * routine. + * One is meant to be more precise and should only called if an SC1200 is + * present. + *---------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +void +gu1_delay_milliseconds(unsigned long milliseconds) +#else +void +gfx_delay_milliseconds(unsigned long milliseconds) +#endif +{ +#if GFX_VIDEO_SC1200 +#if GFX_VIDEO_DYNAMIC + if (gfx_video_type == GFX_VIDEO_TYPE_SC1200) { +#endif + gu1_delay_precise(milliseconds); + return; +#if GFX_VIDEO_DYNAMIC + } +#endif +#endif /* GFX_VIDEO_SC1200 */ + gu1_delay_approximate(milliseconds); +} + +#if GFX_DISPLAY_DYNAMIC +void +gu1_delay_microseconds(unsigned long microseconds) +#else +void +gfx_delay_microseconds(unsigned long microseconds) +#endif +{ + /* ASSUME 300 MHz, 2 CLOCKS PER INCREMENT */ + unsigned long loop_count = microseconds * 150; + + while (loop_count-- > 0) { + ; + } +} + +/*---------------------------------------------------------------------------- + * GFX_VIDEO_SHUTDOWN + * + * This routine disables the display controller output. + *---------------------------------------------------------------------------- + */ +void +gu1_video_shutdown(void) +{ + unsigned long unlock; + unsigned long gcfg, tcfg; + + /* DISABLE COMPRESSION */ + gu1_disable_compression(); + + /* ALSO DISABLE VIDEO */ + /* Use private "reset video" routine to do all that is needed. */ + /* SC1200, for example, also disables the alpha blending regions. */ + gfx_reset_video(); + + /* UNLOCK THE DISPLAY CONTROLLER REGISTERS */ + unlock = READ_REG32(DC_UNLOCK); + WRITE_REG32(DC_UNLOCK, DC_UNLOCK_VALUE); + + /* READ THE CURRENT GX VALUES */ + gcfg = READ_REG32(DC_GENERAL_CFG); + tcfg = READ_REG32(DC_TIMING_CFG); + + /* BLANK THE GX DISPLAY AND DISABLE THE TIMING GENERATOR */ + tcfg &= ~((unsigned long)DC_TCFG_BLKE | (unsigned long)DC_TCFG_TGEN); + WRITE_REG32(DC_TIMING_CFG, tcfg); + + /* DELAY: WAIT FOR PENDING MEMORY REQUESTS */ + /* This delay is used to make sure that all pending requests to the */ + /* memory controller have completed before disabling the FIFO load. */ + gfx_delay_milliseconds(1); + + /* DISABLE DISPLAY FIFO LOAD AND DISABLE COMPRESSION */ + gcfg &= ~(unsigned long)(DC_GCFG_DFLE | DC_GCFG_CMPE | DC_GCFG_DECE); + WRITE_REG32(DC_GENERAL_CFG, gcfg); + WRITE_REG32(DC_UNLOCK, unlock); + return; +} + +/*---------------------------------------------------------------------------- + * GFX_SET_DISPLAY_BPP + * + * This routine programs the bpp in the display controller. + *---------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +int +gu1_set_display_bpp(unsigned short bpp) +#else +int +gfx_set_display_bpp(unsigned short bpp) +#endif +{ + unsigned long ocfg, lock; + + lock = READ_REG32(DC_UNLOCK); + ocfg = READ_REG32(DC_OUTPUT_CFG) & ~(DC_OCFG_8BPP | DC_OCFG_555); + + /* SET DC PIXEL FORMAT */ + if (bpp == 8) + ocfg |= DC_OCFG_8BPP; + else if (bpp == 15) + ocfg |= DC_OCFG_555; + else if (bpp != 16) + return GFX_STATUS_BAD_PARAMETER; + + WRITE_REG32(DC_UNLOCK, DC_UNLOCK_VALUE); + WRITE_REG32(DC_OUTPUT_CFG, ocfg); + WRITE_REG32(DC_UNLOCK, lock); + + /* SET BPP IN GRAPHICS PIPELINE */ + gfx_set_bpp(bpp); + + return 0; +} + +/*---------------------------------------------------------------------------- + * GFX_SET_SPECIFIED_MODE + * This routine uses the parameters in the specified display mode structure + * to program the display controller hardware. + *---------------------------------------------------------------------------- + */ +int +gu1_set_specified_mode(DISPLAYMODE * pMode, int bpp) +{ + unsigned long unlock, value; + unsigned long gcfg, tcfg, ocfg; + unsigned long size, pitch; + unsigned long hactive, vactive; + + gbpp = bpp; + + /* CHECK WHETHER TIMING CHANGE IS ALLOWED */ + /* Flag used for locking also overrides timing change restriction */ + if (gfx_timing_lock && !(pMode->flags & GFX_MODE_LOCK_TIMING)) + return GFX_STATUS_ERROR; + + /* SET GLOBAL FLAG */ + if (pMode->flags & GFX_MODE_LOCK_TIMING) + gfx_timing_lock = 1; + + /* DISABLE COMPRESSION */ + gu1_disable_compression(); + + /* ALSO DISABLE VIDEO */ + /* Use private "reset video" routine to do all that is needed. */ + /* SC1200, for example, also disables the alpha blending regions. */ + gfx_reset_video(); + + /* UNLOCK THE DISPLAY CONTROLLER REGISTERS */ + unlock = READ_REG32(DC_UNLOCK); + WRITE_REG32(DC_UNLOCK, DC_UNLOCK_VALUE); + + /* READ THE CURRENT GX VALUES */ + gcfg = READ_REG32(DC_GENERAL_CFG); + tcfg = READ_REG32(DC_TIMING_CFG); + + /* BLANK THE GX DISPLAY AND DISABLE THE TIMING GENERATOR */ + tcfg &= ~((unsigned long)DC_TCFG_BLKE | (unsigned long)DC_TCFG_TGEN); + WRITE_REG32(DC_TIMING_CFG, tcfg); + + /* DELAY: WAIT FOR PENDING MEMORY REQUESTS + * This delay is used to make sure that all pending requests to the + * memory controller have completed before disabling the FIFO load. + */ + gfx_delay_milliseconds(1); + + /* DISABLE DISPLAY FIFO LOAD AND DISABLE COMPRESSION */ + gcfg &= ~(unsigned long)(DC_GCFG_DFLE | DC_GCFG_CMPE | DC_GCFG_DECE); + WRITE_REG32(DC_GENERAL_CFG, gcfg); + + /* CLEAR THE "DCLK_MUL" FIELD */ + gcfg &= ~(unsigned long)(DC_GCFG_DDCK | DC_GCFG_DPCK | DC_GCFG_DFCK); + gcfg &= ~(unsigned long)DC_GCFG_DCLK_MASK; + WRITE_REG32(DC_GENERAL_CFG, gcfg); + + /* SET THE DOT CLOCK FREQUENCY */ + /* Mask off the divide by two bit (bit 31) */ + gfx_set_clock_frequency(pMode->frequency & 0x7FFFFFFF); + + /* DELAY: WAIT FOR THE PLL TO SETTLE */ + /* This allows the dot clock frequency that was just set to settle. */ + gfx_delay_milliseconds(1); + + /* SET THE "DCLK_MUL" FIELD OF DC_GENERAL_CFG */ + /* The GX hardware divides the dot clock, so 2x really means that the */ + /* internal dot clock equals the external dot clock. */ + if (pMode->frequency & 0x80000000) + gcfg |= 0x0040; + else + gcfg |= 0x0080; + + WRITE_REG32(DC_GENERAL_CFG, gcfg); + + /* DELAY: WAIT FOR THE ADL TO LOCK */ + /* This allows the clock generatation within GX to settle. This is */ + /* needed since some of the register writes that follow require that */ + /* clock to be present. */ + gfx_delay_milliseconds(1); + + /* SET THE GX DISPLAY CONTROLLER PARAMETERS */ + WRITE_REG32(DC_FB_ST_OFFSET, 0); + WRITE_REG32(DC_CB_ST_OFFSET, 0); + WRITE_REG32(DC_CURS_ST_OFFSET, 0); + + /* SET LINE SIZE AND PITCH */ + /* Flat panels use the current flat panel line size to */ + /* calculate the pitch, but load the true line size */ + /* for the mode into the "Frame Buffer Line Size" field */ + /* of DC_BUF_SIZE. */ + if (PanelEnable) + size = ModeWidth; + else + size = pMode->hactive; + + if (bpp > 8) + size <<= 1; + + /* ONLY PYRAMID SUPPORTS 4K LINE SIZE */ + if (size <= 1024) { + pitch = 1024; + /* SPECIAL CASE */ + /* Graphics acceleration in 16-bit pixel line double modes */ + /* requires a pitch of 2048. */ + if ((pMode->flags & GFX_MODE_LINE_DOUBLE) && bpp > 8) + pitch <<= 1; + } else { + if (gfx_cpu_version == GFX_CPU_PYRAMID) + pitch = (size <= 2048) ? 2048 : 4096; + else + pitch = 2048; + } + + WRITE_REG32(DC_LINE_DELTA, pitch >> 2); + + if (PanelEnable) { + size = pMode->hactive; + if (bpp > 8) + size <<= 1; + } + + /* ADD 2 TO SIZE FOR POSSIBLE START ADDRESS ALIGNMENTS */ + WRITE_REG32(DC_BUF_SIZE, (size >> 3) + 2); + + /* ALWAYS ENABLE "PANEL" DATA FROM MEDIAGX */ + /* That is really just the 18 BPP data bus to the companion chip */ + ocfg = DC_OCFG_PCKE | DC_OCFG_PDEL | DC_OCFG_PDEH; + + /* SET PIXEL FORMAT */ + if (bpp == 8) + ocfg |= DC_OCFG_8BPP; + else if (bpp == 15) + ocfg |= DC_OCFG_555; + + /* ENABLE TIMING GENERATOR, SYNCS, AND FP DATA */ + tcfg = DC_TCFG_FPPE | DC_TCFG_HSYE | DC_TCFG_VSYE | DC_TCFG_BLKE | + DC_TCFG_TGEN; + + /* SET FIFO PRIORITY, DCLK MULTIPLIER, AND FIFO ENABLE */ + /* Default 6/5 for FIFO, 2x for DCLK multiplier. */ + gcfg = + (6 << DC_GCFG_DFHPEL_POS) | (5 << DC_GCFG_DFHPSL_POS) | DC_GCFG_DFLE; + + /* INCREASE FIFO PRIORITY FOR LARGE MODES */ + if (pMode->hactive == 1280 && pMode->vactive == 1024) { + if ((bpp == 8) && (pMode->flags & GFX_MODE_85HZ)) + gcfg = + (8l << DC_GCFG_DFHPEL_POS) | (7l << DC_GCFG_DFHPSL_POS) | + DC_GCFG_DFLE; + + if ((bpp > 8) && (pMode->flags & GFX_MODE_75HZ)) + gcfg = + (7l << DC_GCFG_DFHPEL_POS) | (6l << DC_GCFG_DFHPSL_POS) | + DC_GCFG_DFLE; + + if ((bpp > 8) && (pMode->flags & GFX_MODE_85HZ)) + gcfg = + (9l << DC_GCFG_DFHPEL_POS) | (8l << DC_GCFG_DFHPSL_POS) | + DC_GCFG_DFLE; + } + + /* SET DOT CLOCK MULTIPLIER */ + /* Bit 31 of frequency indicates divide frequency by two */ + if (pMode->frequency & 0x80000000) + gcfg |= (1l << DC_GCFG_DCLK_POS); + else + gcfg |= (2l << DC_GCFG_DCLK_POS); + + /* DIVIDE VIDEO CLOCK */ + /* CPU core frequencies above 266 MHz will divide the video */ + /* clock by 4 to ensure that we are running below 150 MHz. */ + if (gfx_cpu_frequency > 266) + gcfg |= DC_GCFG_VCLK_DIV; + + /* ALWAYS ENABLE VIDEO IN THE DISPLAY CONTROLLER */ + /* Enabling video at an inopportune momemt can corrupt the DC fetch */ + /* engine and cause screen artifacts or system hang. */ + gcfg |= (DC_GCFG_VIDE | DC_GCFG_VRDY); + + /* SET THE PIXEL AND LINE DOUBLE BITS IF NECESSARY */ + hactive = pMode->hactive; + vactive = pMode->vactive; + gfx_line_double = 0; + gfx_pixel_double = 0; + + if (pMode->flags & GFX_MODE_LINE_DOUBLE) { + gcfg |= DC_GCFG_LDBL; + hactive <<= 1; + + /* SET GLOBAL FLAG */ + gfx_line_double = 1; + } + + if (pMode->flags & GFX_MODE_PIXEL_DOUBLE) { + tcfg |= DC_TCFG_PXDB; + vactive <<= 1; + + /* SET GLOBAL FLAG */ + gfx_pixel_double = 1; + } + + /* COMBINE AND SET TIMING VALUES */ + + value = (unsigned long)(hactive - 1) | + (((unsigned long)(pMode->htotal - 1)) << 16); + WRITE_REG32(DC_H_TIMING_1, value); + value = (unsigned long)(pMode->hblankstart - 1) | + (((unsigned long)(pMode->hblankend - 1)) << 16); + WRITE_REG32(DC_H_TIMING_2, value); + value = (unsigned long)(pMode->hsyncstart - 1) | + (((unsigned long)(pMode->hsyncend - 1)) << 16); + WRITE_REG32(DC_H_TIMING_3, value); + WRITE_REG32(DC_FP_H_TIMING, value); + value = (unsigned long)(vactive - 1) | + (((unsigned long)(pMode->vtotal - 1)) << 16); + WRITE_REG32(DC_V_TIMING_1, value); + value = (unsigned long)(pMode->vblankstart - 1) | + (((unsigned long)(pMode->vblankend - 1)) << 16); + WRITE_REG32(DC_V_TIMING_2, value); + value = (unsigned long)(pMode->vsyncstart - 1) | + (((unsigned long)(pMode->vsyncend - 1)) << 16); + WRITE_REG32(DC_V_TIMING_3, value); + value = (unsigned long)(pMode->vsyncstart - 2) | + (((unsigned long)(pMode->vsyncend - 2)) << 16); + WRITE_REG32(DC_FP_V_TIMING, value); + + WRITE_REG32(DC_OUTPUT_CFG, ocfg); + WRITE_REG32(DC_TIMING_CFG, tcfg); + gfx_delay_milliseconds(1); /* delay after TIMING_CFG */ + WRITE_REG32(DC_GENERAL_CFG, gcfg); + + /* ENABLE FLAT PANEL CENTERING */ + /* For 640x480 modes displayed with the 9211 within a 800x600 */ + /* flat panel display, turn on flat panel centering. */ + if (PanelEnable) { + if (ModeWidth < PanelWidth) { + tcfg = READ_REG32(DC_TIMING_CFG); + tcfg = tcfg | DC_TCFG_FCEN; + WRITE_REG32(DC_TIMING_CFG, tcfg); + gfx_delay_milliseconds(1); /* delay after TIMING_CFG */ + } + } + + /* CONFIGURE DISPLAY OUTPUT FROM VIDEO PROCESSOR */ + gfx_set_display_control(((pMode->flags & GFX_MODE_NEG_HSYNC) ? 1 : 0) | + ((pMode->flags & GFX_MODE_NEG_VSYNC) ? 2 : 0)); + + /* RESTORE VALUE OF DC_UNLOCK */ + WRITE_REG32(DC_UNLOCK, unlock); + + /* ALSO WRITE GP_BLIT_STATUS FOR PITCH AND 8/18 BPP */ + /* Remember, only Pyramid supports 4K line pitch */ + value = 0; + if (bpp > 8) + value |= BC_16BPP; + if ((gfx_cpu_version == GFX_CPU_PYRAMID) && (pitch > 2048)) + value |= BC_FB_WIDTH_4096; + else if (pitch > 1024) + value |= BC_FB_WIDTH_2048; + + WRITE_REG16(GP_BLIT_STATUS, (unsigned short)value); + + return GFX_STATUS_OK; +} /* end gfx_set_specified_mode() */ + +/*---------------------------------------------------------------------------- + * GFX_IS_DISPLAY_MODE_SUPPORTED + * + * This routine sets the specified display mode. + * + * Returns the index of the mode if successful and mode returned, -1 if the + * mode could not be found. + *---------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +int +gu1_is_display_mode_supported(int xres, int yres, int bpp, int hz) +#else +int +gfx_is_display_mode_supported(int xres, int yres, int bpp, int hz) +#endif +{ + unsigned int mode = 0; + unsigned long hz_flag = 0, bpp_flag = 0; + + /* SET FLAGS TO MATCH REFRESH RATE */ + if (hz == 56) + hz_flag = GFX_MODE_56HZ; + else if (hz == 60) + hz_flag = GFX_MODE_60HZ; + else if (hz == 70) + hz_flag = GFX_MODE_70HZ; + else if (hz == 72) + hz_flag = GFX_MODE_72HZ; + else if (hz == 75) + hz_flag = GFX_MODE_75HZ; + else if (hz == 85) + hz_flag = GFX_MODE_85HZ; + else + return -1; + + /* SET BPP FLAGS TO LIMIT MODE SELECTION */ + if (bpp == 8) + bpp_flag = GFX_MODE_8BPP; + else if (bpp == 15) + bpp_flag = GFX_MODE_15BPP; + else if (bpp == 16) + bpp_flag = GFX_MODE_16BPP; + else + return -1; + + /* ONLY PYRAMID SUPPORTS 4K PITCH */ + if (gfx_cpu_version != GFX_CPU_PYRAMID && xres > 1024) { + if (bpp > 8) + return (-1); /* return with mode not found */ + } + + /* LOOP THROUGH THE AVAILABLE MODES TO FIND A MATCH */ + for (mode = 0; mode < NUM_GX_DISPLAY_MODES; mode++) { + if ((DisplayParams[mode].hactive == (unsigned short)xres) && + (DisplayParams[mode].vactive == (unsigned short)yres) && + (DisplayParams[mode].flags & hz_flag) && + (DisplayParams[mode].flags & bpp_flag)) { + + /* SET THE DISPLAY CONTROLLER FOR THE SELECTED MODE */ + return (mode); + } + } + return (-1); +} + +/*---------------------------------------------------------------------------- + * GFX_SET_DISPLAY_MODE + * + * This routine sets the specified display mode. + * + * Returns 1 if successful, 0 if mode could not be set. + *---------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +int +gu1_set_display_mode(int xres, int yres, int bpp, int hz) +#else +int +gfx_set_display_mode(int xres, int yres, int bpp, int hz) +#endif +{ + int mode; + + /* DISABLE FLAT PANEL */ + /* Flat Panel settings are enabled by the function gfx_set_fixed_timings + * and disabled by gfx_set_display_mode. */ + PanelEnable = 0; + + mode = gfx_is_display_mode_supported(xres, yres, bpp, hz); + if (mode >= 0) { + if (gu1_set_specified_mode(&DisplayParams[mode], + bpp) == GFX_STATUS_OK) + return (1); + } + return (0); +} + +/*---------------------------------------------------------------------------- + * GFX_SET_DISPLAY_TIMINGS + * + * This routine sets the display controller mode using the specified timing + * values (as opposed to using the tables internal to Durango). + * + * Returns GFX_STATUS_OK on success, GFX_STATUS_ERROR otherwise. + *---------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +int +gu1_set_display_timings(unsigned short bpp, unsigned short flags, + unsigned short hactive, unsigned short hblankstart, + unsigned short hsyncstart, unsigned short hsyncend, + unsigned short hblankend, unsigned short htotal, + unsigned short vactive, unsigned short vblankstart, + unsigned short vsyncstart, unsigned short vsyncend, + unsigned short vblankend, unsigned short vtotal, unsigned long frequency) +#else +int +gfx_set_display_timings(unsigned short bpp, unsigned short flags, + unsigned short hactive, unsigned short hblankstart, + unsigned short hsyncstart, unsigned short hsyncend, + unsigned short hblankend, unsigned short htotal, + unsigned short vactive, unsigned short vblankstart, + unsigned short vsyncstart, unsigned short vsyncend, + unsigned short vblankend, unsigned short vtotal, unsigned long frequency) +#endif +{ + /* SET MODE STRUCTURE WITH SPECIFIED VALUES */ + + gfx_display_mode.flags = 0; + if (flags & 1) + gfx_display_mode.flags |= GFX_MODE_NEG_HSYNC; + if (flags & 2) + gfx_display_mode.flags |= GFX_MODE_NEG_VSYNC; + if (flags & 0x1000) + gfx_display_mode.flags |= GFX_MODE_LOCK_TIMING; + gfx_display_mode.hactive = hactive; + gfx_display_mode.hblankstart = hblankstart; + gfx_display_mode.hsyncstart = hsyncstart; + gfx_display_mode.hsyncend = hsyncend; + gfx_display_mode.hblankend = hblankend; + gfx_display_mode.htotal = htotal; + gfx_display_mode.vactive = vactive; + gfx_display_mode.vblankstart = vblankstart; + gfx_display_mode.vsyncstart = vsyncstart; + gfx_display_mode.vsyncend = vsyncend; + gfx_display_mode.vblankend = vblankend; + gfx_display_mode.vtotal = vtotal; + gfx_display_mode.frequency = frequency; + + /* CALL ROUTINE TO SET MODE */ + return (gu1_set_specified_mode(&gfx_display_mode, bpp)); +} + +/*---------------------------------------------------------------------------- + * GFX_SET_VTOTAL + * + * This routine sets the display controller vertical total to + * "vtotal". As a side effect it also sets vertical blank end. + * It should be used when only this value needs to be changed, + * due to speed considerations. + * + * Note: it is the caller's responsibility to make sure that + * a legal vtotal is used, i.e. that "vtotal" is greater than or + * equal to vsync end. + * + * Always returns 0. + *---------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +int +gu1_set_vtotal(unsigned short vtotal) +#else +int +gfx_set_vtotal(unsigned short vtotal) +#endif +{ + unsigned long unlock, tcfg, timing1, timing2; + + /* UNLOCK THE DISPLAY CONTROLLER REGISTERS */ + unlock = READ_REG32(DC_UNLOCK); + WRITE_REG32(DC_UNLOCK, DC_UNLOCK_VALUE); + + /* READ THE CURRENT GX VALUES */ + tcfg = READ_REG32(DC_TIMING_CFG); + timing1 = READ_REG32(DC_V_TIMING_1); + timing2 = READ_REG32(DC_V_TIMING_2); + + /* DISABLE THE TIMING GENERATOR */ + WRITE_REG32(DC_TIMING_CFG, tcfg & ~(unsigned long)DC_TCFG_TGEN); + + /* WRITE NEW TIMING VALUES */ + WRITE_REG32(DC_V_TIMING_1, + (timing1 & 0xffff) | (unsigned long)(vtotal - 1) << 16); + WRITE_REG32(DC_V_TIMING_2, + (timing2 & 0xffff) | (unsigned long)(vtotal - 1) << 16); + + /* RESTORE GX VALUES */ + WRITE_REG32(DC_TIMING_CFG, tcfg); + WRITE_REG32(DC_UNLOCK, unlock); + + return (0); +} + +/*--------------------------------------------------------------------------- + * gfx_set_display_pitch + * + * This routine sets the pitch of the frame buffer to the specified value. + *--------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +void +gu1_set_display_pitch(unsigned short pitch) +#else +void +gfx_set_display_pitch(unsigned short pitch) +#endif +{ + unsigned long value = 0; + unsigned long lock = READ_REG32(DC_UNLOCK); + + value = READ_REG32(DC_LINE_DELTA) & 0xFFFFF000; + value |= (pitch >> 2); + WRITE_REG32(DC_UNLOCK, DC_UNLOCK_VALUE); + WRITE_REG32(DC_LINE_DELTA, value); + WRITE_REG32(DC_UNLOCK, lock); + + /* ALSO UPDATE PITCH IN GRAPHICS ENGINE */ + /* Pyramid alone supports 4K line pitch */ + value = (unsigned long)READ_REG16(GP_BLIT_STATUS); + value &= ~(BC_FB_WIDTH_2048 | BC_FB_WIDTH_4096); + + if ((gfx_cpu_version == GFX_CPU_PYRAMID) && (pitch > 2048)) + value |= BC_FB_WIDTH_4096; + + else if (pitch > 1024) + value |= BC_FB_WIDTH_2048; + + WRITE_REG16(GP_BLIT_STATUS, (unsigned short)value); + return; +} + +/*--------------------------------------------------------------------------- + * gfx_set_display_offset + * + * This routine sets the start address of the frame buffer. It is + * typically used to pan across a virtual desktop (frame buffer larger than + * the displayed screen) or to flip the display between multiple buffers. + *--------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +void +gu1_set_display_offset(unsigned long offset) +#else +void +gfx_set_display_offset(unsigned long offset) +#endif +{ + /* UPDATE FRAME BUFFER OFFSET */ + + unsigned long lock; + + lock = READ_REG32(DC_UNLOCK); + WRITE_REG32(DC_UNLOCK, DC_UNLOCK_VALUE); + + /* START ADDRESS EFFECTS DISPLAY COMPRESSION */ + /* Disable compression for non-zero start addresss values. */ + /* Enable compression if offset is zero and comression is intended to */ + /* be enabled from a previous call to "gfx_set_compression_enable". */ + /* Compression should be disabled BEFORE the offset is changed */ + /* and enabled AFTER the offset is changed. */ + if (offset == 0) { + WRITE_REG32(DC_FB_ST_OFFSET, offset); + if (gfx_compression_enabled) { + /* WAIT FOR THE OFFSET TO BE LATCHED */ + gfx_wait_vertical_blank(); + gu1_enable_compression(); + } + } else { + /* ONLY DISABLE COMPRESSION ONCE */ + if (gfx_compression_active) + gu1_disable_compression(); + + WRITE_REG32(DC_FB_ST_OFFSET, offset); + } + + WRITE_REG32(DC_UNLOCK, lock); +} + +/*--------------------------------------------------------------------------- + * gfx_set_display_palette_entry + * + * This routine sets an palette entry in the display controller. + * A 32-bit X:R:G:B value. + *--------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +int +gu1_set_display_palette_entry(unsigned long index, unsigned long palette) +#else +int +gfx_set_display_palette_entry(unsigned long index, unsigned long palette) +#endif +{ + unsigned long data; + + if (index > 0xFF) + return GFX_STATUS_BAD_PARAMETER; + + WRITE_REG32(DC_PAL_ADDRESS, index); + data = ((palette >> 2) & 0x0003F) | + ((palette >> 4) & 0x00FC0) | ((palette >> 6) & 0x3F000); + WRITE_REG32(DC_PAL_DATA, data); + + return (0); +} + +/*--------------------------------------------------------------------------- + * gfx_set_display_palette + * + * This routine sets the entire palette in the display controller. + * A pointer is provided to a 256 entry table of 32-bit X:R:G:B values. + * + * Restriction: + * Due to SC1200 Issue #748 (in Notes DB) this function should be called only + * when DCLK is active, i.e PLL is already powered up and genlock is not + * active. + *--------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +int +gu1_set_display_palette(unsigned long *palette) +#else +int +gfx_set_display_palette(unsigned long *palette) +#endif +{ + unsigned long data, i; + + WRITE_REG32(DC_PAL_ADDRESS, 0); + if (palette) { + for (i = 0; i < 256; i++) { + /* CONVERT 24 BPP COLOR DATA TO 18 BPP COLOR DATA */ + data = ((palette[i] >> 2) & 0x0003F) | + ((palette[i] >> 4) & 0x00FC0) | ((palette[i] >> 6) & 0x3F000); + WRITE_REG32(DC_PAL_DATA, data); + } + } + return (0); +} + +/*--------------------------------------------------------------------------- + * gfx_set_cursor_enable + * + * This routine enables or disables the hardware cursor. + * + * WARNING: The cusrsor start offset must be set by setting the cursor + * position before calling this routine to assure that memory reads do not + * go past the end of graphics memory (this can hang GXm). + *--------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +void +gu1_set_cursor_enable(int enable) +#else +void +gfx_set_cursor_enable(int enable) +#endif +{ + unsigned long unlock, gcfg; + + /* SET OR CLEAR CURSOR ENABLE BIT */ + unlock = READ_REG32(DC_UNLOCK); + gcfg = READ_REG32(DC_GENERAL_CFG); + if (enable) + gcfg |= DC_GCFG_CURE; + else + gcfg &= ~(DC_GCFG_CURE); + + /* WRITE NEW REGISTER VALUE */ + WRITE_REG32(DC_UNLOCK, DC_UNLOCK_VALUE); + WRITE_REG32(DC_GENERAL_CFG, gcfg); + WRITE_REG32(DC_UNLOCK, unlock); +} + +/*--------------------------------------------------------------------------- + * gfx_set_cursor_colors + * + * This routine sets the colors of the hardware cursor. + * + * Restriction: + * Due to SC1200 Issue #748 (in Notes DB) this function should be called only + * when DCLK is active, i.e PLL is already powered up. + *--------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +void +gu1_set_cursor_colors(unsigned long bkcolor, unsigned long fgcolor) +#else +void +gfx_set_cursor_colors(unsigned long bkcolor, unsigned long fgcolor) +#endif +{ + unsigned long value; + + /* If genlock is enabled DCLK might be disabled in vertical blank. */ + /* Due to SC1200 Issue #748 in Notes DB this would fail the cursor color settings */ + /* So Wait for vertical blank to end */ + +#if GFX_VIDEO_SC1200 + if (gfx_test_timing_active()) + while ((gfx_get_vline()) > gfx_get_vactive()) ; +#endif + /* SET CURSOR COLORS */ + WRITE_REG32(DC_PAL_ADDRESS, 0x100); + value = ((bkcolor & 0x000000FC) >> 2) | + ((bkcolor & 0x0000FC00) >> (2 + 8 - 6)) | + ((bkcolor & 0x00FC0000) >> (2 + 16 - 12)); + WRITE_REG32(DC_PAL_DATA, value); + value = ((fgcolor & 0x000000FC) >> 2) | + ((fgcolor & 0x0000FC00) >> (2 + 8 - 6)) | + ((fgcolor & 0x00FC0000) >> (2 + 16 - 12)); + WRITE_REG32(DC_PAL_DATA, value); +} + +/*--------------------------------------------------------------------------- + * gfx_set_cursor_position + * + * This routine sets the position of the hardware cusror. The starting + * offset of the cursor buffer must be specified so that the routine can + * properly clip scanlines if the cursor is off the top of the screen. + *--------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +void +gu1_set_cursor_position(unsigned long memoffset, + unsigned short xpos, unsigned short ypos, + unsigned short xhotspot, unsigned short yhotspot) +#else +void +gfx_set_cursor_position(unsigned long memoffset, + unsigned short xpos, unsigned short ypos, + unsigned short xhotspot, unsigned short yhotspot) +#endif +{ + unsigned long unlock; + + short x, y; + short xoffset = 0; + short yoffset = 0; + + /* SUPPORT CURSOR IN EMULATED VGA MODES */ + /* Timings are for twice the resolution */ + if (gfx_pixel_double) + xpos <<= 1; + + if (gfx_line_double) + ypos <<= 1; + + x = (short)xpos - (short)xhotspot; + y = (short)ypos - (short)yhotspot; + if (x < -31) + return; + + if (y < -31) + return; + + if (x < 0) { + xoffset = -x; + x = 0; + } + + if (y < 0) { + yoffset = -y; + y = 0; + } + + memoffset += (unsigned long)yoffset << 3; + + if (PanelEnable) { + if ((ModeWidth > PanelWidth) || (ModeHeight > PanelHeight)) { + gfx_enable_panning(xpos, ypos); + x = x - (short)panelLeft; + y = y - (short)panelTop; + } + } + + /* SET CURSOR POSITION */ + unlock = READ_REG32(DC_UNLOCK); + WRITE_REG32(DC_UNLOCK, DC_UNLOCK_VALUE); + WRITE_REG32(DC_CURS_ST_OFFSET, memoffset); + WRITE_REG32(DC_CURSOR_X, (unsigned long)x | + (((unsigned long)xoffset) << 11)); + WRITE_REG32(DC_CURSOR_Y, (unsigned long)y | + (((unsigned long)yoffset) << 11)); + WRITE_REG32(DC_UNLOCK, unlock); +} + +/*--------------------------------------------------------------------------- + * gfx_set_cursor_shape32 + * + * This routine loads 32x32 cursor data into the specified location in + * graphics memory. + *--------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +void +gu1_set_cursor_shape32(unsigned long memoffset, + unsigned long *andmask, unsigned long *xormask) +#else +void +gfx_set_cursor_shape32(unsigned long memoffset, + unsigned long *andmask, unsigned long *xormask) +#endif +{ + int i; + unsigned long value; + + for (i = 0; i < 32; i++) { + /* CONVERT TO 16 BITS AND MASK, 16 BITS XOR MASK PER DWORD */ + value = (andmask[i] & 0xFFFF0000) | (xormask[i] >> 16); + WRITE_FB32(memoffset, value); + memoffset += 4; + value = (andmask[i] << 16) | (xormask[i] & 0x0000FFFF); + WRITE_FB32(memoffset, value); + memoffset += 4; + } +} + +/*--------------------------------------------------------------------------- + * gu1_enable_compression + * + * This is a private routine to this module (not exposed in the Durango API). + * It enables display compression. + *--------------------------------------------------------------------------- + */ +void +gu1_enable_compression(void) +{ + int i; + unsigned long unlock, gcfg, offset; + + /* DO NOT ENABLE IF START ADDRESS IS NOT ZERO */ + offset = READ_REG32(DC_FB_ST_OFFSET) & 0x003FFFFF; + if (offset != 0) + return; + + /* DO NOT ENABLE IF WE ARE WITHIN AN EMULATED VGA MODE */ + if (gfx_line_double || gfx_pixel_double) + return; + + /* SET GLOBAL INDICATOR */ + gfx_compression_active = 1; + + /* CLEAR DIRTY/VALID BITS IN MEMORY CONTROLLER */ + /* Software is required to do this before enabling compression. */ + /* Don't want controller to think that old lines are still valid. */ + for (i = 0; i < 1024; i++) { + WRITE_REG32(MC_DR_ADD, i); + WRITE_REG32(MC_DR_ACC, 0); + } + + /* TURN ON COMPRESSION CONTROL BITS */ + unlock = READ_REG32(DC_UNLOCK); + gcfg = READ_REG32(DC_GENERAL_CFG); + gcfg |= DC_GCFG_CMPE | DC_GCFG_DECE; + WRITE_REG32(DC_UNLOCK, DC_UNLOCK_VALUE); + WRITE_REG32(DC_GENERAL_CFG, gcfg); + WRITE_REG32(DC_UNLOCK, unlock); +} + +/*--------------------------------------------------------------------------- + * gu1_disable_compression + * + * This is a private routine to this module (not exposed in the Durango API). + * It disables display compression. + *--------------------------------------------------------------------------- + */ +void +gu1_disable_compression(void) +{ + unsigned long unlock, gcfg; + + /* SET GLOBAL INDICATOR */ + gfx_compression_active = 0; + + /* TURN OFF COMPRESSION CONTROL BITS */ + unlock = READ_REG32(DC_UNLOCK); + gcfg = READ_REG32(DC_GENERAL_CFG); + gcfg &= ~(DC_GCFG_CMPE | DC_GCFG_DECE); + WRITE_REG32(DC_UNLOCK, DC_UNLOCK_VALUE); + WRITE_REG32(DC_GENERAL_CFG, gcfg); + WRITE_REG32(DC_UNLOCK, unlock); +} + +/*--------------------------------------------------------------------------- + * gfx_set_compression_enable + * + * This routine enables or disables display compression. + *--------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +int +gu1_set_compression_enable(int enable) +#else +int +gfx_set_compression_enable(int enable) +#endif +{ + /* SET GLOBAL VARIABLE FOR INTENDED STATE */ + /* Compression can only be enabled for non-zero start address values. */ + /* Keep state to enable compression on start address changes. */ + gfx_compression_enabled = enable; + if (enable) + gu1_enable_compression(); + else + gu1_disable_compression(); + + return (0); +} + +/*--------------------------------------------------------------------------- + * gfx_set_compression_offset + * + * This routine sets the base offset for the compression buffer. + *--------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +int +gu1_set_compression_offset(unsigned long offset) +#else +int +gfx_set_compression_offset(unsigned long offset) +#endif +{ + unsigned long lock; + + /* MUST BE 16-BYTE ALIGNED FOR GXLV */ + if (offset & 0x0F) + return (1); + + /* SET REGISTER VALUE */ + lock = READ_REG32(DC_UNLOCK); + WRITE_REG32(DC_UNLOCK, DC_UNLOCK_VALUE); + WRITE_REG32(DC_CB_ST_OFFSET, offset); + WRITE_REG32(DC_UNLOCK, lock); + return (0); +} + +/*--------------------------------------------------------------------------- + * gfx_set_compression_pitch + * + * This routine sets the pitch, in bytes, of the compression buffer. + *--------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +int +gu1_set_compression_pitch(unsigned short pitch) +#else +int +gfx_set_compression_pitch(unsigned short pitch) +#endif +{ + unsigned long lock, line_delta; + + /* SET REGISTER VALUE */ + lock = READ_REG32(DC_UNLOCK); + line_delta = READ_REG32(DC_LINE_DELTA) & 0xFF800FFF; + line_delta |= ((unsigned long)pitch << 10l) & 0x007FF000; + WRITE_REG32(DC_UNLOCK, DC_UNLOCK_VALUE); + WRITE_REG32(DC_LINE_DELTA, line_delta); + WRITE_REG32(DC_UNLOCK, lock); + return (0); +} + +/*--------------------------------------------------------------------------- + * gfx_set_compression_size + * + * This routine sets the line size of the compression buffer, which is the + * maximum number of bytes allowed to store a compressed line. + *--------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +int +gu1_set_compression_size(unsigned short size) +#else +int +gfx_set_compression_size(unsigned short size) +#endif +{ + unsigned long lock, buf_size; + + /* SUBTRACT 16 FROM SIZE */ + /* The display controller will actually write */ + /* 2 extra QWords. So, if we assume that "size" */ + /* refers to the allocated size, we must subtract */ + /* 16 bytes. */ + size -= 16; + + /* SET REGISTER VALUE */ + lock = READ_REG32(DC_UNLOCK); + buf_size = READ_REG32(DC_BUF_SIZE) & 0xFFFF01FF; + buf_size |= (((size >> 2) + 1) & 0x7F) << 9; + WRITE_REG32(DC_UNLOCK, DC_UNLOCK_VALUE); + WRITE_REG32(DC_BUF_SIZE, buf_size); + WRITE_REG32(DC_UNLOCK, lock); + return (0); +} + +/*--------------------------------------------------------------------------- + * gfx_set_display_video_enable (PRIVATE ROUTINE - NOT PART OF API) + * + * This routine enables/disables video on GX. + *--------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +void +gu1_set_display_video_enable(int enable) +#else +void +gfx_set_display_video_enable(int enable) +#endif +{ + unsigned long lock, gcfg, buf_size; + + lock = READ_REG32(DC_UNLOCK); + gcfg = READ_REG32(DC_GENERAL_CFG); + buf_size = READ_REG32(DC_BUF_SIZE); + + WRITE_REG32(DC_UNLOCK, DC_UNLOCK_VALUE); + + vid_enabled = enable; + + /* SET THE BUFFER SIZE TO A NON-ZERO VALUE ONLY WHEN */ + /* ENABLING VIDEO */ + if (enable) { + gcfg |= (DC_GCFG_VIDE | DC_GCFG_VRDY); + WRITE_REG32(DC_GENERAL_CFG, gcfg); + + WRITE_REG32(DC_BUF_SIZE, (buf_size & 0x0000FFFFl) | vid_buf_size); + } + /* CLEAR THE VIDEO BUFFER SIZE WHEN DISABLING VIDEO */ + else { + gcfg &= ~(DC_GCFG_VIDE); + WRITE_REG32(DC_GENERAL_CFG, gcfg); + + vid_buf_size = buf_size & 0xFFFF0000l; + WRITE_REG32(DC_BUF_SIZE, buf_size & 0x0000FFFFl); + } + + WRITE_REG32(DC_UNLOCK, lock); + return; +} + +/*--------------------------------------------------------------------------- + * gfx_set_display_video_size (PRIVATE ROUTINE - NOT PART OF API) + * + * This routine is called by "gfx_set_video_size". It abstracts the + * version of the display controller from the video overlay routines. + *--------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +void +gu1_set_display_video_size(unsigned short width, unsigned short height) +#else +void +gfx_set_display_video_size(unsigned short width, unsigned short height) +#endif +{ + unsigned long lock, size, value; + + size = (unsigned long)(width << 1) * (unsigned long)height; + + /* STORE THE VIDEO BUFFER SIZE AS A GLOBAL */ + vid_buf_size = ((size + 63) >> 6) << 16; + + lock = READ_REG32(DC_UNLOCK); + WRITE_REG32(DC_UNLOCK, DC_UNLOCK_VALUE); + value = READ_REG32(DC_BUF_SIZE) & 0x0000FFFF; + value |= vid_buf_size; + WRITE_REG32(DC_BUF_SIZE, value); + WRITE_REG32(DC_UNLOCK, lock); +} + +/*--------------------------------------------------------------------------- + * gfx_set_display_video_offset (PRIVATE ROUTINE - NOT PART OF API) + * + * This routine is called by "gfx_set_video_offset". It abstracts the + * version of the display controller from the video overlay routines. + *--------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +void +gu1_set_display_video_offset(unsigned long offset) +#else +void +gfx_set_display_video_offset(unsigned long offset) +#endif +{ + unsigned long lock; + + lock = READ_REG32(DC_UNLOCK); + WRITE_REG32(DC_UNLOCK, DC_UNLOCK_VALUE); + offset &= 0x003FFFFF; + WRITE_REG32(DC_VID_ST_OFFSET, offset); + WRITE_REG32(DC_UNLOCK, lock); +} + +/*--------------------------------------------------------------------------- + * gfx_set_display_priority_high + * + * This routine controls the x-bus round robin arbitration mechanism. + * When enable is TRUE, graphics pipeline requests and non-critical display + * controller requests are arbitrated at the same priority as processor + * requests. When FALSE processor requests are arbitrated at a higher priority + *--------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +void +gu1_set_display_priority_high(int enable) +#else +void +gfx_set_display_priority_high(int enable) +#endif +{ + unsigned long lock, control; + + lock = READ_REG32(DC_UNLOCK); + control = READ_REG32(MC_MEM_CNTRL1); + WRITE_REG32(DC_UNLOCK, DC_UNLOCK_VALUE); + if (enable) + control |= MC_XBUSARB; + else + control &= ~(MC_XBUSARB); + WRITE_REG32(MC_MEM_CNTRL1, control); + WRITE_REG32(DC_UNLOCK, lock); + return; +} + +/*--------------------------------------------------------------------------- + * gfx_test_timing_active + *--------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +int +gu1_test_timing_active(void) +#else +int +gfx_test_timing_active(void) +#endif +{ + if (READ_REG32(DC_TIMING_CFG) & DC_TCFG_TGEN) + return (1); + else + return (0); +} + +/*--------------------------------------------------------------------------- + * gfx_test_vertical_active + *--------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +int +gu1_test_vertical_active(void) +#else +int +gfx_test_vertical_active(void) +#endif +{ + if (READ_REG32(DC_TIMING_CFG) & DC_TCFG_VNA) + return (0); + else + return (1); +} + +/*--------------------------------------------------------------------------- + * gfx_wait_vertical_blank + *--------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +int +gu1_wait_vertical_blank(void) +#else +int +gfx_wait_vertical_blank(void) +#endif +{ + if (gfx_test_timing_active()) { + while (!gfx_test_vertical_active()) ; + while (gfx_test_vertical_active()) ; + } + + return (0); +} + +/*--------------------------------------------------------------------------- + * gfx_enable_panning + * + * This routine enables the panning when the Mode is bigger than the panel + * size. + *--------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +void +gu1_enable_panning(int x, int y) +#else +void +gfx_enable_panning(int x, int y) +#endif +{ + unsigned long modeBytesPerPixel; + unsigned long modeBytesPerScanline = 0; + unsigned long startAddress = 0; + + modeBytesPerPixel = (gbpp + 7) / 8; + modeBytesPerScanline = + (((ModeWidth + 1023) / 1024) * 1024) * modeBytesPerPixel; + + /* TEST FOR NO-WORK */ + if (x >= DeltaX && (unsigned short)x < (PanelWidth + DeltaX) && + y >= DeltaY && (unsigned short)y < (PanelHeight + DeltaY)) + return; + + /* ADJUST PANNING VARIABLES WHEN CURSOR EXCEEDS BOUNDARY */ + /* Test the boundary conditions for each coordinate and update */ + /* all variables and the starting offset accordingly. */ + if (x < DeltaX) + DeltaX = x; + else if ((unsigned short)x >= (DeltaX + PanelWidth)) + DeltaX = x - PanelWidth + 1; + + if (y < DeltaY) + DeltaY = y; + else if ((unsigned short)y >= (DeltaY + PanelHeight)) + DeltaY = y - PanelHeight + 1; + + /* CALCULATE THE START OFFSET */ + startAddress = + (DeltaX * modeBytesPerPixel) + (DeltaY * modeBytesPerScanline); + + gfx_set_display_offset(startAddress); + + /* SET PANEL COORDINATES */ + /* Panel's x position must be DWORD aligned */ + panelTop = DeltaY; + panelLeft = DeltaX * modeBytesPerPixel; + + if (panelLeft & 3) + panelLeft = (panelLeft & 0xFFFFFFFC) + 4; + + panelLeft /= modeBytesPerPixel; + +} + +/*--------------------------------------------------------------------------- + * gfx_set_fixed_timings + *--------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +int +gu1_set_fixed_timings(int panelResX, int panelResY, unsigned short width, + unsigned short height, unsigned short bpp) +#else +int +gfx_set_fixed_timings(int panelResX, int panelResY, unsigned short width, + unsigned short height, unsigned short bpp) +#endif +{ + unsigned int mode; + + ModeWidth = width; + ModeHeight = height; + PanelWidth = (unsigned short)panelResX; + PanelHeight = (unsigned short)panelResY; + PanelEnable = 1; + + /* LOOP THROUGH THE AVAILABLE MODES TO FIND A MATCH */ + for (mode = 0; mode < NUM_FIXED_TIMINGS_MODES; mode++) { + if ((FixedParams[mode].xres == width) && + (FixedParams[mode].yres == height) && + (FixedParams[mode].panelresx == panelResX) && + (FixedParams[mode].panelresy == panelResY)) { + + /* SET THE 92xx FOR THE SELECTED MODE */ + FIXEDTIMINGS *fmode = &FixedParams[mode]; + + gfx_set_display_timings(bpp, 3, fmode->hactive, + fmode->hblankstart, fmode->hsyncstart, fmode->hsyncend, + fmode->hblankend, fmode->htotal, fmode->vactive, + fmode->vblankstart, fmode->vsyncstart, fmode->vsyncend, + fmode->vblankend, fmode->vtotal, fmode->frequency); + + return (1); + } /* end if() */ + } /* end for() */ + + return (-1); +} + +/*--------------------------------------------------------------------------- + * gfx_set_panel_present + *--------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +int +gu1_set_panel_present(int panelResX, int panelResY, unsigned short width, + unsigned short height, unsigned short bpp) +#else +int +gfx_set_panel_present(int panelResX, int panelResY, unsigned short width, + unsigned short height, unsigned short bpp) +#endif +{ + /* SET VALID BPP */ + /* 16BPP is the default. */ + if (bpp != 8 && bpp != 15 && bpp != 16) + bpp = 16; + + /* RECORD PANEL PARAMETERS */ + /* This routine does not touch any panel timings. It is used when custom + * panel settings are set up in advance by the BIOS or an application, but + * the application still requires access to other panel functionality + * provided by Durango (i.e. panning) + * */ + + ModeWidth = width; + ModeHeight = height; + PanelWidth = (unsigned short)panelResX; + PanelHeight = (unsigned short)panelResY; + PanelEnable = 1; + gbpp = bpp; + + /* PROGRAM THE BPP IN THE DISPLAY CONTROLLER */ + gfx_set_display_bpp(bpp); + + return (GFX_STATUS_OK); +} + +/*-----------------------------------------------------------------------* + * THE FOLLOWING READ ROUTINES ARE ALWAYS INCLUDED: * + * gfx_get_hsync_end, gfx_get_htotal, gfx_get_vsync_end, gfx_get_vtotal * + * are used by the video overlay routines. * + * * + * gfx_get_vline and gfx_vactive are used to prevent an issue for the * + * SC1200. * + * * + * The others are part of the Durango API. * + *-----------------------------------------------------------------------*/ + +/*--------------------------------------------------------------------------- + * gfx_get_display_pitch + * + * This routine returns the current pitch of the frame buffer, in bytes. + *--------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +unsigned short +gu1_get_display_pitch(void) +#else +unsigned short +gfx_get_display_pitch(void) +#endif +{ + unsigned long value; + + if (gfx_cpu_version == GFX_CPU_PYRAMID) { + /* Pyramid update for 4KB line pitch */ + value = (READ_REG32(DC_LINE_DELTA) & 0x07FF) << 2; + } else { + value = (READ_REG32(DC_LINE_DELTA) & 0x03FF) << 2; + } + + return ((unsigned short)value); +} + +/*---------------------------------------------------------------------------- + * GFX_GET_DISPLAY_DETAILS + * + * This routine gets the specified display mode. + * + * Returns 1 if successful, 0 if mode could not be get. + *---------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +int +gu1_get_display_details(unsigned int mode, int *xres, int *yres, int *hz) +#else +int +gfx_get_display_details(unsigned int mode, int *xres, int *yres, int *hz) +#endif +{ + if (mode < NUM_GX_DISPLAY_MODES) { + if (DisplayParams[mode].flags & GFX_MODE_56HZ) + *hz = 56; + else if (DisplayParams[mode].flags & GFX_MODE_60HZ) + *hz = 60; + else if (DisplayParams[mode].flags & GFX_MODE_70HZ) + *hz = 70; + else if (DisplayParams[mode].flags & GFX_MODE_72HZ) + *hz = 72; + else if (DisplayParams[mode].flags & GFX_MODE_75HZ) + *hz = 75; + else if (DisplayParams[mode].flags & GFX_MODE_85HZ) + *hz = 85; + + *xres = DisplayParams[mode].hactive; + *yres = DisplayParams[mode].vactive; + + return (1); + } + return (0); +} + +/*---------------------------------------------------------------------------- + * GFX_GET_DISPLAY_MODE_COUNT + * + * Returns number of modes supported. + *---------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +int +gu1_get_display_mode_count(void) +#else +int +gfx_get_display_mode_count(void) +#endif +{ + return (NUM_GX_DISPLAY_MODES); +} + +/*---------------------------------------------------------------------------- + * gfx_get_frame_buffer_line_size + * + * Returns the current frame buffer line size, in bytes + *---------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +unsigned long +gu1_get_frame_buffer_line_size(void) +#else +unsigned long +gfx_get_frame_buffer_line_size(void) +#endif +{ + return ((READ_REG32(DC_BUF_SIZE) & 0x1FF) << 3); +} + +/*---------------------------------------------------------------------------- + * gfx_mode_frequency_supported + * + * This routine examines if the requested mode with pixel frequency is supported. + * + * Returns >0 if successful , <0 if freq. could not be found and matched. + *---------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +int +gu1_mode_frequency_supported(int xres, int yres, int bpp, + unsigned long frequency) +#else +int +gfx_mode_frequency_supported(int xres, int yres, int bpp, + unsigned long frequency) +#endif +{ + unsigned int index; + unsigned long value; + unsigned long bpp_flag = 0; + + bpp_flag = GFX_MODE_8BPP; + if (bpp > 8) + bpp_flag = GFX_MODE_16BPP; + + for (index = 0; index < NUM_GX_DISPLAY_MODES; index++) { + if ((DisplayParams[index].hactive == (unsigned short)xres) && + (DisplayParams[index].vactive == (unsigned short)yres) && + (DisplayParams[index].flags & bpp_flag) && + (DisplayParams[index].frequency == frequency)) { + int hz = 0; + + value = DisplayParams[index].flags; + + if (value & GFX_MODE_56HZ) + hz = 56; + else if (value & GFX_MODE_60HZ) + hz = 60; + else if (value & GFX_MODE_70HZ) + hz = 70; + else if (value & GFX_MODE_72HZ) + hz = 72; + else if (value & GFX_MODE_75HZ) + hz = 75; + else if (value & GFX_MODE_85HZ) + hz = 85; + + return (hz); + } + } + return (-1); +} + +/*---------------------------------------------------------------------------- + * gfx_refreshrate_from_frequency + * + * This routine maps the frequency to close match refresh rate + *---------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +int +gu1_get_refreshrate_from_frequency(int xres, int yres, int bpp, int *hz, + unsigned long frequency) +#else +int +gfx_get_refreshrate_from_frequency(int xres, int yres, int bpp, int *hz, + unsigned long frequency) +#endif +{ + unsigned int index, closematch = 0; + unsigned long value; + unsigned long bpp_flag = 0; + long min, diff; + + *hz = 60; + + bpp_flag = GFX_MODE_8BPP; + if (bpp > 8) + bpp_flag = GFX_MODE_16BPP; + + /* FIND THE REGISTER VALUES FOR THE DESIRED FREQUENCY */ + /* Search the table for the closest frequency (16.16 format). */ + min = 0x7fffffff; + for (index = 0; index < NUM_GX_DISPLAY_MODES; index++) { + if ((DisplayParams[index].htotal == (unsigned short)xres) && + (DisplayParams[index].vtotal == (unsigned short)yres) && + (DisplayParams[index].flags & bpp_flag)) { + diff = (long)frequency - (long)DisplayParams[index].frequency; + if (diff < 0) + diff = -diff; + + if (diff < min) { + min = diff; + closematch = index; + } + } + } + + value = DisplayParams[closematch].flags; + + if (value & GFX_MODE_56HZ) + *hz = 56; + else if (value & GFX_MODE_60HZ) + *hz = 60; + else if (value & GFX_MODE_70HZ) + *hz = 70; + else if (value & GFX_MODE_72HZ) + *hz = 72; + else if (value & GFX_MODE_75HZ) + *hz = 75; + else if (value & GFX_MODE_85HZ) + *hz = 85; + + return (1); +} + +/*---------------------------------------------------------------------------- + * gfx_refreshrate_from_mode + * + * This routine is identical to the gfx_get_refreshrate_from_frequency, + * except that the active timing values are compared instead of the total + * values. Some modes (such as 70Hz and 72Hz) may be confused in this routine + *---------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +int +gu1_get_refreshrate_from_mode(int xres, int yres, int bpp, int *hz, + unsigned long frequency) +#else +int +gfx_get_refreshrate_from_mode(int xres, int yres, int bpp, int *hz, + unsigned long frequency) +#endif +{ + unsigned int index, closematch = 0; + unsigned long value; + unsigned long bpp_flag = 0; + long min, diff; + + *hz = 60; + + bpp_flag = GFX_MODE_8BPP; + if (bpp > 8) + bpp_flag = GFX_MODE_16BPP; + + /* FIND THE REGISTER VALUES FOR THE DESIRED FREQUENCY */ + /* Search the table for the closest frequency (16.16 format). */ + min = 0x7fffffff; + for (index = 0; index < NUM_GX_DISPLAY_MODES; index++) { + if ((DisplayParams[index].hactive == (unsigned short)xres) && + (DisplayParams[index].vactive == (unsigned short)yres) && + (DisplayParams[index].flags & bpp_flag)) { + diff = (long)frequency - (long)DisplayParams[index].frequency; + if (diff < 0) + diff = -diff; + + if (diff < min) { + min = diff; + closematch = index; + } + } + } + + value = DisplayParams[closematch].flags; + + if (value & GFX_MODE_56HZ) + *hz = 56; + else if (value & GFX_MODE_60HZ) + *hz = 60; + else if (value & GFX_MODE_70HZ) + *hz = 70; + else if (value & GFX_MODE_72HZ) + *hz = 72; + else if (value & GFX_MODE_75HZ) + *hz = 75; + else if (value & GFX_MODE_85HZ) + *hz = 85; + + return (1); +} + +/*---------------------------------------------------------------------------- + * gfx_get_frequency_from_refreshrate + * + * This routine maps the refresh rate to the closest matching PLL frequency. + *---------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +int +gu1_get_frequency_from_refreshrate(int xres, int yres, int bpp, int hz, + int *frequency) +#else +int +gfx_get_frequency_from_refreshrate(int xres, int yres, int bpp, int hz, + int *frequency) +#endif +{ + unsigned int index; + int retval = -1; + unsigned long hz_flag = 0; + unsigned long bpp_flag = 0; + + *frequency = 0; + + if (hz == 56) + hz_flag = GFX_MODE_56HZ; + else if (hz == 60) + hz_flag = GFX_MODE_60HZ; + else if (hz == 70) + hz_flag = GFX_MODE_70HZ; + else if (hz == 72) + hz_flag = GFX_MODE_72HZ; + else if (hz == 75) + hz_flag = GFX_MODE_75HZ; + else if (hz == 85) + hz_flag = GFX_MODE_85HZ; + + bpp_flag = GFX_MODE_8BPP; + if (bpp > 8) + bpp_flag = GFX_MODE_16BPP; + + /* FIND THE REGISTER VALUES FOR THE DESIRED FREQUENCY */ + + for (index = 0; index < NUM_GX_DISPLAY_MODES; index++) { + if ((DisplayParams[index].hactive == (unsigned short)xres) && + (DisplayParams[index].vactive == (unsigned short)yres) && + (DisplayParams[index].flags & bpp_flag) && + (DisplayParams[index].flags & hz_flag)) { + *frequency = DisplayParams[index].frequency; + retval = 1; + } + } + return retval; +} + +/*--------------------------------------------------------------------------- + * gfx_get_max_supported_pixel_clock + * + * This routine returns the maximum recommended speed for the pixel clock. The + * return value is an integer of the format xxxyyy, where xxx.yyy is the maximum + * floating point pixel clock speed. + *--------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +unsigned long +gu1_get_max_supported_pixel_clock(void) +#else +unsigned long +gfx_get_max_supported_pixel_clock(void) +#endif +{ + /* ALL CHIPS CAN HANDLE 1280X1024@85HZ - 157.5 MHz */ + return 157500; +} + +/*---------------------------------------------------------------------------- + * gfx_get_display_mode + * + * This routine gets the specified display mode. + * + * Returns: >0 if successful and mode returned, <0 if mode could not be found. + *---------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +int +gu1_get_display_mode(int *xres, int *yres, int *bpp, int *hz) +#else +int +gfx_get_display_mode(int *xres, int *yres, int *bpp, int *hz) +#endif +{ + unsigned int mode = 0; + unsigned long pll_freq = 0, bpp_flag = 0; + + *xres = gfx_get_hactive(); + *yres = gfx_get_vactive(); + *bpp = gfx_get_display_bpp(); + pll_freq = gfx_get_clock_frequency(); + + /* SUPPORT EMULATED VGA MODES */ + if (gfx_pixel_double) + *xres >>= 1; + + if (gfx_line_double) + *yres >>= 1; + + /* SET BPP FLAGS TO LIMIT MODE SELECTION */ + bpp_flag = GFX_MODE_8BPP; + if (*bpp > 8) + bpp_flag = GFX_MODE_16BPP; + + for (mode = 0; mode < NUM_GX_DISPLAY_MODES; mode++) { + if ((DisplayParams[mode].hactive == (unsigned short)*xres) && + (DisplayParams[mode].vactive == (unsigned short)*yres) && + (DisplayParams[mode].frequency == pll_freq) && + (DisplayParams[mode].flags & bpp_flag)) { + + pll_freq = DisplayParams[mode].flags; + + if (pll_freq & GFX_MODE_56HZ) + *hz = 56; + else if (pll_freq & GFX_MODE_60HZ) + *hz = 60; + else if (pll_freq & GFX_MODE_70HZ) + *hz = 70; + else if (pll_freq & GFX_MODE_72HZ) + *hz = 72; + else if (pll_freq & GFX_MODE_75HZ) + *hz = 75; + else if (pll_freq & GFX_MODE_85HZ) + *hz = 85; + + return (1); + } + } + return (-1); +} + +/*--------------------------------------------------------------------------- + * gfx_get_hactive + *--------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +unsigned short +gu1_get_hactive(void) +#else +unsigned short +gfx_get_hactive(void) +#endif +{ + return ((unsigned short)((READ_REG32(DC_H_TIMING_1) & 0x07F8) + 8)); +} + +/*--------------------------------------------------------------------------- + * gfx_get_hsync_start + *--------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +unsigned short +gu1_get_hsync_start(void) +#else +unsigned short +gfx_get_hsync_start(void) +#endif +{ + return ((unsigned short)((READ_REG32(DC_H_TIMING_3) & 0x07F8) + 8)); +} + +/*--------------------------------------------------------------------------- + * gfx_get_hsync_end + *--------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +unsigned short +gu1_get_hsync_end(void) +#else +unsigned short +gfx_get_hsync_end(void) +#endif +{ + return ((unsigned short)(((READ_REG32(DC_H_TIMING_3) >> 16) & 0x07F8) + + 8)); +} + +/*--------------------------------------------------------------------------- + * gfx_get_htotal + *--------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +unsigned short +gu1_get_htotal(void) +#else +unsigned short +gfx_get_htotal(void) +#endif +{ + return ((unsigned short)(((READ_REG32(DC_H_TIMING_1) >> 16) & 0x07F8) + + 8)); +} + +/*--------------------------------------------------------------------------- + * gfx_get_vactive + *--------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +unsigned short +gu1_get_vactive(void) +#else +unsigned short +gfx_get_vactive(void) +#endif +{ + return ((unsigned short)((READ_REG32(DC_V_TIMING_1) & 0x07FF) + 1)); +} + +/*--------------------------------------------------------------------------- + * gfx_get_vsync_end + *--------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +unsigned short +gu1_get_vsync_end(void) +#else +unsigned short +gfx_get_vsync_end(void) +#endif +{ + return ((unsigned short)(((READ_REG32(DC_V_TIMING_3) >> 16) & 0x07FF) + + 1)); +} + +/*--------------------------------------------------------------------------- + * gfx_get_vtotal + *--------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +unsigned short +gu1_get_vtotal(void) +#else +unsigned short +gfx_get_vtotal(void) +#endif +{ + return ((unsigned short)(((READ_REG32(DC_V_TIMING_1) >> 16) & 0x07FF) + + 1)); +} + +/*----------------------------------------------------------------------------- + * gfx_get_display_bpp + * + * This routine returns the current color depth of the active display. + *----------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +unsigned short +gu1_get_display_bpp(void) +#else +unsigned short +gfx_get_display_bpp(void) +#endif +{ + switch (READ_REG32(DC_OUTPUT_CFG) & 3) { + case 0: + return (16); + case 2: + return (15); + } + return (8); +} + +/*--------------------------------------------------------------------------- + * gfx_get_vline + *--------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +unsigned short +gu1_get_vline(void) +#else +unsigned short +gfx_get_vline(void) +#endif +{ + unsigned short current_scan_line; + + /* Read similar value twice to ensure that the value is not transitioning */ + do { + current_scan_line = + (unsigned short)READ_REG32(DC_V_LINE_CNT) & 0x07FF; + } while (current_scan_line != + (unsigned short)(READ_REG32(DC_V_LINE_CNT) & 0x07FF)); + + return (current_scan_line); +} + +/*----------------------------------------------------------------------------- + * gfx_get_display_offset + *----------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +unsigned long +gu1_get_display_offset(void) +#else +unsigned long +gfx_get_display_offset(void) +#endif +{ + return (READ_REG32(DC_FB_ST_OFFSET) & 0x003FFFFF); +} + +/*----------------------------------------------------------------------------- + * gfx_get_cursor_offset + *----------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +unsigned long +gu1_get_cursor_offset(void) +#else +unsigned long +gfx_get_cursor_offset(void) +#endif +{ + return (READ_REG32(DC_CURS_ST_OFFSET) & 0x003FFFFF); +} + +#if GFX_READ_ROUTINES + +/*************************************************************/ +/* READ ROUTINES | INCLUDED FOR DIAGNOSTIC PURPOSES ONLY */ +/*************************************************************/ + +/*--------------------------------------------------------------------------- + * gfx_get_hblank_start + *--------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +unsigned short +gu1_get_hblank_start(void) +#else +unsigned short +gfx_get_hblank_start(void) +#endif +{ + return ((unsigned short)((READ_REG32(DC_H_TIMING_2) & 0x07F8) + 8)); +} + +/*--------------------------------------------------------------------------- + * gfx_get_hblank_end + *--------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +unsigned short +gu1_get_hblank_end(void) +#else +unsigned short +gfx_get_hblank_end(void) +#endif +{ + return ((unsigned short)(((READ_REG32(DC_H_TIMING_2) >> 16) & 0x07F8) + + 8)); +} + +/*--------------------------------------------------------------------------- + * gfx_get_vblank_start + *--------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +unsigned short +gu1_get_vblank_start(void) +#else +unsigned short +gfx_get_vblank_start(void) +#endif +{ + return ((unsigned short)((READ_REG32(DC_V_TIMING_2) & 0x07FF) + 1)); +} + +/*--------------------------------------------------------------------------- + * gfx_get_vsync_start + *--------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +unsigned short +gu1_get_vsync_start(void) +#else +unsigned short +gfx_get_vsync_start(void) +#endif +{ + return ((unsigned short)((READ_REG32(DC_V_TIMING_3) & 0x07FF) + 1)); +} + +/*--------------------------------------------------------------------------- + * gfx_get_vblank_end + *--------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +unsigned short +gu1_get_vblank_end(void) +#else +unsigned short +gfx_get_vblank_end(void) +#endif +{ + return ((unsigned short)(((READ_REG32(DC_V_TIMING_2) >> 16) & 0x07FF) + + 1)); +} + +/*----------------------------------------------------------------------------- + * gfx_get_display_palette_entry + *----------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +int +gu1_get_display_palette_entry(unsigned long index, unsigned long *palette) +#else +int +gfx_get_display_palette_entry(unsigned long index, unsigned long *palette) +#endif +{ + unsigned long data; + + if (index > 0xFF) + return GFX_STATUS_BAD_PARAMETER; + + WRITE_REG32(DC_PAL_ADDRESS, index); + data = READ_REG32(DC_PAL_DATA); + data = ((data << 2) & 0x000000FC) | + ((data << 4) & 0x0000FC00) | ((data << 6) & 0x00FC0000); + + *palette = data; + return 0; +} + +/*----------------------------------------------------------------------------- + * gfx_get_display_palette + *----------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +void +gu1_get_display_palette(unsigned long *palette) +#else +void +gfx_get_display_palette(unsigned long *palette) +#endif +{ + unsigned long i, data; + + WRITE_REG32(DC_PAL_ADDRESS, 0); + for (i = 0; i < 256; i++) { + data = READ_REG32(DC_PAL_DATA); + data = ((data << 2) & 0x000000FC) | + ((data << 4) & 0x0000FC00) | ((data << 6) & 0x00FC0000); + palette[i] = data; + } +} + +/*----------------------------------------------------------------------------- + * gfx_get_cursor_enable + *----------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +unsigned long +gu1_get_cursor_enable(void) +#else +unsigned long +gfx_get_cursor_enable(void) +#endif +{ + return (READ_REG32(DC_GENERAL_CFG) & DC_GCFG_CURE); +} + +/*----------------------------------------------------------------------------- + * gfx_get_cursor_position + *----------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +unsigned long +gu1_get_cursor_position(void) +#else +unsigned long +gfx_get_cursor_position(void) +#endif +{ + return ((READ_REG32(DC_CURSOR_X) & 0x07FF) | + ((READ_REG32(DC_CURSOR_Y) << 16) & 0x03FF0000)); +} + +/*----------------------------------------------------------------------------- + * gfx_get_cursor_clip + *----------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +unsigned long +gu1_get_cursor_clip(void) +#else +unsigned long +gfx_get_cursor_clip(void) +#endif +{ + return (((READ_REG32(DC_CURSOR_X) >> 11) & 0x01F) | + ((READ_REG32(DC_CURSOR_Y) << 5) & 0x1F0000)); +} + +/*----------------------------------------------------------------------------- + * gfx_get_cursor_color + *----------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +unsigned long +gu1_get_cursor_color(int color) +#else +unsigned long +gfx_get_cursor_color(int color) +#endif +{ + unsigned long data; + + if (color) { + WRITE_REG32(DC_PAL_ADDRESS, 0x101); + } else { + WRITE_REG32(DC_PAL_ADDRESS, 0x100); + } + data = READ_REG32(DC_PAL_DATA); + data = ((data << 6) & 0x00FC0000) | + ((data << 4) & 0x0000FC00) | ((data << 2) & 0x000000FC); + return (data); +} + +/*----------------------------------------------------------------------------- + * gfx_get_compression_enable + *----------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +int +gu1_get_compression_enable(void) +#else +int +gfx_get_compression_enable(void) +#endif +{ + unsigned long gcfg; + + gcfg = READ_REG32(DC_GENERAL_CFG); + if (gcfg & DC_GCFG_CMPE) + return (1); + else + return (0); +} + +/*----------------------------------------------------------------------------- + * gfx_get_compression_offset + *----------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +unsigned long +gu1_get_compression_offset(void) +#else +unsigned long +gfx_get_compression_offset(void) +#endif +{ + unsigned long offset; + + offset = READ_REG32(DC_CB_ST_OFFSET) & 0x003FFFFF; + return (offset); +} + +/*----------------------------------------------------------------------------- + * gfx_get_compression_pitch + *----------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +unsigned short +gu1_get_compression_pitch(void) +#else +unsigned short +gfx_get_compression_pitch(void) +#endif +{ + unsigned short pitch; + + pitch = (unsigned short)(READ_REG32(DC_LINE_DELTA) >> 12) & 0x03FF; + return (pitch << 2); +} + +/*----------------------------------------------------------------------------- + * gfx_get_compression_size + *----------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +unsigned short +gu1_get_compression_size(void) +#else +unsigned short +gfx_get_compression_size(void) +#endif +{ + unsigned short size; + + size = (unsigned short)((READ_REG32(DC_BUF_SIZE) >> 9) & 0x7F) - 1; + return ((size << 2) + 16); +} + +/*----------------------------------------------------------------------------- + * gfx_get_valid_bit + *----------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +int +gu1_get_valid_bit(int line) +#else +int +gfx_get_valid_bit(int line) +#endif +{ + int valid; + + WRITE_REG32(MC_DR_ADD, line); + valid = (int)READ_REG32(MC_DR_ACC) & 1; + return (valid); +} + +/*--------------------------------------------------------------------------- + * gfx_get_display_video_offset (PRIVATE ROUTINE - NOT PART OF API) + * + * This routine is called by "gfx_get_video_offset". It abstracts the + * version of the display controller from the video overlay routines. + *--------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +unsigned long +gu1_get_display_video_offset(void) +#else +unsigned long +gfx_get_display_video_offset(void) +#endif +{ + return (READ_REG32(DC_VID_ST_OFFSET) & 0x003FFFFF); +} + +/*--------------------------------------------------------------------------- + * gfx_get_display_video_size (PRIVATE ROUTINE - NOT PART OF API) + * + * This routine is called by "gfx_get_video_size". It abstracts the + * version of the display controller from the video overlay routines. + *--------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +unsigned long +gu1_get_display_video_size(void) +#else +unsigned long +gfx_get_display_video_size(void) +#endif +{ + /* RETURN TOTAL SIZE, IN BYTES */ + return ((READ_REG32(DC_BUF_SIZE) >> 10) & 0x000FFFC0); +} + +/*----------------------------------------------------------------------------- + * gfx_get_display_priority_high + *----------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +int +gu1_get_display_priority_high(void) +#else +int +gfx_get_display_priority_high(void) +#endif +{ + if (READ_REG32(MC_MEM_CNTRL1) & MC_XBUSARB) + return (1); + else + return (0); +} + +#endif /* GFX_READ_ROUTINES */ + +/* END OF FILE */ diff --git a/driver/xf86-video-geode/src/gfx/disp_gu2.c b/driver/xf86-video-geode/src/gfx/disp_gu2.c new file mode 100644 index 000000000..403a72ac3 --- /dev/null +++ b/driver/xf86-video-geode/src/gfx/disp_gu2.c @@ -0,0 +1,2788 @@ +/* Copyright (c) 2005 Advanced Micro Devices, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + * + * Neither the name of the Advanced Micro Devices, Inc. nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + */ + +/* + * This file contains routines for the second generation display controller. + * */ + +void gu2_enable_compression(void); /* private routine definition */ +void gu2_disable_compression(void); /* private routine definition */ +int gfx_set_display_control(int sync_polarities); /* private routine + * definition */ +void gfx_reset_video(void); +int gu2_set_specified_mode(DISPLAYMODE * pMode, int bpp); + + /*--------------------------------------------------------------------------- + * WARNING!!!! INACCURATE DELAY MECHANISM + * + * In an effort to keep the code self contained and operating system + * independent, the delay loop just performs reads of a display controller + * register. This time will vary for faster processors. The delay can always + * be longer than intended, only effecting the time of the mode switch + * (obviously want it to still be under a second). Problems with the hardware + * only arise if the delay is not long enough. + *---------------------------------------------------------------------------- + */ +#define RC_READS_PER_MILLISECOND 15000L + +#if GFX_DISPLAY_DYNAMIC +void +gu2_delay_milliseconds(unsigned long milliseconds) +#else +void +gfx_delay_milliseconds(unsigned long milliseconds) +#endif +{ + /* ASSUME 300 MHZ 20 CLOCKS PER READ */ + unsigned long loop; + + loop = milliseconds * RC_READS_PER_MILLISECOND; + while (loop-- > 0) { + READ_REG32(MDC_UNLOCK); + } +} + +#if GFX_DISPLAY_DYNAMIC +void +gu2_delay_microseconds(unsigned long microseconds) +#else +void +gfx_delay_microseconds(unsigned long microseconds) +#endif +{ + /* ASSUME 400 MHz, 2 CLOCKS PER INCREMENT */ + unsigned long loop_count = microseconds * 15; + + while (loop_count-- > 0) { + READ_REG32(MDC_UNLOCK); + } +} + +/*---------------------------------------------------------------------------- + * GFX_SET_DISPLAY_BPP + * + * This routine programs the bpp in the display controller. + *---------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +int +gu2_set_display_bpp(unsigned short bpp) +#else +int +gfx_set_display_bpp(unsigned short bpp) +#endif +{ + unsigned long dcfg, lock; + + dcfg = + READ_REG32(MDC_DISPLAY_CFG) & ~(MDC_DCFG_DISP_MODE_MASK | + MDC_DCFG_16BPP_MODE_MASK); + lock = READ_REG32(MDC_UNLOCK); + + switch (bpp) { + case 12: + dcfg |= (MDC_DCFG_DISP_MODE_16BPP | MDC_DCFG_12BPP); + break; + case 15: + dcfg |= (MDC_DCFG_DISP_MODE_16BPP | MDC_DCFG_15BPP); + break; + case 16: + dcfg |= (MDC_DCFG_DISP_MODE_16BPP | MDC_DCFG_16BPP); + break; + case 32: + dcfg |= (MDC_DCFG_DISP_MODE_24BPP); + break; + case 8: + dcfg |= (MDC_DCFG_DISP_MODE_8BPP); + break; + default: + return GFX_STATUS_BAD_PARAMETER; + } + + WRITE_REG32(MDC_UNLOCK, MDC_UNLOCK_VALUE); + WRITE_REG32(MDC_DISPLAY_CFG, dcfg); + WRITE_REG32(MDC_UNLOCK, lock); + + /* SET BPP IN GRAPHICS PIPELINE */ + gfx_set_bpp(bpp); + + return 0; +} + +/*---------------------------------------------------------------------------- + * gu2_set_specified_mode (private routine) + * This routine uses the parameters in the specified display mode structure + * to program the display controller hardware. + *---------------------------------------------------------------------------- + */ +int +gu2_set_specified_mode(DISPLAYMODE * pMode, int bpp) +{ + unsigned long unlock, value; + unsigned long gcfg, dcfg; + unsigned long size, pitch; + unsigned long vid_buf_size; + unsigned long bpp_mask, temp, dv_size; + + /* CHECK WHETHER TIMING CHANGE IS ALLOWED */ + /* Flag used for locking also overrides timing change restriction */ + if (gfx_timing_lock && !(pMode->flags & GFX_MODE_LOCK_TIMING)) + return GFX_STATUS_ERROR; + + /* CLEAR PANNING OFFSETS */ + DeltaX = 0; + DeltaY = 0; + panelLeft = 0; + panelTop = 0; + + /* SET GLOBAL FLAG */ + + if (pMode->flags & GFX_MODE_LOCK_TIMING) + gfx_timing_lock = 1; + + /* CHECK FOR VALID BPP */ + /* As this function can be called directly from */ + /* gfx_set_display_timings, we must correct any */ + /* invalid bpp settings. */ + switch (bpp) { + case 12: + bpp_mask = 0x00000900; + break; + case 15: + bpp_mask = 0x00000500; + break; + case 16: + bpp_mask = 0x00000100; + break; + case 32: + bpp_mask = 0x00000200; + break; + default: + bpp_mask = 0x00000000; + bpp = 8; + break; + } + + gbpp = bpp; + + /* DISABLE COMPRESSION */ + gu2_disable_compression(); + + /* ALSO DISABLE VIDEO */ + /* Use private "reset video" routine to do all that is needed. */ + /* SC1200, for example, also disables the alpha blending regions. */ + gfx_reset_video(); + + /* UNLOCK THE DISPLAY CONTROLLER REGISTERS */ + unlock = READ_REG32(MDC_UNLOCK); + WRITE_REG32(MDC_UNLOCK, MDC_UNLOCK_VALUE); + + /* READ THE CURRENT REGISTER VALUES */ + gcfg = READ_REG32(MDC_GENERAL_CFG); + dcfg = READ_REG32(MDC_DISPLAY_CFG); + + /* BLANK THE DISPLAY IN THE DISPLAY FILTER */ + gfx_set_crt_enable(0); + + /* DISABLE THE TIMING GENERATOR */ + dcfg &= ~(unsigned long)MDC_DCFG_TGEN; + WRITE_REG32(MDC_DISPLAY_CFG, dcfg); + + /* DELAY: WAIT FOR PENDING MEMORY REQUESTS */ + /* This delay is used to make sure that all pending requests to the */ + /* memory controller have completed before disabling the FIFO load. */ + gfx_delay_milliseconds(5); + + /* DISABLE DISPLAY FIFO LOAD */ + gcfg &= ~(unsigned long)MDC_GCFG_DFLE; + WRITE_REG32(MDC_GENERAL_CFG, gcfg); + + /* PRESERVE VIDEO INFORMATION */ + gcfg &= (unsigned long)(MDC_GCFG_YUVM | MDC_GCFG_VDSE); + dcfg = 0; + + /* SET THE DOT CLOCK FREQUENCY */ + /* Mask off the divide by two bit (bit 31) */ + if (!(pMode->flags & GFX_MODE_EXCLUDE_PLL)) + gfx_set_clock_frequency(pMode->frequency & 0x7FFFFFFF); + + /* DELAY: WAIT FOR THE PLL TO SETTLE */ + /* This allows the dot clock frequency that was just set to settle. */ + gfx_delay_milliseconds(10); + + /* SET THE GX DISPLAY CONTROLLER PARAMETERS */ + WRITE_REG32(MDC_FB_ST_OFFSET, 0); + WRITE_REG32(MDC_CB_ST_OFFSET, 0); + WRITE_REG32(MDC_CURS_ST_OFFSET, 0); + WRITE_REG32(MDC_ICON_ST_OFFSET, 0); + + /* SET LINE SIZE AND PITCH */ + /* 1. Flat Panels must use the mode width and not */ + /* the timing width to set the pitch. */ + /* 2. Mode sets will use a pitch that is aligned */ + /* on a 1K boundary to preserve legacy. The */ + /* pitch can be overridden by a subsequent call */ + /* to gfx_set_display_pitch. */ + if (PanelEnable) + size = ModeWidth; + else + size = pMode->hactive; + + if (bpp > 8) + size <<= 1; + + if (bpp > 16) + size <<= 1; + + pitch = 1024; + dv_size = MDC_DV_LINE_SIZE_1024; + + if (size > 1024) { + pitch = 2048; + dv_size = MDC_DV_LINE_SIZE_2048; + } + + if (size > 2048) { + pitch = 4096; + dv_size = MDC_DV_LINE_SIZE_4096; + } + + if (size > 4096) { + pitch = 8192; + dv_size = MDC_DV_LINE_SIZE_8192; + } + + WRITE_REG32(MDC_GFX_PITCH, pitch >> 3); + + /* WRITE DIRTY/VALID CONTROL WITH LINE LENGTH */ + temp = READ_REG32(MDC_DV_CTL); + WRITE_REG32(MDC_DV_CTL, (temp & ~MDC_DV_LINE_SIZE_MASK) | dv_size); + + if (PanelEnable) { + size = pMode->hactive; + if (bpp > 8) + size <<= 1; + if (bpp > 16) + size <<= 1; + } + + /* SAVE PREVIOUSLY STORED VIDEO LINE SIZE */ + vid_buf_size = READ_REG32(MDC_LINE_SIZE) & 0xFF000000; + + /* ADD 2 TO SIZE FOR POSSIBLE START ADDRESS ALIGNMENTS */ + WRITE_REG32(MDC_LINE_SIZE, ((size >> 3) + 2) | vid_buf_size); + + /* ALWAYS ENABLE VIDEO AND GRAPHICS DATA */ + /* These bits are relics from a previous design and */ + /* should always be enabled. */ + dcfg |= (unsigned long)(MDC_DCFG_VDEN | MDC_DCFG_GDEN); + + /* SET PIXEL FORMAT */ + dcfg |= bpp_mask; + + /* ENABLE TIMING GENERATOR, TIM. REG. UPDATES, PALETTE BYPASS */ + /* AND VERT. INT. SELECT */ + dcfg |= + (unsigned long)(MDC_DCFG_TGEN | MDC_DCFG_TRUP | MDC_DCFG_PALB | + MDC_DCFG_VISL); + + /* DISABLE ADDRESS MASKS */ + dcfg |= MDC_DCFG_A20M; + dcfg |= MDC_DCFG_A18M; + + /* SET FIFO PRIORITIES AND DISPLAY FIFO LOAD ENABLE */ + /* Set the priorities higher for high resolution modes. */ + if (pMode->hactive > 1024 || bpp == 32) + gcfg |= 0x000A901; + else + gcfg |= 0x0006501; + + /* ENABLE FLAT PANEL CENTERING */ + /* For panel modes having a resolution smaller than the */ + /* panel resolution, turn on data centering. */ + if (PanelEnable && ModeWidth < PanelWidth) + dcfg |= MDC_DCFG_DCEN; + + /* COMBINE AND SET TIMING VALUES */ + value = (unsigned long)(pMode->hactive - 1) | + (((unsigned long)(pMode->htotal - 1)) << 16); + WRITE_REG32(MDC_H_ACTIVE_TIMING, value); + value = (unsigned long)(pMode->hblankstart - 1) | + (((unsigned long)(pMode->hblankend - 1)) << 16); + WRITE_REG32(MDC_H_BLANK_TIMING, value); + value = (unsigned long)(pMode->hsyncstart - 1) | + (((unsigned long)(pMode->hsyncend - 1)) << 16); + WRITE_REG32(MDC_H_SYNC_TIMING, value); + value = (unsigned long)(pMode->vactive - 1) | + (((unsigned long)(pMode->vtotal - 1)) << 16); + WRITE_REG32(MDC_V_ACTIVE_TIMING, value); + value = (unsigned long)(pMode->vblankstart - 1) | + (((unsigned long)(pMode->vblankend - 1)) << 16); + WRITE_REG32(MDC_V_BLANK_TIMING, value); + value = (unsigned long)(pMode->vsyncstart - 1) | + (((unsigned long)(pMode->vsyncend - 1)) << 16); + WRITE_REG32(MDC_V_SYNC_TIMING, value); + + WRITE_REG32(MDC_DISPLAY_CFG, dcfg); + WRITE_REG32(MDC_GENERAL_CFG, gcfg); + + /* CONFIGURE DISPLAY OUTPUT FROM VIDEO PROCESSOR */ + gfx_set_display_control(((pMode->flags & GFX_MODE_NEG_HSYNC) ? 1 : 0) | + ((pMode->flags & GFX_MODE_NEG_VSYNC) ? 2 : 0)); + + /* RESTORE VALUE OF MDC_UNLOCK */ + WRITE_REG32(MDC_UNLOCK, unlock); + + /* RESET THE PITCH VALUES IN THE GP */ + gfx_reset_pitch((unsigned short)pitch); + + gfx_set_bpp((unsigned short)bpp); + + return GFX_STATUS_OK; +} + +/*---------------------------------------------------------------------------- + * GFX_IS_DISPLAY_MODE_SUPPORTED + * + * This routine sets the specified display mode. + * + * Returns 1 if successful, 0 if mode could not be set. + *---------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +int +gu2_is_display_mode_supported(int xres, int yres, int bpp, int hz) +#else +int +gfx_is_display_mode_supported(int xres, int yres, int bpp, int hz) +#endif +{ + unsigned int mode; + unsigned long hz_flag = 0, bpp_flag = 0; + + /* SET FLAGS TO MATCH REFRESH RATE */ + gfx_mode_hz_conversion + /* SET BPP FLAGS TO LIMIT MODE SELECTION */ + gfx_mode_bpp_conversion + /* LOOP THROUGH THE AVAILABLE MODES TO FIND A MATCH */ + for (mode = 0; mode < NUM_RC_DISPLAY_MODES; mode++) { + if ((DisplayParams[mode].hactive == (unsigned short)xres) && + (DisplayParams[mode].vactive == (unsigned short)yres) && + (DisplayParams[mode].flags & hz_flag) && + (DisplayParams[mode].flags & bpp_flag)) { + + /* REDCLOUD DOES NOT SUPPORT EMULATED VGA MODES */ + if ((DisplayParams[mode].flags & GFX_MODE_PIXEL_DOUBLE) || + (DisplayParams[mode].flags & GFX_MODE_LINE_DOUBLE)) + continue; + + /* SET THE DISPLAY CONTROLLER FOR THE SELECTED MODE */ + return (mode); + } + } + return (-1); +} + +/*---------------------------------------------------------------------------- + * gfx_set_display_mode + * + * This routine sets the specified display mode. + * + * Returns 1 if successful, 0 if mode could not be set. + *---------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +int +gu2_set_display_mode(int xres, int yres, int bpp, int hz) +#else +int +gfx_set_display_mode(int xres, int yres, int bpp, int hz) +#endif +{ + int mode; + + /* DISABLE FLAT PANEL */ + /* Flat Panel settings are enabled by the function gfx_set_fixed_timings + * and disabled by gfx_set_display_mode. + * */ + PanelEnable = 0; + + mode = gfx_is_display_mode_supported(xres, yres, bpp, hz); + if (mode >= 0) { + if (gu2_set_specified_mode(&DisplayParams[mode], + bpp) == GFX_STATUS_OK) + return (1); + } + return (0); +} + +/*---------------------------------------------------------------------------- + * GFX_SET_DISPLAY_TIMINGS + * + * This routine sets the display controller mode using the specified timing + * values (as opposed to using the tables internal to Durango). + * + * Returns GFX_STATUS_OK ON SUCCESS, GFX_STATUS_ERROR otherwise. + *---------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +int +gu2_set_display_timings(unsigned short bpp, unsigned short flags, + unsigned short hactive, unsigned short hblankstart, + unsigned short hsyncstart, unsigned short hsyncend, + unsigned short hblankend, unsigned short htotal, + unsigned short vactive, unsigned short vblankstart, + unsigned short vsyncstart, unsigned short vsyncend, + unsigned short vblankend, unsigned short vtotal, unsigned long frequency) +#else +int +gfx_set_display_timings(unsigned short bpp, unsigned short flags, + unsigned short hactive, unsigned short hblankstart, + unsigned short hsyncstart, unsigned short hsyncend, + unsigned short hblankend, unsigned short htotal, + unsigned short vactive, unsigned short vblankstart, + unsigned short vsyncstart, unsigned short vsyncend, + unsigned short vblankend, unsigned short vtotal, unsigned long frequency) +#endif +{ + /* SET MODE STRUCTURE WITH SPECIFIED VALUES */ + + gfx_display_mode.flags = 0; + if (flags & 1) + gfx_display_mode.flags |= GFX_MODE_NEG_HSYNC; + if (flags & 2) + gfx_display_mode.flags |= GFX_MODE_NEG_VSYNC; + if (flags & 4) + gfx_display_mode.flags |= GFX_MODE_EXCLUDE_PLL; + if (flags & 0x1000) + gfx_display_mode.flags |= GFX_MODE_LOCK_TIMING; + gfx_display_mode.hactive = hactive; + gfx_display_mode.hblankstart = hblankstart; + gfx_display_mode.hsyncstart = hsyncstart; + gfx_display_mode.hsyncend = hsyncend; + gfx_display_mode.hblankend = hblankend; + gfx_display_mode.htotal = htotal; + gfx_display_mode.vactive = vactive; + gfx_display_mode.vblankstart = vblankstart; + gfx_display_mode.vsyncstart = vsyncstart; + gfx_display_mode.vsyncend = vsyncend; + gfx_display_mode.vblankend = vblankend; + gfx_display_mode.vtotal = vtotal; + gfx_display_mode.frequency = frequency; + + /* CALL ROUTINE TO SET MODE */ + return (gu2_set_specified_mode(&gfx_display_mode, bpp)); +} + +/*---------------------------------------------------------------------------- + * GFX_SET_VTOTAL + * + * This routine sets the display controller vertical total to + * "vtotal". As a side effect it also sets vertical blank end. + * It should be used when only this value needs to be changed, + * due to speed considerations. + * + * Note: it is the caller's responsibility to make sure that + * a legal vtotal is used, i.e. that "vtotal" is greater than or + * equal to vsync end. + * + * Always returns 0. + *---------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +int +gu2_set_vtotal(unsigned short vtotal) +#else +int +gfx_set_vtotal(unsigned short vtotal) +#endif +{ + unsigned long unlock, dcfg, vactive, vblank; + + /* UNLOCK THE DISPLAY CONTROLLER REGISTERS */ + unlock = READ_REG32(MDC_UNLOCK); + WRITE_REG32(MDC_UNLOCK, MDC_UNLOCK_VALUE); + + /* READ THE CURRENT RC VALUES */ + dcfg = READ_REG32(MDC_DISPLAY_CFG); + vactive = READ_REG32(MDC_V_ACTIVE_TIMING); + vblank = READ_REG32(MDC_V_BLANK_TIMING); + + /* DISABLE TIMING REGISTER UPDATES */ + WRITE_REG32(MDC_DISPLAY_CFG, dcfg & ~(unsigned long)MDC_DCFG_TRUP); + + /* WRITE NEW TIMING VALUES */ + WRITE_REG32(MDC_V_ACTIVE_TIMING, + (vactive & MDC_VAT_VA_MASK) | (unsigned long)(vtotal - 1) << 16); + WRITE_REG32(MDC_V_BLANK_TIMING, + (vblank & MDC_VBT_VBS_MASK) | (unsigned long)(vtotal - 1) << 16); + + /* RESTORE OLD RC VALUES */ + WRITE_REG32(MDC_DISPLAY_CFG, dcfg); + WRITE_REG32(MDC_UNLOCK, unlock); + + return (0); +} + +/*--------------------------------------------------------------------------- + * gfx_set_display_pitch + * + * This routine sets the pitch of the frame buffer to the specified value. + *--------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +void +gu2_set_display_pitch(unsigned short pitch) +#else +void +gfx_set_display_pitch(unsigned short pitch) +#endif +{ + unsigned long value = 0; + unsigned long lock = READ_REG32(MDC_UNLOCK); + + value = READ_REG32(MDC_GFX_PITCH) & 0xFFFF0000; + value |= (pitch >> 3); + WRITE_REG32(MDC_UNLOCK, MDC_UNLOCK_VALUE); + WRITE_REG32(MDC_GFX_PITCH, value); + + /* SET RENDERING PITCHES TO MATCH */ + gfx_reset_pitch(pitch); + + /* SET THE FRAME DIRTY MODE */ + /* Non-standard pitches, i.e. pitches that */ + /* are not 1K, 2K or 4K must mark the entire */ + /* frame as dirty when writing to the frame */ + /* buffer. */ + value = READ_REG32(MDC_GENERAL_CFG); + + if (pitch == 1024 || pitch == 2048 || pitch == 4096 || pitch == 8192) + value &= ~(unsigned long)(MDC_GCFG_FDTY); + else + value |= (unsigned long)(MDC_GCFG_FDTY); + + WRITE_REG32(MDC_GENERAL_CFG, value); + WRITE_REG32(MDC_UNLOCK, lock); +} + +/*--------------------------------------------------------------------------- + * gfx_set_display_offset + * + * This routine sets the start address of the frame buffer. It is + * typically used to pan across a virtual desktop (frame buffer larger than + * the displayed screen) or to flip the display between multiple buffers. + *--------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +void +gu2_set_display_offset(unsigned long offset) +#else +void +gfx_set_display_offset(unsigned long offset) +#endif +{ + /* UPDATE FRAME BUFFER OFFSET */ + unsigned long lock; + + lock = READ_REG32(MDC_UNLOCK); + WRITE_REG32(MDC_UNLOCK, MDC_UNLOCK_VALUE); + + /* START ADDRESS EFFECTS DISPLAY COMPRESSION */ + /* Disable compression for non-zero start addresss values. */ + /* Enable compression if offset is zero and comression is intended to */ + /* be enabled from a previous call to "gfx_set_compression_enable". */ + /* Compression should be disabled BEFORE the offset is changed */ + /* and enabled AFTER the offset is changed. */ + if (offset == 0) { + WRITE_REG32(MDC_FB_ST_OFFSET, offset); + if (gfx_compression_enabled) { + /* WAIT FOR THE OFFSET TO BE LATCHED */ + gfx_wait_vertical_blank(); + gu2_enable_compression(); + } + } else { + /* ONLY DISABLE COMPRESSION ONCE */ + if (gfx_compression_active) + gu2_disable_compression(); + + WRITE_REG32(MDC_FB_ST_OFFSET, offset); + } + + WRITE_REG32(MDC_UNLOCK, lock); +} + +/*--------------------------------------------------------------------------- + * gfx_set_display_palette_entry + * + * This routine sets an palette entry in the display controller. + * A 32-bit X:R:G:B value. + *--------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +int +gu2_set_display_palette_entry(unsigned long index, unsigned long palette) +#else +int +gfx_set_display_palette_entry(unsigned long index, unsigned long palette) +#endif +{ + unsigned long dcfg, unlock; + + if (index > 0xFF) + return GFX_STATUS_BAD_PARAMETER; + + unlock = READ_REG32(MDC_UNLOCK); + dcfg = READ_REG32(MDC_DISPLAY_CFG); + + WRITE_REG32(MDC_UNLOCK, MDC_UNLOCK_VALUE); + WRITE_REG32(MDC_DISPLAY_CFG, dcfg & ~MDC_DCFG_PALB); + WRITE_REG32(MDC_UNLOCK, unlock); + + WRITE_REG32(MDC_PAL_ADDRESS, index); + WRITE_REG32(MDC_PAL_DATA, palette); + + return GFX_STATUS_OK; +} + +/*--------------------------------------------------------------------------- + * gfx_set_display_palette + * + * This routine sets the entire palette in the display controller. + * A pointer is provided to a 256 entry table of 32-bit X:R:G:B values. + *--------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +int +gu2_set_display_palette(unsigned long *palette) +#else +int +gfx_set_display_palette(unsigned long *palette) +#endif +{ + unsigned long unlock, dcfg, i; + + WRITE_REG32(MDC_PAL_ADDRESS, 0); + + if (palette) { + unlock = READ_REG32(MDC_UNLOCK); + dcfg = READ_REG32(MDC_DISPLAY_CFG); + + WRITE_REG32(MDC_UNLOCK, MDC_UNLOCK_VALUE); + WRITE_REG32(MDC_DISPLAY_CFG, dcfg & ~MDC_DCFG_PALB); + WRITE_REG32(MDC_UNLOCK, unlock); + + for (i = 0; i < 256; i++) + WRITE_REG32(MDC_PAL_DATA, palette[i]); + + return GFX_STATUS_OK; + } + return GFX_STATUS_BAD_PARAMETER; +} + +/*--------------------------------------------------------------------------- + * gfx_set_cursor_enable + * + * This routine enables or disables the hardware cursor. + * + * WARNING: The cursor start offset must be set by setting the cursor + * position before calling this routine to assure that memory reads do not + * go past the end of graphics memory (this can hang GXm). + *--------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +void +gu2_set_cursor_enable(int enable) +#else +void +gfx_set_cursor_enable(int enable) +#endif +{ + unsigned long unlock, gcfg; + + /* SET OR CLEAR CURSOR ENABLE BIT */ + unlock = READ_REG32(MDC_UNLOCK); + gcfg = READ_REG32(MDC_GENERAL_CFG); + if (enable) + gcfg |= MDC_GCFG_CURE; + else + gcfg &= ~(MDC_GCFG_CURE); + + /* WRITE NEW REGISTER VALUE */ + WRITE_REG32(MDC_UNLOCK, MDC_UNLOCK_VALUE); + WRITE_REG32(MDC_GENERAL_CFG, gcfg); + WRITE_REG32(MDC_UNLOCK, unlock); +} + +/*--------------------------------------------------------------------------- + * gfx_set_cursor_colors + * + * This routine sets the colors of the hardware cursor. + *--------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +void +gu2_set_cursor_colors(unsigned long bkcolor, unsigned long fgcolor) +#else +void +gfx_set_cursor_colors(unsigned long bkcolor, unsigned long fgcolor) +#endif +{ + /* SET CURSOR COLORS */ + WRITE_REG32(MDC_PAL_ADDRESS, 0x100); + WRITE_REG32(MDC_PAL_DATA, bkcolor); + WRITE_REG32(MDC_PAL_DATA, fgcolor); +} + +/*--------------------------------------------------------------------------- + * gfx_set_cursor_position + * + * This routine sets the position of the hardware cusror. The starting + * offset of the cursor buffer must be specified so that the routine can + * properly clip scanlines if the cursor is off the top of the screen. + *--------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +void +gu2_set_cursor_position(unsigned long memoffset, + unsigned short xpos, unsigned short ypos, + unsigned short xhotspot, unsigned short yhotspot) +#else +void +gfx_set_cursor_position(unsigned long memoffset, + unsigned short xpos, unsigned short ypos, + unsigned short xhotspot, unsigned short yhotspot) +#endif +{ + unsigned long unlock; + + short x = (short)xpos - (short)xhotspot; + short y = (short)ypos - (short)yhotspot; + short xoffset = 0; + short yoffset = 0; + + if (x < -63) + return; + if (y < -63) + return; + + if (PanelEnable) { + if ((ModeWidth > PanelWidth) || (ModeHeight > PanelHeight)) { + gfx_enable_panning(xpos, ypos); + x = x - (unsigned short)panelLeft; + y = y - (unsigned short)panelTop; + } + } + + /* ADJUST OFFSETS */ + /* Cursor movement and panning work as follows: The cursor position */ + /* refers to where the hotspot of the cursor is located. However, for */ + /* non-zero hotspots, the cursor buffer actually begins before the */ + /* specified position. */ + if (x < 0) { + xoffset = -x; + x = 0; + } + + if (y < 0) { + yoffset = -y; + y = 0; + } + memoffset += (unsigned long)yoffset << 4; + + /* SET CURSOR POSITION */ + unlock = READ_REG32(MDC_UNLOCK); + WRITE_REG32(MDC_UNLOCK, MDC_UNLOCK_VALUE); + WRITE_REG32(MDC_CURS_ST_OFFSET, memoffset); + WRITE_REG32(MDC_CURSOR_X, (unsigned long)x | + (((unsigned long)xoffset) << 11)); + WRITE_REG32(MDC_CURSOR_Y, (unsigned long)y | + (((unsigned long)yoffset) << 11)); + WRITE_REG32(MDC_UNLOCK, unlock); +} + +/*--------------------------------------------------------------------------- + * gfx_set_cursor_shape32 + * + * This routine loads 32x32 cursor data into the cursor buffer in graphics + * memory. + * As the Redcloud cursor is actually 64x64, we must pad the outside of the + * cursor data with transparent pixels. + *--------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +void +gu2_set_cursor_shape32(unsigned long memoffset, + unsigned long *andmask, unsigned long *xormask) +#else +void +gfx_set_cursor_shape32(unsigned long memoffset, + unsigned long *andmask, unsigned long *xormask) +#endif +{ + int i; + + for (i = 0; i < 32; i++) { + /* EVEN QWORDS CONTAIN THE AND MASK */ + WRITE_FB32(memoffset, 0xFFFFFFFF); + WRITE_FB32(memoffset + 4, andmask[i]); + + /* ODD QWORDS CONTAIN THE XOR MASK */ + WRITE_FB32(memoffset + 8, 0x00000000); + WRITE_FB32(memoffset + 12, xormask[i]); + + memoffset += 16; + } + + /* FILL THE LOWER HALF OF THE BUFFER WITH TRANSPARENT PIXELS */ + for (i = 0; i < 32; i++) { + WRITE_FB32(memoffset, 0xFFFFFFFF); + WRITE_FB32(memoffset + 4, 0xFFFFFFFF); + WRITE_FB32(memoffset + 8, 0x00000000); + WRITE_FB32(memoffset + 12, 0x00000000); + + memoffset += 16; + } +} + +/*--------------------------------------------------------------------------- + * gfx_set_cursor_shape64 + * + * This routine loads 64x64 cursor data into the cursor buffer in graphics + * memory. + *--------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +void +gu2_set_cursor_shape64(unsigned long memoffset, + unsigned long *andmask, unsigned long *xormask) +#else +void +gfx_set_cursor_shape64(unsigned long memoffset, + unsigned long *andmask, unsigned long *xormask) +#endif +{ + int i; + + for (i = 0; i < 128; i += 2) { + /* EVEN QWORDS CONTAIN THE AND MASK */ + /* We invert the dwords to prevent the calling */ + /* application from having to think in terms of Qwords. */ + /* The hardware data order is actually 63:0, or 31:0 of */ + /* the second dword followed by 31:0 of the first dword. */ + WRITE_FB32(memoffset, andmask[i + 1]); + WRITE_FB32(memoffset + 4, andmask[i]); + + /* ODD QWORDS CONTAIN THE XOR MASK */ + WRITE_FB32(memoffset + 8, xormask[i + 1]); + WRITE_FB32(memoffset + 12, xormask[i]); + + memoffset += 16; + } +} + +/*--------------------------------------------------------------------------- + * gfx_set_icon_enable + * + * This routine enables or disables the hardware icon. The icon position + * and colors should be programmed prior to calling this routine for the + * first time. + *--------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +void +gu2_set_icon_enable(int enable) +#else +void +gfx_set_icon_enable(int enable) +#endif +{ + unsigned long unlock, gcfg; + + /* SET OR CLEAR ICON ENABLE BIT */ + unlock = READ_REG32(MDC_UNLOCK); + gcfg = READ_REG32(MDC_GENERAL_CFG); + if (enable) + gcfg |= MDC_GCFG_ICNE; + else + gcfg &= ~(MDC_GCFG_ICNE); + + /* WRITE NEW REGISTER VALUE */ + WRITE_REG32(MDC_UNLOCK, MDC_UNLOCK_VALUE); + WRITE_REG32(MDC_GENERAL_CFG, gcfg); + WRITE_REG32(MDC_UNLOCK, unlock); +} + +/*--------------------------------------------------------------------------- + * gfx_set_icon_colors + * + * This routine sets the three icon colors. + *--------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +void +gu2_set_icon_colors(unsigned long color0, unsigned long color1, + unsigned long color2) +#else +void +gfx_set_icon_colors(unsigned long color0, unsigned long color1, + unsigned long color2) +#endif +{ + /* ICON COLORS LOCATED AT PALETTE INDEXES 102-104h */ + WRITE_REG32(MDC_PAL_ADDRESS, 0x102); + + WRITE_REG32(MDC_PAL_DATA, color0); + WRITE_REG32(MDC_PAL_DATA, color1); + WRITE_REG32(MDC_PAL_DATA, color2); +} + +/*--------------------------------------------------------------------------- + * gfx_set_icon_position + * + * This routine sets the starting X coordinate for the hardware icon and the + * memory offset for the icon buffer. + *--------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +void +gu2_set_icon_position(unsigned long memoffset, unsigned short xpos) +#else +void +gfx_set_icon_position(unsigned long memoffset, unsigned short xpos) +#endif +{ + unsigned long lock = READ_REG32(MDC_UNLOCK); + + WRITE_REG32(MDC_UNLOCK, MDC_UNLOCK_VALUE); + + /* PROGRAM THE MEMORY OFFSET */ + WRITE_REG32(MDC_ICON_ST_OFFSET, memoffset & 0x0FFFFFFF); + + /* PROGRAM THE XCOORDINATE */ + WRITE_REG32(MDC_ICON_X, (unsigned long)(xpos & 0x07FF)); + + WRITE_REG32(MDC_UNLOCK, lock); +} + +/*--------------------------------------------------------------------------- + * gfx_set_icon_shape64 + * + * This routine initializes the icon buffer according to the current mode. + *--------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +void +gu2_set_icon_shape64(unsigned long memoffset, unsigned long *andmask, + unsigned long *xormask, unsigned int lines) +#else +void +gfx_set_icon_shape64(unsigned long memoffset, unsigned long *andmask, + unsigned long *xormask, unsigned int lines) +#endif +{ + unsigned short i, height; + + height = lines << 1; + + for (i = 0; i < height; i += 2) { + /* EVEN QWORDS CONTAIN THE AND MASK */ + /* Swap dwords to hide qword constraint */ + WRITE_FB32(memoffset, andmask[i + 1]); + WRITE_FB32(memoffset + 4, andmask[i]); + + /* ODD QWORDS CONTAIN THE XOR MASK */ + WRITE_FB32(memoffset + 8, xormask[i + 1]); + WRITE_FB32(memoffset + 12, xormask[i]); + + memoffset += 16; + } +} + +/*--------------------------------------------------------------------------- + * gu2_enable_compression + * + * This is a private routine to this module (not exposed in the Durango API). + * It enables display compression. + *--------------------------------------------------------------------------- + */ +void +gu2_enable_compression(void) +{ + unsigned long unlock, gcfg, temp; + + /* DO NOT ENABLE IF START ADDRESS IS NOT ZERO */ + if (READ_REG32(MDC_FB_ST_OFFSET) & 0x0FFFFFFF) + return; + + /* SET GLOBAL INDICATOR */ + gfx_compression_active = 1; + + /* CLEAR DIRTY/VALID BITS IN MEMORY CONTROLLER */ + /* Software is required to do this before enabling compression. */ + /* Don't want controller to think that old lines are still valid. */ + /* Writing a 1 to bit 0 of the DV Control register will force the */ + /* hardware to clear all the valid bits. */ + temp = READ_REG32(MDC_DV_CTL); + WRITE_REG32(MDC_DV_CTL, temp | 0x00000001); + + /* TURN ON COMPRESSION CONTROL BITS */ + unlock = READ_REG32(MDC_UNLOCK); + gcfg = READ_REG32(MDC_GENERAL_CFG); + gcfg |= MDC_GCFG_CMPE | MDC_GCFG_DECE; + WRITE_REG32(MDC_UNLOCK, MDC_UNLOCK_VALUE); + WRITE_REG32(MDC_GENERAL_CFG, gcfg); + WRITE_REG32(MDC_UNLOCK, unlock); +} + +/*--------------------------------------------------------------------------- + * gu2_disable_compression + * + * This is a private routine to this module (not exposed in the Durango API). + * It disables display compression. + *--------------------------------------------------------------------------- + */ +void +gu2_disable_compression(void) +{ + unsigned long unlock, gcfg; + + /* SET GLOBAL INDICATOR */ + + gfx_compression_active = 0; + + /* TURN OFF COMPRESSION CONTROL BITS */ + + unlock = READ_REG32(MDC_UNLOCK); + gcfg = READ_REG32(MDC_GENERAL_CFG); + gcfg &= ~(MDC_GCFG_CMPE | MDC_GCFG_DECE); + WRITE_REG32(MDC_UNLOCK, MDC_UNLOCK_VALUE); + WRITE_REG32(MDC_GENERAL_CFG, gcfg); + WRITE_REG32(MDC_UNLOCK, unlock); +} + +/*--------------------------------------------------------------------------- + * gfx_set_compression_enable + * + * This routine enables or disables display compression. + *--------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +int +gu2_set_compression_enable(int enable) +#else +int +gfx_set_compression_enable(int enable) +#endif +{ + /* SET GLOBAL VARIABLE FOR INDENDED STATE */ + /* Compression can only be enabled for non-zero start address values. */ + /* Keep state to enable compression on start address changes. */ + + gfx_compression_enabled = enable; + if (enable) + gu2_enable_compression(); + else + gu2_disable_compression(); + return (0); +} + +/*--------------------------------------------------------------------------- + * gfx_set_compression_offset + * + * This routine sets the base offset for the compression buffer. + *--------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +int +gu2_set_compression_offset(unsigned long offset) +#else +int +gfx_set_compression_offset(unsigned long offset) +#endif +{ + unsigned long lock; + + /* MUST BE 16-BYTE ALIGNED FOR REDCLOUD */ + + if (offset & 0x0F) + return (1); + + /* SET REGISTER VALUE */ + + lock = READ_REG32(MDC_UNLOCK); + WRITE_REG32(MDC_UNLOCK, MDC_UNLOCK_VALUE); + WRITE_REG32(MDC_CB_ST_OFFSET, offset & 0x0FFFFFFF); + WRITE_REG32(MDC_UNLOCK, lock); + + return (0); +} + +/*--------------------------------------------------------------------------- + * gfx_set_compression_pitch + * + * This routine sets the pitch, in bytes, of the compression buffer. + *--------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +int +gu2_set_compression_pitch(unsigned short pitch) +#else +int +gfx_set_compression_pitch(unsigned short pitch) +#endif +{ + unsigned long lock, line_delta; + + lock = READ_REG32(MDC_UNLOCK); + + /* SET REGISTER VALUE */ + + line_delta = READ_REG32(MDC_GFX_PITCH) & 0x0000FFFF; + line_delta |= (((unsigned long)pitch << 13) & 0xFFFF0000); + WRITE_REG32(MDC_UNLOCK, MDC_UNLOCK_VALUE); + WRITE_REG32(MDC_GFX_PITCH, line_delta); + WRITE_REG32(MDC_UNLOCK, lock); + return (0); +} + +/*--------------------------------------------------------------------------- + * gfx_set_compression_size + * + * This routine sets the line size of the compression buffer, which is the + * maximum number of bytes allowed to store a compressed line. + *--------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +int +gu2_set_compression_size(unsigned short size) +#else +int +gfx_set_compression_size(unsigned short size) +#endif +{ + unsigned long lock, buf_size; + + /* SUBTRACT 32 FROM SIZE */ + /* The display controller will actually write */ + /* 4 extra QWords. So, if we assume that "size" */ + /* refers to the allocated size, we must subtract */ + /* 32 bytes. */ + + size -= 32; + + /* SET REGISTER VALUE */ + + lock = READ_REG32(MDC_UNLOCK); + buf_size = READ_REG32(MDC_LINE_SIZE) & 0xFF80FFFF; + buf_size |= ((((unsigned long)size >> 3) + 1) & 0x7F) << 16; + WRITE_REG32(MDC_UNLOCK, MDC_UNLOCK_VALUE); + WRITE_REG32(MDC_LINE_SIZE, buf_size); + WRITE_REG32(MDC_UNLOCK, lock); + return (0); +} + +/*--------------------------------------------------------------------------- + * gfx_set_display_video_format (PRIVATE ROUTINE - NOT PART OF API) + * + * This routine is called by "gfx_set_video_format". It abstracts the + * version of the display controller from the video overlay routines. + *--------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +void +gu2_set_display_video_format(unsigned long format) +#else +void +gfx_set_display_video_format(unsigned long format) +#endif +{ + unsigned long gcfg, lock; + + lock = READ_REG32(MDC_UNLOCK); + gcfg = READ_REG32(MDC_GENERAL_CFG); + + switch (format) { + case VIDEO_FORMAT_Y0Y1Y2Y3: + case VIDEO_FORMAT_Y3Y2Y1Y0: + case VIDEO_FORMAT_Y1Y0Y3Y2: + case VIDEO_FORMAT_Y1Y2Y3Y0: + gcfg |= MDC_GCFG_YUVM; + break; + + default: + gcfg &= ~MDC_GCFG_YUVM; + break; + } + + WRITE_REG32(MDC_UNLOCK, MDC_UNLOCK_VALUE); + WRITE_REG32(MDC_GENERAL_CFG, gcfg); + WRITE_REG32(MDC_UNLOCK, lock); +} + +/*--------------------------------------------------------------------------- + * gfx_set_display_video_enable (PRIVATE ROUTINE - NOT PART OF API) + * + * This routine is called by "gfx_set_video_enable". It abstracts the + * version of the display controller from the video overlay routines. + *--------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +void +gu2_set_display_video_enable(int enable) +#else +void +gfx_set_display_video_enable(int enable) +#endif +{ + unsigned long lock, gcfg, dcfg; + + /* READ CURRENT VALUES */ + + lock = READ_REG32(MDC_UNLOCK); + gcfg = READ_REG32(MDC_GENERAL_CFG); + dcfg = READ_REG32(MDC_DISPLAY_CFG); + + /* SET OR CLEAR VIDEO ENABLE IN GENERAL_CFG */ + + if (enable) + gcfg |= MDC_GCFG_VIDE; + else + gcfg &= ~MDC_GCFG_VIDE; + + /* WRITE REGISTER */ + + WRITE_REG32(MDC_UNLOCK, MDC_UNLOCK_VALUE); + WRITE_REG32(MDC_GENERAL_CFG, gcfg); + WRITE_REG32(MDC_UNLOCK, lock); +} + +/*--------------------------------------------------------------------------- + * gfx_set_display_video_size (PRIVATE ROUTINE - NOT PART OF API) + * + * This routine is called by "gfx_set_video_size". It abstracts the + * version of the display controller from the video overlay routines. + *--------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +void +gu2_set_display_video_size(unsigned short width, unsigned short height) +#else +void +gfx_set_display_video_size(unsigned short width, unsigned short height) +#endif +{ + unsigned long lock, value, yuv_420; + + /* READ CURRENT VALUES */ + + lock = READ_REG32(MDC_UNLOCK); + value = READ_REG32(MDC_LINE_SIZE) & 0x00FFFFFF; + yuv_420 = READ_REG32(MDC_GENERAL_CFG) & MDC_GCFG_YUVM; + + /* LINE WIDTH IS 1/4 FOR 4:2:0 VIDEO */ + /* All data must be 32-byte aligned. */ + + if (yuv_420) { + width >>= 1; + width = (width + 7) & 0xFFF8; + } else { + width <<= 1; + width = (width + 31) & 0xFFE0; + } + + /* ONLY THE LINE SIZE IS PROGRAMMED IN THE DISPLAY CONTROLLER */ + + value |= ((unsigned long)width << 21); + + /* WRITE THE REGISTER */ + + WRITE_REG32(MDC_UNLOCK, MDC_UNLOCK_VALUE); + WRITE_REG32(MDC_LINE_SIZE, value); + WRITE_REG32(MDC_UNLOCK, lock); +} + +/*--------------------------------------------------------------------------- + * gfx_set_display_video_offset (PRIVATE ROUTINE - NOT PART OF API) + * + * This routine is called by "gfx_set_video_offset". It abstracts the + * version of the display controller from the video overlay routines. + *--------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +void +gu2_set_display_video_offset(unsigned long offset) +#else +void +gfx_set_display_video_offset(unsigned long offset) +#endif +{ + unsigned long lock; + + lock = READ_REG32(MDC_UNLOCK); + WRITE_REG32(MDC_UNLOCK, MDC_UNLOCK_VALUE); + offset &= 0x0FFFFFF0; + WRITE_REG32(MDC_VID_Y_ST_OFFSET, offset); + WRITE_REG32(MDC_UNLOCK, lock); +} + +/*--------------------------------------------------------------------------- + * gfx_set_display_video_yuv_offsets (PRIVATE ROUTINE - NOT PART OF API) + * + * This routine is called by gfx_set_video_yuv_offsets. It abstracts the + * version of the display controller from the video overlay routines. + *--------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +void +gu2_set_display_video_yuv_offsets(unsigned long yoffset, + unsigned long uoffset, unsigned long voffset) +#else +void +gfx_set_display_video_yuv_offsets(unsigned long yoffset, + unsigned long uoffset, unsigned long voffset) +#endif +{ + unsigned long lock; + + lock = READ_REG32(MDC_UNLOCK); + + yoffset &= 0x0FFFFFF0; + uoffset &= 0x0FFFFFF8; + voffset &= 0x0FFFFFF8; + + WRITE_REG32(MDC_UNLOCK, MDC_UNLOCK_VALUE); + WRITE_REG32(MDC_VID_Y_ST_OFFSET, yoffset); + WRITE_REG32(MDC_VID_U_ST_OFFSET, uoffset); + WRITE_REG32(MDC_VID_V_ST_OFFSET, voffset); + WRITE_REG32(MDC_UNLOCK, lock); +} + +/*--------------------------------------------------------------------------- + * gfx_set_display_video_yuv_pitch (PRIVATE ROUTINE - NOT PART OF API) + * + * This routine is called by gfx_set_video_yuv_pitch. It abstracts the + * version of the display controller from the video overlay routines. + *--------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +void +gu2_set_display_video_yuv_pitch(unsigned long ypitch, unsigned long uvpitch) +#else +void +gfx_set_display_video_yuv_pitch(unsigned long ypitch, unsigned long uvpitch) +#endif +{ + unsigned long lock, pitch; + + lock = READ_REG32(MDC_UNLOCK); + + pitch = ((uvpitch << 13) & 0xFFFF0000) | ((ypitch >> 3) & 0xFFFF); + + WRITE_REG32(MDC_UNLOCK, MDC_UNLOCK_VALUE); + WRITE_REG32(MDC_VID_YUV_PITCH, pitch); + WRITE_REG32(MDC_UNLOCK, lock); +} + +/*--------------------------------------------------------------------------- + * gfx_set_display_video_downscale (PRIVATE ROUTINE - NOT PART OF API) + * + * This routine is called by gfx_set_video_vertical_downscale. It abstracts + * the version of the display controller from the video overlay routines. + *--------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +void +gu2_set_display_video_downscale(unsigned short srch, unsigned short dsth) +#else +void +gfx_set_display_video_downscale(unsigned short srch, unsigned short dsth) +#endif +{ + unsigned long lock, delta; + + lock = READ_REG32(MDC_UNLOCK); + + /* CLIP SCALING LIMITS */ + /* Upscaling is performed in a separate function. */ + /* Maximum scale ratio is 1/2. */ + + if (dsth > srch || dsth <= (srch >> 1)) + delta = 0; + else + delta = (((unsigned long)srch << 14) / (unsigned long)dsth) << 18; + + WRITE_REG32(MDC_UNLOCK, MDC_UNLOCK_VALUE); + WRITE_REG32(MDC_VID_DS_DELTA, delta); + WRITE_REG32(MDC_UNLOCK, lock); +} + +/*--------------------------------------------------------------------------- + * gfx_set_display_video_downscale_enable (PRIVATE ROUTINE - NOT PART OF API) + * + * This routine is called by "gfx_set_video_vertical_downscale_enable". + * It abstracts the version of the display controller from the video overlay + * routines. + *--------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +void +gu2_set_display_video_vertical_downscale_enable(int enable) +#else +void +gfx_set_display_video_vertical_downscale_enable(int enable) +#endif +{ + unsigned long gcfg, unlock; + + unlock = READ_REG32(MDC_UNLOCK); + gcfg = READ_REG32(MDC_GENERAL_CFG); + + if (enable) + gcfg |= MDC_GCFG_VDSE; + else + gcfg &= ~MDC_GCFG_VDSE; + + WRITE_REG32(MDC_UNLOCK, MDC_UNLOCK_VALUE); + WRITE_REG32(MDC_GENERAL_CFG, gcfg); + WRITE_REG32(MDC_UNLOCK, unlock); +} + +/*--------------------------------------------------------------------------- + * gfx_test_timing_active + *--------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +int +gu2_test_timing_active(void) +#else +int +gfx_test_timing_active(void) +#endif +{ + if (READ_REG32(MDC_DISPLAY_CFG) & MDC_DCFG_TGEN) + return (1); + else + return (0); +} + +/*--------------------------------------------------------------------------- + * gfx_test_vertical_active + *--------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +int +gu2_test_vertical_active(void) +#else +int +gfx_test_vertical_active(void) +#endif +{ + if (READ_REG32(MDC_LINE_CNT_STATUS) & MDC_LNCNT_VNA) + return (0); + + return (1); +} + +/*--------------------------------------------------------------------------- + * gfx_wait_vertical_blank + *--------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +int +gu2_wait_vertical_blank(void) +#else +int +gfx_wait_vertical_blank(void) +#endif +{ + if (gfx_test_timing_active()) { + while (!gfx_test_vertical_active()) ; + while (gfx_test_vertical_active()) ; + } + return (0); +} + +/*--------------------------------------------------------------------------- + * gfx_enable_panning + * + * This routine enables the panning when the Mode is bigger than the panel + * size. + *--------------------------------------------------------------------------- + */ + +#if GFX_DISPLAY_DYNAMIC +void +gu2_enable_panning(int x, int y) +#else +void +gfx_enable_panning(int x, int y) +#endif +{ + unsigned long modeBytesPerPixel; + unsigned long modeBytesPerScanline = 0; + unsigned long startAddress = 0; + + modeBytesPerPixel = (gbpp + 7) / 8; + modeBytesPerScanline = (READ_REG32(MDC_GFX_PITCH) & 0x0000FFFF) << 3; + + /* TEST FOR NO-WORK */ + + if (x >= DeltaX && x < ((int)PanelWidth + DeltaX) && + y >= DeltaY && y < ((int)PanelHeight + DeltaY)) + return; + + /* ADJUST PANNING VARIABLES WHEN CURSOR EXCEEDS BOUNDARY */ + /* Test the boundary conditions for each coordinate and update */ + /* all variables and the starting offset accordingly. */ + + if (x < DeltaX) + DeltaX = x; + + else if (x >= (DeltaX + (int)PanelWidth)) + DeltaX = x - (int)PanelWidth + 1; + + if (y < DeltaY) + DeltaY = y; + + else if (y >= (DeltaY + (int)PanelHeight)) + DeltaY = y - (int)PanelHeight + 1; + + /* CALCULATE THE START OFFSET */ + + startAddress = + (DeltaX * modeBytesPerPixel) + (DeltaY * modeBytesPerScanline); + + gfx_set_display_offset(startAddress); + + /* SET PANEL COORDINATES */ + /* Panel's x position must be DWORD aligned */ + + panelTop = DeltaY; + panelLeft = DeltaX * modeBytesPerPixel; + + if (panelLeft & 3) + panelLeft = (panelLeft & 0xFFFFFFFC) + 4; + + panelLeft /= modeBytesPerPixel; +} + +/*--------------------------------------------------------------------------- + * gfx_is_panel_mode_supported + *--------------------------------------------------------------------------- + */ + +#if GFX_DISPLAY_DYNAMIC +int +gu2_is_panel_mode_supported(int panelResX, int panelResY, + unsigned short width, unsigned short height, unsigned short bpp) +#else +int +gfx_is_panel_mode_supported(int panelResX, int panelResY, + unsigned short width, unsigned short height, unsigned short bpp) +#endif +{ + unsigned int mode; + + /* LOOP THROUGH THE AVAILABLE MODES TO FIND A MATCH */ + for (mode = 0; mode < NUM_FIXED_TIMINGS_MODES; mode++) { + if ((FixedParams[mode].xres == width) && + (FixedParams[mode].yres == height) && + (FixedParams[mode].panelresx == panelResX) && + (FixedParams[mode].panelresy == panelResY)) { + return ((int)mode); + } + } + + return -1; +} + +/*--------------------------------------------------------------------------- + * gfx_set_fixed_timings + *--------------------------------------------------------------------------- + */ + +#if GFX_DISPLAY_DYNAMIC +int +gu2_set_fixed_timings(int panelResX, int panelResY, unsigned short width, + unsigned short height, unsigned short bpp) +#else +int +gfx_set_fixed_timings(int panelResX, int panelResY, unsigned short width, + unsigned short height, unsigned short bpp) +#endif +{ + unsigned int mode; + + ModeWidth = width; + ModeHeight = height; + PanelWidth = (unsigned short)panelResX; + PanelHeight = (unsigned short)panelResY; + PanelEnable = 1; + + /* LOOP THROUGH THE AVAILABLE MODES TO FIND A MATCH */ + for (mode = 0; mode < NUM_FIXED_TIMINGS_MODES; mode++) { + if ((FixedParams[mode].xres == width) && + (FixedParams[mode].yres == height) && + (FixedParams[mode].panelresx == panelResX) && + (FixedParams[mode].panelresy == panelResY)) { + + /* SET THE 92xx FOR THE SELECTED MODE */ + FIXEDTIMINGS *fmode = &FixedParams[mode]; + + gfx_set_display_timings(bpp, 3, fmode->hactive, + fmode->hblankstart, fmode->hsyncstart, fmode->hsyncend, + fmode->hblankend, fmode->htotal, fmode->vactive, + fmode->vblankstart, fmode->vsyncstart, fmode->vsyncend, + fmode->vblankend, fmode->vtotal, fmode->frequency); + + return (1); + } /* end if() */ + } /* end for() */ + + return (-1); +} + +/*--------------------------------------------------------------------------- + * gfx_set_panel_present + *--------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +int +gu2_set_panel_present(int panelResX, int panelResY, unsigned short width, + unsigned short height, unsigned short bpp) +#else +int +gfx_set_panel_present(int panelResX, int panelResY, unsigned short width, + unsigned short height, unsigned short bpp) +#endif +{ + /* SET VALID BPP */ + /* 16BPP is the default. */ + + if (bpp != 8 && bpp != 12 && bpp != 15 && bpp != 16 && bpp != 32) + bpp = 16; + + /* RECORD PANEL PARAMETERS */ + /* This routine does not touch any panel timings. It is used when custom + * panel settings are set up in advance by the BIOS or an application, but + * the application still requires access to other panel functionality + * provided by Durango (i.e. panning). + * */ + + ModeWidth = width; + ModeHeight = height; + PanelWidth = (unsigned short)panelResX; + PanelHeight = (unsigned short)panelResY; + PanelEnable = 1; + gbpp = bpp; + + /* PROGRAM THE BPP IN THE DISPLAY CONTROLLER */ + + gfx_set_display_bpp(bpp); + + return (GFX_STATUS_OK); +} + +/* THE FOLLOWING READ ROUTINES ARE ALWAYS INCLUDED: */ + +/*--------------------------------------------------------------------------- + * gfx_get_display_pitch + * + * This routine returns the current pitch of the frame buffer, in bytes. + *--------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +unsigned short +gu2_get_display_pitch(void) +#else +unsigned short +gfx_get_display_pitch(void) +#endif +{ + return ((unsigned short)(READ_REG32(MDC_GFX_PITCH) & 0x0000FFFF) << 3); +} + +/*---------------------------------------------------------------------------- + * gfx_mode_frequency_supported + * + * This routine examines if the requested mode with pixel frequency is + * supported. + * + * Returns >0 if successful , <0 if freq. could not be found and matched. + *---------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +int +gu2_mode_frequency_supported(int xres, int yres, int bpp, + unsigned long frequency) +#else +int +gfx_mode_frequency_supported(int xres, int yres, int bpp, + unsigned long frequency) +#endif +{ + unsigned int index; + unsigned long value; + unsigned long bpp_flag = 0; + + gfx_mode_bpp_conversion_def(bpp) + + for (index = 0; index < NUM_RC_DISPLAY_MODES; index++) { + if ((DisplayParams[index].hactive == (unsigned int)xres) && + (DisplayParams[index].vactive == (unsigned int)yres) && + (DisplayParams[index].flags & bpp_flag) && + (DisplayParams[index].frequency == frequency)) { + int hz = 0; + + value = DisplayParams[index].flags; + + if (value & GFX_MODE_56HZ) + hz = 56; + else if (value & GFX_MODE_60HZ) + hz = 60; + else if (value & GFX_MODE_70HZ) + hz = 70; + else if (value & GFX_MODE_72HZ) + hz = 72; + else if (value & GFX_MODE_75HZ) + hz = 75; + else if (value & GFX_MODE_85HZ) + hz = 85; + else if (value & GFX_MODE_90HZ) + hz = 90; + else if (value & GFX_MODE_100HZ) + hz = 100; + return (hz); + } + } + + return (-1); +} + +/*---------------------------------------------------------------------------- + * gfx_refreshrate_from_frequency + * + * This routine maps the frequency to close match refresh rate + *---------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +int +gu2_get_refreshrate_from_frequency(int xres, int yres, int bpp, int *hz, + unsigned long frequency) +#else +int +gfx_get_refreshrate_from_frequency(int xres, int yres, int bpp, int *hz, + unsigned long frequency) +#endif +{ + unsigned int index, closematch = 0; + unsigned long value; + unsigned long bpp_flag = 0; + long min, diff; + + *hz = 60; + + gfx_mode_bpp_conversion_def(bpp) + + /* FIND THE REGISTER VALUES FOR THE DESIRED FREQUENCY */ + /* Search the table for the closest frequency (16.16 format). */ + min = 0x7fffffff; + for (index = 0; index < NUM_RC_DISPLAY_MODES; index++) { + if ((DisplayParams[index].htotal == (unsigned int)xres) && + (DisplayParams[index].vtotal == (unsigned int)yres) && + (DisplayParams[index].flags & bpp_flag)) { + diff = (long)frequency - (long)DisplayParams[index].frequency; + if (diff < 0) + diff = -diff; + + if (diff < min) { + min = diff; + closematch = index; + } + } + } + + value = DisplayParams[closematch].flags; + + if (value & GFX_MODE_56HZ) + *hz = 56; + else if (value & GFX_MODE_60HZ) + *hz = 60; + else if (value & GFX_MODE_70HZ) + *hz = 70; + else if (value & GFX_MODE_72HZ) + *hz = 72; + else if (value & GFX_MODE_75HZ) + *hz = 75; + else if (value & GFX_MODE_85HZ) + *hz = 85; + else if (value & GFX_MODE_90HZ) + *hz = 90; + else if (value & GFX_MODE_100HZ) + *hz = 100; + + return (1); +} + +/*---------------------------------------------------------------------------- + * gfx_refreshrate_from_mode + * + * This routine is identical to the gfx_get_refreshrate_from_frequency, + * except that the active timing values are compared instead of the total + * values. Some modes (such as 70Hz and 72Hz) may be confused in this routine + *---------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +int +gu2_get_refreshrate_from_mode(int xres, int yres, int bpp, int *hz, + unsigned long frequency) +#else +int +gfx_get_refreshrate_from_mode(int xres, int yres, int bpp, int *hz, + unsigned long frequency) +#endif +{ + unsigned int index, closematch = 0; + unsigned long value; + unsigned long bpp_flag = 0; + long min, diff; + + *hz = 60; + + gfx_mode_bpp_conversion_def(bpp) + + /* FIND THE REGISTER VALUES FOR THE DESIRED FREQUENCY */ + /* Search the table for the closest frequency (16.16 format). */ + min = 0x7fffffff; + for (index = 0; index < NUM_RC_DISPLAY_MODES; index++) { + if ((DisplayParams[index].hactive == (unsigned int)xres) && + (DisplayParams[index].vactive == (unsigned int)yres) && + (DisplayParams[index].flags & bpp_flag)) { + diff = (long)frequency - (long)DisplayParams[index].frequency; + if (diff < 0) + diff = -diff; + + if (diff < min) { + min = diff; + closematch = index; + } + } + } + + value = DisplayParams[closematch].flags; + + if (value & GFX_MODE_56HZ) + *hz = 56; + else if (value & GFX_MODE_60HZ) + *hz = 60; + else if (value & GFX_MODE_70HZ) + *hz = 70; + else if (value & GFX_MODE_72HZ) + *hz = 72; + else if (value & GFX_MODE_75HZ) + *hz = 75; + else if (value & GFX_MODE_85HZ) + *hz = 85; + else if (value & GFX_MODE_90HZ) + *hz = 90; + else if (value & GFX_MODE_100HZ) + *hz = 100; + + return (1); +} + +/*---------------------------------------------------------------------------- + * gfx_get_frequency_from_refreshrate + * + * This routine maps the refresh rate to the closest matching PLL frequency. + *---------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +int +gu2_get_frequency_from_refreshrate(int xres, int yres, int bpp, int hz, + int *frequency) +#else +int +gfx_get_frequency_from_refreshrate(int xres, int yres, int bpp, int hz, + int *frequency) +#endif +{ + unsigned int index; + int retval = -1; + unsigned long hz_flag = 0; + unsigned long bpp_flag = 0; + + *frequency = 0; + + gfx_mode_hz_conversion gfx_mode_bpp_conversion_def(bpp) + + /* FIND THE REGISTER VALUES FOR THE DESIRED FREQUENCY */ + /* Search the table for the closest frequency (16.16 format). */ + for (index = 0; index < NUM_RC_DISPLAY_MODES; index++) { + if ((DisplayParams[index].hactive == (unsigned short)xres) && + (DisplayParams[index].vactive == (unsigned short)yres) && + (DisplayParams[index].flags & bpp_flag) && + (DisplayParams[index].flags & hz_flag)) { + *frequency = DisplayParams[index].frequency; + retval = 1; + } + } + return retval; +} + +/*--------------------------------------------------------------------------- + * gfx_get_max_supported_pixel_clock + * + * This routine returns the maximum recommended speed for the pixel clock. The + * return value is an integer of the format xxxyyy, where xxx.yyy is the + * maximum floating point pixel clock speed. + *--------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +unsigned long +gu2_get_max_supported_pixel_clock(void) +#else +unsigned long +gfx_get_max_supported_pixel_clock(void) +#endif +{ + return 229500; +} + +/*---------------------------------------------------------------------------- + * gfx_get_display_mode + * + * This routine gets the specified display mode. + * + * Returns >0 if successful and mode returned, <0 if mode could not be found. + *---------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +int +gu2_get_display_mode(int *xres, int *yres, int *bpp, int *hz) +#else +int +gfx_get_display_mode(int *xres, int *yres, int *bpp, int *hz) +#endif +{ + unsigned int mode = 0; + unsigned long pll_freq = 0, bpp_flag = 0; + + *xres = gfx_get_hactive(); + *yres = gfx_get_vactive(); + *bpp = gfx_get_display_bpp(); + pll_freq = gfx_get_clock_frequency(); + + /* SET BPP FLAGS TO LIMIT MODE SELECTION */ + gfx_mode_bpp_conversion_def(*bpp) + + for (mode = 0; mode < NUM_RC_DISPLAY_MODES; mode++) { + if ((DisplayParams[mode].hactive == (unsigned int)*xres) && + (DisplayParams[mode].vactive == (unsigned int)*yres) && + (DisplayParams[mode].frequency == pll_freq) && + (DisplayParams[mode].flags & bpp_flag)) { + + pll_freq = DisplayParams[mode].flags; + + if (pll_freq & GFX_MODE_56HZ) + *hz = 56; + else if (pll_freq & GFX_MODE_60HZ) + *hz = 60; + else if (pll_freq & GFX_MODE_70HZ) + *hz = 70; + else if (pll_freq & GFX_MODE_72HZ) + *hz = 72; + else if (pll_freq & GFX_MODE_75HZ) + *hz = 75; + else if (pll_freq & GFX_MODE_85HZ) + *hz = 85; + else if (pll_freq & GFX_MODE_90HZ) + *hz = 90; + else if (pll_freq & GFX_MODE_100HZ) + *hz = 100; + + return (1); + } + } + return (-1); +} + +/*---------------------------------------------------------------------------- + * GFX_GET_DISPLAY_DETAILS + * + * This routine gets the specified display mode. + * + * Returns 1 if successful, 0 if mode could not be get. + *---------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +int +gu2_get_display_details(unsigned int mode, int *xres, int *yres, int *hz) +#else +int +gfx_get_display_details(unsigned int mode, int *xres, int *yres, int *hz) +#endif +{ + if (mode < NUM_RC_DISPLAY_MODES) { + if (DisplayParams[mode].flags & GFX_MODE_56HZ) + *hz = 56; + else if (DisplayParams[mode].flags & GFX_MODE_60HZ) + *hz = 60; + else if (DisplayParams[mode].flags & GFX_MODE_70HZ) + *hz = 70; + else if (DisplayParams[mode].flags & GFX_MODE_72HZ) + *hz = 72; + else if (DisplayParams[mode].flags & GFX_MODE_75HZ) + *hz = 75; + else if (DisplayParams[mode].flags & GFX_MODE_85HZ) + *hz = 85; + else if (DisplayParams[mode].flags & GFX_MODE_90HZ) + *hz = 90; + else if (DisplayParams[mode].flags & GFX_MODE_100HZ) + *hz = 100; + + *xres = DisplayParams[mode].hactive; + *yres = DisplayParams[mode].vactive; + + if (DisplayParams[mode].flags & GFX_MODE_PIXEL_DOUBLE) + *xres >>= 1; + if (DisplayParams[mode].flags & GFX_MODE_LINE_DOUBLE) + *yres >>= 1; + + return (1); + } + return (0); +} + +/*---------------------------------------------------------------------------- + * GFX_GET_DISPLAY_MODE_COUNT + * + * This routine gets the number of available display modes. + *---------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +int +gu2_get_display_mode_count(void) +#else +int +gfx_get_display_mode_count(void) +#endif +{ + return (NUM_RC_DISPLAY_MODES); +} + +/*---------------------------------------------------------------------------- + * gfx_get_frame_buffer_line_size + * + * Returns the current frame buffer line size, in bytes + *---------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +unsigned long +gu2_get_frame_buffer_line_size(void) +#else +unsigned long +gfx_get_frame_buffer_line_size(void) +#endif +{ + return ((READ_REG32(MDC_LINE_SIZE) & 0x7FF) << 3); +} + +/*--------------------------------------------------------------------------- + * gfx_get_hactive + *--------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +unsigned short +gu2_get_hactive(void) +#else +unsigned short +gfx_get_hactive(void) +#endif +{ + return ((unsigned short)((READ_REG32(MDC_H_ACTIVE_TIMING) & 0x0FF8) + 8)); +} + +/*--------------------------------------------------------------------------- + * gfx_get_hsync_start + *--------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +unsigned short +gu2_get_hsync_start(void) +#else +unsigned short +gfx_get_hsync_start(void) +#endif +{ + return ((unsigned short)((READ_REG32(MDC_H_SYNC_TIMING) & 0x0FF8) + 8)); +} + +/*--------------------------------------------------------------------------- + * gfx_get_hsync_end + *--------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +unsigned short +gu2_get_hsync_end(void) +#else +unsigned short +gfx_get_hsync_end(void) +#endif +{ + return ((unsigned short)(((READ_REG32(MDC_H_SYNC_TIMING) >> 16) & 0x0FF8) + + 8)); +} + +/*--------------------------------------------------------------------------- + * gfx_get_htotal + *--------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +unsigned short +gu2_get_htotal(void) +#else +unsigned short +gfx_get_htotal(void) +#endif +{ + return ((unsigned short)(((READ_REG32(MDC_H_ACTIVE_TIMING) >> 16) & + 0x0FF8) + 8)); +} + +/*--------------------------------------------------------------------------- + * gfx_get_vactive + *--------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +unsigned short +gu2_get_vactive(void) +#else +unsigned short +gfx_get_vactive(void) +#endif +{ + return ((unsigned short)((READ_REG32(MDC_V_ACTIVE_TIMING) & 0x07FF) + 1)); +} + +/*--------------------------------------------------------------------------- + * gfx_get_vsync_end + *--------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +unsigned short +gu2_get_vsync_end(void) +#else +unsigned short +gfx_get_vsync_end(void) +#endif +{ + return ((unsigned short)(((READ_REG32(MDC_V_SYNC_TIMING) >> 16) & 0x07FF) + + 1)); +} + +/*--------------------------------------------------------------------------- + * gfx_get_vtotal + *--------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +unsigned short +gu2_get_vtotal(void) +#else +unsigned short +gfx_get_vtotal(void) +#endif +{ + return ((unsigned short)(((READ_REG32(MDC_V_ACTIVE_TIMING) >> 16) & + 0x07FF) + 1)); +} + +/*---------------------------------------------------------------------------- + * gfx_get_display_bpp + * + * This routine returns the current color depth of the active display. + *---------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +unsigned short +gu2_get_display_bpp(void) +#else +unsigned short +gfx_get_display_bpp(void) +#endif +{ + unsigned long dcfg = READ_REG32(MDC_DISPLAY_CFG); + + switch ((dcfg & MDC_DCFG_DISP_MODE_MASK) >> 8) { + case 0: + return (8); + case 2: + return (32); + case 1: + switch ((dcfg & MDC_DCFG_16BPP_MODE_MASK) >> 10) { + case 0: + return (16); + case 1: + return (15); + case 2: + return (12); + default: + return (0); + } + } + + /* INVALID SETTING */ + return (0); +} + +/*--------------------------------------------------------------------------- + * gfx_get_vline + *--------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +unsigned short +gu2_get_vline(void) +#else +unsigned short +gfx_get_vline(void) +#endif +{ + unsigned short current_scan_line; + + /* Read similar value twice to ensure that the value is not + * transitioning */ + do + current_scan_line = + (unsigned short)(READ_REG32(MDC_LINE_CNT_STATUS) & + MDC_LNCNT_V_LINE_CNT); + while (current_scan_line != + (unsigned short)(READ_REG32(MDC_LINE_CNT_STATUS) & + MDC_LNCNT_V_LINE_CNT)); + + return (current_scan_line >> 16); +} + +/*----------------------------------------------------------------------------- + * gfx_get_display_offset + *----------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +unsigned long +gu2_get_display_offset(void) +#else +unsigned long +gfx_get_display_offset(void) +#endif +{ + return (READ_REG32(MDC_FB_ST_OFFSET) & 0x0FFFFFFF); +} + +/*----------------------------------------------------------------------------- + * gfx_get_cursor_offset + *----------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +unsigned long +gu2_get_cursor_offset(void) +#else +unsigned long +gfx_get_cursor_offset(void) +#endif +{ + return (READ_REG32(MDC_CURS_ST_OFFSET) & 0x0FFFFFFF); +} + +#if GFX_READ_ROUTINES + +/*************************************************************/ +/* READ ROUTINES | INCLUDED FOR DIAGNOSTIC PURPOSES ONLY */ +/*************************************************************/ + +/*--------------------------------------------------------------------------- + * gfx_get_hblank_start + *--------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +unsigned short +gu2_get_hblank_start(void) +#else +unsigned short +gfx_get_hblank_start(void) +#endif +{ + return ((unsigned short)((READ_REG32(MDC_H_BLANK_TIMING) & 0x0FF8) + 8)); +} + +/*--------------------------------------------------------------------------- + * gfx_get_hblank_end + *--------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +unsigned short +gu2_get_hblank_end(void) +#else +unsigned short +gfx_get_hblank_end(void) +#endif +{ + return ((unsigned short)(((READ_REG32(MDC_H_BLANK_TIMING) >> 16) & 0x0FF8) + + 8)); +} + +/*--------------------------------------------------------------------------- + * gfx_get_vblank_start + *--------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +unsigned short +gu2_get_vblank_start(void) +#else +unsigned short +gfx_get_vblank_start(void) +#endif +{ + return ((unsigned short)((READ_REG32(MDC_V_BLANK_TIMING) & 0x07FF) + 1)); +} + +/*--------------------------------------------------------------------------- + * gfx_get_vsync_start + *--------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +unsigned short +gu2_get_vsync_start(void) +#else +unsigned short +gfx_get_vsync_start(void) +#endif +{ + return ((unsigned short)((READ_REG32(MDC_V_SYNC_TIMING) & 0x07FF) + 1)); +} + +/*--------------------------------------------------------------------------- + * gfx_get_vblank_end + *--------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +unsigned short +gu2_get_vblank_end(void) +#else +unsigned short +gfx_get_vblank_end(void) +#endif +{ + return ((unsigned short)(((READ_REG32(MDC_V_BLANK_TIMING) >> 16) & 0x07FF) + + 1)); +} + +/*---------------------------------------------------------------------------- + * gfx_get_display_palette_entry + *---------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +int +gu2_get_display_palette_entry(unsigned long index, unsigned long *palette) +#else +int +gfx_get_display_palette_entry(unsigned long index, unsigned long *palette) +#endif +{ + if (index > 0xFF) + return GFX_STATUS_BAD_PARAMETER; + + WRITE_REG32(MDC_PAL_ADDRESS, index); + *palette = READ_REG32(MDC_PAL_DATA); + + return 0; +} + +/*---------------------------------------------------------------------------- + * gfx_get_display_palette + *---------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +void +gu2_get_display_palette(unsigned long *palette) +#else +void +gfx_get_display_palette(unsigned long *palette) +#endif +{ + unsigned long i; + + WRITE_REG32(MDC_PAL_ADDRESS, 0); + for (i = 0; i < 256; i++) { + palette[i] = READ_REG32(MDC_PAL_DATA); + } +} + +/*---------------------------------------------------------------------------- + * gfx_get_cursor_enable + *---------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +unsigned long +gu2_get_cursor_enable(void) +#else +unsigned long +gfx_get_cursor_enable(void) +#endif +{ + return (READ_REG32(MDC_GENERAL_CFG) & MDC_GCFG_CURE); +} + +/*---------------------------------------------------------------------------- + * gfx_get_cursor_position + *---------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +unsigned long +gu2_get_cursor_position(void) +#else +unsigned long +gfx_get_cursor_position(void) +#endif +{ + return ((READ_REG32(MDC_CURSOR_X) & 0x07FF) | + ((READ_REG32(MDC_CURSOR_Y) << 16) & 0x07FF0000)); +} + +/*---------------------------------------------------------------------------- + * gfx_get_cursor_offset + *---------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +unsigned long +gu2_get_cursor_clip(void) +#else +unsigned long +gfx_get_cursor_clip(void) +#endif +{ + return (((READ_REG32(MDC_CURSOR_X) >> 11) & 0x03F) | + ((READ_REG32(MDC_CURSOR_Y) << 5) & 0x3F0000)); +} + +/*---------------------------------------------------------------------------- + * gfx_get_cursor_color + *---------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +unsigned long +gu2_get_cursor_color(int color) +#else +unsigned long +gfx_get_cursor_color(int color) +#endif +{ + if (color) { + WRITE_REG32(MDC_PAL_ADDRESS, 0x101); + } else { + WRITE_REG32(MDC_PAL_ADDRESS, 0x100); + } + return READ_REG32(MDC_PAL_DATA); +} + +/*---------------------------------------------------------------------------- + * gfx_get_icon_enable + *---------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +unsigned long +gu2_get_icon_enable(void) +#else +unsigned long +gfx_get_icon_enable(void) +#endif +{ + return (READ_REG32(MDC_GENERAL_CFG) & MDC_GCFG_ICNE); +} + +/*---------------------------------------------------------------------------- + * gfx_get_icon_offset + *---------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +unsigned long +gu2_get_icon_offset(void) +#else +unsigned long +gfx_get_icon_offset(void) +#endif +{ + return (READ_REG32(MDC_ICON_ST_OFFSET) & 0x0FFFFFFF); +} + +/*---------------------------------------------------------------------------- + * gfx_get_icon_position + *---------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +unsigned long +gu2_get_icon_position(void) +#else +unsigned long +gfx_get_icon_position(void) +#endif +{ + return (READ_REG32(MDC_ICON_X) & 0x07FF); +} + +/*---------------------------------------------------------------------------- + * gfx_get_icon_color + *---------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +unsigned long +gu2_get_icon_color(int color) +#else +unsigned long +gfx_get_icon_color(int color) +#endif +{ + if (color >= 3) + return 0; + + WRITE_REG32(MDC_PAL_ADDRESS, 0x102 + color); + + return READ_REG32(MDC_PAL_DATA); +} + +/*---------------------------------------------------------------------------- + * gfx_get_compression_enable + *---------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +int +gu2_get_compression_enable(void) +#else +int +gfx_get_compression_enable(void) +#endif +{ + if (READ_REG32(MDC_GENERAL_CFG) & MDC_GCFG_CMPE) + return (1); + + return (0); +} + +/*---------------------------------------------------------------------------- + * gfx_get_compression_offset + *---------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +unsigned long +gu2_get_compression_offset(void) +#else +unsigned long +gfx_get_compression_offset(void) +#endif +{ + return (READ_REG32(MDC_CB_ST_OFFSET) & 0x007FFFFF); +} + +/*---------------------------------------------------------------------------- + * gfx_get_compression_pitch + *---------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +unsigned short +gu2_get_compression_pitch(void) +#else +unsigned short +gfx_get_compression_pitch(void) +#endif +{ + unsigned short pitch; + + pitch = (unsigned short)(READ_REG32(MDC_GFX_PITCH) >> 16); + return (pitch << 3); +} + +/*---------------------------------------------------------------------------- + * gfx_get_compression_size + *---------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +unsigned short +gu2_get_compression_size(void) +#else +unsigned short +gfx_get_compression_size(void) +#endif +{ + unsigned short size; + + size = (unsigned short)((READ_REG32(MDC_LINE_SIZE) >> 16) & 0x7F) - 1; + return ((size << 3) + 32); +} + +/*---------------------------------------------------------------------------- + * gfx_get_valid_bit + *---------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +int +gu2_get_valid_bit(int line) +#else +int +gfx_get_valid_bit(int line) +#endif +{ + unsigned long offset; + int valid; + + offset = READ_REG32(MDC_PHY_MEM_OFFSET) & 0xFF000000; + offset |= line; + + WRITE_REG32(MDC_PHY_MEM_OFFSET, offset); + valid = (int)READ_REG32(MDC_DV_ACC) & 2; + + if (valid) + return 1; + return 0; +} + +/*--------------------------------------------------------------------------- + * gfx_get_display_video_offset (PRIVATE ROUTINE - NOT PART OF API) + * + * This routine is called by "gfx_get_video_offset". It abstracts the + * version of the display controller from the video overlay routines. + *--------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +unsigned long +gu2_get_display_video_offset(void) +#else +unsigned long +gfx_get_display_video_offset(void) +#endif +{ + return (READ_REG32(MDC_VID_Y_ST_OFFSET) & 0x0FFFFFFF); +} + +/*--------------------------------------------------------------------------- + * gfx_get_display_video_yuv_offsets (PRIVATE ROUTINE - NOT PART OF API) + * + * This routine is called by "gfx_get_video_yuv_offsets". It abstracts the + * version of the display controller from the video overlay routines. + *--------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +void +gu2_get_display_video_yuv_offsets(unsigned long *yoffset, + unsigned long *uoffset, unsigned long *voffset) +#else +void +gfx_get_display_video_yuv_offsets(unsigned long *yoffset, + unsigned long *uoffset, unsigned long *voffset) +#endif +{ + *yoffset = (READ_REG32(MDC_VID_Y_ST_OFFSET) & 0x0FFFFFFF); + *uoffset = (READ_REG32(MDC_VID_U_ST_OFFSET) & 0x0FFFFFFF); + *voffset = (READ_REG32(MDC_VID_V_ST_OFFSET) & 0x0FFFFFFF); +} + +/*--------------------------------------------------------------------------- + * gfx_get_display_video_yuv_pitch (PRIVATE ROUTINE - NOT PART OF API) + * + * This routine is called by "gfx_get_video_yuv_pitch". It abstracts the + * version of the display controller from the video overlay routines. + *--------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +void +gu2_get_display_video_yuv_pitch(unsigned long *ypitch, unsigned long *uvpitch) +#else +void +gfx_get_display_video_yuv_pitch(unsigned long *ypitch, unsigned long *uvpitch) +#endif +{ + unsigned long pitch = READ_REG32(MDC_VID_YUV_PITCH); + + *ypitch = ((pitch & 0xFFFF) << 3); + *uvpitch = (pitch >> 13) & 0x7FFF8; +} + +/*--------------------------------------------------------------------------- + * gfx_get_display_video_downscale_delta (PRIVATE ROUTINE - NOT PART OF API) + * + * This routine is called by "gfx_get_video_downscale_delta". It abstracts the + * version of the display controller from the video overlay routines. + *--------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +unsigned long +gu2_get_display_video_downscale_delta(void) +#else +unsigned long +gfx_get_display_video_downscale_delta(void) +#endif +{ + return (READ_REG32(MDC_VID_DS_DELTA) >> 18); +} + +/*--------------------------------------------------------------------------- + * gfx_get_display_video_downscale_enable (PRIVATE ROUTINE - NOT PART OF API) + * + * This routine is called by "gfx_get_video_vertical_downscale_enable". + * It abstracts the version of the display controller from the video overlay + * routines. + *--------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +int +gu2_get_display_video_downscale_enable(void) +#else +int +gfx_get_display_video_downscale_enable(void) +#endif +{ + return ((int)((READ_REG32(MDC_GENERAL_CFG) >> 19) & 1)); +} + +/*--------------------------------------------------------------------------- + * gfx_get_display_video_size (PRIVATE ROUTINE - NOT PART OF API) + * + * This routine is called by "gfx_get_video_size". It abstracts the + * version of the display controller from the video overlay routines. + *--------------------------------------------------------------------------- + */ +#if GFX_DISPLAY_DYNAMIC +unsigned long +gu2_get_display_video_size(void) +#else +unsigned long +gfx_get_display_video_size(void) +#endif +{ + /* RETURN THE LINE SIZE, AS THIS IS ALL THAT IS AVAILABLE */ + + return ((READ_REG32(MDC_LINE_SIZE) >> 21) & 0x000007FF); +} + +#endif /* GFX_READ_ROUTINES */ + +/* END OF FILE */ diff --git a/driver/xf86-video-geode/src/gfx/gfx_dcdr.c b/driver/xf86-video-geode/src/gfx/gfx_dcdr.c new file mode 100644 index 000000000..57abe3745 --- /dev/null +++ b/driver/xf86-video-geode/src/gfx/gfx_dcdr.c @@ -0,0 +1,499 @@ +/* Copyright (c) 2005 Advanced Micro Devices, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + * + * Neither the name of the Advanced Micro Devices, Inc. nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * */ + +/* + * This file contains routines to control the video decoder. + * + * gfx_set_decoder_defaults + * gfx_set_decoder_analog_input + * gfx_set_decoder_brightness + * gfx_set_decoder_contrast + * gfx_set_decoder_luminance_filter + * gfx_set_decoder_hue + * gfx_set_decoder_saturation + * gfx_set_decoder_input_offset + * gfx_set_decoder_input_size + * gfx_set_decoder_output_size + * gfx_set_decoder_scale + * gfx_set_decoder_TV_standard + * gfx_set_decoder_vbi_enable + * gfx_set_decoder_vbi_format + * gfx_set_decoder_vbi_upscale + * gfx_decoder_software_reset + * gfx_decoder_detect_macrovision + * gfx_decoder_detect_video + * + * And the following routines if GFX_READ_ROUTINES is set: + * + * gfx_get_decoder_brightness + * gfx_get_decoder_contrast + * gfx_get_decoder_hue + * gfx_get_decoder_saturation + * gfx_get_decoder_input_offset + * gfx_get_decoder_input_size + * gfx_get_decoder_output_size + * gfx_get_decoder_vbi_format + */ + +/* INCLUDE SUPPORT FOR PHILIPS SAA7114 DECODER, IF SPECIFIED */ + +#if GFX_DECODER_SAA7114 +#include "saa7114.c" +#endif + +/* WRAPPERS IF DYNAMIC SELECTION */ +/* Extra layer to call various decoders. Currently only the Pillips */ +/* decoder is supported, but still organized to easily expand later. */ + +#if GFX_DECODER_DYNAMIC + +/*---------------------------------------------------------------------------- + * gfx_set_decoder_defaults + *---------------------------------------------------------------------------- + */ +int +gfx_set_decoder_defaults(void) +{ + int status = GFX_STATUS_UNSUPPORTED; + +#if GFX_DECODER_SAA7114 + if (gfx_decoder_type == GFX_DECODER_SAA7114) + status = saa7114_set_decoder_defaults(); +#endif + return (status); +} + +/*---------------------------------------------------------------------------- + * gfx_set_decoder_analog_input + *---------------------------------------------------------------------------- + */ +int +gfx_set_decoder_analog_input(unsigned char input) +{ + int status = GFX_STATUS_UNSUPPORTED; + +#if GFX_DECODER_SAA7114 + if (gfx_decoder_type == GFX_DECODER_SAA7114) + status = saa7114_set_decoder_analog_input(input); +#endif + return (status); +} + +/*---------------------------------------------------------------------------- + * gfx_set_decoder_brightness + *---------------------------------------------------------------------------- + */ +int +gfx_set_decoder_brightness(unsigned char brightness) +{ + int status = GFX_STATUS_UNSUPPORTED; + +#if GFX_DECODER_SAA7114 + if (gfx_decoder_type == GFX_DECODER_SAA7114) + status = saa7114_set_decoder_brightness(brightness); +#endif + return (status); +} + +/*---------------------------------------------------------------------------- + * gfx_set_decoder_contrast + *---------------------------------------------------------------------------- + */ +int +gfx_set_decoder_contrast(unsigned char contrast) +{ + int status = GFX_STATUS_UNSUPPORTED; + +#if GFX_DECODER_SAA7114 + if (gfx_decoder_type == GFX_DECODER_SAA7114) + status = saa7114_set_decoder_contrast(contrast); +#endif + return (status); +} + +/*---------------------------------------------------------------------------- + * gfx_set_decoder_hue + *---------------------------------------------------------------------------- + */ +int +gfx_set_decoder_hue(char hue) +{ + int status = GFX_STATUS_UNSUPPORTED; + +#if GFX_DECODER_SAA7114 + if (gfx_decoder_type == GFX_DECODER_SAA7114) + status = saa7114_set_decoder_hue(hue); +#endif + return (status); +} + +/*---------------------------------------------------------------------------- + * gfx_set_decoder_saturation + *---------------------------------------------------------------------------- + */ +int +gfx_set_decoder_saturation(unsigned char saturation) +{ + int status = GFX_STATUS_UNSUPPORTED; + +#if GFX_DECODER_SAA7114 + if (gfx_decoder_type == GFX_DECODER_SAA7114) + status = saa7114_set_decoder_saturation(saturation); +#endif + return (status); +} + +/*---------------------------------------------------------------------------- + * gfx_set_decoder_input_offset + *---------------------------------------------------------------------------- + */ +int +gfx_set_decoder_input_offset(unsigned short x, unsigned short y) +{ + int status = GFX_STATUS_UNSUPPORTED; + +#if GFX_DECODER_SAA7114 + if (gfx_decoder_type == GFX_DECODER_SAA7114) + status = saa7114_set_decoder_input_offset(x, y); +#endif + return (status); +} + +/*---------------------------------------------------------------------------- + * gfx_set_decoder_input_size + *---------------------------------------------------------------------------- + */ +int +gfx_set_decoder_input_size(unsigned short width, unsigned short height) +{ + int status = GFX_STATUS_UNSUPPORTED; + +#if GFX_DECODER_SAA7114 + if (gfx_decoder_type == GFX_DECODER_SAA7114) + status = saa7114_set_decoder_input_size(width, height); +#endif + return (status); +} + +/*---------------------------------------------------------------------------- + * gfx_set_decoder_output_size + *---------------------------------------------------------------------------- + */ +int +gfx_set_decoder_output_size(unsigned short width, unsigned short height) +{ + int status = GFX_STATUS_UNSUPPORTED; + +#if GFX_DECODER_SAA7114 + if (gfx_decoder_type == GFX_DECODER_SAA7114) + status = saa7114_set_decoder_output_size(width, height); +#endif + return (status); +} + +/*---------------------------------------------------------------------------- + * gfx_set_decoder_scale + *---------------------------------------------------------------------------- + */ +int +gfx_set_decoder_scale(unsigned short srcw, unsigned short srch, + unsigned short dstw, unsigned short dsth) +{ + int status = GFX_STATUS_UNSUPPORTED; + +#if GFX_DECODER_SAA7114 + if (gfx_decoder_type == GFX_DECODER_SAA7114) + status = saa7114_set_decoder_scale(srcw, srch, dstw, dsth); +#endif + return (status); +} + +/*---------------------------------------------------------------------------- + * gfx_set_decoder_vbi_format + *---------------------------------------------------------------------------- + */ +int +gfx_set_decoder_vbi_format(int start, int end, int format) +{ + int status = GFX_STATUS_UNSUPPORTED; + +#if GFX_DECODER_SAA7114 + if (gfx_decoder_type == GFX_DECODER_SAA7114) + status = saa7114_set_decoder_vbi_format(start, end, format); +#endif + return (status); +} + +/*---------------------------------------------------------------------------- + * gfx_set_decoder_vbi_enable + *---------------------------------------------------------------------------- + */ +int +gfx_set_decoder_vbi_enable(int enable) +{ + int status = GFX_STATUS_UNSUPPORTED; + +#if GFX_DECODER_SAA7114 + if (gfx_decoder_type == GFX_DECODER_SAA7114) + status = saa7114_set_decoder_vbi_enable(enable); +#endif + return (status); +} + +/*---------------------------------------------------------------------------- + * gfx_set_decoder_vbi_upscale + *---------------------------------------------------------------------------- + */ +int +gfx_set_decoder_vbi_upscale(void) +{ + int status = GFX_STATUS_UNSUPPORTED; + +#if GFX_DECODER_SAA7114 + if (gfx_decoder_type == GFX_DECODER_SAA7114) + status = saa7114_set_decoder_vbi_upscale(); +#endif + return (status); +} + +/*---------------------------------------------------------------------------- + * gfx_set_decoder_TV_standard + *---------------------------------------------------------------------------- + */ +int +gfx_set_decoder_TV_standard(TVStandardType TVStandard) +{ + int status = GFX_STATUS_UNSUPPORTED; + +#if GFX_DECODER_SAA7114 + if (gfx_decoder_type == GFX_DECODER_SAA7114) + status = saa7114_set_decoder_TV_standard(TVStandard); +#endif + return (status); +} + +/*---------------------------------------------------------------------------- + * gfx_set_decoder_luminance_filter + *---------------------------------------------------------------------------- + */ +int +gfx_set_decoder_luminance_filter(unsigned char lufi) +{ + int status = GFX_STATUS_UNSUPPORTED; + +#if GFX_DECODER_SAA7114 + if (gfx_decoder_type == GFX_DECODER_SAA7114) + status = saa7114_set_decoder_luminance_filter(lufi); +#endif + return (status); +} + +/*---------------------------------------------------------------------------- + * gfx_decoder_software_reset + *---------------------------------------------------------------------------- + */ +int +gfx_decoder_software_reset(void) +{ + int status = GFX_STATUS_UNSUPPORTED; + +#if GFX_DECODER_SAA7114 + if (gfx_decoder_type == GFX_DECODER_SAA7114) + status = saa7114_decoder_software_reset(); +#endif + return (status); +} + +/*---------------------------------------------------------------------------- + * gfx_decoder_detect_macrovision + *---------------------------------------------------------------------------- + */ +int +gfx_decoder_detect_macrovision(void) +{ + int status = GFX_STATUS_UNSUPPORTED; + +#if GFX_DECODER_SAA7114 + if (gfx_decoder_type == GFX_DECODER_SAA7114) + status = saa7114_decoder_detect_macrovision(); +#endif + return (status); +} + +/*---------------------------------------------------------------------------- + * gfx_decoder_detect_video + *---------------------------------------------------------------------------- + */ +int +gfx_decoder_detect_video(void) +{ + int status = GFX_STATUS_UNSUPPORTED; + +#if GFX_DECODER_SAA7114 + if (gfx_decoder_type == GFX_DECODER_SAA7114) + status = saa7114_decoder_detect_video(); +#endif + return (status); +} + +/*************************************************************/ +/* READ ROUTINES | INCLUDED FOR DIAGNOSTIC PURPOSES ONLY */ +/*************************************************************/ + +#if GFX_READ_ROUTINES + +/*---------------------------------------------------------------------------- + * gfx_get_decoder_brightness + *---------------------------------------------------------------------------- + */ +unsigned char +gfx_get_decoder_brightness(void) +{ + unsigned char brightness = 0; + +#if GFX_DECODER_SAA7114 + if (gfx_decoder_type == GFX_DECODER_SAA7114) + brightness = saa7114_get_decoder_brightness(); +#endif + return (brightness); +} + +/*---------------------------------------------------------------------------- + * gfx_get_decoder_contrast + *---------------------------------------------------------------------------- + */ +unsigned char +gfx_get_decoder_contrast(void) +{ + unsigned char contrast = 0; + +#if GFX_DECODER_SAA7114 + if (gfx_decoder_type == GFX_DECODER_SAA7114) + contrast = saa7114_get_decoder_contrast(); +#endif + return (contrast); +} + +/*---------------------------------------------------------------------------- + * gfx_get_decoder_hue + *---------------------------------------------------------------------------- + */ +char +gfx_get_decoder_hue(void) +{ + unsigned char hue = 0; + +#if GFX_DECODER_SAA7114 + if (gfx_decoder_type == GFX_DECODER_SAA7114) + hue = saa7114_get_decoder_hue(); +#endif + return ((char)hue); +} + +/*---------------------------------------------------------------------------- + * gfx_get_decoder_saturation + *---------------------------------------------------------------------------- + */ +unsigned char +gfx_get_decoder_saturation(void) +{ + unsigned char saturation = 0; + +#if GFX_DECODER_SAA7114 + if (gfx_decoder_type == GFX_DECODER_SAA7114) + saturation = saa7114_get_decoder_saturation(); +#endif + return (saturation); +} + +/*---------------------------------------------------------------------------- + * gfx_get_decoder_input_offset + *---------------------------------------------------------------------------- + */ +unsigned long +gfx_get_decoder_input_offset() +{ + unsigned long offset = 0; + +#if GFX_DECODER_SAA7114 + if (gfx_decoder_type == GFX_DECODER_SAA7114) + offset = saa7114_get_decoder_input_offset(); +#endif + return (offset); +} + +/*---------------------------------------------------------------------------- + * gfx_get_decoder_input_size + *---------------------------------------------------------------------------- + */ +unsigned long +gfx_get_decoder_input_size() +{ + unsigned long size = 0; + +#if GFX_DECODER_SAA7114 + if (gfx_decoder_type == GFX_DECODER_SAA7114) + size = saa7114_get_decoder_input_size(); +#endif + return (size); +} + +/*---------------------------------------------------------------------------- + * gfx_get_decoder_output_size + *---------------------------------------------------------------------------- + */ +unsigned long +gfx_get_decoder_output_size() +{ + unsigned long size = 0; + +#if GFX_DECODER_SAA7114 + if (gfx_decoder_type == GFX_DECODER_SAA7114) + size = saa7114_get_decoder_output_size(); +#endif + return (size); +} + +/*---------------------------------------------------------------------------- + * gfx_get_decoder_vbi_format + *---------------------------------------------------------------------------- + */ +int +gfx_get_decoder_vbi_format(int line) +{ + int format = 0; + +#if GFX_DECODER_SAA7114 + if (gfx_decoder_type == GFX_DECODER_SAA7114) + format = saa7114_get_decoder_vbi_format(line); +#endif + return (format); +} + +#endif /* GFX_READ_ROUTINES */ + +#endif /* GFX_DECODER_DYNAMIC */ + +/* END OF FILE */ diff --git a/driver/xf86-video-geode/src/gfx/gfx_defs.h b/driver/xf86-video-geode/src/gfx/gfx_defs.h new file mode 100644 index 000000000..dde8385a8 --- /dev/null +++ b/driver/xf86-video-geode/src/gfx/gfx_defs.h @@ -0,0 +1,348 @@ +/* Copyright (c) 2005 Advanced Micro Devices, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + * + * Neither the name of the Advanced Micro Devices, Inc. nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * */ + +/* + * This header file contains the macros used to access the hardware. These + * macros assume that 32-bit access is possible, which is true for most + * applications. Projects using 16-bit compilers (the Windows98 display + * driver) and special purpose applications (such as Darwin) need to define + * their own versions of these macros, which typically call a subroutine. + * */ + +/* ACCESS TO THE CPU REGISTERS */ + +#define WRITE_REG8(offset, value) \ + (*(volatile unsigned char *)(gfx_virt_regptr + (offset))) = (value) + +#define WRITE_REG16(offset, value) \ + (*(volatile unsigned short *)(gfx_virt_regptr + (offset))) = (value) + +#define WRITE_REG32(offset, value) \ + (*(volatile unsigned long *)(gfx_virt_regptr + (offset))) = (value) + +#define READ_REG16(offset) \ + (*(volatile unsigned short *)(gfx_virt_regptr + (offset))) + +#define READ_REG32(offset) \ + (*(volatile unsigned long *)(gfx_virt_regptr + (offset))) + +/* ACCESS TO THE ACCELERATOR REGISTERS (REDCLOUD ONLY) */ + +#define WRITE_GP8(offset, value) \ + (*(volatile unsigned char *)(gfx_virt_gpptr + (offset))) = (value) + +#define WRITE_GP16(offset, value) \ + (*(volatile unsigned short *)(gfx_virt_gpptr + (offset))) = (value) + +#define WRITE_GP32(offset, value) \ + (*(volatile unsigned long *)(gfx_virt_gpptr + (offset))) = (value) + +#define READ_GP16(offset) \ + (*(volatile unsigned short *)(gfx_virt_gpptr + (offset))) + +#define READ_GP32(offset) \ + (*(volatile unsigned long *)(gfx_virt_gpptr + (offset))) + +/* ACCESS TO THE FRAME BUFFER */ + +#define WRITE_FB32(offset, value) \ + (*(volatile unsigned long *)(gfx_virt_fbptr + (offset))) = (value) + +#define WRITE_FB16(offset, value) \ + (*(volatile unsigned short *)(gfx_virt_fbptr + (offset))) = (value) + +#define WRITE_FB8(offset, value) \ + (*(volatile unsigned char *)(gfx_virt_fbptr + (offset))) = (value) + +/* ACCESS TO THE VIDEO HARDWARE */ + +#define READ_VID32(offset) \ + (*(volatile unsigned long *)(gfx_virt_vidptr + (offset))) + +#define WRITE_VID32(offset, value) \ + (*(volatile unsigned long *)(gfx_virt_vidptr + (offset))) = (value) + +/* ACCESS TO THE VIP HARDWARE */ + +#define READ_VIP32(offset) \ + (*(volatile unsigned long *)(gfx_virt_vipptr + (offset))) + +#define WRITE_VIP32(offset, value) \ + (*(volatile unsigned long *)(gfx_virt_vipptr + (offset))) = (value) + +/* ACCESS TO THE SCRATCHPAD RAM */ + +#define WRITE_SCRATCH32(offset, value) \ + (*(volatile unsigned long *)(gfx_virt_spptr + (offset))) = (value) + +#define WRITE_SCRATCH16(offset, value) \ + (*(volatile unsigned short *)(gfx_virt_spptr + (offset))) = (value) + +#define WRITE_SCRATCH8(offset, value) \ + (*(volatile unsigned char *)(gfx_virt_spptr + (offset))) = (value) + +#define READ_SCRATCH16(offset) \ + (*(volatile unsigned short *)(gfx_virt_spptr + (offset))) + +#define READ_SCRATCH32(offset) \ + (*(volatile unsigned long *)(gfx_virt_spptr + (offset))) + +/* ACCESS TO MSRS */ + +void gfx_msr_asm_write(unsigned short msrReg, unsigned long msrAddr, + unsigned long *ptrHigh, unsigned long *ptrLow); +void gfx_msr_asm_read(unsigned short msrReg, unsigned long msrAddr, + unsigned long *ptrHigh, unsigned long *ptrLow); + +#define MSR_READ( MBD_MSR_CAP, address, valueHigh_ptr, valueLow_ptr ) \ + gfx_msr_asm_read( ((unsigned short)(MBD_MSR_CAP)), address, \ + valueHigh_ptr, valueLow_ptr ) + +#define MSR_WRITE( MBD_MSR_CAP, address, valueHigh_ptr, valueLow_ptr ) \ + gfx_msr_asm_write( ((unsigned short)(MBD_MSR_CAP)), address, \ + valueHigh_ptr, valueLow_ptr ) + +/* OPTIMIZATION MACROS */ +/* The following macros have been added to allow more complete optimization of + * the bitmap-to-screen routines in Durango. These routines also allow + * Durango to run properly within a 16-bit environment. + * */ + +/***************************************************************************** + * Macro: SET_SCRATCH_BASE + * Purpose: Record the base address of the BLT buffers. The + * WRITE_SCRATCH_STRINGxx macros assume that this address is used + * as the base for all writes. + * + * Arguments: + * scratch_base - offset into the GX base for the first BLT buffer byte. + ****************************************************************************/ + +#define SET_SCRATCH_BASE(scratch_base) \ + { gfx_gx1_scratch_base = (unsigned long)gfx_virt_spptr + scratch_base; } + +#ifdef GFX_OPTIMIZE_ASSEMBLY + +/***************************************************************************** + * Macro: WRITE_SCRATCH_STRING + * Purpose: Write multiple bytes to the scratchpad buffer + * + * Arguments: + * dword_bytes - number of bytes to transfer. This number will always. + * be a multiple of 4. It cannot be modified within the + * macro (ex. bytes -= 4) + * bytes_extra - number of non-DWORD aligned bytes + * array - pointer to an array of unsigned characters. + * array_offset - offset into the array from which to pull the first + * character. + ****************************************************************************/ + +#define WRITE_SCRATCH_STRING(dwords, bytes, array, array_offset) \ +{ \ + _asm { mov edi, gfx_gx1_scratch_base } \ + _asm { mov esi, array } \ + _asm { add esi, array_offset } \ + _asm { mov ecx, dwords } \ + _asm { shr ecx, 2 } \ + _asm { rep movsd } \ + _asm { mov ecx, bytes } \ + _asm { rep movsb } \ +} + +/***************************************************************************** + * Macro: WRITE_FRAME_BUFFER_STRING32 + * Purpose: Write multiple dwords to the Frame buffer + * + * Arguments: + * fboffset - offset to the beginning frame buffer location. + * bytes - number of bytes to transfer. This number will always. + * be a multiple of 4. It cannot be modified within the + * macro (ex. bytes -= 4) + * array - pointer to an array of unsigned characters. + * array_offset - offset into the array from which to pull the first + * character. + ****************************************************************************/ + +#define WRITE_FRAME_BUFFER_STRING32(fboffset, bytes, array, array_offset) \ +{ \ + _asm { mov ecx, bytes } \ + _asm { shr ecx, 2 } \ + _asm { cld } \ + _asm { mov edi, gfx_virt_fbptr } \ + _asm { add edi, fboffset } \ + _asm { mov esi, array } \ + _asm { add esi, array_offset } \ + _asm { rep movsd } \ +} + +#else + +/***************************************************************************** + * Macro: WRITE_SCRATCH_STRING + * Purpose: Write multiple bytes to the scratchpad buffer + * + * Arguments: + * dword_bytes - number of bytes to transfer. This number will always. + * be a multiple of 4. It cannot be modified within the + * macro (ex. bytes -= 4) + * bytes_extra - number of non-DWORD aligned bytes + * array - pointer to an array of unsigned characters. + * array_offset - offset into the array from which to pull the first + * character. + ****************************************************************************/ + +#define WRITE_SCRATCH_STRING(dword_bytes, bytes_extra, array, array_offset) \ +{ \ + unsigned long i, j; \ + unsigned long aroffset = (unsigned long)array + (array_offset); \ + \ + /* WRITE DWORDS */ \ + \ + for (i = 0; i < dword_bytes; i += 4) \ + *((volatile unsigned long *)(gfx_gx1_scratch_base + i)) = \ + *((unsigned long *)(aroffset + i)); \ + \ + /* WRITE BYTES */ \ + \ + j = i + bytes_extra; \ + while (i < j) { \ + *((volatile unsigned char *)(gfx_gx1_scratch_base + i)) = \ + *((unsigned char *)(aroffset + i)); \ + i++; \ + } \ +} + +/***************************************************************************** + * Macro: WRITE_FRAME_BUFFER_STRING32 + * Purpose: Write multiple dwords to the Frame buffer + * + * Arguments: + * fboffset - offset to the beginning frame buffer location. + * bytes - number of bytes to transfer. This number will always. + * be a multiple of 4. It cannot be modified within the + * macro (ex. bytes -= 4) + * array - pointer to an array of unsigned characters. + * array_offset - offset into the array from which to pull the first + * character. + ****************************************************************************/ + +#define WRITE_FRAME_BUFFER_STRING32(fboffset, bytes, array, array_offset) \ +{ \ + unsigned long i; \ + unsigned long aroffset = (unsigned long)array + (array_offset); \ + for (i = 0; i < bytes; i += 4) \ + WRITE_FB32 ((fboffset) + i, *((unsigned long *)(aroffset + i))); \ +} + +#endif + +/***************************************************************************** + * Macro: WRITE_FRAME_BUFFER_STRING8 + * Purpose: Write multiple bytes to the frame buffer + * + * Arguments: + * spoffset - offset to the beginning frame buffer location. + * bytes - number of bytes to transfer. This number cannot be + * modified within the macro (ex. bytes -= 4) + * array - pointer to an array of unsigned characters. + * array_offset - offset into the array from which to pull the first + * character. + ****************************************************************************/ + +#define WRITE_FRAME_BUFFER_STRING8(fboffset, bytes, array, array_offset) \ +{ \ + unsigned long i; \ + unsigned long aroffset = (unsigned long)array + (array_offset); \ + for (i = 0; i < bytes; i++) \ + WRITE_FB8 ((fboffset) + i, *((unsigned char *)(aroffset + i))); \ +} + +/***************************************************************************** + * Macro: WRITE_GPREG_STRING32 + * Purpose: Write multiple dwords to one GP register. + * + * Arguments: + * regoffset - Offset of the GP register to be written. + * dwords - number of dwords to transfer. It cannot be modified + * within the macro (ex. dwords--) + * counter - name of a counter variable that can be used in a loop. + * This is used to optimize macros written in C. + * array - pointer to an array of unsigned characters. + * array_offset - offset into the array from which to pull the first + * character. + * temp - name of a temporary variable that can be used for + * calculations. + * This argument is also used for C-only macros. + ****************************************************************************/ + +#define WRITE_GPREG_STRING32(regoffset, dwords, counter, array, \ + array_offset, temp) \ +{ \ + temp = (unsigned long)array + (array_offset); \ + for (counter = 0; counter < dwords; counter++) \ + WRITE_GP32 (regoffset, *((unsigned long *)temp + counter)); \ +} + +/***************************************************************************** + * Macro: WRITE_GPREG_STRING8 + * Purpose: Write 4 or less bytes to one GP register. + * + * Arguments: + * regoffset - Offset of the GP register to be written. + * bytes - number of bytes to transfer. This number will always. + * be less than 4. It cannot be modified within the + * macro (ex. bytes--) + * shift - name of a shift variable that can be used as a shift + * count. + * This variable holds the initial shift value into the + * GP register. + * counter - name of a counter variable that can be used in a loop. + * This is used to optimize macros written in C. + * array - pointer to an array of unsigned characters. + * array_offset - offset into the array from which to pull the first + * character. + * temp1 - name of a temporary variable that can be used for + * calculations. + * This argument is also used for C-only macros. + * temp2 - name of a temporary variable that can be used for + * calculations. + * This argument is also used for C-only macros. + ****************************************************************************/ +#define WRITE_GPREG_STRING8(regoffset, bytes, shift, counter, array, \ + array_offset, temp1, temp2) \ +{ \ + if (bytes) { \ + temp1 = (unsigned long)array + (array_offset); \ + temp2 = 0; \ + for (counter = 0; counter < bytes; counter++) { \ + temp2 |= ((unsigned long)(*((unsigned char *)(temp1 + \ + counter)))) << shift; \ + shift += 8; \ + } \ + WRITE_GP32 (regoffset, temp2); \ + } \ +} + +/* END OF FILE */ diff --git a/driver/xf86-video-geode/src/gfx/gfx_disp.c b/driver/xf86-video-geode/src/gfx/gfx_disp.c new file mode 100644 index 000000000..6d32a358e --- /dev/null +++ b/driver/xf86-video-geode/src/gfx/gfx_disp.c @@ -0,0 +1,2593 @@ +/* Copyright (c) 2005 Advanced Micro Devices, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + * + * Neither the name of the Advanced Micro Devices, Inc. nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * */ + +/* + * This file contains routines to program the display controller. + * + * The "disp_gu1.c" and "disp_gu2.c" files implement the following routines: + * + * gfx_get_display_mode_count + * gfx_get_display_mode + * gfx_is_display_mode_supported + * gfx_get_display_details + * gfx_set_display_mode + * gfx_set_display_bpp + * gfx_set_display_timings + * gfx_set_vtotal + * gfx_get_display_pitch + * gfx_set_display_pitch + * gfx_set_display_offset + * gfx_set_display_palette + * gfx_set_display_palette_entry + * gfx_set_cursor_enable + * gfx_set_cursor_colors + * gfx_set_cursor_position + * gfx_set_cursor_shape32 + * gfx_set_cursor_shape64 + * gfx_set_compression_enable + * gfx_set_compression_offset + * gfx_set_compression_pitch + * gfx_set_compression_size + * gfx_set_display_priority_high + * gfx_test_timing_active + * gfx_test_vertical_active + * gfx_wait_vertical_blank + * gfx_reset_timing_lock + * + * And the following routines if GFX_READ_ROUTINES is set: + * + * gfx_get_hactive + * gfx_get_hblank_start + * gfx_get_hsync_start + * gfx_get_hsync_end + * gfx_get_hblank_end + * gfx_get_htotal + * gfx_get_vactive + * gfx_get_vblank_start + * gfx_get_vsync_start + * gfx_get_vsync_end + * gfx_get_vblank_end + * gfx_get_vtotal + * gfx_get_vline + * gfx_get_display_bpp + * gfx_get_display_offset + * gfx_get_display_palette + * gfx_get_cursor_enable + * gfx_get_cursor_base + * gfx_get_cursor_position + * gfx_get_cursor_offset + * gfx_get_cursor_color + * gfx_get_compression_enable + * gfx_get_compression_offset + * gfx_get_compression_pitch + * gfx_get_compression_size + * gfx_get_display_priority_high + * gfx_get_valid_bit + * */ + +unsigned short PanelWidth = 0; +unsigned short PanelHeight = 0; +unsigned short PanelEnable = 0; +unsigned short ModeWidth; +unsigned short ModeHeight; + +int DeltaX = 0; +int DeltaY = 0; +unsigned long prevstartAddr = 0; +unsigned long panelTop = 0; +unsigned long panelLeft = 0; + +int gbpp = 8; + +int gfx_compression_enabled = 0; +int gfx_compression_active = 0; +int gfx_line_double = 0; +int gfx_pixel_double = 0; +int gfx_timing_lock = 0; +DISPLAYMODE gfx_display_mode; + +/* DISPLAY MODE TIMINGS */ + +DISPLAYMODE DisplayParams[] = { + +/* 320 x 200 */ + + { + GFX_MODE_70HZ | /* refresh rate = 60 */ + GFX_MODE_8BPP | GFX_MODE_16BPP | /* 8 and 16 BPP valid */ + GFX_MODE_NEG_HSYNC | /* negative HSYNC */ + GFX_MODE_PIXEL_DOUBLE | /* Double width */ + GFX_MODE_LINE_DOUBLE, /* Double height */ + 0x140, 0x288, 0x290, 0x2F0, 0x318, 0x320, /* horizontal timings */ + 0x0C8, 0x197, 0x19C, 0x19E, 0x1BA, 0x1C1, /* vertical timings */ + 0x00192CCC, /* freq = 25.175 MHz */ + }, + +/* 320 x 240 */ + + { + GFX_MODE_75HZ | /* refresh rate = 75 */ + GFX_MODE_8BPP | GFX_MODE_16BPP | /* 8 and 16 BPP valid */ + GFX_MODE_NEG_HSYNC | GFX_MODE_NEG_VSYNC | /* negative syncs */ + GFX_MODE_PIXEL_DOUBLE | /* Double width */ + GFX_MODE_LINE_DOUBLE, /* Double height */ + 0x0140, 0x0280, 0x0290, 0x02D0, 0x0348, 0x0348, + /* horizontal timings */ + 0x00F0, 0x01E0, 0x01E1, 0x01E4, 0x01F4, 0x01F4, + /* vertical timings */ + 0x001F8000, /* freq = 31.5 MHz */ + }, + +/* 400 x 300 */ + + { + GFX_MODE_75HZ | /* refresh rate = 75 */ + GFX_MODE_8BPP | GFX_MODE_16BPP | /* 8 and 16 BPP valid */ + GFX_MODE_PIXEL_DOUBLE | /* Double width */ + GFX_MODE_LINE_DOUBLE, /* Double height */ + 0x0190, 0x0320, 0x0330, 0x0380, 0x0420, 0x0420, + /* horizontal timings */ + 0x012C, 0x0258, 0x0259, 0x025C, 0x0271, 0x0271, + /* vertical timings */ + 0x00318000, /* freq = 49.5 MHz */ + }, + +/* 512 x 384 */ + + { + GFX_MODE_75HZ | /* refresh rate = 75 */ + GFX_MODE_8BPP | GFX_MODE_16BPP | /* 8 and 16 BPP valid */ + GFX_MODE_PIXEL_DOUBLE | /* Double width */ + GFX_MODE_LINE_DOUBLE, /* Double height */ + 0x0200, 0x0400, 0x0410, 0x0470, 0x0520, 0x0520, + /* horizontal timings */ + 0x0180, 0x0300, 0x0301, 0x0304, 0x0320, 0x0320, + /* vertical timings */ + 0x004EC000, /* freq = 78.75 MHz */ + }, + +/* 640 x 400 */ + + { + GFX_MODE_70HZ | /* refresh rate = 60 */ + GFX_MODE_8BPP | GFX_MODE_12BPP | GFX_MODE_15BPP | + /* all BPP valid */ + GFX_MODE_16BPP | GFX_MODE_24BPP | GFX_MODE_NEG_HSYNC, + /* negative HSYNC */ + 0x280, 0x288, 0x290, 0x2F0, 0x318, 0x320, /* horizontal timings */ + 0x190, 0x197, 0x19C, 0x19E, 0x1BA, 0x1C1, /* vertical timings */ + 0x00192CCC, /* freq = 25.175 MHz */ + }, + +/* 640x480 */ + + { + GFX_MODE_60HZ | /* refresh rate = 60 */ + GFX_MODE_8BPP | GFX_MODE_12BPP | GFX_MODE_15BPP | + /* all BPP valid */ + GFX_MODE_16BPP | GFX_MODE_24BPP | GFX_MODE_NEG_HSYNC | GFX_MODE_NEG_VSYNC, /* negative syncs */ + 0x0280, 0x0288, 0x0290, 0x02E8, 0x0318, 0x0320, + /* horizontal timings */ + 0x01E0, 0x01E8, 0x01EA, 0x01EC, 0x0205, 0x020D, + /* vertical timings */ + 0x00192CCC, /* freq = 25.175 MHz */ + }, + + { + GFX_MODE_70HZ | /* refresh rate = 60 */ + GFX_MODE_8BPP | GFX_MODE_12BPP | GFX_MODE_15BPP | + /* all BPP valid */ + GFX_MODE_16BPP | GFX_MODE_24BPP, + 0x0280, 0x0280, 0x0298, 0x02D8, 0x0330, 0x0330, + /* horizontal timings */ + 0x01E0, 0x01E0, 0x01E2, 0x01E5, 0x01F4, 0x01F4, + /* vertical timings */ + 0x001C8F5C, /* freq = 28.560 MHz */ + }, + + { + GFX_MODE_72HZ | /* refresh rate = 72 */ + GFX_MODE_8BPP | GFX_MODE_12BPP | GFX_MODE_15BPP | + /* all BPP valid */ + GFX_MODE_16BPP | GFX_MODE_24BPP | GFX_MODE_NEG_HSYNC | GFX_MODE_NEG_VSYNC, /* negative syncs */ + 0x0280, 0x0288, 0x0298, 0x02c0, 0x0338, 0x0340, + /* horizontal timings */ + 0x01e0, 0x01e8, 0x01e9, 0x01ec, 0x0200, 0x0208, + /* vertical timings */ + 0x001F8000, /* freq = 31.5 MHz */ + }, + + { + GFX_MODE_75HZ | /* refresh rate = 75 */ + GFX_MODE_8BPP | GFX_MODE_12BPP | GFX_MODE_15BPP | + /* all BPP valid */ + GFX_MODE_16BPP | GFX_MODE_24BPP | GFX_MODE_NEG_HSYNC | GFX_MODE_NEG_VSYNC, /* negative syncs */ + 0x0280, 0x0280, 0x0290, 0x02D0, 0x0348, 0x0348, + /* horizontal timings */ + 0x01E0, 0x01E0, 0x01E1, 0x01E4, 0x01F4, 0x01F4, + /* vertical timings */ + 0x001F8000, /* freq = 31.5 MHz */ + }, + + { + GFX_MODE_85HZ | /* refresh rate = 85 */ + GFX_MODE_8BPP | GFX_MODE_12BPP | GFX_MODE_15BPP | + /* all BPP valid */ + GFX_MODE_16BPP | GFX_MODE_24BPP | GFX_MODE_NEG_HSYNC | GFX_MODE_NEG_VSYNC, /* negative syncs */ + 0x0280, 0x0280, 0x02B8, 0x02F0, 0x0340, 0x0340, + /* horizontal timings */ + 0x01E0, 0x01E0, 0x01E1, 0x01E4, 0x01FD, 0x01FD, + /* vertical timings */ + 0x00240000, /* freq = 36.0 MHz */ + }, + + { + GFX_MODE_90HZ | /* refresh rate = 90 */ + GFX_MODE_8BPP | GFX_MODE_12BPP | GFX_MODE_15BPP | + /* all BPP valid */ + GFX_MODE_16BPP | GFX_MODE_24BPP, + 0x0280, 0x0280, 0x02A0, 0x02E0, 0x0340, 0x0340, + /* horizontal timings */ + 0x01E0, 0x01E0, 0x01E1, 0x01E4, 0x01FA, 0x01FA, + /* vertical timings */ + 0x0025E395, /* freq = 37.889 MHz */ + }, + + { + GFX_MODE_100HZ | /* refresh rate = 100 */ + GFX_MODE_8BPP | GFX_MODE_12BPP | GFX_MODE_15BPP | + /* all BPP valid */ + GFX_MODE_16BPP | GFX_MODE_24BPP, + 0x0280, 0x0280, 0x02A8, 0x02E8, 0x0350, 0x0350, + /* horizontal timings */ + 0x01E0, 0x01E0, 0x01E1, 0x01E4, 0x01FD, 0x01FD, + /* vertical timings */ + 0x002B29BA, /* freq = 43.163 MHz */ + }, + +/* 800x600 */ + + { + GFX_MODE_56HZ | /* refresh rate = 56 */ + GFX_MODE_8BPP | GFX_MODE_12BPP | GFX_MODE_15BPP | + /* all BPP valid */ + GFX_MODE_16BPP | GFX_MODE_24BPP, + 0x0320, 0x0320, 0x0338, 0x0380, 0x0400, 0x0400, + /* horizontal timings */ + 0x0258, 0x0258, 0x0259, 0x025B, 0x0271, 0x0271, + /* vertical timings */ + 0x00240000, /* freq = 36.00 MHz */ + }, + + { + GFX_MODE_60HZ | /* refresh rate = 60 */ + GFX_MODE_8BPP | GFX_MODE_12BPP | GFX_MODE_15BPP | + /* all BPP valid */ + GFX_MODE_16BPP | GFX_MODE_24BPP, + 0x0320, 0x0328, 0x0348, 0x03D0, 0x0418, 0x0420, + /* horizontal timings */ + 0x0258, 0x0258, 0x0259, 0x025D, 0x0274, 0x0274, + /* vertical timings */ + 0x00280000, /* freq = 40.00 MHz */ + }, + + { + GFX_MODE_70HZ | /* refresh rate = 70 */ + GFX_MODE_8BPP | GFX_MODE_12BPP | GFX_MODE_15BPP | + /* all BPP valid */ + GFX_MODE_16BPP | GFX_MODE_24BPP, + 0x0320, 0x0320, 0x0348, 0x0398, 0x0410, 0x0410, + /* horizontal timings */ + 0x0258, 0x0258, 0x025c, 0x025F, 0x0274, 0x0274, + /* vertical timings */ + 0x002DB851, /* freq = 45.72 MHz */ + }, + + { + GFX_MODE_72HZ | /* refresh rate = 72 */ + GFX_MODE_8BPP | GFX_MODE_12BPP | GFX_MODE_15BPP | + /* all BPP valid */ + GFX_MODE_16BPP | GFX_MODE_24BPP, + 0x0320, 0x0320, 0x0358, 0x03D0, 0x0410, 0x0410, + /* horizontal timings */ + 0x0258, 0x0258, 0x027D, 0x0283, 0x029A, 0x029A, + /* vertical timings */ + 0x00320000, /* freq = 49.5 MHz */ + }, + + { + GFX_MODE_75HZ | /* refresh rate = 75 */ + GFX_MODE_8BPP | GFX_MODE_12BPP | GFX_MODE_15BPP | + /* all BPP valid */ + GFX_MODE_16BPP | GFX_MODE_24BPP, + 0x0320, 0x0320, 0x0330, 0x0380, 0x0420, 0x0420, + /* horizontal timings */ + 0x0258, 0x0258, 0x0259, 0x025C, 0x0271, 0x0271, + /* vertical timings */ + 0x00318000, /* freq = 49.5 MHz */ + }, + + { + GFX_MODE_85HZ | /* refresh rate = 85 */ + GFX_MODE_8BPP | GFX_MODE_12BPP | GFX_MODE_15BPP | + /* all BPP valid */ + GFX_MODE_16BPP | GFX_MODE_24BPP, + 0x0320, 0x0320, 0x0340, 0x0380, 0x0418, 0x0418, + /* horizontal timings */ + 0x0258, 0x0258, 0x0259, 0x025C, 0x0277, 0x0277, + /* vertical timings */ + 0x00384000, /* freq = 56.25 MHz */ + }, + + { + GFX_MODE_90HZ | /* refresh rate = 90 */ + GFX_MODE_8BPP | GFX_MODE_12BPP | GFX_MODE_15BPP | + /* all BPP valid */ + GFX_MODE_16BPP | GFX_MODE_24BPP, + 0x0320, 0x0320, 0x0348, 0x03A0, 0x0420, 0x0420, + /* horizontal timings */ + 0x0258, 0x0258, 0x0259, 0x025C, 0x0278, 0x0278, + /* vertical timings */ + 0x003C10A3, /* freq = 60.065 MHz */ + }, + + { + GFX_MODE_100HZ | /* refresh rate = 100 */ + GFX_MODE_8BPP | GFX_MODE_12BPP | GFX_MODE_15BPP | + /* all BPP valid */ + GFX_MODE_16BPP | GFX_MODE_24BPP, + 0x0320, 0x0320, 0x0350, 0x03A8, 0x0430, 0x0430, + /* horizontal timings */ + 0x0258, 0x0258, 0x0259, 0x025C, 0x0277, 0x027C, + /* vertical timings */ + 0x00442DD2, /* freq = 68.179 MHz */ + }, + +/* 1024x768 */ + + { + GFX_MODE_60HZ | /* refresh rate = 60 */ + GFX_MODE_8BPP | GFX_MODE_12BPP | GFX_MODE_15BPP | + /* all BPP valid */ + GFX_MODE_16BPP | GFX_MODE_24BPP | GFX_MODE_NEG_HSYNC | GFX_MODE_NEG_VSYNC, /* negative syncs */ + 0x0400, 0x0400, 0x0418, 0x04A0, 0x0540, 0x0540, + /* horizontal timings */ + 0x0300, 0x0300, 0x0303, 0x0309, 0x0326, 0x0326, + /* vertical timings */ + 0x00410000, /* freq = 65.00 MHz */ + }, + + { + GFX_MODE_70HZ | /* refresh rate = 70 */ + GFX_MODE_8BPP | GFX_MODE_12BPP | GFX_MODE_15BPP | + /* all BPP valid */ + GFX_MODE_16BPP | GFX_MODE_24BPP | GFX_MODE_NEG_HSYNC | GFX_MODE_NEG_VSYNC, /* negative syncs */ + 0x0400, 0x0400, 0x0418, 0x04A0, 0x0530, 0x0530, + /* horizontal timings */ + 0x0300, 0x0300, 0x0303, 0x0309, 0x0326, 0x0326, + /* vertical timings */ + 0x004B0000, /* freq = 75.00 MHz */ + }, + + { + GFX_MODE_72HZ | /* refresh rate = 72 */ + GFX_MODE_8BPP | GFX_MODE_12BPP | GFX_MODE_15BPP | + /* all BPP valid */ + GFX_MODE_16BPP | GFX_MODE_24BPP, + 0x0400, 0x0400, 0x0438, 0x04A8, 0x0550, 0x0550, + /* horizontal timings */ + 0x0300, 0x0300, 0x0304, 0x0307, 0x0324, 0x0324, + /* vertical timings */ + 0x004EC000, /* freq = 78.75 MHz */ + }, + + { + GFX_MODE_75HZ | /* refresh rate = 75 */ + GFX_MODE_8BPP | GFX_MODE_12BPP | GFX_MODE_15BPP | + /* all BPP valid */ + GFX_MODE_16BPP | GFX_MODE_24BPP, + 0x0400, 0x0400, 0x0410, 0x0470, 0x0520, 0x0520, + /* horizontal timings */ + 0x0300, 0x0300, 0x0301, 0x0304, 0x0320, 0x0320, + /* vertical timings */ + 0x004EC000, /* freq = 78.75 MHz */ + }, + + { + GFX_MODE_85HZ | /* refresh rate = 85 */ + GFX_MODE_8BPP | GFX_MODE_12BPP | GFX_MODE_15BPP | + /* all BPP valid */ + GFX_MODE_16BPP | GFX_MODE_24BPP, + 0x0400, 0x0400, 0x0430, 0x0490, 0x0560, 0x0560, + /* horizontal timings */ + 0x0300, 0x0300, 0x0301, 0x0304, 0x0328, 0x0328, + /* vertical timings */ + 0x005E8000, /* freq = 94.50 MHz */ + }, + + { + GFX_MODE_90HZ | /* refresh rate = 90 */ + GFX_MODE_8BPP | GFX_MODE_12BPP | GFX_MODE_15BPP | + /* all BPP valid */ + GFX_MODE_16BPP | GFX_MODE_24BPP, + 0x0400, 0x0400, 0x0440, 0x04B0, 0x0560, 0x0560, + /* horizontal timings */ + 0x0300, 0x0300, 0x0301, 0x0304, 0x0329, 0x0329, + /* vertical timings */ + 0x00642FDF, /* freq = 100.187 MHz */ + }, + + { + GFX_MODE_100HZ | /* refresh rate = 100 */ + GFX_MODE_8BPP | GFX_MODE_12BPP | GFX_MODE_15BPP | + /* all BPP valid */ + GFX_MODE_16BPP | GFX_MODE_24BPP, + 0x0400, 0x0400, 0x0448, 0x04B8, 0x0570, 0x0570, + /* horizontal timings */ + 0x0300, 0x0300, 0x0301, 0x0304, 0x032E, 0x032E, + /* vertical timings */ + 0x00714F1A, /* freq = 113.309 MHz */ + }, + +/* 1152x864 */ + + { + GFX_MODE_60HZ | /* refresh rate = 60 */ + GFX_MODE_8BPP | GFX_MODE_12BPP | GFX_MODE_15BPP | + /* all BPP valid */ + GFX_MODE_16BPP | GFX_MODE_24BPP, + 0x0480, 0x0480, 0x04C0, 0x0538, 0x05F0, 0x05F0, + /* horizontal timings */ + 0x0360, 0x0360, 0x0361, 0x0364, 0x037F, 0x037F, + /* vertical timings */ + 0x00519999, /* freq = 81.60 MHz */ + }, + + { + GFX_MODE_70HZ | /* refresh rate = 70 */ + GFX_MODE_8BPP | GFX_MODE_12BPP | GFX_MODE_15BPP | + /* all BPP valid */ + GFX_MODE_16BPP | GFX_MODE_24BPP, + 0x0480, 0x0480, 0x04C8, 0x0540, 0x0600, 0x0600, + /* horizontal timings */ + 0x0360, 0x0360, 0x0368, 0x036B, 0x038B, 0x038B, + /* vertical timings */ + 0x00618560, /* freq = 97.521 MHz */ + }, + + { + GFX_MODE_72HZ | /* refresh rate = 70 */ + GFX_MODE_8BPP | GFX_MODE_12BPP | GFX_MODE_15BPP | + /* all BPP valid */ + GFX_MODE_16BPP | GFX_MODE_24BPP, + 0x0480, 0x0480, 0x04C8, 0x0548, 0x0610, 0x0610, + /* horizontal timings */ + 0x0360, 0x0360, 0x0367, 0x036A, 0x038B, 0x038B, + /* vertical timings */ + 0x00656B85, /* freq = 101.42 MHz */ + }, + + { + GFX_MODE_75HZ | /* refresh rate = 75 */ + GFX_MODE_8BPP | GFX_MODE_12BPP | GFX_MODE_15BPP | + /* all BPP valid */ + GFX_MODE_16BPP | GFX_MODE_24BPP, + 0x0480, 0x0480, 0x04C0, 0x0540, 0x0640, 0x0640, + /* horizontal timings */ + 0x0360, 0x0360, 0x0361, 0x0364, 0x0384, 0x0384, + /* vertical timings */ + 0x006C0000, /* freq = 108.00 MHz */ + }, + + { + GFX_MODE_85HZ | /* refresh rate = 85 */ + GFX_MODE_8BPP | GFX_MODE_12BPP | GFX_MODE_15BPP | + /* all BPP valid */ + GFX_MODE_16BPP | GFX_MODE_24BPP, + 0x0480, 0x0480, 0x04C8, 0x0548, 0x0610, 0x0610, + /* horizontal timings */ + 0x0360, 0x0360, 0x0363, 0x0366, 0x038B, 0x038B, + /* vertical timings */ + 0x0077A666, /* freq = 119.65 MHz */ + }, + + { + GFX_MODE_90HZ | /* refresh rate = 90 */ + GFX_MODE_8BPP | GFX_MODE_12BPP | GFX_MODE_15BPP | + /* all BPP valid */ + GFX_MODE_16BPP | GFX_MODE_24BPP, + 0x0480, 0x0480, 0x04D0, 0x0550, 0x0620, 0x0620, + /* horizontal timings */ + 0x0360, 0x0360, 0x0363, 0x0366, 0x038E, 0x038E, + /* vertical timings */ + 0x00806666, /* freq = 128.40 MHz */ + }, + + { + GFX_MODE_100HZ | /* refresh rate = 100 */ + GFX_MODE_8BPP | GFX_MODE_12BPP | GFX_MODE_15BPP | + /* all BPP valid */ + GFX_MODE_16BPP | GFX_MODE_24BPP, + 0x0480, 0x0480, 0x04D0, 0x0550, 0x0620, 0x0620, + /* horizontal timings */ + 0x0360, 0x0360, 0x0365, 0x0368, 0x0398, 0x0398, + /* vertical timings */ + 0x00906147, /* freq = 144.38 MHz */ + }, + +/* 1280x1024 */ + + { + GFX_MODE_60HZ | /* refresh rate = 60 */ + GFX_MODE_8BPP | GFX_MODE_12BPP | GFX_MODE_15BPP | + /* all BPP valid */ + GFX_MODE_16BPP | GFX_MODE_24BPP, + 0x0500, 0x0500, 0x0530, 0x05A0, 0x0698, 0x0698, + /* horizontal timings */ + 0x0400, 0x0400, 0x0401, 0x0404, 0x042A, 0x042A, + /* vertical timings */ + 0x006C0000, /* freq = 108.0 MHz */ + }, + + { + GFX_MODE_70HZ | /* refresh rate = 70 */ + GFX_MODE_8BPP | GFX_MODE_12BPP | GFX_MODE_15BPP | + /* all BPP valid */ + GFX_MODE_16BPP | GFX_MODE_24BPP, + 0x0500, 0x0500, 0x0558, 0x05E0, 0x06C0, 0x06C0, + /* horizontal timings */ + 0x0400, 0x0400, 0x040A, 0x040D, 0x0433, 0x0433, + /* vertical timings */ + 0x00821999, /* freq = 130.1 MHz */ + }, + + { + GFX_MODE_72HZ | /* refresh rate = 72 */ + GFX_MODE_8BPP | GFX_MODE_12BPP | GFX_MODE_15BPP | + /* all BPP valid */ + GFX_MODE_16BPP | GFX_MODE_24BPP, + 0x0500, 0x0500, 0x0558, 0x05E0, 0x06C0, 0x06C0, + /* horizontal timings */ + 0x0400, 0x0400, 0x0407, 0x040A, 0x0431, 0x0431, + /* vertical timings */ + 0x00858000, /* freq = 133.5 MHz */ + }, + + { + GFX_MODE_75HZ | /* refresh rate = 75 */ + GFX_MODE_8BPP | GFX_MODE_12BPP | GFX_MODE_15BPP | + /* all BPP valid */ + GFX_MODE_16BPP | GFX_MODE_24BPP, + 0x0500, 0x0500, 0x0510, 0x05A0, 0x0698, 0x0698, + /* horizontal timings */ + 0x0400, 0x0400, 0x0401, 0x0404, 0x042A, 0x042A, + /* vertical timings */ + 0x00870000, /* freq = 135.0 MHz */ + }, + + { + GFX_MODE_85HZ | /* refresh rate = 85 */ + GFX_MODE_8BPP | GFX_MODE_12BPP | GFX_MODE_15BPP | + /* all BPP valid */ + GFX_MODE_16BPP | GFX_MODE_24BPP, + 0x0500, 0x0500, 0x0540, 0x05E0, 0x06C0, 0x06C0, + /* horizontal timings */ + 0x0400, 0x0400, 0x0401, 0x0404, 0x0430, 0x0430, + /* vertical timings */ + 0x009D8000, /* freq = 157.5 MHz */ + }, + + { + GFX_MODE_90HZ | /* refresh rate = 90 */ + GFX_MODE_8BPP | GFX_MODE_12BPP | GFX_MODE_15BPP | + /* all BPP valid */ + GFX_MODE_16BPP | GFX_MODE_24BPP, + 0x0500, 0x0500, 0x0560, 0x05E8, 0x06D0, 0x06D0, + /* horizontal timings */ + 0x0400, 0x0400, 0x0401, 0x0404, 0x0436, 0x0436, + /* vertical timings */ + 0x00A933F7, /* freq = 169.203 MHz */ + }, + + { + GFX_MODE_100HZ | /* refresh rate = 100 */ + GFX_MODE_8BPP | GFX_MODE_12BPP | GFX_MODE_15BPP | + /* all BPP valid */ + GFX_MODE_16BPP | GFX_MODE_24BPP, + 0x0500, 0x0500, 0x0560, 0x05F0, 0x06E0, 0x06E0, + /* horizontal timings */ + 0x0400, 0x0400, 0x0401, 0x0404, 0x043D, 0x043D, + /* vertical timings */ + 0x00BEF5C2, /* freq = 190.96 MHz */ + }, + +/*********************************/ +/* BEGIN REDCLOUD-SPECIFIC MODES */ +/*-------------------------------*/ + +/* 1600 x 1200 */ + + { + GFX_MODE_60HZ | /* refresh rate = 60 */ + GFX_MODE_8BPP | GFX_MODE_12BPP | GFX_MODE_15BPP | + /* all BPP valid */ + GFX_MODE_16BPP | GFX_MODE_24BPP, + 0x0640, 0x0640, 0x0680, 0x0740, 0x0870, 0x0870, + /* horizontal timings */ + 0x04B0, 0x04B0, 0x04B1, 0x04B4, 0x04E2, 0x04E2, + /* vertical timings */ + 0x00A20000, /* freq = 162.0 MHz */ + }, + + { + GFX_MODE_70HZ | /* refresh rate = 70 */ + GFX_MODE_8BPP | GFX_MODE_12BPP | GFX_MODE_15BPP | + /* all BPP valid */ + GFX_MODE_16BPP | GFX_MODE_24BPP, + 0x0640, 0x0640, 0x0680, 0x0740, 0x0870, 0x0870, + /* horizontal timings */ + 0x04B0, 0x04B0, 0x04B1, 0x04B4, 0x04E2, 0x04E2, + /* vertical timings */ + 0x00BD0000, /* freq = 189.0 MHz */ + }, + + { + GFX_MODE_72HZ | /* refresh rate = 72 */ + GFX_MODE_8BPP | GFX_MODE_12BPP | GFX_MODE_15BPP | + /* all BPP valid */ + GFX_MODE_16BPP | GFX_MODE_24BPP, + 0x0640, 0x0640, 0x06B0, 0x0760, 0x0880, 0x0880, + /* horizontal timings */ + 0x04B0, 0x04B0, 0x04BD, 0x04C0, 0x04EF, 0x04EF, + /* vertical timings */ + 0x00C60000, /* freq = 198.0 MHz */ + }, + + { + GFX_MODE_75HZ | /* refresh rate = 75 */ + GFX_MODE_8BPP | GFX_MODE_12BPP | GFX_MODE_15BPP | + /* all BPP valid */ + GFX_MODE_16BPP | GFX_MODE_24BPP, + 0x0640, 0x0640, 0x0680, 0x0740, 0x0870, 0x0870, + /* horizontal timings */ + 0x04B0, 0x04B0, 0x04B1, 0x04B4, 0x04E2, 0x04E2, + /* vertical timings */ + 0x00CA8000, /* freq = 202.5 MHz */ + }, + + { + GFX_MODE_85HZ | /* refresh rate = 85 */ + GFX_MODE_8BPP | GFX_MODE_12BPP | GFX_MODE_15BPP | + /* all BPP valid */ + GFX_MODE_16BPP | GFX_MODE_24BPP, + 0x0640, 0x0640, 0x0680, 0x0740, 0x0870, 0x0870, + /* horizontal timings */ + 0x04B0, 0x04B0, 0x04B1, 0x04B4, 0x04E2, 0x04E2, + /* vertical timings */ + 0x00E58000, /* freq = 229.5 MHz */ + }, +}; + +/* UPDATE THIS VARIABLE WHENEVER NEW REDCLOUD-SPECIFIC MODES ARE ADDED */ + +#define REDCLOUD_SPECIFIC_MODES 4 + +#define NUM_RC_DISPLAY_MODES sizeof(DisplayParams) / sizeof(DISPLAYMODE) +#define NUM_GX_DISPLAY_MODES (NUM_RC_DISPLAY_MODES - REDCLOUD_SPECIFIC_MODES) + +FIXEDTIMINGS FixedParams[] = { +/* 640x480 Panel */ + {640, 480, 640, 480, + 0x0280, 0x0280, 0x0290, 0x02E8, 0x0318, 0x0320, + 0x01E0, 0x01E0, 0x01EA, 0x01EC, 0x0205, 0x020D, + 0x00192CCC, + }, + + {640, 480, 800, 600, + 0x0280, 0x0280, 0x0290, 0x02E8, 0x0318, 0x0320, + 0x01E0, 0x01E0, 0x01EA, 0x01EC, 0x0205, 0x020D, + 0x00192CCC, + }, + + {640, 480, 1024, 768, + 0x0280, 0x0280, 0x0290, 0x02E8, 0x0318, 0x0320, + 0x01E0, 0x01E0, 0x01EA, 0x01EC, 0x0205, 0x020D, + 0x00192CCC, + }, + + {640, 480, 1152, 864, + 0x0280, 0x0280, 0x0290, 0x02E8, 0x0318, 0x0320, + 0x01E0, 0x01E0, 0x01EA, 0x01EC, 0x0205, 0x020D, + 0x00192CCC, + }, + + {640, 480, 1280, 1024, + 0x0280, 0x0280, 0x0290, 0x02E8, 0x0318, 0x0320, + 0x01E0, 0x01E0, 0x01EA, 0x01EC, 0x0205, 0x020D, + 0x00192CCC, + }, + + {640, 480, 1600, 1200, + 0x0280, 0x0280, 0x0290, 0x02E8, 0x0318, 0x0320, + 0x01E0, 0x01E0, 0x01EA, 0x01EC, 0x0205, 0x020D, + 0x00192CCC, + }, + +/* 800x600 Panel */ + {800, 600, 640, 480, + 0x0280, 0x2d0, 0x2f8, 0x378, 0x3d0, 0x420, + 0x1e0, 0x21c, 0x21d, 0x221, 0x238, 0x274, + 0x00280000, + }, + + {800, 600, 800, 600, + 0x320, 0x320, 0x348, 0x3c8, 0x420, 0x420, + 0x258, 0x258, 0x259, 0x25d, 0x274, 0x274, + 0x00280000, + }, + + {800, 600, 1024, 768, + 0x320, 0x320, 0x348, 0x3c8, 0x420, 0x420, + 0x258, 0x258, 0x259, 0x25d, 0x274, 0x274, + 0x00280000, + }, + + {800, 600, 1152, 864, + 0x320, 0x320, 0x348, 0x3c8, 0x420, 0x420, + 0x258, 0x258, 0x259, 0x25d, 0x274, 0x274, + 0x00280000, + }, + + {800, 600, 1280, 1024, + 0x320, 0x320, 0x348, 0x3c8, 0x420, 0x420, + 0x258, 0x258, 0x259, 0x25d, 0x274, 0x274, + 0x00280000, + }, + + {800, 600, 1600, 1200, + 0x320, 0x320, 0x348, 0x3c8, 0x420, 0x420, + 0x258, 0x258, 0x259, 0x25d, 0x274, 0x274, + 0x00280000, + }, + +/* 1024x768 panel */ + {1024, 768, 640, 480, + 0x0280, 0x340, 0x368, 0x3e8, 0x480, 0x540, + 0x1e0, 0x270, 0x271, 0x275, 0x296, 0x326, + 0x00410000, + }, + + {1024, 768, 800, 600, + 0x0320, 0x390, 0x3b8, 0x438, 0x4D0, 0x540, + 0x258, 0x2ac, 0x2ad, 0x2b1, 0x2D2, 0x326, + 0x00410000, + }, + + {1024, 768, 1024, 768, + 0x0400, 0x0400, 0x0418, 0x04A0, 0x0540, 0x0540, + 0x0300, 0x0300, 0x0303, 0x0309, 0x0326, 0x0326, + 0x00410000, + }, + + {1024, 768, 1152, 864, + 0x0400, 0x0400, 0x0418, 0x04A0, 0x0540, 0x0540, + 0x0300, 0x0300, 0x0303, 0x0309, 0x0326, 0x0326, + 0x00410000, + }, + + {1024, 768, 1280, 1024, + 0x0400, 0x0400, 0x0418, 0x04A0, 0x0540, 0x0540, + 0x0300, 0x0300, 0x0303, 0x0309, 0x0326, 0x0326, + 0x00410000, + }, + + {1024, 768, 1600, 1200, + 0x0400, 0x0400, 0x0418, 0x04A0, 0x0540, 0x0540, + 0x0300, 0x0300, 0x0303, 0x0309, 0x0326, 0x0326, + 0x00410000, + }, + +/* 1280x1024 panel */ + {1280, 1024, 640, 480, + 640, 960, 1008, 1120, 1368, 1688, + 480, 752, 753, 756, 794, 1066, + 0x006C0000, + }, + + {1280, 1024, 800, 600, + 800, 1040, 1088, 1200, 1448, 1688, + 600, 812, 813, 816, 854, 1066, + 0x006C0000, + }, + + {1280, 1024, 1024, 768, + 1024, 1152, 1200, 1312, 1560, 1688, + 768, 896, 897, 900, 938, 1066, + 0x006C0000, + }, + + {1280, 1024, 1152, 864, + 1152, 1216, 1264, 1376, 1624, 1688, + 864, 944, 945, 948, 986, 1066, + 0x006C0000, + }, + + {1280, 1024, 1280, 1024, + 1280, 1280, 1328, 1440, 1688, 1688, + 1024, 1024, 1025, 1028, 1066, 1066, + 0x006C0000, + }, + +}; + +#define NUM_FIXED_TIMINGS_MODES sizeof(FixedParams)/sizeof(FIXEDTIMINGS) + +/* INCLUDE SUPPORT FOR FIRST GENERATION, IF SPECIFIED. */ + +#if GFX_DISPLAY_GU1 +#include "disp_gu1.c" +#endif + +/* INCLUDE SUPPORT FOR SECOND GENERATION, IF SPECIFIED. */ + +#if GFX_DISPLAY_GU2 +#include "disp_gu2.c" +#endif + +/*--------------------------------------------------------------------------- + * gfx_reset_timing_lock + * + * This routine resets the timing change lock. The lock can only be set by + * setting a flag when calling mode set. + *--------------------------------------------------------------------------- + */ +void +gfx_reset_timing_lock(void) +{ + gfx_timing_lock = 0; +} + +/* WRAPPERS IF DYNAMIC SELECTION */ +/* Extra layer to call either first or second generation routines. */ + +#if GFX_DISPLAY_DYNAMIC + +/*--------------------------------------------------------------------------- + * gfx_set_display_bpp + *--------------------------------------------------------------------------- + */ +int +gfx_set_display_bpp(unsigned short bpp) +{ + int retval = 0; + +#if GFX_DISPLAY_GU1 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU1) + retval = gu1_set_display_bpp(bpp); +#endif +#if GFX_DISPLAY_GU2 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU2) + retval = gu2_set_display_bpp(bpp); +#endif + return (retval); +} + +/*--------------------------------------------------------------------------- + * gfx_is_display_mode_supported + * check if given mode supported, + * return the supported mode on success, -1 on fail + *--------------------------------------------------------------------------- + */ +int +gfx_is_display_mode_supported(int xres, int yres, int bpp, int hz) +{ + int retval = -1; + +#if GFX_DISPLAY_GU1 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU1) + retval = gu1_is_display_mode_supported(xres, yres, bpp, hz); +#endif +#if GFX_DISPLAY_GU2 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU2) + retval = gu2_is_display_mode_supported(xres, yres, bpp, hz); +#endif + return (retval); +} + +/*--------------------------------------------------------------------------- + * gfx_set_display_mode + *--------------------------------------------------------------------------- + */ +int +gfx_set_display_mode(int xres, int yres, int bpp, int hz) +{ + int retval = 0; + +#if GFX_DISPLAY_GU1 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU1) + retval = gu1_set_display_mode(xres, yres, bpp, hz); +#endif +#if GFX_DISPLAY_GU2 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU2) + retval = gu2_set_display_mode(xres, yres, bpp, hz); +#endif + return (retval); +} + +/*--------------------------------------------------------------------------- + * gfx_set_display_timings + *--------------------------------------------------------------------------- + */ +int +gfx_set_display_timings(unsigned short bpp, unsigned short flags, + unsigned short hactive, unsigned short hblankstart, + unsigned short hsyncstart, unsigned short hsyncend, + unsigned short hblankend, unsigned short htotal, + unsigned short vactive, unsigned short vblankstart, + unsigned short vsyncstart, unsigned short vsyncend, + unsigned short vblankend, unsigned short vtotal, unsigned long frequency) +{ + int retval = 0; + +#if GFX_DISPLAY_GU1 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU1) + retval = gu1_set_display_timings(bpp, flags, + hactive, hblankstart, hsyncstart, hsyncend, hblankend, htotal, + vactive, vblankstart, vsyncstart, vsyncend, vblankend, vtotal, + frequency); +#endif +#if GFX_DISPLAY_GU2 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU2) + retval = gu2_set_display_timings(bpp, flags, + hactive, hblankstart, hsyncstart, hsyncend, hblankend, htotal, + vactive, vblankstart, vsyncstart, vsyncend, vblankend, vtotal, + frequency); +#endif + return (retval); +} + +/*--------------------------------------------------------------------------- + * gfx_set_display_pitch + *--------------------------------------------------------------------------- + */ +void +gfx_set_display_pitch(unsigned short pitch) +{ +#if GFX_DISPLAY_GU1 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU1) + gu1_set_display_pitch(pitch); +#endif +#if GFX_DISPLAY_GU2 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU2) + gu2_set_display_pitch(pitch); +#endif +} + +/*--------------------------------------------------------------------------- + * gfx_set_display_offset + *--------------------------------------------------------------------------- + */ +void +gfx_set_display_offset(unsigned long offset) +{ +#if GFX_DISPLAY_GU1 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU1) + gu1_set_display_offset(offset); +#endif +#if GFX_DISPLAY_GU2 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU2) + gu2_set_display_offset(offset); +#endif +} + +/*--------------------------------------------------------------------------- + * gfx_set_display_palette_entry + *--------------------------------------------------------------------------- + */ +int +gfx_set_display_palette_entry(unsigned long index, unsigned long palette) +{ + int status = 0; + +#if GFX_DISPLAY_GU1 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU1) + status = gu1_set_display_palette_entry(index, palette); +#endif +#if GFX_DISPLAY_GU2 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU2) + status = gu2_set_display_palette_entry(index, palette); +#endif + return (status); +} + +/*--------------------------------------------------------------------------- + * gfx_set_display_palette + *--------------------------------------------------------------------------- + */ +int +gfx_set_display_palette(unsigned long *palette) +{ + int status = 0; + +#if GFX_DISPLAY_GU1 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU1) + status = gu1_set_display_palette(palette); +#endif +#if GFX_DISPLAY_GU2 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU2) + status = gu2_set_display_palette(palette); +#endif + return (status); +} + +/*--------------------------------------------------------------------------- + * gfx_set_cursor_enable + *--------------------------------------------------------------------------- + */ +void +gfx_set_cursor_enable(int enable) +{ +#if GFX_DISPLAY_GU1 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU1) + gu1_set_cursor_enable(enable); +#endif +#if GFX_DISPLAY_GU2 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU2) + gu2_set_cursor_enable(enable); +#endif +} + +/*--------------------------------------------------------------------------- + * gfx_set_cursor_colors + *--------------------------------------------------------------------------- + */ +void +gfx_set_cursor_colors(unsigned long bkcolor, unsigned long fgcolor) +{ +#if GFX_DISPLAY_GU1 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU1) + gu1_set_cursor_colors(bkcolor, fgcolor); +#endif +#if GFX_DISPLAY_GU2 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU2) + gu2_set_cursor_colors(bkcolor, fgcolor); +#endif +} + +/*--------------------------------------------------------------------------- + * gfx_set_cursor_position + *--------------------------------------------------------------------------- + */ +void +gfx_set_cursor_position(unsigned long memoffset, + unsigned short xpos, unsigned short ypos, + unsigned short xhotspot, unsigned short yhotspot) +{ +#if GFX_DISPLAY_GU1 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU1) + gu1_set_cursor_position(memoffset, xpos, ypos, xhotspot, yhotspot); +#endif +#if GFX_DISPLAY_GU2 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU2) + gu2_set_cursor_position(memoffset, xpos, ypos, xhotspot, yhotspot); +#endif +} + +/*--------------------------------------------------------------------------- + * gfx_set_cursor_shape32 + *--------------------------------------------------------------------------- + */ +void +gfx_set_cursor_shape32(unsigned long memoffset, + unsigned long *andmask, unsigned long *xormask) +{ +#if GFX_DISPLAY_GU1 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU1) + gu1_set_cursor_shape32(memoffset, andmask, xormask); +#endif +#if GFX_DISPLAY_GU2 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU2) + gu2_set_cursor_shape32(memoffset, andmask, xormask); +#endif +} + +/*--------------------------------------------------------------------------- + * gfx_set_cursor_shape64 + *--------------------------------------------------------------------------- + */ +void +gfx_set_cursor_shape64(unsigned long memoffset, + unsigned long *andmask, unsigned long *xormask) +{ +#if GFX_DISPLAY_GU2 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU2) + gu2_set_cursor_shape64(memoffset, andmask, xormask); +#endif +} + +/*--------------------------------------------------------------------------- + * gfx_set_icon_enable + *--------------------------------------------------------------------------- + */ +void +gfx_set_icon_enable(int enable) +{ +#if GFX_DISPLAY_GU2 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU2) + gu2_set_icon_enable(enable); +#endif +} + +/*--------------------------------------------------------------------------- + * gfx_set_icon_colors + *--------------------------------------------------------------------------- + */ +void +gfx_set_icon_colors(unsigned long color0, unsigned long color1, + unsigned long color2) +{ +#if GFX_DISPLAY_GU2 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU2) + gu2_set_icon_colors(color0, color1, color2); +#endif +} + +/*--------------------------------------------------------------------------- + * gfx_set_icon_position + *--------------------------------------------------------------------------- + */ +void +gfx_set_icon_position(unsigned long memoffset, unsigned short xpos) +{ +#if GFX_DISPLAY_GU2 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU2) + gu2_set_icon_position(memoffset, xpos); +#endif +} + +/*--------------------------------------------------------------------------- + * gfx_set_icon_shape64 + *--------------------------------------------------------------------------- + */ +void +gfx_set_icon_shape64(unsigned long memoffset, + unsigned long *andmask, unsigned long *xormask, unsigned int lines) +{ +#if GFX_DISPLAY_GU2 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU2) + gu2_set_icon_shape64(memoffset, andmask, xormask, lines); +#endif +} + +/*--------------------------------------------------------------------------- + * gfx_set_compression_enable + *--------------------------------------------------------------------------- + */ +int +gfx_set_compression_enable(int enable) +{ + int status = 0; + +#if GFX_DISPLAY_GU1 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU1) + status = gu1_set_compression_enable(enable); +#endif +#if GFX_DISPLAY_GU2 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU2) + status = gu2_set_compression_enable(enable); +#endif + return (status); +} + +/*--------------------------------------------------------------------------- + * gfx_set_compression_offset + *--------------------------------------------------------------------------- + */ +int +gfx_set_compression_offset(unsigned long offset) +{ + int status = 0; + +#if GFX_DISPLAY_GU1 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU1) + status = gu1_set_compression_offset(offset); +#endif +#if GFX_DISPLAY_GU2 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU2) + status = gu2_set_compression_offset(offset); +#endif + return (status); +} + +/*--------------------------------------------------------------------------- + * gfx_set_compression_pitch + *--------------------------------------------------------------------------- + */ +int +gfx_set_compression_pitch(unsigned short pitch) +{ + int status = 0; + +#if GFX_DISPLAY_GU1 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU1) + status = gu1_set_compression_pitch(pitch); +#endif +#if GFX_DISPLAY_GU2 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU2) + status = gu2_set_compression_pitch(pitch); +#endif + return (status); +} + +/*--------------------------------------------------------------------------- + * gfx_set_compression_size + *--------------------------------------------------------------------------- + */ +int +gfx_set_compression_size(unsigned short size) +{ + int status = 0; + +#if GFX_DISPLAY_GU1 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU1) + status = gu1_set_compression_size(size); +#endif +#if GFX_DISPLAY_GU2 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU2) + status = gu2_set_compression_size(size); +#endif + return (status); +} + +/*--------------------------------------------------------------------------- + * gfx_set_display_priority_high + *--------------------------------------------------------------------------- + */ +void +gfx_set_display_priority_high(int enable) +{ +#if GFX_DISPLAY_GU1 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU1) + gu1_set_display_priority_high(enable); +#endif +} + +/*--------------------------------------------------------------------------- + * gfx_set_display_video_format (PRIVATE ROUTINE - NOT PART OF API) + * + * This routine is called by "gfx_set_video_format". It abstracts the + * version of the display controller from the video overlay routines. + *--------------------------------------------------------------------------- + */ +void +gfx_set_display_video_format(unsigned long format) +{ +#if GFX_DISPLAY_GU2 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU2) + gu2_set_display_video_format(format); +#endif +} + +/*--------------------------------------------------------------------------- + * gfx_set_display_video_enable (PRIVATE ROUTINE - NOT PART OF API) + * + * This routine is called by "gfx_set_video_enable". It abstracts the + * version of the display controller from the video overlay routines. + *--------------------------------------------------------------------------- + */ +void +gfx_set_display_video_enable(int enable) +{ +#if GFX_DISPLAY_GU1 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU1) + gu1_set_display_video_enable(enable); +#endif +#if GFX_DISPLAY_GU2 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU2) + gu2_set_display_video_enable(enable); +#endif + return; +} + +/*--------------------------------------------------------------------------- + * gfx_set_display_video_size (PRIVATE ROUTINE - NOT PART OF API) + * + * This routine is called by "gfx_set_video_size". It abstracts the + * version of the display controller from the video overlay routines. + *--------------------------------------------------------------------------- + */ +void +gfx_set_display_video_size(unsigned short width, unsigned short height) +{ +#if GFX_DISPLAY_GU1 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU1) + gu1_set_display_video_size(width, height); +#endif +#if GFX_DISPLAY_GU2 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU2) + gu2_set_display_video_size(width, height); +#endif +} + +/*--------------------------------------------------------------------------- + * gfx_set_display_video_offset (PRIVATE ROUTINE - NOT PART OF API) + * + * This routine is called by "gfx_set_video_offset". It abstracts the + * version of the display controller from the video overlay routines. + *--------------------------------------------------------------------------- + */ +void +gfx_set_display_video_offset(unsigned long offset) +{ +#if GFX_DISPLAY_GU1 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU1) + gu1_set_display_video_offset(offset); +#endif +#if GFX_DISPLAY_GU2 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU2) + gu2_set_display_video_offset(offset); +#endif +} + +/*--------------------------------------------------------------------------- + * gfx_set_display_video_yuv_offsets (PRIVATE ROUTINE - NOT PART OF API) + * + * This routine is called by "gfx_set_video_yuv_offsets". It abstracts the + * version of the display controller from the video overlay routines. + *--------------------------------------------------------------------------- + */ +void +gfx_set_display_video_yuv_offsets(unsigned long yoffset, + unsigned long uoffset, unsigned long voffset) +{ +#if GFX_DISPLAY_GU2 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU2) + gu2_set_display_video_yuv_offsets(yoffset, uoffset, voffset); +#endif +} + +/*--------------------------------------------------------------------------- + * gfx_set_display_video_yuv_pitch (PRIVATE ROUTINE - NOT PART OF API) + * + * This routine is called by "gfx_set_video_yuv_pitch". It abstracts the + * version of the display controller from the video overlay routines. + *--------------------------------------------------------------------------- + */ +void +gfx_set_display_video_yuv_pitch(unsigned long ypitch, unsigned long uvpitch) +{ +#if GFX_DISPLAY_GU2 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU2) + gu2_set_display_video_yuv_pitch(ypitch, uvpitch); +#endif +} + +/*--------------------------------------------------------------------------- + * gfx_set_display_video_downscale (PRIVATE ROUTINE - NOT PART OF API) + * + * This routine is called by "gfx_set_video_vertical_downscale". It abstracts the + * version of the display controller from the video overlay routines. + *--------------------------------------------------------------------------- + */ +void +gfx_set_display_video_downscale(unsigned short srch, unsigned short dsth) +{ +#if GFX_DISPLAY_GU2 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU2) + gu2_set_display_video_downscale(srch, dsth); +#endif +} + +/*--------------------------------------------------------------------------- + * gfx_set_display_video_vertical_downscale_enable (PRIVATE ROUTINE - NOT PART OF API) + * + * This routine is called by "gfx_set_video_vertical_downscale_enable". It abstracts the + * version of the display controller from the video overlay routines. + *--------------------------------------------------------------------------- + */ +void +gfx_set_display_video_vertical_downscale_enable(int enable) +{ +#if GFX_DISPLAY_GU2 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU2) + gu2_set_display_video_vertical_downscale_enable(enable); +#endif +} + +/*--------------------------------------------------------------------------- + * gfx_test_timing_active + *--------------------------------------------------------------------------- + */ +int +gfx_test_timing_active(void) +{ + int status = 0; + +#if GFX_DISPLAY_GU1 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU1) + status = gu1_test_timing_active(); +#endif +#if GFX_DISPLAY_GU2 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU2) + status = gu2_test_timing_active(); +#endif + return (status); +} + +/*--------------------------------------------------------------------------- + * gfx_test_vertical_active + *--------------------------------------------------------------------------- + */ +int +gfx_test_vertical_active(void) +{ + int status = 0; + +#if GFX_DISPLAY_GU1 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU1) + status = gu1_test_vertical_active(); +#endif +#if GFX_DISPLAY_GU2 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU2) + status = gu2_test_vertical_active(); +#endif + return (status); +} + +/*--------------------------------------------------------------------------- + * gfx_wait_vertical_blank + *--------------------------------------------------------------------------- + */ +int +gfx_wait_vertical_blank(void) +{ + int status = 0; + +#if GFX_DISPLAY_GU1 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU1) + status = gu1_wait_vertical_blank(); +#endif +#if GFX_DISPLAY_GU2 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU2) + status = gu2_wait_vertical_blank(); +#endif + return (status); +} + +/*--------------------------------------------------------------------------- + * gfx_delay_milliseconds + *--------------------------------------------------------------------------- + */ +void +gfx_delay_milliseconds(unsigned long milliseconds) +{ +#if GFX_DISPLAY_GU1 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU1) + gu1_delay_milliseconds(milliseconds); +#endif +#if GFX_DISPLAY_GU2 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU2) + gu2_delay_milliseconds(milliseconds); +#endif +} + +/*--------------------------------------------------------------------------- + * gfx_delay_microseconds + *--------------------------------------------------------------------------- + */ +void +gfx_delay_microseconds(unsigned long microseconds) +{ +#if GFX_DISPLAY_GU1 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU1) + gu1_delay_microseconds(microseconds); +#endif +#if GFX_DISPLAY_GU2 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU2) + gu2_delay_microseconds(microseconds); +#endif +} + +/*--------------------------------------------------------------------------- + * gfx_enable_panning + * + * This routine enables the panning when the Mode is bigger than the panel + * size. + *--------------------------------------------------------------------------- + */ +void +gfx_enable_panning(int x, int y) +{ +#if GFX_DISPLAY_GU1 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU1) + gu1_enable_panning(x, y); +#endif +#if GFX_DISPLAY_GU2 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU2) + gu2_enable_panning(x, y); +#endif +} + +/*--------------------------------------------------------------------------- + * gfx_is_panel_mode_supported + *--------------------------------------------------------------------------- + */ +int +gfx_is_panel_mode_supported(int panelResX, int panelResY, + unsigned short width, unsigned short height, unsigned short bpp) +{ + int status = -1; + +#if GFX_DISPLAY_GU2 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU2) + status = + gu2_is_panel_mode_supported(panelResX, panelResY, width, height, + bpp); +#endif + + return (status); +} + +/*--------------------------------------------------------------------------- + * gfx_set_fixed_timings + *--------------------------------------------------------------------------- + */ +int +gfx_set_fixed_timings(int panelResX, int panelResY, unsigned short width, + unsigned short height, unsigned short bpp) +{ + int status = 0; + +#if GFX_DISPLAY_GU1 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU1) + status = + gu1_set_fixed_timings(panelResX, panelResY, width, height, bpp); +#endif +#if GFX_DISPLAY_GU2 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU2) + status = + gu2_set_fixed_timings(panelResX, panelResY, width, height, bpp); +#endif + return (status); +} + +/*--------------------------------------------------------------------------- + * gfx_set_panel_present + *--------------------------------------------------------------------------- + */ +int +gfx_set_panel_present(int panelResX, int panelResY, unsigned short width, + unsigned short height, unsigned short bpp) +{ + int status = 0; + +#if GFX_DISPLAY_GU1 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU1) + status = + gu1_set_panel_present(panelResX, panelResY, width, height, bpp); +#endif +#if GFX_DISPLAY_GU2 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU2) + status = + gu2_set_panel_present(panelResX, panelResY, width, height, bpp); +#endif + return (status); +} + +/*--------------------------------------------------------------------------- + * gfx_set_vtotal + *--------------------------------------------------------------------------- + */ +int +gfx_set_vtotal(unsigned short vtotal) +{ + int retval = 0; + +#if GFX_DISPLAY_GU1 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU1) + retval = gu1_set_vtotal(vtotal); +#endif +#if GFX_DISPLAY_GU2 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU2) + retval = gu2_set_vtotal(vtotal); +#endif + return (retval); +} + +/*-----------------------------------------------------------------------* + * THE FOLLOWING READ ROUTINES ARE ALWAYS INCLUDED: * + * gfx_get_hsync_end, gfx_get_htotal, gfx_get_vsync_end, gfx_get_vtotal * + * are used by the video overlay routines. * + * * + * gfx_get_vline and gfx_vactive are used to prevent an issue for the * + * SC1200. * + * * + * The others are part of the Durango API. * + *-----------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------- + * gfx_mode_frequency_supported + *---------------------------------------------------------------------------- + */ +int +gfx_mode_frequency_supported(int xres, int yres, int bpp, + unsigned long frequency) +{ + int freq = 0; + +#if GFX_DISPLAY_GU1 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU1) + freq = gu1_mode_frequency_supported(xres, yres, bpp, frequency); +#endif +#if GFX_DISPLAY_GU2 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU2) + freq = gu2_mode_frequency_supported(xres, yres, bpp, frequency); +#endif + return (freq); +} + +/*---------------------------------------------------------------------------- + * gfx_refreshrate_from_frequency + *---------------------------------------------------------------------------- + */ +int +gfx_get_refreshrate_from_frequency(int xres, int yres, int bpp, int *hz, + unsigned long frequency) +{ +#if GFX_DISPLAY_GU1 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU1) + gu1_get_refreshrate_from_frequency(xres, yres, bpp, hz, frequency); +#endif +#if GFX_DISPLAY_GU2 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU2) + gu2_get_refreshrate_from_frequency(xres, yres, bpp, hz, frequency); +#endif + + return (1); +} + +/*---------------------------------------------------------------------------- + * gfx_refreshrate_from_mode + *---------------------------------------------------------------------------- + */ +int +gfx_get_refreshrate_from_mode(int xres, int yres, int bpp, int *hz, + unsigned long frequency) +{ +#if GFX_DISPLAY_GU1 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU1) + gu1_get_refreshrate_from_mode(xres, yres, bpp, hz, frequency); +#endif +#if GFX_DISPLAY_GU2 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU2) + gu2_get_refreshrate_from_mode(xres, yres, bpp, hz, frequency); +#endif + + return (1); +} + +/*---------------------------------------------------------------------------- + * gfx_get_frequency_from_refreshrate + *---------------------------------------------------------------------------- + */ +int +gfx_get_frequency_from_refreshrate(int xres, int yres, int bpp, int hz, + int *frequency) +{ + int retval = -1; + +#if GFX_DISPLAY_GU1 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU1) + retval = + gu1_get_frequency_from_refreshrate(xres, yres, bpp, hz, + frequency); +#endif +#if GFX_DISPLAY_GU2 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU2) + retval = + gu2_get_frequency_from_refreshrate(xres, yres, bpp, hz, + frequency); +#endif + + return retval; +} + +/*--------------------------------------------------------------------------- + * gfx_get_max_supported_pixel_clock + *--------------------------------------------------------------------------- + */ +unsigned long +gfx_get_max_supported_pixel_clock(void) +{ + unsigned long status = 0; + +#if GFX_DISPLAY_GU1 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU1) + status = gu1_get_max_supported_pixel_clock(); +#endif +#if GFX_DISPLAY_GU2 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU2) + status = gu2_get_max_supported_pixel_clock(); +#endif + return (status); +} + +/*--------------------------------------------------------------------------- + * gfx_get_display_pitch + *--------------------------------------------------------------------------- + */ +unsigned short +gfx_get_display_pitch(void) +{ + unsigned short pitch = 0; + +#if GFX_DISPLAY_GU1 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU1) + pitch = gu1_get_display_pitch(); +#endif +#if GFX_DISPLAY_GU2 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU2) + pitch = gu2_get_display_pitch(); +#endif + return (pitch); +} + +/*--------------------------------------------------------------------------- + * gfx_get_display_mode_count + * return # of modes supported. + *--------------------------------------------------------------------------- + */ +int +gfx_get_display_mode_count(void) +{ + int retval = 0; + +#if GFX_DISPLAY_GU1 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU1) + retval = gu1_get_display_mode_count(); +#endif +#if GFX_DISPLAY_GU2 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU2) + retval = gu2_get_display_mode_count(); +#endif + return (retval); +} + +/*--------------------------------------------------------------------------- + * gfx_get_frame_buffer_line_size + *--------------------------------------------------------------------------- + */ +unsigned long +gfx_get_frame_buffer_line_size(void) +{ + unsigned long retval = 0; + +#if GFX_DISPLAY_GU1 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU1) + retval = gu1_get_frame_buffer_line_size(); +#endif +#if GFX_DISPLAY_GU2 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU2) + retval = gu2_get_frame_buffer_line_size(); +#endif + return (retval); +} + +/*--------------------------------------------------------------------------- + * gfx_get_display_mode + * get the curent mode set, + * return the supported mode on success, -1 on fail + *--------------------------------------------------------------------------- + */ +int +gfx_get_display_mode(int *xres, int *yres, int *bpp, int *hz) +{ + int retval = -1; + +#if GFX_DISPLAY_GU1 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU1) + retval = gu1_get_display_mode(xres, yres, bpp, hz); +#endif +#if GFX_DISPLAY_GU2 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU2) + retval = gu2_get_display_mode(xres, yres, bpp, hz); +#endif + return (retval); +} + +/*--------------------------------------------------------------------------- + * gfx_get_display_details + * given the mode get's the resoultion details, width, height, freq + *--------------------------------------------------------------------------- + */ +int +gfx_get_display_details(unsigned int mode, int *xres, int *yres, int *hz) +{ + int retval = -1; + +#if GFX_DISPLAY_GU1 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU1) + retval = gu1_get_display_details(mode, xres, yres, hz); +#endif +#if GFX_DISPLAY_GU2 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU2) + retval = gu2_get_display_details(mode, xres, yres, hz); +#endif + return (retval); +} + +/*--------------------------------------------------------------------------- + * gfx_get_hactive + *--------------------------------------------------------------------------- + */ +unsigned short +gfx_get_hactive(void) +{ + unsigned short hactive = 0; + +#if GFX_DISPLAY_GU1 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU1) + hactive = gu1_get_hactive(); +#endif +#if GFX_DISPLAY_GU2 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU2) + hactive = gu2_get_hactive(); +#endif + return (hactive); +} + +/*--------------------------------------------------------------------------- + * gfx_get_hsync_start + *--------------------------------------------------------------------------- + */ +unsigned short +gfx_get_hsync_start(void) +{ + unsigned short hsync_start = 0; + +#if GFX_DISPLAY_GU1 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU1) + hsync_start = gu1_get_hsync_start(); +#endif +#if GFX_DISPLAY_GU2 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU2) + hsync_start = gu2_get_hsync_start(); +#endif + return (hsync_start); +} + +/*--------------------------------------------------------------------------- + * gfx_get_hsync_end + *--------------------------------------------------------------------------- + */ +unsigned short +gfx_get_hsync_end(void) +{ + unsigned short hsync_end = 0; + +#if GFX_DISPLAY_GU1 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU1) + hsync_end = gu1_get_hsync_end(); +#endif +#if GFX_DISPLAY_GU2 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU2) + hsync_end = gu2_get_hsync_end(); +#endif + return (hsync_end); +} + +/*--------------------------------------------------------------------------- + * gfx_get_htotal + *--------------------------------------------------------------------------- + */ +unsigned short +gfx_get_htotal(void) +{ + unsigned short htotal = 0; + +#if GFX_DISPLAY_GU1 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU1) + htotal = gu1_get_htotal(); +#endif +#if GFX_DISPLAY_GU2 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU2) + htotal = gu2_get_htotal(); +#endif + return (htotal); +} + +/*--------------------------------------------------------------------------- + * gfx_get_vactive + *--------------------------------------------------------------------------- + */ +unsigned short +gfx_get_vactive(void) +{ + unsigned short vactive = 0; + +#if GFX_DISPLAY_GU1 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU1) + vactive = gu1_get_vactive(); +#endif +#if GFX_DISPLAY_GU2 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU2) + vactive = gu2_get_vactive(); +#endif + return (vactive); +} + +/*--------------------------------------------------------------------------- + * gfx_get_vsync_end + *--------------------------------------------------------------------------- + */ +unsigned short +gfx_get_vsync_end(void) +{ + unsigned short vsync_end = 0; + +#if GFX_DISPLAY_GU1 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU1) + vsync_end = gu1_get_vsync_end(); +#endif +#if GFX_DISPLAY_GU2 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU2) + vsync_end = gu2_get_vsync_end(); +#endif + return (vsync_end); +} + +/*--------------------------------------------------------------------------- + * gfx_get_vtotal + *--------------------------------------------------------------------------- + */ +unsigned short +gfx_get_vtotal(void) +{ + unsigned short vtotal = 0; + +#if GFX_DISPLAY_GU1 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU1) + vtotal = gu1_get_vtotal(); +#endif +#if GFX_DISPLAY_GU2 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU2) + vtotal = gu2_get_vtotal(); +#endif + return (vtotal); +} + +/*--------------------------------------------------------------------------- + * gfx_get_display_bpp + *--------------------------------------------------------------------------- + */ +unsigned short +gfx_get_display_bpp(void) +{ + unsigned short bpp = 0; + +#if GFX_DISPLAY_GU1 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU1) + bpp = gu1_get_display_bpp(); +#endif +#if GFX_DISPLAY_GU2 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU2) + bpp = gu2_get_display_bpp(); +#endif + return (bpp); +} + +/*--------------------------------------------------------------------------- + * gfx_get_vline + *--------------------------------------------------------------------------- + */ +unsigned short +gfx_get_vline(void) +{ + unsigned short vline = 0; + +#if GFX_DISPLAY_GU1 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU1) + vline = gu1_get_vline(); +#endif +#if GFX_DISPLAY_GU2 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU2) + vline = gu2_get_vline(); +#endif + return (vline); +} + +/*--------------------------------------------------------------------------- + * gfx_get_display_offset + *--------------------------------------------------------------------------- + */ +unsigned long +gfx_get_display_offset(void) +{ + unsigned long offset = 0; + +#if GFX_DISPLAY_GU1 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU1) + offset = gu1_get_display_offset(); +#endif +#if GFX_DISPLAY_GU2 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU2) + offset = gu2_get_display_offset(); +#endif + return (offset); +} + +/*--------------------------------------------------------------------------- + * gfx_get_cursor_offset + *--------------------------------------------------------------------------- + */ +unsigned long +gfx_get_cursor_offset(void) +{ + unsigned long base = 0; + +#if GFX_DISPLAY_GU1 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU1) + base = gu1_get_cursor_offset(); +#endif +#if GFX_DISPLAY_GU2 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU2) + base = gu2_get_cursor_offset(); +#endif + return (base); +} + +/*************************************************************/ +/* READ ROUTINES | INCLUDED FOR DIAGNOSTIC PURPOSES ONLY */ +/*************************************************************/ + +#if GFX_READ_ROUTINES + +/*--------------------------------------------------------------------------- + * gfx_get_hblank_start + *--------------------------------------------------------------------------- + */ +unsigned short +gfx_get_hblank_start(void) +{ + unsigned short hblank_start = 0; + +#if GFX_DISPLAY_GU1 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU1) + hblank_start = gu1_get_hblank_start(); +#endif +#if GFX_DISPLAY_GU2 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU2) + hblank_start = gu2_get_hblank_start(); +#endif + return (hblank_start); +} + +/*--------------------------------------------------------------------------- + * gfx_get_hblank_end + *--------------------------------------------------------------------------- + */ +unsigned short +gfx_get_hblank_end(void) +{ + unsigned short hblank_end = 0; + +#if GFX_DISPLAY_GU1 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU1) + hblank_end = gu1_get_hblank_end(); +#endif +#if GFX_DISPLAY_GU2 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU2) + hblank_end = gu2_get_hblank_end(); +#endif + return (hblank_end); +} + +/*--------------------------------------------------------------------------- + * gfx_get_vblank_start + *--------------------------------------------------------------------------- + */ +unsigned short +gfx_get_vblank_start(void) +{ + unsigned short vblank_start = 0; + +#if GFX_DISPLAY_GU1 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU1) + vblank_start = gu1_get_vblank_start(); +#endif +#if GFX_DISPLAY_GU2 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU2) + vblank_start = gu2_get_vblank_start(); +#endif + return (vblank_start); +} + +/*--------------------------------------------------------------------------- + * gfx_get_vsync_start + *--------------------------------------------------------------------------- + */ +unsigned short +gfx_get_vsync_start(void) +{ + unsigned short vsync_start = 0; + +#if GFX_DISPLAY_GU1 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU1) + vsync_start = gu1_get_vsync_start(); +#endif +#if GFX_DISPLAY_GU2 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU2) + vsync_start = gu2_get_vsync_start(); +#endif + return (vsync_start); +} + +/*--------------------------------------------------------------------------- + * gfx_get_vblank_end + *--------------------------------------------------------------------------- + */ +unsigned short +gfx_get_vblank_end(void) +{ + unsigned short vblank_end = 0; + +#if GFX_DISPLAY_GU1 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU1) + vblank_end = gu1_get_vblank_end(); +#endif +#if GFX_DISPLAY_GU2 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU2) + vblank_end = gu2_get_vblank_end(); +#endif + return (vblank_end); +} + +/*--------------------------------------------------------------------------- + * gfx_get_display_palette_entry + *--------------------------------------------------------------------------- + */ +int +gfx_get_display_palette_entry(unsigned long index, unsigned long *palette) +{ + int status = 0; + +#if GFX_DISPLAY_GU1 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU1) + status = gu1_get_display_palette_entry(index, palette); +#endif +#if GFX_DISPLAY_GU2 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU2) + status = gu2_get_display_palette_entry(index, palette); +#endif + + return status; +} + +/*--------------------------------------------------------------------------- + * gfx_get_display_palette + *--------------------------------------------------------------------------- + */ +void +gfx_get_display_palette(unsigned long *palette) +{ +#if GFX_DISPLAY_GU1 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU1) + gu1_get_display_palette(palette); +#endif +#if GFX_DISPLAY_GU2 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU2) + gu2_get_display_palette(palette); +#endif +} + +/*--------------------------------------------------------------------------- + * gfx_get_cursor_enable + *--------------------------------------------------------------------------- + */ +unsigned long +gfx_get_cursor_enable(void) +{ + unsigned long enable = 0; + +#if GFX_DISPLAY_GU1 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU1) + enable = gu1_get_cursor_enable(); +#endif +#if GFX_DISPLAY_GU2 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU2) + enable = gu2_get_cursor_enable(); +#endif + return (enable); +} + +/*--------------------------------------------------------------------------- + * gfx_get_cursor_position + *--------------------------------------------------------------------------- + */ +unsigned long +gfx_get_cursor_position(void) +{ + unsigned long position = 0; + +#if GFX_DISPLAY_GU1 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU1) + position = gu1_get_cursor_position(); +#endif +#if GFX_DISPLAY_GU2 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU2) + position = gu2_get_cursor_position(); +#endif + return (position); +} + +/*--------------------------------------------------------------------------- + * gfx_get_cursor_clip + *--------------------------------------------------------------------------- + */ +unsigned long +gfx_get_cursor_clip(void) +{ + unsigned long offset = 0; + +#if GFX_DISPLAY_GU1 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU1) + offset = gu1_get_cursor_clip(); +#endif +#if GFX_DISPLAY_GU2 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU2) + offset = gu2_get_cursor_clip(); +#endif + return (offset); +} + +/*--------------------------------------------------------------------------- + * gfx_get_cursor_color + *--------------------------------------------------------------------------- + */ +unsigned long +gfx_get_cursor_color(int index) +{ + unsigned long color = 0; + +#if GFX_DISPLAY_GU1 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU1) + color = gu1_get_cursor_color(index); +#endif +#if GFX_DISPLAY_GU2 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU2) + color = gu2_get_cursor_color(index); +#endif + return (color); +} + +/*--------------------------------------------------------------------------- + * gfx_get_icon_enable + *--------------------------------------------------------------------------- + */ +unsigned long +gfx_get_icon_enable(void) +{ + unsigned long enable = 0; + +#if GFX_DISPLAY_GU2 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU2) + enable = gu2_get_icon_enable(); +#endif + return (enable); +} + +/*--------------------------------------------------------------------------- + * gfx_get_icon_offset + *--------------------------------------------------------------------------- + */ +unsigned long +gfx_get_icon_offset(void) +{ + unsigned long base = 0; + +#if GFX_DISPLAY_GU2 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU2) + base = gu2_get_icon_offset(); +#endif + + return (base); +} + +/*--------------------------------------------------------------------------- + * gfx_get_icon_position + *--------------------------------------------------------------------------- + */ +unsigned long +gfx_get_icon_position(void) +{ + unsigned long position = 0; + +#if GFX_DISPLAY_GU2 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU2) + position = gu2_get_icon_position(); +#endif + + return (position); +} + +/*--------------------------------------------------------------------------- + * gfx_get_icon_color + *--------------------------------------------------------------------------- + */ +unsigned long +gfx_get_icon_color(int index) +{ + unsigned long color = 0; + +#if GFX_DISPLAY_GU2 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU2) + color = gu2_get_icon_color(index); +#endif + + return (color); +} + +/*--------------------------------------------------------------------------- + * gfx_get_compression_enable + *--------------------------------------------------------------------------- + */ +int +gfx_get_compression_enable(void) +{ + int enable = 0; + +#if GFX_DISPLAY_GU1 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU1) + enable = gu1_get_compression_enable(); +#endif +#if GFX_DISPLAY_GU2 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU2) + enable = gu2_get_compression_enable(); +#endif + return (enable); +} + +/*--------------------------------------------------------------------------- + * gfx_get_compression_offset + *--------------------------------------------------------------------------- + */ +unsigned long +gfx_get_compression_offset(void) +{ + unsigned long offset = 0; + +#if GFX_DISPLAY_GU1 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU1) + offset = gu1_get_compression_offset(); +#endif +#if GFX_DISPLAY_GU2 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU2) + offset = gu2_get_compression_offset(); +#endif + return (offset); +} + +/*--------------------------------------------------------------------------- + * gfx_get_compression_pitch + *--------------------------------------------------------------------------- + */ +unsigned short +gfx_get_compression_pitch(void) +{ + unsigned short pitch = 0; + +#if GFX_DISPLAY_GU1 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU1) + pitch = gu1_get_compression_pitch(); +#endif +#if GFX_DISPLAY_GU2 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU2) + pitch = gu2_get_compression_pitch(); +#endif + return (pitch); +} + +/*--------------------------------------------------------------------------- + * gfx_get_compression_size + *--------------------------------------------------------------------------- + */ +unsigned short +gfx_get_compression_size(void) +{ + unsigned short size = 0; + +#if GFX_DISPLAY_GU1 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU1) + size = gu1_get_compression_size(); +#endif +#if GFX_DISPLAY_GU2 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU2) + size = gu2_get_compression_size(); +#endif + return (size); +} + +/*--------------------------------------------------------------------------- + * gfx_get_display_priority_high + *--------------------------------------------------------------------------- + */ +int +gfx_get_display_priority_high(void) +{ + int high = GFX_STATUS_UNSUPPORTED; + +#if GFX_DISPLAY_GU1 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU1) + high = gu1_get_display_priority_high(); +#endif + return (high); +} + +/*--------------------------------------------------------------------------- + * gfx_get_valid_bit + *--------------------------------------------------------------------------- + */ +int +gfx_get_valid_bit(int line) +{ + int valid = 0; + +#if GFX_DISPLAY_GU1 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU1) + valid = gu1_get_valid_bit(line); +#endif +#if GFX_DISPLAY_GU2 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU2) + valid = gu2_get_valid_bit(line); +#endif + return (valid); +} + +/*--------------------------------------------------------------------------- + * gfx_get_display_video_color_key + *--------------------------------------------------------------------------- + */ +unsigned long +gfx_get_display_video_color_key(void) +{ + unsigned long value = 0; + return (value); +} + +/*--------------------------------------------------------------------------- + * gfx_get_display_video_offset + *--------------------------------------------------------------------------- + */ +unsigned long +gfx_get_display_video_offset(void) +{ + unsigned long offset = 0; + +#if GFX_DISPLAY_GU1 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU1) + offset = gu1_get_display_video_offset(); +#endif +#if GFX_DISPLAY_GU2 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU2) + offset = gu2_get_display_video_offset(); +#endif + return (offset); +} + +/*--------------------------------------------------------------------------- + * gfx_get_display_video_yuv_offsets + *--------------------------------------------------------------------------- + */ +void +gfx_get_display_video_yuv_offsets(unsigned long *yoffset, + unsigned long *uoffset, unsigned long *voffset) +{ +#if GFX_DISPLAY_GU2 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU2) + gu2_get_display_video_yuv_offsets(yoffset, uoffset, voffset); +#endif +} + +/*--------------------------------------------------------------------------- + * gfx_get_display_video_yuv_offsets + *--------------------------------------------------------------------------- + */ +void +gfx_get_display_video_yuv_pitch(unsigned long *ypitch, unsigned long *uvpitch) +{ +#if GFX_DISPLAY_GU2 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU2) + gu2_get_display_video_yuv_pitch(ypitch, uvpitch); +#endif +} + +/*--------------------------------------------------------------------------- + * gfx_get_display_video_downscale_delta + *--------------------------------------------------------------------------- + */ +unsigned long +gfx_get_display_video_downscale_delta(void) +{ + unsigned long ret_value = 0; + +#if GFX_DISPLAY_GU2 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU2) + ret_value = gu2_get_display_video_downscale_delta(); +#endif + + return ret_value; +} + +/*--------------------------------------------------------------------------- + * gfx_get_display_video_downscale_delta + *--------------------------------------------------------------------------- + */ +int +gfx_get_display_video_downscale_enable(void) +{ + int ret_value = 0; + +#if GFX_DISPLAY_GU2 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU2) + ret_value = gu2_get_display_video_downscale_enable(); +#endif + + return ret_value; +} + +/*--------------------------------------------------------------------------- + * gfx_get_display_video_size + *--------------------------------------------------------------------------- + */ +unsigned long +gfx_get_display_video_size(void) +{ + unsigned long size = 0; + +#if GFX_DISPLAY_GU1 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU1) + size = gu1_get_display_video_size(); +#endif +#if GFX_DISPLAY_GU2 + if (gfx_display_type & GFX_DISPLAY_TYPE_GU2) + size = gu2_get_display_video_size(); +#endif + return (size); +} + +/*--------------------------------------------------------------------------- + * gfx_get_display_video_color_key_mask + *--------------------------------------------------------------------------- + */ +unsigned long +gfx_get_display_video_color_key_mask(void) +{ + unsigned long mask = 0; + return (mask); +} + +#endif /* GFX_READ_ROUTINES */ + +#endif /* GFX_DISPLAY_DYNAMIC */ diff --git a/driver/xf86-video-geode/src/gfx/gfx_i2c.c b/driver/xf86-video-geode/src/gfx/gfx_i2c.c new file mode 100644 index 000000000..7a3ad422c --- /dev/null +++ b/driver/xf86-video-geode/src/gfx/gfx_i2c.c @@ -0,0 +1,168 @@ +/* Copyright (c) 2005 Advanced Micro Devices, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + * + * Neither the name of the Advanced Micro Devices, Inc. nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * */ + +/* + * This file contains routines to write to and read from the I2C bus. + * */ + +/* INCLUDE ROUTINES FOR ACCESS.BUS, IF SPECIFIED */ +/* This is for SC1200 systems. */ + +#if GFX_I2C_ACCESS +#include "i2c_acc.c" +#endif + +/* INCLUDE ROUTINES FOR CS5530 GPIOs, IF SPECIFIED */ +/* This is for GXLV systems that use GPIOs on the CS5530 for I2C. */ + +#if GFX_I2C_GPIO +#include "i2c_gpio.c" +#endif + +/* WRAPPERS IF DYNAMIC SELECTION */ +/* Extra layer to call either ACCESS.bus or GPIO routines. */ + +#if GFX_I2C_DYNAMIC + +/*--------------------------------------------------------------------------- + * gfx_i2c_reset + *--------------------------------------------------------------------------- + */ +int +gfx_i2c_reset(unsigned char busnum, short adr, char freq) +{ + int status = GFX_STATUS_UNSUPPORTED; + +#if GFX_I2C_ACCESS + if (gfx_i2c_type & GFX_I2C_TYPE_ACCESS) + status = acc_i2c_reset(busnum, adr, freq); +#endif +#if GFX_I2C_GPIO + if (gfx_i2c_type & GFX_I2C_TYPE_GPIO) + status = gpio_i2c_reset(busnum, adr, freq); +#endif + return (status); +} + +/*--------------------------------------------------------------------------- + * gfx_i2c_select_gpio + *--------------------------------------------------------------------------- + */ +int +gfx_i2c_select_gpio(int clock, int data) +{ +#if GFX_I2C_ACCESS + if (gfx_i2c_type & GFX_I2C_TYPE_ACCESS) + acc_i2c_select_gpio(clock, data); +#endif +#if GFX_I2C_GPIO + if (gfx_i2c_type & GFX_I2C_TYPE_GPIO) + gpio_i2c_select_gpio(clock, data); +#endif + return (0); +} + +/*--------------------------------------------------------------------------- + * gfx_i2c_write + *--------------------------------------------------------------------------- + */ +int +gfx_i2c_write(unsigned char busnum, unsigned char chipadr, + unsigned char subadr, unsigned char bytes, unsigned char *data) +{ + int status = -1; + +#if GFX_I2C_ACCESS + if (gfx_i2c_type & GFX_I2C_TYPE_ACCESS) + status = acc_i2c_write(busnum, chipadr, subadr, bytes, data); +#endif +#if GFX_I2C_GPIO + if (gfx_i2c_type & GFX_I2C_TYPE_GPIO) + status = gpio_i2c_write(busnum, chipadr, subadr, bytes, data); +#endif + return (status); +} + +/*--------------------------------------------------------------------------- + * gfx_i2c_read + *--------------------------------------------------------------------------- + */ +int +gfx_i2c_read(unsigned char busnum, unsigned char chipadr, + unsigned char subadr, unsigned char bytes, unsigned char *data) +{ + int status = -1; + +#if GFX_I2C_ACCESS + if (gfx_i2c_type & GFX_I2C_TYPE_ACCESS) + status = acc_i2c_read(busnum, chipadr, subadr, bytes, data); +#endif +#if GFX_I2C_GPIO + if (gfx_i2c_type & GFX_I2C_TYPE_GPIO) + status = gpio_i2c_read(busnum, chipadr, subadr, bytes, data); +#endif + return (status); +} + +/*--------------------------------------------------------------------------- + * gfx_i2c_init + *--------------------------------------------------------------------------- + */ +int +gfx_i2c_init(void) +{ + int status = -1; + +#if GFX_I2C_ACCESS + if (gfx_i2c_type & GFX_I2C_TYPE_ACCESS) + status = acc_i2c_init(); +#endif +#if GFX_I2C_GPIO + if (gfx_i2c_type & GFX_I2C_TYPE_GPIO) + status = gpio_i2c_init(); +#endif + return (status); +} + +/*--------------------------------------------------------------------------- + * gfx_i2c_cleanup + *--------------------------------------------------------------------------- + */ +void +gfx_i2c_cleanup(void) +{ +#if GFX_I2C_ACCESS + if (gfx_i2c_type & GFX_I2C_TYPE_ACCESS) + acc_i2c_cleanup(); +#endif +#if GFX_I2C_GPIO + if (gfx_i2c_type & GFX_I2C_TYPE_GPIO) + gpio_i2c_cleanup(); +#endif +} + +#endif /* GFX_I2C_DYNAMIC */ + +/* END OF FILE */ diff --git a/driver/xf86-video-geode/src/gfx/gfx_init.c b/driver/xf86-video-geode/src/gfx/gfx_init.c new file mode 100644 index 000000000..469c70f0f --- /dev/null +++ b/driver/xf86-video-geode/src/gfx/gfx_init.c @@ -0,0 +1,609 @@ +/* Copyright (c) 2005 Advanced Micro Devices, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + * + * Neither the name of the Advanced Micro Devices, Inc. nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * */ + +/* + * This file contains routines typically used in driver initialization. + * + * Routines: + * + * gfx_pci_config_read + * gfx_cpu_config_read + * gfx_detect_cpu + * gfx_detect_video + * gfx_get_cpu_register_base + * gfx_get_frame_buffer_base + * gfx_get_frame_buffer_size + * gfx_get_vid_register_base + * gfx_get_vip_register_base + * */ + +/* CONSTANTS USED BY THE INITIALIZATION CODE */ + +#define PCI_CONFIG_ADDR 0x0CF8 +#define PCI_CONFIG_DATA 0x0CFC +#define PCI_VENDOR_DEVICE_GXM 0x00011078 +#define PCI_VENDOR_DEVICE_REDCLOUD 0x0028100B +#define REDCLOUD_VIDEO_PCI_VENDOR_DEVICE 0x0030100B + +#define GXM_CONFIG_GCR 0xB8 +#define GXM_CONFIG_CCR3 0xC3 +#define GXM_CONFIG_DIR0 0xFE +#define GXM_CONFIG_DIR1 0xFF + +/* STATIC VARIABLES FOR THIS FILE */ + +unsigned long gfx_cpu_version = 0; +unsigned long gfx_cpu_frequency = 0; +unsigned long gfx_vid_version = 0; +unsigned long gfx_gx1_scratch_base = 0; +unsigned long gfx_gx2_scratch_base = 0x7FC000; +unsigned long gfx_pci_speed_khz = 33300; +ChipType gfx_chip_revision = CHIP_NOT_DETECTED; + +ChipType gfx_detect_chip(void); + +/* INCLUDE SUPPORT FOR FIRST GENERATION, IF SPECIFIED. */ + +#if GFX_INIT_GU1 +#include "init_gu1.c" +#endif + +/* INCLUDE SUPPORT FOR SECOND GENERATION, IF SPECIFIED. */ + +#if GFX_INIT_GU2 +#include "init_gu2.c" +#endif + +/* THE FOLLOWING ROUTINES ARE NEVER DYNAMIC */ +/* They are used to set the variables for future dynamic */ +/* function calls. */ + +/*---------------------------------------------------------------------------- + * gfx_detect_chip + * + * This routine returns the name and revision of the chip. This function is + * only relevant to the SC1200. + *---------------------------------------------------------------------------- + */ +ChipType +gfx_detect_chip(void) +{ + unsigned char pid = INB(SC1200_CB_BASE_ADDR + SC1200_CB_PID); + unsigned char rev = INB(SC1200_CB_BASE_ADDR + SC1200_CB_REV); + unsigned short clk = INW(SC1200_CB_BASE_ADDR + SC1200_CB_CCFC); + + gfx_chip_revision = CHIP_NOT_DETECTED; + + if (pid == 0x4) { + switch (rev) { + case 0: + gfx_chip_revision = SC1200_REV_A; + break; + case 1: + gfx_chip_revision = SC1200_REV_B1_B2; + break; + case 2: + gfx_chip_revision = SC1200_REV_B3; + break; + case 3: + gfx_chip_revision = SC1200_REV_C1; + break; + case 4: + gfx_chip_revision = SC1200_REV_D1; + break; + case 5: + gfx_chip_revision = SC1200_REV_D1_1; + break; + case 6: + gfx_chip_revision = SC1200_REV_D2_MVD; + break; + } + if (rev > 0x6) + gfx_chip_revision = SC1200_FUTURE_REV; + } else if (pid == 0x5) { + if (rev == 0x6) + gfx_chip_revision = SC1200_REV_D2_MVE; + else if (rev > 0x6) + gfx_chip_revision = SC1200_FUTURE_REV; + } + + switch ((clk >> 8) & 3) { + case 0: + default: + gfx_pci_speed_khz = 33300; + break; + case 1: + gfx_pci_speed_khz = 48000; + break; + case 2: + gfx_pci_speed_khz = 66600; + break; + } + + return (gfx_chip_revision); +} + +/*---------------------------------------------------------------------------- + * gfx_detect_cpu + * + * This routine returns the type and revison of the CPU. If a Geode + * processor is not present, the routine returns zero. + * + * The return value is as follows: + * bits[24:16] = minor version + * bits[15:8] = major version + * bits[7:0] = type (1 = GXm, 2 = SC1200, 3 = Redcloud) + * + * A return value of 0x00020501, for example, indicates GXm version 5.2. + *---------------------------------------------------------------------------- + */ +unsigned long +gfx_detect_cpu(void) +{ + + unsigned long value = 0; + unsigned long version = 0; + + /* initialize core freq. to 0 */ + gfx_cpu_frequency = 0; + +#if GFX_INIT_GU1 + + value = gfx_pci_config_read(0x80000000); + + if (value == PCI_VENDOR_DEVICE_GXM) { + unsigned char dir0 = gfx_gxm_config_read(GXM_CONFIG_DIR0) & 0xF0; + unsigned char dir1 = gfx_gxm_config_read(GXM_CONFIG_DIR1); + + if (dir0 == 0x40) { + /* CHECK FOR GXLV (and GXm) (DIR1 = 0x30 THROUGH 0x82) */ + + if ((dir1 >= 0x30) && (dir1 <= 0x82)) { + /* Major version is one less than what appears in DIR1 */ + if ((dir1 & 0xF0) < 0x70) { + + version = GFX_CPU_GXLV | (((((unsigned long)dir1 >> 4) - 1) << 8)) | /* major - 1 */ + ((((unsigned long)dir1 & 0x0F)) << 16); /* minor */ + } else { + version = GFX_CPU_GXLV | ((((unsigned long)dir1 >> 4)) + << 8) | /* major */ + ((((unsigned long)dir1 & 0x0F)) << 16); /* minor */ + } + /* Currently always CS5530 for video overlay. */ + +#if GFX_VIDEO_DYNAMIC + gfx_video_type = GFX_VIDEO_TYPE_CS5530; +#endif + + /* Currently always CS5530 GPIOs for I2C access. */ + +#if GFX_I2C_DYNAMIC + gfx_i2c_type = GFX_I2C_TYPE_GPIO; +#endif + +#if GFX_TV_DYNAMIC + gfx_tv_type = GFX_TV_TYPE_FS451; +#endif + } + } else if (dir0 == 0xB0) { + /* CHECK FOR SC1200 */ + + if ((dir1 == 0x70) || (dir1 == 0x81)) { + version = GFX_CPU_SC1200 | ((((unsigned long)dir1 >> 4)) + << 8) | /* major */ + ((((unsigned long)dir1 & 0x0F)) << 16); /* minor */ + + /* Detect SC1200 revision */ + + gfx_detect_chip(); + + /* SC1200 for video overlay and VIP. */ + +#if GFX_VIDEO_DYNAMIC + gfx_video_type = GFX_VIDEO_TYPE_SC1200; +#endif + +#if GFX_VIP_DYNAMIC + gfx_vip_type = GFX_VIP_TYPE_SC1200; +#endif + + /* Currently always SAA7114 decoder. */ + +#if GFX_DECODER_DYNAMIC + gfx_decoder_type = GFX_DECODER_TYPE_SAA7114; +#endif + + /* SC1200 for TV encoder */ + +#if GFX_TV_DYNAMIC + gfx_tv_type = GFX_TV_TYPE_SC1200; +#endif + + /* Currently always ACCESS.bus for I2C access. */ + +#if GFX_I2C_DYNAMIC + gfx_i2c_type = GFX_I2C_TYPE_ACCESS; +#endif + } + } + + if (version) { + /* ALWAYS FIRST GENERATION GRAPHICS UNIT */ + +#if GFX_DISPLAY_DYNAMIC + gfx_display_type = GFX_DISPLAY_TYPE_GU1; +#endif +#if GFX_2DACCEL_DYNAMIC + gfx_2daccel_type = GFX_2DACCEL_TYPE_GU1; +#endif +#if GFX_INIT_DYNAMIC + gfx_init_type = GFX_INIT_TYPE_GU1; +#endif + + /* READ THE CORE FREQUENCY */ + + gfx_cpu_frequency = gfx_get_core_freq(); + } + } +#endif + +#if GFX_INIT_GU2 + + value = gfx_pci_config_read(0x80000800); + + if (value == PCI_VENDOR_DEVICE_REDCLOUD) { + Q_WORD msr_value; + int valid, i; + + /* CHECK FOR SOFT VG */ + /* If SoftVG is not present, the base addresses for all devices */ + /* will not be allocated. Essentially, it is as if no Redcloud */ + /* video hardware is present. */ + + value = gfx_pci_config_read(0x80000900); + + if (value == REDCLOUD_VIDEO_PCI_VENDOR_DEVICE) { + valid = 1; + + /* BAR0 - BAR3 HOLD THE PERIPHERAL BASE ADDRESSES */ + + for (i = 0; i < 4; i++) { + value = gfx_pci_config_read(0x80000910 + (i << 2)); + if (value == 0x00000000 || value == 0xFFFFFFFF) { + valid = 0; + break; + } + } + + if (valid) { + /* REDCLOUD INTEGRATED VIDEO */ + +#if GFX_VIDEO_DYNAMIC + gfx_video_type = GFX_VIDEO_TYPE_REDCLOUD; +#endif + + /* CURRENTLY, ALWAYS GPIO FOR I2C ACCESS */ + +#if GFX_I2C_DYNAMIC + gfx_i2c_type = GFX_I2C_TYPE_GPIO; +#endif + + /* SECOND-GENERATION DISPLAY CONTROLLER */ + +#if GFX_DISPLAY_DYNAMIC + gfx_display_type = GFX_DISPLAY_TYPE_GU2; +#endif + + /* SECOND-GENERATION GRAPHICS UNIT */ + +#if GFX_2DACCEL_DYNAMIC + gfx_2daccel_type = GFX_2DACCEL_TYPE_GU2; +#endif + + /* SECOND-GENERATION INITIALIZATION */ + +#if GFX_INIT_DYNAMIC + gfx_init_type = GFX_INIT_TYPE_GU2; +#endif + + /* MBUS MSR ACCESSES */ + +#if GFX_MSR_DYNAMIC + gfx_msr_type = GFX_MSR_TYPE_REDCLOUD; +#endif + + /* CS5530 GPIO I2C */ + +#if GFX_I2C_DYNAMIC + gfx_i2c_type = GFX_I2C_TYPE_GPIO; +#endif + + /* READ VERSION */ + + gfx_msr_init(); + + gfx_msr_read(RC_ID_MCP, MCP_RC_REVID, &msr_value); + + /* SUBTRACT 1 FROM REV ID */ + /* REDCLOUD 1.X rev id is 1 less than the reported value */ + + if ((msr_value.low & 0xF0) == 0x10) + msr_value.low--; + + version = GFX_CPU_REDCLOUD | ((msr_value.low & 0xF0) << 4) | /* MAJOR */ + ((msr_value.low & 0x0F) << 16); /* MINOR */ + + /* READ THE CORE FREQUENCY */ + /* I can't find GX implementations that need + * this - we're trying to avoid virtual reads + * anyway, so bail on it + */ + + /* gfx_cpu_frequency = gfx_get_core_freq(); */ + + /* SET THE GP SCRATCH AREA */ + /* Color bitmap BLTs use the last 16K of frame buffer space */ + + gfx_gx2_scratch_base = gfx_get_frame_buffer_size() - 0x4000; + } + } + } + +#endif + + if (!version) { + /* ALWAYS SECOND GENERATION IF SIMULATING */ + /* For now, that is. This could change. */ + +#if GFX_DISPLAY_DYNAMIC + gfx_display_type = GFX_DISPLAY_TYPE_GU2; +#endif +#if GFX_2DACCEL_DYNAMIC + gfx_2daccel_type = GFX_2DACCEL_TYPE_GU2; +#endif +#if GFX_INIT_DYNAMIC + gfx_init_type = GFX_INIT_TYPE_GU2; +#endif +#if GFX_MSR_DYNAMIC + gfx_msr_type = GFX_MSR_TYPE_REDCLOUD; +#endif +#if GFX_VIDEO_DYNAMIC + gfx_video_type = GFX_VIDEO_TYPE_REDCLOUD; +#endif +#if GFX_I2C_DYNAMIC + gfx_i2c_type = GFX_I2C_TYPE_GPIO; +#endif + } + gfx_cpu_version = version; + + return (version); +} + +/*---------------------------------------------------------------------------- + * gfx_detect_video + * + * This routine returns the type of the video hardware. + * + * The return value is as follows: + * bits[7:0] = type (1 = CS5530, 2 = SC1200, 3 = Redcloud) + * + * Currently this routine does not actually detect any hardware, and bases + * the video hardware entirely on the detected CPU. + *---------------------------------------------------------------------------- + */ +unsigned long +gfx_detect_video(void) +{ + unsigned long version = 0; + + if ((gfx_cpu_version & 0xFF) == GFX_CPU_GXLV) + version = GFX_VID_CS5530; + else if ((gfx_cpu_version & 0xFF) == GFX_CPU_SC1200) + version = GFX_VID_SC1200; + else if ((gfx_cpu_version & 0xFF) == GFX_CPU_REDCLOUD) + version = GFX_VID_REDCLOUD; + gfx_vid_version = version; + return (version); +} + +/*---------------------------------------------------------------------------- + * gfx_pci_config_read + * + * This routine reads a 32-bit value from the specified location in PCI + * configuration space. + *---------------------------------------------------------------------------- + */ +unsigned long +gfx_pci_config_read(unsigned long address) +{ + unsigned long value = 0xFFFFFFFF; + + OUTD(PCI_CONFIG_ADDR, address); + value = IND(PCI_CONFIG_DATA); + return (value); +} + +/*---------------------------------------------------------------------------- + * gfx_pci_config_write + * + * This routine writes a 32-bit value to the specified location in PCI + * configuration space. + *---------------------------------------------------------------------------- + */ +void +gfx_pci_config_write(unsigned long address, unsigned long data) +{ + OUTD(PCI_CONFIG_ADDR, address); + OUTD(PCI_CONFIG_DATA, data); + return; +} + +/* WRAPPERS IF DYNAMIC SELECTION */ +/* Extra layer to call either first or second generation routines. */ + +#if GFX_INIT_DYNAMIC + +/*---------------------------------------------------------------------------- + * gfx_get_core_freq + *---------------------------------------------------------------------------- + */ +unsigned long +gfx_get_core_freq(void) +{ + unsigned long freq = 0; + +#if GFX_INIT_GU1 + if (gfx_init_type & GFX_INIT_TYPE_GU1) + freq = gu1_get_core_freq(); +#endif +#if GFX_INIT_GU2 + if (gfx_init_type & GFX_INIT_TYPE_GU2) + freq = gu2_get_core_freq(); +#endif + + return freq; +} + +/*---------------------------------------------------------------------------- + * gfx_get_cpu_register_base + *---------------------------------------------------------------------------- + */ +unsigned long +gfx_get_cpu_register_base(void) +{ + unsigned long base = 0; + +#if GFX_INIT_GU1 + if (gfx_init_type & GFX_INIT_TYPE_GU1) + base = gu1_get_cpu_register_base(); +#endif +#if GFX_INIT_GU2 + if (gfx_init_type & GFX_INIT_TYPE_GU2) + base = gu2_get_cpu_register_base(); +#endif + + return (base); +} + +/*---------------------------------------------------------------------------- + * gfx_get_graphics_register_base + *---------------------------------------------------------------------------- + */ +unsigned long +gfx_get_graphics_register_base(void) +{ + unsigned long base = 0; + +#if GFX_INIT_GU2 + if (gfx_init_type & GFX_INIT_TYPE_GU2) + base = gu2_get_graphics_register_base(); +#endif + + return (base); +} + +/*---------------------------------------------------------------------------- + * gfx_get_frame_buffer_base + *---------------------------------------------------------------------------- + */ +unsigned long +gfx_get_frame_buffer_base(void) +{ + unsigned long base = 0; + +#if GFX_INIT_GU1 + if (gfx_init_type & GFX_INIT_TYPE_GU1) + base = gu1_get_frame_buffer_base(); +#endif +#if GFX_INIT_GU2 + if (gfx_init_type & GFX_INIT_TYPE_GU2) + base = gu2_get_frame_buffer_base(); +#endif + + return (base); +} + +/*---------------------------------------------------------------------------- + * gfx_get_frame_buffer_size + *---------------------------------------------------------------------------- + */ +unsigned long +gfx_get_frame_buffer_size(void) +{ + unsigned long size = 0; + +#if GFX_INIT_GU1 + if (gfx_init_type & GFX_INIT_TYPE_GU1) + size = gu1_get_frame_buffer_size(); +#endif +#if GFX_INIT_GU2 + if (gfx_init_type & GFX_INIT_TYPE_GU2) + size = gu2_get_frame_buffer_size(); +#endif + + return size; +} + +/*---------------------------------------------------------------------------- + * gfx_get_vid_register_base + *---------------------------------------------------------------------------- + */ +unsigned long +gfx_get_vid_register_base(void) +{ + unsigned long base = 0; + +#if GFX_INIT_GU1 + if (gfx_init_type & GFX_INIT_TYPE_GU1) + base = gu1_get_vid_register_base(); +#endif +#if GFX_INIT_GU2 + if (gfx_init_type & GFX_INIT_TYPE_GU2) + base = gu2_get_vid_register_base(); +#endif + + return (base); +} + +/*---------------------------------------------------------------------------- + * gfx_get_vip_register_base + *---------------------------------------------------------------------------- + */ +unsigned long +gfx_get_vip_register_base(void) +{ + unsigned long base = 0; + +#if GFX_INIT_GU1 + if (gfx_init_type & GFX_INIT_TYPE_GU1) + base = gu1_get_vip_register_base(); +#endif + + return (base); +} + +#endif + +/* END OF FILE */ diff --git a/driver/xf86-video-geode/src/gfx/gfx_mode.h b/driver/xf86-video-geode/src/gfx/gfx_mode.h new file mode 100644 index 000000000..f9b42b0c7 --- /dev/null +++ b/driver/xf86-video-geode/src/gfx/gfx_mode.h @@ -0,0 +1,194 @@ +/* Copyright (c) 2005 Advanced Micro Devices, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + * + * Neither the name of the Advanced Micro Devices, Inc. nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * */ + +/* + * This header file contains the mode tables. It is used by the "gfx_disp.c" + * file to set a display mode. + * */ + +#ifndef _gfx_mode_h +#define _gfx_mode_h + +/* MODE FLAGS (BITWISE-OR) */ + +#define GFX_MODE_8BPP 0x00000001 +#define GFX_MODE_12BPP 0x00000002 +#define GFX_MODE_15BPP 0x00000004 +#define GFX_MODE_16BPP 0x00000008 +#define GFX_MODE_24BPP 0x00000010 +#define GFX_MODE_56HZ 0x00000020 +#define GFX_MODE_60HZ 0x00000040 +#define GFX_MODE_70HZ 0x00000080 +#define GFX_MODE_72HZ 0x00000100 +#define GFX_MODE_75HZ 0x00000200 +#define GFX_MODE_85HZ 0x00000400 +#define GFX_MODE_90HZ 0x00000800 +#define GFX_MODE_100HZ 0x00001000 +#define GFX_MODE_NEG_HSYNC 0x00002000 +#define GFX_MODE_NEG_VSYNC 0x00004000 +#define GFX_MODE_PIXEL_DOUBLE 0x00008000 +#define GFX_MODE_LINE_DOUBLE 0x00010000 +#define GFX_MODE_TV_NTSC 0x00020000 +#define GFX_MODE_TV_PAL 0x00040000 +#define GFX_MODE_EXCLUDE_PLL 0x00080000 +#define GFX_MODE_LOCK_TIMING 0x10000000 + +#define gfx_mode_hz_conversion \ + switch (hz) { \ + case 56: \ + hz_flag = GFX_MODE_56HZ; \ + break; \ + case 60: \ + hz_flag = GFX_MODE_60HZ; \ + break; \ + case 70: \ + hz_flag = GFX_MODE_70HZ; \ + break; \ + case 72: \ + hz_flag = GFX_MODE_72HZ; \ + break; \ + case 75: \ + hz_flag = GFX_MODE_75HZ; \ + break; \ + case 85: \ + hz_flag = GFX_MODE_85HZ; \ + break; \ + case 90: \ + hz_flag = GFX_MODE_90HZ; \ + break; \ + case 100: \ + hz_flag = GFX_MODE_100HZ; \ + break; \ + } + +#define gfx_mode_bpp_conversion \ + switch (bpp) { \ + case 8: \ + bpp_flag = GFX_MODE_8BPP; \ + break; \ + case 12: \ + bpp_flag = GFX_MODE_12BPP; \ + break; \ + case 15: \ + bpp_flag = GFX_MODE_15BPP; \ + break; \ + case 16: \ + bpp_flag = GFX_MODE_16BPP; \ + break; \ + case 32: \ + bpp_flag = GFX_MODE_24BPP; \ + break; \ + default: \ + return -1; \ + } + +#define gfx_mode_bpp_conversion_def(bpp) \ + switch (bpp) { \ + case 8: \ + bpp_flag = GFX_MODE_8BPP; \ + break; \ + case 12: \ + bpp_flag = GFX_MODE_12BPP; \ + break; \ + case 15: \ + bpp_flag = GFX_MODE_15BPP; \ + break; \ + case 16: \ + bpp_flag = GFX_MODE_16BPP; \ + break; \ + case 32: \ + bpp_flag = GFX_MODE_24BPP; \ + break; \ + default: \ + bpp_flag = GFX_MODE_8BPP; \ + } + +/* STRUCTURE DEFINITION */ + +typedef struct tagDISPLAYMODE +{ + /* DISPLAY MODE FLAGS */ + /* Specify valid color depths and the refresh rate. */ + + unsigned long flags; + + /* TIMINGS */ + + unsigned short hactive; + unsigned short hblankstart; + unsigned short hsyncstart; + unsigned short hsyncend; + unsigned short hblankend; + unsigned short htotal; + + unsigned short vactive; + unsigned short vblankstart; + unsigned short vsyncstart; + unsigned short vsyncend; + unsigned short vblankend; + unsigned short vtotal; + + /* CLOCK FREQUENCY */ + + unsigned long frequency; + +} DISPLAYMODE; + +/* For Fixed timings */ +typedef struct tagFIXEDTIMINGS +{ + /* DISPLAY MODE FLAGS */ + /* Specify valid color depths and the refresh rate. */ + + int panelresx; + int panelresy; + unsigned short xres; + unsigned short yres; + + /* TIMINGS */ + + unsigned short hactive; + unsigned short hblankstart; + unsigned short hsyncstart; + unsigned short hsyncend; + unsigned short hblankend; + unsigned short htotal; + + unsigned short vactive; + unsigned short vblankstart; + unsigned short vsyncstart; + unsigned short vsyncend; + unsigned short vblankend; + unsigned short vtotal; + + /* CLOCK FREQUENCY */ + + unsigned long frequency; + +} FIXEDTIMINGS; + +#endif /* !_gfx_mode_h */ + +/* END OF FILE */ diff --git a/driver/xf86-video-geode/src/gfx/gfx_msr.c b/driver/xf86-video-geode/src/gfx/gfx_msr.c new file mode 100644 index 000000000..1705acb6e --- /dev/null +++ b/driver/xf86-video-geode/src/gfx/gfx_msr.c @@ -0,0 +1,156 @@ +/* Copyright (c) 2005 Advanced Micro Devices, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + * + * Neither the name of the Advanced Micro Devices, Inc. nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * */ + +/* + * This file contains routines to read machine-specific registers (MSRs) + * + * Routines: + * + * gfx_msr_init + * gfx_id_msr_device + * gfx_get_msr_dev_address + * gfx_get_glink_id_at_address + * gfx_msr_read + * gfx_msr_write + * */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +/* INCLUDE SUPPORT FOR REDCLOUD, IF SPECIFIED */ + +#if GFX_MSR_REDCLOUD +#include "msr_rdcl.c" +#endif + +/* EXTRA WRAPPERS FOR DYNAMIC SELECTION */ + +#if GFX_MSR_DYNAMIC + +/*---------------------------------------------------------------------------- + * gfx_msr_init + *---------------------------------------------------------------------------- + */ +int +gfx_msr_init() +{ + int ret_value = 0; + +#if GFX_MSR_REDCLOUD + if (gfx_msr_type & GFX_MSR_TYPE_REDCLOUD) + ret_value = redcloud_msr_init(); +#endif + + return ret_value; +} + +/*---------------------------------------------------------------------------- + * gfx_id_msr_device + *---------------------------------------------------------------------------- + */ +DEV_STATUS +gfx_id_msr_device(MSR * pDev, unsigned long address) +{ + DEV_STATUS ret_value = NOT_KNOWN; + +#if GFX_MSR_REDCLOUD + if (gfx_msr_type & GFX_MSR_TYPE_REDCLOUD) + ret_value = redcloud_id_msr_device(pDev, address); +#endif + + return ret_value; +} + +/*---------------------------------------------------------------------------- + * gfx_get_msr_dev_address + *---------------------------------------------------------------------------- + */ +DEV_STATUS +gfx_get_msr_dev_address(unsigned int device, unsigned long *address) +{ + DEV_STATUS ret_value = NOT_KNOWN; + +#if GFX_MSR_REDCLOUD + if (gfx_msr_type & GFX_MSR_TYPE_REDCLOUD) + ret_value = redcloud_get_msr_dev_address(device, address); +#endif + + return ret_value; +} + +/*---------------------------------------------------------------------------- + * gfx_get_glink_id_at_address + *---------------------------------------------------------------------------- + */ +DEV_STATUS +gfx_get_glink_id_at_address(unsigned int *device, unsigned long address) +{ + DEV_STATUS ret_value = NOT_KNOWN; + +#if GFX_MSR_REDCLOUD + if (gfx_msr_type & GFX_MSR_TYPE_REDCLOUD) + ret_value = redcloud_get_glink_id_at_address(device, address); +#endif + + return ret_value; +} + +/*---------------------------------------------------------------------------- + * gfx_msr_read + *---------------------------------------------------------------------------- + */ +DEV_STATUS +gfx_msr_read(unsigned int device, unsigned int msrRegister, Q_WORD * msrValue) +{ + DEV_STATUS ret_value = NOT_KNOWN; + +#if GFX_MSR_REDCLOUD + if (gfx_msr_type & GFX_MSR_TYPE_REDCLOUD) + ret_value = redcloud_msr_read(device, msrRegister, msrValue); +#endif + + return ret_value; +} + +/*---------------------------------------------------------------------------- + * gfx_msr_write + *---------------------------------------------------------------------------- + */ +DEV_STATUS +gfx_msr_write(unsigned int device, unsigned int msrRegister, + Q_WORD * msrValue) +{ + DEV_STATUS ret_value = NOT_KNOWN; + +#if GFX_MSR_REDCLOUD + if (gfx_msr_type & GFX_MSR_TYPE_REDCLOUD) + ret_value = redcloud_msr_write(device, msrRegister, msrValue); +#endif + + return ret_value; +} + +#endif diff --git a/driver/xf86-video-geode/src/gfx/gfx_priv.h b/driver/xf86-video-geode/src/gfx/gfx_priv.h new file mode 100644 index 000000000..5647af849 --- /dev/null +++ b/driver/xf86-video-geode/src/gfx/gfx_priv.h @@ -0,0 +1,981 @@ +/* Copyright (c) 2005 Advanced Micro Devices, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + * + * Neither the name of the Advanced Micro Devices, Inc. nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * */ + +/* + * This header file contains the prototypes for local and private routines. + * */ + +/*---------------------------------*/ +/* FIRST GENERATION INITIALIZATION */ +/*---------------------------------*/ + +#if GFX_INIT_GU1 + +/* PRIVATE ROUTINES */ + +unsigned char gfx_gxm_config_read(unsigned char index); + +/* DYNAMIC ROUTINES */ + +#if GFX_INIT_DYNAMIC +unsigned long gu1_get_core_freq(void); +unsigned long gu1_get_cpu_register_base(void); +unsigned long gu1_get_graphics_register_base(void); +unsigned long gu1_get_frame_buffer_base(void); +unsigned long gu1_get_frame_buffer_size(void); +unsigned long gu1_get_vid_register_base(void); +unsigned long gu1_get_vip_register_base(void); +#endif + +#endif + +/*----------------------------------*/ +/* SECOND GENERATION INITIALIZATION */ +/*----------------------------------*/ + +#if GFX_INIT_GU2 + +/* DYNAMIC ROUTINES */ + +#if GFX_INIT_DYNAMIC +unsigned long gu2_get_core_freq(void); +unsigned long gu2_get_cpu_register_base(void); +unsigned long gu2_get_graphics_register_base(void); +unsigned long gu2_get_frame_buffer_base(void); +unsigned long gu2_get_frame_buffer_size(void); +unsigned long gu2_get_vid_register_base(void); +unsigned long gu2_get_vip_register_base(void); +#endif + +#endif + +/*----------------------------------*/ +/* MSR ROUTINES */ +/*----------------------------------*/ + +#if GFX_MSR_REDCLOUD + +/* PRIVATE ROUTINES */ + +void redcloud_build_mbus_tree(void); +int redcloud_init_msr_devices(MSR aDev[], unsigned int array_size); +DEV_STATUS redcloud_find_msr_device(MSR * pDev); + +/* DYNAMIC ROUTINES */ + +#if GFX_MSR_DYNAMIC +int redcloud_msr_init(void); +DEV_STATUS redcloud_id_msr_device(MSR * pDev, unsigned long address); +DEV_STATUS redcloud_get_msr_dev_address(unsigned int device, + unsigned long *address); +DEV_STATUS redcloud_get_glink_id_at_address(unsigned int *device, + unsigned long address); +DEV_STATUS redcloud_msr_read(unsigned int device, unsigned int msrRegister, + Q_WORD * msrValue); +DEV_STATUS redcloud_msr_write(unsigned int device, unsigned int msrRegister, + Q_WORD * msrValue); +#endif + +#endif + +void gfx_set_display_video_enable(int enable); +void gfx_set_display_video_size(unsigned short width, unsigned short height); +void gfx_set_display_video_offset(unsigned long offset); +unsigned long gfx_get_display_video_offset(void); +unsigned long gfx_get_display_video_size(void); + +/*----------------------------------*/ +/* FIRST GENERATION DISPLAY */ +/*----------------------------------*/ + +#if GFX_DISPLAY_GU1 + +/* PRIVATE ROUTINES */ + +void gu1_enable_compression(void); +void gu1_disable_compression(void); +void gu1_delay_approximate(unsigned long milliseconds); +void gu1_delay_precise(unsigned long milliseconds); + +/* DYNAMIC ROUTINES */ + +#if GFX_DISPLAY_DYNAMIC +void gu1_set_display_video_enable(int enable); +void gu1_set_display_video_size(unsigned short width, unsigned short height); +void gu1_set_display_video_offset(unsigned long offset); +unsigned long gu1_get_display_video_offset(void); +unsigned long gu1_get_display_video_size(void); +int gu1_set_display_bpp(unsigned short bpp); +int gu1_is_display_mode_supported(int xres, int yres, int bpp, int hz); +int gu1_set_display_mode(int xres, int yres, int bpp, int hz); +int gu1_set_display_timings(unsigned short bpp, unsigned short flags, + unsigned short hactive, unsigned short hblank_start, + unsigned short hsync_start, unsigned short hsync_end, + unsigned short hblank_end, unsigned short htotal, + unsigned short vactive, unsigned short vblank_start, + unsigned short vsync_start, unsigned short vsync_end, + unsigned short vblank_end, unsigned short vtotal, + unsigned long frequency); +int gu1_set_vtotal(unsigned short vtotal); +void gu1_set_display_pitch(unsigned short pitch); +void gu1_set_display_offset(unsigned long offset); +int gu1_set_display_palette_entry(unsigned long index, unsigned long palette); +int gu1_set_display_palette(unsigned long *palette); +void gu1_video_shutdown(void); +void gu1_set_cursor_enable(int enable); +void gu1_set_cursor_colors(unsigned long bkcolor, unsigned long fgcolor); +void gu1_set_cursor_position(unsigned long memoffset, + unsigned short xpos, unsigned short ypos, + unsigned short xhotspot, unsigned short yhotspot); +void gu1_set_cursor_shape32(unsigned long memoffset, + unsigned long *andmask, unsigned long *xormask); +int gu1_set_compression_enable(int enable); +int gu1_set_compression_offset(unsigned long offset); +int gu1_set_compression_pitch(unsigned short pitch); +int gu1_set_compression_size(unsigned short size); +void gu1_set_display_priority_high(int enable); +int gu1_test_timing_active(void); +int gu1_test_vertical_active(void); +int gu1_wait_vertical_blank(void); +void gu1_delay_milliseconds(unsigned long milliseconds); +void gu1_delay_microseconds(unsigned long microseconds); +void gu1_enable_panning(int x, int y); +int gu1_set_fixed_timings(int panelResX, int panelResY, unsigned short width, + unsigned short height, unsigned short bpp); +int gu1_set_panel_present(int panelResX, int panelResY, unsigned short width, + unsigned short height, unsigned short bpp); +void gu1_reset_timing_lock(void); +int gu1_get_display_details(unsigned int mode, int *xres, int *yres, int *hz); +unsigned short gu1_get_display_pitch(void); +unsigned long gu1_get_max_supported_pixel_clock(void); +int gu1_mode_frequency_supported(int xres, int yres, int bpp, + unsigned long frequency); +int gu1_get_refreshrate_from_frequency(int xres, int yres, int bpp, int *hz, + unsigned long frequency); +int gu1_get_refreshrate_from_mode(int xres, int yres, int bpp, int *hz, + unsigned long frequency); +int gu1_get_frequency_from_refreshrate(int xres, int yres, int bpp, int hz, + int *frequency); +int gu1_get_display_mode_count(void); +int gu1_get_display_mode(int *xres, int *yres, int *bpp, int *hz); +unsigned long gu1_get_frame_buffer_line_size(void); +unsigned short gu1_get_hactive(void); +unsigned short gu1_get_hblank_start(void); +unsigned short gu1_get_hsync_start(void); +unsigned short gu1_get_hsync_end(void); +unsigned short gu1_get_hblank_end(void); +unsigned short gu1_get_htotal(void); +unsigned short gu1_get_vactive(void); +unsigned short gu1_get_vline(void); +unsigned short gu1_get_vblank_start(void); +unsigned short gu1_get_vsync_start(void); +unsigned short gu1_get_vsync_end(void); +unsigned short gu1_get_vblank_end(void); +unsigned short gu1_get_vtotal(void); +unsigned short gu1_get_display_bpp(void); +unsigned long gu1_get_display_offset(void); +int gu1_get_display_palette_entry(unsigned long index, + unsigned long *palette); +void gu1_get_display_palette(unsigned long *palette); +unsigned long gu1_get_cursor_enable(void); +unsigned long gu1_get_cursor_offset(void); +unsigned long gu1_get_cursor_position(void); +unsigned long gu1_get_cursor_clip(void); +unsigned long gu1_get_cursor_color(int color); +unsigned long gu1_get_icon_enable(void); +unsigned long gu1_get_icon_offset(void); +unsigned long gu1_get_icon_position(void); +unsigned long gu1_get_icon_color(int color); +int gu1_get_compression_enable(void); +unsigned long gu1_get_compression_offset(void); +unsigned short gu1_get_compression_pitch(void); +unsigned short gu1_get_compression_size(void); +int gu1_get_display_priority_high(void); +int gu1_get_valid_bit(int line); +#endif + +#endif + +void gfx_set_display_video_format(unsigned long format); +void gfx_set_display_video_yuv_offsets(unsigned long yoffset, + unsigned long uoffset, unsigned long voffset); +void gfx_set_display_video_yuv_pitch(unsigned long ypitch, + unsigned long uvpitch); +void gfx_set_display_video_downscale(unsigned short srch, + unsigned short dsth); +void gfx_set_display_video_vertical_downscale_enable(int enable); +void gfx_get_display_video_yuv_offsets(unsigned long *yoffset, + unsigned long *uoffset, unsigned long *voffset); +void gfx_get_display_video_yuv_pitch(unsigned long *ypitch, + unsigned long *uvpitch); +unsigned long gfx_get_display_video_downscale_delta(void); +int gfx_get_display_video_downscale_enable(void); + +/*----------------------------------*/ +/* SECOND GENERATION DISPLAY */ +/*----------------------------------*/ + +#if GFX_DISPLAY_GU2 + +/* PRIVATE ROUTINES */ + +void gu2_enable_compression(void); +void gu2_disable_compression(void); + +/* DYNAMIC ROUTINES */ + +#if GFX_DISPLAY_DYNAMIC +void gu2_get_display_video_yuv_offsets(unsigned long *yoffset, + unsigned long *uoffset, unsigned long *voffset); +void gu2_get_display_video_yuv_pitch(unsigned long *ypitch, + unsigned long *uvpitch); +unsigned long gu2_get_display_video_downscale_delta(void); +int gu2_get_display_video_downscale_enable(void); +void gu2_set_display_video_yuv_offsets(unsigned long yoffset, + unsigned long uoffset, unsigned long voffset); +void gu2_set_display_video_format(unsigned long format); +void gu2_set_display_video_yuv_pitch(unsigned long ypitch, + unsigned long uvpitch); +void gu2_set_display_video_downscale(unsigned short srch, + unsigned short dsth); +void gu2_set_display_video_vertical_downscale_enable(int enable); +void gu2_set_display_video_enable(int enable); +void gu2_set_display_video_size(unsigned short width, unsigned short height); +void gu2_set_display_video_offset(unsigned long offset); +unsigned long gu2_get_display_video_offset(void); +unsigned long gu2_get_display_video_size(void); +int gu2_set_display_bpp(unsigned short bpp); +int gu2_is_display_mode_supported(int xres, int yres, int bpp, int hz); +int gu2_set_display_mode(int xres, int yres, int bpp, int hz); +int gu2_set_display_timings(unsigned short bpp, unsigned short flags, + unsigned short hactive, unsigned short hblank_start, + unsigned short hsync_start, unsigned short hsync_end, + unsigned short hblank_end, unsigned short htotal, + unsigned short vactive, unsigned short vblank_start, + unsigned short vsync_start, unsigned short vsync_end, + unsigned short vblank_end, unsigned short vtotal, + unsigned long frequency); +int gu2_set_vtotal(unsigned short vtotal); +void gu2_set_display_pitch(unsigned short pitch); +void gu2_set_display_offset(unsigned long offset); +int gu2_set_display_palette_entry(unsigned long index, unsigned long palette); +int gu2_set_display_palette(unsigned long *palette); +void gu2_set_cursor_enable(int enable); +void gu2_set_cursor_colors(unsigned long bkcolor, unsigned long fgcolor); +void gu2_set_cursor_position(unsigned long memoffset, + unsigned short xpos, unsigned short ypos, + unsigned short xhotspot, unsigned short yhotspot); +void gu2_set_cursor_shape32(unsigned long memoffset, + unsigned long *andmask, unsigned long *xormask); +void gu2_set_cursor_shape64(unsigned long memoffset, + unsigned long *andmask, unsigned long *xormask); +void gu2_set_icon_enable(int enable); +void gu2_set_icon_colors(unsigned long color0, unsigned long color1, + unsigned long color2); +void gu2_set_icon_position(unsigned long memoffset, unsigned short xpos); +void gu2_set_icon_shape64(unsigned long memoffset, unsigned long *andmask, + unsigned long *xormask, unsigned int lines); +int gu2_set_compression_enable(int enable); +int gu2_set_compression_offset(unsigned long offset); +int gu2_set_compression_pitch(unsigned short pitch); +int gu2_set_compression_size(unsigned short size); +void gu2_set_display_priority_high(int enable); +int gu2_test_timing_active(void); +int gu2_test_vertical_active(void); +int gu2_wait_vertical_blank(void); +void gu2_delay_milliseconds(unsigned long milliseconds); +void gu2_delay_microseconds(unsigned long microseconds); +void gu2_enable_panning(int x, int y); +int gu2_is_panel_mode_supported(int panelResX, int panelResY, + unsigned short width, unsigned short height, unsigned short bpp); +int gu2_set_fixed_timings(int panelResX, int panelResY, unsigned short width, + unsigned short height, unsigned short bpp); +int gu2_set_panel_present(int panelResX, int panelResY, unsigned short width, + unsigned short height, unsigned short bpp); +void gu2_reset_timing_lock(void); +int gu2_get_display_details(unsigned int mode, int *xres, int *yres, int *hz); +unsigned short gu2_get_display_pitch(void); +unsigned long gu2_get_max_supported_pixel_clock(void); +int gu2_mode_frequency_supported(int xres, int yres, int bpp, + unsigned long frequency); +int gu2_get_refreshrate_from_frequency(int xres, int yres, int bpp, int *hz, + unsigned long frequency); +int gu2_get_refreshrate_from_mode(int xres, int yres, int bpp, int *hz, + unsigned long frequency); +int gu2_get_frequency_from_refreshrate(int xres, int yres, int bpp, int hz, + int *frequency); +int gu2_get_display_mode_count(void); +int gu2_get_display_mode(int *xres, int *yres, int *bpp, int *hz); +unsigned long gu2_get_frame_buffer_line_size(void); +unsigned short gu2_get_hactive(void); +unsigned short gu2_get_hblank_start(void); +unsigned short gu2_get_hsync_start(void); +unsigned short gu2_get_hsync_end(void); +unsigned short gu2_get_hblank_end(void); +unsigned short gu2_get_htotal(void); +unsigned short gu2_get_vactive(void); +unsigned short gu2_get_vline(void); +unsigned short gu2_get_vblank_start(void); +unsigned short gu2_get_vsync_start(void); +unsigned short gu2_get_vsync_end(void); +unsigned short gu2_get_vblank_end(void); +unsigned short gu2_get_vtotal(void); +unsigned short gu2_get_display_bpp(void); +unsigned long gu2_get_display_offset(void); +int gu2_get_display_palette_entry(unsigned long index, + unsigned long *palette); +void gu2_get_display_palette(unsigned long *palette); +unsigned long gu2_get_cursor_enable(void); +unsigned long gu2_get_cursor_offset(void); +unsigned long gu2_get_cursor_position(void); +unsigned long gu2_get_cursor_clip(void); +unsigned long gu2_get_cursor_color(int color); +unsigned long gu2_get_icon_enable(void); +unsigned long gu2_get_icon_offset(void); +unsigned long gu2_get_icon_position(void); +unsigned long gu2_get_icon_color(int color); +int gu2_get_compression_enable(void); +unsigned long gu2_get_compression_offset(void); +unsigned short gu2_get_compression_pitch(void); +unsigned short gu2_get_compression_size(void); +int gu2_get_valid_bit(int line); +#endif + +#endif + +/*----------------------------------*/ +/* FIRST GENERATION 2D ACCELERATION */ +/*----------------------------------*/ + +#if GFX_2DACCEL_GU1 + +/* PRIVATE ROUTINES */ + +void gu1_solid_fill(unsigned short x, unsigned short y, + unsigned short width, unsigned short height, unsigned long color); +void gu1_detect_blt_buffer_base(void); + +/* DYNAMIC ROUTINES */ + +#if GFX_2DACCEL_DYNAMIC +void gu1_set_bpp(unsigned short bpp); +void gu1_set_solid_pattern(unsigned long color); +void gu1_set_mono_pattern(unsigned long bgcolor, unsigned long fgcolor, + unsigned long data0, unsigned long data1, unsigned char transparency); +void gu1_set_color_pattern(unsigned long bgcolor, unsigned long fgcolor, + unsigned long data0, unsigned long data1, unsigned long data2, + unsigned long data3, unsigned char transparency); +void gu1_load_color_pattern_line(short y, unsigned long *pattern_8x8); +void gu1_set_solid_source(unsigned long color); +void gu1_set_mono_source(unsigned long bgcolor, unsigned long fgcolor, + unsigned short transparent); +void gu1_set_pattern_flags(unsigned short flags); +void gu1_set_raster_operation(unsigned char rop); +void gu1_pattern_fill(unsigned short x, unsigned short y, + unsigned short width, unsigned short height); +void gu1_color_pattern_fill(unsigned short x, unsigned short y, + unsigned short width, unsigned short height, unsigned long *pattern); +void gu1_screen_to_screen_blt(unsigned short srcx, unsigned short srcy, + unsigned short dstx, unsigned short dsty, unsigned short width, + unsigned short height); +void gu1_screen_to_screen_xblt(unsigned short srcx, unsigned short srcy, + unsigned short dstx, unsigned short dsty, unsigned short width, + unsigned short height, unsigned long color); +void gu1_color_bitmap_to_screen_blt(unsigned short srcx, unsigned short srcy, + unsigned short dstx, unsigned short dsty, unsigned short width, + unsigned short height, unsigned char *data, long pitch); +void gu1_color_bitmap_to_screen_xblt(unsigned short srcx, unsigned short srcy, + unsigned short dstx, unsigned short dsty, unsigned short width, + unsigned short height, unsigned char *data, long pitch, + unsigned long color); +void gu1_mono_bitmap_to_screen_blt(unsigned short srcx, unsigned short srcy, + unsigned short dstx, unsigned short dsty, unsigned short width, + unsigned short height, unsigned char *data, short pitch); +void gu1_text_blt(unsigned short dstx, unsigned short dsty, + unsigned short width, unsigned short height, unsigned char *data); +void gu1_bresenham_line(unsigned short x, unsigned short y, + unsigned short length, unsigned short initerr, unsigned short axialerr, + unsigned short diagerr, unsigned short flags); +void gu1_wait_until_idle(void); +int gu1_test_blt_pending(void); +#endif + +#endif + +/*-----------------------------------*/ +/* SECOND GENERATION 2D ACCELERATION */ +/*-----------------------------------*/ + +#if GFX_2DACCEL_GU2 + +/* DYNAMIC ROUTINES */ + +#if GFX_2DACCEL_DYNAMIC +void gfx_reset_pitch(unsigned short pitch); +void gu2_reset_pitch(unsigned short pitch); +void gu2_set_bpp(unsigned short bpp); +void gu2_set_solid_pattern(unsigned long color); +void gu2_set_mono_pattern(unsigned long bgcolor, unsigned long fgcolor, + unsigned long data0, unsigned long data1, unsigned char transparency); +void gu2_set_color_pattern(unsigned long bgcolor, unsigned long fgcolor, + unsigned long data0, unsigned long data1, unsigned long data2, + unsigned long data3, unsigned char transparency); +void gu2_load_color_pattern_line(short y, unsigned long *pattern_8x8); +void gu2_set_solid_source(unsigned long color); +void gu2_set_mono_source(unsigned long bgcolor, unsigned long fgcolor, + unsigned short transparent); +void gu2_set_pattern_flags(unsigned short flags); +void gu2_set_raster_operation(unsigned char rop); +void gu2_pattern_fill(unsigned short x, unsigned short y, + unsigned short width, unsigned short height); +void gu2_color_pattern_fill(unsigned short x, unsigned short y, + unsigned short width, unsigned short height, unsigned long *pattern); +void gu2_screen_to_screen_blt(unsigned short srcx, unsigned short srcy, + unsigned short dstx, unsigned short dsty, unsigned short width, + unsigned short height); +void gu2_screen_to_screen_xblt(unsigned short srcx, unsigned short srcy, + unsigned short dstx, unsigned short dsty, unsigned short width, + unsigned short height, unsigned long color); +void gu2_color_bitmap_to_screen_blt(unsigned short srcx, unsigned short srcy, + unsigned short dstx, unsigned short dsty, unsigned short width, + unsigned short height, unsigned char *data, long pitch); +void gu2_color_bitmap_to_screen_xblt(unsigned short srcx, unsigned short srcy, + unsigned short dstx, unsigned short dsty, unsigned short width, + unsigned short height, unsigned char *data, long pitch, + unsigned long color); +void gu2_mono_bitmap_to_screen_blt(unsigned short srcx, unsigned short srcy, + unsigned short dstx, unsigned short dsty, unsigned short width, + unsigned short height, unsigned char *data, short pitch); +void gu2_text_blt(unsigned short dstx, unsigned short dsty, + unsigned short width, unsigned short height, unsigned char *data); +void gu2_bresenham_line(unsigned short x, unsigned short y, + unsigned short length, unsigned short initerr, unsigned short axialerr, + unsigned short diagerr, unsigned short flags); +void gu2_wait_until_idle(void); +int gu2_test_blt_pending(void); + +void gu22_set_source_stride(unsigned short stride); +void gu22_set_destination_stride(unsigned short stride); +void gu22_set_pattern_origin(int x, int y); +void gu22_set_source_transparency(unsigned long color, unsigned long mask); +void gu22_set_alpha_mode(int mode); +void gu22_set_alpha_value(unsigned char value); +void gu22_pattern_fill(unsigned long dstoffset, unsigned short width, + unsigned short height); +void gu22_color_pattern_fill(unsigned long dstoffset, unsigned short width, + unsigned short height, unsigned long *pattern); +void gu22_screen_to_screen_blt(unsigned long srcoffset, + unsigned long dstoffset, unsigned short width, unsigned short height, + int flags); +void gu22_mono_expand_blt(unsigned long srcbase, unsigned short srcx, + unsigned short srcy, unsigned long dstoffset, unsigned short width, + unsigned short height, int byte_packed); +void gu22_color_bitmap_to_screen_blt(unsigned short srcx, unsigned short srcy, + unsigned long dstoffset, unsigned short width, unsigned short height, + unsigned char *data, short pitch); +void gu22_mono_bitmap_to_screen_blt(unsigned short srcx, unsigned short srcy, + unsigned long dstoffset, unsigned short width, unsigned short height, + unsigned char *data, short pitch); +void gu22_text_blt(unsigned long dstoffset, unsigned short width, + unsigned short height, unsigned char *data); +void gu22_bresenham_line(unsigned long dstoffset, unsigned short length, + unsigned short initerr, unsigned short axialerr, unsigned short diagerr, + unsigned short flags); +void gu22_sync_to_vblank(void); +#endif + +#endif + +void gfx_reset_video(void); +int gfx_set_display_control(int sync_polarities); +int gfx_set_screen_enable(int enable); + +/*-----------------------*/ +/* CS5530 VIDEO ROUTINES */ +/*-----------------------*/ + +#if GFX_VIDEO_CS5530 + +/* PRIVATE ROUTINES */ + +/* DYNAMIC ROUTINES */ + +#if GFX_VIDEO_DYNAMIC +void cs5530_reset_video(void); +int cs5530_set_display_control(int sync_polarities); +void cs5530_set_clock_frequency(unsigned long frequency); +unsigned long cs5530_get_clock_frequency(void); +int cs5530_set_crt_enable(int enable); +int cs5530_get_sync_polarities(void); +int cs5530_get_vsa2_softvga_enable(void); +int cs5530_set_video_enable(int enable); +int cs5530_set_video_format(unsigned long format); +int cs5530_set_video_size(unsigned short width, unsigned short height); +int cs5530_set_video_offset(unsigned long offset); +int cs5530_set_video_window(short x, short y, unsigned short w, + unsigned short h); +int cs5530_set_video_left_crop(unsigned short x); +int cs5530_set_video_scale(unsigned short srcw, unsigned short srch, + unsigned short dstw, unsigned short dsth); +int cs5530_set_video_color_key(unsigned long key, unsigned long mask, + int bluescreen); +int cs5530_set_video_filter(int xfilter, int yfilter); +int cs5530_set_video_palette(unsigned long *palette); +int cs5530_set_video_palette_entry(unsigned long index, unsigned long color); +int cs5530_disable_softvga(void); +int cs5530_enable_softvga(void); +unsigned long cs5530_get_max_video_width(void); + +/* READ ROUTINES IN GFX_VID.C */ + +int cs5530_get_video_enable(void); +int cs5530_get_video_format(void); +unsigned long cs5530_get_video_src_size(void); +unsigned long cs5530_get_video_line_size(void); +unsigned long cs5530_get_video_xclip(void); +unsigned long cs5530_get_video_offset(void); +unsigned long cs5530_get_video_upscale(void); +unsigned long cs5530_get_video_scale(void); +unsigned long cs5530_get_video_dst_size(void); +unsigned long cs5530_get_video_position(void); +unsigned long cs5530_get_video_color_key(void); +unsigned long cs5530_get_video_color_key_mask(void); +int cs5530_get_video_palette_entry(unsigned long index, + unsigned long *palette); +int cs5530_get_video_color_key_src(void); +int cs5530_get_video_filter(void); +unsigned long cs5530_read_crc(void); +#endif +#endif + +/*-----------------------*/ +/* SC1200 VIDEO ROUTINES */ +/*-----------------------*/ + +#if GFX_VIDEO_SC1200 + +/* PRIVATE ROUTINES */ + +/* DYNAMIC ROUTINES */ + +#if GFX_VIDEO_DYNAMIC +void sc1200_reset_video(void); +int sc1200_set_display_control(int sync_polarities); +int sc1200_set_screen_enable(int enable); +void sc1200_set_clock_frequency(unsigned long frequency); +unsigned long sc1200_get_clock_frequency(void); +int sc1200_set_crt_enable(int enable); +int sc1200_get_sync_polarities(void); +int sc1200_get_vsa2_softvga_enable(void); +int sc1200_set_video_enable(int enable); +int sc1200_set_video_format(unsigned long format); +int sc1200_set_video_size(unsigned short width, unsigned short height); +int sc1200_set_video_offset(unsigned long offset); +int sc1200_set_video_window(short x, short y, unsigned short w, + unsigned short h); +int sc1200_set_video_left_crop(unsigned short x); +int sc1200_set_video_upscale(unsigned short srcw, unsigned short srch, + unsigned short dstw, unsigned short dsth); +int sc1200_set_video_scale(unsigned short srcw, unsigned short srch, + unsigned short dstw, unsigned short dsth); +int sc1200_set_video_downscale_config(unsigned short type, unsigned short m); +int sc1200_set_video_color_key(unsigned long key, unsigned long mask, + int bluescreen); +int sc1200_set_video_filter(int xfilter, int yfilter); +int sc1200_set_video_palette(unsigned long *palette); +int sc1200_set_video_palette_bypass(int enable); +int sc1200_set_video_palette_entry(unsigned long index, unsigned long color); +int sc1200_set_video_downscale_coefficients(unsigned short coef1, + unsigned short coef2, unsigned short coef3, unsigned short coef4); +int sc1200_set_video_downscale_enable(int enable); +int sc1200_set_video_source(VideoSourceType source); +int sc1200_set_vbi_source(VbiSourceType source); +int sc1200_set_vbi_lines(unsigned long even, unsigned long odd); +int sc1200_set_vbi_total(unsigned long even, unsigned long odd); +int sc1200_set_video_interlaced(int enable); +int sc1200_set_color_space_YUV(int enable); +int sc1200_set_vertical_scaler_offset(char offset); +int sc1200_set_top_line_in_odd(int enable); +int sc1200_set_genlock_delay(unsigned long delay); +int sc1200_set_genlock_enable(int flags); +int sc1200_set_video_cursor(unsigned long key, unsigned long mask, + unsigned short select_color2, unsigned long color1, unsigned long color2); +int sc1200_set_video_request(short x, short y); + +int sc1200_select_alpha_region(int region); +int sc1200_set_alpha_enable(int enable); +int sc1200_set_alpha_window(short x, short y, + unsigned short width, unsigned short height); +int sc1200_set_alpha_value(unsigned char alpha, char delta); +int sc1200_set_alpha_priority(int priority); +int sc1200_set_alpha_color(unsigned long color); +int sc1200_set_alpha_color_enable(int enable); +int sc1200_set_no_ck_outside_alpha(int enable); +int sc1200_disable_softvga(void); +int sc1200_enable_softvga(void); +int sc1200_set_macrovision_enable(int enable); +unsigned long sc1200_get_max_video_width(void); + +/* READ ROUTINES IN GFX_VID.C */ + +int sc1200_get_video_enable(void); +int sc1200_get_video_format(void); +unsigned long sc1200_get_video_src_size(void); +unsigned long sc1200_get_video_line_size(void); +unsigned long sc1200_get_video_xclip(void); +unsigned long sc1200_get_video_offset(void); +unsigned long sc1200_get_video_upscale(void); +unsigned long sc1200_get_video_scale(void); +int sc1200_get_video_downscale_config(unsigned short *type, + unsigned short *m); +void sc1200_get_video_downscale_coefficients(unsigned short *coef1, + unsigned short *coef2, unsigned short *coef3, unsigned short *coef4); +void sc1200_get_video_downscale_enable(int *enable); +unsigned long sc1200_get_video_dst_size(void); +unsigned long sc1200_get_video_position(void); +unsigned long sc1200_get_video_color_key(void); +unsigned long sc1200_get_video_color_key_mask(void); +int sc1200_get_video_palette_entry(unsigned long index, + unsigned long *palette); +int sc1200_get_video_color_key_src(void); +int sc1200_get_video_filter(void); +int sc1200_get_video_request(short *x, short *y); +int sc1200_get_video_source(VideoSourceType * source); +int sc1200_get_vbi_source(VbiSourceType * source); +unsigned long sc1200_get_vbi_lines(int odd); +unsigned long sc1200_get_vbi_total(int odd); +int sc1200_get_video_interlaced(void); +int sc1200_get_color_space_YUV(void); +int sc1200_get_vertical_scaler_offset(char *offset); +unsigned long sc1200_get_genlock_delay(void); +int sc1200_get_genlock_enable(void); +int sc1200_get_video_cursor(unsigned long *key, unsigned long *mask, + unsigned short *select_color2, unsigned long *color1, + unsigned short *color2); +unsigned long sc1200_read_crc(void); +int sc1200_get_macrovision_enable(void); + +void sc1200_get_alpha_enable(int *enable); +void sc1200_get_alpha_size(unsigned short *x, unsigned short *y, + unsigned short *width, unsigned short *height); +void sc1200_get_alpha_value(unsigned char *alpha, char *delta); +void sc1200_get_alpha_priority(int *priority); +void sc1200_get_alpha_color(unsigned long *color); +#endif +#endif + +/*-------------------------*/ +/* REDCLOUD VIDEO ROUTINES */ +/*-------------------------*/ + +#if GFX_VIDEO_REDCLOUD + +/* PRIVATE ROUTINES */ + +/* DYNAMIC ROUTINES */ + +#if GFX_VIDEO_DYNAMIC +void redcloud_reset_video(void); +int redcloud_set_display_control(int sync_polarities); +void redcloud_set_clock_frequency(unsigned long frequency); +unsigned long redcloud_get_clock_frequency(void); +int redcloud_set_crt_enable(int enable); +int redcloud_get_sync_polarities(void); +int redcloud_set_video_enable(int enable); +int redcloud_set_video_format(unsigned long format); +int redcloud_set_video_size(unsigned short width, unsigned short height); +int redcloud_set_video_yuv_pitch(unsigned long ypitch, unsigned long uvpitch); +int redcloud_set_video_offset(unsigned long offset); +int redcloud_set_video_yuv_offsets(unsigned long yoffset, + unsigned long uoffset, unsigned long voffset); +int redcloud_set_video_window(short x, short y, unsigned short w, + unsigned short h); +int redcloud_set_video_left_crop(unsigned short x); +int redcloud_set_video_scale(unsigned short srcw, unsigned short srch, + unsigned short dstw, unsigned short dsth); +int redcloud_set_video_vertical_downscale(unsigned short srch, + unsigned short dsth); +void redcloud_set_video_vertical_downscale_enable(int enable); +int redcloud_set_video_downscale_config(unsigned short type, + unsigned short m); +int redcloud_set_video_color_key(unsigned long key, unsigned long mask, + int bluescreen); +int redcloud_set_video_filter(int xfilter, int yfilter); +int redcloud_set_video_palette(unsigned long *palette); +int redcloud_set_graphics_palette(unsigned long *palette); +int redcloud_set_video_palette_bypass(int enable); +int redcloud_set_video_palette_entry(unsigned long index, + unsigned long color); +int redcloud_set_graphics_palette_entry(unsigned long index, + unsigned long color); +int redcloud_set_video_downscale_coefficients(unsigned short coef1, + unsigned short coef2, unsigned short coef3, unsigned short coef4); +int redcloud_set_video_downscale_enable(int enable); +int redcloud_set_video_cursor(unsigned long key, unsigned long mask, + unsigned short select_color2, unsigned long color1, unsigned long color2); +int redcloud_set_video_cursor_enable(int enable); + +int redcloud_select_alpha_region(int region); +int redcloud_set_alpha_enable(int enable); +int redcloud_set_alpha_window(short x, short y, + unsigned short width, unsigned short height); +int redcloud_set_alpha_value(unsigned char alpha, char delta); +int redcloud_set_alpha_priority(int priority); +int redcloud_set_alpha_color(unsigned long color); +int redcloud_set_alpha_color_enable(int enable); +int redcloud_set_no_ck_outside_alpha(int enable); +int redcloud_set_video_request(short x, short y); + +/* READ ROUTINES IN GFX_VID.C */ + +int redcloud_get_video_enable(void); +int redcloud_get_video_format(void); +unsigned long redcloud_get_video_src_size(void); +unsigned long redcloud_get_video_line_size(void); +unsigned long redcloud_get_video_xclip(void); +unsigned long redcloud_get_video_offset(void); +void redcloud_get_video_yuv_offsets(unsigned long *yoffset, + unsigned long *uoffset, unsigned long *voffset); +void redcloud_get_video_yuv_pitch(unsigned long *ypitch, + unsigned long *uvpitch); +unsigned long redcloud_get_video_scale(void); +unsigned long redcloud_get_video_downscale_delta(void); +int redcloud_get_video_vertical_downscale_enable(void); +int redcloud_get_video_downscale_config(unsigned short *type, + unsigned short *m); +void redcloud_get_video_downscale_coefficients(unsigned short *coef1, + unsigned short *coef2, unsigned short *coef3, unsigned short *coef4); +void redcloud_get_video_downscale_enable(int *enable); +unsigned long redcloud_get_video_dst_size(void); +unsigned long redcloud_get_video_position(void); +unsigned long redcloud_get_video_color_key(void); +unsigned long redcloud_get_video_color_key_mask(void); +int redcloud_get_video_palette_entry(unsigned long index, + unsigned long *palette); +int redcloud_get_video_color_key_src(void); +int redcloud_get_video_filter(void); +int redcloud_get_video_cursor(unsigned long *key, unsigned long *mask, + unsigned short *select_color2, unsigned long *color1, + unsigned short *color2); +unsigned long redcloud_read_crc(void); +unsigned long redcloud_read_crc32(void); +unsigned long redcloud_read_window_crc(int source, unsigned short x, + unsigned short y, unsigned short width, unsigned short height, int crc32); + +void redcloud_get_alpha_enable(int *enable); +void redcloud_get_alpha_size(unsigned short *x, unsigned short *y, + unsigned short *width, unsigned short *height); +void redcloud_get_alpha_value(unsigned char *alpha, char *delta); +void redcloud_get_alpha_priority(int *priority); +void redcloud_get_alpha_color(unsigned long *color); +int redcloud_get_video_request(short *x, short *y); +#endif +#endif + +/*--------------*/ +/* VIP ROUTINES */ +/*--------------*/ + +#if GFX_VIP_SC1200 + +/* DYNAMIC ROUTINES */ + +#if GFX_VIP_DYNAMIC +int sc1200_set_vip_enable(int enable); +int sc1200_set_vip_capture_run_mode(int mode); +int sc1200_set_vip_base(unsigned long even, unsigned long odd); +int sc1200_set_vip_pitch(unsigned long pitch); +int sc1200_set_vip_mode(int mode); +int sc1200_set_vbi_enable(int enable); +int sc1200_set_vbi_mode(int mode); +int sc1200_set_vbi_base(unsigned long even, unsigned long odd); +int sc1200_set_vbi_pitch(unsigned long pitch); +int sc1200_set_vbi_direct(unsigned long even_lines, unsigned long odd_lines); +int sc1200_set_vbi_interrupt(int enable); +int sc1200_set_vip_bus_request_threshold_high(int enable); +int sc1200_set_vip_last_line(int last_line); +int sc1200_test_vip_odd_field(void); +int sc1200_test_vip_bases_updated(void); +int sc1200_test_vip_fifo_overflow(void); +int sc1200_get_vip_line(void); +int sc1200_get_vip_enable(void); +unsigned long sc1200_get_vip_base(int odd); +unsigned long sc1200_get_vip_pitch(void); +int sc1200_get_vip_mode(void); +int sc1200_get_vbi_enable(void); +int sc1200_get_vbi_mode(void); +unsigned long sc1200_get_vbi_base(int odd); +unsigned long sc1200_get_vbi_pitch(void); +unsigned long sc1200_get_vbi_direct(int odd); +int sc1200_get_vbi_interrupt(void); +int sc1200_get_vip_bus_request_threshold_high(void); +#endif +#endif + +/* DECODER ROUTINES */ + +#if GFX_DECODER_SAA7114 + +/* PRIVATE ROUTINES */ + +int saa7114_write_reg(unsigned char reg, unsigned char val); +int saa7114_read_reg(unsigned char reg, unsigned char *val); + +/* DYNAMIC ROUTINES */ + +#if GFX_DECODER_DYNAMIC +int saa7114_set_decoder_defaults(void); +int saa7114_set_decoder_analog_input(unsigned char input); +int saa7114_set_decoder_brightness(unsigned char brightness); +int saa7114_set_decoder_contrast(unsigned char contrast); +int saa7114_set_decoder_hue(char hue); +int saa7114_set_decoder_saturation(unsigned char saturation); +int saa7114_set_decoder_input_offset(unsigned short x, unsigned short y); +int saa7114_set_decoder_input_size(unsigned short width, + unsigned short height); +int saa7114_set_decoder_output_size(unsigned short width, + unsigned short height); +int saa7114_set_decoder_scale(unsigned short srcw, unsigned short srch, + unsigned short dstw, unsigned short dsth); +int saa7114_set_decoder_vbi_format(int start, int end, int format); +int saa7114_set_decoder_vbi_enable(int enable); +int saa7114_set_decoder_vbi_upscale(void); +int saa7114_set_decoder_TV_standard(TVStandardType TVStandard); +int saa7114_set_decoder_luminance_filter(unsigned char lufi); +int saa7114_decoder_software_reset(void); +int saa7114_decoder_detect_macrovision(void); +int saa7114_decoder_detect_video(void); +unsigned char saa7114_get_decoder_brightness(void); +unsigned char saa7114_get_decoder_contrast(void); +char saa7114_get_decoder_hue(void); +unsigned char saa7114_get_decoder_saturation(void); +unsigned long saa7114_get_decoder_input_offset(void); +unsigned long saa7114_get_decoder_input_size(void); +unsigned long saa7114_get_decoder_output_size(void); +int saa7114_get_decoder_vbi_format(int line); +#endif +#endif + +/* ACCESS I2C ROUTINES */ + +#if GFX_I2C_ACCESS + +#if GFX_I2C_DYNAMIC +int acc_i2c_reset(unsigned char busnum, short adr, char freq); +int acc_i2c_write(unsigned char busnum, unsigned char chipadr, + unsigned char subadr, unsigned char bytes, unsigned char *data); +int acc_i2c_read(unsigned char busnum, unsigned char chipadr, + unsigned char subadr, unsigned char bytes, unsigned char *data); +int acc_i2c_select_gpio(int clock, int data); +int acc_i2c_init(void); +void acc_i2c_cleanup(void); +#endif +#endif + +/* GPIO I2C ROUTINES */ + +#if GFX_I2C_GPIO + +#if GFX_I2C_DYNAMIC +int gpio_i2c_reset(unsigned char busnum, short adr, char freq); +int gpio_i2c_write(unsigned char busnum, unsigned char chipadr, + unsigned char subadr, unsigned char bytes, unsigned char *data); +int gpio_i2c_read(unsigned char busnum, unsigned char chipadr, + unsigned char subadr, unsigned char bytes, unsigned char *data); +int gpio_i2c_select_gpio(int clock, int data); +int gpio_i2c_init(void); +void gpio_i2c_cleanup(void); +#endif +#endif + +/* TV ROUTINES */ + +#if GFX_TV_SC1200 + +#if GFX_TV_DYNAMIC +int sc1200_set_tv_format(TVStandardType format, GfxOnTVType resolution); +int sc1200_set_tv_output(int output); +int sc1200_set_tv_enable(int enable); +int sc1200_set_tv_flicker_filter(int ff); +int sc1200_set_tv_sub_carrier_reset(int screset); +int sc1200_set_tv_vphase(int vphase); +int sc1200_set_tv_YC_delay(int delay); +int sc1200_set_tvenc_reset_interval(int interval); +int sc1200_set_tv_cc_enable(int enable); +int sc1200_set_tv_cc_data(unsigned char data1, unsigned char data2); +int sc1200_set_tv_display(int width, int height); +int sc1200_test_tvout_odd_field(void); +int sc1200_test_tvenc_odd_field(void); +int sc1200_set_tv_field_status_invert(int enable); +int sc1200_get_tv_vphase(void); +int sc1200_get_tv_enable(unsigned int *p_on); +int sc1200_get_tv_output(void); +int sc1200_get_tv_mode_count(TVStandardType format); +int sc1200_get_tv_display_mode(int *width, int *height, int *bpp, int *hz); +int sc1200_get_tv_display_mode_frequency(unsigned short width, + unsigned short height, TVStandardType format, int *frequency); +int sc1200_is_tv_display_mode_supported(unsigned short width, + unsigned short height, TVStandardType format); +unsigned char cc_add_parity_bit(unsigned char data); + +#endif +#endif + +/* FS450 ROUTINES */ + +#if GFX_TV_FS451 + +#if GFX_TV_DYNAMIC +int fs450_set_tv_format(TVStandardType format, GfxOnTVType resolution); +int fs450_set_tv_output(int output); +int fs450_set_tv_enable(int enable); +int fs450_get_tv_standard(unsigned long *p_standard); +int fs450_get_available_tv_standards(unsigned long *p_standards); +int fs450_set_tv_standard(unsigned long standard); +int fs450_get_tv_vga_mode(unsigned long *p_vga_mode); +int fs450_get_available_tv_vga_modes(unsigned long *p_vga_modes); +int fs450_set_tv_vga_mode(unsigned long vga_mode); +int fs450_get_tvout_mode(unsigned long *p_tvout_mode); +int fs450_set_tvout_mode(unsigned long tvout_mode); +int fs450_get_sharpness(int *p_sharpness); +int fs450_set_sharpness(int sharpness); +int fs450_get_flicker_filter(int *p_flicker); +int fs450_set_flicker_filter(int flicker); +int fs450_get_overscan(int *p_x, int *p_y); +int fs450_set_overscan(int x, int y); +int fs450_get_position(int *p_x, int *p_y); +int fs450_set_position(int x, int y); +int fs450_get_color(int *p_color); +int fs450_set_color(int color); +int fs450_get_brightness(int *p_brightness); +int fs450_set_brightness(int brightness); +int fs450_get_contrast(int *p_contrast); +int fs450_set_contrast(int constrast); +int fs450_get_yc_filter(unsigned int *p_yc_filter); +int fs450_set_yc_filter(unsigned int yc_filter); +int fs450_get_aps_trigger_bits(unsigned int *p_trigger_bits); +int fs450_set_aps_trigger_bits(unsigned int trigger_bits); +#endif +#endif diff --git a/driver/xf86-video-geode/src/gfx/gfx_regs.h b/driver/xf86-video-geode/src/gfx/gfx_regs.h new file mode 100644 index 000000000..2326f61a4 --- /dev/null +++ b/driver/xf86-video-geode/src/gfx/gfx_regs.h @@ -0,0 +1,1276 @@ +/* Copyright (c) 2005 Advanced Micro Devices, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + * + * Neither the name of the Advanced Micro Devices, Inc. nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * */ + +/* + * This header file contains the graphics register definitions. + * */ + +/*----------------------------------*/ +/* FIRST GENERATION GRAPHICS UNIT */ +/*----------------------------------*/ + +#define GP_DST_XCOOR 0x8100 /* x destination origin */ +#define GP_DST_YCOOR 0x8102 /* y destination origin */ +#define GP_WIDTH 0x8104 /* pixel width */ +#define GP_HEIGHT 0x8106 /* pixel height */ +#define GP_SRC_XCOOR 0x8108 /* x source origin */ +#define GP_SRC_YCOOR 0x810A /* y source origin */ + +#define GP_VECTOR_LENGTH 0x8104 /* vector length */ +#define GP_INIT_ERROR 0x8106 /* vector initial error */ +#define GP_AXIAL_ERROR 0x8108 /* axial error increment */ +#define GP_DIAG_ERROR 0x810A /* diagonal error increment */ + +#define GP_SRC_COLOR_0 0x810C /* source color 0 */ +#define GP_SRC_COLOR_1 0x810E /* source color 1 */ +#define GP_PAT_COLOR_0 0x8110 /* pattern color 0 */ +#define GP_PAT_COLOR_1 0x8112 /* pattern color 1 */ +#define GP_PAT_COLOR_2 0x8114 /* pattern color 2 */ +#define GP_PAT_COLOR_3 0x8116 /* pattern color 3 */ +#define GP_PAT_DATA_0 0x8120 /* bits 31:0 of pattern */ +#define GP_PAT_DATA_1 0x8124 /* bits 63:32 of pattern */ +#define GP_PAT_DATA_2 0x8128 /* bits 95:64 of pattern */ +#define GP_PAT_DATA_3 0x812C /* bits 127:96 of pattern */ + +#define GP_VGA_WRITE 0x8140 /* VGA write path control */ +#define GP_VGA_READ 0x8144 /* VGA read path control */ + +#define GP_RASTER_MODE 0x8200 /* raster operation */ +#define GP_VECTOR_MODE 0x8204 /* vector mode register */ +#define GP_BLIT_MODE 0x8208 /* blit mode register */ +#define GP_BLIT_STATUS 0x820C /* blit status register */ + +#define GP_VGA_BASE 0x8210 /* VGA memory offset (x64K) */ +#define GP_VGA_LATCH 0x8214 /* VGA display latch */ + +/* "GP_VECTOR_MODE" BIT DEFINITIONS */ + +#define VM_X_MAJOR 0x0000 /* X major vector */ +#define VM_Y_MAJOR 0x0001 /* Y major vector */ +#define VM_MAJOR_INC 0x0002 /* positive major axis step */ +#define VM_MINOR_INC 0x0004 /* positive minor axis step */ +#define VM_READ_DST_FB 0x0008 /* read destination data */ + +/* "GP_RASTER_MODE" BIT DEFINITIONS */ + +#define RM_PAT_DISABLE 0x0000 /* pattern is disabled */ +#define RM_PAT_MONO 0x0100 /* 1BPP pattern expansion */ +#define RM_PAT_DITHER 0x0200 /* 2BPP pattern expansion */ +#define RM_PAT_COLOR 0x0300 /* 8BPP or 16BPP pattern */ +#define RM_PAT_MASK 0x0300 /* mask for pattern mode */ +#define RM_PAT_TRANSPARENT 0x0400 /* transparent 1BPP pattern */ +#define RM_SRC_TRANSPARENT 0x0800 /* transparent 1BPP source */ + +/* "GP_BLIT_STATUS" BIT DEFINITIONS */ + +#define BS_BLIT_BUSY 0x0001 /* blit engine is busy */ +#define BS_PIPELINE_BUSY 0x0002 /* graphics pipeline is busy */ +#define BS_BLIT_PENDING 0x0004 /* blit pending */ +#define BC_FLUSH 0x0080 /* flush pipeline requests */ +#define BC_8BPP 0x0000 /* 8BPP mode */ +#define BC_16BPP 0x0100 /* 16BPP mode */ +#define BC_FB_WIDTH_1024 0x0000 /* framebuffer width = 1024 */ +#define BC_FB_WIDTH_2048 0x0200 /* framebuffer width = 2048 */ +#define BC_FB_WIDTH_4096 0x0400 /* framebuffer width = 4096 */ + +/* "GP_BLIT_MODE" BIT DEFINITIONS */ + +#define BM_READ_SRC_NONE 0x0000 /* source foreground color */ +#define BM_READ_SRC_FB 0x0001 /* read source from FB */ +#define BM_READ_SRC_BB0 0x0002 /* read source from BB0 */ +#define BM_READ_SRC_BB1 0x0003 /* read source from BB1 */ +#define BM_READ_SRC_MASK 0x0003 /* read source mask */ + +#define BM_READ_DST_NONE 0x0000 /* no destination data */ +#define BM_READ_DST_BB0 0x0008 /* destination from BB0 */ +#define BM_READ_DST_BB1 0x000C /* destination from BB1 */ +#define BM_READ_DST_FB0 0x0010 /* dest from FB (store BB0) */ +#define BM_READ_DST_FB1 0x0014 /* dest from FB (store BB1) */ +#define BM_READ_DST_MASK 0x001C /* read destination mask */ + +#define BM_WRITE_FB 0x0000 /* write to framebuffer */ +#define BM_WRITE_MEM 0x0020 /* write to memory */ +#define BM_WRITE_MASK 0x0020 /* write mask */ + +#define BM_SOURCE_COLOR 0x0000 /* source is 8BPP or 16BPP */ +#define BM_SOURCE_EXPAND 0x0040 /* source is 1BPP */ +#define BM_SOURCE_TEXT 0x00C0 /* source is 1BPP text */ +#define BM_SOURCE_MASK 0x00C0 /* source mask */ + +#define BM_REVERSE_Y 0x0100 /* reverse Y direction */ + +/*---------------------------------------*/ +/* FIRST GENERATION DISPLAY CONTROLLER */ +/*---------------------------------------*/ + +#define DC_UNLOCK 0x8300 /* lock register */ +#define DC_GENERAL_CFG 0x8304 /* config registers... */ +#define DC_TIMING_CFG 0x8308 +#define DC_OUTPUT_CFG 0x830C + +#define DC_FB_ST_OFFSET 0x8310 /* framebuffer start offset */ +#define DC_CB_ST_OFFSET 0x8314 /* compression start offset */ +#define DC_CURS_ST_OFFSET 0x8318 /* cursor start offset */ +#define DC_ICON_ST_OFFSET 0x831C /* icon start offset */ +#define DC_VID_ST_OFFSET 0x8320 /* video start offset */ +#define DC_LINE_DELTA 0x8324 /* fb and cb skip counts */ +#define DC_BUF_SIZE 0x8328 /* fb and cb line size */ + +#define DC_H_TIMING_1 0x8330 /* horizontal timing... */ +#define DC_H_TIMING_2 0x8334 +#define DC_H_TIMING_3 0x8338 +#define DC_FP_H_TIMING 0x833C + +#define DC_V_TIMING_1 0x8340 /* vertical timing... */ +#define DC_V_TIMING_2 0x8344 +#define DC_V_TIMING_3 0x8348 +#define DC_FP_V_TIMING 0x834C + +#define DC_CURSOR_X 0x8350 /* cursor x position */ +#define DC_ICON_X 0x8354 /* HACK - 1.3 definition */ +#define DC_V_LINE_CNT 0x8354 /* vertical line counter */ +#define DC_CURSOR_Y 0x8358 /* cursor y position */ +#define DC_ICON_Y 0x835C /* HACK - 1.3 definition */ +#define DC_SS_LINE_CMP 0x835C /* line compare value */ +#define DC_CURSOR_COLOR 0x8360 /* cursor colors */ +#define DC_ICON_COLOR 0x8364 /* icon colors */ +#define DC_BORDER_COLOR 0x8368 /* border color */ +#define DC_PAL_ADDRESS 0x8370 /* palette address */ +#define DC_PAL_DATA 0x8374 /* palette data */ +#define DC_DFIFO_DIAG 0x8378 /* display FIFO diagnostic */ +#define DC_CFIFO_DIAG 0x837C /* compression FIF0 diagnostic */ + +/* PALETTE LOCATIONS */ + +#define PAL_CURSOR_COLOR_0 0x100 +#define PAL_CURSOR_COLOR_1 0x101 +#define PAL_ICON_COLOR_0 0x102 +#define PAL_ICON_COLOR_1 0x103 +#define PAL_OVERSCAN_COLOR 0x104 + +/* UNLOCK VALUE */ + +#define DC_UNLOCK_VALUE 0x00004758 /* used to unlock DC regs */ + +/* "DC_GENERAL_CFG" BIT DEFINITIONS */ + +#define DC_GCFG_DFLE 0x00000001 /* display FIFO load enable */ +#define DC_GCFG_CURE 0x00000002 /* cursor enable */ +#define DC_GCFG_VCLK_DIV 0x00000004 /* vid clock divisor */ +#define DC_GCFG_PLNO 0x00000004 /* planar offset LSB */ +#define DC_GCFG_PPC 0x00000008 /* pixel pan compatibility */ +#define DC_GCFG_CMPE 0x00000010 /* compression enable */ +#define DC_GCFG_DECE 0x00000020 /* decompression enable */ +#define DC_GCFG_DCLK_MASK 0x000000C0 /* dotclock multiplier */ +#define DC_GCFG_DCLK_POS 6 /* dotclock multiplier */ +#define DC_GCFG_DFHPSL_MASK 0x00000F00 /* FIFO high-priority start */ +#define DC_GCFG_DFHPSL_POS 8 /* FIFO high-priority start */ +#define DC_GCFG_DFHPEL_MASK 0x0000F000 /* FIFO high-priority end */ +#define DC_GCFG_DFHPEL_POS 12 /* FIFO high-priority end */ +#define DC_GCFG_CIM_MASK 0x00030000 /* compressor insert mode */ +#define DC_GCFG_CIM_POS 16 /* compressor insert mode */ +#define DC_GCFG_FDTY 0x00040000 /* frame dirty mode */ +#define DC_GCFG_RTPM 0x00080000 /* real-time perf. monitor */ +#define DC_GCFG_DAC_RS_MASK 0x00700000 /* DAC register selects */ +#define DC_GCFG_DAC_RS_POS 20 /* DAC register selects */ +#define DC_GCFG_CKWR 0x00800000 /* clock write */ +#define DC_GCFG_LDBL 0x01000000 /* line double */ +#define DC_GCFG_DIAG 0x02000000 /* FIFO diagnostic mode */ +#define DC_GCFG_CH4S 0x04000000 /* sparse refresh mode */ +#define DC_GCFG_SSLC 0x08000000 /* enable line compare */ +#define DC_GCFG_VIDE 0x10000000 /* video enable */ +#define DC_GCFG_DFCK 0x20000000 /* divide flat-panel clock */ + /* - rev 2.3 down */ +#define DC_GCFG_VRDY 0x20000000 /* video port speed */ + /* - rev 2.4 up */ +#define DC_GCFG_DPCK 0x40000000 /* divide pixel clock */ +#define DC_GCFG_DDCK 0x80000000 /* divide dot clock */ + +/* "DC_TIMING_CFG" BIT DEFINITIONS */ + +#define DC_TCFG_FPPE 0x00000001 /* flat-panel power enable */ +#define DC_TCFG_HSYE 0x00000002 /* horizontal sync enable */ +#define DC_TCFG_VSYE 0x00000004 /* vertical sync enable */ +#define DC_TCFG_BLKE 0x00000008 /* blank enable */ +#define DC_TCFG_DDCK 0x00000010 /* DDC clock */ +#define DC_TCFG_TGEN 0x00000020 /* timing generator enable */ +#define DC_TCFG_VIEN 0x00000040 /* vertical interrupt enable */ +#define DC_TCFG_BLNK 0x00000080 /* blink enable */ +#define DC_TCFG_CHSP 0x00000100 /* horizontal sync polarity */ +#define DC_TCFG_CVSP 0x00000200 /* vertical sync polarity */ +#define DC_TCFG_FHSP 0x00000400 /* panel horz sync polarity */ +#define DC_TCFG_FVSP 0x00000800 /* panel vert sync polarity */ +#define DC_TCFG_FCEN 0x00001000 /* flat-panel centering */ +#define DC_TCFG_CDCE 0x00002000 /* HACK - 1.3 definition */ +#define DC_TCFG_PLNR 0x00002000 /* planar mode enable */ +#define DC_TCFG_INTL 0x00004000 /* interlace scan */ +#define DC_TCFG_PXDB 0x00008000 /* pixel double */ +#define DC_TCFG_BKRT 0x00010000 /* blink rate */ +#define DC_TCFG_PSD_MASK 0x000E0000 /* power sequence delay */ +#define DC_TCFG_PSD_POS 17 /* power sequence delay */ +#define DC_TCFG_DDCI 0x08000000 /* DDC input (RO) */ +#define DC_TCFG_SENS 0x10000000 /* monitor sense (RO) */ +#define DC_TCFG_DNA 0x20000000 /* display not active (RO) */ +#define DC_TCFG_VNA 0x40000000 /* vertical not active (RO) */ +#define DC_TCFG_VINT 0x80000000 /* vertical interrupt (RO) */ + +/* "DC_OUTPUT_CFG" BIT DEFINITIONS */ + +#define DC_OCFG_8BPP 0x00000001 /* 8/16 bpp select */ +#define DC_OCFG_555 0x00000002 /* 16 bpp format */ +#define DC_OCFG_PCKE 0x00000004 /* PCLK enable */ +#define DC_OCFG_FRME 0x00000008 /* frame rate mod enable */ +#define DC_OCFG_DITE 0x00000010 /* dither enable */ +#define DC_OCFG_2PXE 0x00000020 /* 2 pixel enable */ +#define DC_OCFG_2XCK 0x00000040 /* 2 x pixel clock */ +#define DC_OCFG_2IND 0x00000080 /* 2 index enable */ +#define DC_OCFG_34ADD 0x00000100 /* 3- or 4-bit add */ +#define DC_OCFG_FRMS 0x00000200 /* frame rate mod select */ +#define DC_OCFG_CKSL 0x00000400 /* clock select */ +#define DC_OCFG_PRMP 0x00000800 /* palette re-map */ +#define DC_OCFG_PDEL 0x00001000 /* panel data enable low */ +#define DC_OCFG_PDEH 0x00002000 /* panel data enable high */ +#define DC_OCFG_CFRW 0x00004000 /* comp line buffer r/w sel */ +#define DC_OCFG_DIAG 0x00008000 /* comp line buffer diag */ + +#define MC_MEM_CNTRL1 0x00008400 +#define MC_DR_ADD 0x00008418 +#define MC_DR_ACC 0x0000841C + +/* MC_MEM_CNTRL1 BIT DEFINITIONS */ + +#define MC_XBUSARB 0x00000008 /* 0 = GP priority < CPU priority */ + /* 1 = GP priority = CPU priority */ + /* GXm databook V2.0 is wrong ! */ +/*----------*/ +/* CS5530 */ +/*----------*/ + +/* CS5530 REGISTER DEFINITIONS */ + +#define CS5530_VIDEO_CONFIG 0x0000 +#define CS5530_DISPLAY_CONFIG 0x0004 +#define CS5530_VIDEO_X_POS 0x0008 +#define CS5530_VIDEO_Y_POS 0x000C +#define CS5530_VIDEO_SCALE 0x0010 +#define CS5530_VIDEO_COLOR_KEY 0x0014 +#define CS5530_VIDEO_COLOR_MASK 0x0018 +#define CS5530_PALETTE_ADDRESS 0x001C +#define CS5530_PALETTE_DATA 0x0020 +#define CS5530_DOT_CLK_CONFIG 0x0024 +#define CS5530_CRCSIG_TFT_TV 0x0028 + +/* "CS5530_VIDEO_CONFIG" BIT DEFINITIONS */ + +#define CS5530_VCFG_VID_EN 0x00000001 +#define CS5530_VCFG_VID_REG_UPDATE 0x00000002 +#define CS5530_VCFG_VID_INP_FORMAT 0x0000000C +#define CS5530_VCFG_8_BIT_4_2_0 0x00000004 +#define CS5530_VCFG_16_BIT_4_2_0 0x00000008 +#define CS5530_VCFG_GV_SEL 0x00000010 +#define CS5530_VCFG_CSC_BYPASS 0x00000020 +#define CS5530_VCFG_X_FILTER_EN 0x00000040 +#define CS5530_VCFG_Y_FILTER_EN 0x00000080 +#define CS5530_VCFG_LINE_SIZE_LOWER_MASK 0x0000FF00 +#define CS5530_VCFG_INIT_READ_MASK 0x01FF0000 +#define CS5530_VCFG_EARLY_VID_RDY 0x02000000 +#define CS5530_VCFG_LINE_SIZE_UPPER 0x08000000 +#define CS5530_VCFG_4_2_0_MODE 0x10000000 +#define CS5530_VCFG_16_BIT_EN 0x20000000 +#define CS5530_VCFG_HIGH_SPD_INT 0x40000000 + +/* "CS5530_DISPLAY_CONFIG" BIT DEFINITIONS */ + +#define CS5530_DCFG_DIS_EN 0x00000001 +#define CS5530_DCFG_HSYNC_EN 0x00000002 +#define CS5530_DCFG_VSYNC_EN 0x00000004 +#define CS5530_DCFG_DAC_BL_EN 0x00000008 +#define CS5530_DCFG_DAC_PWDNX 0x00000020 +#define CS5530_DCFG_FP_PWR_EN 0x00000040 +#define CS5530_DCFG_FP_DATA_EN 0x00000080 +#define CS5530_DCFG_CRT_HSYNC_POL 0x00000100 +#define CS5530_DCFG_CRT_VSYNC_POL 0x00000200 +#define CS5530_DCFG_FP_HSYNC_POL 0x00000400 +#define CS5530_DCFG_FP_VSYNC_POL 0x00000800 +#define CS5530_DCFG_XGA_FP 0x00001000 +#define CS5530_DCFG_FP_DITH_EN 0x00002000 +#define CS5530_DCFG_CRT_SYNC_SKW_MASK 0x0001C000 +#define CS5530_DCFG_CRT_SYNC_SKW_INIT 0x00010000 +#define CS5530_DCFG_PWR_SEQ_DLY_MASK 0x000E0000 +#define CS5530_DCFG_PWR_SEQ_DLY_INIT 0x00080000 +#define CS5530_DCFG_VG_CK 0x00100000 +#define CS5530_DCFG_GV_PAL_BYP 0x00200000 +#define CS5530_DCFG_DDC_SCL 0x00400000 +#define CS5530_DCFG_DDC_SDA 0x00800000 +#define CS5530_DCFG_DDC_OE 0x01000000 +#define CS5530_DCFG_16_BIT_EN 0x02000000 + +/*----------*/ +/* SC1200 */ +/*----------*/ + +/* SC1200 VIDEO REGISTER DEFINITIONS */ + +#define SC1200_VIDEO_CONFIG 0x000 +#define SC1200_DISPLAY_CONFIG 0x004 +#define SC1200_VIDEO_X_POS 0x008 +#define SC1200_VIDEO_Y_POS 0x00C +#define SC1200_VIDEO_UPSCALE 0x010 +#define SC1200_VIDEO_COLOR_KEY 0x014 +#define SC1200_VIDEO_COLOR_MASK 0x018 +#define SC1200_PALETTE_ADDRESS 0x01C +#define SC1200_PALETTE_DATA 0x020 +#define SC1200_VID_MISC 0x028 +#define SC1200_VID_CLOCK_SELECT 0x02C +#define SC1200_VIDEO_DOWNSCALER_CONTROL 0x03C +#define SC1200_VIDEO_DOWNSCALER_COEFFICIENTS 0x40 +#define SC1200_VID_CRC 0x044 +#define SC1200_DEVICE_ID 0x048 +#define SC1200_VID_ALPHA_CONTROL 0x04C +#define SC1200_CURSOR_COLOR_KEY 0x050 +#define SC1200_CURSOR_COLOR_MASK 0x054 +#define SC1200_CURSOR_COLOR_1 0x058 +#define SC1200_CURSOR_COLOR_2 0x05C +#define SC1200_ALPHA_XPOS_1 0x060 +#define SC1200_ALPHA_YPOS_1 0x064 +#define SC1200_ALPHA_COLOR_1 0x068 +#define SC1200_ALPHA_CONTROL_1 0x06C +#define SC1200_ALPHA_XPOS_2 0x070 +#define SC1200_ALPHA_YPOS_2 0x074 +#define SC1200_ALPHA_COLOR_2 0x078 +#define SC1200_ALPHA_CONTROL_2 0x07C +#define SC1200_ALPHA_XPOS_3 0x080 +#define SC1200_ALPHA_YPOS_3 0x084 +#define SC1200_ALPHA_COLOR_3 0x088 +#define SC1200_ALPHA_CONTROL_3 0x08C +#define SC1200_VIDEO_REQUEST 0x090 +#define SC1200_ALPHA_WATCH 0x094 +#define SC1200_VIDEO_DISPLAY_MODE 0x400 +#define SC1200_VIDEO_ODD_VBI_LINE_ENABLE 0x40C +#define SC1200_VIDEO_EVEN_VBI_LINE_ENABLE 0x410 +#define SC1200_VIDEO_VBI_HORIZ_CONTROL 0x414 +#define SC1200_VIDEO_ODD_VBI_TOTAL_COUNT 0x418 +#define SC1200_VIDEO_EVEN_VBI_TOTAL_COUNT 0x41C +#define SC1200_GENLOCK 0x420 +#define SC1200_GENLOCK_DELAY 0x424 +#define SC1200_TVOUT_HORZ_TIM 0x800 +#define SC1200_TVOUT_HORZ_SYNC 0x804 +#define SC1200_TVOUT_VERT_SYNC 0x808 +#define SC1200_TVOUT_LINE_END 0x80C +#define SC1200_TVOUT_VERT_DOWNSCALE 0x810 /* REV. A & B */ +#define SC1200_TVOUT_HORZ_PRE_ENCODER_SCALE 0x810 /* REV. C */ +#define SC1200_TVOUT_HORZ_SCALING 0x814 +#define SC1200_TVOUT_DEBUG 0x818 +#define SC1200_TVENC_TIM_CTRL_1 0xC00 +#define SC1200_TVENC_TIM_CTRL_2 0xC04 +#define SC1200_TVENC_TIM_CTRL_3 0xC08 +#define SC1200_TVENC_SUB_FREQ 0xC0C +#define SC1200_TVENC_DISP_POS 0xC10 +#define SC1200_TVENC_DISP_SIZE 0xC14 +#define SC1200_TVENC_CC_DATA 0xC18 +#define SC1200_TVENC_EDS_DATA 0xC1C +#define SC1200_TVENC_CGMS_DATA 0xC20 +#define SC1200_TVENC_WSS_DATA 0xC24 +#define SC1200_TVENC_CC_CONTROL 0xC28 +#define SC1200_TVENC_DAC_CONTROL 0xC2C +#define SC1200_TVENC_MV_CONTROL 0xC30 + +/* "SC1200_VIDEO_CONFIG" BIT DEFINITIONS */ + +#define SC1200_VCFG_VID_EN 0x00000001 +#define SC1200_VCFG_VID_INP_FORMAT 0x0000000C +#define SC1200_VCFG_UYVY_FORMAT 0x00000000 +#define SC1200_VCFG_Y2YU_FORMAT 0x00000004 +#define SC1200_VCFG_YUYV_FORMAT 0x00000008 +#define SC1200_VCFG_YVYU_FORMAT 0x0000000C +#define SC1200_VCFG_X_FILTER_EN 0x00000040 +#define SC1200_VCFG_Y_FILTER_EN 0x00000080 +#define SC1200_VCFG_LINE_SIZE_LOWER_MASK 0x0000FF00 +#define SC1200_VCFG_INIT_READ_MASK 0x01FF0000 +#define SC1200_VCFG_LINE_SIZE_UPPER 0x08000000 +#define SC1200_VCFG_4_2_0_MODE 0x10000000 + +/* "SC1200_DISPLAY_CONFIG" BIT DEFINITIONS */ + +#define SC1200_DCFG_DIS_EN 0x00000001 +#define SC1200_DCFG_HSYNC_EN 0x00000002 +#define SC1200_DCFG_VSYNC_EN 0x00000004 +#define SC1200_DCFG_DAC_BL_EN 0x00000008 +#define SC1200_DCFG_FP_PWR_EN 0x00000040 +#define SC1200_DCFG_FP_DATA_EN 0x00000080 +#define SC1200_DCFG_CRT_HSYNC_POL 0x00000100 +#define SC1200_DCFG_CRT_VSYNC_POL 0x00000200 +#define SC1200_DCFG_CRT_SYNC_SKW_MASK 0x0001C000 +#define SC1200_DCFG_CRT_SYNC_SKW_INIT 0x00010000 +#define SC1200_DCFG_PWR_SEQ_DLY_MASK 0x000E0000 +#define SC1200_DCFG_PWR_SEQ_DLY_INIT 0x00080000 +#define SC1200_DCFG_VG_CK 0x00100000 +#define SC1200_DCFG_GV_PAL_BYP 0x00200000 +#define SC1200_DCFG_DDC_SCL 0x00400000 +#define SC1200_DCFG_DDC_SDA 0x00800000 +#define SC1200_DCFG_DDC_OE 0x01000000 + +/* "SC1200_VID_MISC" BIT DEFINITIONS */ + +#define SC1200_GAMMA_BYPASS_BOTH 0x00000001 +#define SC1200_DAC_POWER_DOWN 0x00000400 +#define SC1200_ANALOG_POWER_DOWN 0x00000800 +#define SC1200_PLL_POWER_NORMAL 0x00001000 + +/* "SC1200_VIDEO_DOWNSCALER_CONTROL" BIT DEFINITIONS */ + +#define SC1200_VIDEO_DOWNSCALE_ENABLE 0x00000001 +#define SC1200_VIDEO_DOWNSCALE_FACTOR_POS 1 +#define SC1200_VIDEO_DOWNSCALE_FACTOR_MASK 0x0000001E +#define SC1200_VIDEO_DOWNSCALE_TYPE_A 0x00000000 +#define SC1200_VIDEO_DOWNSCALE_TYPE_B 0x00000040 +#define SC1200_VIDEO_DOWNSCALE_TYPE_MASK 0x00000040 + +/* "SC1200_VIDEO_DOWNSCALER_COEFFICIENTS" BIT DEFINITIONS */ + +#define SC1200_VIDEO_DOWNSCALER_COEF1_POS 0 +#define SC1200_VIDEO_DOWNSCALER_COEF2_POS 8 +#define SC1200_VIDEO_DOWNSCALER_COEF3_POS 16 +#define SC1200_VIDEO_DOWNSCALER_COEF4_POS 24 +#define SC1200_VIDEO_DOWNSCALER_COEF_MASK 0xF + +/* VIDEO DE-INTERLACING AND ALPHA CONTROL (REGISTER 0x4C) */ + +#define SC1200_VERTICAL_SCALER_SHIFT_MASK 0x00000007 +#define SC1200_VERTICAL_SCALER_SHIFT_INIT 0x00000004 +#define SC1200_VERTICAL_SCALER_SHIFT_EN 0x00000010 +#define SC1200_TOP_LINE_IN_ODD 0x00000040 +#define SC1200_NO_CK_OUTSIDE_ALPHA 0x00000100 +#define SC1200_VIDEO_IS_INTERLACED 0x00000200 +#define SC1200_CSC_VIDEO_YUV_TO_RGB 0x00000400 +#define SC1200_CSC_GFX_RGB_TO_YUV 0x00000800 +#define SC1200_VIDEO_INPUT_IS_RGB 0x00002000 +#define SC1200_VIDEO_LINE_OFFSET_ODD 0x00001000 +#define SC1200_ALPHA1_PRIORITY_POS 16 +#define SC1200_ALPHA1_PRIORITY_MASK 0x00030000 +#define SC1200_ALPHA2_PRIORITY_POS 18 +#define SC1200_ALPHA2_PRIORITY_MASK 0x000C0000 +#define SC1200_ALPHA3_PRIORITY_POS 20 +#define SC1200_ALPHA3_PRIORITY_MASK 0x00300000 + +/* VIDEO CURSOR COLOR KEY DEFINITIONS (REGISTER 0x50) */ + +#define SC1200_CURSOR_COLOR_KEY_OFFSET_POS 24 +#define SC1200_CURSOR_COLOR_BITS 23 +#define SC1200_COLOR_MASK 0x00FFFFFF /* 24 significant + * bits */ + +/* ALPHA COLOR BIT DEFINITION (REGISTERS 0x68, 0x78, AND 0x88) */ + +#define SC1200_ALPHA_COLOR_ENABLE 0x01000000 + +/* ALPHA CONTROL BIT DEFINITIONS (REGISTERS 0x6C, 0x7C, AND 0x8C) */ + +#define SC1200_ACTRL_WIN_ENABLE 0x00010000 +#define SC1200_ACTRL_LOAD_ALPHA 0x00020000 + +/* VIDEO REQUEST DEFINITIONS (REGISTER 0x90) */ + +#define SC1200_VIDEO_Y_REQUEST_POS 0 +#define SC1200_VIDEO_X_REQUEST_POS 16 +#define SC1200_VIDEO_REQUEST_MASK 0x00000FFF + +/* VIDEO DISPLAY MODE (REGISTER 0x400) */ + +#define SC1200_VIDEO_SOURCE_MASK 0x00000003 +#define SC1200_VIDEO_SOURCE_GX1 0x00000000 +#define SC1200_VIDEO_SOURCE_DVIP 0x00000002 +#define SC1200_VBI_SOURCE_MASK 0x00000004 +#define SC1200_VBI_SOURCE_DVIP 0x00000000 +#define SC1200_VBI_SOURCE_GX1 0x00000004 + +/* ODD/EVEN VBI LINE ENABLE (REGISTERS 0x40C, 0x410) */ + +#define SC1200_VIDEO_VBI_LINE_ENABLE_MASK 0x00FFFFFC +#define SC1200_VIDEO_ALL_ACTIVE_IS_VBI 0x01000000 +#define SC1200_VIDEO_VBI_LINE_OFFSET_POS 25 +#define SC1200_VIDEO_VBI_LINE_OFFSET_MASK 0x3E000000 + +/* ODD/EVEN VBI TOTAL COUNT (REGISTERS 0x418, 0x41C) */ + +#define SC1200_VIDEO_VBI_TOTAL_COUNT_MASK 0x000FFFFF + +/* GENLOCK BIT DEFINITIONS */ + +#define SC1200_GENLOCK_SINGLE_ENABLE 0x00000001 +#define SC1200_GENLOCK_FIELD_SYNC_ENABLE 0x00000001 +#define SC1200_GENLOCK_CONTINUOUS_ENABLE 0x00000002 +#define SC1200_GENLOCK_GX_VSYNC_FALLING_EDGE 0x00000004 +#define SC1200_GENLOCK_VIP_VSYNC_FALLING_EDGE 0x00000008 +#define SC1200_GENLOCK_TIMEOUT_ENABLE 0x00000010 +#define SC1200_GENLOCK_TVENC_RESET_EVEN_FIELD 0x00000020 +#define SC1200_GENLOCK_TVENC_RESET_BEFORE_DELAY 0x00000040 +#define SC1200_GENLOCK_TVENC_RESET_ENABLE 0x00000080 +#define SC1200_GENLOCK_SYNC_TO_TVENC 0x00000100 +#define SC1200_GENLOCK_DELAY_MASK 0x001FFFFF + +/* TVOUT HORIZONTAL PRE ENCODER SCALE BIT DEFINITIONS */ + +#define SC1200_TVOUT_YC_DELAY_MASK 0x00C00000 +#define SC1200_TVOUT_YC_DELAY_NONE 0x00000000 +#define SC1200_TVOUT_Y_DELAY_ONE_PIXEL 0x00400000 +#define SC1200_TVOUT_C_DELAY_ONE_PIXEL 0x00800000 +#define SC1200_TVOUT_C_DELAY_TWO_PIXELS 0x00C00000 + +/* TVOUT HORIZONTAL SCALING/CONTROL BIT DEFINITIONS */ + +#define SC1200_TVOUT_FLICKER_FILTER_MASK 0x60000000 +#define SC1200_TVOUT_FLICKER_FILTER_FOURTH_HALF_FOURTH 0x00000000 +#define SC1200_TVOUT_FLICKER_FILTER_HALF_ONE_HALF 0x20000000 +#define SC1200_TVOUT_FLICKER_FILTER_DISABLED 0x40000000 +#define SC1200_TVENC_EXTERNAL_RESET_INTERVAL_MASK 0x0F000000 +#define SC1200_TVENC_EXTERNAL_RESET_EVERY_ODD_FIELD 0x00000000 +#define SC1200_TVENC_EXTERNAL_RESET_EVERY_EVEN_FIELD 0x02000000 +#define SC1200_TVENC_EXTERNAL_RESET_NEXT_ODD_FIELD 0x05000000 +#define SC1200_TVENC_EXTERNAL_RESET_NEXT_EVEN_FIELD 0x07000000 +#define SC1200_TVENC_EXTERNAL_RESET_EVERY_FIELD 0x0E000000 +#define SC1200_TVENC_EXTERNAL_RESET_EVERY_X_ODD_FIELDS 0x08000000 +#define SC1200_TVENC_EXTERNAL_RESET_EVERY_X_EVEN_FIELDS 0x0A000000 + +/* TVOUT DEBUG BIT DEFINITIONS */ + +#define SC1200_TVOUT_FIELD_STATUS_EVEN 0x00000040 +#define SC1200_TVOUT_FIELD_STATUS_TV 0x00000080 +#define SC1200_TVOUT_CRT_VSYNC_STATUS_TRAILING 0x00000100 +#define SC1200_TVOUT_FIELD_STATUS_INVERT 0x00000200 +#define SC1200_TVOUT_CONVERTER_INTERPOLATION 0x00000400 + +/* TVENC TIMING/CONTROL 1 BIT DEFINITIONS (REGISTER 0xC00) */ + +#define SC1200_TVENC_VPHASE_MASK 0x001FF800 +#define SC1200_TVENC_VPHASE_POS 11 +#define SC1200_TVENC_SUB_CARRIER_RESET_MASK 0x30000000 +#define SC1200_TVENC_SUB_CARRIER_RESET_NEVER 0x00000000 +#define SC1200_TVENC_SUB_CARRIER_RESET_EVERY_TWO_LINES 0x10000000 +#define SC1200_TVENC_SUB_CARRIER_RESET_EVERY_TWO_FRAMES 0x20000000 +#define SC1200_TVENC_SUB_CARRIER_RESET_EVERY_FOUR_FRAMES 0x30000000 +#define SC1200_TVENC_VIDEO_TIMING_ENABLE 0x80000000 + +/* TVENC TIMING/CONTROL 2 BIT DEFINITIONS (REGISTER 0xC04) */ + +#define SC1200_TVENC_OUTPUT_YCBCR 0x40000000 +#define SC1200_TVENC_CFS_MASK 0x00030000 +#define SC1200_TVENC_CFS_BYPASS 0x00000000 +#define SC1200_TVENC_CFS_CVBS 0x00020000 +#define SC1200_TVENC_CFS_SVIDEO 0x00030000 + +/* TVENC TIMING/CONTROL 3 BIT DEFINITIONS (REGISTER 0xC08) */ + +#define SC1200_TVENC_CS 0x00000001 +#define SC1200_TVENC_SYNCMODE_MASK 0x00000006 +#define SC1200_TVENC_SYNC_ON_GREEN 0x00000002 +#define SC1200_TVENC_SYNC_ON_CVBS 0x00000004 +#define SC1200_TVENC_CM 0x00000008 + +/* TVENC DAC CONTROL BIT DEFINITIONS (REGISTER 0xC2C) */ +#define SC1200_TVENC_TRIM_MASK 0x00000007 +#define SC1200_TVENC_POWER_DOWN 0x00000020 + +/* TVENC MV CONTROL BIT DEFINITIONS (REGISTER 0xC30) */ +#define SC1200_TVENC_MV_ENABLE 0xBE + +/* SC1200 VIP REGISTER DEFINITIONS */ + +#define SC1200_VIP_CONFIG 0x00000000 +#define SC1200_VIP_CONTROL 0x00000004 +#define SC1200_VIP_STATUS 0x00000008 +#define SC1200_VIP_CURRENT_LINE 0x00000010 +#define SC1200_VIP_LINE_TARGET 0x00000014 +#define SC1200_ODD_DIRECT_VBI_LINE_ENABLE 0x00000018 +#define SC1200_EVEN_DIRECT_VBI_LINE_ENABLE 0x0000001C +#define SC1200_VIP_ODD_BASE 0x00000020 +#define SC1200_VIP_EVEN_BASE 0x00000024 +#define SC1200_VIP_PITCH 0x00000028 +#define SC1200_VBI_ODD_BASE 0x00000040 +#define SC1200_VBI_EVEN_BASE 0x00000044 +#define SC1200_VBI_PITCH 0x00000048 + +/* "SC1200_VIP_CONFIG" BIT DEFINITIONS */ + +#define SC1200_VIP_MODE_MASK 0x00000003 +#define SC1200_VIP_MODE_C 0x00000002 +#define SC1200_VBI_ANCILLARY_TO_MEMORY 0x000C0000 +#define SC1200_VBI_TASK_A_TO_MEMORY 0x00140000 +#define SC1200_VBI_TASK_B_TO_MEMORY 0x00240000 +#define SC1200_VIP_BUS_REQUEST_THRESHOLD 0x00400000 + +/* "SC1200_VIP_CONTROL" BIT DEFINITIONS */ + +#define SC1200_CAPTURE_RUN_MODE_MASK 0x00000003 +#define SC1200_CAPTURE_RUN_MODE_STOP_LINE 0x00000000 +#define SC1200_CAPTURE_RUN_MODE_STOP_FIELD 0x00000001 +#define SC1200_CAPTURE_RUN_MODE_START 0x00000003 +#define SC1200_VIP_DATA_CAPTURE_EN 0x00000100 +#define SC1200_VIP_VBI_CAPTURE_EN 0x00000200 +#define SC1200_VIP_VBI_FIELD_INTERRUPT_EN 0x00010000 + +/* "SC1200_VIP_STATUS" BIT DEFINITIONS */ + +#define SC1200_VIP_CURRENT_FIELD_ODD 0x01000000 +#define SC1200_VIP_BASE_NOT_UPDATED 0x00200000 +#define SC1200_VIP_FIFO_OVERFLOW 0x00100000 +#define SC1200_VIP_CLEAR_LINE_INT 0x00020000 +#define SC1200_VIP_CLEAR_FIELD_INT 0x00010000 +#define SC1200_VBI_DATA_CAPTURE_ACTIVE 0x00000200 +#define SC1200_VIDEO_DATA_CAPTURE_ACTIVE 0x00000100 + +/* "SC1200_VIP_CURRENT_LINE" BIT DEFINITIONS */ + +#define SC1200_VIP_CURRENT_LINE_MASK 0x000003FF + +/* "SC1200_VIP_LINE_TARGET" BIT DEFINITIONS */ + +#define SC1200_VIP_LAST_LINE_MASK 0x03FF0000 + +/* "SC1200_VIP_PITCH" BIT DEFINITION */ + +#define SC1200_VIP_PITCH_MASK 0x0000FFFC + +/* "SC1200_VBI_PITCH" BIT DEFINITION */ + +#define SC1200_VBI_PITCH_MASK 0x0000FFFC + +/* SC1200 DIRECT VBI LINE ENABLE BIT DEFINITION */ + +#define SC1200_DIRECT_VBI_LINE_ENABLE_MASK 0x00FFFFFF + +/* SC1200 CONFIGURATION BLOCK */ + +#define SC1200_CB_BASE_ADDR 0x9000 +#define SC1200_CB_WDTO 0x0000 +#define SC1200_CB_WDCNFG 0x0002 +#define SC1200_CB_WDSTS 0x0004 +#define SC1200_CB_TMVALUE 0x0008 +#define SC1200_CB_TMCNFG 0x000D +#define SC1200_CB_CCFC 0x001E +#define SC1200_CB_PMR 0x0030 +#define SC1200_CB_MCR 0x0034 +#define SC1200_CB_INTSEL 0x0038 +#define SC1200_CB_PID 0x003C +#define SC1200_CB_REV 0x003D + +/* SC1200 HIGH RESOLUTION TIMER CONFIGURATION REGISTER BITS */ + +#define SC1200_TMCLKSEL_27MHZ 0x2 + +/*---------------------------------*/ +/* PHILIPS SAA7114 VIDEO DECODER */ +/*---------------------------------*/ + +#define SAA7114_CHIPADDR 0x42 + +/* VIDEO DECODER REGISTER DEFINITIONS */ + +#define SAA7114_ANALOG_INPUT_CTRL1 0x02 +#define SAA7114_LUMINANCE_CONTROL 0x09 +#define SAA7114_BRIGHTNESS 0x0A +#define SAA7114_CONTRAST 0x0B +#define SAA7114_SATURATION 0x0C +#define SAA7114_HUE 0x0D +#define SAA7114_STATUS 0x1F +#define SAA7114_IPORT_CONTROL 0x86 + +/* TASK A REGISTER DEFINITIONS */ + +#define SAA7114_TASK_A_HORZ_OUTPUT_LO 0x9C +#define SAA7114_TASK_A_HORZ_OUTPUT_HI 0x9D +#define SAA7114_TASK_A_HSCALE_LUMA_LO 0xA8 +#define SAA7114_TASK_A_HSCALE_LUMA_HI 0xA9 +#define SAA7114_TASK_A_HSCALE_CHROMA_LO 0xAC +#define SAA7114_TASK_A_HSCALE_CHROMA_HI 0xAD + +/* TASK B REGISTER DEFINITIONS */ + +#define SAA7114_HORZ_OFFSET_LO 0xC4 +#define SAA7114_HORZ_OFFSET_HI 0xC5 +#define SAA7114_HORZ_INPUT_LO 0xC6 +#define SAA7114_HORZ_INPUT_HI 0xC7 +#define SAA7114_VERT_OFFSET_LO 0xC8 +#define SAA7114_VERT_OFFSET_HI 0xC9 +#define SAA7114_VERT_INPUT_LO 0xCA +#define SAA7114_VERT_INPUT_HI 0xCB +#define SAA7114_HORZ_OUTPUT_LO 0xCC +#define SAA7114_HORZ_OUTPUT_HI 0xCD +#define SAA7114_VERT_OUTPUT_LO 0xCE +#define SAA7114_VERT_OUTPUT_HI 0xCF +#define SAA7114_HORZ_PRESCALER 0xD0 +#define SAA7114_HORZ_ACL 0xD1 +#define SAA7114_HORZ_FIR_PREFILTER 0xD2 +#define SAA7114_FILTER_CONTRAST 0xD5 +#define SAA7114_FILTER_SATURATION 0xD6 +#define SAA7114_HSCALE_LUMA_LO 0xD8 +#define SAA7114_HSCALE_LUMA_HI 0xD9 +#define SAA7114_HSCALE_CHROMA_LO 0xDC +#define SAA7114_HSCALE_CHROMA_HI 0xDD +#define SAA7114_VSCALE_LUMA_LO 0xE0 +#define SAA7114_VSCALE_LUMA_HI 0xE1 +#define SAA7114_VSCALE_CHROMA_LO 0xE2 +#define SAA7114_VSCALE_CHROMA_HI 0xE3 +#define SAA7114_VSCALE_CONTROL 0xE4 +#define SAA7114_VSCALE_CHROMA_OFFS0 0xE8 +#define SAA7114_VSCALE_CHROMA_OFFS1 0xE9 +#define SAA7114_VSCALE_CHROMA_OFFS2 0xEA +#define SAA7114_VSCALE_CHROMA_OFFS3 0xEB +#define SAA7114_VSCALE_LUMINA_OFFS0 0xEC +#define SAA7114_VSCALE_LUMINA_OFFS1 0xED +#define SAA7114_VSCALE_LUMINA_OFFS2 0xEE +#define SAA7114_VSCALE_LUMINA_OFFS3 0xEF + +/* Still need to determine PHO value (common phase offset) */ +#define SAA7114_VSCALE_PHO 0x00 + +/*----------------------------------------------*/ +/* SECOND GENERATION GRAPHICS UNIT (REDCLOUD) */ +/*----------------------------------------------*/ + +#define MGP_DST_OFFSET 0x0000 /* dst address */ +#define MGP_SRC_OFFSET 0x0004 /* src address */ +#define MGP_VEC_ERR 0x0004 /* vector diag/axial errors */ +#define MGP_STRIDE 0x0008 /* src and dst strides */ +#define MGP_WID_HEIGHT 0x000C /* width and height of BLT */ +#define MGP_VEC_LEN 0x000C /* vector length/init error */ +#define MGP_SRC_COLOR_FG 0x0010 /* src mono data fgcolor */ +#define MGP_SRC_COLOR_BG 0x0014 /* src mono data bkcolor */ +#define MGP_PAT_COLOR_0 0x0018 /* pattern color 0 */ +#define MGP_PAT_COLOR_1 0x001C /* pattern color 1 */ +#define MGP_PAT_COLOR_2 0x0020 /* pattern color 2 */ +#define MGP_PAT_COLOR_3 0x0024 /* pattern color 3 */ +#define MGP_PAT_COLOR_4 0x0028 /* pattern color 4 */ +#define MGP_PAT_COLOR_5 0x002C /* pattern color 5 */ +#define MGP_PAT_DATA_0 0x0030 /* pattern data 0 */ +#define MGP_PAT_DATA_1 0x0034 /* pattern data 1 */ +#define MGP_RASTER_MODE 0x0038 /* raster operation */ +#define MGP_VECTOR_MODE 0x003C /* render vector */ +#define MGP_BLT_MODE 0x0040 /* render BLT */ +#define MGP_BLT_STATUS 0x0044 /* BLT status register */ +#define MGP_RESET 0x0044 /* reset register (write) */ +#define MGP_HST_SOURCE 0x0048 /* host src data (bitmap) */ +#define MGP_BASE_OFFSET 0x004C /* base render offset */ + +/* MGP_RASTER_MODE DEFINITIONS */ + +#define MGP_RM_BPPFMT_332 0x00000000 /* 8 BPP, 3:3:2 */ +#define MGP_RM_BPPFMT_4444 0x40000000 /* 16 BPP, 4:4:4:4 */ +#define MGP_RM_BPPFMT_1555 0x50000000 /* 16 BPP, 1:5:5:5 */ +#define MGP_RM_BPPFMT_565 0x60000000 /* 16 BPP, 5:6:5 */ +#define MGP_RM_BPPFMT_8888 0x80000000 /* 32 BPP, 8:8:8:8 */ +#define MGP_RM_ALPHA_EN_MASK 0x00C00000 /* Alpha enable */ +#define MGP_RM_ALPHA_TO_RGB 0x00400000 /* Alpha applies to RGB */ +#define MGP_RM_ALPHA_TO_ALPHA 0x00800000 /* Alpha applies to alpha */ +#define MGP_RM_ALPHA_OP_MASK 0x00300000 /* Alpha operation */ +#define MGP_RM_ALPHA_TIMES_A 0x00000000 /* Alpha * A */ +#define MGP_RM_BETA_TIMES_B 0x00100000 /* (1-alpha) * B */ +#define MGP_RM_A_PLUS_BETA_B 0x00200000 /* A + (1-alpha) * B */ +#define MGP_RM_ALPHA_A_PLUS_BETA_B 0x00300000 /* alpha * A + (1 - alpha)B */ +#define MGP_RM_ALPHA_SELECT 0x000E0000 /* Alpha Select */ +#define MGP_RM_SELECT_ALPHA_A 0x00000000 /* Alpha from channel A */ +#define MGP_RM_SELECT_ALPHA_B 0x00020000 /* Alpha from channel B */ +#define MGP_RM_SELECT_ALPHA_R 0x00040000 /* Registered alpha */ +#define MGP_RM_SELECT_ALPHA_1 0x00060000 /* Constant 1 */ +#define MGP_RM_SELECT_ALPHA_CHAN_A 0x00080000 /* RGB Values from A */ +#define MGP_RM_SELECT_ALPHA_CHAN_B 0x000A0000 /* RGB Values from B */ +#define MGP_RM_DEST_FROM_CHAN_A 0x00010000 /* Alpha channel select */ +#define MGP_RM_PAT_FLAGS 0x00000700 /* pattern related bits */ +#define MGP_RM_PAT_MONO 0x00000100 /* monochrome pattern */ +#define MGP_RM_PAT_COLOR 0x00000200 /* color pattern */ +#define MGP_RM_PAT_TRANS 0x00000400 /* pattern transparency */ +#define MGP_RM_SRC_TRANS 0x00000800 /* source transparency */ + +/* MGP_VECTOR_MODE DEFINITIONS */ + +#define MGP_VM_DST_REQ 0x00000008 /* dst data required */ +#define MGP_VM_THROTTLE 0x00000010 /* sync to VBLANK */ + +/* MGP_BLT_MODE DEFINITIONS */ + +#define MGP_BM_SRC_FB 0x00000001 /* src = frame buffer */ +#define MGP_BM_SRC_HOST 0x00000002 /* src = host register */ +#define MGP_BM_DST_REQ 0x00000004 /* dst data required */ +#define MGP_BM_SRC_MONO 0x00000040 /* monochrome source data */ +#define MGP_BM_SRC_BP_MONO 0x00000080 /* Byte-packed monochrome */ +#define MGP_BM_SRC_TYPE_MASK 0x000000C0 /* Mask for all source fmts */ +#define MGP_BM_NEG_YDIR 0x00000100 /* negative Y direction */ +#define MGP_BM_NEG_XDIR 0x00000200 /* negative X direction */ +#define MGP_BM_THROTTLE 0x00000400 /* sync to VBLANK */ + +/* MGP_BLT_STATUS DEFINITIONS */ + +#define MGP_BS_BLT_BUSY 0x00000001 /* GP is not idle */ +#define MGP_BS_BLT_PENDING 0x00000004 /* second BLT is pending */ +#define MGP_BS_HALF_EMPTY 0x00000008 /* src FIFO half empty */ + +/* ALPHA BLENDING MODES */ + +#define ALPHA_MODE_BLEND 0x00000000 + +/*---------------------------------------------------*/ +/* SECOND GENERATION DISPLAY CONTROLLER (REDCLOUD) */ +/*---------------------------------------------------*/ + +#define MDC_UNLOCK 0x00000000 /* Unlock register */ +#define MDC_GENERAL_CFG 0x00000004 /* Config registers */ +#define MDC_DISPLAY_CFG 0x00000008 +#define MDC_GFX_SCL 0x0000000C /* Graphics scaling */ + +#define MDC_FB_ST_OFFSET 0x00000010 /* Frame buffer start offset */ +#define MDC_CB_ST_OFFSET 0x00000014 /* Compression start offset */ +#define MDC_CURS_ST_OFFSET 0x00000018 /* Cursor buffer start */ + /* offset */ +#define MDC_ICON_ST_OFFSET 0x0000001C /* Icon buffer start offset */ +#define MDC_VID_Y_ST_OFFSET 0x00000020 /* Video Y Buffer start */ + /* offset */ +#define MDC_VID_U_ST_OFFSET 0x00000024 /* Video U Buffer start */ + /* offset */ +#define MDC_VID_V_ST_OFFSET 0x00000028 /* Video V Buffer start */ + /* offset */ +#define MDC_LINE_SIZE 0x00000030 /* Video, CB, and FB line */ + /* sizes */ +#define MDC_GFX_PITCH 0x00000034 /* FB and DB skip counts */ +#define MDC_VID_YUV_PITCH 0x00000038 /* Y, U and V buffer skip */ + /* counts */ + +#define MDC_H_ACTIVE_TIMING 0x00000040 /* Horizontal timings */ +#define MDC_H_BLANK_TIMING 0x00000044 +#define MDC_H_SYNC_TIMING 0x00000048 +#define MDC_V_ACTIVE_TIMING 0x00000050 /* Vertical Timings */ +#define MDC_V_BLANK_TIMING 0x00000054 +#define MDC_V_SYNC_TIMING 0x00000058 + +#define MDC_CURSOR_X 0x00000060 /* Cursor X position */ +#define MDC_CURSOR_Y 0x00000064 /* Cursor Y Position */ +#define MDC_ICON_X 0x00000068 /* Icon X Position */ +#define MDC_LINE_CNT_STATUS 0x0000006C /* Icon Y Position */ + +#define MDC_PAL_ADDRESS 0x00000070 /* Palette Address */ +#define MDC_PAL_DATA 0x00000074 /* Palette Data */ +#define MDC_DFIFO_DIAG 0x00000078 /* Display FIFO diagnostic */ +#define MDC_CFIFO_DIAG 0x0000007C /* Compression FIFO */ + /* diagnostic */ + +#define MDC_VID_DS_DELTA 0x00000080 /* Vertical Downscaling */ + /* fraction */ + +#define MDC_PHY_MEM_OFFSET 0x00000084 /* VG Base Address Register */ +#define MDC_DV_CTL 0x00000088 /* Dirty-Valid Control */ + /* Register */ +#define MDC_DV_ACC 0x0000008C /* Dirty-Valid RAM Access */ + +/* UNLOCK VALUE */ + +#define MDC_UNLOCK_VALUE 0x00004758 /* used to unlock DC regs */ + +/* VG MBUS DEVICE SMI MSR FIELDS */ + +#define MDC_VG_BL_MASK 0x00000001 +#define MDC_MISC_MASK 0x00000002 +#define MDC_ISR0_MASK 0x00000004 +#define MDC_VGA_BL_MASK 0x00000008 +#define MDC_CRTCIO_MSK 0x00000010 +#define MDC_VG_BLANK_SMI 0x00000001 +#define MDC_MISC_SMI 0x00000002 +#define MDC_ISR0_SMI 0x00000004 +#define MDC_VGA_BLANK_SMI 0x00000008 +#define MDC_CRTCIO_SMI 0x00000010 + +/* MDC_GENERAL_CFG BIT FIELDS */ + +#define MDC_GCFG_DBUG 0x80000000 +#define MDC_GCFG_DBSL 0x40000000 +#define MDC_GCFG_CFRW 0x20000000 +#define MDC_GCFG_DIAG 0x10000000 +#define MDC_GCFG_GXRFS4 0x08000000 +#define MDC_GCFG_SGFR 0x04000000 +#define MDC_GCFG_SGRE 0x02000000 +#define MDC_GCFG_SIGE 0x01000000 +#define MDC_GCFG_YUVM 0x00100000 +#define MDC_GCFG_VDSE 0x00080000 +#define MDC_GCFG_VGAFT 0x00040000 +#define MDC_GCFG_FDTY 0x00020000 +#define MDC_GCFG_STFM 0x00010000 +#define MDC_GCFG_DFHPEL_MASK 0x0000F000 +#define MDC_GCFG_DFHPSL_MASK 0x00000F00 +#define MDC_GCFG_VGAE 0x00000080 +#define MDC_GCFG_DECE 0x00000040 +#define MDC_GCFG_CMPE 0x00000020 +#define MDC_GCFG_VIDE 0x00000008 +#define MDC_GCFG_ICNE 0x00000004 +#define MDC_GCFG_CURE 0x00000002 +#define MDC_GCFG_DFLE 0x00000001 + +/* MDC_DISPLAY_CFG BIT FIELDS */ + +#define MDC_DCFG_A20M 0x80000000 +#define MDC_DCFG_A18M 0x40000000 +#define MDC_DCFG_VISL 0x08000000 +#define MDC_DCFG_FRLK 0x04000000 +#define MDC_DCFG_PALB 0x02000000 +#define MDC_DCFG_PIX_PAN_MASK 0x00F00000 +#define MDC_DCFG_DCEN 0x00080000 +#define MDC_DCFG_16BPP_MODE_MASK 0x00000C00 +#define MDC_DCFG_16BPP 0x00000000 +#define MDC_DCFG_15BPP 0x00000400 +#define MDC_DCFG_12BPP 0x00000800 +#define MDC_DCFG_DISP_MODE_MASK 0x00000300 +#define MDC_DCFG_DISP_MODE_8BPP 0x00000000 +#define MDC_DCFG_DISP_MODE_16BPP 0x00000100 +#define MDC_DCFG_DISP_MODE_24BPP 0x00000200 +#define MDC_DCFG_SCLE 0x00000080 +#define MDC_DCFG_TRUP 0x00000040 +#define MDC_DCFG_VIEN 0x00000020 +#define MDC_DCFG_VDEN 0x00000010 +#define MDC_DCFG_GDEN 0x00000008 +#define MDC_DCFG_VCKE 0x00000004 +#define MDC_DCFG_PCKE 0x00000002 +#define MDC_DCFG_TGEN 0x00000001 + +/* MDC_LINE_CNT BIT FIELDS */ + +#define MDC_LNCNT_DNA 0x80000000 +#define MDC_LNCNT_VNA 0x40000000 +#define MDC_LNCNT_VSA 0x20000000 +#define MDC_LNCNT_VINT 0x10000000 +#define MDC_LNCNT_FLIP 0x08000000 +#define MDC_LNCNT_V_LINE_CNT 0x07FF0000 +#define MDC_LNCNT_VFLIP 0x00008000 +#define MDC_LNCNT_SIGC 0x00004000 +#define MDC_LNCNT_SS_LINE_CMP 0x000007FF + +/* MDC_FB_ST_OFFSET BIT FIELDS */ + +#define MDC_FB_ST_OFFSET_MASK 0x0FFFFFFF + +/* MDC_CB_ST_OFFSET BIT FIELDS */ + +#define MDC_CB_ST_OFFSET_MASK 0x0FFFFFFF + +/* MDC_CURS_ST_OFFSET BIT FIELDS */ + +#define MDC_CURS_ST_OFFSET_MASK 0x0FFFFFFF + +/* MDC_ICON_ST_OFFSET BIT FIELDS */ + +#define MDC_ICON_ST_OFFSET_MASK 0x0FFFFFFF + +/* MDC_VID_Y_ST_OFFSET BIT FIELDS */ + +#define MDC_VID_Y_ST_OFFSET_MASK 0x0FFFFFFF + +/* MDC_VID_U_ST_OFFSET BIT FIELDS */ + +#define MDC_VID_U_ST_OFFSET_MASK 0x0FFFFFFF + +/* MDC_VID_V_ST_OFFSET BIT FIELDS */ + +#define MDC_VID_V_ST_OFFSET_MASK 0x0FFFFFFF + +/* MDC_LINE_SIZE BIT FIELDS */ + +#define MDC_LINE_SIZE_VLS_MASK 0xFF000000 +#define MDC_LINE_SIZE_CBLS_MASK 0x007F0000 +#define MDC_LINE_SIZE_FBLS_MASK 0x000007FF + +/* MDC_GFX_PITCH BIT FIELDS */ + +#define MDC_GFX_PITCH_CBP_MASK 0xFFFF0000 +#define MDC_GFX_PITCH_FBP_MASK 0x0000FFFF + +/* MDC_VID_YUV_PITCH BIT FIELDS */ + +#define MDC_YUV_PITCH_UVP_MASK 0xFFFF0000 +#define MDC_YUV_PITCH_YBP_MASK 0x0000FFFF + +/* MDC_H_ACTIVE_TIMING BIT FIELDS */ + +#define MDC_HAT_HT_MASK 0x0FF80000 +#define MDC_HAT_HA_MASK 0x00000FF8 + +/* MDC_H_BLANK_TIMING BIT FIELDS */ + +#define MDC_HBT_HBE_MASK 0x0FF80000 +#define MDC_HBT_HBS_MASK 0x00000FF8 + +/* MDC_H_SYNC_TIMING BIT FIELDS */ + +#define MDC_HST_HSE_MASK 0x0FF80000 +#define MDC_HST_HSS_MASK 0x00000FF8 + +/* MDC_V_ACTIVE_TIMING BIT FIELDS */ + +#define MDC_VAT_VT_MASK 0x07FF0000 +#define MDC_VAT_VA_MASK 0x000007FF + +/* MDC_V_BLANK_TIMING BIT FIELDS */ + +#define MDC_VBT_VBE_MASK 0x07FF0000 +#define MDC_VBT_VBS_MASK 0x000007FF + +/* MDC_V_SYNC_TIMING BIT FIELDS */ + +#define MDC_VST_VSE_MASK 0x07FF0000 +#define MDC_VST_VSS_MASK 0x000007FF + +/* MDC_DV_CTL BIT DEFINITIONS */ + +#define MDC_DV_LINE_SIZE_MASK 0x00000C00 +#define MDC_DV_LINE_SIZE_1024 0x00000000 +#define MDC_DV_LINE_SIZE_2048 0x00000400 +#define MDC_DV_LINE_SIZE_4096 0x00000800 +#define MDC_DV_LINE_SIZE_8192 0x00000C00 + +/* VGA DEFINITIONS */ + +#define MDC_SEQUENCER_INDEX 0x03C4 +#define MDC_SEQUENCER_DATA 0x03C5 +#define MDC_SEQUENCER_RESET 0x00 +#define MDC_SEQUENCER_CLK_MODE 0x01 + +#define MDC_RESET_VGA_DISP_ENABLE 0x03 +#define MDC_CLK_MODE_SCREEN_OFF 0x20 + +/*---------------------------------------------------*/ +/* REDCLOUD DISPLAY FILTER */ +/*---------------------------------------------------*/ + +/* RCDF VIDEO REGISTER DEFINITIONS */ + +#define RCDF_VIDEO_CONFIG 0x000 +#define RCDF_DISPLAY_CONFIG 0x008 +#define RCDF_VIDEO_X_POS 0x010 +#define RCDF_VIDEO_Y_POS 0x018 +#define RCDF_VIDEO_SCALE 0x020 +#define RCDF_VIDEO_COLOR_KEY 0x028 +#define RCDF_VIDEO_COLOR_MASK 0x030 +#define RCDF_PALETTE_ADDRESS 0x038 +#define RCDF_PALETTE_DATA 0x040 +#define RCDF_VID_MISC 0x050 +#define RCDF_VID_CLOCK_SELECT 0x058 +#define RCDF_VIDEO_DOWNSCALER_CONTROL 0x078 +#define RCDF_VIDEO_DOWNSCALER_COEFFICIENTS 0x080 +#define RCDF_VID_CRC 0x088 +#define RCDF_VID_CRC32 0x090 +#define RCDF_VID_ALPHA_CONTROL 0x098 +#define RCDF_CURSOR_COLOR_KEY 0x0A0 +#define RCDF_CURSOR_COLOR_MASK 0x0A8 +#define RCDF_CURSOR_COLOR_1 0x0B0 +#define RCDF_CURSOR_COLOR_2 0x0B8 +#define RCDF_ALPHA_XPOS_1 0x0C0 +#define RCDF_ALPHA_YPOS_1 0x0C8 +#define RCDF_ALPHA_COLOR_1 0x0D0 +#define RCDF_ALPHA_CONTROL_1 0x0D8 +#define RCDF_ALPHA_XPOS_2 0x0E0 +#define RCDF_ALPHA_YPOS_2 0x0E8 +#define RCDF_ALPHA_COLOR_2 0x0F0 +#define RCDF_ALPHA_CONTROL_2 0x0F8 +#define RCDF_ALPHA_XPOS_3 0x100 +#define RCDF_ALPHA_YPOS_3 0x108 +#define RCDF_ALPHA_COLOR_3 0x110 +#define RCDF_ALPHA_CONTROL_3 0x118 +#define RCDF_VIDEO_REQUEST 0x120 +#define RCDF_ALPHA_WATCH 0x128 +#define RCDF_VIDEO_TEST_MODE 0x210 +#define RCDF_POWER_MANAGEMENT 0x410 + +/* DISPLAY FILTER POWER MANAGEMENT DEFINITIONS */ + +#define RCDF_PM_PANEL_POWER_ON 0x01000000 + +/* DISPLAY FILTER MSRS */ + +#define RCDF_MBD_MSR_DIAG_DF 0x2010 +#define RCDF_DIAG_32BIT_CRC 0x80000000 + +/* "RCDF_VIDEO_CONFIG" BIT DEFINITIONS */ + +#define RCDF_VCFG_VID_EN 0x00000001 +#define RCDF_VCFG_VID_INP_FORMAT 0x0000000C +#define RCDF_VCFG_X_FILTER_EN 0x00000040 +#define RCDF_VCFG_Y_FILTER_EN 0x00000080 +#define RCDF_VCFG_LINE_SIZE_LOWER_MASK 0x0000FF00 +#define RCDF_VCFG_INIT_READ_MASK 0x01FF0000 +#define RCDF_VCFG_LINE_SIZE_UPPER 0x08000000 +#define RCDF_VCFG_4_2_0_MODE 0x10000000 +#define RCDF_VCFG_UYVY_FORMAT 0x00000000 +#define RCDF_VCFG_Y2YU_FORMAT 0x00000004 +#define RCDF_VCFG_YUYV_FORMAT 0x00000008 +#define RCDF_VCFG_YVYU_FORMAT 0x0000000C + +/* "RCDF_DISPLAY_CONFIG" BIT DEFINITIONS */ + +#define RCDF_DCFG_DIS_EN 0x00000001 +#define RCDF_DCFG_HSYNC_EN 0x00000002 +#define RCDF_DCFG_VSYNC_EN 0x00000004 +#define RCDF_DCFG_DAC_BL_EN 0x00000008 +#define RCDF_DCFG_FP_PWR_EN 0x00000040 +#define RCDF_DCFG_FP_DATA_EN 0x00000080 +#define RCDF_DCFG_CRT_HSYNC_POL 0x00000100 +#define RCDF_DCFG_CRT_VSYNC_POL 0x00000200 +#define RCDF_DCFG_CRT_SYNC_SKW_MASK 0x0001C000 +#define RCDF_DCFG_CRT_SYNC_SKW_INIT 0x00010000 +#define RCDF_DCFG_PWR_SEQ_DLY_MASK 0x000E0000 +#define RCDF_DCFG_PWR_SEQ_DLY_INIT 0x00080000 +#define RCDF_DCFG_VG_CK 0x00100000 +#define RCDF_DCFG_GV_PAL_BYP 0x00200000 +#define RCDF_DAC_VREF 0x04000000 +#define RCDF_FP_ON_STATUS 0x08000000 + +/* "RCDF_VID_MISC" BIT DEFINITIONS */ + +#define RCDF_GAMMA_BYPASS_BOTH 0x00000001 +#define RCDF_DAC_POWER_DOWN 0x00000400 +#define RCDF_ANALOG_POWER_DOWN 0x00000800 + +/* "RCDF_VIDEO_DOWNSCALER_CONTROL" BIT DEFINITIONS */ + +#define RCDF_VIDEO_DOWNSCALE_ENABLE 0x00000001 +#define RCDF_VIDEO_DOWNSCALE_FACTOR_POS 1 +#define RCDF_VIDEO_DOWNSCALE_FACTOR_MASK 0x0000001E +#define RCDF_VIDEO_DOWNSCALE_TYPE_A 0x00000000 +#define RCDF_VIDEO_DOWNSCALE_TYPE_B 0x00000040 +#define RCDF_VIDEO_DOWNSCALE_TYPE_MASK 0x00000040 + +/* "RCDF_VIDEO_DOWNSCALER_COEFFICIENTS" BIT DEFINITIONS */ + +#define RCDF_VIDEO_DOWNSCALER_COEF1_POS 0 +#define RCDF_VIDEO_DOWNSCALER_COEF2_POS 8 +#define RCDF_VIDEO_DOWNSCALER_COEF3_POS 16 +#define RCDF_VIDEO_DOWNSCALER_COEF4_POS 24 +#define RCDF_VIDEO_DOWNSCALER_COEF_MASK 0xF + +/* VIDEO DE-INTERLACING AND ALPHA CONTROL */ + +#define RCDF_NO_CK_OUTSIDE_ALPHA 0x00000100 +#define RCDF_CSC_VIDEO_YUV_TO_RGB 0x00000400 +#define RCDF_VIDEO_INPUT_IS_RGB 0x00002000 +#define RCDF_ALPHA1_PRIORITY_POS 16 +#define RCDF_ALPHA1_PRIORITY_MASK 0x00030000 +#define RCDF_ALPHA2_PRIORITY_POS 18 +#define RCDF_ALPHA2_PRIORITY_MASK 0x000C0000 +#define RCDF_ALPHA3_PRIORITY_POS 20 +#define RCDF_ALPHA3_PRIORITY_MASK 0x00300000 + +/* VIDEO CURSOR COLOR KEY DEFINITIONS */ + +#define RCDF_CURSOR_COLOR_KEY_ENABLE 0x20000000 +#define RCDF_CURSOR_COLOR_KEY_OFFSET_POS 24 +#define RCDF_CURSOR_COLOR_BITS 23 +#define RCDF_COLOR_MASK 0x00FFFFFF + /* 24 significant bits */ + +/* ALPHA COLOR BIT DEFINITION (REGISTERS 0x68, 0x78, AND 0x88) */ + +#define RCDF_ALPHA_COLOR_ENABLE 0x01000000 + +/* ALPHA CONTROL BIT DEFINITIONS (REGISTERS 0x6C, 0x7C, AND 0x8C) */ + +#define RCDF_ACTRL_WIN_ENABLE 0x00010000 +#define RCDF_ACTRL_LOAD_ALPHA 0x00020000 + +/* VIDEO REQUEST DEFINITIONS (REGISTER 0x90) */ + +#define RCDF_VIDEO_Y_REQUEST_POS 0 +#define RCDF_VIDEO_X_REQUEST_POS 16 +#define RCDF_VIDEO_REQUEST_MASK 0x000007FF + +/* GEODELINK DEVICE MSR REGISTER SUMMARY */ + +#define MBD_MSR_CAP 0x2000 /* Device Capabilities */ +#define MBD_MSR_CONFIG 0x2001 /* Device Master Configuration */ + /* Register */ +#define MBD_MSR_SMI 0x2002 /* MBus Device SMI Register */ +#define MBD_MSR_ERROR 0x2003 /* MBus Device Error */ +#define MBD_MSR_PM 0x2004 /* MBus Device Power Management */ + /* Register */ +#define MBD_MSR_DIAG 0x2005 /* Mbus Device Diagnostic Register */ + +/* DISPLAY FILTER MBD_MSR_DIAG DEFINITIONS */ + +#define RCDF_MBD_DIAG_SEL0 0x00007FFF /* Lower 32-bits of Diag Bus + * Select */ +#define RCDF_MBD_DIAG_EN0 0x00008000 /* Enable for lower 32-bits of + * diag bus */ +#define RCDF_MBD_DIAG_SEL1 0x7FFF0000 /* Upper 32-bits of Diag Bus + * Select */ +#define RCDF_MBD_DIAG_EN1 0x80000000 /* Enable for upper 32-bits of + * diag bus */ + +/* DISPLAY FILTER MBD_MSR_CONFIG DEFINITIONS */ + +#define RCDF_CONFIG_FMT_MASK 0x00000038 /* Output Format */ +#define RCDF_CONFIG_FMT_CRT 0x00000000 +#define RCDF_CONFIG_FMT_FP 0x00000008 + +/* MCP MSR DEFINITIONS */ + +#define MCP_CLKOFF 0x0010 +#define MCP_CLKACTIVE 0x0011 +#define MCP_CLKDISABLE 0x0012 +#define MCP_CLK4ACK 0x0013 +#define MCP_SYS_RSTPLL 0x0014 +#define MCP_DOTPLL 0x0015 +#define MCP_DBGCLKCTL 0x0016 +#define MCP_RC_REVID 0x0017 +#define MCP_SETM0CTL 0x0040 +#define MCP_SETN0CTL 0x0048 +#define MCP_CMPVAL0 0x0050 +#define MCP_CMPMASK0 0x0051 +#define MCP_REGA 0x0058 +#define MCP_REGB 0x0059 +#define MCP_REGAMASK 0x005A +#define MCP_REGAVAL 0x005B +#define MCP_REGBMASK 0x005C +#define MCP_REGBVAL 0x005D +#define MCP_FIFOCTL 0x005E +#define MCP_DIAGCTL 0x005F +#define MCP_H0CTL 0x0060 +#define MCP_XSTATE 0x0066 +#define MCP_YSTATE 0x0067 +#define MCP_ACTION0 0x0068 + +/* MCP_SYS_RSTPLL DEFINITIONS */ + +#define MCP_DOTPOSTDIV3 0x00000008 +#define MCP_DOTPREMULT2 0x00000004 +#define MCP_DOTPREDIV2 0x00000002 +#define MCP_DOTPLL_HALFPIX 0x01000000 + +/* MCP MBD_MSR_DIAG DEFINITIONS */ + +#define MCP_MBD_DIAG_SEL0 0x00000007 +#define MCP_MBD_DIAG_EN0 0x00008000 +#define MCP_MBD_DIAG_SEL1 0x00070000 +#define MCP_MBD_DIAG_EN1 0x80000000 + +/* MCP_DOTPLL DEFINITIONS */ + +#define MCP_DOTPLL_P 0x00000003 +#define MCP_DOTPLL_N 0x000001FC +#define MCP_DOTPLL_M 0x00001E00 +#define MCP_DOTPLL_LOCK 0x02000000 +#define MCP_DOTPLL_BYPASS 0x00008000 diff --git a/driver/xf86-video-geode/src/gfx/gfx_rndr.c b/driver/xf86-video-geode/src/gfx/gfx_rndr.c new file mode 100644 index 000000000..c5a46ac10 --- /dev/null +++ b/driver/xf86-video-geode/src/gfx/gfx_rndr.c @@ -0,0 +1,671 @@ +/* Copyright (c) 2005 Advanced Micro Devices, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + * + * Neither the name of the Advanced Micro Devices, Inc. nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * */ + +/* + * This file contains routines to program the 2D acceleration hardware: + * + * gfx_set_bpp + * gfx_set_solid_pattern + * gfx_set_mono_pattern + * gfx_set_color_pattern + * gfx_load_color_pattern_line + * gfx_set_solid_source + * gfx_set_mono_source + * gfx_set_raster_operation + * gfx_pattern_fill + * gfx_color_pattern_fill + * gfx_screen_to_screen_blt + * gfx_screen_to_screen_xblt + * gfx_color_bitmap_to_screen_blt + * gfx_color_bitmap_to_screen_xblt + * gfx_mono_bitmap_to_screen_blt + * gfx_bresenham_line + * gfx_wait_until_idle + * */ + +/* STATIC VARIABLES */ + +unsigned short GFXbpp = 16; +unsigned short GFXbb0Base = 0x400; +unsigned short GFXbb1Base = 0x930; +unsigned short GFXbufferWidthPixels = 400; + +unsigned short GFXpatternFlags = 0; +unsigned short GFXsourceFlags = 0; +unsigned long GFXsavedColor = 0; +unsigned short GFXsavedRop = 0; +unsigned short GFXusesDstData = 0; + +/* INCLUDE SUPPORT FOR FIRST GENERATION, IF SPECIFIED. */ + +#if GFX_2DACCEL_GU1 +#include "rndr_gu1.c" +#endif + +/* INCLUDE SUPPORT FOR SECOND GENERATION, IF SPECIFIED. */ + +#if GFX_2DACCEL_GU2 +#include "rndr_gu2.c" +#endif + +/* WRAPPERS IF DYNAMIC SELECTION */ +/* Extra layer to call either first or second generation routines. */ + +#if GFX_2DACCEL_DYNAMIC + +/*--------------------------------------------------------------------------- + * gfx_reset_pitch (PRIVATE ROUTINE - NOT PART OF API) + *--------------------------------------------------------------------------- + */ +void +gfx_reset_pitch(unsigned short pitch) +{ +#if GFX_2DACCEL_GU2 + if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU2) + gu2_reset_pitch(pitch); +#endif +} + +/*--------------------------------------------------------------------------- + * gfx_set_bpp + *--------------------------------------------------------------------------- + */ +void +gfx_set_bpp(unsigned short bpp) +{ +#if GFX_2DACCEL_GU1 + if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU1) + gu1_set_bpp(bpp); +#endif +#if GFX_2DACCEL_GU2 + if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU2) + gu2_set_bpp(bpp); +#endif +} + +/*--------------------------------------------------------------------------- + * gfx_set_solid_source + *--------------------------------------------------------------------------- + */ +void +gfx_set_solid_source(unsigned long color) +{ +#if GFX_2DACCEL_GU1 + if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU1) + gu1_set_solid_source(color); +#endif +#if GFX_2DACCEL_GU2 + if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU2) + gu2_set_solid_source(color); +#endif +} + +/*--------------------------------------------------------------------------- + * gfx_set_mono_source + *--------------------------------------------------------------------------- + */ +void +gfx_set_mono_source(unsigned long bgcolor, unsigned long fgcolor, + unsigned short transparent) +{ +#if GFX_2DACCEL_GU1 + if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU1) + gu1_set_mono_source(bgcolor, fgcolor, transparent); +#endif +#if GFX_2DACCEL_GU2 + if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU2) + gu2_set_mono_source(bgcolor, fgcolor, transparent); +#endif +} + +void +gfx_set_pattern_flags(unsigned short flags) +{ + GFXpatternFlags |= flags; +} + +/*--------------------------------------------------------------------------- + * gfx_set_solid_pattern + *--------------------------------------------------------------------------- + */ +void +gfx_set_solid_pattern(unsigned long color) +{ +#if GFX_2DACCEL_GU1 + if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU1) + gu1_set_solid_pattern(color); +#endif +#if GFX_2DACCEL_GU2 + if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU2) + gu2_set_solid_pattern(color); +#endif +} + +/*--------------------------------------------------------------------------- + * gfx_set_mono_pattern + *--------------------------------------------------------------------------- + */ +void +gfx_set_mono_pattern(unsigned long bgcolor, unsigned long fgcolor, + unsigned long data0, unsigned long data1, unsigned char transparent) +{ +#if GFX_2DACCEL_GU1 + if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU1) + gu1_set_mono_pattern(bgcolor, fgcolor, data0, data1, transparent); +#endif +#if GFX_2DACCEL_GU2 + if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU2) + gu2_set_mono_pattern(bgcolor, fgcolor, data0, data1, transparent); +#endif +} + +/*--------------------------------------------------------------------------- + * gfx_set_color_pattern + *--------------------------------------------------------------------------- + */ +void +gfx_set_color_pattern(unsigned long bgcolor, unsigned long fgcolor, + unsigned long data0, unsigned long data1, + unsigned long data2, unsigned long data3, unsigned char transparent) +{ +#if GFX_2DACCEL_GU1 + if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU1) + gu1_set_color_pattern(bgcolor, fgcolor, data0, data1, data2, data3, + transparent); +#endif +#if GFX_2DACCEL_GU2 + if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU2) + gu2_set_color_pattern(bgcolor, fgcolor, data0, data1, data2, data3, + transparent); +#endif +} + +/*--------------------------------------------------------------------------- + * gfx_load_color_pattern_line + *--------------------------------------------------------------------------- + */ +void +gfx_load_color_pattern_line(short y, unsigned long *pattern_8x8) +{ +#if GFX_2DACCEL_GU1 + if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU1) + gu1_load_color_pattern_line(y, pattern_8x8); +#endif +#if GFX_2DACCEL_GU2 + if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU2) + gu2_load_color_pattern_line(y, pattern_8x8); +#endif +} + +/*--------------------------------------------------------------------------- + * gfx_set_raster_operation + *--------------------------------------------------------------------------- + */ +void +gfx_set_raster_operation(unsigned char rop) +{ +#if GFX_2DACCEL_GU1 + if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU1) + gu1_set_raster_operation(rop); +#endif +#if GFX_2DACCEL_GU2 + if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU2) + gu2_set_raster_operation(rop); +#endif +} + +/*--------------------------------------------------------------------------- + * gfx_pattern_fill + *--------------------------------------------------------------------------- + */ +void +gfx_pattern_fill(unsigned short x, unsigned short y, + unsigned short width, unsigned short height) +{ +#if GFX_2DACCEL_GU1 + if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU1) + gu1_pattern_fill(x, y, width, height); +#endif +#if GFX_2DACCEL_GU2 + if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU2) + gu2_pattern_fill(x, y, width, height); +#endif +} + +/*--------------------------------------------------------------------------- + * gfx_color_pattern_fill + *--------------------------------------------------------------------------- + */ +void +gfx_color_pattern_fill(unsigned short x, unsigned short y, + unsigned short width, unsigned short height, unsigned long *pattern) +{ +#if GFX_2DACCEL_GU1 + if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU1) + gu1_color_pattern_fill(x, y, width, height, pattern); +#endif +#if GFX_2DACCEL_GU2 + if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU2) + gu2_color_pattern_fill(x, y, width, height, pattern); +#endif +} + +/*--------------------------------------------------------------------------- + * gfx_screen_to_screen_blt + *--------------------------------------------------------------------------- + */ +void +gfx_screen_to_screen_blt(unsigned short srcx, unsigned short srcy, + unsigned short dstx, unsigned short dsty, unsigned short width, + unsigned short height) +{ +#if GFX_2DACCEL_GU1 + if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU1) + gu1_screen_to_screen_blt(srcx, srcy, dstx, dsty, width, height); +#endif +#if GFX_2DACCEL_GU2 + if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU2) + gu2_screen_to_screen_blt(srcx, srcy, dstx, dsty, width, height); +#endif +} + +/*--------------------------------------------------------------------------- + * gfx_screen_to_screen_xblt + *--------------------------------------------------------------------------- + */ +void +gfx_screen_to_screen_xblt(unsigned short srcx, unsigned short srcy, + unsigned short dstx, unsigned short dsty, unsigned short width, + unsigned short height, unsigned long color) +{ +#if GFX_2DACCEL_GU1 + if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU1) + gu1_screen_to_screen_xblt(srcx, srcy, dstx, dsty, width, height, + color); +#endif +#if GFX_2DACCEL_GU2 + if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU2) + gu2_screen_to_screen_xblt(srcx, srcy, dstx, dsty, width, height, + color); +#endif +} + +/*--------------------------------------------------------------------------- + * gfx_color_bitmap_to_screen_blt + *--------------------------------------------------------------------------- + */ +void +gfx_color_bitmap_to_screen_blt(unsigned short srcx, unsigned short srcy, + unsigned short dstx, unsigned short dsty, unsigned short width, + unsigned short height, unsigned char *data, long pitch) +{ +#if GFX_2DACCEL_GU1 + if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU1) + gu1_color_bitmap_to_screen_blt(srcx, srcy, dstx, dsty, width, height, + data, pitch); +#endif +#if GFX_2DACCEL_GU2 + if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU2) + gu2_color_bitmap_to_screen_blt(srcx, srcy, dstx, dsty, width, height, + data, pitch); +#endif +} + +/*--------------------------------------------------------------------------- + * gfx_color_bitmap_to_screen_xblt + *--------------------------------------------------------------------------- + */ +void +gfx_color_bitmap_to_screen_xblt(unsigned short srcx, unsigned short srcy, + unsigned short dstx, unsigned short dsty, unsigned short width, + unsigned short height, unsigned char *data, long pitch, + unsigned long color) +{ +#if GFX_2DACCEL_GU1 + if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU1) + gu1_color_bitmap_to_screen_xblt(srcx, srcy, dstx, dsty, width, height, + data, pitch, color); +#endif +#if GFX_2DACCEL_GU2 + if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU2) + gu2_color_bitmap_to_screen_xblt(srcx, srcy, dstx, dsty, width, height, + data, pitch, color); +#endif +} + +/*--------------------------------------------------------------------------- + * gfx_mono_bitmap_to_screen_blt + *--------------------------------------------------------------------------- + */ +void +gfx_mono_bitmap_to_screen_blt(unsigned short srcx, unsigned short srcy, + unsigned short dstx, unsigned short dsty, unsigned short width, + unsigned short height, unsigned char *data, short pitch) +{ +#if GFX_2DACCEL_GU1 + if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU1) + gu1_mono_bitmap_to_screen_blt(srcx, srcy, dstx, dsty, width, height, + data, pitch); +#endif +#if GFX_2DACCEL_GU2 + if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU2) + gu2_mono_bitmap_to_screen_blt(srcx, srcy, dstx, dsty, width, height, + data, pitch); +#endif +} + +/*--------------------------------------------------------------------------- + * gfx_text_blt + *--------------------------------------------------------------------------- + */ +void +gfx_text_blt(unsigned short dstx, unsigned short dsty, unsigned short width, + unsigned short height, unsigned char *data) +{ +#if GFX_2DACCEL_GU1 + if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU1) + gu1_text_blt(dstx, dsty, width, height, data); +#endif +#if GFX_2DACCEL_GU2 + if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU2) + gu2_text_blt(dstx, dsty, width, height, data); +#endif +} + +/*--------------------------------------------------------------------------- + * gfx_bresenham_line + *--------------------------------------------------------------------------- + */ +void +gfx_bresenham_line(unsigned short x, unsigned short y, + unsigned short length, unsigned short initerr, + unsigned short axialerr, unsigned short diagerr, unsigned short flags) +{ +#if GFX_2DACCEL_GU1 + if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU1) + gu1_bresenham_line(x, y, length, initerr, axialerr, diagerr, flags); +#endif +#if GFX_2DACCEL_GU2 + if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU2) + gu2_bresenham_line(x, y, length, initerr, axialerr, diagerr, flags); +#endif +} + +/*--------------------------------------------------------------------------- + * gfx_wait_until_idle + *--------------------------------------------------------------------------- + */ +void +gfx_wait_until_idle(void) +{ +#if GFX_2DACCEL_GU1 + if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU1) + gu1_wait_until_idle(); +#endif +#if GFX_2DACCEL_GU2 + if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU2) + gu2_wait_until_idle(); +#endif +} + +/*--------------------------------------------------------------------------- + * gfx_test_blt_pending + *--------------------------------------------------------------------------- + */ +int +gfx_test_blt_pending(void) +{ + int retval = 0; + +#if GFX_2DACCEL_GU1 + if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU1) + retval = gu1_test_blt_pending(); +#endif +#if GFX_2DACCEL_GU2 + if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU2) + retval = gu2_test_blt_pending(); +#endif + return (retval); +} + +/*--------------------------------------------------------------------------- + * NEW ROUTINES FOR REDCLOUD + *--------------------------------------------------------------------------- + */ + +/*--------------------------------------------------------------------------- + * gfx2_set_source_stride + *--------------------------------------------------------------------------- + */ +void +gfx2_set_source_stride(unsigned short stride) +{ +#if GFX_2DACCEL_GU2 + if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU2) + gu22_set_source_stride(stride); +#endif +} + +/*--------------------------------------------------------------------------- + * gfx2_set_destination_stride + *--------------------------------------------------------------------------- + */ +void +gfx2_set_destination_stride(unsigned short stride) +{ +#if GFX_2DACCEL_GU2 + if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU2) + gu22_set_destination_stride(stride); +#endif +} + +/*--------------------------------------------------------------------------- + * gfx2_set_pattern_origin + *--------------------------------------------------------------------------- + */ +void +gfx2_set_pattern_origin(int x, int y) +{ +#if GFX_2DACCEL_GU2 + if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU2) + gu22_set_pattern_origin(x, y); +#endif +} + +/*--------------------------------------------------------------------------- + * gfx2_set_source_transparency + *--------------------------------------------------------------------------- + */ +void +gfx2_set_source_transparency(unsigned long color, unsigned long mask) +{ +#if GFX_2DACCEL_GU2 + if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU2) + gu22_set_source_transparency(color, mask); +#endif +} + +/*--------------------------------------------------------------------------- + * gfx2_set_alpha_mode + *--------------------------------------------------------------------------- + */ +void +gfx2_set_alpha_mode(int mode) +{ +#if GFX_2DACCEL_GU2 + if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU2) + gu22_set_alpha_mode(mode); +#endif +} + +/*--------------------------------------------------------------------------- + * gfx2_set_alpha_value + *--------------------------------------------------------------------------- + */ +void +gfx2_set_alpha_value(unsigned char value) +{ +#if GFX_2DACCEL_GU2 + if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU2) + gu22_set_alpha_value(value); +#endif +} + +/*--------------------------------------------------------------------------- + * gfx2_pattern_fill + *--------------------------------------------------------------------------- + */ +void +gfx2_pattern_fill(unsigned long dstoffset, unsigned short width, + unsigned short height) +{ +#if GFX_2DACCEL_GU2 + if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU2) + gu22_pattern_fill(dstoffset, width, height); +#endif +} + +/*--------------------------------------------------------------------------- + * gfx2_color_pattern_fill + *--------------------------------------------------------------------------- + */ +void +gfx2_color_pattern_fill(unsigned long dstoffset, unsigned short width, + unsigned short height, unsigned long *pattern) +{ +#if GFX_2DACCEL_GU2 + if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU2) + gu22_color_pattern_fill(dstoffset, width, height, pattern); +#endif +} + +/*--------------------------------------------------------------------------- + * gfx2_screen_to_screen_blt + *--------------------------------------------------------------------------- + */ +void +gfx2_screen_to_screen_blt(unsigned long srcoffset, unsigned long dstoffset, + unsigned short width, unsigned short height, int flags) +{ +#if GFX_2DACCEL_GU2 + if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU2) + gu22_screen_to_screen_blt(srcoffset, dstoffset, width, height, flags); +#endif +} + +/*--------------------------------------------------------------------------- + * gfx2_mono_expand_blt + *--------------------------------------------------------------------------- + */ +void +gfx2_mono_expand_blt(unsigned long srcbase, unsigned short srcx, + unsigned short srcy, unsigned long dstoffset, unsigned short width, + unsigned short height, int byte_packed) +{ +#if GFX_2DACCEL_GU2 + if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU2) + gu22_mono_expand_blt(srcbase, srcx, srcy, dstoffset, width, height, + byte_packed); +#endif +} + +/*--------------------------------------------------------------------------- + * gfx2_color_bitmap_to_screen_blt + *--------------------------------------------------------------------------- + */ +void +gfx2_color_bitmap_to_screen_blt(unsigned short srcx, unsigned short srcy, + unsigned long dstoffset, unsigned short width, unsigned short height, + unsigned char *data, short pitch) +{ +#if GFX_2DACCEL_GU2 + if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU2) + gu22_color_bitmap_to_screen_blt(srcx, srcy, dstoffset, width, height, + data, pitch); +#endif +} + +/*--------------------------------------------------------------------------- + * gfx2_text_blt + *--------------------------------------------------------------------------- + */ +void +gfx2_text_blt(unsigned long dstoffset, unsigned short width, + unsigned short height, unsigned char *data) +{ +#if GFX_2DACCEL_GU2 + if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU2) + gu22_text_blt(dstoffset, width, height, data); +#endif +} + +/*--------------------------------------------------------------------------- + * gfx2_mono_bitmap_to_screen_blt + *--------------------------------------------------------------------------- + */ +void +gfx2_mono_bitmap_to_screen_blt(unsigned short srcx, unsigned short srcy, + unsigned long dstoffset, unsigned short width, unsigned short height, + unsigned char *data, short pitch) +{ +#if GFX_2DACCEL_GU2 + if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU2) + gu22_mono_bitmap_to_screen_blt(srcx, srcy, dstoffset, width, height, + data, pitch); +#endif +} + +/*--------------------------------------------------------------------------- + * gfx2_bresenham_line + *--------------------------------------------------------------------------- + */ +void +gfx2_bresenham_line(unsigned long dstoffset, + unsigned short length, unsigned short initerr, + unsigned short axialerr, unsigned short diagerr, unsigned short flags) +{ +#if GFX_2DACCEL_GU2 + if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU2) + gu22_bresenham_line(dstoffset, length, initerr, axialerr, diagerr, + flags); +#endif +} + +/*--------------------------------------------------------------------------- + * gfx2_sync_to_vblank + *--------------------------------------------------------------------------- + */ +void +gfx2_sync_to_vblank(void) +{ +#if GFX_2DACCEL_GU2 + if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU2) + gu22_sync_to_vblank(); +#endif +} + +#endif /* GFX_2DACCEL_DYNAMIC */ + +/* END OF FILE */ diff --git a/driver/xf86-video-geode/src/gfx/gfx_rtns.h b/driver/xf86-video-geode/src/gfx/gfx_rtns.h new file mode 100644 index 000000000..d7e001e66 --- /dev/null +++ b/driver/xf86-video-geode/src/gfx/gfx_rtns.h @@ -0,0 +1,601 @@ +/* Copyright (c) 2005 Advanced Micro Devices, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + * + * Neither the name of the Advanced Micro Devices, Inc. nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * */ + +/* + * This header file defines the Durango routines and variables used + * to access the memory mapped regions. + * */ + +#ifndef _gfx_rtns_h +#define _gfx_rtns_h + +/* INCLUDE DURANGO DEFINITIONS */ +/* These definitions are placed in another file to allow their inclusion + * in a user application. Such applications generally work through driver + * shell routines that simply pass their parameters to Durango routines. + * An external file provides an easy way to provide the definitions for these + * parameters without the applications gaining any Durango visisbility. + * */ + +#include "gfx_type.h" + +/* COMPILER OPTION FOR C++ PROGRAMS */ + +#ifdef __cplusplus +extern "C" +{ +#endif + +/* DURANGO MEMORY POINTERS */ + + extern unsigned char *gfx_virt_regptr; + extern unsigned char *gfx_virt_fbptr; + extern unsigned char *gfx_virt_vidptr; + extern unsigned char *gfx_virt_vipptr; + extern unsigned char *gfx_virt_spptr; + extern unsigned char *gfx_virt_gpptr; + + extern unsigned char *gfx_phys_regptr; + extern unsigned char *gfx_phys_fbptr; + extern unsigned char *gfx_phys_vidptr; + extern unsigned char *gfx_phys_vipptr; + extern unsigned char *gfx_phys_spptr; + extern unsigned char *gfx_phys_gpptr; + +/* DURANGO VARIBLES FOR RUNTIME SELECTION AND POSSIBLE VALUES */ + + extern int gfx_display_type; +#define GFX_DISPLAY_TYPE_GU1 0x0001 +#define GFX_DISPLAY_TYPE_GU2 0x0002 + + extern int gfx_init_type; +#define GFX_INIT_TYPE_GU1 0x0001 +#define GFX_INIT_TYPE_GU2 0x0002 + + extern int gfx_msr_type; +#define GFX_MSR_TYPE_REDCLOUD 0x0001 + + extern int gfx_2daccel_type; +#define GFX_2DACCEL_TYPE_GU1 0x0001 +#define GFX_2DACCEL_TYPE_GU2 0x0002 + + extern int gfx_video_type; +#define GFX_VIDEO_TYPE_CS5530 0x0001 +#define GFX_VIDEO_TYPE_SC1200 0x0002 +#define GFX_VIDEO_TYPE_REDCLOUD 0x0004 + + extern int gfx_vip_type; +#define GFX_VIP_TYPE_SC1200 0x0001 + + extern int gfx_decoder_type; +#define GFX_DECODER_TYPE_SAA7114 0x0001 + + extern int gfx_tv_type; +#define GFX_TV_TYPE_SC1200 0x0001 +#define GFX_TV_TYPE_FS451 0x0002 + + extern int gfx_i2c_type; +#define GFX_I2C_TYPE_ACCESS 0x0001 +#define GFX_I2C_TYPE_GPIO 0x0002 + +/* GLOBAL CPU INFORMATION */ + + extern unsigned long gfx_cpu_version; + extern unsigned long gfx_cpu_frequency; + extern unsigned long gfx_vid_version; + extern ChipType gfx_chip_revision; + +/* ROUTINES IN GFX_INIT.C */ + + unsigned long gfx_pci_config_read(unsigned long address); + void gfx_pci_config_write(unsigned long address, unsigned long data); + unsigned long gfx_get_core_freq(void); + unsigned long gfx_detect_cpu(void); + unsigned long gfx_detect_video(void); + unsigned long gfx_get_cpu_register_base(void); + unsigned long gfx_get_graphics_register_base(void); + unsigned long gfx_get_frame_buffer_base(void); + unsigned long gfx_get_frame_buffer_size(void); + unsigned long gfx_get_vid_register_base(void); + unsigned long gfx_get_vip_register_base(void); + +/* ROUTINES IN GFX_MSR.C */ + + int gfx_msr_init(void); + DEV_STATUS gfx_id_msr_device(MSR * pDev, unsigned long address); + DEV_STATUS gfx_get_msr_dev_address(unsigned int device, + unsigned long *address); + DEV_STATUS gfx_get_glink_id_at_address(unsigned int *device, + unsigned long address); + DEV_STATUS gfx_msr_read(unsigned int device, unsigned int msrRegister, + Q_WORD * msrValue); + DEV_STATUS gfx_msr_write(unsigned int device, unsigned int msrRegister, + Q_WORD * msrValue); + +/* ROUTINES IN GFX_DISP.C */ + + int gfx_set_display_bpp(unsigned short bpp); + int gfx_is_display_mode_supported(int xres, int yres, int bpp, int hz); + int gfx_set_display_mode(int xres, int yres, int bpp, int hz); + int gfx_set_display_timings(unsigned short bpp, unsigned short flags, + unsigned short hactive, unsigned short hblank_start, + unsigned short hsync_start, unsigned short hsync_end, + unsigned short hblank_end, unsigned short htotal, + unsigned short vactive, unsigned short vblank_start, + unsigned short vsync_start, unsigned short vsync_end, + unsigned short vblank_end, unsigned short vtotal, + unsigned long frequency); + int gfx_set_vtotal(unsigned short vtotal); + void gfx_set_display_pitch(unsigned short pitch); + void gfx_set_display_offset(unsigned long offset); + int gfx_set_display_palette_entry(unsigned long index, + unsigned long palette); + int gfx_set_display_palette(unsigned long *palette); + void gfx_video_shutdown(void); + void gfx_set_clock_frequency(unsigned long frequency); + int gfx_set_crt_enable(int enable); + void gfx_set_cursor_enable(int enable); + void gfx_set_cursor_colors(unsigned long bkcolor, unsigned long fgcolor); + void gfx_set_cursor_position(unsigned long memoffset, + unsigned short xpos, unsigned short ypos, + unsigned short xhotspot, unsigned short yhotspot); + void gfx_set_cursor_shape32(unsigned long memoffset, + unsigned long *andmask, unsigned long *xormask); + void gfx_set_cursor_shape64(unsigned long memoffset, + unsigned long *andmask, unsigned long *xormask); + void gfx_set_icon_enable(int enable); + void gfx_set_icon_colors(unsigned long color0, unsigned long color1, + unsigned long color2); + void gfx_set_icon_position(unsigned long memoffset, unsigned short xpos); + void gfx_set_icon_shape64(unsigned long memoffset, unsigned long *andmask, + unsigned long *xormask, unsigned int lines); + + int gfx_set_compression_enable(int enable); + int gfx_set_compression_offset(unsigned long offset); + int gfx_set_compression_pitch(unsigned short pitch); + int gfx_set_compression_size(unsigned short size); + void gfx_set_display_priority_high(int enable); + int gfx_test_timing_active(void); + int gfx_test_vertical_active(void); + int gfx_wait_vertical_blank(void); + void gfx_delay_milliseconds(unsigned long milliseconds); + void gfx_delay_microseconds(unsigned long microseconds); + void gfx_enable_panning(int x, int y); + int gfx_is_panel_mode_supported(int panelResX, int panelResY, + unsigned short width, unsigned short height, unsigned short bpp); + int gfx_set_fixed_timings(int panelResX, int panelResY, + unsigned short width, unsigned short height, unsigned short bpp); + int gfx_set_panel_present(int panelResX, int panelResY, + unsigned short width, unsigned short height, unsigned short bpp); + void gfx_reset_timing_lock(void); + +/* "READ" ROUTINES IN GFX_DISP.C */ + + int gfx_get_display_details(unsigned int mode, int *xres, int *yres, + int *hz); + unsigned short gfx_get_display_pitch(void); + int gfx_get_vsa2_softvga_enable(void); + int gfx_get_sync_polarities(void); + unsigned long gfx_get_clock_frequency(void); + unsigned long gfx_get_max_supported_pixel_clock(void); + int gfx_mode_frequency_supported(int xres, int yres, int bpp, + unsigned long frequency); + int gfx_get_refreshrate_from_frequency(int xres, int yres, int bpp, + int *hz, unsigned long frequency); + int gfx_get_refreshrate_from_mode(int xres, int yres, int bpp, int *hz, + unsigned long frequency); + int gfx_get_frequency_from_refreshrate(int xres, int yres, int bpp, + int hz, int *frequency); + int gfx_get_display_mode_count(void); + int gfx_get_display_mode(int *xres, int *yres, int *bpp, int *hz); + unsigned long gfx_get_frame_buffer_line_size(void); + unsigned short gfx_get_hactive(void); + unsigned short gfx_get_hblank_start(void); + unsigned short gfx_get_hsync_start(void); + unsigned short gfx_get_hsync_end(void); + unsigned short gfx_get_hblank_end(void); + unsigned short gfx_get_htotal(void); + unsigned short gfx_get_vactive(void); + unsigned short gfx_get_vline(void); + unsigned short gfx_get_vblank_start(void); + unsigned short gfx_get_vsync_start(void); + unsigned short gfx_get_vsync_end(void); + unsigned short gfx_get_vblank_end(void); + unsigned short gfx_get_vtotal(void); + unsigned short gfx_get_display_bpp(void); + unsigned long gfx_get_display_offset(void); + int gfx_get_display_palette_entry(unsigned long index, + unsigned long *palette); + void gfx_get_display_palette(unsigned long *palette); + unsigned long gfx_get_cursor_enable(void); + unsigned long gfx_get_cursor_offset(void); + unsigned long gfx_get_cursor_position(void); + unsigned long gfx_get_cursor_clip(void); + unsigned long gfx_get_cursor_color(int color); + unsigned long gfx_get_icon_enable(void); + unsigned long gfx_get_icon_offset(void); + unsigned long gfx_get_icon_position(void); + unsigned long gfx_get_icon_color(int color); + int gfx_get_compression_enable(void); + unsigned long gfx_get_compression_offset(void); + unsigned short gfx_get_compression_pitch(void); + unsigned short gfx_get_compression_size(void); + int gfx_get_display_priority_high(void); + int gfx_get_valid_bit(int line); + +/* ROUTINES IN GFX_RNDR.C */ + + void gfx_set_bpp(unsigned short bpp); + void gfx_set_solid_pattern(unsigned long color); + void gfx_set_mono_pattern(unsigned long bgcolor, unsigned long fgcolor, + unsigned long data0, unsigned long data1, unsigned char transparency); + void gfx_set_color_pattern(unsigned long bgcolor, unsigned long fgcolor, + unsigned long data0, unsigned long data1, unsigned long data2, + unsigned long data3, unsigned char transparency); + void gfx_load_color_pattern_line(short y, unsigned long *pattern_8x8); + void gfx_set_solid_source(unsigned long color); + void gfx_set_mono_source(unsigned long bgcolor, unsigned long fgcolor, + unsigned short transparent); + void gfx_set_pattern_flags(unsigned short flags); + void gfx_set_raster_operation(unsigned char rop); + void gfx_pattern_fill(unsigned short x, unsigned short y, + unsigned short width, unsigned short height); + void gfx_color_pattern_fill(unsigned short x, unsigned short y, + unsigned short width, unsigned short height, unsigned long *pattern); + void gfx_screen_to_screen_blt(unsigned short srcx, unsigned short srcy, + unsigned short dstx, unsigned short dsty, unsigned short width, + unsigned short height); + void gfx_screen_to_screen_xblt(unsigned short srcx, unsigned short srcy, + unsigned short dstx, unsigned short dsty, unsigned short width, + unsigned short height, unsigned long color); + void gfx_color_bitmap_to_screen_blt(unsigned short srcx, + unsigned short srcy, unsigned short dstx, unsigned short dsty, + unsigned short width, unsigned short height, unsigned char *data, + long pitch); + void gfx_color_bitmap_to_screen_xblt(unsigned short srcx, + unsigned short srcy, unsigned short dstx, unsigned short dsty, + unsigned short width, unsigned short height, unsigned char *data, + long pitch, unsigned long color); + void gfx_mono_bitmap_to_screen_blt(unsigned short srcx, + unsigned short srcy, unsigned short dstx, unsigned short dsty, + unsigned short width, unsigned short height, unsigned char *data, + short pitch); + void gfx_text_blt(unsigned short dstx, unsigned short dsty, + unsigned short width, unsigned short height, unsigned char *data); + void gfx_bresenham_line(unsigned short x, unsigned short y, + unsigned short length, unsigned short initerr, + unsigned short axialerr, unsigned short diagerr, + unsigned short flags); + void gfx_wait_until_idle(void); + int gfx_test_blt_pending(void); + +/* SECOND GENERATION RENDERING ROUTINES */ + + void gfx2_set_source_stride(unsigned short stride); + void gfx2_set_destination_stride(unsigned short stride); + void gfx2_set_pattern_origin(int x, int y); + void gfx2_set_source_transparency(unsigned long color, + unsigned long mask); + void gfx2_set_alpha_mode(int mode); + void gfx2_set_alpha_value(unsigned char value); + void gfx2_pattern_fill(unsigned long dstoffset, unsigned short width, + unsigned short height); + void gfx2_color_pattern_fill(unsigned long dstoffset, + unsigned short width, unsigned short height, unsigned long *pattern); + void gfx2_screen_to_screen_blt(unsigned long srcoffset, + unsigned long dstoffset, unsigned short width, unsigned short height, + int flags); + void gfx2_mono_expand_blt(unsigned long srcbase, unsigned short srcx, + unsigned short srcy, unsigned long dstoffset, unsigned short width, + unsigned short height, int byte_packed); + void gfx2_color_bitmap_to_screen_blt(unsigned short srcx, + unsigned short srcy, unsigned long dstoffset, unsigned short width, + unsigned short height, unsigned char *data, short pitch); + void gfx2_mono_bitmap_to_screen_blt(unsigned short srcx, + unsigned short srcy, unsigned long dstoffset, unsigned short width, + unsigned short height, unsigned char *data, short pitch); + void gfx2_text_blt(unsigned long dstoffset, unsigned short width, + unsigned short height, unsigned char *data); + void gfx2_bresenham_line(unsigned long dstoffset, unsigned short length, + unsigned short initerr, unsigned short axialerr, + unsigned short diagerr, unsigned short flags); + void gfx2_sync_to_vblank(void); + +/* ROUTINES IN GFX_VID.C */ + + int gfx_set_video_enable(int enable); + int gfx_set_video_format(unsigned long format); + int gfx_set_video_size(unsigned short width, unsigned short height); + int gfx_set_video_yuv_pitch(unsigned long ypitch, unsigned long uvpitch); + int gfx_set_video_offset(unsigned long offset); + int gfx_set_video_yuv_offsets(unsigned long yoffset, + unsigned long uoffset, unsigned long voffset); + int gfx_set_video_window(short x, short y, unsigned short w, + unsigned short h); + int gfx_set_video_left_crop(unsigned short x); + int gfx_set_video_upscale(unsigned short srcw, unsigned short srch, + unsigned short dstw, unsigned short dsth); + int gfx_set_video_scale(unsigned short srcw, unsigned short srch, + unsigned short dstw, unsigned short dsth); + int gfx_set_video_vertical_downscale(unsigned short srch, + unsigned short dsth); + void gfx_set_video_vertical_downscale_enable(int enable); + int gfx_set_video_downscale_config(unsigned short type, unsigned short m); + int gfx_set_video_color_key(unsigned long key, unsigned long mask, + int bluescreen); + int gfx_set_video_filter(int xfilter, int yfilter); + int gfx_set_video_palette(unsigned long *palette); + int gfx_set_graphics_palette(unsigned long *palette); + int gfx_set_video_palette_bypass(int enable); + int gfx_set_video_palette_entry(unsigned long index, unsigned long color); + int gfx_set_graphics_palette_entry(unsigned long index, + unsigned long color); + int gfx_set_video_downscale_coefficients(unsigned short coef1, + unsigned short coef2, unsigned short coef3, unsigned short coef4); + int gfx_set_video_downscale_enable(int enable); + int gfx_set_video_source(VideoSourceType source); + int gfx_set_vbi_source(VbiSourceType source); + int gfx_set_vbi_lines(unsigned long even, unsigned long odd); + int gfx_set_vbi_total(unsigned long even, unsigned long odd); + int gfx_set_video_interlaced(int enable); + int gfx_set_color_space_YUV(int enable); + int gfx_set_vertical_scaler_offset(char offset); + int gfx_set_top_line_in_odd(int enable); + int gfx_set_genlock_delay(unsigned long delay); + int gfx_set_genlock_enable(int flags); + int gfx_set_video_cursor(unsigned long key, unsigned long mask, + unsigned short select_color2, unsigned long color1, + unsigned long color2); + int gfx_set_video_cursor_enable(int enable); + int gfx_set_video_request(short x, short y); + + int gfx_select_alpha_region(int region); + int gfx_set_alpha_enable(int enable); + int gfx_set_alpha_window(short x, short y, + unsigned short width, unsigned short height); + int gfx_set_alpha_value(unsigned char alpha, char delta); + int gfx_set_alpha_priority(int priority); + int gfx_set_alpha_color(unsigned long color); + int gfx_set_alpha_color_enable(int enable); + int gfx_set_no_ck_outside_alpha(int enable); + int gfx_disable_softvga(void); + int gfx_enable_softvga(void); + int gfx_set_macrovision_enable(int enable); + unsigned long gfx_get_max_video_width(void); + +/* READ ROUTINES IN GFX_VID.C */ + + int gfx_get_video_enable(void); + int gfx_get_video_format(void); + unsigned long gfx_get_video_src_size(void); + unsigned long gfx_get_video_line_size(void); + unsigned long gfx_get_video_xclip(void); + unsigned long gfx_get_video_offset(void); + void gfx_get_video_yuv_offsets(unsigned long *yoffset, + unsigned long *uoffset, unsigned long *voffset); + void gfx_get_video_yuv_pitch(unsigned long *ypitch, + unsigned long *uvpitch); + unsigned long gfx_get_video_upscale(void); + unsigned long gfx_get_video_scale(void); + unsigned long gfx_get_video_downscale_delta(void); + int gfx_get_video_vertical_downscale_enable(void); + int gfx_get_video_downscale_config(unsigned short *type, + unsigned short *m); + void gfx_get_video_downscale_coefficients(unsigned short *coef1, + unsigned short *coef2, unsigned short *coef3, unsigned short *coef4); + void gfx_get_video_downscale_enable(int *enable); + unsigned long gfx_get_video_dst_size(void); + unsigned long gfx_get_video_position(void); + unsigned long gfx_get_video_color_key(void); + unsigned long gfx_get_video_color_key_mask(void); + int gfx_get_video_palette_entry(unsigned long index, + unsigned long *palette); + int gfx_get_video_color_key_src(void); + int gfx_get_video_filter(void); + int gfx_get_video_request(short *x, short *y); + int gfx_get_video_source(VideoSourceType * source); + int gfx_get_vbi_source(VbiSourceType * source); + unsigned long gfx_get_vbi_lines(int odd); + unsigned long gfx_get_vbi_total(int odd); + int gfx_get_video_interlaced(void); + int gfx_get_color_space_YUV(void); + int gfx_get_vertical_scaler_offset(char *offset); + unsigned long gfx_get_genlock_delay(void); + int gfx_get_genlock_enable(void); + int gfx_get_video_cursor(unsigned long *key, unsigned long *mask, + unsigned short *select_color2, unsigned long *color1, + unsigned short *color2); + unsigned long gfx_read_crc(void); + unsigned long gfx_read_crc32(void); + unsigned long gfx_read_window_crc(int source, unsigned short x, + unsigned short y, unsigned short width, unsigned short height, + int crc32); + int gfx_get_macrovision_enable(void); + + void gfx_get_alpha_enable(int *enable); + void gfx_get_alpha_size(unsigned short *x, unsigned short *y, + unsigned short *width, unsigned short *height); + void gfx_get_alpha_value(unsigned char *alpha, char *delta); + void gfx_get_alpha_priority(int *priority); + void gfx_get_alpha_color(unsigned long *color); + +/* ROUTINES IN GFX_VIP.C */ + + int gfx_set_vip_enable(int enable); + int gfx_set_vip_capture_run_mode(int mode); + int gfx_set_vip_base(unsigned long even, unsigned long odd); + int gfx_set_vip_pitch(unsigned long pitch); + int gfx_set_vip_mode(int mode); + int gfx_set_vbi_enable(int enable); + int gfx_set_vbi_mode(int mode); + int gfx_set_vbi_base(unsigned long even, unsigned long odd); + int gfx_set_vbi_pitch(unsigned long pitch); + int gfx_set_vbi_direct(unsigned long even_lines, unsigned long odd_lines); + int gfx_set_vbi_interrupt(int enable); + int gfx_set_vip_bus_request_threshold_high(int enable); + int gfx_set_vip_last_line(int last_line); + int gfx_test_vip_odd_field(void); + int gfx_test_vip_bases_updated(void); + int gfx_test_vip_fifo_overflow(void); + int gfx_get_vip_line(void); + +/* READ ROUTINES IN GFX_VIP.C */ + + int gfx_get_vip_enable(void); + unsigned long gfx_get_vip_base(int odd); + unsigned long gfx_get_vip_pitch(void); + int gfx_get_vip_mode(void); + int gfx_get_vbi_enable(void); + int gfx_get_vbi_mode(void); + unsigned long gfx_get_vbi_base(int odd); + unsigned long gfx_get_vbi_pitch(void); + unsigned long gfx_get_vbi_direct(int odd); + int gfx_get_vbi_interrupt(void); + int gfx_get_vip_bus_request_threshold_high(void); + +/* ROUTINES IN GFX_DCDR.C */ + + int gfx_set_decoder_defaults(void); + int gfx_set_decoder_analog_input(unsigned char input); + int gfx_set_decoder_brightness(unsigned char brightness); + int gfx_set_decoder_contrast(unsigned char contrast); + int gfx_set_decoder_hue(char hue); + int gfx_set_decoder_saturation(unsigned char saturation); + int gfx_set_decoder_input_offset(unsigned short x, unsigned short y); + int gfx_set_decoder_input_size(unsigned short width, + unsigned short height); + int gfx_set_decoder_output_size(unsigned short width, + unsigned short height); + int gfx_set_decoder_scale(unsigned short srcw, unsigned short srch, + unsigned short dstw, unsigned short dsth); + int gfx_set_decoder_vbi_format(int start, int end, int format); + int gfx_set_decoder_vbi_enable(int enable); + int gfx_set_decoder_vbi_upscale(void); + int gfx_set_decoder_TV_standard(TVStandardType TVStandard); + int gfx_set_decoder_luminance_filter(unsigned char lufi); + int gfx_decoder_software_reset(void); + int gfx_decoder_detect_macrovision(void); + int gfx_decoder_detect_video(void); + +/* READ ROUTINES IN GFX_DCDR.C */ + + unsigned char gfx_get_decoder_brightness(void); + unsigned char gfx_get_decoder_contrast(void); + char gfx_get_decoder_hue(void); + unsigned char gfx_get_decoder_saturation(void); + unsigned long gfx_get_decoder_input_offset(void); + unsigned long gfx_get_decoder_input_size(void); + unsigned long gfx_get_decoder_output_size(void); + int gfx_get_decoder_vbi_format(int line); + +/* ROUTINES IN GFX_I2C.C */ + + int gfx_i2c_reset(unsigned char busnum, short adr, char freq); + int gfx_i2c_write(unsigned char busnum, unsigned char chipadr, + unsigned char subadr, unsigned char bytes, unsigned char *data); + int gfx_i2c_read(unsigned char busnum, unsigned char chipadr, + unsigned char subadr, unsigned char bytes, unsigned char *data); + int gfx_i2c_select_gpio(int clock, int data); + int gfx_i2c_init(void); + void gfx_i2c_cleanup(void); + +/* ROUTINES IN GFX_TV.C */ + + int gfx_set_tv_format(TVStandardType format, GfxOnTVType resolution); + int gfx_set_tv_output(int output); + int gfx_set_tv_enable(int enable); + int gfx_set_tv_flicker_filter(int ff); + int gfx_set_tv_sub_carrier_reset(int screset); + int gfx_set_tv_vphase(int vphase); + int gfx_set_tv_YC_delay(int delay); + int gfx_set_tvenc_reset_interval(int interval); + int gfx_set_tv_cc_enable(int enable); + int gfx_set_tv_cc_data(unsigned char data1, unsigned char data2); + int gfx_set_tv_display(int width, int height); + int gfx_test_tvout_odd_field(void); + int gfx_test_tvenc_odd_field(void); + int gfx_set_tv_field_status_invert(int enable); + int gfx_get_tv_vphase(void); + int gfx_get_tv_enable(unsigned int *p_on); + int gfx_get_tv_output(void); + int gfx_get_tv_mode_count(TVStandardType format); + int gfx_get_tv_display_mode(int *width, int *height, int *bpp, int *hz); + int gfx_get_tv_display_mode_frequency(unsigned short width, + unsigned short height, TVStandardType format, int *frequency); + int gfx_is_tv_display_mode_supported(unsigned short width, + unsigned short height, TVStandardType format); + + int gfx_get_tv_standard(unsigned long *p_standard); + int gfx_get_available_tv_standards(unsigned long *p_standards); + int gfx_set_tv_standard(unsigned long standard); + int gfx_get_tv_vga_mode(unsigned long *p_vga_mode); + int gfx_get_available_tv_vga_modes(unsigned long *p_vga_modes); + int gfx_set_tv_vga_mode(unsigned long vga_mode); + int gfx_get_tvout_mode(unsigned long *p_tvout_mode); + int gfx_set_tvout_mode(unsigned long tvout_mode); + int gfx_get_sharpness(int *p_sharpness); + int gfx_set_sharpness(int sharpness); + int gfx_get_flicker_filter(int *p_flicker); + int gfx_set_flicker_filter(int flicker); + int gfx_get_overscan(int *p_x, int *p_y); + int gfx_set_overscan(int x, int y); + int gfx_get_position(int *p_x, int *p_y); + int gfx_set_position(int x, int y); + int gfx_get_color(int *p_color); + int gfx_set_color(int color); + int gfx_get_brightness(int *p_brightness); + int gfx_set_brightness(int brightness); + int gfx_get_contrast(int *p_contrast); + int gfx_set_contrast(int constrast); + int gfx_get_yc_filter(unsigned int *p_yc_filter); + int gfx_set_yc_filter(unsigned int yc_filter); + int gfx_get_aps_trigger_bits(unsigned int *p_trigger_bits); + int gfx_set_aps_trigger_bits(unsigned int trigger_bits); + +/* ROUTINES IN GFX_VGA.C */ + + int gfx_get_softvga_active(void); + int gfx_vga_test_pci(void); + unsigned char gfx_vga_get_pci_command(void); + int gfx_vga_set_pci_command(unsigned char command); + int gfx_vga_seq_reset(int reset); + int gfx_vga_set_graphics_bits(void); + int gfx_vga_mode(gfx_vga_struct * vga, int xres, int yres, int bpp, + int hz); + int gfx_vga_pitch(gfx_vga_struct * vga, unsigned short pitch); + int gfx_vga_save(gfx_vga_struct * vga, int flags); + int gfx_vga_restore(gfx_vga_struct * vga, int flags); + int gfx_vga_mode_switch(int active); + void gfx_vga_clear_extended(void); + +/* CLOSE BRACKET FOR C++ COMPLILATION */ + +#ifdef __cplusplus +} +#endif + +#endif /* !_gfx_rtns_h */ + +/* END OF FILE */ diff --git a/driver/xf86-video-geode/src/gfx/gfx_tv.c b/driver/xf86-video-geode/src/gfx/gfx_tv.c new file mode 100644 index 000000000..fb34d6036 --- /dev/null +++ b/driver/xf86-video-geode/src/gfx/gfx_tv.c @@ -0,0 +1,836 @@ +/* Copyright (c) 2005 Advanced Micro Devices, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + * + * Neither the name of the Advanced Micro Devices, Inc. nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * */ + +/* + * This file contains routines to program TVOUT and TV encoder. + * + * Routines: + * + * gfx_set_tv_format + * gfx_set_tv_output + * gfx_set_tv_enable + * gfx_set_tv_flicker_filter + * gfx_set_tv_sub_carrier_reset + * gfx_set_tv_vphase + * gfx_set_tv_YC_delay + * gfx_set_tvenc_reset_interval + * gfx_set_tv_cc_enable + * gfx_set_tv_cc_data + * gfx_test_tvout_odd_field + * gfx_test_tvenc_odd_field + * gfx_set_tv_field_status_invert + * gfx_get_tv_vphase + * */ + +/* TV TIMINGS */ + +DISPLAYMODE TVTimings[] = { + +/* NTSC resolution */ + + {0x3 | /* negative syncs */ + GFX_MODE_TV_NTSC, /* NTSC format */ + 640, 640, 656, 744, 792, 792, /* horizontal timings */ + 480, 480, 490, 492, 517, 525, /* vertical timings */ + 0x0018EC4D, /* freq = 24.923052 MHz */ + } + , + +/* PAL resolution */ + + {0x3 | /* negative syncs */ + GFX_MODE_TV_PAL, /* PAL format */ + 768, 768, 800, 848, 864, 864, /* horizontal timings */ + 576, 576, 586, 588, 625, 625, /* vertical timings */ + 0x001B0000, /* freq = 27.00 MHz */ + } + , + +/* NTSC resolution non-square pixels */ + + {0x3 | /* negative syncs */ + GFX_MODE_TV_NTSC, /* NTSC format */ + 720, 720, 736, 752, 792, 792, /* horizontal timings */ + 480, 480, 490, 492, 517, 525, /* vertical timings */ + 0x0018EC4D, /* freq = 24.923052 MHz */ + } + , + +/* PAL resolution non-square pixels */ + + {0x3 | /* negative syncs */ + GFX_MODE_TV_PAL, /* PAL format */ + 720, 720, 752, 816, 864, 864, /* horizontal timings */ + 576, 576, 586, 588, 625, 625, /* vertical timings */ + 0x001B0000, /* freq = 27.00 MHz */ + } +}; + +#define NUM_TV_MODES sizeof(TVTimings)/sizeof(DISPLAYMODE) + +/* INCLUDE SUPPORT FOR SC1200 TV ENCODER, IF SPECIFIED */ + +#if GFX_TV_SC1200 +#include "tv_1200.c" +#endif + +/* INCLUDE SUPPORT FOR FS450 TV ENCODER, IF SPECIFIED */ + +#if GFX_TV_FS451 +#include "tv_fs450.c" +#endif + +/* WRAPPERS IF DYNAMIC SELECTION */ +/* Extra layer to call either SC1200 or FS450 TV encoder routines. */ + +#if GFX_TV_DYNAMIC + +/*---------------------------------------------------------------------------- + * gfx_set_tv_format + *---------------------------------------------------------------------------- + */ +int +gfx_set_tv_format(TVStandardType format, GfxOnTVType resolution) +{ + int retval = GFX_STATUS_UNSUPPORTED; + +#if GFX_TV_SC1200 + if (gfx_tv_type & GFX_TV_TYPE_SC1200) + retval = sc1200_set_tv_format(format, resolution); +#endif +#if GFX_TV_FS451 + if (gfx_tv_type & GFX_TV_TYPE_FS451) + retval = fs450_set_tv_format(format, resolution); +#endif + return (retval); +} + +/*---------------------------------------------------------------------------- + * gfx_set_tv_output + *---------------------------------------------------------------------------- + */ +int +gfx_set_tv_output(int output) +{ + int retval = GFX_STATUS_UNSUPPORTED; + +#if GFX_TV_SC1200 + if (gfx_tv_type & GFX_TV_TYPE_SC1200) + retval = sc1200_set_tv_output(output); +#endif +#if GFX_TV_FS451 + if (gfx_tv_type & GFX_TV_TYPE_FS451) + retval = fs450_set_tv_output(output); +#endif + return (retval); +} + +/*---------------------------------------------------------------------------- + * gfx_set_tv_enable + *---------------------------------------------------------------------------- + */ +int +gfx_set_tv_enable(int enable) +{ + int retval = GFX_STATUS_UNSUPPORTED; + +#if GFX_TV_SC1200 + if (gfx_tv_type & GFX_TV_TYPE_SC1200) + retval = sc1200_set_tv_enable(enable); +#endif +#if GFX_TV_FS451 + if (gfx_tv_type & GFX_TV_TYPE_FS451) + retval = fs450_set_tv_enable(enable); +#endif + return (retval); +} + +/*---------------------------------------------------------------------------- + * gfx_set_tv_flicker_filter + *---------------------------------------------------------------------------- + */ +int +gfx_set_tv_flicker_filter(int ff) +{ + int retval = GFX_STATUS_UNSUPPORTED; + +#if GFX_TV_SC1200 + if (gfx_tv_type & GFX_TV_TYPE_SC1200) + retval = sc1200_set_tv_flicker_filter(ff); +#endif + return (retval); +} + +/*---------------------------------------------------------------------------- + * gfx_set_tv_sub_carrier_reset + *---------------------------------------------------------------------------- + */ +int +gfx_set_tv_sub_carrier_reset(int screset) +{ + int retval = GFX_STATUS_UNSUPPORTED; + +#if GFX_TV_SC1200 + if (gfx_tv_type & GFX_TV_TYPE_SC1200) + retval = sc1200_set_tv_sub_carrier_reset(screset); +#endif + return (retval); +} + +/*---------------------------------------------------------------------------- + * gfx_set_tv_vphase + *---------------------------------------------------------------------------- + */ +int +gfx_set_tv_vphase(int vphase) +{ + int retval = GFX_STATUS_UNSUPPORTED; + +#if GFX_TV_SC1200 + if (gfx_tv_type & GFX_TV_TYPE_SC1200) + retval = sc1200_set_tv_vphase(vphase); +#endif + return (retval); +} + +/*---------------------------------------------------------------------------- + * gfx_set_tv_YC_delay + *---------------------------------------------------------------------------- + */ +int +gfx_set_tv_YC_delay(int delay) +{ + int retval = GFX_STATUS_UNSUPPORTED; + +#if GFX_TV_SC1200 + if (gfx_tv_type & GFX_TV_TYPE_SC1200) + retval = sc1200_set_tv_YC_delay(delay); +#endif + return (retval); +} + +/*---------------------------------------------------------------------------- + * gfx_set_tvenc_reset_interval + *---------------------------------------------------------------------------- + */ +int +gfx_set_tvenc_reset_interval(int interval) +{ + int retval = GFX_STATUS_UNSUPPORTED; + +#if GFX_TV_SC1200 + if (gfx_tv_type & GFX_TV_TYPE_SC1200) + retval = sc1200_set_tvenc_reset_interval(interval); +#endif + return (retval); +} + +/*---------------------------------------------------------------------------- + * gfx_set_tv_cc_enable + *---------------------------------------------------------------------------- + */ +int +gfx_set_tv_cc_enable(int enable) +{ + int retval = GFX_STATUS_UNSUPPORTED; + +#if GFX_TV_SC1200 + if (gfx_tv_type & GFX_TV_TYPE_SC1200) + retval = sc1200_set_tv_cc_enable(enable); +#endif + return (retval); +} + +/*---------------------------------------------------------------------------- + * gfx_set_tv_cc_data + * + * This routine writes the two specified characters to the CC data register + * of the TV encoder. + *---------------------------------------------------------------------------- + */ +int +gfx_set_tv_cc_data(unsigned char data1, unsigned char data2) +{ + int retval = GFX_STATUS_UNSUPPORTED; + +#if GFX_TV_SC1200 + if (gfx_tv_type & GFX_TV_TYPE_SC1200) + retval = sc1200_set_tv_cc_data(data1, data2); +#endif + return (retval); +} + +/*--------------------------------------------------------------------------- + * gfx_set_tv_display + * + * Set the timings in the display controller to support a TV resolution. + *--------------------------------------------------------------------------- + */ +int +gfx_set_tv_display(int width, int height) +{ + int status = GFX_STATUS_UNSUPPORTED; + +#if GFX_TV_SC1200 + if (gfx_tv_type & GFX_TV_TYPE_SC1200) + status = sc1200_set_tv_display(width, height); +#endif + return (status); +} + +/*--------------------------------------------------------------------------- + * gfx_test_tvout_odd_field + *--------------------------------------------------------------------------- + */ +int +gfx_test_tvout_odd_field(void) +{ + int status = GFX_STATUS_UNSUPPORTED; + +#if GFX_TV_SC1200 + if (gfx_tv_type & GFX_TV_TYPE_SC1200) + status = sc1200_test_tvout_odd_field(); +#endif + return (status); +} + +/*--------------------------------------------------------------------------- + * gfx_test_tvenc_odd_field + *--------------------------------------------------------------------------- + */ +int +gfx_test_tvenc_odd_field(void) +{ + int status = GFX_STATUS_UNSUPPORTED; + +#if GFX_TV_SC1200 + if (gfx_tv_type & GFX_TV_TYPE_SC1200) + status = sc1200_test_tvenc_odd_field(); +#endif + return (status); +} + +/*---------------------------------------------------------------------------- + * gfx_set_tv_field_status_invert + *---------------------------------------------------------------------------- + */ +int +gfx_set_tv_field_status_invert(int enable) +{ + int retval = GFX_STATUS_UNSUPPORTED; + +#if GFX_TV_SC1200 + if (gfx_tv_type & GFX_TV_TYPE_SC1200) + retval = sc1200_set_tv_field_status_invert(enable); +#endif + return (retval); +} + +/*--------------------------------------------------------------------------- + * gfx_get_tv_vphase + *--------------------------------------------------------------------------- + */ +int +gfx_get_tv_vphase(void) +{ + int status = GFX_STATUS_UNSUPPORTED; + +#if GFX_TV_SC1200 + if (gfx_tv_type & GFX_TV_TYPE_SC1200) + status = sc1200_get_tv_vphase(); +#endif + return (status); +} + +/*--------------------------------------------------------------------------- + * gfx_get_tv_enable + *--------------------------------------------------------------------------- + */ +int +gfx_get_tv_enable(unsigned int *p_on) +{ + int retval = -1; + +#if GFX_TV_FS451 + if (gfx_tv_type & GFX_TV_TYPE_FS451) + retval = fs450_get_tv_enable(p_on); +#endif +#if GFX_TV_SC1200 + if (gfx_tv_type & GFX_TV_TYPE_SC1200) + retval = sc1200_get_tv_enable(p_on); +#endif + return (retval); +} + +/*--------------------------------------------------------------------------- + * gfx_get_tv_output + *--------------------------------------------------------------------------- + */ +int +gfx_get_tv_output() +{ + int retval = -1; + +#if GFX_TV_SC1200 + if (gfx_tv_type & GFX_TV_TYPE_SC1200) + retval = sc1200_get_tv_output(); +#endif + return (retval); +} + +/*--------------------------------------------------------------------------- + * gfx_get_tv_mode_count + *--------------------------------------------------------------------------- + */ +int +gfx_get_tv_mode_count(TVStandardType format) +{ + int retval = -1; + +#if GFX_TV_SC1200 + if (gfx_tv_type & GFX_TV_TYPE_SC1200) + retval = sc1200_get_tv_mode_count(format); +#endif + return (retval); +} + +/*--------------------------------------------------------------------------- + * gfx_get_tv_display_mode + *--------------------------------------------------------------------------- + */ +int +gfx_get_tv_display_mode(int *width, int *height, int *bpp, int *hz) +{ + int retval = -1; + +#if GFX_TV_SC1200 + if (gfx_tv_type & GFX_TV_TYPE_SC1200) + retval = sc1200_get_tv_display_mode(width, height, bpp, hz); +#endif + return (retval); +} + +/*--------------------------------------------------------------------------- + * gfx_get_tv_display_mode_frequency + *--------------------------------------------------------------------------- + */ +int +gfx_get_tv_display_mode_frequency(unsigned short width, unsigned short height, + TVStandardType format, int *frequency) +{ + int retval = -1; + +#if GFX_TV_SC1200 + if (gfx_tv_type & GFX_TV_TYPE_SC1200) + retval = + sc1200_get_tv_display_mode_frequency(width, height, format, + frequency); +#endif + return (retval); +} + +/*--------------------------------------------------------------------------- + * gfx_is_tv_display_mode_supported + *--------------------------------------------------------------------------- + */ +int +gfx_is_tv_display_mode_supported(unsigned short width, unsigned short height, + TVStandardType format) +{ + int retval = -1; + +#if GFX_TV_SC1200 + if (gfx_tv_type & GFX_TV_TYPE_SC1200) + retval = sc1200_is_tv_display_mode_supported(width, height, format); +#endif + return (retval); +} + +/*------------------------------------------ + * The following functions were added to support + * the FS450 and will eventually be removed. There + * is no equivalent support in the SC1200. + *----------------------------------------------*/ + +/*========================================================================== + * TV standard + *========================================================================== + */ +int +gfx_get_tv_standard(unsigned long *p_standard) +{ + int retval = -1; + +#if GFX_TV_FS451 + if (gfx_tv_type & GFX_TV_TYPE_FS451) + retval = fs450_get_tv_standard(p_standard); +#endif + return (retval); +} + +int +gfx_get_available_tv_standards(unsigned long *p_standards) +{ + int retval = -1; + +#if GFX_TV_FS451 + if (gfx_tv_type & GFX_TV_TYPE_FS451) + retval = fs450_get_available_tv_standards(p_standards); +#endif + return (retval); +} + +int +gfx_set_tv_standard(unsigned long standard) +{ + int retval = -1; + +#if GFX_TV_FS451 + if (gfx_tv_type & GFX_TV_TYPE_FS451) + retval = fs450_set_tv_standard(standard); +#endif + return (retval); +} + +/* + *========================================================================== + * vga mode as known by the driver + *========================================================================== + */ +int +gfx_get_tv_vga_mode(unsigned long *p_vga_mode) +{ + int retval = -1; + +#if GFX_TV_FS451 + if (gfx_tv_type & GFX_TV_TYPE_FS451) + retval = fs450_get_tv_vga_mode(p_vga_mode); +#endif + return (retval); +} + +int +gfx_get_available_tv_vga_modes(unsigned long *p_vga_modes) +{ + int retval = -1; + +#if GFX_TV_FS451 + if (gfx_tv_type & GFX_TV_TYPE_FS451) + retval = fs450_get_available_tv_vga_modes(p_vga_modes); +#endif + return (retval); +} + +int +gfx_set_tv_vga_mode(unsigned long vga_mode) +{ + int re tval = -1; + +#if GFX_TV_FS451 + if (gfx_tv_type & GFX_TV_TYPE_FS451) + retval = fs450_set_tv_vga_mode(vga_mode); +#endif + return (retval); +} + +/* + *========================================================================== + * + * tvout mode + */ + +int +gfx_get_tvout_mode(unsigned long *p_tvout_mode) +{ + int retval = -1; + +#if GFX_TV_FS451 + if (gfx_tv_type & GFX_TV_TYPE_FS451) + retval = fs450_get_tvout_mode(p_tvout_mode); +#endif + return (retval); +} + +int +gfx_set_tvout_mode(unsigned long tvout_mode) +{ + int retval = -1; + +#if GFX_TV_FS451 + if (gfx_tv_type & GFX_TV_TYPE_FS451) + retval = fs450_set_tvout_mode(tvout_mode); +#endif + return (retval); +} + +/* + *========================================================================== + * + * Sharpness + */ +int +gfx_get_sharpness(int *p_sharpness) +{ + int retval = -1; + +#if GFX_TV_FS451 + if (gfx_tv_type & GFX_TV_TYPE_FS451) + retval = fs450_get_sharpness(p_sharpness); +#endif + return (retval); +} + +int +gfx_set_sharpness(int sharpness) +{ + int retval = -1; + +#if GFX_TV_FS451 + if (gfx_tv_type & GFX_TV_TYPE_FS451) + retval = fs450_set_sharpness(sharpness); +#endif + return (retval); +} + +/* + *========================================================================== + * + * flicker filter control. + */ + +int +gfx_get_flicker_filter(int *p_flicker) +{ + int retval = -1; + +#if GFX_TV_FS451 + if (gfx_tv_type & GFX_TV_TYPE_FS451) + retval = fs450_get_flicker_filter(p_flicker); +#endif + return (retval); +} + +int +gfx_set_flicker_filter(int flicker) +{ + int retval = -1; + +#if GFX_TV_FS451 + if (gfx_tv_type & GFX_TV_TYPE_FS451) + retval = fs450_set_flicker_filter(flicker); +#endif + return (retval); +} + +/* + *========================================================================== + * + * Overscan and Position + */ + +int +gfx_get_overscan(int *p_x, int *p_y) +{ + int retval = -1; + +#if GFX_TV_FS451 + if (gfx_tv_type & GFX_TV_TYPE_FS451) + retval = fs450_get_overscan(p_x, p_y); +#endif + return (retval); + +} + +int +gfx_set_overscan(int x, int y) +{ + int retval = -1; + +#if GFX_TV_FS451 + if (gfx_tv_type & GFX_TV_TYPE_FS451) + retval = fs450_set_overscan(x, y); +#endif + return (retval); +} + +int +gfx_get_position(int *p_x, int *p_y) +{ + int retval = -1; + +#if GFX_TV_FS451 + if (gfx_tv_type & GFX_TV_TYPE_FS451) + retval = fs450_get_position(p_x, p_y); +#endif + return (retval); +} + +int +gfx_set_position(int x, int y) +{ + int retval = -1; + +#if GFX_TV_FS451 + if (gfx_tv_type & GFX_TV_TYPE_FS451) + retval = fs450_set_position(x, y); +#endif + return (retval); +} + +/* + *========================================================================== + * + * Color, Brightness, and Contrast + */ + +int +gfx_get_color(int *p_color) +{ + int retval = -1; + +#if GFX_TV_FS451 + if (gfx_tv_type & GFX_TV_TYPE_FS451) + retval = fs450_get_color(p_color); +#endif + return (retval); +} + +int +gfx_set_color(int color) +{ + int retval = -1; + +#if GFX_TV_FS451 + if (gfx_tv_type & GFX_TV_TYPE_FS451) + retval = fs450_set_color(color); +#endif + return (retval); +} + +int +gfx_get_brightness(int *p_brightness) +{ + int retval = -1; + +#if GFX_TV_FS451 + if (gfx_tv_type & GFX_TV_TYPE_FS451) + retval = fs450_get_brightness(p_brightness); +#endif + return (retval); +} + +int +gfx_set_brightness(int brightness) +{ + int retval = -1; + +#if GFX_TV_FS451 + if (gfx_tv_type & GFX_TV_TYPE_FS451) + retval = fs450_set_brightness(brightness); +#endif + return (retval); +} + +int +gfx_get_contrast(int *p_contrast) +{ + int retval = -1; + +#if GFX_TV_FS451 + if (gfx_tv_type & GFX_TV_TYPE_FS451) + retval = fs450_get_contrast(p_contrast); +#endif + return (retval); +} + +int +gfx_set_contrast(int contrast) +{ + int retval = -1; + +#if GFX_TV_FS451 + if (gfx_tv_type & GFX_TV_TYPE_FS451) + retval = fs450_set_contrast(contrast); +#endif + return (retval); +} + +/* + *========================================================================== + * + * YC filters + */ + +int +gfx_get_yc_filter(unsigned int *p_yc_filter) +{ + int retval = -1; + +#if GFX_TV_FS451 + if (gfx_tv_type & GFX_TV_TYPE_FS451) + retval = fs450_get_yc_filter(p_yc_filter); +#endif + return (retval); +} + +int +gfx_set_yc_filter(unsigned int yc_filter) +{ + int retval = -1; + +#if GFX_TV_FS451 + if (gfx_tv_type & GFX_TV_TYPE_FS451) + retval = fs450_set_yc_filter(yc_filter); +#endif + return (retval); +} + +int +gfx_get_aps_trigger_bits(unsigned int *p_trigger_bits) +{ + int retval = -1; + +#if GFX_TV_FS451 + if (gfx_tv_type & GFX_TV_TYPE_FS451) + retval = fs450_get_aps_trigger_bits(p_trigger_bits); +#endif + return (retval); +} + +int +gfx_set_aps_trigger_bits(unsigned int trigger_bits) +{ + int retval = -1; + +#if GFX_TV_FS451 + if (gfx_tv_type & GFX_TV_TYPE_FS451) + retval = fs450_set_aps_trigger_bits(trigger_bits); +#endif + return (retval); +} + +#endif /* GFX_TV_DYNAMIC */ + +/* END OF FILE */ diff --git a/driver/xf86-video-geode/src/gfx/gfx_type.h b/driver/xf86-video-geode/src/gfx/gfx_type.h new file mode 100644 index 000000000..33b6cab0d --- /dev/null +++ b/driver/xf86-video-geode/src/gfx/gfx_type.h @@ -0,0 +1,329 @@ +/* Copyright (c) 2005 Advanced Micro Devices, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + * + * Neither the name of the Advanced Micro Devices, Inc. nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * */ + +/* + * This header file defines the pneumonics used when calling Durango routines. + * This file is automatically included by gfx_rtns.h + * */ + +#ifndef _gfx_type_h +#define _gfx_type_h + +/* MSR DEFINITIONS */ + +typedef enum DevStatus +{ FOUND, NOT_KNOWN, REQ_NOT_FOUND, REQ_NOT_INSTALLED } DEV_STATUS; + +typedef struct msr +{ + DEV_STATUS Present; /* Node enumeration status */ + unsigned char Id; /* Device ID (from MSR specs) */ + unsigned long Address; /* Address - 32-bit MBus address at */ + /* which 'Id' is found */ +} MSR; + +typedef struct mValue +{ + unsigned long high; + unsigned long low; +} Q_WORD; + +typedef struct mbusNode +{ + unsigned long address; + unsigned int deviceId; + unsigned int claimed; +} MBUS_NODE; + +/* MSR ARRAY INDEXES */ +/* These are indexes into the array of MBus devices. These */ +/* should not be confused with the class codes at MSR register */ +/* 0x2000. */ + +#define RC_ID_MBIU0 0x00 +#define RC_ID_MBIU1 0x01 +#define RC_ID_MCP 0x02 +#define RC_ID_MPCI 0x03 +#define RC_ID_MC 0x04 +#define RC_ID_GP 0x05 +#define RC_ID_VG 0x06 +#define RC_ID_DF 0x07 +#define RC_ID_FG 0x08 +#define RC_ID_VA 0x09 +#define CP_ID_MBIU 0x0A +#define CP_ID_MPCI 0x0B +#define CP_ID_USB2 0x0C +#define CP_ID_ATAC 0x0D +#define CP_ID_MDD 0x0E +#define CP_ID_ACC 0x0F +#define CP_ID_USB1 0x10 +#define CP_ID_MCP 0x11 + +/* MBUS DEVICE CLASS CODES */ +/* These are the device ids for the known Redcloud MBus devices. */ + +#define RC_CC_MBIU 0x01 +#define RC_CC_MCP 0x02 +#define RC_CC_MPCI 0x05 +#define RC_CC_MC 0x20 +#define RC_CC_GP 0x3D +#define RC_CC_VG 0x3E +#define RC_CC_DF 0x3F +#define RC_CC_FG 0xF0 +#define RC_CC_VA 0x86 +#define CP_CC_MBIU 0x01 +#define CP_CC_MPCI 0x05 +#define CP_CC_USB2 0x42 +#define CP_CC_ATAC 0x47 +#define CP_CC_MDD 0xDF +#define CP_CC_ACC 0x33 +#define CP_CC_USB1 0x42 +#define CP_CC_MCP 0x02 + +/* VAIL AND MBIUS ARE AT KNOWN ADDRESSES */ +/* We can initialize the addresses of these devices in advance, */ +/* as their location should never change. */ + +#define RC_MB0_MBIU0 0x10000000 +#define RC_MB0_MBIU1 0x40000000 +#define CP_MB0_MBIU0 0x51010000 +#define RC_MB0_CPU 0x00000000 +#define FAKE_ADDRESS 0xFFFFFFFF + +/* MSR PORT DESCRIPTORS */ + +#define NOT_POPULATED 0 +#define NOT_INSTALLED 0xFFFE +#define REFLECTIVE 0xFFFF + +/* CRC DATA SOURCES */ + +#define CRC_SOURCE_GFX_DATA 0x00 +#define CRC_SOURCE_CRT_RGB 0x01 +#define CRC_SOURCE_FP_DATA 0x02 + +/* TV DEFINITIONS */ + +typedef enum TVStandardType +{ + TV_STANDARD_NTSC = 1, + TV_STANDARD_PAL +} TVStandardType; + +typedef enum GfxOnTVType +{ + GFX_ON_TV_SQUARE_PIXELS = 1, + GFX_ON_TV_NO_SCALING +} GfxOnTVType; + +#define CRT_DISABLE 0x00 +#define CRT_ENABLE 0x01 +#define CRT_STANDBY 0x02 +#define CRT_SUSPEND 0x03 + +#define TV_OUTPUT_COMPOSITE 0x01 +#define TV_OUTPUT_S_VIDEO 0x02 +#define TV_OUTPUT_YUV 0x03 +#define TV_OUTPUT_SCART 0x04 + +#define TV_FLICKER_FILTER_NONE 0x01 +#define TV_FLICKER_FILTER_NORMAL 0x02 +#define TV_FLICKER_FILTER_INTERLACED 0x03 + +#define TV_YC_DELAY_NONE 0x01 +#define TV_Y_DELAY_ONE_PIXEL 0x02 +#define TV_C_DELAY_ONE_PIXEL 0x03 +#define TV_C_DELAY_TWO_PIXELS 0x04 + +#define TV_SUB_CARRIER_RESET_NEVER 0x01 +#define TV_SUB_CARRIER_RESET_EVERY_TWO_LINES 0x02 +#define TV_SUB_CARRIER_RESET_EVERY_TWO_FRAMES 0x03 +#define TV_SUB_CARRIER_RESET_EVERY_FOUR_FRAMES 0x04 + +#define TVENC_RESET_EVERY_ODD_FIELD 0x01 +#define TVENC_RESET_EVERY_EVEN_FIELD 0x02 +#define TVENC_RESET_NEXT_ODD_FIELD 0x03 +#define TVENC_RESET_NEXT_EVEN_FIELD 0x04 +#define TVENC_RESET_EVERY_FIELD 0x05 +#define TVENC_RESET_EVERY_X_ODD_FIELDS 0x06 +#define TVENC_RESET_EVERY_X_EVEN_FIELDS 0x07 + +/* VBI FORMATS */ + +#define VBI_FORMAT_VIDEO 0x1 +#define VBI_FORMAT_RAW 0x2 +#define VBI_FORMAT_CC 0x4 +#define VBI_FORMAT_NABTS 0x8 + +/* VIDEO DEFINITIONS */ + +#define VIDEO_FORMAT_UYVY 0x0 +#define VIDEO_FORMAT_Y2YU 0x1 +#define VIDEO_FORMAT_YUYV 0x2 +#define VIDEO_FORMAT_YVYU 0x3 +#define VIDEO_FORMAT_Y0Y1Y2Y3 0x4 +#define VIDEO_FORMAT_Y3Y2Y1Y0 0x5 +#define VIDEO_FORMAT_Y1Y0Y3Y2 0x6 +#define VIDEO_FORMAT_Y1Y2Y3Y0 0x7 +#define VIDEO_FORMAT_RGB 0x8 +#define VIDEO_FORMAT_P2M_P2L_P1M_P1L 0x9 +#define VIDEO_FORMAT_P1M_P1L_P2M_P2L 0xA +#define VIDEO_FORMAT_P1M_P2L_P2M_P1L 0xB + +#define VIDEO_DOWNSCALE_KEEP_1_OF 0x1 +#define VIDEO_DOWNSCALE_DROP_1_OF 0x2 + +typedef enum VideoSourceType +{ /* The source from which the video processor shows full screen video */ + VIDEO_SOURCE_MEMORY = 1, + VIDEO_SOURCE_DVIP +} VideoSourceType; + +typedef enum VbiSourceType +{ /* The source from which the video processor takes VBI */ + VBI_SOURCE_MEMORY = 1, + VBI_SOURCE_DVIP +} VbiSourceType; + +/* GENLOCK DEFINITIONS */ + +#define GENLOCK_SINGLE 0x001 +#define GENLOCK_FIELD_SYNC 0x001 +#define GENLOCK_CONTINUOUS 0x002 +#define GENLOCK_SYNCED_EDGE_FALLING 0x004 +#define GENLOCK_SYNCING_EDGE_FALLING 0x008 +#define GENLOCK_TIMEOUT 0x010 +#define GENLOCK_TVENC_RESET_EVEN_FIELD 0x020 +#define GENLOCK_TVENC_RESET_BEFORE_DELAY 0x040 +#define GENLOCK_TVENC_RESET 0x080 +#define GENLOCK_SYNC_TO_TVENC 0x100 + +/* VIP DEFINITIONS */ + +#define VIP_MODE_C 0x1 + +#define VIP_CAPTURE_STOP_LINE 0x1 +#define VIP_CAPTURE_STOP_FIELD 0x2 +#define VIP_CAPTURE_START_FIELD 0x4 + +#define VBI_ANCILLARY 0x1 +#define VBI_TASK_A 0x2 +#define VBI_TASK_B 0x4 + +/* VGA STRUCTURE */ + +#define GFX_STD_CRTC_REGS 25 +#define GFX_EXT_CRTC_REGS 16 + +#define GFX_VGA_FLAG_MISC_OUTPUT 0x00000001 +#define GFX_VGA_FLAG_STD_CRTC 0x00000002 +#define GFX_VGA_FLAG_EXT_CRTC 0x00000004 + +/* FS450 TV Standard flags */ + +#define GFX_TV_STANDARD_NTSC_M 0x0001 +#define GFX_TV_STANDARD_NTSC_M_J 0x0002 +#define GFX_TV_STANDARD_PAL_B 0x0004 +#define GFX_TV_STANDARD_PAL_D 0x0008 +#define GFX_TV_STANDARD_PAL_H 0x0010 +#define GFX_TV_STANDARD_PAL_I 0x0020 +#define GFX_TV_STANDARD_PAL_M 0x0040 +#define GFX_TV_STANDARD_PAL_N 0x0080 +#define GFX_TV_STANDARD_PAL_G 0x0100 + +/* FS450 VGA Mode flags */ + +#define GFX_VGA_MODE_UNKNOWN 0 +#define GFX_VGA_MODE_640X480 0x0001 +#define GFX_VGA_MODE_720X487 0x0002 +#define GFX_VGA_MODE_720X576 0x0004 +#define GFX_VGA_MODE_800X600 0x0008 +#define GFX_VGA_MODE_1024X768 0x0010 + +/* FS450 TVout mode flags */ + +#define GFX_TVOUT_MODE_CVBS 0x0001 +#define GFX_TVOUT_MODE_YC 0x0002 +#define GFX_TVOUT_MODE_RGB 0x0004 +#define GFX_TVOUT_MODE_CVBS_YC (GFX_TVOUT_MODE_CVBS | GFX_TVOUT_MODE_YC) + +/* FS450 Luma and Chroma Filters */ + +#define GFX_LUMA_FILTER 0x0001 +#define GFX_CHROMA_FILTER 0x0002 + +/* APS Trigger Bits */ + +#define GFX_APS_TRIGGER_OFF 0 +#define GFX_APS_TRIGGER_AGC_ONLY 1 +#define GFX_APS_TRIGGER_AGC_2_LINE 2 +#define GFX_APS_TRIGGER_AGC_4_LINE 3 + +typedef struct +{ + int xsize; + int ysize; + int hz; + int clock; + unsigned char miscOutput; + unsigned char stdCRTCregs[GFX_STD_CRTC_REGS]; + unsigned char extCRTCregs[GFX_EXT_CRTC_REGS]; +} gfx_vga_struct; + +/* POSSIBLE STATUS VALUES */ + +#define GFX_STATUS_UNSUPPORTED (-3) +#define GFX_STATUS_BAD_PARAMETER (-2) +#define GFX_STATUS_ERROR (-1) +#define GFX_STATUS_OK 0 + +/* CPU AND VIDEO TYPES */ + +#define GFX_CPU_GXLV 1 +#define GFX_CPU_SC1200 2 +#define GFX_CPU_REDCLOUD 3 +#define GFX_CPU_PYRAMID 0x20801 + +#define GFX_VID_CS5530 1 +#define GFX_VID_SC1200 2 +#define GFX_VID_REDCLOUD 3 + +/* CHIP NAME AND REVISION */ + +typedef enum ChipType +{ + CHIP_NOT_DETECTED, + SC1200_REV_A, + SC1200_REV_B1_B2, + SC1200_REV_B3, + SC1200_REV_C1, + SC1200_REV_D1, + SC1200_REV_D1_1, + SC1200_REV_D2_MVD, /* Macrovision disabled */ + SC1200_REV_D2_MVE, /* Macrovision enabled */ + SC1200_FUTURE_REV +} ChipType; + +#endif /* !_gfx_type_h */ diff --git a/driver/xf86-video-geode/src/gfx/gfx_vga.c b/driver/xf86-video-geode/src/gfx/gfx_vga.c new file mode 100644 index 000000000..8ab9b6a22 --- /dev/null +++ b/driver/xf86-video-geode/src/gfx/gfx_vga.c @@ -0,0 +1,45 @@ +/* Copyright (c) 2005 Advanced Micro Devices, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + * + * Neither the name of the Advanced Micro Devices, Inc. nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * */ + +/* + * This file contains routines to interface to the VGA registers. Some + * operating systems require mode sets be done through VGA, rather than + * directly using the "gfx_set_display_mode" routine. + * */ + +/* INCLUDE SUPPORT FOR FIRST GENERATION, IF SPECIFIED. */ + +#if GFX_VGA_GU1 +#include "vga_gu1.c" +#endif + +/* WRAPPERS IF DYNAMIC SELECTION */ +/* Extra layer to call either first or second generation routines. */ + +#if GFX_VGA_DYNAMIC + +#endif /* GFX_DISPLAY_DYNAMIC */ + +/* END OF FILE */ diff --git a/driver/xf86-video-geode/src/gfx/gfx_vid.c b/driver/xf86-video-geode/src/gfx/gfx_vid.c new file mode 100644 index 000000000..41fef74ac --- /dev/null +++ b/driver/xf86-video-geode/src/gfx/gfx_vid.c @@ -0,0 +1,2103 @@ +/* + * Copyright (C) 2005 Advanced Micro Devices, Inc. All Rights Reserved. + * */ +/* + * */ +/* Copyright (c) 2005 Advanced Micro Devices, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + * + * Neither the name of the Advanced Micro Devices, Inc. nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * */ + +/* + * This file contains routines to control the video overlay window. + * + * Video overlay routines: + * + * gfx_set_clock_frequency + * gfx_set_crt_enable + * gfx_set_video_enable + * gfx_set_video_format + * gfx_set_video_size + * gfx_set_video_offset + * gfx_set_video_yuv_offsets + * gfx_set_video_yuv_pitch + * gfx_set_video_scale + * gfx_set_video_upscale + * gfx_set_video_downscale_config + * gfx_set_video_downscale_coefficients + * gfx_set_video_downscale_enable + * gfx_set_video_vertical_downscale + * gfx_set_video_vertical_downscale_enable + * gfx_set_video_window + * gfx_set_video_left_crop + * gfx_set_video_color_key + * gfx_set_video_filter + * gfx_set_video_palette + * gfx_set_video_request + * gfx_set_video_source + * gfx_set_vbi_source + * gfx_set_vbi_lines + * gfx_set_vbi_total + * gfx_set_video_interlaced + * gfx_set_color_space_YUV + * gfx_set_vertical_scaler_offset + * gfx_set_top_line_in_odd + * gfx_set_genlock_delay + * gfx_set_genlock_enable + * gfx_set_video_cursor + * gfx_set_video_cursor_enable + * + * Alpha blending routines (SC1200 ONLY): + * + * gfx_select_alpha_region + * gfx_set_alpha_enable + * gfx_set_alpha_window + * gfx_set_alpha_value + * gfx_set_alpha_priority + * gfx_set_alpha_color + * gfx_set_alpha_color_enable + * gfx_set_no_ck_outside_alpha + * gfx_test_tvout_odd_field + * + * And the following routines if GFX_READ_ROUTINES is set: + * + * gfx_get_sync_polarities + * gfx_get_video_enable + * gfx_get_video_format + * gfx_get_video_src_size + * gfx_get_video_line_size + * gfx_get_video_xclip + * gfx_get_video_offset + * gfx_get_video_yuv_offsets + * gfx_get_video_yuv_pitch + * gfx_get_video_scale + * gfx_get_video_upscale + * gfx_get_video_downscale_config + * gfx_get_video_downscale_coefficients + * gfx_get_video_downscale_enable + * gfx_get_video_downscale_delta + * gfx_get_video_vertical_downscale_enable + * gfx_get_video_dst_size + * gfx_get_video_position + * gfx_get_video_color_key + * gfx_get_video_color_key_mask + * gfx_get_video_color_key_src + * gfx_get_video_filter + * gfx_get_video_request + * gfx_get_video_source + * gfx_get_vbi_source + * gfx_get_vbi_lines + * gfx_get_vbi_total + * gfx_get_video_interlaced + * gfx_get_color_space_YUV + * gfx_get_vertical_scaler_offset + * gfx_get_genlock_delay + * gfx_get_genlock_enable + * gfx_get_video_cursor + * gfx_get_clock_frequency + * gfx_read_crc + * + * Alpha blending read routines (SC1200 ONLY): + * + * gfx_get_alpha_enable + * gfx_get_alpha_size + * gfx_get_alpha_value + * gfx_get_alpha_priority + * gfx_get_alpha_color + * */ + +/* STATIC VARIABLES FOR VIDEO OVERLAY CONTROL */ +/* These are saved to allow these routines to do clipping. */ + +unsigned long gfx_vid_offset = 0; /* copy from last gfx_set_video_offset */ +unsigned long gfx_vid_uoffset = 0; /* copy from last + * gfx_set_video_yuv_offsets */ +unsigned long gfx_vid_voffset = 0; /* copy from last + * gfx_set_video_yuv_offsets */ +unsigned long gfx_vid_srcw = 300; /* copy from last gfx_set_video_scale */ +unsigned long gfx_vid_srch = 300; /* copy from last gfx_set_video_scale */ +unsigned long gfx_vid_dstw = 300; /* copy from last gfx_set_video_scale */ +unsigned long gfx_vid_dsth = 300; /* copy from last gfx_set_video_scale */ +short gfx_vid_xpos = 0; /* copy from last gfx_set_video_window */ +short gfx_vid_ypos = 0; /* copy from last gfx_set_video_window */ +unsigned short gfx_vid_width = 0; /* copy from last gfx_set_video_window */ +unsigned short gfx_vid_height = 0; /* copy from last gfx_set_video_window */ + +int gfx_alpha_select = 0; /* currently selected alpha region */ + +int gfx_set_screen_enable(int enable); /* forward declaration */ + +/* INCLUDE SUPPORT FOR CS5530, IF SPECIFIED. */ + +#if GFX_VIDEO_CS5530 +#include "vid_5530.c" +#endif + +/* INCLUDE SUPPORT FOR SC1200, IF SPECIFIED. */ + +#if GFX_VIDEO_SC1200 +#include "vid_1200.c" +#endif + +/* INLUDE SUPPORT FOR REDCLOUD, IF SPECIFIED. */ + +#if GFX_VIDEO_REDCLOUD +#include "vid_rdcl.c" +#endif + +/*--------------------------------------------------------------------------- + * gfx_select_alpha_region + * + * This routine selects which alpha region should be used for future + * updates. The SC1200, for example, has 3 alpha windows available, + * so valid parameter values are 0..2. + *--------------------------------------------------------------------------- + */ +int +gfx_select_alpha_region(int region) +{ + if (region > 2) + return (GFX_STATUS_BAD_PARAMETER); + + gfx_alpha_select = region; + return (GFX_STATUS_OK); +} + +/* WRAPPERS IF DYNAMIC SELECTION */ +/* Extra layer to call either CS5530 or SC1200 routines. */ + +#if GFX_VIDEO_DYNAMIC + +/*--------------------------------------------------------------------------- + * gfx_reset_video (PRIVATE ROUTINE: NOT PART OF DURANGO API) + * + * This routine is used to disable all components of video overlay before + * performing a mode switch. + *--------------------------------------------------------------------------- + */ +void +gfx_reset_video(void) +{ +#if GFX_VIDEO_CS5530 + if (gfx_video_type == GFX_VIDEO_TYPE_CS5530) + cs5530_reset_video(); +#endif +#if GFX_VIDEO_SC1200 + if (gfx_video_type == GFX_VIDEO_TYPE_SC1200) + sc1200_reset_video(); +#endif +#if GFX_VIDEO_REDCLOUD + if (gfx_video_type == GFX_VIDEO_TYPE_REDCLOUD) + redcloud_reset_video(); +#endif +} + +/*--------------------------------------------------------------------------- + * gfx_set_display_control (PRIVATE ROUTINE: NOT PART OF DURANGO API) + * + * This routine is used to configure the display output during a modeset + *--------------------------------------------------------------------------- + */ +int +gfx_set_display_control(int sync_polarities) +{ + int status = GFX_STATUS_UNSUPPORTED; + +#if GFX_VIDEO_CS5530 + if (gfx_video_type == GFX_VIDEO_TYPE_CS5530) + status = cs5530_set_display_control(sync_polarities); +#endif +#if GFX_VIDEO_SC1200 + if (gfx_video_type == GFX_VIDEO_TYPE_SC1200) + status = sc1200_set_display_control(sync_polarities); +#endif +#if GFX_VIDEO_REDCLOUD + if (gfx_video_type == GFX_VIDEO_TYPE_REDCLOUD) + status = redcloud_set_display_control(sync_polarities); +#endif + return (status); +} + +/*---------------------------------------------------------------------------- + * gfx_set_clock_frequency + *---------------------------------------------------------------------------- + */ +void +gfx_set_clock_frequency(unsigned long frequency) +{ +#if GFX_VIDEO_CS5530 + if (gfx_video_type == GFX_VIDEO_TYPE_CS5530) + cs5530_set_clock_frequency(frequency); +#endif +#if GFX_VIDEO_SC1200 + if (gfx_video_type == GFX_VIDEO_TYPE_SC1200) + sc1200_set_clock_frequency(frequency); +#endif +#if GFX_VIDEO_REDCLOUD + if (gfx_video_type == GFX_VIDEO_TYPE_REDCLOUD) + redcloud_set_clock_frequency(frequency); +#endif +} + +/*---------------------------------------------------------------------------- + * gfx_set_crt_enable + *---------------------------------------------------------------------------- + */ +int +gfx_set_crt_enable(int enable) +{ + int status = GFX_STATUS_UNSUPPORTED; + +#if GFX_VIDEO_SC1200 + if (gfx_video_type == GFX_VIDEO_TYPE_SC1200) + status = sc1200_set_crt_enable(enable); +#endif +#if GFX_VIDEO_CS5530 + if (gfx_video_type == GFX_VIDEO_TYPE_CS5530) + status = cs5530_set_crt_enable(enable); +#endif +#if GFX_VIDEO_REDCLOUD + if (gfx_video_type == GFX_VIDEO_TYPE_REDCLOUD) + status = redcloud_set_crt_enable(enable); +#endif + return (status); +} + +/*---------------------------------------------------------------------------- + * gfx_set_video_enable + *---------------------------------------------------------------------------- + */ +int +gfx_set_video_enable(int enable) +{ + int status = GFX_STATUS_UNSUPPORTED; + +#if GFX_VIDEO_CS5530 + if (gfx_video_type == GFX_VIDEO_TYPE_CS5530) + status = cs5530_set_video_enable(enable); +#endif +#if GFX_VIDEO_SC1200 + if (gfx_video_type == GFX_VIDEO_TYPE_SC1200) + status = sc1200_set_video_enable(enable); +#endif +#if GFX_VIDEO_REDCLOUD + if (gfx_video_type == GFX_VIDEO_TYPE_REDCLOUD) + status = redcloud_set_video_enable(enable); +#endif + return (status); +} + +/*--------------------------------------------------------------------------- + * gfx_set_screen_enable (PRIVATE ROUTINE: NOT PART OF DURANGO API) + * + * This routine enables or disables the graphics display logic of the video + * processor. + *--------------------------------------------------------------------------- + */ +int +gfx_set_screen_enable(int enable) +{ + int status = GFX_STATUS_UNSUPPORTED; + +#if GFX_VIDEO_SC1200 + if (gfx_video_type == GFX_VIDEO_TYPE_SC1200) + status = sc1200_set_screen_enable(enable); +#endif + return (status); +} + +/*---------------------------------------------------------------------------- + * gfx_set_video_format + *---------------------------------------------------------------------------- + */ +int +gfx_set_video_format(unsigned long format) +{ + int status = GFX_STATUS_UNSUPPORTED; + +#if GFX_VIDEO_CS5530 + if (gfx_video_type == GFX_VIDEO_TYPE_CS5530) + status = cs5530_set_video_format(format); +#endif +#if GFX_VIDEO_SC1200 + if (gfx_video_type == GFX_VIDEO_TYPE_SC1200) + status = sc1200_set_video_format(format); +#endif +#if GFX_VIDEO_REDCLOUD + if (gfx_video_type == GFX_VIDEO_TYPE_REDCLOUD) + status = redcloud_set_video_format(format); +#endif + return (status); +} + +/*---------------------------------------------------------------------------- + * gfx_set_video_size + *---------------------------------------------------------------------------- + */ +int +gfx_set_video_size(unsigned short width, unsigned short height) +{ + int status = GFX_STATUS_UNSUPPORTED; + +#if GFX_VIDEO_CS5530 + if (gfx_video_type == GFX_VIDEO_TYPE_CS5530) + status = cs5530_set_video_size(width, height); +#endif +#if GFX_VIDEO_SC1200 + if (gfx_video_type == GFX_VIDEO_TYPE_SC1200) + status = sc1200_set_video_size(width, height); +#endif +#if GFX_VIDEO_REDCLOUD + if (gfx_video_type == GFX_VIDEO_TYPE_REDCLOUD) + status = redcloud_set_video_size(width, height); +#endif + return (status); +} + +/*---------------------------------------------------------------------------- + * gfx_set_video_yuv_pitch + *---------------------------------------------------------------------------- + */ +int +gfx_set_video_yuv_pitch(unsigned long ypitch, unsigned long uvpitch) +{ + int status = GFX_STATUS_UNSUPPORTED; + +#if GFX_VIDEO_REDCLOUD + if (gfx_video_type == GFX_VIDEO_TYPE_REDCLOUD) + status = redcloud_set_video_yuv_pitch(ypitch, uvpitch); +#endif + return (status); +} + +/*---------------------------------------------------------------------------- + * gfx_set_video_offset + *---------------------------------------------------------------------------- + */ +int +gfx_set_video_offset(unsigned long offset) +{ + int status = GFX_STATUS_UNSUPPORTED; + +#if GFX_VIDEO_CS5530 + if (gfx_video_type == GFX_VIDEO_TYPE_CS5530) + status = cs5530_set_video_offset(offset); +#endif +#if GFX_VIDEO_SC1200 + if (gfx_video_type == GFX_VIDEO_TYPE_SC1200) + status = sc1200_set_video_offset(offset); +#endif +#if GFX_VIDEO_REDCLOUD + if (gfx_video_type == GFX_VIDEO_TYPE_REDCLOUD) + status = redcloud_set_video_offset(offset); +#endif + return (status); +} + +/*---------------------------------------------------------------------------- + * gfx_set_video_yuv_offsets + *---------------------------------------------------------------------------- + */ +int +gfx_set_video_yuv_offsets(unsigned long yoffset, unsigned long uoffset, + unsigned long voffset) +{ + int status = GFX_STATUS_UNSUPPORTED; + +#if GFX_VIDEO_REDCLOUD + if (gfx_video_type == GFX_VIDEO_TYPE_REDCLOUD) + status = redcloud_set_video_yuv_offsets(yoffset, uoffset, voffset); +#endif + return (status); +} + +/*--------------------------------------------------------------------------- + * gfx_set_video_scale + *--------------------------------------------------------------------------- + */ +int +gfx_set_video_scale(unsigned short srcw, unsigned short srch, + unsigned short dstw, unsigned short dsth) +{ + int status = GFX_STATUS_UNSUPPORTED; + +#if GFX_VIDEO_CS5530 + if (gfx_video_type == GFX_VIDEO_TYPE_CS5530) + status = cs5530_set_video_scale(srcw, srch, dstw, dsth); +#endif +#if GFX_VIDEO_SC1200 + if (gfx_video_type == GFX_VIDEO_TYPE_SC1200) + status = sc1200_set_video_scale(srcw, srch, dstw, dsth); +#endif +#if GFX_VIDEO_REDCLOUD + if (gfx_video_type == GFX_VIDEO_TYPE_REDCLOUD) + status = redcloud_set_video_scale(srcw, srch, dstw, dsth); +#endif + return (status); +} + +/*--------------------------------------------------------------------------- + * gfx_set_video_upscale + *--------------------------------------------------------------------------- + */ +int +gfx_set_video_upscale(unsigned short srcw, unsigned short srch, + unsigned short dstw, unsigned short dsth) +{ + int status = GFX_STATUS_UNSUPPORTED; + +#if GFX_VIDEO_SC1200 + if (gfx_video_type == GFX_VIDEO_TYPE_SC1200) + status = sc1200_set_video_upscale(srcw, srch, dstw, dsth); +#endif + return (status); +} + +/*--------------------------------------------------------------------------- + * gfx_set_video_vertical_downscale + *--------------------------------------------------------------------------- + */ +int +gfx_set_video_vertical_downscale(unsigned short srch, unsigned short dsth) +{ + int status = GFX_STATUS_UNSUPPORTED; + +#if GFX_VIDEO_REDCLOUD + if (gfx_video_type == GFX_VIDEO_TYPE_REDCLOUD) + status = redcloud_set_video_vertical_downscale(srch, dsth); +#endif + return (status); +} + +/*--------------------------------------------------------------------------- + * gfx_set_video_vertical_downscale_enable + *--------------------------------------------------------------------------- + */ +void +gfx_set_video_vertical_downscale_enable(int enable) +{ +#if GFX_VIDEO_REDCLOUD + if (gfx_video_type == GFX_VIDEO_TYPE_REDCLOUD) + redcloud_set_video_vertical_downscale_enable(enable); +#endif +} + +/*--------------------------------------------------------------------------- + * gfx_set_video_downscale_config + *--------------------------------------------------------------------------- + */ +int +gfx_set_video_downscale_config(unsigned short type, unsigned short m) +{ + int status = GFX_STATUS_UNSUPPORTED; + +#if GFX_VIDEO_SC1200 + if (gfx_video_type == GFX_VIDEO_TYPE_SC1200) + status = sc1200_set_video_downscale_config(type, m); +#endif +#if GFX_VIDEO_REDCLOUD + if (gfx_video_type == GFX_VIDEO_TYPE_REDCLOUD) + status = redcloud_set_video_downscale_config(type, m); +#endif + return (status); +} + +/*--------------------------------------------------------------------------- + * gfx_set_video_downscale_coefficients + *--------------------------------------------------------------------------- + */ +int +gfx_set_video_downscale_coefficients(unsigned short coef1, + unsigned short coef2, unsigned short coef3, unsigned short coef4) +{ + int status = GFX_STATUS_UNSUPPORTED; + +#if GFX_VIDEO_SC1200 + if (gfx_video_type == GFX_VIDEO_TYPE_SC1200) + status = + sc1200_set_video_downscale_coefficients(coef1, coef2, coef3, + coef4); +#endif +#if GFX_VIDEO_REDCLOUD + if (gfx_video_type == GFX_VIDEO_TYPE_REDCLOUD) + status = + redcloud_set_video_downscale_coefficients(coef1, coef2, coef3, + coef4); +#endif + return (status); +} + +/*--------------------------------------------------------------------------- + * gfx_set_video_downscale_enable + *--------------------------------------------------------------------------- + */ +int +gfx_set_video_downscale_enable(int enable) +{ + int status = GFX_STATUS_UNSUPPORTED; + +#if GFX_VIDEO_SC1200 + if (gfx_video_type == GFX_VIDEO_TYPE_SC1200) + status = sc1200_set_video_downscale_enable(enable); +#endif +#if GFX_VIDEO_REDCLOUD + if (gfx_video_type == GFX_VIDEO_TYPE_REDCLOUD) + status = redcloud_set_video_downscale_enable(enable); +#endif + return (status); +} + +/*--------------------------------------------------------------------------- + * gfx_set_video_window + *--------------------------------------------------------------------------- + */ +int +gfx_set_video_window(short x, short y, unsigned short w, unsigned short h) +{ + int status = GFX_STATUS_UNSUPPORTED; + +#if GFX_VIDEO_CS5530 + if (gfx_video_type == GFX_VIDEO_TYPE_CS5530) + status = cs5530_set_video_window(x, y, w, h); +#endif +#if GFX_VIDEO_SC1200 + if (gfx_video_type == GFX_VIDEO_TYPE_SC1200) + status = sc1200_set_video_window(x, y, w, h); +#endif +#if GFX_VIDEO_REDCLOUD + if (gfx_video_type == GFX_VIDEO_TYPE_REDCLOUD) + status = redcloud_set_video_window(x, y, w, h); +#endif + return (status); +} + +/*--------------------------------------------------------------------------- + * gfx_set_video_left_crop + *--------------------------------------------------------------------------- + */ +int +gfx_set_video_left_crop(unsigned short x) +{ + int status = GFX_STATUS_UNSUPPORTED; + +#if GFX_VIDEO_SC1200 + if (gfx_video_type == GFX_VIDEO_TYPE_SC1200) + status = sc1200_set_video_left_crop(x); +#endif +#if GFX_VIDEO_CS5530 + if (gfx_video_type == GFX_VIDEO_TYPE_CS5530) + status = cs5530_set_video_left_crop(x); +#endif +#if GFX_VIDEO_REDCLOUD + if (gfx_video_type == GFX_VIDEO_TYPE_REDCLOUD) + status = redcloud_set_video_left_crop(x); +#endif + return (status); +} + +/*--------------------------------------------------------------------------- + * gfx_set_video_color_key + *--------------------------------------------------------------------------- + */ +int +gfx_set_video_color_key(unsigned long key, unsigned long mask, int graphics) +{ + int status = GFX_STATUS_UNSUPPORTED; + +#if GFX_VIDEO_CS5530 + if (gfx_video_type == GFX_VIDEO_TYPE_CS5530) + status = cs5530_set_video_color_key(key, mask, graphics); +#endif +#if GFX_VIDEO_SC1200 + if (gfx_video_type == GFX_VIDEO_TYPE_SC1200) + status = sc1200_set_video_color_key(key, mask, graphics); +#endif +#if GFX_VIDEO_REDCLOUD + if (gfx_video_type == GFX_VIDEO_TYPE_REDCLOUD) + status = redcloud_set_video_color_key(key, mask, graphics); +#endif + return (status); +} + +/*--------------------------------------------------------------------------- + * gfx_set_video_filter + *--------------------------------------------------------------------------- + */ +int +gfx_set_video_filter(int xfilter, int yfilter) +{ + int status = GFX_STATUS_UNSUPPORTED; + +#if GFX_VIDEO_CS5530 + if (gfx_video_type == GFX_VIDEO_TYPE_CS5530) + status = cs5530_set_video_filter(xfilter, yfilter); +#endif +#if GFX_VIDEO_SC1200 + if (gfx_video_type == GFX_VIDEO_TYPE_SC1200) + status = sc1200_set_video_filter(xfilter, yfilter); +#endif +#if GFX_VIDEO_REDCLOUD + if (gfx_video_type == GFX_VIDEO_TYPE_REDCLOUD) + status = redcloud_set_video_filter(xfilter, yfilter); +#endif + return (status); +} + +/*--------------------------------------------------------------------------- + * gfx_set_video_palette + *--------------------------------------------------------------------------- + */ +int +gfx_set_video_palette(unsigned long *palette) +{ + int status = GFX_STATUS_UNSUPPORTED; + +#if GFX_VIDEO_CS5530 + if (gfx_video_type == GFX_VIDEO_TYPE_CS5530) + status = cs5530_set_video_palette(palette); +#endif +#if GFX_VIDEO_SC1200 + if (gfx_video_type == GFX_VIDEO_TYPE_SC1200) + status = sc1200_set_video_palette(palette); +#endif +#if GFX_VIDEO_REDCLOUD + if (gfx_video_type == GFX_VIDEO_TYPE_REDCLOUD) + status = redcloud_set_video_palette(palette); +#endif + return (status); +} + +/*--------------------------------------------------------------------------- + * gfx_set_graphics_palette + *--------------------------------------------------------------------------- + */ +int +gfx_set_graphics_palette(unsigned long *palette) +{ + int status = GFX_STATUS_UNSUPPORTED; + +#if GFX_VIDEO_REDCLOUD + if (gfx_video_type == GFX_VIDEO_TYPE_REDCLOUD) + status = redcloud_set_graphics_palette(palette); +#endif + + return (status); +} + +/*--------------------------------------------------------------------------- + * gfx_set_video_palette_entry + *--------------------------------------------------------------------------- + */ +int +gfx_set_video_palette_entry(unsigned long index, unsigned long palette) +{ + int status = GFX_STATUS_UNSUPPORTED; + +#if GFX_VIDEO_CS5530 + if (gfx_video_type == GFX_VIDEO_TYPE_CS5530) + status = cs5530_set_video_palette_entry(index, palette); +#endif +#if GFX_VIDEO_SC1200 + if (gfx_video_type == GFX_VIDEO_TYPE_SC1200) + status = sc1200_set_video_palette_entry(index, palette); +#endif +#if GFX_VIDEO_REDCLOUD + if (gfx_video_type == GFX_VIDEO_TYPE_REDCLOUD) + status = redcloud_set_video_palette_entry(index, palette); +#endif + return (status); +} + +/*--------------------------------------------------------------------------- + * gfx_set_graphics_palette_entry + *--------------------------------------------------------------------------- + */ +int +gfx_set_graphics_palette_entry(unsigned long index, unsigned long palette) +{ + int status = GFX_STATUS_UNSUPPORTED; + +#if GFX_VIDEO_REDCLOUD + if (gfx_video_type == GFX_VIDEO_TYPE_REDCLOUD) + status = redcloud_set_graphics_palette_entry(index, palette); +#endif + + return (status); +} + +/*--------------------------------------------------------------------------- + * gfx_set_video_palette_bypass + *--------------------------------------------------------------------------- + */ +int +gfx_set_video_palette_bypass(int enable) +{ + int status = GFX_STATUS_UNSUPPORTED; + +#if GFX_VIDEO_SC1200 + if (gfx_video_type == GFX_VIDEO_TYPE_SC1200) + status = sc1200_set_video_palette_bypass(enable); +#endif +#if GFX_VIDEO_REDCLOUD + if (gfx_video_type == GFX_VIDEO_TYPE_REDCLOUD) + status = redcloud_set_video_palette_bypass(enable); +#endif + return (status); +} + +/*--------------------------------------------------------------------------- + * gfx_set_video_request + *--------------------------------------------------------------------------- + */ +int +gfx_set_video_request(short x, short y) +{ + int status = GFX_STATUS_UNSUPPORTED; + +#if GFX_VIDEO_SC1200 + if (gfx_video_type == GFX_VIDEO_TYPE_SC1200) + status = sc1200_set_video_request(x, y); +#endif +#if GFX_VIDEO_REDCLOUD + if (gfx_video_type == GFX_VIDEO_TYPE_REDCLOUD) + status = redcloud_set_video_request(x, y); +#endif + return (status); +} + +/*--------------------------------------------------------------------------- + * gfx_set_video_source + *--------------------------------------------------------------------------- + */ +int +gfx_set_video_source(VideoSourceType source) +{ + int status = GFX_STATUS_UNSUPPORTED; + +#if GFX_VIDEO_SC1200 + if (gfx_video_type == GFX_VIDEO_TYPE_SC1200) + status = sc1200_set_video_source(source); +#endif + return (status); +} + +/*--------------------------------------------------------------------------- + * gfx_set_vbi_source + *--------------------------------------------------------------------------- + */ +int +gfx_set_vbi_source(VbiSourceType source) +{ + int status = GFX_STATUS_UNSUPPORTED; + +#if GFX_VIDEO_SC1200 + if (gfx_video_type == GFX_VIDEO_TYPE_SC1200) + status = sc1200_set_vbi_source(source); +#endif + return (status); +} + +/*--------------------------------------------------------------------------- + * gfx_set_vbi_lines + *--------------------------------------------------------------------------- + */ +int +gfx_set_vbi_lines(unsigned long even, unsigned long odd) +{ + int status = GFX_STATUS_UNSUPPORTED; + +#if GFX_VIDEO_SC1200 + if (gfx_video_type == GFX_VIDEO_TYPE_SC1200) + status = sc1200_set_vbi_lines(even, odd); +#endif + return (status); +} + +/*--------------------------------------------------------------------------- + * gfx_set_vbi_total + *--------------------------------------------------------------------------- + */ +int +gfx_set_vbi_total(unsigned long even, unsigned long odd) +{ + int status = GFX_STATUS_UNSUPPORTED; + +#if GFX_VIDEO_SC1200 + if (gfx_video_type == GFX_VIDEO_TYPE_SC1200) + status = sc1200_set_vbi_total(even, odd); +#endif + return (status); +} + +/*--------------------------------------------------------------------------- + * gfx_set_video_interlaced + *--------------------------------------------------------------------------- + */ +int +gfx_set_video_interlaced(int enable) +{ + int status = GFX_STATUS_UNSUPPORTED; + +#if GFX_VIDEO_SC1200 + if (gfx_video_type == GFX_VIDEO_TYPE_SC1200) + status = sc1200_set_video_interlaced(enable); +#endif + return (status); +} + +/*--------------------------------------------------------------------------- + * gfx_set_color_space_YUV + *--------------------------------------------------------------------------- + */ +int +gfx_set_color_space_YUV(int enable) +{ + int status = GFX_STATUS_UNSUPPORTED; + +#if GFX_VIDEO_SC1200 + if (gfx_video_type == GFX_VIDEO_TYPE_SC1200) + status = sc1200_set_color_space_YUV(enable); +#endif + return (status); +} + +/*--------------------------------------------------------------------------- + * gfx_set_vertical_scaler_offset + *--------------------------------------------------------------------------- + */ +int +gfx_set_vertical_scaler_offset(char offset) +{ + int status = GFX_STATUS_UNSUPPORTED; + +#if GFX_VIDEO_SC1200 + if (gfx_video_type == GFX_VIDEO_TYPE_SC1200) + status = sc1200_set_vertical_scaler_offset(offset); +#endif + return (status); +} + +/*--------------------------------------------------------------------------- + * gfx_set_top_line_in_odd + *--------------------------------------------------------------------------- + */ +int +gfx_set_top_line_in_odd(int enable) +{ + int status = GFX_STATUS_UNSUPPORTED; + +#if GFX_VIDEO_SC1200 + if (gfx_video_type == GFX_VIDEO_TYPE_SC1200) + status = sc1200_set_top_line_in_odd(enable); +#endif + return (status); +} + +/*--------------------------------------------------------------------------- + * gfx_set_genlock_delay + *--------------------------------------------------------------------------- + */ +int +gfx_set_genlock_delay(unsigned long delay) +{ + int status = GFX_STATUS_UNSUPPORTED; + +#if GFX_VIDEO_SC1200 + if (gfx_video_type == GFX_VIDEO_TYPE_SC1200) + status = sc1200_set_genlock_delay(delay); +#endif + return (status); +} + +/*--------------------------------------------------------------------------- + * gfx_set_genlock_enable + *--------------------------------------------------------------------------- + */ +int +gfx_set_genlock_enable(int flags) +{ + int status = GFX_STATUS_UNSUPPORTED; + +#if GFX_VIDEO_SC1200 + if (gfx_video_type == GFX_VIDEO_TYPE_SC1200) + status = sc1200_set_genlock_enable(flags); +#endif + return (status); +} + +/*--------------------------------------------------------------------------- + * gfx_set_video_cursor + *--------------------------------------------------------------------------- + */ +int +gfx_set_video_cursor(unsigned long key, unsigned long mask, + unsigned short select_color2, unsigned long color1, unsigned long color2) +{ + int status = GFX_STATUS_UNSUPPORTED; + +#if GFX_VIDEO_SC1200 + if (gfx_video_type == GFX_VIDEO_TYPE_SC1200) + status = + sc1200_set_video_cursor(key, mask, select_color2, color1, color2); +#endif +#if GFX_VIDEO_REDCLOUD + if (gfx_video_type == GFX_VIDEO_TYPE_REDCLOUD) + status = + redcloud_set_video_cursor(key, mask, select_color2, color1, + color2); +#endif + return (status); +} + +/*--------------------------------------------------------------------------- + * gfx_set_video_cursor_enable + *--------------------------------------------------------------------------- + */ +int +gfx_set_video_cursor_enable(int enable) +{ + int status = GFX_STATUS_UNSUPPORTED; + +#if GFX_VIDEO_REDCLOUD + if (gfx_video_type == GFX_VIDEO_TYPE_REDCLOUD) + status = redcloud_set_video_cursor_enable(enable); +#endif + return (status); +} + +/*--------------------------------------------------------------------------- + * gfx_set_alpha_enable + *--------------------------------------------------------------------------- + */ +int +gfx_set_alpha_enable(int enable) +{ + int status = GFX_STATUS_UNSUPPORTED; + +#if GFX_VIDEO_SC1200 + if (gfx_video_type == GFX_VIDEO_TYPE_SC1200) + status = sc1200_set_alpha_enable(enable); +#endif +#if GFX_VIDEO_REDCLOUD + if (gfx_video_type == GFX_VIDEO_TYPE_REDCLOUD) + status = redcloud_set_alpha_enable(enable); +#endif + return (status); +} + +/*--------------------------------------------------------------------------- + * gfx_set_alpha_window + *--------------------------------------------------------------------------- + */ +int +gfx_set_alpha_window(short x, short y, + unsigned short width, unsigned short height) +{ + int status = GFX_STATUS_UNSUPPORTED; + +#if GFX_VIDEO_SC1200 + if (gfx_video_type == GFX_VIDEO_TYPE_SC1200) + status = sc1200_set_alpha_window(x, y, width, height); +#endif +#if GFX_VIDEO_REDCLOUD + if (gfx_video_type == GFX_VIDEO_TYPE_REDCLOUD) + status = redcloud_set_alpha_window(x, y, width, height); +#endif + return (status); +} + +/*--------------------------------------------------------------------------- + * gfx_set_alpha_value + *--------------------------------------------------------------------------- + */ +int +gfx_set_alpha_value(unsigned char alpha, char delta) +{ + int status = GFX_STATUS_UNSUPPORTED; + +#if GFX_VIDEO_SC1200 + if (gfx_video_type == GFX_VIDEO_TYPE_SC1200) + status = sc1200_set_alpha_value(alpha, delta); +#endif +#if GFX_VIDEO_REDCLOUD + if (gfx_video_type == GFX_VIDEO_TYPE_REDCLOUD) + status = redcloud_set_alpha_value(alpha, delta); +#endif + return (status); +} + +/*--------------------------------------------------------------------------- + * gfx_set_alpha_priority + *--------------------------------------------------------------------------- + */ +int +gfx_set_alpha_priority(int priority) +{ + int status = GFX_STATUS_UNSUPPORTED; + +#if GFX_VIDEO_SC1200 + if (gfx_video_type == GFX_VIDEO_TYPE_SC1200) + status = sc1200_set_alpha_priority(priority); +#endif +#if GFX_VIDEO_REDCLOUD + if (gfx_video_type == GFX_VIDEO_TYPE_REDCLOUD) + status = redcloud_set_alpha_priority(priority); +#endif + return (status); +} + +/*--------------------------------------------------------------------------- + * gfx_set_alpha_color + *--------------------------------------------------------------------------- + */ +int +gfx_set_alpha_color(unsigned long color) +{ + int status = GFX_STATUS_UNSUPPORTED; + +#if GFX_VIDEO_SC1200 + if (gfx_video_type == GFX_VIDEO_TYPE_SC1200) + status = sc1200_set_alpha_color(color); +#endif +#if GFX_VIDEO_REDCLOUD + if (gfx_video_type == GFX_VIDEO_TYPE_REDCLOUD) + status = redcloud_set_alpha_color(color); +#endif + return (status); +} + +/*--------------------------------------------------------------------------- + * gfx_set_alpha_color_enable + *--------------------------------------------------------------------------- + */ +int +gfx_set_alpha_color_enable(int enable) +{ + int status = GFX_STATUS_UNSUPPORTED; + +#if GFX_VIDEO_SC1200 + if (gfx_video_type == GFX_VIDEO_TYPE_SC1200) + status = sc1200_set_alpha_color_enable(enable); +#endif +#if GFX_VIDEO_REDCLOUD + if (gfx_video_type == GFX_VIDEO_TYPE_REDCLOUD) + status = redcloud_set_alpha_color_enable(enable); +#endif + return (status); +} + +/*--------------------------------------------------------------------------- + * gfx_set_no_ck_outside_alpha + *--------------------------------------------------------------------------- + */ +int +gfx_set_no_ck_outside_alpha(int enable) +{ + int status = GFX_STATUS_UNSUPPORTED; + +#if GFX_VIDEO_SC1200 + if (gfx_video_type == GFX_VIDEO_TYPE_SC1200) + status = sc1200_set_no_ck_outside_alpha(enable); +#endif +#if GFX_VIDEO_REDCLOUD + if (gfx_video_type == GFX_VIDEO_TYPE_REDCLOUD) + status = redcloud_set_no_ck_outside_alpha(enable); +#endif + return (status); +} + +/*--------------------------------------------------------------------------- + * gfx_set_macrovision_enable + *--------------------------------------------------------------------------- + */ +int +gfx_set_macrovision_enable(int enable) +{ + int status = GFX_STATUS_UNSUPPORTED; + +#if GFX_VIDEO_SC1200 + if (gfx_video_type == GFX_VIDEO_TYPE_SC1200) + status = sc1200_set_macrovision_enable(enable); +#endif + return (status); +} + +/*--------------------------------------------------------------------------- + * gfx_disable_softvga + *--------------------------------------------------------------------------- + */ +int +gfx_disable_softvga(void) +{ + int status = 0; + +#if GFX_VIDEO_CS5530 + if (gfx_video_type == GFX_VIDEO_TYPE_CS5530) + status = cs5530_disable_softvga(); +#endif +#if GFX_VIDEO_SC1200 + if (gfx_video_type == GFX_VIDEO_TYPE_SC1200) + status = sc1200_disable_softvga(); +#endif + return (status); +} + +/*--------------------------------------------------------------------------- + * gfx_enable_softvga + *--------------------------------------------------------------------------- + */ +int +gfx_enable_softvga(void) +{ + int status = 0; + +#if GFX_VIDEO_CS5530 + if (gfx_video_type == GFX_VIDEO_TYPE_CS5530) + status = cs5530_enable_softvga(); +#endif +#if GFX_VIDEO_SC1200 + if (gfx_video_type == GFX_VIDEO_TYPE_SC1200) + status = sc1200_enable_softvga(); +#endif + return (status); +} + +/*--------------------------------------------------------------------------- + * gfx_get_clock_frequency + *--------------------------------------------------------------------------- + */ +unsigned long +gfx_get_clock_frequency(void) +{ + unsigned long frequency = 0; + +#if GFX_VIDEO_CS5530 + if (gfx_video_type == GFX_VIDEO_TYPE_CS5530) + frequency = cs5530_get_clock_frequency(); +#endif +#if GFX_VIDEO_SC1200 + if (gfx_video_type == GFX_VIDEO_TYPE_SC1200) + frequency = sc1200_get_clock_frequency(); +#endif +#if GFX_VIDEO_REDCLOUD + if (gfx_video_type == GFX_VIDEO_TYPE_REDCLOUD) + frequency = redcloud_get_clock_frequency(); +#endif + return (frequency); +} + +/*--------------------------------------------------------------------------- + * gfx_get_max_video_width + *--------------------------------------------------------------------------- + */ +unsigned long +gfx_get_max_video_width(void) +{ + unsigned long width = 0; + +#if GFX_VIDEO_CS5530 + if (gfx_video_type == GFX_VIDEO_TYPE_CS5530) + width = cs5530_get_max_video_width(); +#endif +#if GFX_VIDEO_SC1200 + if (gfx_video_type == GFX_VIDEO_TYPE_SC1200) + width = sc1200_get_max_video_width(); +#endif + return (width); +} + +/*************************************************************/ +/* READ ROUTINES | INCLUDED FOR DIAGNOSTIC PURPOSES ONLY */ +/*************************************************************/ + +#if GFX_READ_ROUTINES + +/*--------------------------------------------------------------------------- + * gfx_get_vsa2_softvga_enable + *--------------------------------------------------------------------------- + */ +int +gfx_get_vsa2_softvga_enable(void) +{ + int enable = 0; + +#if GFX_VIDEO_CS5530 + if (gfx_video_type == GFX_VIDEO_TYPE_CS5530) + enable = cs5530_get_vsa2_softvga_enable(); +#endif +#if GFX_VIDEO_SC1200 + if (gfx_video_type == GFX_VIDEO_TYPE_SC1200) + enable = sc1200_get_vsa2_softvga_enable(); +#endif + return enable; + +} + +/*--------------------------------------------------------------------------- + * gfx_get_sync_polarities + *--------------------------------------------------------------------------- + */ +int +gfx_get_sync_polarities(void) +{ + int polarities = 0; + +#if GFX_VIDEO_CS5530 + if (gfx_video_type == GFX_VIDEO_TYPE_CS5530) + polarities = cs5530_get_sync_polarities(); +#endif +#if GFX_VIDEO_SC1200 + if (gfx_video_type == GFX_VIDEO_TYPE_SC1200) + polarities = sc1200_get_sync_polarities(); +#endif +#if GFX_VIDEO_REDCLOUD + if (gfx_video_type == GFX_VIDEO_TYPE_REDCLOUD) + polarities = redcloud_get_sync_polarities(); +#endif + return (polarities); +} + +/*--------------------------------------------------------------------------- + * gfx_get_video_palette_entry + *--------------------------------------------------------------------------- + */ +int +gfx_get_video_palette_entry(unsigned long index, unsigned long *palette) +{ + int status = GFX_STATUS_UNSUPPORTED; + +#if GFX_VIDEO_CS5530 + if (gfx_video_type == GFX_VIDEO_TYPE_CS5530) + status = cs5530_get_video_palette_entry(index, palette); +#endif +#if GFX_VIDEO_SC1200 + if (gfx_video_type == GFX_VIDEO_TYPE_SC1200) + status = sc1200_get_video_palette_entry(index, palette); +#endif +#if GFX_VIDEO_REDCLOUD + if (gfx_video_type == GFX_VIDEO_TYPE_REDCLOUD) + status = redcloud_get_video_palette_entry(index, palette); +#endif + return (status); +} + +/*---------------------------------------------------------------------------- + * gfx_get_video_enable + *---------------------------------------------------------------------------- + */ +int +gfx_get_video_enable(void) +{ + int enable = 0; + +#if GFX_VIDEO_CS5530 + if (gfx_video_type == GFX_VIDEO_TYPE_CS5530) + enable = cs5530_get_video_enable(); +#endif +#if GFX_VIDEO_SC1200 + if (gfx_video_type == GFX_VIDEO_TYPE_SC1200) + enable = sc1200_get_video_enable(); +#endif +#if GFX_VIDEO_REDCLOUD + if (gfx_video_type == GFX_VIDEO_TYPE_REDCLOUD) + enable = redcloud_get_video_enable(); +#endif + return (enable); +} + +/*---------------------------------------------------------------------------- + * gfx_get_video_format + *---------------------------------------------------------------------------- + */ +int +gfx_get_video_format(void) +{ + int format = 0; + +#if GFX_VIDEO_CS5530 + if (gfx_video_type == GFX_VIDEO_TYPE_CS5530) + format = cs5530_get_video_format(); +#endif +#if GFX_VIDEO_SC1200 + if (gfx_video_type == GFX_VIDEO_TYPE_SC1200) + format = sc1200_get_video_format(); +#endif +#if GFX_VIDEO_REDCLOUD + if (gfx_video_type == GFX_VIDEO_TYPE_REDCLOUD) + format = redcloud_get_video_format(); +#endif + return (format); +} + +/*---------------------------------------------------------------------------- + * gfx_get_video_src_size + *---------------------------------------------------------------------------- + */ +unsigned long +gfx_get_video_src_size(void) +{ + unsigned long size = 0; + +#if GFX_VIDEO_CS5530 + if (gfx_video_type == GFX_VIDEO_TYPE_CS5530) + size = cs5530_get_video_src_size(); +#endif +#if GFX_VIDEO_SC1200 + if (gfx_video_type == GFX_VIDEO_TYPE_SC1200) + size = sc1200_get_video_src_size(); +#endif +#if GFX_VIDEO_REDCLOUD + if (gfx_video_type == GFX_VIDEO_TYPE_REDCLOUD) + size = redcloud_get_video_src_size(); +#endif + return (size); +} + +/*---------------------------------------------------------------------------- + * gfx_get_video_line_size + *---------------------------------------------------------------------------- + */ +unsigned long +gfx_get_video_line_size(void) +{ + unsigned long size = 0; + +#if GFX_VIDEO_CS5530 + if (gfx_video_type == GFX_VIDEO_TYPE_CS5530) + size = cs5530_get_video_line_size(); +#endif +#if GFX_VIDEO_SC1200 + if (gfx_video_type == GFX_VIDEO_TYPE_SC1200) + size = sc1200_get_video_line_size(); +#endif +#if GFX_VIDEO_REDCLOUD + if (gfx_video_type == GFX_VIDEO_TYPE_REDCLOUD) + size = redcloud_get_video_line_size(); +#endif + return (size); +} + +/*---------------------------------------------------------------------------- + * gfx_get_video_xclip + *---------------------------------------------------------------------------- + */ +unsigned long +gfx_get_video_xclip(void) +{ + unsigned long size = 0; + +#if GFX_VIDEO_CS5530 + if (gfx_video_type == GFX_VIDEO_TYPE_CS5530) + size = cs5530_get_video_xclip(); +#endif +#if GFX_VIDEO_SC1200 + if (gfx_video_type == GFX_VIDEO_TYPE_SC1200) + size = sc1200_get_video_xclip(); +#endif +#if GFX_VIDEO_REDCLOUD + if (gfx_video_type == GFX_VIDEO_TYPE_REDCLOUD) + size = redcloud_get_video_xclip(); +#endif + return (size); +} + +/*---------------------------------------------------------------------------- + * gfx_get_video_offset + *---------------------------------------------------------------------------- + */ +unsigned long +gfx_get_video_offset(void) +{ + unsigned long offset = 0; + +#if GFX_VIDEO_CS5530 + if (gfx_video_type == GFX_VIDEO_TYPE_CS5530) + offset = cs5530_get_video_offset(); +#endif +#if GFX_VIDEO_SC1200 + if (gfx_video_type == GFX_VIDEO_TYPE_SC1200) + offset = sc1200_get_video_offset(); +#endif +#if GFX_VIDEO_REDCLOUD + if (gfx_video_type == GFX_VIDEO_TYPE_REDCLOUD) + offset = redcloud_get_video_offset(); +#endif + return (offset); +} + +/*---------------------------------------------------------------------------- + * gfx_get_video_yuv_offsets + *---------------------------------------------------------------------------- + */ +void +gfx_get_video_yuv_offsets(unsigned long *yoffset, unsigned long *uoffset, + unsigned long *voffset) +{ +#if GFX_VIDEO_REDCLOUD + if (gfx_video_type == GFX_VIDEO_TYPE_REDCLOUD) + redcloud_get_video_yuv_offsets(yoffset, uoffset, voffset); +#endif +} + +/*---------------------------------------------------------------------------- + * gfx_get_video_yuv_pitch + *---------------------------------------------------------------------------- + */ +void +gfx_get_video_yuv_pitch(unsigned long *ypitch, unsigned long *uvpitch) +{ +#if GFX_VIDEO_REDCLOUD + if (gfx_video_type == GFX_VIDEO_TYPE_REDCLOUD) + redcloud_get_video_yuv_pitch(ypitch, uvpitch); +#endif +} + +/*--------------------------------------------------------------------------- + * gfx_get_video_upscale + *--------------------------------------------------------------------------- + */ +unsigned long +gfx_get_video_upscale(void) +{ + unsigned long scale = 0; + +#if GFX_VIDEO_SC1200 + if (gfx_video_type == GFX_VIDEO_TYPE_SC1200) + scale = sc1200_get_video_upscale(); +#endif + return (scale); +} + +/*--------------------------------------------------------------------------- + * gfx_get_video_scale + *--------------------------------------------------------------------------- + */ +unsigned long +gfx_get_video_scale(void) +{ + unsigned long scale = 0; + +#if GFX_VIDEO_CS5530 + if (gfx_video_type == GFX_VIDEO_TYPE_CS5530) + scale = cs5530_get_video_scale(); +#endif +#if GFX_VIDEO_SC1200 + if (gfx_video_type == GFX_VIDEO_TYPE_SC1200) + scale = sc1200_get_video_scale(); +#endif +#if GFX_VIDEO_REDCLOUD + if (gfx_video_type == GFX_VIDEO_TYPE_REDCLOUD) + scale = redcloud_get_video_scale(); +#endif + return (scale); +} + +/*--------------------------------------------------------------------------- + * gfx_get_video_downscale_delta + *--------------------------------------------------------------------------- + */ +unsigned long +gfx_get_video_downscale_delta(void) +{ + unsigned long delta = 0; + +#if GFX_VIDEO_REDCLOUD + if (gfx_video_type == GFX_VIDEO_TYPE_REDCLOUD) + delta = redcloud_get_video_downscale_delta(); +#endif + return (delta); +} + +/*--------------------------------------------------------------------------- + * gfx_get_video_vertical_downscale_enable + *--------------------------------------------------------------------------- + */ +int +gfx_get_video_vertical_downscale_enable(void) +{ + int enable = 0; + +#if GFX_VIDEO_REDCLOUD + if (gfx_video_type == GFX_VIDEO_TYPE_REDCLOUD) + enable = redcloud_get_video_vertical_downscale_enable(); +#endif + return (enable); +} + +/*--------------------------------------------------------------------------- + * gfx_get_video_downscale_config + *--------------------------------------------------------------------------- + */ +int +gfx_get_video_downscale_config(unsigned short *type, unsigned short *m) +{ + int status = GFX_STATUS_UNSUPPORTED; + +#if GFX_VIDEO_SC1200 + if (gfx_video_type == GFX_VIDEO_TYPE_SC1200) + status = sc1200_get_video_downscale_config(type, m); +#endif +#if GFX_VIDEO_REDCLOUD + if (gfx_video_type == GFX_VIDEO_TYPE_REDCLOUD) + status = redcloud_get_video_downscale_config(type, m); +#endif + return (status); +} + +/*--------------------------------------------------------------------------- + * gfx_get_video_downscale_coefficients + *--------------------------------------------------------------------------- + */ +void +gfx_get_video_downscale_coefficients(unsigned short *coef1, + unsigned short *coef2, unsigned short *coef3, unsigned short *coef4) +{ +#if GFX_VIDEO_SC1200 + if (gfx_video_type == GFX_VIDEO_TYPE_SC1200) + sc1200_get_video_downscale_coefficients(coef1, coef2, coef3, coef4); +#endif +#if GFX_VIDEO_REDCLOUD + if (gfx_video_type == GFX_VIDEO_TYPE_REDCLOUD) + redcloud_get_video_downscale_coefficients(coef1, coef2, coef3, coef4); +#endif +} + +/*--------------------------------------------------------------------------- + * gfx_get_video_downscale_enable + *--------------------------------------------------------------------------- + */ +void +gfx_get_video_downscale_enable(int *enable) +{ +#if GFX_VIDEO_SC1200 + if (gfx_video_type == GFX_VIDEO_TYPE_SC1200) + sc1200_get_video_downscale_enable(enable); +#endif +#if GFX_VIDEO_REDCLOUD + if (gfx_video_type == GFX_VIDEO_TYPE_REDCLOUD) + redcloud_get_video_downscale_enable(enable); +#endif +} + +/*--------------------------------------------------------------------------- + * gfx_get_video_dst_size + *--------------------------------------------------------------------------- + */ +unsigned long +gfx_get_video_dst_size(void) +{ + unsigned long size = 0; + +#if GFX_VIDEO_CS5530 + if (gfx_video_type == GFX_VIDEO_TYPE_CS5530) + size = cs5530_get_video_dst_size(); +#endif +#if GFX_VIDEO_SC1200 + if (gfx_video_type == GFX_VIDEO_TYPE_SC1200) + size = sc1200_get_video_dst_size(); +#endif +#if GFX_VIDEO_REDCLOUD + if (gfx_video_type == GFX_VIDEO_TYPE_REDCLOUD) + size = redcloud_get_video_dst_size(); +#endif + return (size); +} + +/*--------------------------------------------------------------------------- + * gfx_get_video_position + *--------------------------------------------------------------------------- + */ +unsigned long +gfx_get_video_position(void) +{ + unsigned long position = 0; + +#if GFX_VIDEO_CS5530 + if (gfx_video_type == GFX_VIDEO_TYPE_CS5530) + position = cs5530_get_video_position(); +#endif +#if GFX_VIDEO_SC1200 + if (gfx_video_type == GFX_VIDEO_TYPE_SC1200) + position = sc1200_get_video_position(); +#endif +#if GFX_VIDEO_REDCLOUD + if (gfx_video_type == GFX_VIDEO_TYPE_REDCLOUD) + position = redcloud_get_video_position(); +#endif + return (position); +} + +/*--------------------------------------------------------------------------- + * gfx_get_video_color_key + *--------------------------------------------------------------------------- + */ +unsigned long +gfx_get_video_color_key(void) +{ + unsigned long key = 0; + +#if GFX_VIDEO_CS5530 + if (gfx_video_type == GFX_VIDEO_TYPE_CS5530) + key = cs5530_get_video_color_key(); +#endif +#if GFX_VIDEO_SC1200 + if (gfx_video_type == GFX_VIDEO_TYPE_SC1200) + key = sc1200_get_video_color_key(); +#endif +#if GFX_VIDEO_REDCLOUD + if (gfx_video_type == GFX_VIDEO_TYPE_REDCLOUD) + key = redcloud_get_video_color_key(); +#endif + return (key); +} + +/*--------------------------------------------------------------------------- + * gfx_get_video_color_key_mask + *--------------------------------------------------------------------------- + */ +unsigned long +gfx_get_video_color_key_mask(void) +{ + unsigned long mask = 0; + +#if GFX_VIDEO_CS5530 + if (gfx_video_type == GFX_VIDEO_TYPE_CS5530) + mask = cs5530_get_video_color_key_mask(); +#endif +#if GFX_VIDEO_SC1200 + if (gfx_video_type == GFX_VIDEO_TYPE_SC1200) + mask = sc1200_get_video_color_key_mask(); +#endif +#if GFX_VIDEO_REDCLOUD + if (gfx_video_type == GFX_VIDEO_TYPE_REDCLOUD) + mask = redcloud_get_video_color_key_mask(); +#endif + return (mask); +} + +/*--------------------------------------------------------------------------- + * gfx_get_video_color_key_src + *--------------------------------------------------------------------------- + */ +int +gfx_get_video_color_key_src(void) +{ + int src = 0; + +#if GFX_VIDEO_CS5530 + if (gfx_video_type == GFX_VIDEO_TYPE_CS5530) + src = cs5530_get_video_color_key_src(); +#endif +#if GFX_VIDEO_SC1200 + if (gfx_video_type == GFX_VIDEO_TYPE_SC1200) + src = sc1200_get_video_color_key_src(); +#endif +#if GFX_VIDEO_REDCLOUD + if (gfx_video_type == GFX_VIDEO_TYPE_REDCLOUD) + src = redcloud_get_video_color_key_src(); +#endif + return (src); +} + +/*--------------------------------------------------------------------------- + * gfx_get_video_filter + *--------------------------------------------------------------------------- + */ +int +gfx_get_video_filter(void) +{ + int filter = 0; + +#if GFX_VIDEO_CS5530 + if (gfx_video_type == GFX_VIDEO_TYPE_CS5530) + filter = cs5530_get_video_filter(); +#endif +#if GFX_VIDEO_SC1200 + if (gfx_video_type == GFX_VIDEO_TYPE_SC1200) + filter = sc1200_get_video_filter(); +#endif +#if GFX_VIDEO_REDCLOUD + if (gfx_video_type == GFX_VIDEO_TYPE_REDCLOUD) + filter = redcloud_get_video_filter(); +#endif + return (filter); +} + +/*--------------------------------------------------------------------------- + * gfx_get_video_request + *--------------------------------------------------------------------------- + */ +int +gfx_get_video_request(short *x, short *y) +{ + int status = GFX_STATUS_UNSUPPORTED; + +#if GFX_VIDEO_SC1200 + if (gfx_video_type == GFX_VIDEO_TYPE_SC1200) + status = sc1200_get_video_request(x, y); +#endif +#if GFX_VIDEO_REDCLOUD + if (gfx_video_type == GFX_VIDEO_TYPE_REDCLOUD) + status = redcloud_get_video_request(x, y); +#endif + return (status); +} + +/*--------------------------------------------------------------------------- + * gfx_get_video_source + *--------------------------------------------------------------------------- + */ +int +gfx_get_video_source(VideoSourceType * source) +{ + int status = GFX_STATUS_UNSUPPORTED; + +#if GFX_VIDEO_SC1200 + if (gfx_video_type == GFX_VIDEO_TYPE_SC1200) + status = sc1200_get_video_source(source); +#endif + return (status); +} + +/*--------------------------------------------------------------------------- + * gfx_get_vbi_source + *--------------------------------------------------------------------------- + */ +int +gfx_get_vbi_source(VbiSourceType * source) +{ + int status = GFX_STATUS_UNSUPPORTED; + +#if GFX_VIDEO_SC1200 + if (gfx_video_type == GFX_VIDEO_TYPE_SC1200) + status = sc1200_get_vbi_source(source); +#endif + return (status); +} + +/*--------------------------------------------------------------------------- + * gfx_get_vbi_lines + *--------------------------------------------------------------------------- + */ +unsigned long +gfx_get_vbi_lines(int odd) +{ + unsigned long lines = (unsigned long)GFX_STATUS_UNSUPPORTED; + +#if GFX_VIDEO_SC1200 + if (gfx_video_type == GFX_VIDEO_TYPE_SC1200) + lines = sc1200_get_vbi_lines(odd); +#endif + return (lines); +} + +/*--------------------------------------------------------------------------- + * gfx_get_vbi_total + *--------------------------------------------------------------------------- + */ +unsigned long +gfx_get_vbi_total(int odd) +{ + unsigned long total = (unsigned long)GFX_STATUS_UNSUPPORTED; + +#if GFX_VIDEO_SC1200 + if (gfx_video_type == GFX_VIDEO_TYPE_SC1200) + total = sc1200_get_vbi_total(odd); +#endif + return (total); +} + +/*--------------------------------------------------------------------------- + * gfx_get_video_interlaced + *--------------------------------------------------------------------------- + */ +int +gfx_get_video_interlaced(void) +{ + int interlaced = GFX_STATUS_UNSUPPORTED; + +#if GFX_VIDEO_SC1200 + if (gfx_video_type == GFX_VIDEO_TYPE_SC1200) + interlaced = sc1200_get_video_interlaced(); +#endif + return (interlaced); +} + +/*--------------------------------------------------------------------------- + * gfx_get_color_space_YUV + *--------------------------------------------------------------------------- + */ +int +gfx_get_color_space_YUV(void) +{ + int color_space = GFX_STATUS_UNSUPPORTED; + +#if GFX_VIDEO_SC1200 + if (gfx_video_type == GFX_VIDEO_TYPE_SC1200) + color_space = sc1200_get_color_space_YUV(); +#endif + return (color_space); +} + +/*--------------------------------------------------------------------------- + * gfx_get_vertical_scaler_offset + *--------------------------------------------------------------------------- + */ +int +gfx_get_vertical_scaler_offset(char *offset) +{ + int status = GFX_STATUS_UNSUPPORTED; + +#if GFX_VIDEO_SC1200 + if (gfx_video_type == GFX_VIDEO_TYPE_SC1200) + status = sc1200_get_vertical_scaler_offset(offset); +#endif + return (status); +} + +/*--------------------------------------------------------------------------- + * gfx_get_genlock_delay + *--------------------------------------------------------------------------- + */ +unsigned long +gfx_get_genlock_delay(void) +{ + unsigned long delay = (unsigned long)GFX_STATUS_UNSUPPORTED; + +#if GFX_VIDEO_SC1200 + if (gfx_video_type == GFX_VIDEO_TYPE_SC1200) + delay = sc1200_get_genlock_delay(); +#endif + return (delay); +} + +/*--------------------------------------------------------------------------- + * gfx_get_genlock_enable + *--------------------------------------------------------------------------- + */ +int +gfx_get_genlock_enable(void) +{ + int enable = GFX_STATUS_UNSUPPORTED; + +#if GFX_VIDEO_SC1200 + if (gfx_video_type == GFX_VIDEO_TYPE_SC1200) + enable = sc1200_get_genlock_enable(); +#endif + return (enable); +} + +/*--------------------------------------------------------------------------- + * gfx_get_video_cursor + *--------------------------------------------------------------------------- + */ +int +gfx_get_video_cursor(unsigned long *key, unsigned long *mask, + unsigned short *select_color2, unsigned long *color1, + unsigned short *color2) +{ + int enable = GFX_STATUS_UNSUPPORTED; + +#if GFX_VIDEO_SC1200 + if (gfx_video_type == GFX_VIDEO_TYPE_SC1200) + enable = + sc1200_get_video_cursor(key, mask, select_color2, color1, color2); +#endif +#if GFX_VIDEO_REDCLOUD + if (gfx_video_type == GFX_VIDEO_TYPE_REDCLOUD) + enable = + redcloud_get_video_cursor(key, mask, select_color2, color1, + color2); +#endif + return (enable); +} + +/*--------------------------------------------------------------------------- + * gfx_read_crc + *--------------------------------------------------------------------------- + */ +unsigned long +gfx_read_crc(void) +{ + unsigned long crc = 0; + +#if GFX_VIDEO_CS5530 + if (gfx_video_type == GFX_VIDEO_TYPE_CS5530) + crc = cs5530_read_crc(); +#endif +#if GFX_VIDEO_SC1200 + if (gfx_video_type == GFX_VIDEO_TYPE_SC1200) + crc = sc1200_read_crc(); +#endif +#if GFX_VIDEO_REDCLOUD + if (gfx_video_type == GFX_VIDEO_TYPE_REDCLOUD) + crc = redcloud_read_crc(); +#endif + return (crc); +} + +/*--------------------------------------------------------------------------- + * gfx_read_crc32 + *--------------------------------------------------------------------------- + */ +unsigned long +gfx_read_crc32(void) +{ + unsigned long crc = 0; + +#if GFX_VIDEO_REDCLOUD + if (gfx_video_type == GFX_VIDEO_TYPE_REDCLOUD) + crc = redcloud_read_crc32(); +#endif + return (crc); +} + +/*--------------------------------------------------------------------------- + * gfx_read_window_crc + *--------------------------------------------------------------------------- + */ +unsigned long +gfx_read_window_crc(int source, unsigned short x, unsigned short y, + unsigned short width, unsigned short height, int crc32) +{ + unsigned long crc = 0; + +#if GFX_VIDEO_REDCLOUD + if (gfx_video_type == GFX_VIDEO_TYPE_REDCLOUD) + crc = redcloud_read_window_crc(source, x, y, width, height, crc32); +#endif + return (crc); +} + +/*----------------------------------------------------------------------------- + * gfx_get_macrovision_enable + *----------------------------------------------------------------------------- + */ +int +gfx_get_macrovision_enable(void) +{ + int enable = 0; + +#if GFX_VIDEO_SC1200 + if (gfx_video_type == GFX_VIDEO_TYPE_SC1200) + enable = sc1200_get_video_enable(); +#endif + return (enable); +} + +/*--------------------------------------------------------------------------- + * gfx_get_alpha_enable + *--------------------------------------------------------------------------- + */ +void +gfx_get_alpha_enable(int *enable) +{ +#if GFX_VIDEO_SC1200 + if (gfx_video_type == GFX_VIDEO_TYPE_SC1200) + sc1200_get_alpha_enable(enable); +#endif +#if GFX_VIDEO_REDCLOUD + if (gfx_video_type == GFX_VIDEO_TYPE_REDCLOUD) + redcloud_get_alpha_enable(enable); +#endif + return; +} + +/*--------------------------------------------------------------------------- + * gfx_get_alpha_size + *--------------------------------------------------------------------------- + */ +void +gfx_get_alpha_size(unsigned short *x, unsigned short *y, + unsigned short *width, unsigned short *height) +{ +#if GFX_VIDEO_SC1200 + if (gfx_video_type == GFX_VIDEO_TYPE_SC1200) + sc1200_get_alpha_size(x, y, width, height); +#endif +#if GFX_VIDEO_REDCLOUD + if (gfx_video_type == GFX_VIDEO_TYPE_REDCLOUD) + redcloud_get_alpha_size(x, y, width, height); +#endif + return; +} + +/*--------------------------------------------------------------------------- + * gfx_get_alpha_value + *--------------------------------------------------------------------------- + */ +void +gfx_get_alpha_value(unsigned char *alpha, char *delta) +{ +#if GFX_VIDEO_SC1200 + if (gfx_video_type == GFX_VIDEO_TYPE_SC1200) + sc1200_get_alpha_value(alpha, delta); +#endif +#if GFX_VIDEO_REDCLOUD + if (gfx_video_type == GFX_VIDEO_TYPE_REDCLOUD) + redcloud_get_alpha_value(alpha, delta); +#endif + return; +} + +/*--------------------------------------------------------------------------- + * gfx_get_alpha_priority + *--------------------------------------------------------------------------- + */ +void +gfx_get_alpha_priority(int *priority) +{ +#if GFX_VIDEO_SC1200 + if (gfx_video_type == GFX_VIDEO_TYPE_SC1200) + sc1200_get_alpha_priority(priority); +#endif +#if GFX_VIDEO_REDCLOUD + if (gfx_video_type == GFX_VIDEO_TYPE_REDCLOUD) + redcloud_get_alpha_priority(priority); +#endif + return; +} + +/*--------------------------------------------------------------------------- + * gfx_get_alpha_color + *--------------------------------------------------------------------------- + */ +void +gfx_get_alpha_color(unsigned long *color) +{ +#if GFX_VIDEO_SC1200 + if (gfx_video_type == GFX_VIDEO_TYPE_SC1200) + sc1200_get_alpha_color(color); +#endif +#if GFX_VIDEO_REDCLOUD + if (gfx_video_type == GFX_VIDEO_TYPE_REDCLOUD) + redcloud_get_alpha_color(color); +#endif + return; +} + +#endif /* GFX_READ_ROUTINES */ + +#endif /* GFX_VIDEO_DYNAMIC */ + +/* END OF FILE */ diff --git a/driver/xf86-video-geode/src/gfx/gfx_vip.c b/driver/xf86-video-geode/src/gfx/gfx_vip.c new file mode 100644 index 000000000..e38c2f7d5 --- /dev/null +++ b/driver/xf86-video-geode/src/gfx/gfx_vip.c @@ -0,0 +1,531 @@ +/* Copyright (c) 2005 Advanced Micro Devices, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + * + * Neither the name of the Advanced Micro Devices, Inc. nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * */ + +/* + * This file contains routines to control the video input port (VIP). + * + * gfx_set_vip_enable + * gfx_set_vip_capture_run_mode + * gfx_set_vip_base + * gfx_set_vip_pitch + * gfx_set_vip_mode + * gfx_set_vbi_enable + * gfx_set_vbi_mode + * gfx_set_vbi_base + * gfx_set_vbi_pitch + * gfx_set_vbi_direct + * gfx_set_vbi_interrupt + * gfx_set_vip_bus_request_threshold_high + * gfx_set_vip_last_line + * gfx_test_vip_odd_field + * gfx_test_vip_bases_updated + * gfx_test_vip_fifo_overflow + * gfx_get_vip_line + * gfx_get_vip_base + * gfx_get_vbi_pitch + * + * And the following routines if GFX_READ_ROUTINES is set: + * + * gfx_get_vip_enable + * gfx_get_vip_pitch + * gfx_get_vip_mode + * gfx_get_vbi_enable + * gfx_get_vbi_mode + * gfx_get_vbi_base + * gfx_get_vbi_direct + * gfx_get_vbi_interrupt + * gfx_get_vip_bus_request_threshold_high + * */ + +/* INCLUDE SUPPORT FOR SC1200, IF SPECIFIED. */ + +#if GFX_VIP_SC1200 +#include "vip_1200.c" +#endif + +/* WRAPPERS IF DYNAMIC SELECTION */ +/* Extra layer to call either CS5530 or SC1200 routines. */ + +#if GFX_VIP_DYNAMIC + +/*--------------------------------------------------------------------------- + * gfx_set_vip_enable + *---------------------------------------------------------------------------- + */ +int +gfx_set_vip_enable(int enable) +{ + int status = GFX_STATUS_UNSUPPORTED; + +#if GFX_VIP_SC1200 + if (gfx_vip_type == GFX_VIP_TYPE_SC1200) + status = sc1200_set_vip_enable(enable); +#endif + return (status); +} + +/*---------------------------------------------------------------------------- + * gfx_set_vip_capture_run_mode + *---------------------------------------------------------------------------- + */ +int +gfx_set_vip_capture_run_mode(int mode) +{ + int status = GFX_STATUS_UNSUPPORTED; + +#if GFX_VIP_SC1200 + if (gfx_vip_type == GFX_VIP_TYPE_SC1200) + status = sc1200_set_vip_capture_run_mode(mode); +#endif + return (status); +} + +/*---------------------------------------------------------------------------- + * gfx_set_vip_base + *---------------------------------------------------------------------------- + */ +int +gfx_set_vip_base(unsigned long even, unsigned long odd) +{ + int status = GFX_STATUS_UNSUPPORTED; + +#if GFX_VIP_SC1200 + if (gfx_vip_type == GFX_VIP_TYPE_SC1200) + status = sc1200_set_vip_base(even, odd); +#endif + return (status); +} + +/*---------------------------------------------------------------------------- + * gfx_set_vip_pitch + *---------------------------------------------------------------------------- + */ +int +gfx_set_vip_pitch(unsigned long pitch) +{ + int status = GFX_STATUS_UNSUPPORTED; + +#if GFX_VIP_SC1200 + if (gfx_vip_type == GFX_VIP_TYPE_SC1200) + status = sc1200_set_vip_pitch(pitch); +#endif + return (status); +} + +/*---------------------------------------------------------------------------- + * gfx_set_vip_mode + *---------------------------------------------------------------------------- + */ +int +gfx_set_vip_mode(int mode) +{ + int status = GFX_STATUS_UNSUPPORTED; + +#if GFX_VIP_SC1200 + if (gfx_vip_type == GFX_VIP_TYPE_SC1200) + status = sc1200_set_vip_mode(mode); +#endif + return (status); +} + +/*---------------------------------------------------------------------------- + * gfx_set_vbi_enable + *---------------------------------------------------------------------------- + */ +int +gfx_set_vbi_enable(int enable) +{ + int status = GFX_STATUS_UNSUPPORTED; + +#if GFX_VIP_SC1200 + if (gfx_vip_type == GFX_VIP_TYPE_SC1200) + status = sc1200_set_vbi_enable(enable); +#endif + return (status); +} + +/*---------------------------------------------------------------------------- + * gfx_set_vbi_mode + *---------------------------------------------------------------------------- + */ +int +gfx_set_vbi_mode(int mode) +{ + int status = GFX_STATUS_UNSUPPORTED; + +#if GFX_VIP_SC1200 + if (gfx_vip_type == GFX_VIP_TYPE_SC1200) + status = sc1200_set_vbi_mode(mode); +#endif + return (status); +} + +/*---------------------------------------------------------------------------- + * gfx_set_vbi_base + *---------------------------------------------------------------------------- + */ +int +gfx_set_vbi_base(unsigned long even, unsigned long odd) +{ + int status = GFX_STATUS_UNSUPPORTED; + +#if GFX_VIP_SC1200 + if (gfx_vip_type == GFX_VIP_TYPE_SC1200) + status = sc1200_set_vbi_base(even, odd); +#endif + return (status); +} + +/*---------------------------------------------------------------------------- + * gfx_set_vbi_pitch + *---------------------------------------------------------------------------- + */ +int +gfx_set_vbi_pitch(unsigned long pitch) +{ + int status = GFX_STATUS_UNSUPPORTED; + +#if GFX_VIP_SC1200 + if (gfx_vip_type == GFX_VIP_TYPE_SC1200) + status = sc1200_set_vbi_pitch(pitch); +#endif + return (status); +} + +/*---------------------------------------------------------------------------- + * gfx_set_vbi_direct + *---------------------------------------------------------------------------- + */ +int +gfx_set_vbi_direct(unsigned long even_lines, unsigned long odd_lines) +{ + int status = GFX_STATUS_UNSUPPORTED; + +#if GFX_VIP_SC1200 + if (gfx_vip_type == GFX_VIP_TYPE_SC1200) + status = sc1200_set_vbi_direct(even_lines, odd_lines); +#endif + return (status); +} + +/*---------------------------------------------------------------------------- + * gfx_set_vbi_interrupt + *---------------------------------------------------------------------------- + */ +int +gfx_set_vbi_interrupt(int enable) +{ + int status = GFX_STATUS_UNSUPPORTED; + +#if GFX_VIP_SC1200 + if (gfx_vip_type == GFX_VIP_TYPE_SC1200) + status = sc1200_set_vbi_interrupt(enable); +#endif + return (status); +} + +/*---------------------------------------------------------------------------- + * gfx_set_vip_bus_request_threshold_high + *---------------------------------------------------------------------------- + */ +int +gfx_set_vip_bus_request_threshold_high(int enable) +{ + int status = GFX_STATUS_UNSUPPORTED; + +#if GFX_VIP_SC1200 + if (gfx_vip_type == GFX_VIP_TYPE_SC1200) + status = sc1200_set_vip_bus_request_threshold_high(enable); +#endif + return (status); +} + +/*---------------------------------------------------------------------------- + * gfx_set_vip_last_line + *---------------------------------------------------------------------------- + */ +int +gfx_set_vip_last_line(int last_line) +{ + int status = GFX_STATUS_UNSUPPORTED; + +#if GFX_VIP_SC1200 + if (gfx_vip_type == GFX_VIP_TYPE_SC1200) + status = sc1200_set_vip_last_line(last_line); +#endif + return (status); +} + +/*---------------------------------------------------------------------------- + * gfx_test_vip_odd_field + *---------------------------------------------------------------------------- + */ +int +gfx_test_vip_odd_field(void) +{ + int status = GFX_STATUS_UNSUPPORTED; + +#if GFX_VIP_SC1200 + if (gfx_vip_type == GFX_VIP_TYPE_SC1200) + status = sc1200_test_vip_odd_field(); +#endif + return (status); +} + +/*---------------------------------------------------------------------------- + * gfx_test_vip_bases_updated + *---------------------------------------------------------------------------- + */ +int +gfx_test_vip_bases_updated(void) +{ + int status = GFX_STATUS_UNSUPPORTED; + +#if GFX_VIP_SC1200 + if (gfx_vip_type == GFX_VIP_TYPE_SC1200) + status = sc1200_test_vip_bases_updated(); +#endif + return (status); +} + +/*---------------------------------------------------------------------------- + * gfx_test_vip_fifo_overflow + *---------------------------------------------------------------------------- + */ +int +gfx_test_vip_fifo_overflow(void) +{ + int status = GFX_STATUS_UNSUPPORTED; + +#if GFX_VIP_SC1200 + if (gfx_vip_type == GFX_VIP_TYPE_SC1200) + status = sc1200_test_vip_fifo_overflow(); +#endif + return (status); +} + +/*---------------------------------------------------------------------------- + * gfx_get_vip_line + *---------------------------------------------------------------------------- + */ +int +gfx_get_vip_line(void) +{ + int status = GFX_STATUS_UNSUPPORTED; + +#if GFX_VIP_SC1200 + if (gfx_vip_type == GFX_VIP_TYPE_SC1200) + status = sc1200_get_vip_line(); +#endif + return (status); +} + +/*---------------------------------------------------------------------------- + * gfx_get_vip_base + *---------------------------------------------------------------------------- + */ +unsigned long +gfx_get_vip_base(int odd) +{ + unsigned long base = 0; + +#if GFX_VIP_SC1200 + if (gfx_vip_type == GFX_VIP_TYPE_SC1200) + base = sc1200_get_vip_base(odd); +#endif + return (base); +} + +/*---------------------------------------------------------------------------- + * gfx_get_vbi_pitch + *---------------------------------------------------------------------------- + */ +unsigned long +gfx_get_vbi_pitch(void) +{ + unsigned long pitch = 0; + +#if GFX_VIP_SC1200 + if (gfx_vip_type == GFX_VIP_TYPE_SC1200) + pitch = sc1200_get_vbi_pitch(); +#endif + return (pitch); +} + +/*************************************************************/ +/* READ ROUTINES | INCLUDED FOR DIAGNOSTIC PURPOSES ONLY */ +/*************************************************************/ + +#if GFX_READ_ROUTINES + +/*---------------------------------------------------------------------------- + * gfx_get_vip_enable + *---------------------------------------------------------------------------- + */ +int +gfx_get_vip_enable(void) +{ + int enable = 0; + +#if GFX_VIP_SC1200 + if (gfx_vip_type == GFX_VIP_TYPE_SC1200) + enable = sc1200_get_vip_enable(); +#endif + return (enable); +} + +/*---------------------------------------------------------------------------- + * gfx_get_vip_pitch + *---------------------------------------------------------------------------- + */ +unsigned long +gfx_get_vip_pitch(void) +{ + unsigned long pitch = 0; + +#if GFX_VIP_SC1200 + if (gfx_vip_type == GFX_VIP_TYPE_SC1200) + pitch = sc1200_get_vip_pitch(); +#endif + return (pitch); +} + +/*---------------------------------------------------------------------------- + * gfx_get_vip_mode + *---------------------------------------------------------------------------- + */ +int +gfx_get_vip_mode(void) +{ + int mode = 0; + +#if GFX_VIP_SC1200 + if (gfx_vip_type == GFX_VIP_TYPE_SC1200) + mode = sc1200_get_vip_mode(); +#endif + return (mode); +} + +/*---------------------------------------------------------------------------- + * gfx_get_vbi_enable + *---------------------------------------------------------------------------- + */ +int +gfx_get_vbi_enable(void) +{ + int enable = 0; + +#if GFX_VIP_SC1200 + if (gfx_vip_type == GFX_VIP_TYPE_SC1200) + enable = sc1200_get_vbi_enable(); +#endif + return (enable); +} + +/*---------------------------------------------------------------------------- + * gfx_get_vbi_mode + *---------------------------------------------------------------------------- + */ +int +gfx_get_vbi_mode(void) +{ + int mode = 0; + +#if GFX_VIP_SC1200 + if (gfx_vip_type == GFX_VIP_TYPE_SC1200) + mode = sc1200_get_vbi_mode(); +#endif + return (mode); +} + +/*---------------------------------------------------------------------------- + * gfx_get_vbi_base + *---------------------------------------------------------------------------- + */ +unsigned long +gfx_get_vbi_base(int odd) +{ + unsigned long base = 0; + +#if GFX_VIP_SC1200 + if (gfx_vip_type == GFX_VIP_TYPE_SC1200) + base = sc1200_get_vbi_base(odd); +#endif + return (base); +} + +/*---------------------------------------------------------------------------- + * gfx_get_vbi_direct + *---------------------------------------------------------------------------- + */ +unsigned long +gfx_get_vbi_direct(int odd) +{ + unsigned long vbi_direct_lines = 0; + +#if GFX_VIP_SC1200 + if (gfx_vip_type == GFX_VIP_TYPE_SC1200) + vbi_direct_lines = sc1200_get_vbi_direct(odd); +#endif + return (vbi_direct_lines); +} + +/*---------------------------------------------------------------------------- + * gfx_get_vbi_interrupt + *---------------------------------------------------------------------------- + */ +int +gfx_get_vbi_interrupt(void) +{ + int enable = 0; + +#if GFX_VIP_SC1200 + if (gfx_vip_type == GFX_VIP_TYPE_SC1200) + enable = sc1200_get_vbi_interrupt(); +#endif + return (enable); +} + +/*---------------------------------------------------------------------------- + * gfx_get_vip_bus_request_threshold_high + *---------------------------------------------------------------------------- + */ +int +gfx_get_vip_bus_request_threshold_high(void) +{ + int enable = 0; + +#if GFX_VIP_SC1200 + if (gfx_vip_type == GFX_VIP_TYPE_SC1200) + enable = sc1200_get_vip_bus_request_threshold_high(); +#endif + return (enable); +} + +#endif /* GFX_READ_ROUTINES */ + +#endif /* GFX_VIP_DYNAMIC */ + +/* END OF FILE */ diff --git a/driver/xf86-video-geode/src/gfx/history.h b/driver/xf86-video-geode/src/gfx/history.h new file mode 100644 index 000000000..ccb8d6a13 --- /dev/null +++ b/driver/xf86-video-geode/src/gfx/history.h @@ -0,0 +1,33 @@ +/* Copyright (c) 2005 Advanced Micro Devices, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + * + * Neither the name of the Advanced Micro Devices, Inc. nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * */ + +/* Version is in the format of MMmmpp + * where in MM is the Major version, mm is the minor version + * and pp is the patch number (0 - 99) + */ + +#define DURANGO_VERSION 30003 + +/* END OF FILE */ diff --git a/driver/xf86-video-geode/src/gfx/i2c_acc.c b/driver/xf86-video-geode/src/gfx/i2c_acc.c new file mode 100644 index 000000000..a45a2c3fb --- /dev/null +++ b/driver/xf86-video-geode/src/gfx/i2c_acc.c @@ -0,0 +1,876 @@ +/* Copyright (c) 2005 Advanced Micro Devices, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + * + * Neither the name of the Advanced Micro Devices, Inc. nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * */ + +/* + * This file contains routines to write to and read from the I2C bus using + * the ACCESS.bus hardware in the SC1200. + * */ + +/* SUPER IO DEFINITIONS */ + +#define INDEX_1 0x15C /* base address 1 selected */ +#define DATA_1 0x15D +#define INDEX_2 0x2E /* base address 2 selected */ +#define DATA_2 0x2F +#define PCI_INDEX 0xCF8 /* PCI configuration space INDEX */ +#define PCI_DATA 0xCFC /* PCI configuration space DATA */ +#define BASE_ADR_MSB_REG 0x60 /* base address MSB register */ +#define BASE_ADR_LSB_REG 0x61 /* base address LSB register */ + +#define SIO_BASE_ADR_15C_15D 0x6000000 +#define SIO_BASE_ADR_2E_2F 0x4000000 + +/* SUPER IO GLOBALS */ + +unsigned short index_reg, data_reg; + +/* ACCESS BUS DEFINITIONS */ + +#define ACC_I2C_TIMEOUT 1000000 /* Number of reads before timing out */ +#define ACB1_BASE 0x810 /* ACCESS.bus base addresses */ +#define ACB2_BASE 0x820 +#define ACBSDA 0 /* ACB serial data */ +#define ACBST 1 /* ACB status */ +#define ACBCST 2 /* ACB control status */ +#define ACBCTL1 3 /* ACB control 1 */ +#define ACBADDR 4 /* ACB own address */ +#define ACBCTL2 5 /* ACB control 2 */ +#define LDN 0x7 /* Logical Device Numbers */ +#define ACB1_LDN 0x5 +#define ACB2_LDN 0x6 + +/* INITIAL ACCESS.bus BASE ADDRESS VALUES */ + +unsigned short base_address_array[3] = { 0, ACB1_BASE, ACB2_BASE }; +char Freq = 0x71; + +/* LOCAL ACCESS.bus FUNCTION DECLARATIONS */ + +void acc_i2c_start(unsigned char busnum); +void acc_i2c_stop(unsigned char busnum); +void acc_i2c_abort_data(unsigned char busnum); +void acc_i2c_bus_recovery(unsigned char busnum); +void acc_i2c_stall_after_start(unsigned char busnum, int state); +void acc_i2c_send_address(unsigned char busnum, unsigned char cData); +int acc_i2c_ack(unsigned char busnum, int fPut, int negAck); +void acc_i2c_stop_clock(unsigned char busnum); +void acc_i2c_activate_clock(unsigned char busnum); +void acc_i2c_write_byte(unsigned char busnum, unsigned char cData); +unsigned char acc_i2c_read_byte(unsigned char busnum, int last_byte); +void acc_i2c_reset_bus(unsigned char busnum); +int acc_i2c_request_master(unsigned char busnum); +void acc_i2c_config(unsigned char busnum, short adr, char freq); +char acc_i2c_set_freq(unsigned char busnum, char freq); +unsigned short acc_i2c_set_base_address(unsigned char busnum, short adr); + +/* LOCAL HELPER ROUTINES */ + +void OsPciReadDWord(int bus, int dev, int func, int address, + unsigned long *data); +int sio_set_index_data_reg(void); +void sio_write_reg(unsigned char reg, unsigned char data); +unsigned char sio_read_reg(unsigned char reg); + +/*--------------------------------------------------------------------------- + * OsPciReadDWord + * + * This routine reads one double word from the PCI configuration header + * defined by 'bus', 'dev', 'func' and 'address' to the double word + * pointed to by 'data'. + * + * Returns : None. + *--------------------------------------------------------------------------- + */ +void +OsPciReadDWord(int bus, int dev, int func, int address, unsigned long *data) +{ + /* + * The address of a double word in the Configuration Header is built in + * the following way : + * {10000000,bus[23:16],device[15:11],function[10:8],address[7:2],00} + */ + long addr = (0x80000000 | + ((bus & 0xff) << 16) | + ((dev & 0x1f) << 11) | ((func & 0x7) << 8) | (address & 0xff)); + OUTD(PCI_INDEX, addr); + *data = IND(PCI_DATA); +} + +/*--------------------------------------------------------------------------- + * sio_set_index_data_reg + * + * This routine checks which index and data registers to use + * in order to access the Super I/O registers + * + * Returns : 1 - OK + * 0 - Super I/O disabled or configuration access disabled + *--------------------------------------------------------------------------- + */ +int +sio_set_index_data_reg(void) +{ + unsigned long xbus_expention_bar, io_control_reg1; + + OsPciReadDWord(0, 0x12, 5, 0x10, &xbus_expention_bar); + xbus_expention_bar = xbus_expention_bar & 0xfffffffe; + io_control_reg1 = IND((unsigned short)xbus_expention_bar); + + if ((io_control_reg1) & (SIO_BASE_ADR_15C_15D)) { + index_reg = INDEX_1; + data_reg = DATA_1; + return (1); + } + + if ((io_control_reg1) & (SIO_BASE_ADR_2E_2F)) { + index_reg = INDEX_2; + data_reg = DATA_2; + return (1); + } + + return (0); +} + +/*--------------------------------------------------------------------------- + * sio_write_reg + * + * This routine writes 'data' to 'reg' Super I/O register + * + * Returns : None + *--------------------------------------------------------------------------- + */ +void +sio_write_reg(unsigned char reg, unsigned char data) +{ + OUTB(index_reg, reg); + OUTB(data_reg, data); +} + +/*--------------------------------------------------------------------------- + * sio_read_reg + * + * This routine reads data from 'reg' Super I/O register + * + * Returns : The data read from the requested register + *--------------------------------------------------------------------------- + */ +unsigned char +sio_read_reg(unsigned char reg) +{ + OUTB(index_reg, reg); + return INB(data_reg); +} + +/*--------------------------------------------------------------------------- + * gfx_i2c_reset + * + * This routine resets the I2C bus as follows : + * · Sets the base address of the ACCESS.bus + * · Sets the frequency of the ACCESS.bus + * · Resets the ACCESS.bus + * + * If 'adr' is -1 the address is read from the hardware. + * If 'freq' is -1 the frequency is set to 56 clock cycles. + *--------------------------------------------------------------------------- + */ +#if GFX_I2C_DYNAMIC +int +acc_i2c_reset(unsigned char busnum, short adr, char freq) +#else +int +gfx_i2c_reset(unsigned char busnum, short adr, char freq) +#endif +{ + if ((busnum != 1) && (busnum != 2)) + return GFX_STATUS_BAD_PARAMETER; + acc_i2c_config(busnum, adr, freq); + if (base_address_array[busnum] == 0) + return GFX_STATUS_ERROR; + acc_i2c_reset_bus(busnum); + return GFX_STATUS_OK; +} + +/*--------------------------------------------------------------------------- + * gfx_i2c_select_gpio + * + * This routine selects which GPIO pins to use. + *--------------------------------------------------------------------------- + */ +#if GFX_I2C_DYNAMIC +int +acc_i2c_select_gpio(int clock, int data) +#else +int +gfx_i2c_select_gpio(int clock, int data) +#endif +{ + /* THIS ROUTINE DOES NOT APPLY TO THE ACCESS.bus IMPLEMENTATION. */ + + return (GFX_STATUS_OK); +} + +/*--------------------------------------------------------------------------- + * gfx_i2c_write + * + * This routine writes data to the specified I2C address. + * busnum - ACCESS.bus number (1 or 2). + *--------------------------------------------------------------------------- + */ +#if GFX_I2C_DYNAMIC +int +acc_i2c_write(unsigned char busnum, unsigned char chipadr, + unsigned char subadr, unsigned char bytes, unsigned char *data) +#else +int +gfx_i2c_write(unsigned char busnum, unsigned char chipadr, + unsigned char subadr, unsigned char bytes, unsigned char *data) +#endif +{ + int loop = 0; + + if ((busnum != 1) && (busnum != 2)) + return GFX_STATUS_BAD_PARAMETER; + + /* REQUEST MASTER */ + + if (!acc_i2c_request_master(busnum)) + return (GFX_STATUS_ERROR); + + /* WRITE ADDRESS COMMAND */ + + acc_i2c_ack(busnum, 1, 0); + acc_i2c_stall_after_start(busnum, 1); + acc_i2c_send_address(busnum, (unsigned char)(chipadr & 0xFE)); + acc_i2c_stall_after_start(busnum, 0); + if (!acc_i2c_ack(busnum, 0, 0)) + return (GFX_STATUS_ERROR); + + /* WRITE COMMAND */ + + acc_i2c_write_byte(busnum, subadr); + if (!acc_i2c_ack(busnum, 0, 0)) + return (GFX_STATUS_ERROR); + + /* WRITE DATA */ + + for (loop = 0; loop < bytes; loop++) { + acc_i2c_write_byte(busnum, *data); + if (loop < (bytes - 1)) + data += sizeof(unsigned char); + if (!acc_i2c_ack(busnum, 0, 0)) + return (GFX_STATUS_ERROR); + } + data -= (bytes - 1); + acc_i2c_stop(busnum); + + return GFX_STATUS_OK; +} + +/*--------------------------------------------------------------------------- + * gfx_i2c_read + * + * This routine reads data from the specified I2C address. + * busnum - ACCESS.bus number (1 or 2). + *--------------------------------------------------------------------------- + */ +#if GFX_I2C_DYNAMIC +int +acc_i2c_read(unsigned char busnum, unsigned char chipadr, + unsigned char subadr, unsigned char bytes, unsigned char *data) +#else +int +gfx_i2c_read(unsigned char busnum, unsigned char chipadr, + unsigned char subadr, unsigned char bytes, unsigned char *data) +#endif +{ + unsigned char bytesRead; + + if ((busnum != 1) && (busnum != 2)) + return GFX_STATUS_BAD_PARAMETER; + + if (bytes == 0) + return GFX_STATUS_OK; + + /* REQUEST MASTER */ + + if (!acc_i2c_request_master(busnum)) + return (GFX_STATUS_ERROR); + + /* WRITE ADDRESS COMMAND */ + + acc_i2c_ack(busnum, 1, 0); + acc_i2c_stall_after_start(busnum, 1); + acc_i2c_send_address(busnum, (unsigned char)(chipadr & 0xFE)); + acc_i2c_stall_after_start(busnum, 0); + if (!acc_i2c_ack(busnum, 0, 0)) + return (GFX_STATUS_ERROR); + + /* WRITE COMMAND */ + + acc_i2c_write_byte(busnum, subadr); + if (!acc_i2c_ack(busnum, 0, 0)) + return (GFX_STATUS_ERROR); + + /* START THE READ */ + + acc_i2c_start(busnum); + + /* WRITE ADDRESS COMMAND */ + + acc_i2c_ack(busnum, 1, 1); + acc_i2c_stall_after_start(busnum, 1); + acc_i2c_send_address(busnum, (unsigned char)(chipadr | 0x01)); + + /* IF LAST BYTE */ + + if (bytes == 1) + acc_i2c_ack(busnum, 1, 1); + else + acc_i2c_ack(busnum, 1, 0); + + acc_i2c_stall_after_start(busnum, 0); + + if (!acc_i2c_ack(busnum, 0, 0)) + return (GFX_STATUS_ERROR); + + /* READ COMMAND */ + + for (bytesRead = 0; bytesRead < bytes; bytesRead += 1) { + if (bytesRead < (bytes - 2)) { + data[bytesRead] = acc_i2c_read_byte(busnum, 0); + acc_i2c_ack(busnum, 1, 0); + } else if (bytesRead == (bytes - 2)) { /* TWO BYTES LEFT */ + acc_i2c_ack(busnum, 1, 1); + data[bytesRead] = acc_i2c_read_byte(busnum, 0); + acc_i2c_ack(busnum, 1, 1); + } else { /* LAST BYTE */ + + data[bytesRead] = acc_i2c_read_byte(busnum, 1); + acc_i2c_stop(busnum); + } + + /* WHILE NOT LAST BYTE */ + + if ((!(bytesRead == (bytes - 1))) && (!acc_i2c_ack(busnum, 0, 0))) + return (bytesRead); + } + + return GFX_STATUS_OK; +} + +/*--------------------------------------------------------------------------- + * gfx_i2c_init + * + * This routine initializes the use of the ACCESS.BUS. + *--------------------------------------------------------------------------- + */ +#if GFX_I2C_DYNAMIC +int +acc_i2c_init(void) +#else +int +gfx_i2c_init(void) +#endif +{ + /* ### ADD ### THIS ROUTINE IS NOT YET IMPLEMENTED FOR ACCESS.bus */ + return (GFX_STATUS_OK); +} + +/*--------------------------------------------------------------------------- + * gfx_i2c_cleanup + * + * This routine ends the use of the ACCESS.BUS. + *--------------------------------------------------------------------------- + */ +#if GFX_I2C_DYNAMIC +void +acc_i2c_cleanup(void) +#else +void +gfx_i2c_cleanup(void) +#endif +{ + /* ### ADD ### THIS ROUTINE IS NOT YET IMPLEMENTED FOR ACCESS.bus */ +} + +/*--------------------------------------------------------*/ +/* LOCAL ROUTINES SPECIFIC TO ACCESS.bus IMPLEMENTATION */ +/*--------------------------------------------------------*/ + +/*--------------------------------------------------------------------------- + * acc_i2c_reset_bus + * + * This routine resets the I2C bus. + *--------------------------------------------------------------------------- + */ +void +acc_i2c_reset_bus(unsigned char busnum) +{ + unsigned char reg; + unsigned short bus_base_address = base_address_array[busnum]; + + /* Disable the ACCESS.bus device and */ + /* Configure the SCL frequency */ + OUTB((unsigned short)(bus_base_address + ACBCTL2), + (unsigned char)(Freq & 0xFE)); + + /* Configure no interrupt mode (polling) and */ + /* Disable global call address */ + OUTB((unsigned short)(bus_base_address + ACBCTL1), 0x0); + + /* Disable slave address */ + OUTB((unsigned short)(bus_base_address + ACBADDR), 0x0); + + /* Enable the ACCESS.bus device */ + reg = INB((unsigned short)(bus_base_address + ACBCTL2)); + reg |= 0x01; + OUTB((unsigned short)(bus_base_address + ACBCTL2), reg); + + /* Issue STOP event */ + + acc_i2c_stop(busnum); + + /* Clear NEGACK, STASTR and BER bits */ + OUTB((unsigned short)(bus_base_address + ACBST), 0x38); + + /* Clear BB (BUS BUSY) bit */ + reg = INB((unsigned short)(bus_base_address + ACBCST)); + reg |= 0x02; + OUTB((unsigned short)(bus_base_address + ACBCST), reg); +} + +/*--------------------------------------------------------------------------- + * acc_i2c_start + * + * This routine starts a transfer on the I2C bus. + *--------------------------------------------------------------------------- + */ +void +acc_i2c_start(unsigned char busnum) +{ + unsigned char reg; + unsigned short bus_base_address = base_address_array[busnum]; + + reg = INB((unsigned short)(bus_base_address + ACBCTL1)); + reg |= 0x01; + OUTB((unsigned short)(bus_base_address + ACBCTL1), reg); +} + +/*--------------------------------------------------------------------------- + * acc_i2c_stop + * + * This routine stops a transfer on the I2C bus. + *--------------------------------------------------------------------------- + */ +void +acc_i2c_stop(unsigned char busnum) +{ + unsigned char reg; + unsigned short bus_base_address = base_address_array[busnum]; + + reg = INB((unsigned short)(bus_base_address + ACBCTL1)); + reg |= 0x02; + OUTB((unsigned short)(bus_base_address + ACBCTL1), reg); +} + +/*--------------------------------------------------------------------------- + * acc_i2c_abort_data + *--------------------------------------------------------------------------- + */ +void +acc_i2c_abort_data(unsigned char busnum) +{ + unsigned char reg; + unsigned short bus_base_address = base_address_array[busnum]; + + acc_i2c_stop(busnum); + reg = INB((unsigned short)(bus_base_address + ACBCTL1)); + reg |= 0x10; + OUTB((unsigned short)(bus_base_address + ACBCTL1), reg); +} + +/*--------------------------------------------------------------------------- + * acc_i2c_bus_recovery + *--------------------------------------------------------------------------- + */ +void +acc_i2c_bus_recovery(unsigned char busnum) +{ + acc_i2c_abort_data(busnum); + acc_i2c_reset_bus(busnum); +} + +/*--------------------------------------------------------------------------- + * acc_i2c_stall_after_start + *--------------------------------------------------------------------------- + */ +void +acc_i2c_stall_after_start(unsigned char busnum, int state) +{ + unsigned char reg; + unsigned short bus_base_address = base_address_array[busnum]; + + reg = INB((unsigned short)(bus_base_address + ACBCTL1)); + if (state) + reg |= 0x80; + else + reg &= 0x7F; + OUTB((unsigned short)(bus_base_address + ACBCTL1), reg); + + if (!state) { + reg = INB((unsigned short)(bus_base_address + ACBST)); + reg |= 0x08; + OUTB((unsigned short)(bus_base_address + ACBST), reg); + } +} + +/*--------------------------------------------------------------------------- + * acc_i2c_send_address + *--------------------------------------------------------------------------- + */ +void +acc_i2c_send_address(unsigned char busnum, unsigned char cData) +{ + unsigned char reg; + unsigned short bus_base_address = base_address_array[busnum]; + unsigned long timeout = 0; + + /* WRITE THE DATA */ + + OUTB((unsigned short)(bus_base_address + ACBSDA), cData); + while (1) { + reg = INB((unsigned short)(bus_base_address + ACBST)); + if ((reg & 0x38) != 0) /* check STASTR, BER and NEGACK */ + break; + if (timeout++ == ACC_I2C_TIMEOUT) { + acc_i2c_bus_recovery(busnum); + return; + } + } + + /* CHECK FOR BUS ERROR */ + + if (reg & 0x20) { + acc_i2c_bus_recovery(busnum); + return; + } + + /* CHECK NEGATIVE ACKNOWLEDGE */ + + if (reg & 0x10) { + acc_i2c_abort_data(busnum); + return; + } + +} + +/*--------------------------------------------------------------------------- + * acc_i2c_ack + * + * This routine looks for acknowledge on the I2C bus. + *--------------------------------------------------------------------------- + */ +int +acc_i2c_ack(unsigned char busnum, int fPut, int negAck) +{ + unsigned char reg; + unsigned short bus_base_address = base_address_array[busnum]; + unsigned long timeout = 0; + + if (fPut) { /* read operation */ + if (!negAck) { + /* Push Ack onto I2C bus */ + reg = INB((unsigned short)(bus_base_address + ACBCTL1)); + reg &= 0xE7; + OUTB((unsigned short)(bus_base_address + ACBCTL1), reg); + } else { + /* Push negAck onto I2C bus */ + reg = INB((unsigned short)(bus_base_address + ACBCTL1)); + reg |= 0x10; + OUTB((unsigned short)(bus_base_address + ACBCTL1), reg); + } + } else { /* write operation */ + /* Receive Ack from I2C bus */ + while (1) { + reg = INB((unsigned short)(bus_base_address + ACBST)); + if ((reg & 0x70) != 0) /* check SDAST, BER and NEGACK */ + break; + if (timeout++ == ACC_I2C_TIMEOUT) { + acc_i2c_bus_recovery(busnum); + return (0); + } + } + + /* CHECK FOR BUS ERROR */ + + if (reg & 0x20) { + acc_i2c_bus_recovery(busnum); + return (0); + } + + /* CHECK NEGATIVE ACKNOWLEDGE */ + + if (reg & 0x10) { + acc_i2c_abort_data(busnum); + return (0); + } + } + return (1); +} + +/*--------------------------------------------------------------------------- + * acc_i2c_stop_clock + * + * This routine stops the ACCESS.bus clock. + *--------------------------------------------------------------------------- + */ +void +acc_i2c_stop_clock(unsigned char busnum) +{ + unsigned char reg; + unsigned short bus_base_address = base_address_array[busnum]; + + reg = INB((unsigned short)(bus_base_address + ACBCTL2)); + reg &= ~0x01; + OUTB((unsigned short)(bus_base_address + ACBCTL2), reg); +} + +/*--------------------------------------------------------------------------- + * acc_i2c_activate_clock + * + * This routine activates the ACCESS.bus clock. + *--------------------------------------------------------------------------- + */ +void +acc_i2c_activate_clock(unsigned char busnum) +{ + unsigned char reg; + unsigned short bus_base_address = base_address_array[busnum]; + + reg = INB((unsigned short)(bus_base_address + ACBCTL2)); + reg |= 0x01; + OUTB((unsigned short)(bus_base_address + ACBCTL2), reg); +} + +/*--------------------------------------------------------------------------- + * acc_i2c_write_byte + * + * This routine writes a byte to the I2C bus + *--------------------------------------------------------------------------- + */ +void +acc_i2c_write_byte(unsigned char busnum, unsigned char cData) +{ + unsigned char reg; + unsigned short bus_base_address = base_address_array[busnum]; + unsigned long timeout = 0; + + while (1) { + reg = INB((unsigned short)(bus_base_address + ACBST)); + if (reg & 0x70) + break; + if (timeout++ == ACC_I2C_TIMEOUT) { + acc_i2c_bus_recovery(busnum); + return; + } + } + + /* CHECK FOR BUS ERROR */ + + if (reg & 0x20) { + acc_i2c_bus_recovery(busnum); + return; + } + + /* CHECK NEGATIVE ACKNOWLEDGE */ + + if (reg & 0x10) { + acc_i2c_abort_data(busnum); + return; + } + + /* WRITE THE DATA */ + + OUTB((unsigned short)(bus_base_address + ACBSDA), cData); +} + +/*--------------------------------------------------------------------------- + * acc_i2c_read_byte + * + * This routine reads a byte from the I2C bus + *--------------------------------------------------------------------------- + */ +unsigned char +acc_i2c_read_byte(unsigned char busnum, int last_byte) +{ + unsigned char cData, reg; + unsigned short bus_base_address = base_address_array[busnum]; + unsigned long timeout = 0; + + while (1) { + reg = INB((unsigned short)(bus_base_address + ACBST)); + if (reg & 0x60) + break; + if (timeout++ == ACC_I2C_TIMEOUT) { + acc_i2c_bus_recovery(busnum); + return (0xEF); + } + } + + /* CHECK FOR BUS ERROR */ + + if (reg & 0x20) { + acc_i2c_bus_recovery(busnum); + return (0xEE); + } + + /* READ DATA */ + if (last_byte) + acc_i2c_stop_clock(busnum); + cData = INB((unsigned short)(bus_base_address + ACBSDA)); + if (last_byte) + acc_i2c_activate_clock(busnum); + + return (cData); +} + +/*--------------------------------------------------------------------------- + * acc_i2c_request_master + *--------------------------------------------------------------------------- + */ +int +acc_i2c_request_master(unsigned char busnum) +{ + unsigned char reg; + unsigned short bus_base_address = base_address_array[busnum]; + unsigned long timeout = 0; + + acc_i2c_start(busnum); + while (1) { + reg = INB((unsigned short)(bus_base_address + ACBST)); + if (reg & 0x60) + break; + if (timeout++ == ACC_I2C_TIMEOUT) { + acc_i2c_bus_recovery(busnum); + return (0); + } + } + + /* CHECK FOR BUS ERROR */ + + if (reg & 0x20) { + acc_i2c_abort_data(busnum); + return (0); + } + + /* CHECK NEGATIVE ACKNOWLEDGE */ + + if (reg & 0x10) { + acc_i2c_abort_data(busnum); + return (0); + } + return (1); +} + +/*--------------------------------------------------------*/ +/* LOCAL ROUTINES SPECIFIC TO ACCESS.bus INITIALIZATION */ +/*--------------------------------------------------------*/ + +/*---------------------------------------------------------------------------- + * acc_i2c_config + * + * This routine configures the I2C bus + *---------------------------------------------------------------------------- + */ +void +acc_i2c_config(unsigned char busnum, short adr, char freq) +{ + base_address_array[busnum] = acc_i2c_set_base_address(busnum, adr); + Freq = acc_i2c_set_freq(busnum, freq); +} + +/*---------------------------------------------------------------------------- + * acc_i2c_set_freq + * + * This routine sets the frequency of the I2C bus + *---------------------------------------------------------------------------- + */ +char +acc_i2c_set_freq(unsigned char busnum, char freq) +{ + unsigned short bus_base_address = base_address_array[busnum]; + + OUTB((unsigned short)(bus_base_address + ACBCTL2), 0x0); + + if (freq == -1) + freq = 0x71; + else { + freq = freq << 1; + freq |= 0x01; + } + + OUTB((unsigned short)(bus_base_address + ACBCTL2), freq); + return (freq); +} + +/*--------------------------------------------------------------------------- + * acc_i2c_set_base_address + * + * This routine sets the base address of the I2C bus + *--------------------------------------------------------------------------- + */ +unsigned short +acc_i2c_set_base_address(unsigned char busnum, short adr) +{ + unsigned short ab_base_addr; + + /* Get Super I/O Index and Data registers */ + if (!sio_set_index_data_reg()) + return (0); + + /* Configure LDN to current ACB */ + if (busnum == 1) + sio_write_reg(LDN, ACB1_LDN); + if (busnum == 2) + sio_write_reg(LDN, ACB2_LDN); + + if (adr == -1) { + /* Get ACCESS.bus base address */ + ab_base_addr = sio_read_reg(BASE_ADR_MSB_REG); + ab_base_addr = ab_base_addr << 8; + ab_base_addr |= sio_read_reg(BASE_ADR_LSB_REG); + if (ab_base_addr != 0) + return ab_base_addr; + else + adr = (busnum == 1 ? ACB1_BASE : ACB2_BASE); + } + + /* Set ACCESS.bus base address */ + sio_write_reg(BASE_ADR_LSB_REG, (unsigned char)(adr & 0xFF)); + sio_write_reg(BASE_ADR_MSB_REG, (unsigned char)(adr >> 8)); + + return adr; +} + +/* END OF FILE */ diff --git a/driver/xf86-video-geode/src/gfx/i2c_gpio.c b/driver/xf86-video-geode/src/gfx/i2c_gpio.c new file mode 100644 index 000000000..7614cd02d --- /dev/null +++ b/driver/xf86-video-geode/src/gfx/i2c_gpio.c @@ -0,0 +1,639 @@ +/* Copyright (c) 2005 Advanced Micro Devices, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + * + * Neither the name of the Advanced Micro Devices, Inc. nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * */ + +/* + * This file contains routines to write to and read from the I2C bus using + * the GPIO pins of the CS5530. + * */ + +/* STATIC VARIABLES TO STORE WHAT GPIO PINS TO USE */ + +int gpio_clock = 0; +int gpio_data = 0; + +static int g_initialized = 0; + +#define I2CWRITE 0x00 /* Write address */ +#define I2CREAD 0x01 /* Read address */ + +#define I2CACK 0x00 /* Ack value */ +#define I2CNACK 0x01 /* Not - ack value */ + +#define CS5530_ID (0x80000000 | (0x00<<16) | (0x12<<11) | (0<<8) | 0x00) +#define CS5530_GPIO (0x80000000 | (0x00<<16) | (0x12<<11) | (0<<8) | 0x90) +#define SDA 0x0800 +#define SCL 0x0400 +#define SDADIR 0x0008 +#define SCLDIR 0x0004 + +int I2C_init(void); +void I2C_cleanup(void); + +int I2C_Read(unsigned char address, unsigned int reg, unsigned long *p_value, + unsigned int bytes); +int I2C_Write(unsigned char address, unsigned int reg, unsigned long value, + unsigned int bytes); +int I2CAL_init(void); +void I2CAL_cleanup(void); + +void I2CAL_output_clock(int state); +void I2CAL_output_data(int state); +unsigned char I2CAL_input_data(void); + +void I2CAL_set_data_for_input(void); +void I2CAL_set_data_for_output(void); + +void SendI2CStart(void); +void SendI2CData(unsigned char inData); + +unsigned char ReceiveI2CAck(void); +void SendI2CStop(void); +void SendI2CNack(void); +void SendI2CAck(void); +unsigned char ReceiveI2CData(void); + +/* ### ADD ### ANY LOCAL ROUTINE DEFINITIONS SPECIFIC TO GPIO */ + +/*--------------------------------------------------------------------------- + * gfx_i2c_reset + * + * This routine resets the I2C bus. + *--------------------------------------------------------------------------- + */ + +#if GFX_I2C_DYNAMIC +int +gpio_i2c_reset(unsigned char busnum, short adr, char freq) +#else +int +gfx_i2c_reset(unsigned char busnum, short adr, char freq) +#endif +{ + /* ### ADD ### Any code needed to reset the state of the GPIOs. */ + return GFX_STATUS_OK; +} + +/*--------------------------------------------------------------------------- + * gfx_i2c_select_gpio + * + * This routine selects which GPIO pins to use. + *--------------------------------------------------------------------------- + */ +#if GFX_I2C_DYNAMIC +int +gpio_i2c_select_gpio(int clock, int data) +#else +int +gfx_i2c_select_gpio(int clock, int data) +#endif +{ + gpio_clock = clock; + gpio_data = data; + return (0); +} + +/*--------------------------------------------------------------------------- + * gfx_i2c_write + * + * This routine writes data to the specified I2C address. + *--------------------------------------------------------------------------- + */ +#if GFX_I2C_DYNAMIC +int +gpio_i2c_write(unsigned char busnum, unsigned char address, unsigned char reg, + unsigned char bytes, unsigned char *value) +#else +int +gfx_i2c_write(unsigned char busnum, unsigned char address, unsigned char reg, + unsigned char bytes, unsigned char *value) +#endif +{ + /* ### ADD ### CODE TO WRITE BYTE TO I2B BUS */ + + int restart_count = 0; + + while (restart_count++ < 5) { + /* set the access pointer register. */ + /* The address is shifted left by one to make room for Read/Write + * bit */ + SendI2CStart(); + SendI2CData((char)((address << 1) | I2CWRITE)); + if (!ReceiveI2CAck()) { + SendI2CStop(); + gfx_delay_milliseconds(10); + continue; + } + SendI2CData((unsigned char)reg); + if (!ReceiveI2CAck()) { + SendI2CStop(); + gfx_delay_milliseconds(10); + continue; + } + + /* write the first byte */ + SendI2CData(*value); + if (!ReceiveI2CAck()) { + SendI2CStop(); + gfx_delay_milliseconds(10); + continue; + } + + /* write the second byte. */ + if (bytes == 2) { + SendI2CData(*(value + 1)); + if (!ReceiveI2CAck()) { + SendI2CStop(); + gfx_delay_milliseconds(10); + continue; + } + } + + /* done. */ + SendI2CStop(); + + return 0; + } + + return (0); + +} + +/*--------------------------------------------------------------------------- + * gfx_i2c_read + * + * This routine reads data from the specified I2C address. + *--------------------------------------------------------------------------- + */ +#if GFX_I2C_DYNAMIC +int +gpio_i2c_read(unsigned char busnum, unsigned char address, unsigned char reg, + unsigned char bytes, unsigned char *p_value) +#else +int +gfx_i2c_read(unsigned char busnum, unsigned char address, unsigned char reg, + unsigned char bytes, unsigned char *p_value) +#endif +{ + /* ### ADD ### CODE TO WRITE BYTE TO I2B BUS */ + /* For now return clock and data pins */ + + int restart_count = 0; + + if (!p_value) + return (1); + + while (restart_count++ < 5) { + /* set the access pointer register. */ + /* The address is shifted left by one to make room for Read/Write + * bit */ + SendI2CStart(); + SendI2CData((char)((address << 1) | I2CWRITE)); + if (!ReceiveI2CAck()) { + SendI2CStop(); + gfx_delay_milliseconds(10); + continue; + } + SendI2CData((unsigned char)(reg & 0xFF)); + SendI2CNack(); + + /* read the first data byte. */ + SendI2CStart(); + SendI2CData((char)((address << 1) | I2CREAD)); + if (!ReceiveI2CAck()) { + SendI2CStop(); + gfx_delay_milliseconds(10); + continue; + } + *p_value = ReceiveI2CData(); + + /* read the second byte. */ + if (bytes == 2) { + SendI2CAck(); + *(p_value + 1) = ReceiveI2CData(); + } + + /* done. */ + SendI2CNack(); + SendI2CStop(); + + return 0; + } + + return (1); +} + +/* Added i2c/gpio code to test fs451 chip. */ + +/* + * ---------------------------------------------------------------------- + * + * void SendI2CStart(void) + * + * Sends an I2C start signal on the bus. + * + *---------------------------------------------------------------------- + */ +void +SendI2CStart(void) +{ + I2CAL_output_data(1); + I2CAL_output_clock(1); + I2CAL_output_data(0); + I2CAL_output_clock(0); +} + +/* + *---------------------------------------------------------------------- + * + * void SendI2CStop(void) + * + * Sends an I2C stop signal on the bus. + * + *---------------------------------------------------------------------- + */ +void +SendI2CStop(void) +{ + I2CAL_output_data(0); + I2CAL_output_clock(1); + I2CAL_output_data(1); +} + +/* + *---------------------------------------------------------------------- + * + * void SendI2CAck(void) + * + * Sends the Ack signal on the I2C bus. + * + *---------------------------------------------------------------------- + */ +void +SendI2CAck(void) +{ + I2CAL_output_data(0); + I2CAL_output_clock(1); + I2CAL_output_clock(0); +} + +/* + *---------------------------------------------------------------------- + * + * void SendI2CNack(void) + * + * Sends the Nt-Ack signal on the I2C bus. + * + *---------------------------------------------------------------------- + */ +void +SendI2CNack(void) +{ + I2CAL_output_data(1); + I2CAL_output_clock(1); + I2CAL_output_clock(0); +} + +/* + *---------------------------------------------------------------------- + * + * UInt8 SendI2CData( UInt8 inData ) + * + * Sends a byte of data on the I2C bus and returns the TRUE if the slave + * ACK'dthe data. + * + * Input: inData - the byte of data to send + * Output: (return) - TRUE (1) if ACK was received, FALSE (0) if not + * + *---------------------------------------------------------------------- + */ +void +SendI2CData(unsigned char inData) +{ + unsigned char bit; + + /* Send all 8 bits of data byte, MSB to LSB */ + for (bit = 0x80; bit != 0; bit >>= 1) { + if (inData & bit) + I2CAL_output_data(1); + else + I2CAL_output_data(0); + + I2CAL_output_clock(1); + I2CAL_output_clock(0); + } +} + +/* + *---------------------------------------------------------------------- + * + * UInt8 ReceiveI2CAck( ) + * + * Receives the Ack (or Nack) from the slave. + * + * Output: (return) - TRUE (1) if ACK was received, FALSE (0) if not + * + *---------------------------------------------------------------------- + */ +unsigned char +ReceiveI2CAck(void) +{ + unsigned char bit; + + /* Test for Ack/Nack */ + I2CAL_set_data_for_input(); + I2CAL_output_data(1); + I2CAL_output_clock(1); + bit = I2CAL_input_data(); + I2CAL_output_clock(0); + I2CAL_set_data_for_output(); + return !bit; +} + +/* + *---------------------------------------------------------------------- + * + * unsigned char ReceiveI2CData(void) + * + * Receives a byte of data from the I2C bus. + * + * Output: (return) - The data byte recehved from the bus + * + *---------------------------------------------------------------------- + */ +unsigned char +ReceiveI2CData(void) +{ + unsigned char data = 0; + unsigned char x; + + /* make sure the data line is released */ + I2CAL_set_data_for_input(); + I2CAL_output_data(1); + + /* shift in the data */ + for (x = 0; x < 8; x++) { + /* shift the data left */ + I2CAL_output_clock(1); + data <<= 1; + data |= I2CAL_input_data(); + I2CAL_output_clock(0); + } + + I2CAL_set_data_for_output(); + I2CAL_output_data(1); + return data; +} + +/* + *---------------------------------------------------------------------- + * + * void I2C_init(void) + * + * This routine initializes the I2C interface. Clients of the I2C.c + * will call this routine before calling any other routine in the I2C.c + * + *---------------------------------------------------------------------- + */ + +#if GFX_I2C_DYNAMIC +int +gpio_i2c_init(void) +#else +int +gfx_i2c_init(void) +#endif +{ + int errc; + + /* init I2CAL */ + errc = I2CAL_init(); + if (errc) + return errc; + + /* set the clock and data lines to the proper states */ + I2CAL_output_clock(1); + I2CAL_output_data(1); + I2CAL_set_data_for_output(); + + SendI2CStart(); + SendI2CStop(); + SendI2CStop(); + + g_initialized = 1; + + return 0; +} + +/* + *---------------------------------------------------------------------- + * + * void I2C_cleanup(void) + * + * This routine disables the I2C interface. Clients of the I2C.c will not + * call any other I2C routine after calling this routine. + * + *---------------------------------------------------------------------- + */ + +#if GFX_I2C_DYNAMIC +void +gpio_i2c_cleanup(void) +#else +void +gfx_i2c_cleanup(void) +#endif +{ + if (g_initialized) { + + /* set the clock and data lines to a harmless state */ + I2CAL_output_clock(1); + I2CAL_output_data(1); + + g_initialized = 0; + } + + I2CAL_cleanup(); +} + +int +I2CAL_init(void) +{ + unsigned long l_reg; + unsigned short reg; + + /* initialize the i2c port. */ + l_reg = gfx_pci_config_read(CS5530_GPIO); + + if (l_reg != 0x01001078) + return 1; + + l_reg = gfx_pci_config_read(CS5530_GPIO); + reg = (unsigned short)l_reg; + + /* both outputs, both high. */ + reg |= (SDADIR | SCLDIR | SDA | SCL); + l_reg = reg; + gfx_pci_config_write(CS5530_GPIO, l_reg); + + g_initialized = 1; + + return 0; +} + +void +I2CAL_cleanup(void) +{ + if (g_initialized) { + + g_initialized = 0; + } +} + +/* + *---------------------------------------------------------------------------- + * + * set the I2C clock line state + * + *---------------------------------------------------------------------------- + */ +void +I2CAL_output_clock(int inState) +{ + unsigned short reg; + unsigned long value; + + value = gfx_pci_config_read(CS5530_GPIO); + reg = (unsigned short)value; + + if (inState) { /* write a 1. */ + reg |= SCL; + } else { /* write a 0. */ + reg &= ~SCL; + } + + value = reg; + gfx_pci_config_write(CS5530_GPIO, value); + + /* hold it for a minimum of 4.7us */ + gfx_delay_microseconds(5); +} + +/* + *---------------------------------------------------------------------------- + * + * set the I2C data line state + * + *---------------------------------------------------------------------------- + */ +void +I2CAL_output_data(int inState) +{ + unsigned short reg; + unsigned long value; + + value = gfx_pci_config_read(CS5530_GPIO); + reg = (unsigned short)value; + + if (inState) { /* write a 1. */ + reg |= SDA; + } else { + /* write a 0. */ + reg &= ~SDA; + } + value = reg; + gfx_pci_config_write(CS5530_GPIO, value); + + /* 250 ns setup time */ + gfx_delay_microseconds(1); +} + +/* + *---------------------------------------------------------------------------- + * + * read the state of the data line + * + *---------------------------------------------------------------------------- + */ +unsigned char +I2CAL_input_data(void) +{ + unsigned short reg; + unsigned long value; + + value = gfx_pci_config_read(CS5530_GPIO); + reg = (unsigned short)value; + + if (reg & SDA) + return 1; + else + return 0; +} + +/* + *---------------------------------------------------------------------------- + * + * set the I2C data for input mode + * + *---------------------------------------------------------------------------- + */ +void +I2CAL_set_data_for_input(void) +{ + unsigned short reg; + unsigned long value; + + value = gfx_pci_config_read(CS5530_GPIO); + reg = (unsigned short)value; + + reg &= ~SDADIR; + + value = reg; + + gfx_pci_config_write(CS5530_GPIO, value); +} + +/* + *---------------------------------------------------------------------------- + * + * set the I2C data for output mode + * + *---------------------------------------------------------------------------- + */ +void +I2CAL_set_data_for_output(void) +{ + unsigned short reg; + unsigned long value; + + value = gfx_pci_config_read(CS5530_GPIO); + reg = (unsigned short)value; + reg |= SDADIR; + value = reg; + + gfx_pci_config_write(CS5530_GPIO, value); + +} + +/* END OF FILE */ diff --git a/driver/xf86-video-geode/src/gfx/init_gu1.c b/driver/xf86-video-geode/src/gfx/init_gu1.c new file mode 100644 index 000000000..e7d998763 --- /dev/null +++ b/driver/xf86-video-geode/src/gfx/init_gu1.c @@ -0,0 +1,265 @@ +/* Copyright (c) 2005 Advanced Micro Devices, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + * + * Neither the name of the Advanced Micro Devices, Inc. nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * */ + +/* + * This file contains routines used in the initialization of Geode-family + * processors. + * */ + +/*---------------------------------------------------------------------------- + * gfx_gxm_config_read + * + * This routine reads the value of the specified GXm configuration register. + *---------------------------------------------------------------------------- + */ +unsigned char +gfx_gxm_config_read(unsigned char index) +{ + unsigned char value = 0xFF; + unsigned char lock; + + OUTB(0x22, GXM_CONFIG_CCR3); + lock = INB(0x23); + OUTB(0x22, GXM_CONFIG_CCR3); + OUTB(0x23, (unsigned char)(lock | 0x10)); + OUTB(0x22, index); + value = INB(0x23); + OUTB(0x22, GXM_CONFIG_CCR3); + OUTB(0x23, lock); + return (value); +} + +/*---------------------------------------------------------------------------- + * gfx_get_core_freq + * + * This routine returns the core clock frequency of a GXm if valid jumper + * settings are detected; 0 It assumes that a 33.3 MHz PCI clock is being used + * for GX1. + * For SCx2xx, the fast PCI divisor is read. + *---------------------------------------------------------------------------- + */ +#if GFX_INIT_DYNAMIC +unsigned long +gu1_get_core_freq(void) +#else +unsigned long +gfx_get_core_freq(void) +#endif +{ + unsigned char dir0, dir1; + unsigned long cpu_speed; + + dir0 = gfx_gxm_config_read(GXM_CONFIG_DIR0) & 0x0F; + dir1 = gfx_gxm_config_read(GXM_CONFIG_DIR1); + + /* REVISION 4.0 AND UP */ + + if (dir1 >= 0x50) { + switch (dir0) { + case 0: + case 2: + cpu_speed = 133; + break; + case 5: + cpu_speed = 166; + break; + case 3: + cpu_speed = 200; + break; + case 6: + cpu_speed = 233; + break; + case 7: + cpu_speed = 266; + break; + case 4: + cpu_speed = 300; + break; + case 1: + cpu_speed = 333; + break; + default: + return (0); + } + } else { + switch (dir0) { + case 0: + case 2: + cpu_speed = 133; + break; + case 7: + cpu_speed = 166; + break; + case 1: + case 3: + cpu_speed = 200; + break; + case 4: + case 6: + cpu_speed = 233; + break; + case 5: + cpu_speed = 266; + break; + default: + return (0); + } + } + + if ((gfx_cpu_version & 0xFF) == GFX_CPU_SC1200) { + cpu_speed = (cpu_speed * gfx_pci_speed_khz) / 33300; + } + return (cpu_speed); +} + +/*---------------------------------------------------------------------------- + * gfx_get_cpu_register_base + * + * This routine returns the base address for graphics registers. + *---------------------------------------------------------------------------- + */ +#if GFX_INIT_DYNAMIC +unsigned long +gu1_get_cpu_register_base(void) +#else +unsigned long +gfx_get_cpu_register_base(void) +#endif +{ + unsigned long base; + + base = (unsigned long)gfx_gxm_config_read(GXM_CONFIG_GCR); + base = (base & 0x03) << 30; + return (base); +} + +/*---------------------------------------------------------------------------- + * gfx_get_frame_buffer_base + * + * This routine returns the base address for graphics memory. This is an + * offset of 0x00800000 from the base address specified in the GCR register. + * + * The function returns zero if the GCR indicates the graphics subsystem + * is disabled. + *---------------------------------------------------------------------------- + */ +#if GFX_INIT_DYNAMIC +unsigned long +gu1_get_frame_buffer_base(void) +#else +unsigned long +gfx_get_frame_buffer_base(void) +#endif +{ + unsigned long base; + + base = (unsigned long)gfx_gxm_config_read(GXM_CONFIG_GCR); + base = (base & 0x03) << 30; + if (base) + base |= 0x00800000; + return (base); +} + +/*---------------------------------------------------------------------------- + * gfx_get_frame_buffer_size + * + * This routine returns the total size of graphics memory, in bytes. + * + * Currently this routine is hardcoded to return 2 Meg. + *---------------------------------------------------------------------------- + */ +#if GFX_INIT_DYNAMIC +unsigned long +gu1_get_frame_buffer_size(void) +#else +unsigned long +gfx_get_frame_buffer_size(void) +#endif +{ +#if FB4MB + return (0x00400000); +#else + return (0x00200000); +#endif +} + +/*---------------------------------------------------------------------------- + * gfx_get_vid_register_base + * + * This routine returns the base address for the video hardware. It assumes + * an offset of 0x00010000 from the base address specified by the GCR. + * + * The function returns zero if the GCR indicates the graphics subsystem + * is disabled. + *---------------------------------------------------------------------------- + */ +#if GFX_INIT_DYNAMIC +unsigned long +gu1_get_vid_register_base(void) +#else +unsigned long +gfx_get_vid_register_base(void) +#endif +{ + unsigned long base; + + base = (unsigned long)gfx_gxm_config_read(GXM_CONFIG_GCR); + base = (base & 0x03) << 30; + if (base) + base |= 0x00010000; + return (base); +} + +/*---------------------------------------------------------------------------- + * gfx_get_vip_register_base + * + * This routine returns the base address for the VIP hardware. This is + * only applicable to the SC1200, for which this routine assumes an offset + * of 0x00015000 from the base address specified by the GCR. + * + * The function returns zero if the GCR indicates the graphics subsystem + * is disabled. + *---------------------------------------------------------------------------- + */ +#if GFX_INIT_DYNAMIC +unsigned long +gu1_get_vip_register_base(void) +#else +unsigned long +gfx_get_vip_register_base(void) +#endif +{ + unsigned long base = 0; + + if ((gfx_cpu_version & 0xFF) == GFX_CPU_SC1200) { + base = (unsigned long)gfx_gxm_config_read(GXM_CONFIG_GCR); + base = (base & 0x03) << 30; + if (base) + base |= 0x00015000; + } + return (base); +} + +/* END OF FILE */ diff --git a/driver/xf86-video-geode/src/gfx/init_gu2.c b/driver/xf86-video-geode/src/gfx/init_gu2.c new file mode 100644 index 000000000..0bbb0640b --- /dev/null +++ b/driver/xf86-video-geode/src/gfx/init_gu2.c @@ -0,0 +1,154 @@ +/* Copyright (c) 2005 Advanced Micro Devices, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + * + * Neither the name of the Advanced Micro Devices, Inc. nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * */ + +/* + * This file contains routines used in Redcloud initialization. + * */ + +/*---------------------------------------------------------------------------- + * gfx_get_core_freq + * + * Returns the core clock frequency of a GX2. + *---------------------------------------------------------------------------- + */ +#if GFX_INIT_DYNAMIC +unsigned long +gu2_get_core_freq(void) +#else +unsigned long +gfx_get_core_freq(void) +#endif +{ + unsigned long value; + + /* CPU SPEED IS REPORTED BY A VSM IN VSA II */ + /* Virtual Register Class = 0x12 (Sysinfo) */ + /* CPU Speed Register = 0x01 */ + + OUTW(0xAC1C, 0xFC53); + OUTW(0xAC1C, 0x1201); + + value = (unsigned long)(INW(0xAC1E)); + + return (value); +} + +/*---------------------------------------------------------------------------- + * gfx_get_cpu_register_base + * + * This routine returns the base address for display controller registers. + *---------------------------------------------------------------------------- + */ +#if GFX_INIT_DYNAMIC +unsigned long +gu2_get_cpu_register_base(void) +#else +unsigned long +gfx_get_cpu_register_base(void) +#endif +{ + return gfx_pci_config_read(0x80000918); +} + +/*---------------------------------------------------------------------------- + * gfx_get_graphics_register_base + * + * This routine returns the base address for the graphics acceleration. + *---------------------------------------------------------------------------- + */ +#if GFX_INIT_DYNAMIC +unsigned long +gu2_get_graphics_register_base(void) +#else +unsigned long +gfx_get_graphics_register_base(void) +#endif +{ + return gfx_pci_config_read(0x80000914); +} + +/*---------------------------------------------------------------------------- + * gfx_get_frame_buffer_base + * + * This routine returns the base address for graphics memory. + *---------------------------------------------------------------------------- + */ +#if GFX_INIT_DYNAMIC +unsigned long +gu2_get_frame_buffer_base(void) +#else +unsigned long +gfx_get_frame_buffer_base(void) +#endif +{ + return gfx_pci_config_read(0x80000910); +} + +/*---------------------------------------------------------------------------- + * gfx_get_frame_buffer_size + * + * This routine returns the total size of graphics memory, in bytes. + *---------------------------------------------------------------------------- + */ +#if GFX_INIT_DYNAMIC +unsigned long +gu2_get_frame_buffer_size(void) +#else +unsigned long +gfx_get_frame_buffer_size(void) +#endif +{ + unsigned long value; + + /* FRAME BUFFER SIZE IS REPORTED BY A VSM IN VSA II */ + /* Virtual Register Class = 0x02 */ + /* VG_MEM_SIZE (512KB units) = 0x00 */ + + OUTW(0xAC1C, 0xFC53); + OUTW(0xAC1C, 0x0200); + + value = (unsigned long)(INW(0xAC1E)) & 0xFFl; + + return (value << 19); +} + +/*---------------------------------------------------------------------------- + * gfx_get_vid_register_base + * + * This routine returns the base address for the video hardware. + *---------------------------------------------------------------------------- + */ +#if GFX_INIT_DYNAMIC +unsigned long +gu2_get_vid_register_base(void) +#else +unsigned long +gfx_get_vid_register_base(void) +#endif +{ + return gfx_pci_config_read(0x8000091C); +} + +/* END OF FILE */ diff --git a/driver/xf86-video-geode/src/gfx/msr_rdcl.c b/driver/xf86-video-geode/src/gfx/msr_rdcl.c new file mode 100644 index 000000000..548e8a4da --- /dev/null +++ b/driver/xf86-video-geode/src/gfx/msr_rdcl.c @@ -0,0 +1,633 @@ +/* Copyright (c) 2005 Advanced Micro Devices, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + * + * Neither the name of the Advanced Micro Devices, Inc. nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * */ + +/* + * This file contains MSR access routines for Redcloud. + * */ + +void redcloud_build_mbus_tree(void); /* private routine definition */ +int redcloud_init_msr_devices(MSR aDev[], unsigned int array_size); + + /* private routine definition */ +DEV_STATUS redcloud_find_msr_device(MSR * pDev); + + /* private routine definition */ + +/* REDCLOUD MSR BITMASKS */ + +#define MBD_MSR_CAP 0x2000 +#define MSR_CAP_ID_MASK 0xFF000 +#define MSR_CAP_ID_SHIFT 12 +#define MSR_CAP_REV_MASK 0x0F +#define MBIU_CAP 0x86 +#define NUM_PORTS_MASK 0x00380000 +#define NUM_PORTS_SHIFT 19 +#define MBIU_WHOAMI 0x8B +#define WHOAMI_MASK 0x07 + +/* REDCLOUD and CS5535 MSR DEVICES */ + +MSR msrDev[] = { + {FOUND, RC_CC_MBIU, RC_MB0_MBIU0}, + {FOUND, RC_CC_MBIU, RC_MB0_MBIU1}, + {NOT_KNOWN, RC_CC_MCP, FAKE_ADDRESS}, + {NOT_KNOWN, RC_CC_MPCI, FAKE_ADDRESS}, + {NOT_KNOWN, RC_CC_MC, FAKE_ADDRESS}, + {NOT_KNOWN, RC_CC_GP, FAKE_ADDRESS}, + {NOT_KNOWN, RC_CC_VG, FAKE_ADDRESS}, + {NOT_KNOWN, RC_CC_DF, FAKE_ADDRESS}, + {NOT_KNOWN, RC_CC_FG, FAKE_ADDRESS}, + {FOUND, RC_CC_VA, RC_MB0_CPU}, + {FOUND, CP_CC_MBIU, CP_MB0_MBIU0}, + {NOT_KNOWN, CP_CC_MPCI, FAKE_ADDRESS}, + {NOT_KNOWN, CP_CC_USB2, FAKE_ADDRESS}, + {NOT_KNOWN, CP_CC_ATAC, FAKE_ADDRESS}, + {NOT_KNOWN, CP_CC_MDD, FAKE_ADDRESS}, + {NOT_KNOWN, CP_CC_ACC, FAKE_ADDRESS}, + {NOT_KNOWN, CP_CC_USB1, FAKE_ADDRESS}, + {NOT_KNOWN, CP_CC_MCP, FAKE_ADDRESS}, +}; + +#define NUM_DEVS sizeof(msrDev) / sizeof(struct msr) + +/* CAPISTRANO DEVICE INDEX LIMITS */ +/* These defines represent the start and stop indexes into the device array + * for all Capistrano devices. These should be updated whenever a device is + * added or removed to the Capistrano list. + * */ + +#define CP_INDEX_START CP_ID_MBIU +#define CP_INDEX_STOP CP_ID_MCP + +/* GLOBAL MBUS CACHE STRUCTURES */ +/* These structures contain a "cached" copy of the MBUS topology */ +/* for easy future lookup. */ + +MBUS_NODE MBIU0[8], MBIU1[8], MBIU2[8]; + +/* REGISTER MACROS */ + +#define GET_DEVICE_ID( CAPABILITIES_HIGH, CAPABILITIES_LOW ) \ + ((unsigned int)(( (CAPABILITIES_LOW) & MSR_CAP_ID_MASK ) >> MSR_CAP_ID_SHIFT )) + +#define GET_NUM_PORTS( MBIU_CAP_HIGH, MBIU_CAP_LOW ) (((MBIU_CAP_HIGH) & NUM_PORTS_MASK ) >> NUM_PORTS_SHIFT) + +/*---------------------------------------------------------------------------- + * gfx_msr_init + * + * This routine initializes the base addresses of all known MBUS devices. + *---------------------------------------------------------------------------- + */ +#if GFX_MSR_DYNAMIC +int +redcloud_msr_init(void) +#else +int +gfx_msr_init(void) +#endif +{ + Q_WORD msrValue; + int return_value = 1; + + /* CHECK FOR VALID MBUS CONFIGURATION */ + /* The CPU and the two MBIUs are assumed to be at known static addresses, + * so we will check the device IDs at these addresses as proof of a valid + * mbus configuration. + * */ + + MSR_READ(MBD_MSR_CAP, RC_MB0_CPU, &(msrValue.high), &(msrValue.low)); + if (GET_DEVICE_ID(msrValue.high, msrValue.low) != RC_CC_VA) + return_value = 0; + + MSR_READ(MBD_MSR_CAP, RC_MB0_MBIU0, &(msrValue.high), &(msrValue.low)); + if (GET_DEVICE_ID(msrValue.high, msrValue.low) != RC_CC_MBIU) + return_value = 0; + + MSR_READ(MBD_MSR_CAP, RC_MB0_MBIU1, &(msrValue.high), &(msrValue.low)); + if (GET_DEVICE_ID(msrValue.high, msrValue.low) != RC_CC_MBIU) + return_value = 0; + + /* ENUMERATE VALID BUS */ + /* If all static devices were identified, continue with the enumeration */ + + if (return_value) { + /* OPTIMIZATION */ + /* Build a local copy of the MBUS topology. This allows us to */ + /* quickly search the entire MBUS for a given device ID without */ + /* repeated MSR accesses. */ + + redcloud_build_mbus_tree(); + + /* INITIALIZE MSR DEVICES */ + + return_value = redcloud_init_msr_devices(msrDev, NUM_DEVS); + + } + + return return_value; + +} + +/*-------------------------------------------------------------------------- + * void redcloud_build_mbus_tree() (PRIVATE ROUTINE - NOT PART OF DURANGO API) + * + * This routine walks through the MBUS and records the address value and + * device ID found at each node. If a node (aka port) is not populated, + * that node returns '0'. The deviceID for that node is set to '0' + * (NOT_POPULATED) to reflect this. If the node being queried points back to + * Vail or MBIU0, the deviceID for that node is set to 'REFLECTIVE'. + * Reflective nodes are nodes that forward the given MBUS address BACK to the + * initiator. + *---------------------------------------------------------------------------- + */ +void +redcloud_build_mbus_tree(void) +{ + unsigned long mbiu_port_count, reflective; + unsigned long port; + Q_WORD msrValue; + + /* */ + /* ENUMERATE MBIU0 */ + /* */ + + /* COUNT MBIU PORTS */ + + MSR_READ(MBIU_CAP, RC_MB0_MBIU0, &(msrValue.high), &(msrValue.low)); + mbiu_port_count = GET_NUM_PORTS(msrValue.high, msrValue.low); + + /* FIND REFLECTIVE PORT */ + /* Query the MBIU for the port through which we are communicating. */ + /* We will avoid accesses to this port to avoid a self-reference. */ + + MSR_READ(MBIU_WHOAMI, RC_MB0_MBIU0, &(msrValue.high), &(msrValue.low)); + reflective = msrValue.low & WHOAMI_MASK; + + /* ENUMERATE ALL PORTS */ + /* For every possible port, set the MBIU.deviceId to something. */ + + for (port = 0; port < 8; port++) { + /* FILL IN CLAIMED FIELD */ + /* All MBIU ports can only be assigned to one device from the */ + /* Durango table */ + + MBIU0[port].claimed = 0; + + /* MBIU0 PORT NUMBERS ARE IN ADDRESS BITS 31:29 */ + + MBIU0[port].address = port << 29; + + /* SPECIAL CASE FOR MBIU0 */ + /* MBIU0 port 0 is a special case, as it points back to MBIU0. MBIU0 + * responds at address 0x40000xxx, which does not equal 0 << 29. + * */ + + if (port == 0) + MBIU0[port].deviceId = RC_CC_MBIU; + else if (port == reflective) + MBIU0[port].deviceId = REFLECTIVE; + else if (port > mbiu_port_count) + MBIU0[port].deviceId = NOT_POPULATED; + else { + MSR_READ(MBD_MSR_CAP, MBIU0[port].address, &(msrValue.high), + &(msrValue.low)); + MBIU0[port].deviceId = GET_DEVICE_ID(msrValue.high, msrValue.low); + } + } + + /* */ + /* ENUMERATE MBIU1 */ + /* */ + + /* COUNT MBIU PORTS */ + + MSR_READ(MBIU_CAP, RC_MB0_MBIU1, &(msrValue.high), &(msrValue.low)); + mbiu_port_count = GET_NUM_PORTS(msrValue.high, msrValue.low); + + /* FIND REFLECTIVE PORT */ + /* Query the MBIU for the port through which we are communicating. */ + /* We will avoid accesses to this port to avoid a self-reference. */ + + MSR_READ(MBIU_WHOAMI, RC_MB0_MBIU1, &(msrValue.high), &(msrValue.low)); + reflective = msrValue.low & WHOAMI_MASK; + + /* ENUMERATE ALL PORTS */ + /* For every possible port, set the MBIU.deviceId to something. */ + + for (port = 0; port < 8; port++) { + /* FILL IN CLAIMED FIELD */ + /* All MBIU ports can only be assigned to one device from the */ + /* Durango table */ + + MBIU1[port].claimed = 0; + + /* MBIU1 PORT NUMBERS ARE IN 28:26 AND 31:29 = 010B */ + + MBIU1[port].address = (0x02l << 29) + (port << 26); + + if (port == reflective) + MBIU1[port].deviceId = REFLECTIVE; + else if (port > mbiu_port_count) + MBIU1[port].deviceId = NOT_POPULATED; + else { + MSR_READ(MBD_MSR_CAP, MBIU1[port].address, &(msrValue.high), + &(msrValue.low)); + MBIU1[port].deviceId = GET_DEVICE_ID(msrValue.high, msrValue.low); + } + } + + /* */ + /* ENUMERATE MBIU2 (CS5535) */ + /* (if present) */ + + MSR_READ(MBD_MSR_CAP, CP_MB0_MBIU0, &(msrValue.high), &(msrValue.low)); + if (GET_DEVICE_ID(msrValue.high, msrValue.low) == CP_CC_MBIU) { + /* COUNT MBIU PORTS */ + + MSR_READ(MBIU_CAP, CP_MB0_MBIU0, &(msrValue.high), &(msrValue.low)); + mbiu_port_count = GET_NUM_PORTS(msrValue.high, msrValue.low); + + /* FIND REFLECTIVE PORT */ + /* Query the MBIU for the port through which we are communicating. */ + /* We will avoid accesses to this port to avoid a self-reference. */ + + MSR_READ(MBIU_WHOAMI, CP_MB0_MBIU0, &(msrValue.high), + &(msrValue.low)); + reflective = msrValue.low & WHOAMI_MASK; + + /* ENUMERATE ALL PORTS */ + /* For every possible port, set the MBIU.deviceId to something. */ + + for (port = 0; port < 8; port++) { + /* FILL IN CLAIMED FIELD */ + /* All MBIU ports can only be assigned to one device from the */ + /* Durango table */ + + MBIU2[port].claimed = 0; + + /* MBIU2 PORT NUMBERS ARE IN 22:20 AND 31:23 = 010100010B */ + + MBIU2[port].address = + (0x02l << 29) + (0x04l << 26) + (0x02l << 23) + (port << 20); + + if (port == reflective) + MBIU2[port].deviceId = REFLECTIVE; + else if (port > mbiu_port_count) + MBIU2[port].deviceId = NOT_POPULATED; + else { + MSR_READ(MBD_MSR_CAP, MBIU2[port].address, &(msrValue.high), + &(msrValue.low)); + MBIU2[port].deviceId = + GET_DEVICE_ID(msrValue.high, msrValue.low); + } + } + } else { + /* NO 5535 */ + /* If the CS5535 is not installed, fill in the cached table */ + /* with the 'NOT_INSTALLED' flag. Also, fill in the device */ + /* status from NOT_KNOWN to REQ_NOT_INSTALLED. */ + + for (port = 0; port < 8; port++) { + MBIU2[port].claimed = 0; + MBIU2[port].deviceId = NOT_INSTALLED; + MBIU2[port].address = + (0x02l << 29) + (0x04l << 26) + (0x02l << 23) + (port << 20); + } + for (port = CP_INDEX_START; port <= CP_INDEX_STOP; port++) { + msrDev[port].Present = REQ_NOT_INSTALLED; + } + } +} + +/*------------------------------------------------------------------ + * redcloud_init_msr_devices (PRIVATE ROUTINE - NOT PART OF DURANGO API) + * + * Handles the details of finding each possible device on the MBUS. + * If a given device is not found, its structure is left uninitialized. + * If a given device is found, its structure is updated. + * + * This init routine only checks for devices in aDev[]. + * + * Passed: + * aDev - is a pointer to the array of MBUS devices. + * arraySize - number of elements in aDev. + * + * Returns: + * 1 - If, for every device, its address was found. + * 0 - If, for any device, an error was encountered. + *------------------------------------------------------------------ + */ +int +redcloud_init_msr_devices(MSR aDev[], unsigned int array_size) +{ + unsigned int i, issues = 0; + + /* TRY TO FIND EACH ITEM IN THE ARRAY */ + + for (i = 0; i < array_size; i++) { + /* IGNORE DEVICES THAT ARE ALREADY FOUND */ + /* The addresses for "found" devices are already known. */ + + if (aDev[i].Present == FOUND || aDev[i].Present == REQ_NOT_INSTALLED) + continue; + + /* TRY TO FIND THE DEVICE ON THE MBUS */ + + aDev[i].Present = redcloud_find_msr_device(&aDev[i]); + + /* INCREMENT ERROR COUNT IF DEVICE NOT FOUND */ + + if (aDev[i].Present != FOUND) + issues++; + } + + return (issues == 0); +} + +/*------------------------------------------------------------------ + * redcloud_find_msr_device (PRIVATE ROUTINE - NOT PART OF DURANGO API) + * + * Passed: + * pDev - is a pointer to one element in the array of MBUS devices + * + * Returns: + * FOUND - Device was found and pDev->Address has been updated. + * + * REQ_NOT_FOUND - Device was not found and pDev->Address has not + * been updated. + * + *------------------------------------------------------------------ + */ +DEV_STATUS +redcloud_find_msr_device(MSR * pDev) +{ + unsigned int i; + + /* SEARCH DURANGO'S CACHED MBUS TOPOLOGY */ + /* This gets a little tricky. As the only identifier we have for each + * device is the device ID and we have multiple devices of the same type + * MCP, MPCI, USB, etc. we need to make some assumptions based on table + * order. These are as follows: + * 1. All Redcloud nodes are searched first, as we assume that they + * are first in the table. + * 2. If two devices have the same device ID and are found on the same + * device (GX2, CS5535, etc.) we assume that they are listed such + * that the first device in the table with this device ID has a lower + * port address. + * 3. After a device ID has been matched, the port is marked as + * 'claimed', such that future enumerations continue searching the + * GeodeLink topology. + */ + + /* SEARCH MBIU0 */ + + for (i = 0; i < 8; i++) { + if (MBIU0[i].deviceId == pDev->Id && !(MBIU0[i].claimed)) { + MBIU0[i].claimed = 1; + pDev->Address = MBIU0[i].address; + return FOUND; + } + } + + /* SEARCH MBIU1 */ + + for (i = 0; i < 8; i++) { + if (MBIU1[i].deviceId == pDev->Id && !(MBIU1[i].claimed)) { + MBIU1[i].claimed = 1; + pDev->Address = MBIU1[i].address; + return FOUND; + } + } + + /* SEARCH MBIU2 */ + + for (i = 0; i < 8; i++) { + if (MBIU2[i].deviceId == pDev->Id && !(MBIU2[i].claimed)) { + MBIU2[i].claimed = 1; + pDev->Address = MBIU2[i].address; + return FOUND; + } + } + + return REQ_NOT_FOUND; +} + +/*-------------------------------------------------------------------- + * gfx_id_msr_device + * + * This routine handles reading the capabilities MSR register (typically + * 0x2000) and checking if the 'id' field matchs pDev.Id. This routine is + * used by applications/drivers that need to extend the list of known + * MBUS devices beyond those known by Durango. + * + * Passed: + * pDev - Pointer to MSR structure containing the device's ID. + * address - device address. + * + * Returns: + * FOUND - The IDs do match. + * REQ_NOT_FOUND - There was not a match. + * + *-------------------------------------------------------------------- + */ +#if GFX_MSR_DYNAMIC +DEV_STATUS +redcloud_id_msr_device(MSR * pDev, unsigned long address) +#else +DEV_STATUS +gfx_id_msr_device(MSR * pDev, unsigned long address) +#endif +{ + Q_WORD msrValue; + + MSR_READ(MBD_MSR_CAP, address, &(msrValue.high), &(msrValue.low)); + + if (GET_DEVICE_ID(msrValue.high, msrValue.low) == pDev->Id) + return FOUND; + else + return REQ_NOT_FOUND; +} + +/*-------------------------------------------------------------------- + * gfx_get_msr_dev_address + * + * This function returns the 32-bit address of the requested device. + * The device must be a known MBUS device. (It must be in Durango's + * device table.) DEV_STATUS should be checked to verify that the address + * was updated. + * + * + * Passed: + * device - device index of the device in question. + * *address - ptr to location where address should be stored. + * + * Returns: + * DEV_STATUS of device in question. (NOT_KNOWN if device is out of range.) + * *address - updated if 'device' is within range + * + * Notes: + * This function should only be called after gfx_msr_init + * + *-------------------------------------------------------------------- + */ +#if GFX_MSR_DYNAMIC +DEV_STATUS +redcloud_get_msr_dev_address(unsigned int device, unsigned long *address) +#else +DEV_STATUS +gfx_get_msr_dev_address(unsigned int device, unsigned long *address) +#endif +{ + if (device < NUM_DEVS) { + if (msrDev[device].Present == FOUND) + *address = msrDev[device].Address; + + return msrDev[device].Present; + } + return NOT_KNOWN; + +} + +/*-------------------------------------------------------------------- + * gfx_get_glink_id_at_address + * + * This function returns the 16-bit deviceId at the requested address. + * DEV_STATUS should be checked to make sure that device was updated. + * + * Passed: + * device - ptr to location where device ID should be stored. + * address - address of desired device ID. + * + * Returns: + * FOUND if address is a valid address, NOT_KNOWN if address cannot be + * found on the mbus. + * *device - updated with device Id info. + * + * Notes: + * This function should be called after gfx_msr_init + * + *-------------------------------------------------------------------- + */ +#if GFX_MSR_DYNAMIC +DEV_STATUS +redcloud_get_glink_id_at_address(unsigned int *device, unsigned long address) +#else +DEV_STATUS +gfx_get_glink_id_at_address(unsigned int *device, unsigned long address) +#endif +{ + int port; + + for (port = 0; port < 8; port++) { + if (MBIU0[port].address == address) { + *device = MBIU0[port].deviceId; + return FOUND; + } else if (MBIU1[port].address == address) { + *device = MBIU1[port].deviceId; + return FOUND; + } else if (MBIU2[port].address == address) { + *device = MBIU2[port].deviceId; + return FOUND; + } + } + + return NOT_KNOWN; + +} + +/*-------------------------------------------------------------------- + * gfx_msr_read + * + * Performs a 64-bit read from 'msrRegister' in device 'device'. 'device' is + * an index into Durango's table of known MBUS devices. + * + * Returns: + * FOUND - if no errors were detected and msrValue has been + * updated. + * NOT_KNOWN - an error was detected. msrValue is not updated. + * REQ_NOT_FOUND - 'msrAddress' for 'devID' is unknown. Caller + * should call msrInit() first. msrValue is not + * updated. + * Notes: + * This function should be called after gfx_msr_init + *-------------------------------------------------------------------- + */ +#if GFX_MSR_DYNAMIC +DEV_STATUS +redcloud_msr_read(unsigned int device, unsigned int msrRegister, + Q_WORD * msrValue) +#else +DEV_STATUS +gfx_msr_read(unsigned int device, unsigned int msrRegister, Q_WORD * msrValue) +#endif +{ + if (device < NUM_DEVS) { + if (msrDev[device].Present == FOUND) + MSR_READ(msrRegister, msrDev[device].Address, &(msrValue->high), + &(msrValue->low)); + + return msrDev[device].Present; + } + return NOT_KNOWN; +} + +/*-------------------------------------------------------------------- + * gfx_msr_write + * + * Performs a 64-bit write to 'msrRegister' in device 'devID'. + * + * Returns: + * FOUND - if no errors were detected and msrValue has been + * updated. + * NOT_KNOWN - an error was detected. msrValue is not updated. + * REQ_NOT_FOUND - 'msrAddress' for 'devID' is unknown. Caller + * should call msrInit() first. msrValue is not + * updated. + * + *Notes: + * This function is valid to call after initMSR_API() + * + *-------------------------------------------------------------------- + */ +#if GFX_MSR_DYNAMIC +DEV_STATUS +redcloud_msr_write(unsigned int device, unsigned int msrRegister, + Q_WORD * msrValue) +#else +DEV_STATUS +gfx_msr_write(unsigned int device, unsigned int msrRegister, + Q_WORD * msrValue) +#endif +{ + if (device < NUM_DEVS) { + if (msrDev[device].Present == FOUND) + MSR_WRITE(msrRegister, msrDev[device].Address, &(msrValue->high), + &(msrValue->low)); + + return msrDev[device].Present; + } + + return NOT_KNOWN; +} diff --git a/driver/xf86-video-geode/src/gfx/release.txt b/driver/xf86-video-geode/src/gfx/release.txt new file mode 100644 index 000000000..805b84769 --- /dev/null +++ b/driver/xf86-video-geode/src/gfx/release.txt @@ -0,0 +1,630 @@ +Durango Release Notes +Version 2.57.00 +Win98/WinXP/DOS/Linux +April 5, 2003 + +----------------------------------------------------------------------------- +PRODUCT INFORMATION +----------------------------------------------------------------------------- +Durango is a graphics/video software support package designed to assist in the +development of display drivers and embedded applications. The core of this +package is source code that performs most of the graphics related +functionality for the National Semiconductor (c) Geode family of products. +Development time for new software is reduced by using these routines to access +the hardware. + +----------------------------------------------------------------------------- +INSTALLATION INSTRUCTIONS +----------------------------------------------------------------------------- +Download the file to a directory. Modify and include the file durango.c +according to the needs of the application. + +----------------------------------------------------------------------------- +REVISION HISTORY +----------------------------------------------------------------------------- + +04/05/04 Version 2.57.00 + +----------------------------------------------------------------------------- +FUNCTIONAL CHANGES +----------------------------------------------------------------------------- + +* Fixed the PLL setting for 1280x1024@70Hz and 1152x864@70Hz. + +============================================================================= + +03/30/04 Version 2.56.00 + +----------------------------------------------------------------------------- +FUNCTIONAL CHANGES +----------------------------------------------------------------------------- + +* Updated the GX2 render code such that BLTs that involve source will work + correctly even if source is not involved in the ROP. + +============================================================================= + +03/26/04 Version 2.55.00 + +----------------------------------------------------------------------------- +FUNCTIONAL CHANGES +----------------------------------------------------------------------------- + +* Filled in all missing refresh rates in the mode table for Redcloud and Castle. +* Added a new routine gfx_is_panel_mode_supported. +* Added new routines gfx_set_graphics_palette and gfx_set_graphics_palette_entry + to support using the video palette to gamma correct graphics data. + +============================================================================= + +03/11/04 Version 2.54.00 + +----------------------------------------------------------------------------- +FUNCTIONAL CHANGES +----------------------------------------------------------------------------- + +* Updated the video palette routines to clear the bypass both bit before + updating the palette. + +============================================================================= + +03/02/04 Version 2.53.00 + +----------------------------------------------------------------------------- +FUNCTIONAL CHANGES +----------------------------------------------------------------------------- + +* Added 1152x864@60, 85, 90 and 100Hz to the mode table. + +============================================================================= + +02/07/04 Version 2.52.00 + +----------------------------------------------------------------------------- +FUNCTIONAL CHANGES +----------------------------------------------------------------------------- + +* Updated Durango to support Castle, including a 48MHz dotref. +* Added 90 and 100Hz modes for Redcloud. +* Updated the PLL table to remove any pre-divides by 2. + +============================================================================= + +10/24/03 Version 2.51.08 + +----------------------------------------------------------------------------- +FUNCTIONAL CHANGES +----------------------------------------------------------------------------- + +* Removed GX2 1.0 support from the PLL routines, gfx_set_clock_frequency and + gfx_get_clock_frequency. +* Fixed a bug in gfx_set_clock_frequency, wherein the last three PLL values in + Durango's PLL table could never be set. + +============================================================================= + +09/22/03 Version 2.51.07 + +----------------------------------------------------------------------------- +FUNCTIONAL CHANGES +----------------------------------------------------------------------------- + +* Changed gfx_set_video_palette and gfx_set_video_palette_entry such that calling + one of these routines will also configure the video hardware to route video + data through the DF palette RAM. +* Added a new routine, gfx_set_video_palette_bypass to toggle the 'Bypass Both' + functionality of the SC1200 and GX2 palette RAMs. + +============================================================================= + +09/02/03 Version 2.51.06 + +----------------------------------------------------------------------------- +FUNCTIONAL CHANGES +----------------------------------------------------------------------------- + +* Added new routine gfx_get_max_video_width for SC1200 and CS5530. This routine + calculates the maximum theoretical video width based on the current display + mode and video clock. + +============================================================================= + +08/07/03 Version 2.51.05 + +----------------------------------------------------------------------------- +FUNCTIONAL CHANGES +----------------------------------------------------------------------------- + +* Fixed gfx_get_core_freq for SCx2xx when the fast PCI frequency is not 33MHz. +* Fixed gfx_get_compression_pitch to mask correct bits. +* Changed CS5530 and SCx2xx code to always enable video in the display + controller. +* Modified GX2 PLL code to only update the PLL when the value has not already + been programmed. + +============================================================================= + +06/17/03 Version 2.51.04 + +----------------------------------------------------------------------------- +FUNCTIONAL CHANGES +----------------------------------------------------------------------------- + +* Fixed code to set default gamma RAM for SCx2xx. + +============================================================================= + +06/02/03 Version 2.51.03 + +----------------------------------------------------------------------------- +FUNCTIONAL CHANGES +----------------------------------------------------------------------------- + +* Fixed gfx_get_cursor_position for GX2 to support large display resolutions. +* Added default gamma RAM table for SCx2xx and GX2 to correct CSC hardware. + +============================================================================= + +03/20/03 Version 2.51.02 + +----------------------------------------------------------------------------- +FUNCTIONAL CHANGES +----------------------------------------------------------------------------- + +* Changed all preprocessor statements to conform to K and R standard. +* Added support for 56Hz modes to all Durango routines. +* Added missing header file to gfx_priv.h + +============================================================================= + +03/13/03 Version 2.51.01 + +----------------------------------------------------------------------------- +FUNCTIONAL CHANGES +----------------------------------------------------------------------------- + +* Updated file headers to NSC standard headers. +* Added routine definitions for private and local routines. +* Minor fixes for compilation without warnings. +* Fixed panel timings for 640x480 panels and 1024x768 panels. + +============================================================================= + +02/05/03 Version 2.49.02 + +----------------------------------------------------------------------------- +FUNCTIONAL CHANGES +----------------------------------------------------------------------------- + +* Fixed GX2 left clipping for 4:2:0 video. + +============================================================================= + +01/29/03 Version 2.49.01 + +----------------------------------------------------------------------------- +FUNCTIONAL CHANGES +----------------------------------------------------------------------------- + +* Removed unused variable in CS5530 video code. +* Changed max supported pixel clock for SCx2xx to 157.5 MHz. + +============================================================================= + +01/10/03 Version 2.49.00 + +----------------------------------------------------------------------------- +FUNCTIONAL CHANGES +----------------------------------------------------------------------------- + +* Added extra wait loop when polling for CRC completion. +* Removed code that sets the pitch offsets for 4:2:0 video within + gfx_set_video_size. +* Fixed panning code to work with any display pitch. +* Added code to clear the PLL bypass bit when setting the dot PLL. +* Fixed panning code so cursor never disappears when panning. +* Changed GX2 delay loops to do a volatile register read to prevent + the entire delay loop from being discarded by a compiler. + +============================================================================= + +11/19/02 Version 2.47.00 + +----------------------------------------------------------------------------- +FUNCTIONAL CHANGES +----------------------------------------------------------------------------- + +* Updated gfx2_* routines to use a signed stride. +* SW workaround for issue #134.8 - Strange horizontal lines appearing while + drawing lines. +* Implemented gfx_set_video_left_crop for CS5530 +* Updated sub carrier reset values for NTSC and PAL. + +============================================================================= + +08/29/02 Version 2.45.00 + +----------------------------------------------------------------------------- +FUNCTIONAL CHANGES +----------------------------------------------------------------------------- + +* Modified gfx_set_cursor_position to use cursor position when panning and not adjust + using hotspots. +* Added new routine gfx_get_refreshrate_from_mode. +* Added gfx_text_blt routine. +* Added gfx_get_tv_display_mode_frequency routine. +* Added gfx_get_frequency_from_refreshrate routine. +* Added gfx_set_video_cursor_enable routine. +* Fixed Linux compilation warnings. +* Updated modeset code to clear panning variables. +* Added panel timings for 1600x1200 desktops. +* Removed wait for VBlank when panning using cursor routines. + +============================================================================= + +07/12/02 Version 2.43.03 + +----------------------------------------------------------------------------- +FUNCTIONAL CHANGES +----------------------------------------------------------------------------- + +* Modified gfx_get_display_mode to support 56 Hz modes. +* Added support for 8K pitch when setting a true color mode above 1024x768 +* Added a byte-packed option to gfx2_mono_expand_blt +* Fix for Carmel D2 alpha blending issue. +* Added typecasts for proper compilation. +* Fixed CS5535 MBIU address. +* Added new GX2 routine, gfx2_text_blt +* Added MSR implementations for Linux. +* Further optimized default GX1 string macros. +* Added new routine, gfx_set_panel_present to allow panning without adjusting panel timings. +* Added assembly macros for 32-bit Windows applications. + +============================================================================= + +03/21/02 Version 2.41.02 + +----------------------------------------------------------------------------- +FUNCTIONAL CHANGES +----------------------------------------------------------------------------- + +* Optimized GX2 Bitmap-to-screen BLTs by using a 2-line offscreen scratch area. +* Fixed a bug in GX2 monochrome bitmap BLTs. +* Fixed gfx_get_clock_frequency for GX2 2.0 +* Added 56 Hz support to gfx_get_clock_frequency +* Changed gfx_set_compression_size to subtract header size +* Changed gfx_get_compression_size to add header size + +============================================================================= + +03/04/02 Version 2.39.01 + +----------------------------------------------------------------------------- +FUNCTIONAL CHANGES +----------------------------------------------------------------------------- + +* Added support for CS5535 MSRs. +* Fixed a bug in monochrome bitmap BLTs. +* Added support for 32-bit CRC mechanism in GX2 2.0. +* First official GX2 release. +* Added support for new Dot PLL mechanism in GX2 2.0 +* Added support for Carmel D1.1 and D2. + +============================================================================= + +01/24/02 Version 2.37.00 + +----------------------------------------------------------------------------- +FUNCTIONAL CHANGES +----------------------------------------------------------------------------- + +* Changed gfx_get_clock_frequency, gfx_get_cursor_offset and gfx_get_display_offset + to be outside the GFX_READ_ROUTINES flag. +* Modified the modeset code to set higher FIFO priority levels for high bandwidth + modes. +* Init code no longer returns Redcloud ID when no chip detected. +* Added fix for Redcloud 1.x rev ID +* New GX2 PLL settings - updates to the 14 MHz table and a new 48 MHz table. +* Optimized all bitmap-to-screen routines. Optimizations include new macros that + allow correct operation in a 16-bit environment. +* 3K cache is now assumed to be the default scratchpad configuration. +* gfx_get_frame_buffer_size for GX2 no longer uses a VGA register. This allows + correct operation even with an external VGA card present in the system. +* Added support for 1152x864 desktop resolution on a flat panel. +* Added 24BPP support for large display modes. +* Modified gfx_set_video_scale such that an identity scale is now default. +* Modifed flat panel modeset code to dynamically determine the size of the mode table. +* Added support for Carmel Rev D2. + +============================================================================= + +10/22/01 Version 2.35.01 + +----------------------------------------------------------------------------- +FUNCTIONAL CHANGES +----------------------------------------------------------------------------- + +* New release notes format. +* Added fix for SC1200 issue #813 (TVOut field indication is reversed. +* Added check for invalid values in video upscale. +* Fixed compilation warnings and run-time errors under DOS. +* Added new macros for word I/O. +* Optimized VSAII MSR code to used DWORD I/O. +* Fixed SoftVG base PCI base addresses. +* Several fixes to Redcloud API found during bringup. +* Modified Durango to support 4-pixel video alignment for Redcloud. +* Added the functions gfx_test_vip_overflow, gfx_get_vip_line, + gfx_set_decoder_luminance_filter, gfx_set_tv_YV_delya and + gfx_set_tv_field_status_invert. +* Added support for Carmel D1 revision ID. +* Moved gfx_get_vip_base and gfx_get_vbi_pitch outside of the + GXF_READ_ROUTINES flag. +* Minor fixes to saa7114.c and gfx_set_tv-enable. +* Added don't care option in gfx_set_vip_base. +* Added fix for SC1200 issue #1121 (VIP FIFO bus request threshold bit + is inverted. + +============================================================================= + +07/31/01 Version 2.33.02 + +----------------------------------------------------------------------------- +FUNCTIONAL CHANGES +----------------------------------------------------------------------------- +* Completed implementation of vertical downscaling support for GX2. +* Added a method to lock the display controller timings. +* Added support for SC1200 Rev C. +* Small modifications to gfx_set_video_format. +* Removed unused and unimplemented I2C functions. +* Changes to prevent errors and compiler warnings in DOS. +* Updated headers to include both BSD and GPL licenses. + +============================================================================= + +06/08/01 Version 2.31.00 + +----------------------------------------------------------------------------- +FUNCTIONAL CHANGES +----------------------------------------------------------------------------- +* Added new routines to manipulate vertical video downscaling on GX2. +* Minor fixes to the function gfx_read_window_crc. +* Implemented all init routines for GX2 except gfx_get_core_freq. +* Added support for 27MHz reference frequency to the GX2 PLL. +* Added new function gfx_get_softvga_active. +* Minor changes to the function sc1200_reset_video. +* Fixed some minor compiler warnings. + +============================================================================= + +04/25/01 Version 2.29.00 + +----------------------------------------------------------------------------- +FUNCTIONAL CHANGES +----------------------------------------------------------------------------- +* Disabled all CSC when setting an RGB video format. +* Modified sc1200_set_video_size to add 2 to the window height. +* Modified code to support the accelerator and cursor in pixel and line double modes. +* Modified gfx_get_core_freq to be a dynamic API routine. +* Added the function gfx_read_window_crc for GX2. +* Added init routine gfx_get_graphics_register_base for GX2. +* Added new macros to access the scratchpad RAM to support Win2K and WinME. +* Added mew macros to access the GP registers for GX2. + +============================================================================= + +04/06/01 Version 2.27.00 + +----------------------------------------------------------------------------- +FUNCTIONAL CHANGES +----------------------------------------------------------------------------- +* Added new TV read functions: + gfx_get_tv_enable, gfx_get_tv_output, gfx_get_tv_display_mode, + gfx_get_tv_mode_count, gfx_is_tv_display_mode_supported +* Added new function gfx_set_display_bpp. +* Added new function gfx_get_frame_buffer_line_size. +* Modified gfx_set_vbi_base to accept pure physical addresses instead of offsets. +* Implemented video and display controller routines for GX2. +* Modified some initialization routines to be dynamic. +* Created new API extension for GX2 MSR accesses. +* Added new icon routines for GX2. +* Modified gfx_set_tv_display to preserve current bpp. +* Minor modifications to gfx_set_tv_format, gfx_set_video_palette and + gfx_set_video_palette entry. +* Added support for 1152x864@75Hz + +============================================================================= + +03/12/01 Version 2.25.00 + +----------------------------------------------------------------------------- +FUNCTIONAL CHANGES +----------------------------------------------------------------------------- +* Adapted new revision format system. +* Synchronized with NSTA Durango. Updated support for all SC1200 features. +* Added support for 640x400 as well as emulated VGA modes. +* Added new routines to access single palette color entries. +* Added new routine to return the maximum supported pixel clock. +* Added new routine gfx_set_crt_enable to manipulate the CRT display logic. +* Added new rendering routine gfx_color_pattern_fill. +* Added 4:2:0 and RGB video format support for CS5530 and SC1200. +* Modified code to allow operation under DOS. + +============================================================================= + +07/21/00 Version 2.04 + +----------------------------------------------------------------------------- +FUNCTIONAL CHANGES +----------------------------------------------------------------------------- +* Verified Xfree86 driver version 1.1.4 under Linux, and ce v2.3. +* Merged sc1200 changes. +* Added routines to support the query of current display mode. +* Added functions gfx_enable_softvga, dfx_disable_softvga. +* Added code optimization in rendering loops to use 32 bit writes where possible. +* Added gfx_is_mode_supported to query if given mode supported by the h/w. +* Added Flat panel support, realy testing with panel done only for 800x600. +* Removed subtraction of 16 from gfx_set_compression_size. +* Added version.h file to reflect the version of the durango used. + +============================================================================= + +03/03/00 Version 2.01 + +----------------------------------------------------------------------------- +FUNCTIONAL CHANGES +----------------------------------------------------------------------------- +* Verified Xfree86 driver version 1.1 under FreeBSD and Linux. +* Added automatic detection of BLT buffer bases in "gfx_set_bpp" routine. +* Fixed improper setting of VGA attrubute controller index register. +* Moved "gfx_get_display_bpp" to always be included. +* Moved "gfx_get_hactive" and "gfx_get_vactive" to always be included. +* Clipped video source size if off bottom or right side. +* Properly adjusted video offset if clipped on the top side. +* Added "gfx_get_video_line_size" and "gfx_get_video_xclip" routines. + +============================================================================= + +02/21/00 Version 2.00 + +----------------------------------------------------------------------------- +FUNCTIONAL CHANGES +----------------------------------------------------------------------------- +* Added gfx_vga.c. +* Added write to GP_BLIT_STATUS in "gfx_set_bpp" routine. +* Verified alpha blending on SC1200. +* Removed "gfx_set_blt_buffers" routine. + +============================================================================= + +02/09/00 Version 1.20 + +----------------------------------------------------------------------------- +FUNCTIONAL CHANGES +----------------------------------------------------------------------------- +* Verified display modes and graphics rendering on SC1200. +* Updated PLL table for SC1200 to set modes. +* DURANGO.C FILE CHANGE!: Modifed and added compiler definitions. +* Split gfx_disp.c file into gu1_disp.c and gu2_disp.c +* Split gfx_rndr.c file into gu1_rndr.c and gu2_rndr.c +* Split gfx_vid.c file into vid_5530.c, vid_1400.c, and vid_1200.c +* Split gfx_vip.c file into vip_1400.c and vip_1200.c +* Split gfx_tv.c file into geode_tv.c and fs451_tv.c +* Split gfx_i2c.c file into acc_i2c.c and gpio_i2c.c. +* Split gfx_dcdr.c file to saa7114.c +* Added GFX_READ_ROUTINES compiler definition. +* Moved routines from gfx_read.c (no longer exists) to other files. +* Abstracted display controller access in the video overlay routines. +* Added routines to control display compression hardware. + +============================================================================= + +01/28/00 Version 1.13 + +----------------------------------------------------------------------------- +FUNCTIONAL CHANGES +----------------------------------------------------------------------------- +* Passes randomly generated rendering tests in Darwin for GXLV. +* Fixed bug for large bitmap to screen BLTs (greater than 64K). +* Fixed bug for pattern fills using solid source data for plane masks. + +============================================================================= + +01/14/00 Version 1.12 + +----------------------------------------------------------------------------- +FUNCTIONAL CHANGES +----------------------------------------------------------------------------- +* Added proper use of hotspot to gfx_set_cursor_position. +* Fixed buffer size to handle all frame buffer start address alignments. +* Added initial version of gfx_tv.c. + +============================================================================= + +01/07/00 Version 1.11 + +----------------------------------------------------------------------------- +FUNCTIONAL CHANGES +----------------------------------------------------------------------------- +* Fixed bug with transparent BLTs (loading transparent color into BB1). +* Added definition of gfx_color_bitmap_to_screen_blt to gfx_rtns.h. +* Added gfx_color_bitmap_to_screen_xblt (transparent bitmap to screen). + +============================================================================= + +12/21/99 Version 1.10 + +----------------------------------------------------------------------------- +FUNCTIONAL CHANGES +----------------------------------------------------------------------------- +* Added additional video decoder routines to gfx_dcdr.c. +* Added VBI routines to gfx_vip.c. +* Added alpha blending routines for SC1200 to gfx_vid.c + +============================================================================= + +10/01/99 Version 1.00 + +----------------------------------------------------------------------------- +FUNCTIONAL CHANGES +----------------------------------------------------------------------------- +* Added video port, video decoder, I2C, and hardware query rouines. +* New files: gfx_vip.c, gfx_dcdr.c, gfx_i2c.c, gfx_read.c. + +============================================================================= + +08/27/99 Version 0.05 + +----------------------------------------------------------------------------- +FUNCTIONAL CHANGES +----------------------------------------------------------------------------- +* INTERFACE CHANGE: Changed "gfx_csptr[]" to "gfx_vidptr" and "gfx_vipptr". +* Added "gfx_get_vid_register_base" and "gfx_get_vip_register_base". +* Added initial PLL table for SC1400. +* Verified mode set and video overlay routines work correctly on SC1400. +* Updated initilization routines. +* Added update of graphics engine in "gfx_set_display_pitch". + +============================================================================= + +08/20/99 Version 0.04 + +----------------------------------------------------------------------------- +FUNCTIONAL CHANGES +----------------------------------------------------------------------------- +* INTERFACE CHANGE: "gfx_load_*" routines changed to "gfx_set_*" for naming + consistency. The "gfx_text_glyph" routine was removed. +* Added video overlay routines. +* Added gfx_vid.c file. + +============================================================================= + +08/16/99 Version 0.03 + +----------------------------------------------------------------------------- +FUNCTIONAL CHANGES +----------------------------------------------------------------------------- +* INTERFACE CHANGE: Access to CS5530 now through separate pointer. Project + must declare and map the gfx_csptr[GFX_CSPTR_SIZE] variable. +* Added durango.c file as template for main source file. +* Added gfx_init.c file. + +============================================================================= + +08/04/99 Version 0.02 + +----------------------------------------------------------------------------- +FUNCTIONAL CHANGES +----------------------------------------------------------------------------- +* Additional modes in gfx_mode.h file. +* Separated register definitions from gfx_defs.h into gfx_regs.h. + +============================================================================= + +07/30/99 Version 0.01 + +----------------------------------------------------------------------------- +FUNCTIONAL CHANGES +----------------------------------------------------------------------------- +* Initial release. +----------------------------------------------------------------------------- + diff --git a/driver/xf86-video-geode/src/gfx/rndr_gu1.c b/driver/xf86-video-geode/src/gfx/rndr_gu1.c new file mode 100644 index 000000000..5ad5af1c9 --- /dev/null +++ b/driver/xf86-video-geode/src/gfx/rndr_gu1.c @@ -0,0 +1,1584 @@ +/* Copyright (c) 2005 Advanced Micro Devices, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + * + * Neither the name of the Advanced Micro Devices, Inc. nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * */ + +/* + * This file contains routines to program the 2D acceleration hardware for + * the first generation graphics unit (GXLV, SC1200). + * + * gfx_set_bpp + * gfx_set_solid_pattern + * gfx_set_mono_pattern + * gfx_set_color_pattern + * gfx_set_solid_source + * gfx_set_mono_source + * gfx_set_raster_operation + * gfx_pattern_fill + * gfx_screen_to_screen_blt + * gfx_screen_to_screen_xblt + * gfx_color_bitmap_to_screen_blt + * gfx_color_bitmap_to_screen_xblt + * gfx_mono_bitmap_to_screen_blt + * gfx_bresenham_line + * gfx_wait_until_idle + * */ + +#if GFX_NO_IO_IN_WAIT_MACROS +#define GFX_WAIT_PENDING \ + while(READ_REG16(GP_BLIT_STATUS) & BS_BLIT_PENDING) { ; } +#define GFX_WAIT_BUSY \ + while(READ_REG16(GP_BLIT_STATUS) & BS_BLIT_BUSY) { ; } +#define GFX_WAIT_PIPELINE \ + while (READ_REG16(GP_BLIT_STATUS) & BS_PIPELINE_BUSY) { ; } +#else +#define GFX_WAIT_PENDING \ + while(READ_REG16(GP_BLIT_STATUS) & BS_BLIT_PENDING) { INB (0x80); } +#define GFX_WAIT_BUSY \ + while(READ_REG16(GP_BLIT_STATUS) & BS_BLIT_BUSY) { INB (0x80); } +#define GFX_WAIT_PIPELINE \ + while (READ_REG16(GP_BLIT_STATUS) & BS_PIPELINE_BUSY) { INB (0x80); } +#endif + +void gu1_detect_blt_buffer_base(void); + +/*--------------------------------------------------------------------------- + * GFX_SET_BPP + * + * This routine sets the bits per pixel value in the graphics engine. + * It is also stored in a static variable to use in the future calls to + * the rendering routines. + *--------------------------------------------------------------------------- + */ +#if GFX_2DACCEL_DYNAMIC +void +gu1_set_bpp(unsigned short bpp) +#else +void +gfx_set_bpp(unsigned short bpp) +#endif +{ + int control = 0; + unsigned short pitch = gfx_get_display_pitch(); + + GFXbpp = bpp; + + /* DETECT BASE ADDRESSES FOR BLT BUFFERS */ + /* Different for 2K or 3K of scratchpad. Also need to calculate */ + /* the number of pixels that can fit in a BLT buffer - need to */ + /* subtract 16 for alignment considerations. The 2K case, for */ + /* example, is 816 bytes wide, allowing 800 pixels in 8 BPP, which */ + /* means rendering operations won't be split for 800x600. */ + + gu1_detect_blt_buffer_base(); + GFXbufferWidthPixels = GFXbb1Base - GFXbb0Base - 16; + if (bpp > 8) { + /* If 16bpp, divide GFXbufferWidthPixels by 2 */ + GFXbufferWidthPixels >>= 1; + } + + /* SET THE GRAPHICS CONTROLLER BPP AND PITCH */ + if (bpp > 8) { + /* Set the 16bpp bit if necessary */ + control = BC_16BPP; + } + if ((gfx_cpu_version == GFX_CPU_PYRAMID) && (pitch > 2048)) { + control |= BC_FB_WIDTH_4096; + } else if (pitch > 1024) { + control |= BC_FB_WIDTH_2048; + } + GFX_WAIT_BUSY; + WRITE_REG32(GP_BLIT_STATUS, control); +} + +/* + *--------------------------------------------------------------------------- + * GFX_SET_SOLID_SOURCE + * + * This routine is used to specify a solid source color. For the Xfree96 + * display driver, the source color is used to specify a planemask and the + * ROP is adjusted accordingly. + *--------------------------------------------------------------------------- + */ +#if GFX_2DACCEL_DYNAMIC +void +gu1_set_solid_source(unsigned long color) +#else +void +gfx_set_solid_source(unsigned long color) +#endif +{ + /* CLEAR TRANSPARENCY FLAG */ + + GFXsourceFlags = 0; + + /* FORMAT 8 BPP COLOR */ + /* GX requires 8BPP color data be duplicated into bits [15:8]. */ + + if (GFXbpp == 8) { + color &= 0x00FF; + color |= (color << 8); + } + + /* POLL UNTIL ABLE TO WRITE THE SOURCE COLOR */ + + GFX_WAIT_PENDING; + WRITE_REG16(GP_SRC_COLOR_0, (unsigned short)color); + WRITE_REG16(GP_SRC_COLOR_1, (unsigned short)color); +} + +/* + *--------------------------------------------------------------------------- + * GFX_SET_MONO_SOURCE + * + * This routine is used to specify the monochrome source colors. + * It must be called *after* loading any pattern data (those routines + * clear the source flags). + *--------------------------------------------------------------------------- + */ +#if GFX_2DACCEL_DYNAMIC +void +gu1_set_mono_source(unsigned long bgcolor, unsigned long fgcolor, + unsigned short transparent) +#else +void +gfx_set_mono_source(unsigned long bgcolor, unsigned long fgcolor, + unsigned short transparent) +#endif +{ + /* SET TRANSPARENCY FLAG */ + + GFXsourceFlags = transparent ? RM_SRC_TRANSPARENT : 0; + + /* FORMAT 8 BPP COLOR */ + /* GX requires 8BPP color data be duplicated into bits [15:8]. */ + + if (GFXbpp == 8) { + bgcolor &= 0x00FF; + bgcolor |= (bgcolor << 8); + fgcolor &= 0x00FF; + fgcolor |= (fgcolor << 8); + } + + /* POLL UNTIL ABLE TO WRITE THE SOURCE COLOR */ + + GFX_WAIT_PENDING; + WRITE_REG16(GP_SRC_COLOR_0, (unsigned short)bgcolor); + WRITE_REG16(GP_SRC_COLOR_1, (unsigned short)fgcolor); +} + +/* + *--------------------------------------------------------------------------- + * GFX_SET_SOLID_PATTERN + * + * This routine is used to specify a solid pattern color. It is called + * before performing solid rectangle fills or more complicated BLTs that + * use a solid pattern color. + * + * The driver should always call "gfx_load_raster_operation" after a call + * to this routine to make sure that the pattern flags are set appropriately. + *--------------------------------------------------------------------------- + */ +#if GFX_2DACCEL_DYNAMIC +void +gu1_set_solid_pattern(unsigned long color) +#else +void +gfx_set_solid_pattern(unsigned long color) +#endif +{ + /* CLEAR TRANSPARENCY FLAG */ + + GFXsourceFlags = 0; + + /* SET PATTERN FLAGS */ + + GFXpatternFlags = 0; + + /* FORMAT 8 BPP COLOR */ + /* GX requires 8BPP color data be duplicated into bits [15:8]. */ + + if (GFXbpp == 8) { + color &= 0x00FF; + color |= (color << 8); + } + + /* SAVE THE REFORMATTED COLOR FOR LATER */ + /* Used to call the "GFX_solid_fill" routine for special cases. */ + + GFXsavedColor = color; + + /* POLL UNTIL ABLE TO WRITE THE PATTERN COLOR */ + + GFX_WAIT_PENDING; + WRITE_REG16(GP_PAT_COLOR_0, (unsigned short)color); +} + +/* + *--------------------------------------------------------------------------- + * GFX_SET_MONO_PATTERN + * + * This routine is used to specify a monochrome pattern. + *--------------------------------------------------------------------------- + */ +#if GFX_2DACCEL_DYNAMIC +void +gu1_set_mono_pattern(unsigned long bgcolor, unsigned long fgcolor, + unsigned long data0, unsigned long data1, unsigned char transparent) +#else +void +gfx_set_mono_pattern(unsigned long bgcolor, unsigned long fgcolor, + unsigned long data0, unsigned long data1, unsigned char transparent) +#endif +{ + /* CLEAR TRANSPARENCY FLAG */ + + GFXsourceFlags = 0; + + /* SET PATTERN FLAGS */ + + GFXpatternFlags = transparent ? RM_PAT_MONO | RM_PAT_TRANSPARENT : + RM_PAT_MONO; + + /* FORMAT 8 BPP COLOR */ + /* GXm requires 8BPP color data be duplicated into bits [15:8]. */ + + if (GFXbpp == 8) { + bgcolor &= 0x00FF; + bgcolor |= (bgcolor << 8); + fgcolor &= 0x00FF; + fgcolor |= (fgcolor << 8); + } + + /* POLL UNTIL ABLE TO WRITE THE PATTERN COLORS AND DATA */ + + GFX_WAIT_PENDING; + WRITE_REG16(GP_PAT_COLOR_0, (unsigned short)bgcolor); + WRITE_REG16(GP_PAT_COLOR_1, (unsigned short)fgcolor); + WRITE_REG32(GP_PAT_DATA_0, data0); + WRITE_REG32(GP_PAT_DATA_1, data1); +} + +/* + *--------------------------------------------------------------------------- + * GFX_SET_COLOR_PATTERN + * + * This routine is used to specify a color pattern. + *--------------------------------------------------------------------------- + */ +#if GFX_2DACCEL_DYNAMIC +void +gu1_set_color_pattern(unsigned long bgcolor, unsigned long fgcolor, + unsigned long data0, unsigned long data1, unsigned long data2, + unsigned long data3, unsigned char transparent) +#else +void +gfx_set_color_pattern(unsigned long bgcolor, unsigned long fgcolor, + unsigned long data0, unsigned long data1, unsigned long data2, + unsigned long data3, unsigned char transparent) +#endif +{ + /* CLEAR TRANSPARENCY FLAG */ + + GFXsourceFlags = 0; + + /* SET PATTERN FLAGS */ + + GFXpatternFlags = transparent ? RM_PAT_MONO | RM_PAT_TRANSPARENT : + RM_PAT_MONO; + + GFXpatternFlags |= RM_PAT_COLOR; + /* FORMAT 8 BPP COLOR */ + /* GXm requires 8BPP color data be duplicated into bits [15:8]. */ + + if (GFXbpp == 8) { + bgcolor &= 0x00FF; + bgcolor |= (bgcolor << 8); + fgcolor &= 0x00FF; + fgcolor |= (fgcolor << 8); + } + + /* POLL UNTIL ABLE TO WRITE THE PATTERN COLORS AND DATA */ + + GFX_WAIT_PENDING; + WRITE_REG16(GP_PAT_COLOR_0, (unsigned short)bgcolor); + WRITE_REG16(GP_PAT_COLOR_1, (unsigned short)fgcolor); + WRITE_REG32(GP_PAT_DATA_0, data0); + WRITE_REG32(GP_PAT_DATA_1, data1); + if (GFXbpp > 8) { + WRITE_REG32(GP_PAT_DATA_2, data2); + WRITE_REG32(GP_PAT_DATA_3, data3); + } +} + +/* + *--------------------------------------------------------------------------- + * GFX_LOAD_COLOR_PATTERN_LINE + * + * This routine is used to load a single line of a 8x8 color pattern. + *--------------------------------------------------------------------------- + */ +#if GFX_2DACCEL_DYNAMIC +void +gu1_load_color_pattern_line(short y, unsigned long *pattern_8x8) +#else +void +gfx_load_color_pattern_line(short y, unsigned long *pattern_8x8) +#endif +{ + /* CLEAR TRANSPARENCY FLAG */ + + GFXsourceFlags = 0; + + /* SET PATTERN FLAGS */ + + GFXpatternFlags = RM_PAT_COLOR; + + y &= 7; + + if (GFXbpp > 8) + pattern_8x8 += (y << 2); + else + pattern_8x8 += (y << 1); + + /* POLL UNTIL ABLE TO WRITE THE PATTERN COLORS AND DATA */ + + GFX_WAIT_PENDING; + WRITE_REG32(GP_PAT_DATA_0, pattern_8x8[0]); + WRITE_REG32(GP_PAT_DATA_1, pattern_8x8[1]); + if (GFXbpp > 8) { + WRITE_REG32(GP_PAT_DATA_2, pattern_8x8[2]); + WRITE_REG32(GP_PAT_DATA_3, pattern_8x8[3]); + } +} + +/* + *--------------------------------------------------------------------------- + * GFX_SET_RASTER_OPERATION + * + * This routine loads the specified raster operation. It sets the pattern + * flags appropriately. + *--------------------------------------------------------------------------- + */ +#if GFX_2DACCEL_DYNAMIC +void +gu1_set_raster_operation(unsigned char rop) +#else +void +gfx_set_raster_operation(unsigned char rop) +#endif +{ + unsigned short rop16; + + /* GENERATE 16-BIT VERSION OF ROP WITH PATTERN FLAGS */ + + rop16 = (unsigned short)rop | GFXpatternFlags; + if ((rop & 0x33) ^ ((rop >> 2) & 0x33)) + rop16 |= GFXsourceFlags; + + /* SAVE ROP FOR LATER COMPARISONS */ + /* Need to have the pattern flags included */ + + GFXsavedRop = rop16; + + /* SET FLAG INDICATING ROP REQUIRES DESTINATION DATA */ + /* True if even bits (0:2:4:6) do not equal the correspinding */ + /* even bits (1:3:5:7). */ + + GFXusesDstData = ((rop & 0x55) ^ ((rop >> 1) & 0x55)); + + /* POLL UNTIL ABLE TO WRITE THE PATTERN COLOR */ + /* Only one operation can be pending at a time. */ + + GFX_WAIT_PENDING; + WRITE_REG16(GP_RASTER_MODE, rop16); +} + +/* + *--------------------------------------------------------------------------- + * GFX_SOLID_FILL + * + * This routine MUST be used when performing a solid rectangle fill with + * the ROPs of PATCOPY (0xF0), BLACKNESS (0x00), WHITENESS (0xFF), or + * PATINVERT (0x0F). There is a bug in GXm for these cases that requires a + * workaround. + * + * For BLACKNESS (ROP = 0x00), set the color to 0x0000. + * For WHITENESS (ROP = 0xFF), set the color to 0xFFFF. + * For PATINVERT (ROP = 0x0F), invert the desired color. + * + * X screen X position (left) + * Y screen Y position (top) + * WIDTH width of rectangle, in pixels + * HEIGHT height of rectangle, in scanlines + * COLOR fill color + * + * THIS ROUTINE SHOULD NOT BE DIRECTLY CALLED FROM THE DRIVER. The driver + * should always use GFX_pattern_fill and let that routine call this one + * when approipriate. This is to hide quirks specific to MediaGX hardware. + *--------------------------------------------------------------------------- + */ +void +gu1_solid_fill(unsigned short x, unsigned short y, + unsigned short width, unsigned short height, unsigned long color) +{ + unsigned short section; + + /* POLL UNTIL ABLE TO WRITE TO THE REGISTERS */ + /* Only one operation can be pending at a time. */ + + GFX_WAIT_PENDING; + + /* SET REGISTERS TO DRAW RECTANGLE */ + + WRITE_REG16(GP_DST_XCOOR, x); + WRITE_REG16(GP_DST_YCOOR, y); + WRITE_REG16(GP_HEIGHT, height); + WRITE_REG16(GP_RASTER_MODE, 0x00F0); /* PATCOPY */ + WRITE_REG16(GP_PAT_COLOR_0, (unsigned short)color); + + /* CHECK WIDTH FOR GX BUG WORKAROUND */ + + if (width <= 16) { + /* OK TO DRAW SMALL RECTANGLE IN ONE PASS */ + + WRITE_REG16(GP_WIDTH, width); + WRITE_REG16(GP_BLIT_MODE, 0); + } else { + /* DRAW FIRST PART OF RECTANGLE */ + /* Get to a 16 pixel boundary. */ + + section = 0x10 - (x & 0x0F); + WRITE_REG16(GP_WIDTH, section); + WRITE_REG16(GP_BLIT_MODE, 0); + + /* POLL UNTIL ABLE TO LOAD THE SECOND RECTANGLE */ + + GFX_WAIT_PENDING; + WRITE_REG16(GP_DST_XCOOR, x + section); + WRITE_REG16(GP_DST_YCOOR, y); + WRITE_REG16(GP_WIDTH, width - section); + WRITE_REG16(GP_BLIT_MODE, 0); + } +} + +/* + *---------------------------------------------------------------------------- + * GFX_PATTERN_FILL + * + * This routine is used to fill a rectangular region. The pattern must + * be previously loaded using one of GFX_load_*_pattern routines. Also, the + * raster operation must be previously specified using the + * "GFX_load_raster_operation" routine. + * + * X screen X position (left) + * Y screen Y position (top) + * WIDTH width of rectangle, in pixels + * HEIGHT height of rectangle, in scanlines + *---------------------------------------------------------------------------- + */ +#if GFX_2DACCEL_DYNAMIC +void +gu1_pattern_fill(unsigned short x, unsigned short y, + unsigned short width, unsigned short height) +#else +void +gfx_pattern_fill(unsigned short x, unsigned short y, + unsigned short width, unsigned short height) +#endif +{ + unsigned short section, buffer_width, blit_mode; + + /* CHECK IF OPTIMIZED SOLID CASES */ + /* Check all 16 bits of the ROP to include solid pattern flags. */ + + switch (GFXsavedRop) { + /* CHECK FOR SPECIAL CASES WITHOUT DESTINATION DATA */ + /* Need hardware workaround for fast "burst write" cases. */ + + case 0x00F0: + gu1_solid_fill(x, y, width, height, (unsigned short)GFXsavedColor); + break; + case 0x000F: + gu1_solid_fill(x, y, width, height, (unsigned short)~GFXsavedColor); + break; + case 0x0000: + gu1_solid_fill(x, y, width, height, 0x0000); + break; + case 0x00FF: + gu1_solid_fill(x, y, width, height, 0xFFFF); + break; + + /* REMAINING CASES REQUIRE DESTINATION DATA OR NOT SOLID COLOR */ + + default: + + /* DETERMINE BLT MODE VALUE */ + /* Still here for non-solid patterns without destination data. */ + + blit_mode = GFXusesDstData ? BM_READ_DST_FB0 : 0; + + /* SET SOURCE EXPANSION MODE */ + /* If the ROP requires source data, then the source data is all 1's */ + /* and then expanded into the desired color in GP_SRC_COLOR_1. */ + + blit_mode |= BM_SOURCE_EXPAND; + + /* POLL UNTIL ABLE TO WRITE TO THE REGISTERS */ + /* Write the registers that do not change for each section. */ + + GFX_WAIT_PENDING; + WRITE_REG16(GP_HEIGHT, height); + + /* SINCE ONLY DESTINATION DATA, WE CAN USE BOTH BB0 AND BB1. */ + /* Therefore, width available = BLT buffer width * 2. */ + + buffer_width = GFXbufferWidthPixels << 1; + + /* REPEAT UNTIL FINISHED WITH RECTANGLE */ + /* Perform BLT in vertical sections, as wide as the BLT buffer */ + /* allows. Hardware does not split the operations, so */ + /* software must do it to avoid large scanlines that would */ + /* overflow the BLT buffers. */ + + while (width > 0) { + /* DETERMINE WIDTH OF SECTION */ + + if (width > buffer_width) + section = buffer_width; + else + section = width; + + /* POLL UNTIL ABLE TO WRITE TO THE REGISTERS */ + + GFX_WAIT_PENDING; + WRITE_REG16(GP_DST_XCOOR, x); + WRITE_REG16(GP_DST_YCOOR, y); + WRITE_REG16(GP_WIDTH, section); + WRITE_REG16(GP_BLIT_MODE, blit_mode); + + /* ADJUST PARAMETERS FOR NEXT SECTION */ + + width -= section; + x += section; + } + break; + } +} + +/* + *---------------------------------------------------------------------------- + * GFX_COLOR_PATTERN_FILL + * + * This routine is used to render a rectangle using the current raster + * operation and the specified color pattern. It allows an 8x8 color + * pattern to be rendered without multiple calls to the gfx_set_color_pattern + * and gfx_pattern_fill routines. + * + * X screen X position (left) + * Y screen Y position (top) + * WIDTH width of rectangle, in pixels + * HEIGHT height of rectangle, in scanlines + * *PATTERN pointer to 8x8 color pattern data + *---------------------------------------------------------------------------- + */ +#if GFX_2DACCEL_DYNAMIC +void +gu1_color_pattern_fill(unsigned short x, unsigned short y, + unsigned short width, unsigned short height, unsigned long *pattern) +#else +void +gfx_color_pattern_fill(unsigned short x, unsigned short y, + unsigned short width, unsigned short height, unsigned long *pattern) +#endif +{ + unsigned short blit_mode, passes, cur_y, pat_y, i; + unsigned short buffer_width, line_width; + unsigned short bpp_shift, section, cur_x; + + /* SET APPROPRIATE INCREMENT */ + + bpp_shift = (GFXbpp > 8) ? 2 : 1; + + /* SET DESTINATION REQUIRED */ + + blit_mode = GFXusesDstData ? BM_READ_DST_FB0 : 0; + + /* SET SOURCE EXPANSION */ + + blit_mode |= BM_SOURCE_EXPAND; + + /* OVERRIDE RASTER MODE TO FORCE A COLOR PATTERN */ + + GFX_WAIT_PENDING; + WRITE_REG16(GP_RASTER_MODE, + (GFXsavedRop & ~RM_PAT_MASK & ~RM_PAT_TRANSPARENT) | RM_PAT_COLOR); + + /* WRITE THE REGISTERS THAT DO NOT CHANGE */ + /* If destination data is required, the width and */ + /* x position will be overwritten. */ + + WRITE_REG16(GP_HEIGHT, 1); + WRITE_REG16(GP_WIDTH, width); + WRITE_REG16(GP_DST_XCOOR, x); + + /* THE ENTIRE PATTERN WILL NOT BE DRAWN IF THE HEIGHT IS LESS THAN 8 */ + + passes = (height < 8) ? height : 8; + + /* SINCE ONLY DESTINATION DATA, WE CAN USE BOTH BB0 AND BB1. */ + /* Therefore, width available = BLT buffer width * 2. */ + + buffer_width = GFXbufferWidthPixels << 1; + + for (i = 0; i < passes; i++) { + pat_y = ((y + i) & 7) << bpp_shift; + cur_y = y + i; + + /* WRITE THE PATTERN DATA FOR THE ACTIVE LINE */ + + GFX_WAIT_PENDING; + WRITE_REG32(GP_PAT_DATA_0, pattern[pat_y]); + WRITE_REG32(GP_PAT_DATA_1, pattern[pat_y + 1]); + + if (GFXbpp > 8) { + WRITE_REG32(GP_PAT_DATA_2, pattern[pat_y + 2]); + WRITE_REG32(GP_PAT_DATA_3, pattern[pat_y + 3]); + } + + /* SPLIT BLT LINE INTO SECTIONS IF REQUIRED */ + /* If no destination data is required, we can ignore */ + /* the BLT buffers. Otherwise, we must separate the BLT */ + /* so as not to overflow the buffers */ + + if (blit_mode & BM_READ_DST_BB0) { + line_width = width; + cur_x = x; + + while (line_width) { + section = + (line_width > buffer_width) ? buffer_width : line_width; + cur_y = y + i; + + GFX_WAIT_PENDING; + WRITE_REG16(GP_DST_XCOOR, cur_x); + WRITE_REG16(GP_WIDTH, section); + + while (cur_y < y + height) { + GFX_WAIT_PENDING; + WRITE_REG16(GP_DST_YCOOR, cur_y); + WRITE_REG16(GP_BLIT_MODE, blit_mode); + cur_y += 8; + } + + cur_x += section; + line_width -= section; + } + + } else { + while (cur_y < y + height) { + GFX_WAIT_PENDING; + WRITE_REG16(GP_DST_YCOOR, cur_y); + WRITE_REG16(GP_BLIT_MODE, blit_mode); + cur_y += 8; + } + } + + } + + /* RESTORE ORIGINAL ROP AND FLAGS */ + + GFX_WAIT_PENDING; + WRITE_REG16(GP_RASTER_MODE, GFXsavedRop); + +} + +/* + *---------------------------------------------------------------------------- + * SCREEN TO SCREEN BLT + * + * This routine should be used to perform a screen to screen BLT when the + * ROP does not require destination data. + * + * SRCX screen X position to copy from + * SRCY screen Y position to copy from + * DSTX screen X position to copy to + * DSTY screen Y position to copy to + * WIDTH width of rectangle, in pixels + * HEIGHT height of rectangle, in scanlines + *---------------------------------------------------------------------------- + */ +#if GFX_2DACCEL_DYNAMIC +void +gu1_screen_to_screen_blt(unsigned short srcx, unsigned short srcy, + unsigned short dstx, unsigned short dsty, unsigned short width, + unsigned short height) +#else +void +gfx_screen_to_screen_blt(unsigned short srcx, unsigned short srcy, + unsigned short dstx, unsigned short dsty, unsigned short width, + unsigned short height) +#endif +{ + unsigned short section, buffer_width; + unsigned short blit_mode; + + /* CHECK IF RASTER OPERATION REQUIRES DESTINATION DATA */ + + blit_mode = GFXusesDstData ? BM_READ_DST_FB1 | BM_READ_SRC_FB : + BM_READ_SRC_FB; + + /* CHECK Y DIRECTION */ + /* Hardware has support for negative Y direction. */ + + if (dsty > srcy) { + blit_mode |= BM_REVERSE_Y; + srcy += height - 1; + dsty += height - 1; + } + + /* CHECK X DIRECTION */ + /* Hardware does not support negative X direction since at the time */ + /* of development all supported resolutions could fit a scanline of */ + /* data at once into the BLT buffers (using both BB0 and BB1). This */ + /* code is more generic to allow for any size BLT buffer. */ + + if (dstx > srcx) { + srcx += width; + dstx += width; + } + + /* POLL UNTIL ABLE TO WRITE TO THE REGISTERS */ + /* Write the registers that do not change for each section. */ + + GFX_WAIT_PENDING; + WRITE_REG16(GP_HEIGHT, height); + + /* CHECK AVAILABLE BLT BUFFER SIZE */ + /* Can use both BLT buffers if no destination data is required. */ + + buffer_width = GFXusesDstData ? GFXbufferWidthPixels : + GFXbufferWidthPixels << 1; + + /* REPEAT UNTIL FINISHED WITH RECTANGLE */ + /* Perform BLT in vertical sections, as wide as the BLT buffer allows. */ + /* Hardware does not split the operations, so software must do it to */ + /* avoid large scanlines that would overflow the BLT buffers. */ + + while (width > 0) { + /* CHECK WIDTH OF CURRENT SECTION */ + + if (width > buffer_width) + section = buffer_width; + else + section = width; + + /* PROGRAM REGISTERS THAT ARE THE SAME FOR EITHER X DIRECTION */ + + GFX_WAIT_PENDING; + WRITE_REG16(GP_SRC_YCOOR, srcy); + WRITE_REG16(GP_DST_YCOOR, dsty); + WRITE_REG16(GP_WIDTH, section); + + /* CHECK X DIRECTION */ + + if (dstx > srcx) { + /* NEGATIVE X DIRECTION */ + /* Still positive X direction within the section. */ + + srcx -= section; + dstx -= section; + WRITE_REG16(GP_SRC_XCOOR, srcx); + WRITE_REG16(GP_DST_XCOOR, dstx); + WRITE_REG16(GP_BLIT_MODE, blit_mode); + } else { + /* POSITIVE X DIRECTION */ + + WRITE_REG16(GP_SRC_XCOOR, srcx); + WRITE_REG16(GP_DST_XCOOR, dstx); + WRITE_REG16(GP_BLIT_MODE, blit_mode); + dstx += section; + srcx += section; + } + width -= section; + } +} + +/* + *---------------------------------------------------------------------------- + * SCREEN TO SCREEN TRANSPARENT BLT + * + * This routine should be used to perform a screen to screen BLT when a + * specified color should by transparent. The only supported ROP is SRCCOPY. + * + * SRCX screen X position to copy from + * SRCY screen Y position to copy from + * DSTX screen X position to copy to + * DSTY screen Y position to copy to + * WIDTH width of rectangle, in pixels + * HEIGHT height of rectangle, in scanlines + * COLOR transparent color + *---------------------------------------------------------------------------- + */ +#if GFX_2DACCEL_DYNAMIC +void +gu1_screen_to_screen_xblt(unsigned short srcx, unsigned short srcy, + unsigned short dstx, unsigned short dsty, unsigned short width, + unsigned short height, unsigned long color) +#else +void +gfx_screen_to_screen_xblt(unsigned short srcx, unsigned short srcy, + unsigned short dstx, unsigned short dsty, unsigned short width, + unsigned short height, unsigned long color) +#endif +{ + unsigned short section, buffer_width; + unsigned short blit_mode = BM_READ_SRC_FB; + + /* CHECK Y DIRECTION */ + /* Hardware has support for negative Y direction. */ + + if (dsty > srcy) { + blit_mode |= BM_REVERSE_Y; + srcy += height - 1; + dsty += height - 1; + } + + /* CHECK X DIRECTION */ + /* Hardware does not support negative X direction since at the time */ + /* of development all supported resolutions could fit a scanline of */ + /* data at once into the BLT buffers (using both BB0 and BB1). This */ + /* code is more generic to allow for any size BLT buffer. */ + + if (dstx > srcx) { + srcx += width; + dstx += width; + } + + /* CALCULATE BLT BUFFER SIZE */ + /* Need to use BB1 to store the BLT buffer data. */ + + buffer_width = GFXbufferWidthPixels; + + /* WRITE TRANSPARENCY COLOR TO BLT BUFFER 1 */ + + if (GFXbpp == 8) { + color &= 0x00FF; + color |= (color << 8); + } + color = (color & 0x0000FFFF) | (color << 16); + + /* WAIT UNTIL PIPELINE IS NOT BUSY BEFORE LOADING DATA INTO BB1 */ + /* Need to make sure any previous BLT using BB1 is complete. */ + /* Only need to load 32 bits of BB1 for the 1 pixel BLT that follows. */ + + GFX_WAIT_BUSY; + WRITE_SCRATCH32(GFXbb1Base, color); + + /* DO BOGUS BLT TO LATCH DATA FROM BB1 */ + /* Already know graphics pipeline is idle. */ + /* Only need to latch data into the holding registers for the current */ + /* data from BB1. A 1 pixel wide BLT will suffice. */ + + WRITE_REG32(GP_DST_XCOOR, 0); + WRITE_REG32(GP_SRC_XCOOR, 0); + WRITE_REG32(GP_WIDTH, 0x00010001); + WRITE_REG16(GP_RASTER_MODE, 0x00CC); + WRITE_REG16(GP_BLIT_MODE, BM_READ_SRC_FB | BM_READ_DST_BB1); + + /* WRITE REGISTERS FOR REAL SCREEN TO SCREEN BLT */ + + GFX_WAIT_PENDING; + WRITE_REG16(GP_HEIGHT, height); + WRITE_REG16(GP_RASTER_MODE, 0x10C6); + WRITE_REG32(GP_PAT_COLOR_0, 0xFFFFFFFF); + + /* REPEAT UNTIL FINISHED WITH RECTANGLE */ + /* Perform BLT in vertical sections, as wide as the BLT buffer allows. */ + /* Hardware does not split the operations, so software must do it to */ + /* avoid large scanlines that would overflow the BLT buffers. */ + + while (width > 0) { + /* CHECK WIDTH OF CURRENT SECTION */ + + if (width > buffer_width) + section = buffer_width; + else + section = width; + + /* PROGRAM REGISTERS THAT ARE THE SAME FOR EITHER X DIRECTION */ + + GFX_WAIT_PENDING; + WRITE_REG16(GP_SRC_YCOOR, srcy); + WRITE_REG16(GP_DST_YCOOR, dsty); + WRITE_REG16(GP_WIDTH, section); + + /* CHECK X DIRECTION */ + /* Again, this must be done in software, and can be removed if the */ + /* display driver knows that the BLT buffers will always be large */ + /* enough to contain an entire scanline of a screen to screen BLT. */ + + if (dstx > srcx) { + /* NEGATIVE X DIRECTION */ + /* Still positive X direction within the section. */ + + srcx -= section; + dstx -= section; + WRITE_REG16(GP_SRC_XCOOR, srcx); + WRITE_REG16(GP_DST_XCOOR, dstx); + WRITE_REG16(GP_BLIT_MODE, blit_mode); + } else { + /* POSITIVE X DIRECTION */ + + WRITE_REG16(GP_SRC_XCOOR, srcx); + WRITE_REG16(GP_DST_XCOOR, dstx); + WRITE_REG16(GP_BLIT_MODE, blit_mode); + dstx += section; + srcx += section; + } + width -= section; + } +} + +/* + *---------------------------------------------------------------------------- + * COLOR BITMAP TO SCREEN BLT + * + * This routine transfers color bitmap data to the screen. For most cases, + * when the ROP is SRCCOPY, it may be faster to write a separate routine that + * copies the data to the frame buffer directly. This routine should be + * used when the ROP requires destination data. + * + * Transparency is handled by another routine. + * + * SRCX X offset within source bitmap + * SRCY Y offset within source bitmap + * DSTX screen X position to render data + * DSTY screen Y position to render data + * WIDTH width of rectangle, in pixels + * HEIGHT height of rectangle, in scanlines + * *DATA pointer to bitmap data + * PITCH pitch of bitmap data (bytes between scanlines) + *---------------------------------------------------------------------------- + */ + +#if GFX_2DACCEL_DYNAMIC +void +gu1_color_bitmap_to_screen_blt(unsigned short srcx, unsigned short srcy, + unsigned short dstx, unsigned short dsty, unsigned short width, + unsigned short height, unsigned char *data, long pitch) +#else +void +gfx_color_bitmap_to_screen_blt(unsigned short srcx, unsigned short srcy, + unsigned short dstx, unsigned short dsty, unsigned short width, + unsigned short height, unsigned char *data, long pitch) +#endif +{ + unsigned short section, buffer_width; + unsigned short blit_mode = BM_READ_SRC_BB0; + unsigned short temp_height; + unsigned long dword_bytes_needed, bytes_extra; + unsigned long bpp_shift; + long array_offset; + + /* CHECK SIZE OF BLT BUFFER */ + + buffer_width = GFXbufferWidthPixels; + + /* CHECK IF RASTER OPERATION REQUIRES DESTINATION DATA */ + /* If no destination data, we have twice the room for */ + /* source data. */ + + if (GFXusesDstData) + blit_mode |= BM_READ_DST_FB1; + else + buffer_width <<= 1; + + /* SET THE SCRATCHPAD BASE */ + + SET_SCRATCH_BASE(GFXbb0Base); + + /* POLL UNTIL ABLE TO WRITE TO THE REGISTERS */ + /* Write the registers that do not change for each section. */ + + GFX_WAIT_PENDING; + WRITE_REG16(GP_HEIGHT, 1); + + bpp_shift = (GFXbpp + 7) >> 4; + + while (width > 0) { + if (width > buffer_width) + section = buffer_width; + else + section = width; + + dword_bytes_needed = (section << bpp_shift) & ~3l; + bytes_extra = (section << bpp_shift) & 3l; + + temp_height = height; + + /* WRITE THE REGISTERS FOR EACH SECTION */ + /* The GX hardware will auto-increment the Y coordinate, meaning */ + /* that we don't have to. */ + + WRITE_REG16(GP_WIDTH, section); + WRITE_REG16(GP_DST_XCOOR, dstx); + WRITE_REG16(GP_DST_YCOOR, dsty); + + /* CALCULATE THE BITMAP OFFSET */ + + array_offset = + (unsigned long)srcy *(long)pitch + ((long)srcx << bpp_shift); + + while (temp_height--) { + GFX_WAIT_PIPELINE; + + /* WRITE ALL DATA TO THE BLT BUFFERS */ + /* The WRITE_SCRATCH_STRING macro assumes that the data begins + * at the scratchpad offset set by the SET_SCRATCH_BASE macro. + * */ + + WRITE_SCRATCH_STRING(dword_bytes_needed, bytes_extra, data, + array_offset); + WRITE_REG16(GP_BLIT_MODE, blit_mode); + + array_offset += pitch; + } + + width -= section; + srcx += section; + dstx += section; + } +} + +/* + *---------------------------------------------------------------------------- + * COLOR BITMAP TO SCREEN TRANSPARENT BLT + * + * This routine transfers color bitmap data to the screen with transparency. + * The transparent color is specified. The only supported ROP is SRCCOPY, + * meaning that transparency cannot be applied if the ROP requires + * destination data (this is a hardware restriction). + * + * SRCX X offset within source bitmap + * SRCY Y offset within source bitmap + * DSTX screen X position to render data + * DSTY screen Y position to render data + * WIDTH width of rectangle, in pixels + * HEIGHT height of rectangle, in scanlines + * *DATA pointer to bitmap data + * PITCH pitch of bitmap data (bytes between scanlines) + * COLOR transparent color + *---------------------------------------------------------------------------- + */ +#if GFX_2DACCEL_DYNAMIC +void +gu1_color_bitmap_to_screen_xblt(unsigned short srcx, unsigned short srcy, + unsigned short dstx, unsigned short dsty, unsigned short width, + unsigned short height, unsigned char *data, long pitch, + unsigned long color) +#else +void +gfx_color_bitmap_to_screen_xblt(unsigned short srcx, unsigned short srcy, + unsigned short dstx, unsigned short dsty, unsigned short width, + unsigned short height, unsigned char *data, long pitch, + unsigned long color) +#endif +{ + unsigned short section, buffer_width; + unsigned short temp_height; + unsigned long dword_bytes_needed, bytes_extra; + unsigned long bpp_shift; + long array_offset; + + /* CHECK SIZE OF BLT BUFFER */ + + buffer_width = GFXbufferWidthPixels; + + /* WRITE TRANSPARENCY COLOR TO BLT BUFFER 1 */ + + if (GFXbpp == 8) { + color &= 0x00FF; + color |= (color << 8); + } + color = (color & 0x0000FFFF) | (color << 16); + + /* WAIT UNTIL PIPELINE IS NOT BUSY BEFORE LOADING DATA INTO BB1 */ + /* Need to make sure any previous BLT using BB1 is complete. */ + /* Only need to load 32 bits of BB1 for the 1 pixel BLT that follows. */ + + GFX_WAIT_PIPELINE; + GFX_WAIT_PENDING; + WRITE_SCRATCH32(GFXbb1Base, color); + + /* DO BOGUS BLT TO LATCH DATA FROM BB1 */ + /* Already know graphics pipeline is idle. */ + /* Only need to latch data into the holding registers for the current */ + /* data from BB1. A 1 pixel wide BLT will suffice. */ + + WRITE_REG32(GP_DST_XCOOR, 0); + WRITE_REG32(GP_SRC_XCOOR, 0); + WRITE_REG32(GP_WIDTH, 0x00010001); + WRITE_REG16(GP_RASTER_MODE, 0x00CC); + WRITE_REG16(GP_BLIT_MODE, BM_READ_SRC_FB | BM_READ_DST_BB1); + + /* POLL UNTIL ABLE TO WRITE TO THE REGISTERS */ + /* Write the registers that do not change for each section. */ + + GFX_WAIT_PENDING; + WRITE_REG16(GP_HEIGHT, 1); + WRITE_REG16(GP_RASTER_MODE, 0x10C6); + WRITE_REG32(GP_PAT_COLOR_0, 0xFFFFFFFF); + + bpp_shift = (GFXbpp + 7) >> 4; + + /* SET THE SCRATCHPAD BASE */ + + SET_SCRATCH_BASE(GFXbb0Base); + + while (width > 0) { + if (width > buffer_width) + section = buffer_width; + else + section = width; + + dword_bytes_needed = (section << bpp_shift) & ~3l; + bytes_extra = (section << bpp_shift) & 3l; + + temp_height = height; + + /* WRITE THE REGISTERS FOR EACH SECTION */ + /* The GX hardware will auto-increment the Y coordinate, meaning */ + /* that we don't have to. */ + + WRITE_REG16(GP_WIDTH, section); + WRITE_REG16(GP_DST_XCOOR, dstx); + WRITE_REG16(GP_DST_YCOOR, dsty); + + /* CALCULATE THE BITMAP OFFSET */ + + array_offset = + (unsigned long)srcy *(long)pitch + ((long)srcx << bpp_shift); + + while (temp_height--) { + GFX_WAIT_PIPELINE; + + /* WRITE ALL DATA TO THE BLT BUFFERS */ + /* The WRITE_SCRATCH_STRING macro assumes that the data begins at the */ + /* scratchpad offset set by the SET_SCRATCH_BASE macro. */ + + WRITE_SCRATCH_STRING(dword_bytes_needed, bytes_extra, data, + array_offset); + WRITE_REG16(GP_BLIT_MODE, BM_READ_SRC_BB0); + + array_offset += pitch; + } + + width -= section; + srcx += section; + dstx += section; + } +} + +/* + *---------------------------------------------------------------------------- + * MONOCHROME BITMAP TO SCREEN BLT + * + * This routine transfers monochrome bitmap data to the screen. + * + * SRCX X offset within source bitmap + * SRCY Y offset within source bitmap + * DSTX screen X position to render data + * DSTY screen Y position to render data + * WIDTH width of rectangle, in pixels + * HEIGHT height of rectangle, in scanlines + * *DATA pointer to bitmap data + * PITCH pitch of bitmap data (bytes between scanlines) + *---------------------------------------------------------------------------- + */ +#if GFX_2DACCEL_DYNAMIC +void +gu1_mono_bitmap_to_screen_blt(unsigned short srcx, unsigned short srcy, + unsigned short dstx, unsigned short dsty, unsigned short width, + unsigned short height, unsigned char *data, short pitch) +#else +void +gfx_mono_bitmap_to_screen_blt(unsigned short srcx, unsigned short srcy, + unsigned short dstx, unsigned short dsty, unsigned short width, + unsigned short height, unsigned char *data, short pitch) +#endif +{ + unsigned short section, buffer_width; + unsigned short blit_mode = BM_READ_SRC_BB0 | BM_SOURCE_EXPAND; + unsigned short temp_height; + unsigned long dword_bytes_needed, bytes_extra; + long array_offset; + + /* CHECK IF RASTER OPERATION REQUIRES DESTINATION DATA */ + /* If no destination data, the source data will always fit. */ + /* So, in that event we will set the buffer width to a */ + /* fictitiously large value such that the BLT is never split. */ + + if (GFXusesDstData) { + buffer_width = GFXbufferWidthPixels; + blit_mode |= BM_READ_DST_FB1; + } else + buffer_width = 3200; + + /* CHECK IF DATA ALREADY IN BLIT BUFFER */ + /* If the pointer is NULL, data for the full BLT is already there */ + /* WARNING: This could cause problems if destination data is */ + /* involved and it overflows the BLT buffer. Need to remove */ + /* this option and change the drivers to use a temporary buffer. */ + + if (!data) { + GFX_WAIT_PENDING; + WRITE_REG16(GP_SRC_XCOOR, srcx & 7); + WRITE_REG16(GP_DST_XCOOR, dstx); + WRITE_REG16(GP_DST_YCOOR, dsty); + WRITE_REG16(GP_WIDTH, width); + WRITE_REG16(GP_HEIGHT, height); + WRITE_REG16(GP_BLIT_MODE, blit_mode); + return; + } + + /* SET THE SCRATCHPAD BASE */ + + SET_SCRATCH_BASE(GFXbb0Base); + + /* POLL UNTIL ABLE TO WRITE TO THE REGISTERS */ + /* Write the registers that do not change for each section. */ + + GFX_WAIT_PENDING; + WRITE_REG16(GP_HEIGHT, 1); + + while (width > 0) { + if (width > buffer_width) + section = buffer_width; + else + section = width; + + /* CALCULATE BYTES NEEDED */ + /* Add 1 for possible alignment issues. */ + + dword_bytes_needed = ((section + 7 + (srcx & 7)) >> 3) & ~3l; + bytes_extra = ((section + 7 + (srcx & 7)) >> 3) & 3l; + + temp_height = height; + + /* WRITE THE REGISTERS FOR EACH SECTION */ + /* The GX hardware will auto-increment the Y coordinate, meaning */ + /* that we don't have to. */ + + WRITE_REG16(GP_WIDTH, section); + WRITE_REG16(GP_DST_XCOOR, dstx); + WRITE_REG16(GP_DST_YCOOR, dsty); + WRITE_REG16(GP_SRC_XCOOR, srcx & 7); + + /* CALCULATE THE BITMAP OFFSET */ + + array_offset = (unsigned long)srcy *(long)pitch + ((long)srcx >> 3); + + while (temp_height--) { + GFX_WAIT_PIPELINE; + + /* WRITE ALL DATA TO THE BLT BUFFERS */ + /* The WRITE_SCRATCH_STRING macro assumes that the data begins at the */ + /* scratchpad offset set by the SET_SCRATCH_BASE macro. */ + + WRITE_SCRATCH_STRING(dword_bytes_needed, bytes_extra, data, + array_offset); + WRITE_REG16(GP_BLIT_MODE, blit_mode); + + array_offset += pitch; + } + + width -= section; + srcx += section; + dstx += section; + } +} + +/* + *---------------------------------------------------------------------------- + * MONOCHROME TEXT BLT + * + * This routine transfers contiguous monochrome text data to the screen. + * + * DSTX screen X position to render data + * DSTY screen Y position to render data + * WIDTH width of rectangle, in pixels + * HEIGHT height of rectangle, in scanlines + * *DATA pointer to bitmap data + *---------------------------------------------------------------------------- + */ +#if GFX_2DACCEL_DYNAMIC +void +gu1_text_blt(unsigned short dstx, unsigned short dsty, unsigned short width, + unsigned short height, unsigned char *data) +#else +void +gfx_text_blt(unsigned short dstx, unsigned short dsty, unsigned short width, + unsigned short height, unsigned char *data) +#endif +{ + unsigned long dword_bytes_needed, bytes_extra; + long pitch, buffer_bytes, data_bytes; + + /* CALCULATE DATA SIZE */ + + pitch = (width + 7) >> 3; + data_bytes = (long)height *pitch; + + /* CHECK FOR SIMPLE CASE */ + /* This routine is designed to render a source copy text glyph. If + * destination data is required or the source data will not fit, we will + * punt the operation to the more versatile (and slow) mono bitmap routine + * */ + + if (GFXbpp > 8) + buffer_bytes = GFXbufferWidthPixels << 1; + else + buffer_bytes = GFXbufferWidthPixels; + + if (GFXusesDstData || data_bytes > buffer_bytes) { + gfx_mono_bitmap_to_screen_blt(0, 0, dstx, dsty, width, height, data, + (short)pitch); + return; + } + + /* SET THE SCRATCHPAD BASE */ + + SET_SCRATCH_BASE(GFXbb0Base); + + /* POLL UNTIL ABLE TO WRITE TO THE REGISTERS */ + + dword_bytes_needed = data_bytes & ~3l; + bytes_extra = data_bytes & 3l; + + GFX_WAIT_PENDING; + WRITE_REG16(GP_HEIGHT, height); + WRITE_REG16(GP_WIDTH, width); + WRITE_REG16(GP_DST_XCOOR, dstx); + WRITE_REG16(GP_DST_YCOOR, dsty); + WRITE_REG16(GP_SRC_XCOOR, 0); + + /* WRITE ALL DATA TO THE BLT BUFFERS */ + /* The WRITE_SCRATCH_STRING macro assumes that the data begins at the */ + /* scratchpad offset set by the SET_SCRATCH_BASE macro. */ + + GFX_WAIT_PIPELINE; + + WRITE_SCRATCH_STRING(dword_bytes_needed, bytes_extra, data, 0); + WRITE_REG16(GP_BLIT_MODE, BM_READ_SRC_BB0 | BM_SOURCE_TEXT); +} + +/* + *---------------------------------------------------------------------------- + * BRESENHAM LINE + * + * This routine draws a vector using the specified Bresenham parameters. + * Currently this file does not support a routine that accepts the two + * endpoints of a vector and calculates the Bresenham parameters. If it + * ever does, this routine is still required for vectors that have been + * clipped. + * + * X screen X position to start vector + * Y screen Y position to start vector + * LENGTH length of the vector, in pixels + * INITERR Bresenham initial error term + * AXIALERR Bresenham axial error term + * DIAGERR Bresenham diagonal error term + * FLAGS VM_YMAJOR, VM_MAJOR_INC, VM_MINOR_INC + *---------------------------------------------------------------------------- + */ +#if GFX_2DACCEL_DYNAMIC +void +gu1_bresenham_line(unsigned short x, unsigned short y, + unsigned short length, unsigned short initerr, + unsigned short axialerr, unsigned short diagerr, unsigned short flags) +#else +void +gfx_bresenham_line(unsigned short x, unsigned short y, + unsigned short length, unsigned short initerr, + unsigned short axialerr, unsigned short diagerr, unsigned short flags) +#endif +{ + unsigned short vector_mode = flags; + + if (GFXusesDstData) + vector_mode |= VM_READ_DST_FB; + + /* CHECK NULL LENGTH */ + + if (!length) + return; + + /* LOAD THE REGISTERS FOR THE VECTOR */ + + GFX_WAIT_PENDING; + WRITE_REG16(GP_DST_XCOOR, x); + WRITE_REG16(GP_DST_YCOOR, y); + WRITE_REG16(GP_VECTOR_LENGTH, length); + WRITE_REG16(GP_INIT_ERROR, initerr); + WRITE_REG16(GP_AXIAL_ERROR, axialerr); + WRITE_REG16(GP_DIAG_ERROR, diagerr); + WRITE_REG16(GP_VECTOR_MODE, vector_mode); +} + +/*--------------------------------------------------------------------------- + * GFX_WAIT_UNTIL_IDLE + * + * This routine waits until the graphics engine is idle. This is required + * before allowing direct access to the frame buffer. + *--------------------------------------------------------------------------- + */ +#if GFX_2DACCEL_DYNAMIC +void +gu1_wait_until_idle(void) +#else +void +gfx_wait_until_idle(void) +#endif +{ + GFX_WAIT_BUSY; +} + +/*--------------------------------------------------------------------------- + * GFX_TEST_BLT_PENDING + * + * This routine returns 1 if a BLT is pending, meaning that a call to + * perform a rendering operation would stall. Otherwise it returns 0. + * It is used by Darwin during random testing to only start a BLT + * operation when it knows the Durango routines won't spin on graphics + * (so Darwin can continue to do frame buffer reads and writes). + *--------------------------------------------------------------------------- + */ +#if GFX_2DACCEL_DYNAMIC +int +gu1_test_blt_pending(void) +#else +int +gfx_test_blt_pending(void) +#endif +{ + if (READ_REG16(GP_BLIT_STATUS) & BS_BLIT_PENDING) + return (1); + else + return (0); +} + +/*--------------------------------------------------------------------------- + * BLT BUFFERS!!!!! + *--------------------------------------------------------------------------- + */ + +/* THE BOOT CODE MUST SET THE BLT BUFFER BASES USING THE "CPU_WRITE" */ +/* INSTRUCTION TO ONE OF THE FOLLOWING VALUES: */ + +#define BB0_BASE_2K 0x800 +#define BB1_BASE_2K 0xB30 +#define BB0_BASE_3K 0x400 +#define BB1_BASE_3K 0x930 + +/*--------------------------------------------------------------------------- + * gu1_detect_blt_buffer_base + * + * This detection is hidden from the driver by being called from the + * "gfx_set_bpp" routine. + * + * This is fairly ugly for the following reasons: + * + * - It is the boot code that must set the BLT buffer bases to the + * appropriate values and load the scratchpad tags. + * - The old drivers would also set the base address values to what they + * knew they should be for the 2K or 3K scratchpad configuration. + * - Unfortunately, to set the base addresses requires the use of the + * CPU_WRITE instruction, an instruction specific to GX. + * - Using the CPU_WRITE instruction requires the use of assembly to + * produce the appropriate op codes. + * - Assembly is something that is avoided in Durango because it is not + * platform independent. Some compilers do not support inline assembly. + * - Therefore Durango cannot use the CPU_WRITE instruction. + * - Therefore drivers using Durango must rely on the boot code to set + * the appropriate values. Durango uses this routine to check where + * the base addresses have been set. + * - Unfortunately, it is not as simple as using IO to check for 2K or 3K + * scratchpad size. In VSA1, even though the boot code may set it for + * 3K, SoftVGA comes along and resets it to 2K for it's use in text + * redraws. It used to be that the display driver would set it back + * to 3K. + * - So, the Durango code was changed to just always use 2K. + * - But, the XpressROM code sets it for 3K, and the newer versions of + * SoftVGA do not interfere with that, so then Durango needs to use + * the 3K values to work properly. + * - Therefore, Durango does somewhat of a kludge by writing to directly + * to the scratchpad at both the 2K and 3K locations, then performing + * a unobtrusive BLT that loads data into BB0 (the graphics engine + * always knows the true base). After the BLT, Durango looks to see + * which location changed to know where the base address is. + * - This is a relatively simple way to allow Durango to work on old + * and new platforms without using theCPU_WRITE instructions. + * + * To summarize, the BLT buffers are one of the most painful aspects of + * the GX graphics unit design, and have been removed from future designs + * (the graphics unit has its own dedicated RAM). Durango has tried to + * hide the BLT buffer use from the drivers. + *--------------------------------------------------------------------------- + */ +void +gu1_detect_blt_buffer_base(void) +{ + /* ASSUME 2K */ + + GFXbb0Base = BB0_BASE_2K; + GFXbb1Base = BB1_BASE_2K; + + /* CHECK IF SCRATCHPAD IS SET TO 3K OR 4K */ + /* Boot code should still set 3K values for 4K. */ + + if (gfx_gxm_config_read(GXM_CONFIG_GCR) & 0x08) { + /* WRITE DATA TO 3K LOCATION */ + + GFX_WAIT_BUSY; + WRITE_SCRATCH32(BB0_BASE_3K, 0xFEEDFACE); + + /* HAVE THE GRAPHICS UNIT STORE SOMETHING IN BB0 */ + + WRITE_REG32(GP_DST_XCOOR, 0x00000000); /* AT (0,0) */ + WRITE_REG32(GP_WIDTH, 0x00010004); /* 4x1 BLT */ + WRITE_REG16(GP_RASTER_MODE, 0x00AA); /* KEEP DST */ + WRITE_REG16(GP_BLIT_MODE, BM_READ_DST_FB0); /* STORE IN BB0 */ + + /* CHECK 3K LOCATION */ + /* Breaks if data happened to be 0xFEEDFACE - unlikely. */ + + GFX_WAIT_BUSY; + if (READ_SCRATCH32(BB0_BASE_3K) != 0xFEEDFACE) { + GFXbb0Base = BB0_BASE_3K; + GFXbb1Base = BB1_BASE_3K; + } + } +} + +/* END OF FILE */ diff --git a/driver/xf86-video-geode/src/gfx/rndr_gu2.c b/driver/xf86-video-geode/src/gfx/rndr_gu2.c new file mode 100644 index 000000000..db3ccf31a --- /dev/null +++ b/driver/xf86-video-geode/src/gfx/rndr_gu2.c @@ -0,0 +1,2183 @@ +/* Copyright (c) 2005 Advanced Micro Devices, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + * + * Neither the name of the Advanced Micro Devices, Inc. nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * */ + +/* + * This file contains routines to program the 2D acceleration hardware for + * the second generation graphics unit. + * + * Basic rendering routines (common to all Geode processors): + * gfx_set_bpp + * gfx_set_solid_pattern + * gfx_set_mono_pattern + * gfx_set_color_pattern + * gfx_set_solid_source + * gfx_set_mono_source + * gfx_set_raster_operation + * gfx_pattern_fill + * gfx_color_pattern_fill + * gfx_screen_to_screen_blt + * gfx_screen_to_screen_xblt + * gfx_color_bitmap_to_screen_blt + * gfx_color_bitmap_to_screen_xblt + * gfx_mono_bitmap_to_screen_blt + * gfx_bresenham_line + * gfx_wait_until_idle + * + * Extended rendering routines for second generation functionality: + * gfx2_set_source_stride + * gfx2_set_destination_stride + * gfx2_set_pattern_origins + * gfx2_set_source_transparency + * gfx2_set_alpha_mode + * gfx2_set_alpha_value + * gfx2_pattern_fill + * gfx2_color_pattern_fill + * gfx2_screen_to_screen_blt + * gfx2_mono_expand_blt + * gfx2_color_bitmap_to_screen_blt + * gfx2_mono_bitmap_to_screen_blt + * gfx2_bresenham_line + * gfx2_sync_to_vblank + * */ + +#define GU2_WAIT_PENDING \ + while(READ_GP32(MGP_BLT_STATUS) & MGP_BS_BLT_PENDING) +#define GU2_WAIT_BUSY \ + while(READ_GP32(MGP_BLT_STATUS) & MGP_BS_BLT_BUSY) +#define GU2_WAIT_HALF_EMPTY \ + while(!(READ_GP32(MGP_BLT_STATUS) & MGP_BS_HALF_EMPTY)) + +/* PATTERN SWIZZLES */ + +#define WORD_SWIZZLE(x) (((x) << 16) | ((x) >> 16)) +#define BYTE_SWIZZLE(x) (((x) << 24) | ((x) >> 24) | (((x) << 8) & \ + 0x00FF0000) | (((x) >> 8) & 0x0000FF00)) + +/* GLOBAL VARIABLES USED BY THE RENDERING ROUTINES */ + +unsigned long gu2_bpp; +unsigned long gu2_pitch = 1280; +unsigned long gu2_src_pitch = 1280; +unsigned long gu2_dst_pitch = 1280; +unsigned long gu2_xshift = 1; +unsigned long gu2_pattern_origin = 0; +unsigned long gu2_rop32; +unsigned long gu2_alpha32 = 0; +unsigned long gu2_alpha_value = 0; +unsigned long gu2_alpha_mode = 0; +unsigned long gu2_alpha_active = 0; +unsigned short gu2_alpha_blt_mode = 0; +unsigned short gu2_alpha_vec_mode = 0; +unsigned short gu2_blt_mode = 0; +unsigned short gu2_vector_mode = 0; +unsigned short gu2_bm_throttle = 0; +unsigned short gu2_vm_throttle = 0; +int gu2_current_line = 0; + +/* Kill a warning */ +void gfx_reset_pitch(unsigned short pitch); + +/*--------------------------------------------------------------------------- + * GFX_RESET_PITCH (PRIVATE ROUTINE - NOT PART OF API) + * + * This routine resets all pitches in the graphics engine to one value. + *--------------------------------------------------------------------------- + */ +#if GFX_2DACCEL_DYNAMIC +void +gu2_reset_pitch(unsigned short pitch) +#else +void +gfx_reset_pitch(unsigned short pitch) +#endif +{ + gu2_pitch = pitch; + gu2_dst_pitch = pitch; + gu2_src_pitch = pitch; +} + +/*--------------------------------------------------------------------------- + * GFX_SET_BPP + * + * This routine sets the bits per pixel value in the graphics engine. + * It is also stored in the static variable "gu2_bpp" to use in the future + * calls to the rendering routines. That variable contains the hardware + * specific value to load into the MGP_RASTER_MODE register. + *--------------------------------------------------------------------------- + */ +#if GFX_2DACCEL_DYNAMIC +void +gu2_set_bpp(unsigned short bpp) +#else +void +gfx_set_bpp(unsigned short bpp) +#endif +{ + GFXbpp = bpp; + + /* COVERT TO BPP/FORMAT VALUE */ + /* Save in global to combine with ROP later. */ + /* Could write register here and then use byte access for */ + /* the ROP, but would need to set other 24 bits to make */ + /* sure all are set to their appropriate values. */ + + switch (bpp) { + case 8: + gu2_bpp = MGP_RM_BPPFMT_332; + gu2_xshift = 0; + break; + case 12: + gu2_bpp = MGP_RM_BPPFMT_4444; + gu2_xshift = 1; + break; + case 15: + gu2_bpp = MGP_RM_BPPFMT_1555; + gu2_xshift = 1; + break; + case 16: + gu2_bpp = MGP_RM_BPPFMT_565; + gu2_xshift = 1; + break; + case 32: + gu2_bpp = MGP_RM_BPPFMT_8888; + gu2_xshift = 2; + break; + } + + /* SET INITIAL ROP BASED ONLY ON BPP */ + /* Needs to be set before loading any pattern or source colors. */ + /* We must wait for BUSY because these bits are not pipelined */ + /* in the hardware. */ + + GU2_WAIT_BUSY; + WRITE_GP32(MGP_RASTER_MODE, gu2_bpp); +} + +/* + *--------------------------------------------------------------------------- + * GFX_SET_SOLID_SOURCE + * + * This routine is used to specify a solid source color. For the Xfree96 + * display driver, the source color is used to specify a planemask and the + * ROP is adjusted accordingly. + *--------------------------------------------------------------------------- + */ +#if GFX_2DACCEL_DYNAMIC +void +gu2_set_solid_source(unsigned long color) +#else +void +gfx_set_solid_source(unsigned long color) +#endif +{ + /* CLEAR TRANSPARENCY FLAG */ + + GFXsourceFlags = 0; + + /* WRITE REGISTERS TO SPECIFY SOURCE COLOR */ + + GU2_WAIT_PENDING; + WRITE_GP32(MGP_SRC_COLOR_FG, color); +} + +/* + *--------------------------------------------------------------------------- + * GFX_SET_MONO_SOURCE + * + * This routine is used to specify the monochrome source colors. + * It must be called *after* loading any pattern data (those routines + * clear the source flags). + *--------------------------------------------------------------------------- + */ +#if GFX_2DACCEL_DYNAMIC +void +gu2_set_mono_source(unsigned long bgcolor, unsigned long fgcolor, + unsigned short transparent) +#else +void +gfx_set_mono_source(unsigned long bgcolor, unsigned long fgcolor, + unsigned short transparent) +#endif +{ + /* SET TRANSPARENCY FLAG */ + + GFXsourceFlags = transparent ? MGP_RM_SRC_TRANS : 0; + + /* WRITE COLOR VALUES */ + + GU2_WAIT_PENDING; + WRITE_GP32(MGP_SRC_COLOR_FG, fgcolor); + WRITE_GP32(MGP_SRC_COLOR_BG, bgcolor); +} + +/* + *--------------------------------------------------------------------------- + * GFX_SET_SOLID_PATTERN + * + * This routine is used to specify a solid pattern color. It is called + * before performing solid rectangle fills or more complicated BLTs that + * use a solid pattern color. + * + * The driver should always call "gfx_load_raster_operation" after a call + * to this routine to make sure that the pattern flags are set appropriately. + *--------------------------------------------------------------------------- + */ +#if GFX_2DACCEL_DYNAMIC +void +gu2_set_solid_pattern(unsigned long color) +#else +void +gfx_set_solid_pattern(unsigned long color) +#endif +{ + /* CLEAR TRANSPARENCY FLAG */ + + GFXsourceFlags = 0; + + /* SET PATTERN FLAGS */ + + GFXpatternFlags = 0; + + /* POLL UNTIL ABLE TO WRITE THE PATTERN COLOR */ + + GU2_WAIT_PENDING; + WRITE_GP32(MGP_RASTER_MODE, gu2_bpp); + WRITE_GP32(MGP_PAT_COLOR_0, color); +} + +/* + *--------------------------------------------------------------------------- + * GFX_SET_MONO_PATTERN + * + * This routine is used to specify a monochrome pattern. + *--------------------------------------------------------------------------- + */ +#if GFX_2DACCEL_DYNAMIC +void +gu2_set_mono_pattern(unsigned long bgcolor, unsigned long fgcolor, + unsigned long data0, unsigned long data1, unsigned char transparent) +#else +void +gfx_set_mono_pattern(unsigned long bgcolor, unsigned long fgcolor, + unsigned long data0, unsigned long data1, unsigned char transparent) +#endif +{ + /* CLEAR TRANSPARENCY FLAG */ + + GFXsourceFlags = 0; + + /* SET PATTERN FLAGS */ + + if (transparent) + GFXpatternFlags = MGP_RM_PAT_MONO | MGP_RM_PAT_TRANS; + else + GFXpatternFlags = MGP_RM_PAT_MONO; + + /* POLL UNTIL ABLE TO WRITE THE PATTERN COLOR */ + + GU2_WAIT_PENDING; + WRITE_GP32(MGP_RASTER_MODE, gu2_bpp | GFXpatternFlags); + WRITE_GP32(MGP_PAT_COLOR_0, bgcolor); + WRITE_GP32(MGP_PAT_COLOR_1, fgcolor); + WRITE_GP32(MGP_PAT_DATA_0, data0); + WRITE_GP32(MGP_PAT_DATA_1, data1); +} + +/* + *--------------------------------------------------------------------------- + * GFX_SET_COLOR_PATTERN + * + * This routine is used to specify a color pattern. + *--------------------------------------------------------------------------- + */ +#if GFX_2DACCEL_DYNAMIC +void +gu2_set_color_pattern(unsigned long bgcolor, unsigned long fgcolor, + unsigned long data0, unsigned long data1, unsigned long data2, + unsigned long data3, unsigned char transparent) +#else +void +gfx_set_color_pattern(unsigned long bgcolor, unsigned long fgcolor, + unsigned long data0, unsigned long data1, unsigned long data2, + unsigned long data3, unsigned char transparent) +#endif +{ + /* REMOVE */ +} + +/* + *--------------------------------------------------------------------------- + * GFX_LOAD_COLOR_PATTERN_LINE + * + * This routine is used to load a single line of a 8x8 color pattern. + *--------------------------------------------------------------------------- */ +#if GFX_2DACCEL_DYNAMIC +void +gu2_load_color_pattern_line(short y, unsigned long *pattern_8x8) +#else +void +gfx_load_color_pattern_line(short y, unsigned long *pattern_8x8) +#endif +{ + unsigned long temp1, temp2, temp3, temp4; + + /* CLEAR TRANSPARENCY FLAG */ + + GFXsourceFlags = 0; + + /* SET PATTERN FLAGS */ + + GFXpatternFlags = MGP_RM_PAT_COLOR; + + /* OVERRIDE THE RASTER MODE REGISTER */ + /* If the pattern format is set to anything but color */ + /* before loading the registers, some of the data will */ + /* be duplicated according to the current mode. */ + + GU2_WAIT_PENDING; + WRITE_GP32(MGP_RASTER_MODE, + (gu2_rop32 & ~MGP_RM_PAT_FLAGS) | MGP_RM_PAT_COLOR); + + /* LOAD THE PATTERN DATA */ + /* This routine is designed to work in tandem with gfx_pattern_fill. */ + /* It is used for cases when multiple BLTs with color pattern data */ + /* are desired on the same line. It would be inefficient to */ + /* repeatedly call gfx_color_pattern_fill for each single-line BLT. */ + /* So, we will simply replicate the pattern data across all available */ + /* lines such that the pattern y origin plays no part in the BLT. */ + + /* 8 BPP */ + + if (gu2_xshift == 0) { + pattern_8x8 += (y & 7) << 1; + temp1 = BYTE_SWIZZLE(pattern_8x8[0]); + temp2 = BYTE_SWIZZLE(pattern_8x8[1]); + WRITE_GP32(MGP_PAT_DATA_1, temp1); + WRITE_GP32(MGP_PAT_DATA_0, temp2); + WRITE_GP32(MGP_PAT_COLOR_1, temp1); + WRITE_GP32(MGP_PAT_COLOR_0, temp2); + + GU2_WAIT_BUSY; + WRITE_GP32(MGP_PAT_COLOR_3, temp1); + WRITE_GP32(MGP_PAT_COLOR_2, temp2); + WRITE_GP32(MGP_PAT_COLOR_5, temp1); + WRITE_GP32(MGP_PAT_COLOR_4, temp2); + } else if (gu2_xshift == 1) { + pattern_8x8 += (y & 7) << 2; + temp1 = WORD_SWIZZLE(pattern_8x8[0]); + temp2 = WORD_SWIZZLE(pattern_8x8[1]); + temp3 = WORD_SWIZZLE(pattern_8x8[2]); + temp4 = WORD_SWIZZLE(pattern_8x8[3]); + + WRITE_GP32(MGP_PAT_COLOR_1, temp1); + WRITE_GP32(MGP_PAT_COLOR_0, temp2); + WRITE_GP32(MGP_PAT_DATA_1, temp3); + WRITE_GP32(MGP_PAT_DATA_0, temp4); + + GU2_WAIT_BUSY; + WRITE_GP32(MGP_PAT_COLOR_5, temp1); + WRITE_GP32(MGP_PAT_COLOR_4, temp2); + WRITE_GP32(MGP_PAT_COLOR_3, temp3); + WRITE_GP32(MGP_PAT_COLOR_2, temp4); + } else { + pattern_8x8 += (y & 7) << 3; + + WRITE_GP32(MGP_PAT_COLOR_1, pattern_8x8[4]); + WRITE_GP32(MGP_PAT_COLOR_0, pattern_8x8[5]); + WRITE_GP32(MGP_PAT_DATA_1, pattern_8x8[6]); + WRITE_GP32(MGP_PAT_DATA_0, pattern_8x8[7]); + + GU2_WAIT_BUSY; + WRITE_GP32(MGP_PAT_COLOR_5, pattern_8x8[0]); + WRITE_GP32(MGP_PAT_COLOR_4, pattern_8x8[1]); + WRITE_GP32(MGP_PAT_COLOR_3, pattern_8x8[2]); + WRITE_GP32(MGP_PAT_COLOR_2, pattern_8x8[3]); + } +} + +/* + *--------------------------------------------------------------------------- + * GFX_SET_RASTER_OPERATION + * + * This routine loads the specified raster operation. It sets the pattern + * flags appropriately. + *--------------------------------------------------------------------------- + */ +#if GFX_2DACCEL_DYNAMIC +void +gu2_set_raster_operation(unsigned char rop) +#else +void +gfx_set_raster_operation(unsigned char rop) +#endif +{ + gu2_blt_mode = 0; + + /* DISABLE ALPHA BLENDING */ + + gu2_alpha_active = 0; + + /* GENERATE 32-BIT VERSION OF ROP WITH PATTERN FLAGS */ + + gu2_rop32 = (unsigned long)rop | GFXpatternFlags | gu2_bpp; + + /* CHECK IF SOURCE FLAGS SHOULD BE MERGED */ + + if ((rop & 0x33) ^ ((rop >> 2) & 0x33)) + gu2_rop32 |= GFXsourceFlags; + else + gu2_blt_mode = 0x40; + + /* SET FLAG INDICATING ROP REQUIRES DESTINATION DATA */ + /* True if even bits (0:2:4:6) do not equal the corresponding */ + /* even bits (1:3:5:7). */ + + if ((rop & 0x55) ^ ((rop >> 1) & 0x55)) { + gu2_blt_mode |= MGP_BM_DST_REQ; + gu2_vector_mode = MGP_VM_DST_REQ; + } else { + gu2_vector_mode = 0; + } +} + +/* + *---------------------------------------------------------------------------- + * GFX_PATTERN_FILL + * + * This routine is used to fill a rectangular region. The pattern must + * be previously loaded using one of GFX_load_*_pattern routines. Also, the + * raster operation must be previously specified using the + * "GFX_load_raster_operation" routine. + * + * X screen X position (left) + * Y screen Y position (top) + * WIDTH width of rectangle, in pixels + * HEIGHT height of rectangle, in scanlines + *---------------------------------------------------------------------------- + */ +#if GFX_2DACCEL_DYNAMIC +void +gu2_pattern_fill(unsigned short x, unsigned short y, + unsigned short width, unsigned short height) +#else +void +gfx_pattern_fill(unsigned short x, unsigned short y, + unsigned short width, unsigned short height) +#endif +{ + unsigned long offset = 0, size; + + size = (((unsigned long)width) << 16) | height; + + /* CALCULATE STARTING OFFSET */ + + offset = (unsigned long)y *gu2_pitch + (((unsigned long)x) << gu2_xshift); + + /* CHECK IF PATTERN ORIGINS NEED TO BE SET */ + + if (GFXpatternFlags) { + /* COMBINE X AND Y PATTERN ORIGINS WITH OFFSET */ + + offset |= ((unsigned long)(x & 7)) << 26; + offset |= ((unsigned long)(y & 7)) << 29; + } + + /* POLL UNTIL ABLE TO WRITE TO THE REGISTERS */ + /* Put off poll for as long as possible (do most calculations first). */ + + GU2_WAIT_PENDING; + WRITE_GP32(MGP_RASTER_MODE, gu2_rop32); + WRITE_GP32(MGP_DST_OFFSET, offset); + WRITE_GP32(MGP_WID_HEIGHT, size); + WRITE_GP32(MGP_STRIDE, gu2_pitch); + WRITE_GP32(MGP_BLT_MODE, gu2_blt_mode); +} + +/* + *---------------------------------------------------------------------------- + * GFX_COLOR_PATTERN_FILL + * + * This routine is used to render a rectangle using the current raster + * operation and the specified color pattern. It allows an 8x8 color + * pattern to be rendered without multiple calls to the gfx_set_color_pattern + * and gfx_pattern_fill routines. + * + * X screen X position (left) + * Y screen Y position (top) + * WIDTH width of rectangle, in pixels + * HEIGHT height of rectangle, in scanlines + * *PATTERN pointer to 8x8 color pattern data + *---------------------------------------------------------------------------- + */ +#if GFX_2DACCEL_DYNAMIC +void +gu2_color_pattern_fill(unsigned short x, unsigned short y, + unsigned short width, unsigned short height, unsigned long *pattern) +#else +void +gfx_color_pattern_fill(unsigned short x, unsigned short y, + unsigned short width, unsigned short height, unsigned long *pattern) +#endif +{ + /* CALL GFX2 ROUTINE TO AVOID DUPLICATION OF CODE */ + + unsigned long offset = (unsigned long)y * gu2_pitch + + (((unsigned long)x) << gu2_xshift); + unsigned long origin = gu2_pattern_origin; + unsigned long pitch = gu2_dst_pitch; + + gfx2_set_pattern_origin(x, y); + gfx2_set_destination_stride((unsigned short)gu2_pitch); + gfx2_color_pattern_fill(offset, width, height, pattern); + + /* RESTORE GFX2 VALUES */ + + gu2_pattern_origin = origin; + gu2_dst_pitch = pitch; +} + +/* + *---------------------------------------------------------------------------- + * SCREEN TO SCREEN BLT + * + * This routine should be used to perform a screen to screen BLT when the + * ROP does not require destination data. + * + * SRCX screen X position to copy from + * SRCY screen Y position to copy from + * DSTX screen X position to copy to + * DSTY screen Y position to copy to + * WIDTH width of rectangle, in pixels + * HEIGHT height of rectangle, in scanlines + *---------------------------------------------------------------------------- + */ +#if GFX_2DACCEL_DYNAMIC +void +gu2_screen_to_screen_blt(unsigned short srcx, unsigned short srcy, + unsigned short dstx, unsigned short dsty, unsigned short width, + unsigned short height) +#else +void +gfx_screen_to_screen_blt(unsigned short srcx, unsigned short srcy, + unsigned short dstx, unsigned short dsty, unsigned short width, + unsigned short height) +#endif +{ + unsigned long srcoffset, dstoffset, size; + unsigned short blt_mode; + + size = (((unsigned long)width) << 16) | height; + + /* CALCULATE THE DIRECTION OF THE BLT */ + + blt_mode = (gu2_blt_mode & ~MGP_BM_SRC_TYPE_MASK) | MGP_BM_SRC_FB; + if (dstx > srcx) { + blt_mode |= MGP_BM_NEG_XDIR; + srcx += width - 1; + dstx += width - 1; + } + if (dsty > srcy) { + blt_mode |= MGP_BM_NEG_YDIR; + srcy += height - 1; + dsty += height - 1; + } + + /* CALCULATE STARTING OFFSETS */ + + srcoffset = (unsigned long)srcy *gu2_pitch + + (((unsigned long)srcx) << gu2_xshift); + dstoffset = ((unsigned long)dsty * gu2_pitch + + (((unsigned long)dstx) << gu2_xshift)) & 0xFFFFFF; + + /* MERGE PATTERN INFORMATION */ + /* This must be done after the x and y coordinates have been updated, */ + /* as the x and y pattern origins correspond to the first ROPed pixel. */ + + if (GFXpatternFlags) { + /* COMBINE X AND Y PATTERN ORIGINS WITH OFFSET */ + + dstoffset |= ((unsigned long)(dstx & 7)) << 26; + dstoffset |= ((unsigned long)(dsty & 7)) << 29; + } + + /* TURN INTO BYTE ADDRESS IF NEGATIVE X DIRECTION */ + /* This is a quirk of the hardware. */ + + if (blt_mode & MGP_BM_NEG_XDIR) { + srcoffset += (1 << gu2_xshift) - 1; + dstoffset += (1 << gu2_xshift) - 1; + } + + /* POLL UNTIL ABLE TO WRITE TO THE REGISTERS */ + /* Put off poll for as long as possible (do most calculations first). */ + + GU2_WAIT_PENDING; + WRITE_GP32(MGP_RASTER_MODE, gu2_rop32 | GFXsourceFlags); + WRITE_GP32(MGP_SRC_OFFSET, srcoffset); + WRITE_GP32(MGP_DST_OFFSET, dstoffset); + WRITE_GP32(MGP_WID_HEIGHT, size); + WRITE_GP32(MGP_STRIDE, gu2_pitch | (gu2_pitch << 16)); + WRITE_GP16(MGP_BLT_MODE, blt_mode); +} + +/* + *---------------------------------------------------------------------------- + * SCREEN TO SCREEN TRANSPARENT BLT + * + * This routine should be used to perform a screen to screen BLT when a + * specified color should by transparent. The only supported ROP is SRCCOPY. + * + * SRCX screen X position to copy from + * SRCY screen Y position to copy from + * DSTX screen X position to copy to + * DSTY screen Y position to copy to + * WIDTH width of rectangle, in pixels + * HEIGHT height of rectangle, in scanlines + * COLOR transparent color + *---------------------------------------------------------------------------- + */ +#if GFX_2DACCEL_DYNAMIC +void +gu2_screen_to_screen_xblt(unsigned short srcx, unsigned short srcy, + unsigned short dstx, unsigned short dsty, unsigned short width, + unsigned short height, unsigned long color) +#else +void +gfx_screen_to_screen_xblt(unsigned short srcx, unsigned short srcy, + unsigned short dstx, unsigned short dsty, unsigned short width, + unsigned short height, unsigned long color) +#endif +{ + unsigned long rop32; + + /* SAVE ORIGINAL RASTER MODE SETTINGS */ + + rop32 = gu2_rop32; + + /* WRITE REGISTERS TO SPECIFY COLOR TRANSPARENCY */ + /* Match GU1 implementation that only allows SRCCOPY for the ROP. */ + + GU2_WAIT_PENDING; + WRITE_GP32(MGP_SRC_COLOR_FG, color); + WRITE_GP32(MGP_SRC_COLOR_BG, 0xFFFFFFFF); + + /* SET GLOBAL RASTER SETTINGS */ + /* This is needed, as the screen-to-screen BLT */ + /* routine will overwrite the raster mode register. */ + + gu2_rop32 = gu2_bpp | MGP_RM_SRC_TRANS | 0xCC; + + /* CALL NORMAL SCREEN TO SCREEN BLT ROUTINE */ + + gfx_screen_to_screen_blt(srcx, srcy, dstx, dsty, width, height); + + /* RESTORE GLOBAL RASTER SETTINGS */ + + gu2_rop32 = rop32; +} + +/* + *---------------------------------------------------------------------------- + * COLOR BITMAP TO SCREEN BLT + * + * This routine transfers color bitmap data to the screen. + * + * SRCX X offset within source bitmap + * SRCY Y offset within source bitmap + * DSTX screen X position to render data + * DSTY screen Y position to render data + * WIDTH width of rectangle, in pixels + * HEIGHT height of rectangle, in scanlines + * *DATA pointer to bitmap data + * PITCH pitch of bitmap data (bytes between scanlines) + * + * Transparency is handled by another routine. + *---------------------------------------------------------------------------- + */ + +#if GFX_2DACCEL_DYNAMIC +void +gu2_color_bitmap_to_screen_blt(unsigned short srcx, unsigned short srcy, + unsigned short dstx, unsigned short dsty, unsigned short width, + unsigned short height, unsigned char *data, long pitch) +#else +void +gfx_color_bitmap_to_screen_blt(unsigned short srcx, unsigned short srcy, + unsigned short dstx, unsigned short dsty, unsigned short width, + unsigned short height, unsigned char *data, long pitch) +#endif +{ + unsigned long dstoffset, srcoffset, size, bytes; + unsigned long offset, temp_offset; + unsigned long dword_bytes, bytes_extra; + unsigned short blt_mode; + + blt_mode = (gu2_blt_mode & ~MGP_BM_SRC_TYPE_MASK) | MGP_BM_SRC_FB; + size = (((unsigned long)width) << 16) | 1; + + /* CALCULATE STARTING OFFSETS */ + + offset = (unsigned long)srcy *pitch + ((unsigned long)srcx << gu2_xshift); + + dstoffset = (unsigned long)dsty *gu2_pitch + + (((unsigned long)dstx) << gu2_xshift); + + /* CHECK IF PATTERN ORIGINS NEED TO BE SET */ + + if (GFXpatternFlags) { + /* COMBINE X AND Y PATTERN ORIGINS WITH OFFSET */ + + dstoffset |= ((unsigned long)(dstx & 7)) << 26; + dstoffset |= ((unsigned long)(dsty & 7)) << 29; + } + + bytes = width << gu2_xshift; + dword_bytes = bytes & ~0x3L; + bytes_extra = bytes & 0x3L; + + /* POLL UNTIL ABLE TO WRITE TO THE REGISTERS */ + /* Put off poll for as long as possible (do most calculations first). */ + /* The source offset is always 0 since we allow misaligned dword reads. */ + /* We must wait for BLT busy because the GP may be executing a screen */ + /* to screen BLT from the scratchpad area. */ + + GU2_WAIT_BUSY; + WRITE_GP32(MGP_RASTER_MODE, gu2_rop32 | GFXsourceFlags); + WRITE_GP32(MGP_WID_HEIGHT, size); + WRITE_GP32(MGP_STRIDE, gu2_pitch); + + /* WRITE DATA ONE LINE AT A TIME */ + /* For speed reasons, data is written to an offscreen scratch area and then */ + /* BLTed using a screen to screen BLT. This is similar to the GX1 BLT buffers, but */ + /* slightly more efficient in that we can queue up data while the GP is rendering */ + /* a line. */ + + while (height--) { + temp_offset = offset; + srcoffset = gfx_gx2_scratch_base; + if (gu2_current_line) + srcoffset += 8192; + + GU2_WAIT_PENDING; + WRITE_GP32(MGP_SRC_OFFSET, srcoffset); + WRITE_GP32(MGP_DST_OFFSET, dstoffset); + dstoffset += gu2_pitch; + dstoffset += 0x20000000; + + WRITE_FRAME_BUFFER_STRING32(srcoffset, dword_bytes, data, + temp_offset); + if (bytes_extra) { + temp_offset += dword_bytes; + srcoffset += dword_bytes; + WRITE_FRAME_BUFFER_STRING8(srcoffset, bytes_extra, data, + temp_offset); + } + WRITE_GP16(MGP_BLT_MODE, blt_mode); + offset += pitch; + gu2_current_line = 1 - gu2_current_line; + } +} + +/* + *---------------------------------------------------------------------------- + * COLOR BITMAP TO SCREEN TRANSPARENT BLT + * + * This routine transfers color bitmap data to the screen with transparency. + * The transparent color is specified. The only supported ROP is SRCCOPY, + * meaning that transparency cannot be applied if the ROP requires + * destination data (this is a hardware restriction). + * + * SRCX X offset within source bitmap + * SRCY Y offset within source bitmap + * DSTX screen X position to render data + * DSTY screen Y position to render data + * WIDTH width of rectangle, in pixels + * HEIGHT height of rectangle, in scanlines + * *DATA pointer to bitmap data + * PITCH pitch of bitmap data (bytes between scanlines) + * COLOR transparent color + *---------------------------------------------------------------------------- + */ +#if GFX_2DACCEL_DYNAMIC +void +gu2_color_bitmap_to_screen_xblt(unsigned short srcx, unsigned short srcy, + unsigned short dstx, unsigned short dsty, unsigned short width, + unsigned short height, unsigned char *data, long pitch, + unsigned long color) +#else +void +gfx_color_bitmap_to_screen_xblt(unsigned short srcx, unsigned short srcy, + unsigned short dstx, unsigned short dsty, unsigned short width, + unsigned short height, unsigned char *data, long pitch, + unsigned long color) +#endif +{ + unsigned long rop32; + + /* SAVE EXISTING RASTER MODE SETTINGS */ + + rop32 = gu2_rop32; + + /* WRITE REGISTERS TO SPECIFY COLOR TRANSPARENCY */ + /* Match GU1 implementation that only allows SRCCOPY for the ROP. */ + + GU2_WAIT_PENDING; + WRITE_GP32(MGP_SRC_COLOR_FG, color); + WRITE_GP32(MGP_SRC_COLOR_BG, 0xFFFFFFFF); + + /* SET GLOBAL RASTER SETTINGS */ + /* This is needed, as the screen-to-screen BLT */ + /* routine will overwrite the raster mode register. */ + + gu2_rop32 = gu2_bpp | MGP_RM_SRC_TRANS | 0xCC; + + /* CALL NORMAL COLOR BITMAP TO SCREEN BLT ROUTINE */ + + gfx_color_bitmap_to_screen_blt(srcx, srcy, dstx, dsty, width, height, + data, pitch); + + /* RESTORE RASTER SETTINGS */ + + gu2_rop32 = rop32; +} + +/* + *---------------------------------------------------------------------------- + * MONOCHROME BITMAP TO SCREEN BLT + * + * This routine transfers monochrome bitmap data to the screen. + * + * SRCX X offset within source bitmap + * SRCY Y offset within source bitmap + * DSTX screen X position to render data + * DSTY screen Y position to render data + * WIDTH width of rectangle, in pixels + * HEIGHT height of rectangle, in scanlines + * *DATA pointer to bitmap data + * PITCH pitch of bitmap data (bytes between scanlines) + *---------------------------------------------------------------------------- + */ +#if GFX_2DACCEL_DYNAMIC +void +gu2_mono_bitmap_to_screen_blt(unsigned short srcx, unsigned short srcy, + unsigned short dstx, unsigned short dsty, unsigned short width, + unsigned short height, unsigned char *data, short pitch) +#else +void +gfx_mono_bitmap_to_screen_blt(unsigned short srcx, unsigned short srcy, + unsigned short dstx, unsigned short dsty, unsigned short width, + unsigned short height, unsigned char *data, short pitch) +#endif +{ + unsigned long dstoffset, size, bytes; + unsigned long offset, temp_offset, temp1 = 0, temp2 = 0; + unsigned long i, j = 0, fifo_lines, dwords_extra, bytes_extra; + unsigned long shift = 0; + + size = (((unsigned long)width) << 16) | height; + + /* CALCULATE STARTING OFFSETS */ + + offset = (unsigned long)srcy *pitch + ((unsigned long)srcx >> 3); + + dstoffset = (unsigned long)dsty *gu2_pitch + + (((unsigned long)dstx) << gu2_xshift); + + /* CHECK IF PATTERN ORIGINS NEED TO BE SET */ + + if (GFXpatternFlags) { + /* COMBINE X AND Y PATTERN ORIGINS WITH OFFSET */ + + dstoffset |= ((unsigned long)(dstx & 7)) << 26; + dstoffset |= ((unsigned long)(dsty & 7)) << 29; + } + + bytes = ((srcx & 7) + width + 7) >> 3; + fifo_lines = bytes >> 5; + dwords_extra = (bytes & 0x0000001Cl) >> 2; + bytes_extra = bytes & 0x00000003l; + + /* POLL UNTIL ABLE TO WRITE TO THE REGISTERS */ + /* Put off poll for as long as possible (do most calculations first). */ + /* The source offset is always 0 since we allow misaligned dword reads. */ + /* Need to wait for busy instead of pending, since hardware clears */ + /* the host data FIFO at the beginning of a BLT. */ + + GU2_WAIT_PENDING; + WRITE_GP32(MGP_RASTER_MODE, gu2_rop32 | GFXsourceFlags); + WRITE_GP32(MGP_SRC_OFFSET, ((unsigned long)srcx & 7) << 26); + WRITE_GP32(MGP_DST_OFFSET, dstoffset); + WRITE_GP32(MGP_WID_HEIGHT, size); + WRITE_GP32(MGP_STRIDE, gu2_pitch); + WRITE_GP16(MGP_BLT_MODE, + (gu2_blt_mode & ~MGP_BM_SRC_TYPE_MASK) | MGP_BM_SRC_HOST | + MGP_BM_SRC_MONO); + + /* WAIT FOR BLT TO BE LATCHED */ + + GU2_WAIT_PENDING; + + /* WRITE ALL OF THE DATA TO THE HOST SOURCE REGISTER */ + + while (height--) { + temp_offset = offset; + + /* WRITE ALL FULL FIFO LINES */ + + for (i = 0; i < fifo_lines; i++) { + GU2_WAIT_HALF_EMPTY; + WRITE_GPREG_STRING32(MGP_HST_SOURCE, 8, j, data, temp_offset, + temp1); + temp_offset += 32; + } + + /* WRITE ALL FULL DWORDS */ + + GU2_WAIT_HALF_EMPTY; + if (dwords_extra) { + WRITE_GPREG_STRING32(MGP_HST_SOURCE, dwords_extra, i, data, + temp_offset, temp1); + temp_offset += (dwords_extra << 2); + } + + /* WRITE REMAINING BYTES */ + + shift = 0; + if (bytes_extra) + WRITE_GPREG_STRING8(MGP_HST_SOURCE, bytes_extra, shift, i, data, + temp_offset, temp1, temp2); + + offset += pitch; + } +} + +/*--------------------------------------------------------------------------- + * GFX_TEXT_BLT + * + * This routine is similar to the gfx_mono_bitmap_to_screen_blt routine + * but assumes that source data is byte-packed. + *--------------------------------------------------------------------------- + */ +#if GFX_2DACCEL_DYNAMIC +void +gu2_text_blt(unsigned short dstx, unsigned short dsty, unsigned short width, + unsigned short height, unsigned char *data) +#else +void +gfx_text_blt(unsigned short dstx, unsigned short dsty, unsigned short width, + unsigned short height, unsigned char *data) +#endif +{ + unsigned long size, bytes; + unsigned long dstoffset, temp1 = 0, temp2 = 0, temp_offset = 0; + unsigned long i, j = 0, fifo_lines, dwords_extra, bytes_extra; + unsigned long shift; + + size = (((unsigned long)width) << 16) | height; + + dstoffset = (unsigned long)dsty *gu2_pitch + + (((unsigned long)dstx) << gu2_xshift); + + /* CHECK IF PATTERN ORIGINS NEED TO BE SET */ + + if (GFXpatternFlags) { + /* COMBINE X AND Y PATTERN ORIGINS WITH OFFSET */ + + dstoffset |= ((unsigned long)(dstx & 7)) << 26; + dstoffset |= ((unsigned long)(dsty & 7)) << 29; + } + + /* CALCULATE STARTING OFFSETS */ + + bytes = ((width + 7) >> 3) * height; + fifo_lines = bytes >> 5; + dwords_extra = (bytes & 0x0000001Cl) >> 2; + bytes_extra = bytes & 0x00000003l; + + /* POLL UNTIL ABLE TO WRITE TO THE REGISTERS */ + + GU2_WAIT_PENDING; + WRITE_GP32(MGP_RASTER_MODE, gu2_rop32 | GFXsourceFlags); + WRITE_GP32(MGP_SRC_OFFSET, 0); + WRITE_GP32(MGP_DST_OFFSET, dstoffset); + WRITE_GP32(MGP_WID_HEIGHT, size); + WRITE_GP32(MGP_STRIDE, gu2_pitch); + WRITE_GP16(MGP_BLT_MODE, + (gu2_blt_mode & ~MGP_BM_SRC_TYPE_MASK) | MGP_BM_SRC_HOST | + MGP_BM_SRC_BP_MONO); + + /* WAIT FOR BLT TO BE LATCHED */ + + GU2_WAIT_PENDING; + + /* WRITE ALL FULL FIFO LINES */ + + for (i = 0; i < fifo_lines; i++) { + GU2_WAIT_HALF_EMPTY; + WRITE_GPREG_STRING32(MGP_HST_SOURCE, 8, j, data, temp_offset, temp1); + temp_offset += 32; + } + + /* WRITE ALL FULL DWORDS */ + + if (dwords_extra || bytes_extra) { + GU2_WAIT_HALF_EMPTY; + if (dwords_extra) { + WRITE_GPREG_STRING32(MGP_HST_SOURCE, dwords_extra, i, data, + temp_offset, temp1); + temp_offset += (dwords_extra << 2); + } + if (bytes_extra) { + shift = 0; + WRITE_GPREG_STRING8(MGP_HST_SOURCE, bytes_extra, shift, i, data, + temp_offset, temp1, temp2); + } + } +} + +/* + *---------------------------------------------------------------------------- + * BRESENHAM LINE + * + * This routine draws a vector using the specified Bresenham parameters. + * Currently this file does not support a routine that accepts the two + * endpoints of a vector and calculates the Bresenham parameters. If it + * ever does, this routine is still required for vectors that have been + * clipped. + * + * X screen X position to start vector + * Y screen Y position to start vector + * LENGTH length of the vector, in pixels + * INITERR Bresenham initial error term + * AXIALERR Bresenham axial error term + * DIAGERR Bresenham diagonal error term + * FLAGS VM_YMAJOR, VM_MAJOR_INC, VM_MINOR_INC + *---------------------------------------------------------------------------- + */ +#if GFX_2DACCEL_DYNAMIC +void +gu2_bresenham_line(unsigned short x, unsigned short y, + unsigned short length, unsigned short initerr, + unsigned short axialerr, unsigned short diagerr, unsigned short flags) +#else +void +gfx_bresenham_line(unsigned short x, unsigned short y, + unsigned short length, unsigned short initerr, + unsigned short axialerr, unsigned short diagerr, unsigned short flags) +#endif +{ + unsigned long offset; + unsigned long data1 = (((unsigned long)axialerr) << 16) | diagerr; + unsigned long data2 = (((unsigned long)length) << 16) | initerr; + unsigned short vector_mode = gu2_vector_mode | flags; + + /* CALCULATE STARTING OFFSET */ + + offset = (unsigned long)y *gu2_pitch + (((unsigned long)x) << gu2_xshift); + + /* CHECK NULL LENGTH */ + + if (!length) + return; + + /* POLL UNTIL ABLE TO WRITE TO THE REGISTERS */ + /* Put off poll for as long as possible (do most calculations first). */ + + GU2_WAIT_PENDING; + WRITE_GP32(MGP_RASTER_MODE, gu2_rop32); + WRITE_GP32(MGP_DST_OFFSET, offset); + WRITE_GP32(MGP_VEC_ERR, data1); + WRITE_GP32(MGP_VEC_LEN, data2); + WRITE_GP32(MGP_STRIDE, gu2_pitch); + WRITE_GP32(MGP_VECTOR_MODE, vector_mode); +} + +/*--------------------------------------------------------------------------- + * GFX_WAIT_UNTIL_IDLE + * + * This routine waits until the graphics engine is idle. This is required + * before allowing direct access to the frame buffer. + *--------------------------------------------------------------------------- + */ +#if GFX_2DACCEL_DYNAMIC +void +gu2_wait_until_idle(void) +#else +void +gfx_wait_until_idle(void) +#endif +{ + while (READ_GP32(MGP_BLT_STATUS) & MGP_BS_BLT_BUSY) ; +} + +/*--------------------------------------------------------------------------- + * GFX_TEST_BLT_PENDING + * + * This routine returns 1 if a BLT is pending, meaning that a call to + * perform a rendering operation would stall. Otherwise it returns 0. + * It is used by Darwin during random testing to only start a BLT + * operation when it knows the Durango routines won't spin on graphics + * (so Darwin can continue to do frame buffer reads and writes). + *--------------------------------------------------------------------------- + */ +#if GFX_2DACCEL_DYNAMIC +int +gu2_test_blt_pending(void) +#else +int +gfx_test_blt_pending(void) +#endif +{ + if (READ_GP32(MGP_BLT_STATUS) & MGP_BS_BLT_PENDING) + return (1); + return (0); +} + +/*--------------------------------------------------------------------------- + * NEW ROUTINES FOR REDCLOUD + *--------------------------------------------------------------------------- + */ + +/*--------------------------------------------------------------------------- + * GFX2_SET_SOURCE_STRIDE + * + * This routine sets the stride to be used in successive screen to screen + * BLTs (used by gfx2_screen_to_screen_blt and gfx2_mono_expand_blt). + *--------------------------------------------------------------------------- + */ +#if GFX_2DACCEL_DYNAMIC +void +gu22_set_source_stride(unsigned short stride) +#else +void +gfx2_set_source_stride(unsigned short stride) +#endif +{ + /* SAVE STRIDE TO BE USED LATER */ + + gu2_src_pitch = (unsigned long)stride; +} + +/*--------------------------------------------------------------------------- + * GFX2_SET_DESTINATION_STRIDE + * + * This routine sets the stride used when rendering to the screen. + *--------------------------------------------------------------------------- + */ +#if GFX_2DACCEL_DYNAMIC +void +gu22_set_destination_stride(unsigned short stride) +#else +void +gfx2_set_destination_stride(unsigned short stride) +#endif +{ + /* SAVE STRIDE TO BE USED LATER */ + + gu2_dst_pitch = (unsigned long)stride; +} + +/*--------------------------------------------------------------------------- + * GFX2_SET_PATTERN_ORIGIN + * + * This routine sets the origin within an 8x8 pattern. It is needed if + * using a monochrome or color pattern (not used for a solid pattern). + *--------------------------------------------------------------------------- + */ +#if GFX_2DACCEL_DYNAMIC +void +gu22_set_pattern_origin(int x, int y) +#else +void +gfx2_set_pattern_origin(int x, int y) +#endif +{ + /* STORE IN FORMAT THAT CAN BE COMBINED WITH THE DESTINATION OFFSET */ + + gu2_pattern_origin = (((unsigned long)(x & 7)) << 26) | + (((unsigned long)(y & 7)) << 29); +} + +/*--------------------------------------------------------------------------- + * GFX2_SET_SOURCE_TRANSPARENCY + * + * This routine sets the source transparency color and mask to be used + * in future rendering operations. If both the color and mask are set + * to zero (normally completely transparent), those values indicate that + * transparency should be disabled. + *--------------------------------------------------------------------------- + */ +#if GFX_2DACCEL_DYNAMIC +void +gu22_set_source_transparency(unsigned long color, unsigned long mask) +#else +void +gfx2_set_source_transparency(unsigned long color, unsigned long mask) +#endif +{ + /* WRITE REGISTERS TO SPECIFY COLOR TRANSPARENCY */ + + GU2_WAIT_PENDING; + WRITE_GP32(MGP_SRC_COLOR_FG, color); + WRITE_GP32(MGP_SRC_COLOR_BG, mask); + + /* SET TRANSPARENCY FLAG */ + + GFXsourceFlags = (color || mask) ? MGP_RM_SRC_TRANS : 0; +} + +/*--------------------------------------------------------------------------- + * GFX2_SET_ALPHA_MODE + * + * This routine sets the alpha blending mode to be used in successive + * rendering operations. + *--------------------------------------------------------------------------- + */ +#if GFX_2DACCEL_DYNAMIC +void +gu22_set_alpha_mode(int mode) +#else +void +gfx2_set_alpha_mode(int mode) +#endif +{ + /* SAVE ALPHA MODE FOR LATER */ + + gu2_alpha_mode = mode; +} + +/*--------------------------------------------------------------------------- + * GFX2_SET_ALPHA_VALUE + * + * This routine sets the alpha value to be used with certain alpha blending + * modes (ALPHA_MODE_BLEND). + *--------------------------------------------------------------------------- + */ +#if GFX_2DACCEL_DYNAMIC +void +gu22_set_alpha_value(unsigned char value) +#else +void +gfx2_set_alpha_value(unsigned char value) +#endif +{ + /* SAVE ALPHA VALUE TO BE USED LATER */ + + gu2_alpha_value = (unsigned long)value; + + /* SET GLOBAL FLAG */ + /* gfx2_* routines will use this flag to program alpha values */ + /* appropriately. Normal gfx_* routines will always write */ + /* the current ROP settings. In this way, the alpha mode */ + /* affects only second generation routines. */ + + gu2_alpha_active = 1; + + switch (gu2_alpha_mode) { + case ALPHA_MODE_BLEND: + + /* GENERATE 32-BIT VERSION OF RASTER MODE REGISTER */ + /* Pattern data is not involved in the operation. */ + + gu2_alpha32 = gu2_alpha_value | gu2_bpp; + + /* HANDLE SPECIAL CASES FOR ENDPOINTS */ + /* The 8-bit hardware alpha value is always */ + /* interpreted as a fraction. Consequently, there */ + /* is no way to use values of 255 or 0 to exclude */ + /* one of the inputs. */ + + switch (gu2_alpha_value) { + /* DESTINATION ONLY */ + /* Operation is alpha * A, where A is destination */ + /* and alpha is 1. */ + + case 0: + + gu2_alpha32 |= MGP_RM_SELECT_ALPHA_1 | + MGP_RM_ALPHA_TIMES_A | + MGP_RM_ALPHA_TO_RGB | MGP_RM_DEST_FROM_CHAN_A; + break; + + /* SOURCE ONLY */ + /* Operation is alpha * A, where A is source and */ + /* alpha is 1. */ + + case 255: + + gu2_alpha32 |= MGP_RM_SELECT_ALPHA_1 | + MGP_RM_ALPHA_TO_RGB | MGP_RM_ALPHA_TIMES_A; + break; + + /* DEFAULT */ + /* Operation is alpha * A + (1 - alpha) * B; */ + /* A is source, B is destination and alpha is the */ + /* programmed 8-bit value. */ + + default: + + gu2_alpha32 |= MGP_RM_SELECT_ALPHA_R | + MGP_RM_ALPHA_TO_RGB | MGP_RM_ALPHA_A_PLUS_BETA_B; + + } + + /* CHECK IF SOURCE INFORMATION SHOULD BE MERGED */ + /* Alpha value of 0 indicates destination only. */ + + if (gu2_alpha_value != 0) + gu2_alpha32 |= GFXsourceFlags; + + /* SET FLAG FOR DESTINATION DATA IF NECESSARY */ + /* Alpha value of 255 indicates no destination */ + + if (gu2_alpha_value != 255) { + gu2_alpha_blt_mode = MGP_BM_DST_REQ; + gu2_alpha_vec_mode = MGP_VM_DST_REQ; + } + + break; + } +} + +/*--------------------------------------------------------------------------- + * GFX2_PATTERN_FILL + * + * This routine is similar to the gfx_pattern_fill routine, but allows the + * use of an arbitrary destination stride. The rendering position is + * also specified as an offset instead of an (x,y) position. + *--------------------------------------------------------------------------- + */ +#if GFX_2DACCEL_DYNAMIC +void +gu22_pattern_fill(unsigned long dstoffset, unsigned short width, + unsigned short height) +#else +void +gfx2_pattern_fill(unsigned long dstoffset, unsigned short width, + unsigned short height) +#endif +{ + unsigned long size; + + size = (((unsigned long)width) << 16) | height; + + /* POLL UNTIL ABLE TO WRITE TO THE REGISTERS */ + /* Put off poll for as long as possible (do most calculations first). */ + + GU2_WAIT_PENDING; + WRITE_GP32(MGP_RASTER_MODE, gu2_rop32); + WRITE_GP32(MGP_DST_OFFSET, dstoffset | gu2_pattern_origin); + WRITE_GP32(MGP_WID_HEIGHT, size); + WRITE_GP32(MGP_STRIDE, gu2_dst_pitch); + WRITE_GP32(MGP_BLT_MODE, gu2_blt_mode | gu2_bm_throttle); + gu2_bm_throttle = 0; + gu2_vm_throttle = 0; +} + +/*--------------------------------------------------------------------------- + * GFX2_COLOR_PATTERN_FILL + * + * This routine is used to render a rectangle using the current raster + * operation and the specified color pattern. It allows an 8x8 color + * pattern to be rendered without multiple calls to the gfx_set_color_pattern + * and gfx_pattern_fill routines. + *--------------------------------------------------------------------------- + */ +#if GFX_2DACCEL_DYNAMIC +void +gu22_color_pattern_fill(unsigned long dstoffset, unsigned short width, + unsigned short height, unsigned long *pattern) +#else +void +gfx2_color_pattern_fill(unsigned long dstoffset, unsigned short width, + unsigned short height, unsigned long *pattern) +#endif +{ + int pass; + unsigned long lines, size, patxorigin, patoffset; + + /* ONLY USE HW PATTERN ORIGIN FOR THE X DIRECTION */ + /* Y direction handled by referencing proper location in pattern data. */ + + patxorigin = (gu2_pattern_origin) & 0x1C000000; + + /* OVERRIDE PATTERN FLAGS IN ROP TO FORCE COLOR PATTERN */ + + GU2_WAIT_PENDING; + WRITE_GP32(MGP_RASTER_MODE, + (gu2_rop32 & ~MGP_RM_PAT_FLAGS) | MGP_RM_PAT_COLOR); + + /* ATTEMPT TO OPTIMIZE */ + /* If possible, we can perform the pattern fill in only a few passes */ + /* This is performed by multiplying the pitch by an appropriate amount. */ + /* Consequently, if the multiplied pitch exceeds 16 bits, this */ + /* optimization is impossible. */ + + if ((gu2_dst_pitch << (gu2_xshift + 1)) <= 0xFFFF) { + /* HANDLE VARIOUS COLOR DEPTHS DIFFERENTLY */ + + switch (gu2_xshift) { + case 0: /* 8 BPP */ + + /* TWO PASSES FOR 8 BPP */ + /* Render every other line per pass by doubling the pitch. */ + + patoffset = (gu2_pattern_origin >> 28) & 0x0E; + for (pass = 0; pass < 2; pass++) { + /* CAN WRITE SOME PATTERN REGISTERS WHILE "PENDING" */ + + GU2_WAIT_PENDING; + WRITE_GP32(MGP_DST_OFFSET, dstoffset | patxorigin); + lines = (height + 1 - pass) >> 1; + if (!lines) + break; + size = (((unsigned long)width) << 16) | lines; + WRITE_GP32(MGP_WID_HEIGHT, size); + WRITE_GP32(MGP_STRIDE, gu2_dst_pitch << 1); + WRITE_GP32(MGP_PAT_DATA_1, BYTE_SWIZZLE(pattern[patoffset])); + WRITE_GP32(MGP_PAT_DATA_0, + BYTE_SWIZZLE(pattern[patoffset + 1])); + patoffset = (patoffset + 4) & 0x0E; + WRITE_GP32(MGP_PAT_COLOR_1, BYTE_SWIZZLE(pattern[patoffset])); + WRITE_GP32(MGP_PAT_COLOR_0, + BYTE_SWIZZLE(pattern[patoffset + 1])); + patoffset = (patoffset + 4) & 0x0E; + + /* NEED TO WAIT UNTIL IDLE FOR COLORS 2 THROUGH 5 */ + /* Those registers are not pipelined. */ + + GU2_WAIT_BUSY; + WRITE_GP32(MGP_PAT_COLOR_3, BYTE_SWIZZLE(pattern[patoffset])); + WRITE_GP32(MGP_PAT_COLOR_2, + BYTE_SWIZZLE(pattern[patoffset + 1])); + patoffset = (patoffset + 4) & 0x0E; + WRITE_GP32(MGP_PAT_COLOR_5, BYTE_SWIZZLE(pattern[patoffset])); + WRITE_GP32(MGP_PAT_COLOR_4, + BYTE_SWIZZLE(pattern[patoffset + 1])); + WRITE_GP16(MGP_BLT_MODE, gu2_blt_mode | gu2_bm_throttle); + gu2_bm_throttle = 0; + gu2_vm_throttle = 0; + + /* ADJUST FOR NEXT PASS */ + + dstoffset += gu2_dst_pitch; + patoffset = (patoffset + 6) & 0x0E; + } + break; + + case 1: /* 12, 15, OR 16 BPP */ + + /* FOUR PASSES FOR 16 BPP */ + /* Render every 4th line per pass by quadrupling the pitch. */ + + patoffset = (gu2_pattern_origin >> 27) & 0x1C; + for (pass = 0; pass < 4; pass++) { + /* CAN WRITE SOME PATTERN REGISTERS WHILE "PENDING" */ + + GU2_WAIT_PENDING; + WRITE_GP32(MGP_DST_OFFSET, dstoffset | patxorigin); + lines = (height + 3 - pass) >> 2; + if (!lines) + break; + size = (((unsigned long)width) << 16) | lines; + WRITE_GP32(MGP_WID_HEIGHT, size); + WRITE_GP32(MGP_STRIDE, gu2_dst_pitch << 2); + WRITE_GP32(MGP_PAT_COLOR_1, WORD_SWIZZLE(pattern[patoffset])); + WRITE_GP32(MGP_PAT_COLOR_0, + WORD_SWIZZLE(pattern[patoffset + 1])); + WRITE_GP32(MGP_PAT_DATA_1, + WORD_SWIZZLE(pattern[patoffset + 2])); + WRITE_GP32(MGP_PAT_DATA_0, + WORD_SWIZZLE(pattern[patoffset + 3])); + patoffset = (patoffset + 16) & 0x1C; + + /* NEED TO WAIT UNTIL IDLE FOR COLORS 2 THROUGH 5 */ + /* Those registers are not pipelined. */ + + GU2_WAIT_BUSY; + WRITE_GP32(MGP_PAT_COLOR_5, WORD_SWIZZLE(pattern[patoffset])); + WRITE_GP32(MGP_PAT_COLOR_4, + WORD_SWIZZLE(pattern[patoffset + 1])); + WRITE_GP32(MGP_PAT_COLOR_3, + WORD_SWIZZLE(pattern[patoffset + 2])); + WRITE_GP32(MGP_PAT_COLOR_2, + WORD_SWIZZLE(pattern[patoffset + 3])); + WRITE_GP16(MGP_BLT_MODE, gu2_blt_mode | gu2_bm_throttle); + gu2_bm_throttle = 0; + gu2_vm_throttle = 0; + + /* ADJUST FOR NEXT PASS */ + + dstoffset += gu2_dst_pitch; + patoffset = (patoffset + 20) & 0x1C; + } + break; + + case 2: /* 32 BPP */ + + /* EIGHT PASSES FOR 32 BPP */ + /* Render every 8th line per pass by setting pitch * 8. */ + + patoffset = (gu2_pattern_origin >> 26) & 0x38; + for (pass = 0; pass < 8; pass++) { + /* CAN WRITE SOME PATTERN REGISTERS WHILE "PENDING" */ + + GU2_WAIT_PENDING; + WRITE_GP32(MGP_DST_OFFSET, dstoffset | patxorigin); + lines = (height + 7 - pass) >> 3; + if (!lines) + break; + size = (((unsigned long)width) << 16) | lines; + WRITE_GP32(MGP_WID_HEIGHT, size); + WRITE_GP32(MGP_STRIDE, gu2_dst_pitch << 3); + WRITE_GP32(MGP_PAT_COLOR_1, pattern[patoffset + 4]); + WRITE_GP32(MGP_PAT_COLOR_0, pattern[patoffset + 5]); + WRITE_GP32(MGP_PAT_DATA_1, pattern[patoffset + 6]); + WRITE_GP32(MGP_PAT_DATA_0, pattern[patoffset + 7]); + + /* NEED TO WAIT UNTIL IDLE FOR COLORS 2 THROUGH 5 */ + /* Those registers are not pipelined. */ + + GU2_WAIT_BUSY; + WRITE_GP32(MGP_PAT_COLOR_5, pattern[patoffset]); + WRITE_GP32(MGP_PAT_COLOR_4, pattern[patoffset + 1]); + WRITE_GP32(MGP_PAT_COLOR_3, pattern[patoffset + 2]); + WRITE_GP32(MGP_PAT_COLOR_2, pattern[patoffset + 3]); + WRITE_GP16(MGP_BLT_MODE, gu2_blt_mode | gu2_bm_throttle); + gu2_bm_throttle = 0; + gu2_vm_throttle = 0; + + /* ADJUST FOR NEXT PASS */ + + dstoffset += gu2_dst_pitch; + patoffset = (patoffset + 8) & 0x38; + } + break; + } + } + + else { + WRITE_GP32(MGP_STRIDE, gu2_dst_pitch); + + switch (gu2_xshift) { + case 0: /* 8 BPP - 4 LINES PER PASS */ + + patoffset = (gu2_pattern_origin >> 28) & 0x0E; + while (height) { + lines = height > 4 ? 4 : height; + + /* CAN WRITE SOME REGISTERS WHILE PENDING */ + + WRITE_GP32(MGP_DST_OFFSET, dstoffset | patxorigin); + WRITE_GP32(MGP_WID_HEIGHT, + (((unsigned long)width) << 16) | lines); + WRITE_GP32(MGP_PAT_DATA_1, BYTE_SWIZZLE(pattern[patoffset])); + WRITE_GP32(MGP_PAT_DATA_0, + BYTE_SWIZZLE(pattern[patoffset + 1])); + patoffset = (patoffset + 2) & 0x0E; + WRITE_GP32(MGP_PAT_COLOR_1, BYTE_SWIZZLE(pattern[patoffset])); + WRITE_GP32(MGP_PAT_COLOR_0, + BYTE_SWIZZLE(pattern[patoffset + 1])); + patoffset = (patoffset + 2) & 0x0E; + + /* NEED TO WAIT UNTIL IDLE FOR COLORS 2 THROUGH 5 */ + /* Those registers are not pipelined. */ + + GU2_WAIT_BUSY; + WRITE_GP32(MGP_PAT_COLOR_3, BYTE_SWIZZLE(pattern[patoffset])); + WRITE_GP32(MGP_PAT_COLOR_2, + BYTE_SWIZZLE(pattern[patoffset + 1])); + patoffset = (patoffset + 2) & 0x0E; + WRITE_GP32(MGP_PAT_COLOR_5, BYTE_SWIZZLE(pattern[patoffset])); + WRITE_GP32(MGP_PAT_COLOR_4, + BYTE_SWIZZLE(pattern[patoffset + 1])); + patoffset = (patoffset + 2) & 0x0E; + WRITE_GP16(MGP_BLT_MODE, gu2_blt_mode | gu2_bm_throttle); + + /* ADJUST FOR NEXT PASS */ + + dstoffset += gu2_dst_pitch << 2; + height -= (unsigned short)lines; + } + break; + + case 1: /* 12, 15 AND 16 BPP - 2 LINES PER PASS */ + + patoffset = (gu2_pattern_origin >> 27) & 0x1C; + while (height) { + lines = height > 2 ? 2 : height; + + /* CAN WRITE SOME REGISTERS WHILE PENDING */ + + WRITE_GP32(MGP_DST_OFFSET, dstoffset | patxorigin); + WRITE_GP32(MGP_WID_HEIGHT, + (((unsigned long)width) << 16) | lines); + WRITE_GP32(MGP_PAT_COLOR_1, WORD_SWIZZLE(pattern[patoffset])); + WRITE_GP32(MGP_PAT_COLOR_0, + WORD_SWIZZLE(pattern[patoffset + 1])); + WRITE_GP32(MGP_PAT_DATA_1, + WORD_SWIZZLE(pattern[patoffset + 2])); + WRITE_GP32(MGP_PAT_DATA_0, + WORD_SWIZZLE(pattern[patoffset + 3])); + patoffset = (patoffset + 4) & 0x1C; + + /* NEED TO WAIT UNTIL IDLE FOR COLORS 2 THROUGH 5 */ + /* Those registers are not pipelined. */ + + GU2_WAIT_BUSY; + WRITE_GP32(MGP_PAT_COLOR_5, WORD_SWIZZLE(pattern[patoffset])); + WRITE_GP32(MGP_PAT_COLOR_4, + WORD_SWIZZLE(pattern[patoffset + 1])); + WRITE_GP32(MGP_PAT_COLOR_3, + WORD_SWIZZLE(pattern[patoffset + 2])); + WRITE_GP32(MGP_PAT_COLOR_2, + WORD_SWIZZLE(pattern[patoffset + 3])); + patoffset = (patoffset + 4) & 0x1C; + WRITE_GP16(MGP_BLT_MODE, gu2_blt_mode | gu2_bm_throttle); + + /* ADJUST FOR NEXT PASS */ + + dstoffset += gu2_dst_pitch << 1; + height -= (unsigned short)lines; + } + break; + + case 2: /* 32 BPP - 1 LINE PER PASS */ + + patoffset = (gu2_pattern_origin >> 26) & 0x38; + while (height) { + /* CAN WRITE SOME REGISTERS WHILE PENDING */ + + WRITE_GP32(MGP_DST_OFFSET, dstoffset | patxorigin); + WRITE_GP32(MGP_WID_HEIGHT, + (((unsigned long)width) << 16) | 1l); + WRITE_GP32(MGP_PAT_COLOR_1, pattern[patoffset + 4]); + WRITE_GP32(MGP_PAT_COLOR_0, pattern[patoffset + 5]); + WRITE_GP32(MGP_PAT_DATA_1, pattern[patoffset + 6]); + WRITE_GP32(MGP_PAT_DATA_0, pattern[patoffset + 7]); + + /* NEED TO WAIT UNTIL IDLE FOR COLORS 2 THROUGH 5 */ + /* Those registers are not pipelined. */ + + GU2_WAIT_BUSY; + WRITE_GP32(MGP_PAT_COLOR_5, pattern[patoffset]); + WRITE_GP32(MGP_PAT_COLOR_4, pattern[patoffset + 1]); + WRITE_GP32(MGP_PAT_COLOR_3, pattern[patoffset + 2]); + WRITE_GP32(MGP_PAT_COLOR_2, pattern[patoffset + 3]); + patoffset = (patoffset + 8) & 0x38; + WRITE_GP16(MGP_BLT_MODE, gu2_blt_mode | gu2_bm_throttle); + + /* ADJUST FOR NEXT PASS */ + + dstoffset += gu2_dst_pitch; + height--; + } + break; + } + + } + +} + +/*--------------------------------------------------------------------------- + * GFX2_SCREEN_TO_SCREEN_BLT + * + * This routine is similar to the gfx_screen_to_screen_blt routine but + * allows the use of arbitrary source and destination strides and alpha + * blending. It also allows the use of an arbitrary ROP with transparency. + *--------------------------------------------------------------------------- + */ +#if GFX_2DACCEL_DYNAMIC +void +gu22_screen_to_screen_blt(unsigned long srcoffset, unsigned long dstoffset, + unsigned short width, unsigned short height, int flags) +#else +void +gfx2_screen_to_screen_blt(unsigned long srcoffset, unsigned long dstoffset, + unsigned short width, unsigned short height, int flags) +#endif +{ + unsigned long size, xbytes; + unsigned short blt_mode; + + size = (((unsigned long)width) << 16) | height; + + /* USE ALPHA SETTINGS, IF REQUESTED */ + + if (gu2_alpha_active) + blt_mode = gu2_alpha_blt_mode | MGP_BM_SRC_FB; + + else + blt_mode = (gu2_blt_mode & ~MGP_BM_SRC_TYPE_MASK) | MGP_BM_SRC_FB; + + /* CALCULATE THE DIRECTION OF THE BLT */ + /* Using offsets, so flags from the calling routine are needed. */ + + if (flags & 1) { + xbytes = (width - 1) << gu2_xshift; + srcoffset += xbytes; + dstoffset += xbytes; + blt_mode |= MGP_BM_NEG_XDIR; + } + if (flags & 2) { + srcoffset += (height - 1) * gu2_src_pitch; + dstoffset += (height - 1) * gu2_dst_pitch; + blt_mode |= MGP_BM_NEG_YDIR; + } + + /* TURN INTO BYTE ADDRESS IF NEGATIVE X DIRECTION */ + /* This is a quirk of the hardware. */ + + if (blt_mode & MGP_BM_NEG_XDIR) { + srcoffset += (1 << gu2_xshift) - 1; + dstoffset += (1 << gu2_xshift) - 1; + } + + /* POLL UNTIL ABLE TO WRITE TO THE REGISTERS */ + /* Put off poll for as long as possible (do most calculations first). */ + + GU2_WAIT_PENDING; + + if (gu2_alpha_active) { + WRITE_GP32(MGP_RASTER_MODE, gu2_alpha32); + } else { + WRITE_GP32(MGP_RASTER_MODE, gu2_rop32 | GFXsourceFlags); + } + + WRITE_GP32(MGP_SRC_OFFSET, srcoffset); + WRITE_GP32(MGP_DST_OFFSET, dstoffset | gu2_pattern_origin); + WRITE_GP32(MGP_WID_HEIGHT, size); + WRITE_GP32(MGP_STRIDE, gu2_dst_pitch | (gu2_src_pitch << 16)); + WRITE_GP16(MGP_BLT_MODE, blt_mode | gu2_bm_throttle); + gu2_bm_throttle = 0; + gu2_vm_throttle = 0; +} + +/*--------------------------------------------------------------------------- + * GFX2_MONO_EXPAND_BLT + * + * This routine is similar to the gfx2_screen_to_screen_blt routine but + * expands monochrome data stored in graphics memory. + * WARNING: This routine assumes that the regions in graphics memory + * will not overlap, and therefore does not check the BLT direction. + *--------------------------------------------------------------------------- + */ +#if GFX_2DACCEL_DYNAMIC +void +gu22_mono_expand_blt(unsigned long srcbase, unsigned short srcx, + unsigned short srcy, unsigned long dstoffset, unsigned short width, + unsigned short height, int byte_packed) +#else +void +gfx2_mono_expand_blt(unsigned long srcbase, unsigned short srcx, + unsigned short srcy, unsigned long dstoffset, unsigned short width, + unsigned short height, int byte_packed) +#endif +{ + unsigned long size, srcoffset; + unsigned short blt_mode; + + size = (((unsigned long)width) << 16) | height; + + /* CALCULATE SOURCE OFFSET */ + + srcoffset = srcbase + (unsigned long)srcy *gu2_src_pitch; + + srcoffset += srcx >> 3; + srcoffset |= ((unsigned long)srcx & 7) << 26; + + /* POLL UNTIL ABLE TO WRITE TO THE REGISTERS */ + /* Put off poll for as long as possible (do most calculations first). */ + + GU2_WAIT_PENDING; + + if (gu2_alpha_active) { + blt_mode = gu2_alpha_blt_mode; + + WRITE_GP32(MGP_RASTER_MODE, gu2_alpha32); + } else { + blt_mode = (gu2_blt_mode & ~MGP_BM_SRC_TYPE_MASK); + + WRITE_GP32(MGP_RASTER_MODE, gu2_rop32 | GFXsourceFlags); + } + + if (byte_packed) + blt_mode |= MGP_BM_SRC_FB | MGP_BM_SRC_BP_MONO | gu2_bm_throttle; + else + blt_mode |= MGP_BM_SRC_FB | MGP_BM_SRC_MONO | gu2_bm_throttle; + + WRITE_GP32(MGP_SRC_OFFSET, srcoffset); + WRITE_GP32(MGP_DST_OFFSET, dstoffset | gu2_pattern_origin); + WRITE_GP32(MGP_WID_HEIGHT, size); + WRITE_GP32(MGP_STRIDE, gu2_dst_pitch | (gu2_src_pitch << 16)); + WRITE_GP16(MGP_BLT_MODE, blt_mode); + gu2_bm_throttle = 0; + gu2_vm_throttle = 0; +} + +/*--------------------------------------------------------------------------- + * GFX2_COLOR_BITMAP_TO_SCREEN_BLT + * + * This routine is similar to the gfx_color_bitmap_to_screen_blt routine + * but allows the use of an arbitrary destination stride and alpha blending. + * It also allows the use of an arbitrary ROP with transparency. + *--------------------------------------------------------------------------- + */ +#if GFX_2DACCEL_DYNAMIC +void +gu22_color_bitmap_to_screen_blt(unsigned short srcx, unsigned short srcy, + unsigned long dstoffset, unsigned short width, + unsigned short height, unsigned char *data, short pitch) +#else +void +gfx2_color_bitmap_to_screen_blt(unsigned short srcx, unsigned short srcy, + unsigned long dstoffset, unsigned short width, + unsigned short height, unsigned char *data, short pitch) +#endif +{ + unsigned long size, bytes; + unsigned long offset, temp_offset; + unsigned long srcoffset, dword_bytes, bytes_extra; + unsigned short blt_mode; + + size = (((unsigned long)width) << 16) | 1; + + /* CALCULATE STARTING OFFSETS */ + + offset = (unsigned long)srcy *pitch + ((unsigned long)srcx << gu2_xshift); + + dstoffset |= gu2_pattern_origin; + + bytes = width << gu2_xshift; + dword_bytes = bytes & ~0x3L; + bytes_extra = bytes & 0x3L; + + /* POLL UNTIL ABLE TO WRITE TO THE REGISTERS */ + /* Put off poll for as long as possible (do most calculations first). */ + /* The source offset is always 0 since we allow misaligned dword reads. */ + /* We must wait for BLT busy because the GP may be executing a screen */ + /* to screen BLT from the scratchpad area. */ + + GU2_WAIT_BUSY; + + if (gu2_alpha_active) { + blt_mode = gu2_alpha_blt_mode; + + WRITE_GP32(MGP_RASTER_MODE, gu2_alpha32); + } else { + blt_mode = (gu2_blt_mode & ~MGP_BM_SRC_TYPE_MASK); + + WRITE_GP32(MGP_RASTER_MODE, gu2_rop32 | GFXsourceFlags); + } + blt_mode |= MGP_BM_SRC_FB | gu2_bm_throttle; + gu2_bm_throttle = 0; + gu2_vm_throttle = 0; + + WRITE_GP32(MGP_WID_HEIGHT, size); + + /* WRITE DATA ONE LINE AT A TIME */ + /* For speed reasons, data is written to an offscreen scratch area and + * then BLTed using a screen to screen BLT. This is similar to the GX1 BLT + * buffers, but slightly more efficient in that we can queue up data while + * the GP is rendering a line. + * */ + + while (height--) { + temp_offset = offset; + srcoffset = gfx_gx2_scratch_base; + if (gu2_current_line) + srcoffset += 8192; + + GU2_WAIT_PENDING; + WRITE_GP32(MGP_SRC_OFFSET, srcoffset); + WRITE_GP32(MGP_DST_OFFSET, dstoffset); + dstoffset += gu2_dst_pitch; + dstoffset += 0x20000000; + + WRITE_FRAME_BUFFER_STRING32(srcoffset, dword_bytes, data, + temp_offset); + if (bytes_extra) { + temp_offset += dword_bytes; + srcoffset += dword_bytes; + WRITE_FRAME_BUFFER_STRING8(srcoffset, bytes_extra, data, + temp_offset); + } + WRITE_GP16(MGP_BLT_MODE, blt_mode); + offset += pitch; + gu2_current_line = 1 - gu2_current_line; + } +} + +/*--------------------------------------------------------------------------- + * GFX2_TEXT_BLT + * + * This routine is similar to the gfx2_mono_bitmap_to_screen_blt routine + * but assumes that source data is byte-packed. + *--------------------------------------------------------------------------- + */ +#if GFX_2DACCEL_DYNAMIC +void +gu22_text_blt(unsigned long dstoffset, unsigned short width, + unsigned short height, unsigned char *data) +#else +void +gfx2_text_blt(unsigned long dstoffset, unsigned short width, + unsigned short height, unsigned char *data) +#endif +{ + unsigned long size, bytes; + unsigned long temp1 = 0, temp2 = 0, temp_offset = 0; + unsigned long i, j = 0, fifo_lines, dwords_extra, bytes_extra; + unsigned long shift; + unsigned short blt_mode; + + size = (((unsigned long)width) << 16) | height; + + /* CALCULATE STARTING OFFSETS */ + + bytes = ((width + 7) >> 3) * height; + fifo_lines = bytes >> 5; + dwords_extra = (bytes & 0x0000001Cl) >> 2; + bytes_extra = bytes & 0x00000003l; + + /* POLL UNTIL ABLE TO WRITE TO THE REGISTERS */ + + GU2_WAIT_PENDING; + + if (gu2_alpha_active) { + blt_mode = gu2_alpha_blt_mode; + + WRITE_GP32(MGP_RASTER_MODE, gu2_alpha32); + } else { + blt_mode = (gu2_blt_mode & ~MGP_BM_SRC_TYPE_MASK); + + WRITE_GP32(MGP_RASTER_MODE, gu2_rop32 | GFXsourceFlags); + } + + WRITE_GP32(MGP_SRC_OFFSET, 0); + WRITE_GP32(MGP_DST_OFFSET, dstoffset | gu2_pattern_origin); + WRITE_GP32(MGP_WID_HEIGHT, size); + WRITE_GP32(MGP_STRIDE, gu2_dst_pitch); + WRITE_GP16(MGP_BLT_MODE, blt_mode | MGP_BM_SRC_HOST | + MGP_BM_SRC_BP_MONO | gu2_bm_throttle); + gu2_bm_throttle = 0; + gu2_vm_throttle = 0; + + /* WAIT FOR BLT TO BE LATCHED */ + + GU2_WAIT_PENDING; + + /* WRITE ALL FULL FIFO LINES */ + + for (i = 0; i < fifo_lines; i++) { + GU2_WAIT_HALF_EMPTY; + WRITE_GPREG_STRING32(MGP_HST_SOURCE, 8, j, data, temp_offset, temp1); + temp_offset += 32; + } + + /* WRITE ALL FULL DWORDS */ + + if (dwords_extra || bytes_extra) { + GU2_WAIT_HALF_EMPTY; + if (dwords_extra) { + WRITE_GPREG_STRING32(MGP_HST_SOURCE, dwords_extra, i, data, + temp_offset, temp1); + temp_offset += (dwords_extra << 2); + } + if (bytes_extra) { + shift = 0; + WRITE_GPREG_STRING8(MGP_HST_SOURCE, bytes_extra, shift, i, data, + temp_offset, temp1, temp2); + } + } +} + +/*--------------------------------------------------------------------------- + * GFX2_MONO_BITMAP_TO_SCREEN_BLT + * + * This routine is similar to the gfx_mono_bitmap_to_screen_blt routine + * but allows the use of an arbitrary destination stride and alpha blending. + *--------------------------------------------------------------------------- + */ +#if GFX_2DACCEL_DYNAMIC +void +gu22_mono_bitmap_to_screen_blt(unsigned short srcx, unsigned short srcy, + unsigned long dstoffset, unsigned short width, + unsigned short height, unsigned char *data, short pitch) +#else +void +gfx2_mono_bitmap_to_screen_blt(unsigned short srcx, unsigned short srcy, + unsigned long dstoffset, unsigned short width, + unsigned short height, unsigned char *data, short pitch) +#endif +{ + unsigned long size, bytes; + unsigned long offset, temp_offset, temp1 = 0, temp2 = 0; + unsigned long i, j = 0, fifo_lines, dwords_extra, bytes_extra; + unsigned long shift = 0; + unsigned short blt_mode; + + size = (((unsigned long)width) << 16) | height; + + /* CALCULATE STARTING OFFSETS */ + + offset = (unsigned long)srcy *pitch + ((unsigned long)srcx >> 3); + + bytes = ((srcx & 7) + width + 7) >> 3; + fifo_lines = bytes >> 5; + dwords_extra = (bytes & 0x0000001Cl) >> 2; + bytes_extra = bytes & 0x00000003l; + + /* POLL UNTIL ABLE TO WRITE TO THE REGISTERS */ + + GU2_WAIT_PENDING; + + if (gu2_alpha_active) { + blt_mode = gu2_alpha_blt_mode; + + WRITE_GP32(MGP_RASTER_MODE, gu2_alpha32); + } else { + blt_mode = (gu2_blt_mode & ~MGP_BM_SRC_TYPE_MASK); + + WRITE_GP32(MGP_RASTER_MODE, gu2_rop32 | GFXsourceFlags); + } + + WRITE_GP32(MGP_SRC_OFFSET, ((unsigned long)srcx & 7) << 26); + WRITE_GP32(MGP_DST_OFFSET, dstoffset | gu2_pattern_origin); + WRITE_GP32(MGP_WID_HEIGHT, size); + WRITE_GP32(MGP_STRIDE, gu2_dst_pitch); + WRITE_GP16(MGP_BLT_MODE, blt_mode | MGP_BM_SRC_HOST | + MGP_BM_SRC_MONO | gu2_bm_throttle); + gu2_bm_throttle = 0; + gu2_vm_throttle = 0; + + /* WAIT FOR BLT TO BE LATCHED */ + + GU2_WAIT_PENDING; + + /* WRITE ALL OF THE DATA TO THE HOST SOURCE REGISTER */ + + while (height--) { + temp_offset = offset; + + /* WRITE ALL FULL FIFO LINES */ + + for (i = 0; i < fifo_lines; i++) { + GU2_WAIT_HALF_EMPTY; + WRITE_GPREG_STRING32(MGP_HST_SOURCE, 8, j, data, temp_offset, + temp1); + temp_offset += 32; + } + + /* WRITE ALL FULL DWORDS */ + + GU2_WAIT_HALF_EMPTY; + if (dwords_extra) + WRITE_GPREG_STRING32(MGP_HST_SOURCE, dwords_extra, i, data, + temp_offset, temp1); + temp_offset += (dwords_extra << 2); + + /* WRITE REMAINING BYTES */ + + shift = 0; + if (bytes_extra) + WRITE_GPREG_STRING8(MGP_HST_SOURCE, bytes_extra, shift, i, data, + temp_offset, temp1, temp2); + + offset += pitch; + } +} + +/*--------------------------------------------------------------------------- + * GFX2_BRESENHAM_LINE + * + * This routine is similar to the gfx_bresenam_line routine but allows + * the use of an arbitrary destination stride. + *--------------------------------------------------------------------------- + */ +#if GFX_2DACCEL_DYNAMIC +void +gu22_bresenham_line(unsigned long dstoffset, + unsigned short length, unsigned short initerr, + unsigned short axialerr, unsigned short diagerr, unsigned short flags) +#else +void +gfx2_bresenham_line(unsigned long dstoffset, + unsigned short length, unsigned short initerr, + unsigned short axialerr, unsigned short diagerr, unsigned short flags) +#endif +{ + unsigned long vector_mode = gu2_vector_mode | flags; + unsigned long data1 = (((unsigned long)axialerr) << 16) | diagerr; + unsigned long data2 = (((unsigned long)length) << 16) | initerr; + + /* CHECK NULL LENGTH */ + + if (!length) + return; + + /* POLL UNTIL ABLE TO WRITE TO THE REGISTERS */ + /* Put off poll for as long as possible (do most calculations first). */ + + GU2_WAIT_PENDING; + + if (gu2_alpha_active) { + vector_mode = gu2_alpha_vec_mode | flags; + + WRITE_GP32(MGP_RASTER_MODE, gu2_alpha32); + } else + WRITE_GP32(MGP_RASTER_MODE, gu2_rop32); + + WRITE_GP32(MGP_DST_OFFSET, dstoffset | gu2_pattern_origin); + WRITE_GP32(MGP_VEC_ERR, data1); + WRITE_GP32(MGP_VEC_LEN, data2); + WRITE_GP32(MGP_STRIDE, gu2_dst_pitch); + WRITE_GP32(MGP_VECTOR_MODE, vector_mode | gu2_vm_throttle); + gu2_bm_throttle = 0; + gu2_vm_throttle = 0; +} + +/*--------------------------------------------------------------------------- + * GFX2_SYNC_TO_VBLANK + * + * This routine sets a flag to synchronize the next rendering routine to + * VBLANK. The flag is cleared by the rendering routine. + *--------------------------------------------------------------------------- + */ +#if GFX_2DACCEL_DYNAMIC +void +gu22_sync_to_vblank(void) +#else +void +gfx2_sync_to_vblank(void) +#endif +{ + /* SET FLAGS TO THROTTLE NEXT RENDERING ROUTINE */ + + gu2_bm_throttle = MGP_BM_THROTTLE; + gu2_vm_throttle = MGP_VM_THROTTLE; +} + +/* END OF FILE */ diff --git a/driver/xf86-video-geode/src/gfx/saa7114.c b/driver/xf86-video-geode/src/gfx/saa7114.c new file mode 100644 index 000000000..df516bcaf --- /dev/null +++ b/driver/xf86-video-geode/src/gfx/saa7114.c @@ -0,0 +1,916 @@ +/* Copyright (c) 2005 Advanced Micro Devices, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + * + * Neither the name of the Advanced Micro Devices, Inc. nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * */ + +/* + * This file contains routines to control the Philips SAA7114 video decoder. + * */ + +/*---------------------------*/ +/* TABLE OF DEFAULT VALUES */ +/*---------------------------*/ + +typedef struct tagGFX_SAA7114_INIT +{ + unsigned char index; + unsigned char value; +} GFX_SAA7114_INIT; + +/* Task A is for VBI raw data and task B is for video */ + +GFX_SAA7114_INIT gfx_saa7114_init_values[] = { + {0x01, 0x08}, {0x02, 0xC0}, {0x03, 0x00}, {0x04, 0x90}, + {0x05, 0x90}, {0x06, 0xEB}, {0x07, 0xE0}, {0x08, 0x88}, + {0x09, 0x40}, {0x0A, 0x80}, {0x0B, 0x44}, {0x0C, 0x40}, + {0x0D, 0x00}, {0x0E, 0x89}, {0x0F, 0x2E}, {0x10, 0x0E}, + {0x11, 0x00}, {0x12, 0x05}, {0x13, 0x00}, {0x14, 0x08}, + {0x15, 0x11}, {0x16, 0xFE}, {0x17, 0x00}, {0x18, 0x40}, + {0x19, 0x80}, {0x30, 0xBC}, {0x31, 0xDF}, {0x32, 0x02}, + {0x34, 0xCD}, {0x35, 0xCC}, {0x36, 0x3A}, {0x38, 0x03}, + {0x39, 0x10}, {0x3A, 0x00}, {0x40, 0x00}, {0x41, 0xFF}, + {0x42, 0xFF}, {0x43, 0xFF}, {0x44, 0xFF}, {0x45, 0xFF}, + {0x46, 0xFF}, {0x47, 0xFF}, {0x48, 0xFF}, {0x49, 0xFF}, + {0x4A, 0xFF}, {0x4B, 0xFF}, {0x4C, 0xFF}, {0x4D, 0xFF}, + {0x4E, 0xFF}, {0x4F, 0xFF}, {0x50, 0xFF}, {0x51, 0xFF}, + {0x52, 0xFF}, {0x53, 0xFF}, {0x54, 0xFF}, {0x55, 0xFF}, + {0x56, 0xFF}, {0x57, 0xFF}, {0x58, 0x00}, {0x59, 0x47}, + {0x5A, 0x06}, {0x5B, 0x43}, {0x5D, 0x3E}, {0x5E, 0x00}, + {0x80, 0x30}, {0x83, 0x00}, {0x84, 0x60}, {0x85, 0x00}, + {0x86, 0xE5}, {0x87, 0x01}, {0x88, 0xF8}, + + /* VBI task */ + + {0x90, 0x01}, {0x91, 0xC8}, {0x92, 0x08}, {0x93, 0x84}, + {0x94, 0x10}, {0x95, 0x00}, {0x96, 0xD0}, {0x97, 0x02}, + {0x98, 0x05}, {0x99, 0x00}, {0x9A, 0x0B}, {0x9B, 0x00}, + {0x9C, 0xA0}, {0x9D, 0x05}, {0x9E, 0x0B}, {0x9F, 0x00}, + {0xA0, 0x01}, {0xA1, 0x00}, {0xA2, 0x00}, {0xA4, 0x80}, + {0xA5, 0x40}, {0xA6, 0x40}, {0xA8, 0x00}, {0xA9, 0x02}, + {0xAA, 0x00}, {0xAC, 0x00}, {0xAD, 0x01}, {0xAE, 0x00}, + {0xB0, 0x00}, {0xB1, 0x04}, {0xB2, 0x00}, {0xB3, 0x04}, + {0xB4, 0x00}, {0xB8, 0x00}, {0xB9, 0x00}, {0xBA, 0x00}, + {0xBB, 0x00}, {0xBC, 0x00}, {0xBD, 0x00}, {0xBE, 0x00}, + {0xBF, 0x00}, + + /* Video task */ + + {0xC0, 0x80}, {0xC1, 0x08}, {0xC2, 0x00}, {0xC3, 0x80}, + {0xC4, 0x10}, {0xC5, 0x00}, {0xC6, 0xD0}, {0xC7, 0x02}, + {0xC8, 0x11}, {0xC9, 0x00}, {0xCA, 0xF1}, {0xCB, 0x00}, + {0xCC, 0xD0}, {0xCD, 0x02}, {0xCE, 0xF1}, {0xCF, 0x00}, + {0xD0, 0x01}, {0xD1, 0x00}, {0xD2, 0x00}, {0xD4, 0x80}, + {0xD5, 0x40}, {0xD6, 0x40}, {0xD8, 0x00}, {0xD9, 0x04}, + {0xDA, 0x00}, {0xDC, 0x00}, {0xDD, 0x02}, {0xDE, 0x00}, + {0xE0, 0x00}, {0xE1, 0x04}, {0xE2, 0x00}, {0xE3, 0x04}, + {0xE4, 0x00}, {0xE8, 0x00}, {0xE9, 0x00}, {0xEA, 0x00}, + {0xEB, 0x00}, {0xEC, 0x00}, {0xED, 0x00}, {0xEE, 0x00}, + {0xEF, 0x00}, +}; + +#define GFX_NUM_SAA7114_INIT_VALUES \ + sizeof(gfx_saa7114_init_values)/sizeof(GFX_SAA7114_INIT) + +/*-----------------------------------------------------*/ +/* TABLE OF FIR PREFILTER RECOMMENDED VALUES */ +/*-----------------------------------------------------*/ + +int optimize_for_aliasing = 0; + +typedef struct tagGFX_SAA7114_FIR_PREFILTER +{ + unsigned char prescaler; + unsigned char acl_low; + unsigned char prefilter_low; + unsigned char acl_high; + unsigned char prefilter_high; +} GFX_SAA7114_FIR_PREFILTER; + +GFX_SAA7114_FIR_PREFILTER gfx_saa7114_fir_values[] = { + {0x01, 0x00, 0x00, 0x00, 0x00}, {0x02, 0x02, 0x5A, 0x01, 0x51}, + {0x03, 0x04, 0xAB, 0x03, 0xA2}, {0x04, 0x07, 0xA3, 0x04, 0xAB}, + {0x05, 0x08, 0xAC, 0x07, 0xA3}, {0x06, 0x08, 0xFC, 0x07, 0xF3}, + {0x07, 0x08, 0xFC, 0x07, 0xF3}, {0x08, 0x0F, 0xF4, 0x08, 0xFC}, + {0x09, 0x0F, 0xF4, 0x08, 0xFC}, {0x0A, 0x10, 0xFD, 0x08, 0xFC}, + {0x0B, 0x10, 0xFD, 0x08, 0xFC}, {0x0C, 0x10, 0xFD, 0x08, 0xFC}, + {0x0D, 0x10, 0xFD, 0x10, 0xFD}, {0x0E, 0x10, 0xFD, 0x10, 0xFD}, + {0x0F, 0x1F, 0xF5, 0x10, 0xFD}, {0x10, 0x20, 0xFE, 0x10, 0xFD}, + {0x11, 0x20, 0xFE, 0x10, 0xFD}, {0x12, 0x20, 0xFE, 0x10, 0xFD}, + {0x13, 0x20, 0xFE, 0x20, 0xFE}, {0x14, 0x20, 0xFE, 0x20, 0xFE}, + {0x15, 0x20, 0xFE, 0x20, 0xFE}, {0x16, 0x20, 0xFE, 0x20, 0xFE}, + {0x17, 0x20, 0xFE, 0x20, 0xFE}, {0x18, 0x20, 0xFE, 0x20, 0xFE}, + {0x19, 0x20, 0xFE, 0x20, 0xFE}, {0x1A, 0x20, 0xFE, 0x20, 0xFE}, + {0x1B, 0x20, 0xFE, 0x20, 0xFE}, {0x1C, 0x20, 0xFE, 0x20, 0xFE}, + {0x1D, 0x20, 0xFE, 0x20, 0xFE}, {0x1E, 0x20, 0xFE, 0x20, 0xFE}, + {0x1F, 0x20, 0xFE, 0x20, 0xFE}, {0x20, 0x3F, 0xFF, 0x20, 0xFE}, + {0x21, 0x3F, 0xFF, 0x20, 0xFE}, {0x22, 0x3F, 0xFF, 0x20, 0xFE}, + {0x23, 0x3F, 0xFF, 0x20, 0xFF} +}; + +int +saa7114_write_reg(unsigned char reg, unsigned char val) +{ + return gfx_i2c_write(2, SAA7114_CHIPADDR, reg, 1, &val); +} + +int +saa7114_read_reg(unsigned char reg, unsigned char *val) +{ + return gfx_i2c_read(2, SAA7114_CHIPADDR, reg, 1, val); +} + +/*---------------------------------------------------------------------------- + * gfx_set_decoder_vbi_upscale + * + * This routine configures the video decoder task A to upscale raw VBI data + * horizontally to match a different system clock. + * The upscale is from 13.5 MHz (SAA7114) to 14.318 MHz (Bt835). + *---------------------------------------------------------------------------- + */ +#if GFX_DECODER_DYNAMIC +int +saa7114_set_decoder_vbi_upscale(void) +#else +int +gfx_set_decoder_vbi_upscale(void) +#endif +{ + /* Set horizontal output length to 1528 (720 * 2 * 14.318 / 13.5) */ + saa7114_write_reg(SAA7114_TASK_A_HORZ_OUTPUT_LO, 0xF8); + saa7114_write_reg(SAA7114_TASK_A_HORZ_OUTPUT_HI, 0x05); + + /* Set horizontal luminance scaling increment to 484 (1024 * 13.5 / + * 28.636) */ + saa7114_write_reg(SAA7114_TASK_A_HSCALE_LUMA_LO, 0xE4); + saa7114_write_reg(SAA7114_TASK_A_HSCALE_LUMA_HI, 0x01); + + /* Set horizontal chrominance scaling increment to 242 */ + saa7114_write_reg(SAA7114_TASK_A_HSCALE_CHROMA_LO, 0xF2); + saa7114_write_reg(SAA7114_TASK_A_HSCALE_CHROMA_HI, 0x00); + + return GFX_STATUS_OK; +} + +/*---------------------------------------------------------------------------- + * gfx_decoder_software_reset + * + * This routine performs a software reset of the decoder. + *---------------------------------------------------------------------------- + */ +#if GFX_DECODER_DYNAMIC +int +saa7114_decoder_software_reset(void) +#else +int +gfx_decoder_software_reset(void) +#endif +{ + saa7114_write_reg(0x88, 0xC0); + /* I2C-bus latency should be sufficient for resetting the internal state + * machine. */ + /* gfx_delay_milliseconds(10); */ + saa7114_write_reg(0x88, 0xF0); + return GFX_STATUS_OK; +} + +/*---------------------------------------------------------------------------- + * gfx_decoder_detect_macrovision + * + * This routine detects if macrovision exists in the input of the video + * decoder. + *---------------------------------------------------------------------------- + */ +#if GFX_DECODER_DYNAMIC +int +saa7114_decoder_detect_macrovision(void) +#else +int +gfx_decoder_detect_macrovision(void) +#endif +{ + unsigned char macrovision = 0xff; + + saa7114_read_reg(SAA7114_STATUS, ¯ovision); + return ((macrovision & 0x02) >> 1); +} + +/*---------------------------------------------------------------------------- + * gfx_decoder_detect_video + * + * This routine detects if video exists in the input of the video decoder. + *---------------------------------------------------------------------------- + */ +#if GFX_DECODER_DYNAMIC +int +saa7114_decoder_detect_video(void) +#else +int +gfx_decoder_detect_video(void) +#endif +{ + unsigned char video = 0xff; + + saa7114_read_reg(SAA7114_STATUS, &video); + return !((video & 0x40) >> 6); +} + +/*---------------------------------------------------------------------------- + * gfx_set_decoder_defaults + * + * This routine is called to set the initial register values of the + * video decoder. + *---------------------------------------------------------------------------- + */ +#if GFX_DECODER_DYNAMIC +int +saa7114_set_decoder_defaults(void) +#else +int +gfx_set_decoder_defaults(void) +#endif +{ + unsigned int i; + + /* LOOP THROUGH INDEX/DATA PAIRS IN THE TABLE */ + + for (i = 0; i < GFX_NUM_SAA7114_INIT_VALUES; i++) { + saa7114_write_reg(gfx_saa7114_init_values[i].index, + gfx_saa7114_init_values[i].value); + } + + gfx_decoder_software_reset(); + return (0); +} + +/*---------------------------------------------------------------------------- + * gfx_set_decoder_analog_input + * + * This routine sets the analog input of the video decoder. + *---------------------------------------------------------------------------- + */ +#if GFX_DECODER_DYNAMIC +int +saa7114_set_decoder_analog_input(unsigned char input) +#else +int +gfx_set_decoder_analog_input(unsigned char input) +#endif +{ + saa7114_write_reg(SAA7114_ANALOG_INPUT_CTRL1, input); + return (0); +} + +/*---------------------------------------------------------------------------- + * gfx_set_decoder_brightness + * + * This routine sets the brightness of the video decoder. + *---------------------------------------------------------------------------- + */ +#if GFX_DECODER_DYNAMIC +int +saa7114_set_decoder_brightness(unsigned char brightness) +#else +int +gfx_set_decoder_brightness(unsigned char brightness) +#endif +{ + saa7114_write_reg(SAA7114_BRIGHTNESS, brightness); + return (0); +} + +/*---------------------------------------------------------------------------- + * gfx_set_decoder_contrast + * + * This routine sets the contrast of the video decoder. + *---------------------------------------------------------------------------- + */ +#if GFX_DECODER_DYNAMIC +int +saa7114_set_decoder_contrast(unsigned char contrast) +#else +int +gfx_set_decoder_contrast(unsigned char contrast) +#endif +{ + saa7114_write_reg(SAA7114_CONTRAST, (unsigned char)(contrast >> 1)); + return (0); +} + +/*---------------------------------------------------------------------------- + * gfx_set_decoder_hue + * + * This routine sets the hue control of the video decoder. + *---------------------------------------------------------------------------- + */ +#if GFX_DECODER_DYNAMIC +int +saa7114_set_decoder_hue(char hue) +#else +int +gfx_set_decoder_hue(char hue) +#endif +{ + saa7114_write_reg(SAA7114_HUE, (unsigned char)hue); + return (0); +} + +/*---------------------------------------------------------------------------- + * gfx_set_decoder_saturation + * + * This routine sets the saturation adjustment of the video decoder. + *---------------------------------------------------------------------------- + */ +#if GFX_DECODER_DYNAMIC +int +saa7114_set_decoder_saturation(unsigned char saturation) +#else +int +gfx_set_decoder_saturation(unsigned char saturation) +#endif +{ + saa7114_write_reg(SAA7114_SATURATION, (unsigned char)(saturation >> 1)); + return (0); +} + +/*---------------------------------------------------------------------------- + * gfx_set_decoder_input_offset + * + * This routine sets the size of the decoder input window. + *---------------------------------------------------------------------------- + */ +#if GFX_DECODER_DYNAMIC +int +saa7114_set_decoder_input_offset(unsigned short x, unsigned short y) +#else +int +gfx_set_decoder_input_offset(unsigned short x, unsigned short y) +#endif +{ + /* SET THE INPUT WINDOW OFFSET */ + + saa7114_write_reg(SAA7114_HORZ_OFFSET_LO, (unsigned char)(x & 0x00FF)); + saa7114_write_reg(SAA7114_HORZ_OFFSET_HI, (unsigned char)(x >> 8)); + saa7114_write_reg(SAA7114_VERT_OFFSET_LO, (unsigned char)(y & 0x00FF)); + saa7114_write_reg(SAA7114_VERT_OFFSET_HI, (unsigned char)(y >> 8)); + + gfx_decoder_software_reset(); + return (0); +} + +/*---------------------------------------------------------------------------- + * gfx_set_decoder_input_size + * + * This routine sets the size of the decoder input window. + *---------------------------------------------------------------------------- + */ +#if GFX_DECODER_DYNAMIC +int +saa7114_set_decoder_input_size(unsigned short width, unsigned short height) +#else +int +gfx_set_decoder_input_size(unsigned short width, unsigned short height) +#endif +{ + /* DIVIDE HEIGHT BY TWO FOR INTERLACING */ + + height = (height + 1) >> 1; + + /* SET THE INPUT WINDOW SIZE */ + + saa7114_write_reg(SAA7114_HORZ_INPUT_LO, (unsigned char)(width & 0x00FF)); + saa7114_write_reg(SAA7114_HORZ_INPUT_HI, (unsigned char)(width >> 8)); + saa7114_write_reg(SAA7114_VERT_INPUT_LO, + (unsigned char)(height & 0x00FF)); + saa7114_write_reg(SAA7114_VERT_INPUT_HI, (unsigned char)(height >> 8)); + + gfx_decoder_software_reset(); + return (0); +} + +/*---------------------------------------------------------------------------- + * gfx_set_decoder_output_size + * + * This routine sets the size of the decoder output window. + *---------------------------------------------------------------------------- + */ +#if GFX_DECODER_DYNAMIC +int +saa7114_set_decoder_output_size(unsigned short width, unsigned short height) +#else +int +gfx_set_decoder_output_size(unsigned short width, unsigned short height) +#endif +{ + /* ROUND WIDTH UP TO EVEN NUMBER TO PREVENT DECODER BECOMING STUCK */ + + width = ((width + 1) >> 1) << 1; + + /* DIVIDE HEIGHT BY TWO FOR INTERLACING */ + + height = (height + 1) >> 1; + + /* SET THE OUTPUT WINDOW SIZE */ + + saa7114_write_reg(SAA7114_HORZ_OUTPUT_LO, + (unsigned char)(width & 0x00FF)); + saa7114_write_reg(SAA7114_HORZ_OUTPUT_HI, (unsigned char)(width >> 8)); + saa7114_write_reg(SAA7114_VERT_OUTPUT_LO, + (unsigned char)(height & 0x00FF)); + saa7114_write_reg(SAA7114_VERT_OUTPUT_HI, (unsigned char)(height >> 8)); + + gfx_decoder_software_reset(); + return (0); +} + +/*---------------------------------------------------------------------------- + * gfx_set_decoder_scale + * + * This routine sets the scaling of the video decoder. + *---------------------------------------------------------------------------- + */ +#if GFX_DECODER_DYNAMIC +int +saa7114_set_decoder_scale(unsigned short srcw, unsigned short srch, + unsigned short dstw, unsigned short dsth) +#else +int +gfx_set_decoder_scale(unsigned short srcw, unsigned short srch, + unsigned short dstw, unsigned short dsth) +#endif +{ + unsigned char prescale = 0; + int scale = 0; + + /* SET THE HORIZONTAL PRESCALE */ + /* Downscale from 1 to 1/63 source size. */ + + if (dstw) + prescale = (unsigned char)(srcw / dstw); + if (!prescale) + prescale = 1; + if (prescale > 63) + return (1); + saa7114_write_reg(SAA7114_HORZ_PRESCALER, prescale); + + /* USE FIR PREFILTER FUNCTIONALITY (OPTIMISATION) */ + + if (prescale < 36) { + if (optimize_for_aliasing) { + saa7114_write_reg(SAA7114_HORZ_ACL, + gfx_saa7114_fir_values[prescale - 1].acl_low); + saa7114_write_reg(SAA7114_HORZ_FIR_PREFILTER, + gfx_saa7114_fir_values[prescale - 1].prefilter_low); + } else { + saa7114_write_reg(SAA7114_HORZ_ACL, + gfx_saa7114_fir_values[prescale - 1].acl_high); + saa7114_write_reg(SAA7114_HORZ_FIR_PREFILTER, + gfx_saa7114_fir_values[prescale - 1].prefilter_high); + } + } else { + /* SAME SETTINGS FOR RATIO 1/35 DOWNTO 1/63 */ + if (optimize_for_aliasing) { + saa7114_write_reg(SAA7114_HORZ_ACL, + gfx_saa7114_fir_values[34].acl_low); + saa7114_write_reg(SAA7114_HORZ_FIR_PREFILTER, + gfx_saa7114_fir_values[34].prefilter_low); + } else { + saa7114_write_reg(SAA7114_HORZ_ACL, + gfx_saa7114_fir_values[34].acl_high); + saa7114_write_reg(SAA7114_HORZ_FIR_PREFILTER, + gfx_saa7114_fir_values[34].prefilter_high); + } + } + + /* SET THE HORIZONTAL SCALING */ + + if (!dstw) + return (1); + scale = ((1024 * srcw * 1000) / (dstw * prescale)) / 1000; + if ((scale > 8191) || (scale < 300)) + return (1); + saa7114_write_reg(SAA7114_HSCALE_LUMA_LO, + (unsigned char)(scale & 0x00FF)); + saa7114_write_reg(SAA7114_HSCALE_LUMA_HI, (unsigned char)(scale >> 8)); + scale >>= 1; + saa7114_write_reg(SAA7114_HSCALE_CHROMA_LO, + (unsigned char)(scale & 0x00FF)); + saa7114_write_reg(SAA7114_HSCALE_CHROMA_HI, (unsigned char)(scale >> 8)); + + /* SET THE VERTICAL SCALING (INTERPOLATION MODE) */ + + if (!dsth) + return (1); + + /* ROUND DESTINATION HEIGHT UP TO EVEN NUMBER TO PREVENT DECODER BECOMING + * STUCK */ + + dsth = ((dsth + 1) >> 1) << 1; + + scale = (int)((1024 * srch) / dsth); + saa7114_write_reg(SAA7114_VSCALE_LUMA_LO, + (unsigned char)(scale & 0x00FF)); + saa7114_write_reg(SAA7114_VSCALE_LUMA_HI, (unsigned char)(scale >> 8)); + saa7114_write_reg(SAA7114_VSCALE_CHROMA_LO, + (unsigned char)(scale & 0x00FF)); + saa7114_write_reg(SAA7114_VSCALE_CHROMA_HI, (unsigned char)(scale >> 8)); + + if (dsth >= (srch >> 1)) { + /* USE INTERPOLATION MODE FOR SCALE FACTOR ABOVE 0.5 */ + + saa7114_write_reg(SAA7114_VSCALE_CONTROL, 0x00); + + /* SET VERTICAL PHASE REGISTER FOR CORRECT SCALED INTERLACED OUTPUT + * (OPTIMISATION) */ + /* THE OPTIMISATION IS BASED ON OFIDC = 0 (REG 90h[6] = 0 ) */ + saa7114_write_reg(SAA7114_VSCALE_CHROMA_OFFS0, SAA7114_VSCALE_PHO); + saa7114_write_reg(SAA7114_VSCALE_CHROMA_OFFS1, SAA7114_VSCALE_PHO); + saa7114_write_reg(SAA7114_VSCALE_CHROMA_OFFS2, + (unsigned char)(SAA7114_VSCALE_PHO + scale / 64 - 16)); + saa7114_write_reg(SAA7114_VSCALE_CHROMA_OFFS3, + (unsigned char)(SAA7114_VSCALE_PHO + scale / 64 - 16)); + + saa7114_write_reg(SAA7114_VSCALE_LUMINA_OFFS0, SAA7114_VSCALE_PHO); + saa7114_write_reg(SAA7114_VSCALE_LUMINA_OFFS1, SAA7114_VSCALE_PHO); + saa7114_write_reg(SAA7114_VSCALE_LUMINA_OFFS2, + (unsigned char)(SAA7114_VSCALE_PHO + scale / 64 - 16)); + saa7114_write_reg(SAA7114_VSCALE_LUMINA_OFFS3, + (unsigned char)(SAA7114_VSCALE_PHO + scale / 64 - 16)); + + /* RESTORE CONTRAST AND SATURATION FOR INTERPOLATION MODE */ + + saa7114_write_reg(SAA7114_FILTER_CONTRAST, (unsigned char)0x40); + saa7114_write_reg(SAA7114_FILTER_SATURATION, (unsigned char)0x40); + } else { + /* USE ACCUMULATION MODE FOR DOWNSCALING BY MORE THAN 2x */ + + saa7114_write_reg(SAA7114_VSCALE_CONTROL, 0x01); + + /* SET VERTICAL PHASE OFFSETS OFF (OPTIMISATION) */ + saa7114_write_reg(SAA7114_VSCALE_CHROMA_OFFS0, 0x00); + saa7114_write_reg(SAA7114_VSCALE_CHROMA_OFFS1, 0x00); + saa7114_write_reg(SAA7114_VSCALE_CHROMA_OFFS2, 0x00); + saa7114_write_reg(SAA7114_VSCALE_CHROMA_OFFS3, 0x00); + + saa7114_write_reg(SAA7114_VSCALE_LUMINA_OFFS0, 0x00); + saa7114_write_reg(SAA7114_VSCALE_LUMINA_OFFS1, 0x00); + saa7114_write_reg(SAA7114_VSCALE_LUMINA_OFFS2, 0x00); + saa7114_write_reg(SAA7114_VSCALE_LUMINA_OFFS3, 0x00); + + /* ADJUST CONTRAST AND SATURATION FOR ACCUMULATION MODE */ + + if (srch) + scale = (64 * dsth) / srch; + saa7114_write_reg(SAA7114_FILTER_CONTRAST, (unsigned char)scale); + saa7114_write_reg(SAA7114_FILTER_SATURATION, (unsigned char)scale); + } + + gfx_decoder_software_reset(); + return (0); +} + +/*---------------------------------------------------------------------------- + * gfx_set_decoder_vbi_format + * + * This routine programs the decoder to produce the specified format of VBI + * data for the specified lines. + *---------------------------------------------------------------------------- + */ +#if GFX_DECODER_DYNAMIC +int +saa7114_set_decoder_vbi_format(int start, int end, int format) +#else +int +gfx_set_decoder_vbi_format(int start, int end, int format) +#endif +{ + int i; + unsigned char data; + + for (i = start; i <= end; i++) { + switch (format) { + case VBI_FORMAT_VIDEO: + data = 0xFF; + break; /* Active video */ + case VBI_FORMAT_RAW: + data = 0x77; + break; /* Raw VBI data */ + case VBI_FORMAT_CC: + data = 0x55; + break; /* US CC */ + case VBI_FORMAT_NABTS: + data = 0xCC; + break; /* US NABTS */ + default: + return GFX_STATUS_BAD_PARAMETER; + } + saa7114_write_reg((unsigned char)(0x3F + i), data); + } + return GFX_STATUS_OK; +} + +/*---------------------------------------------------------------------------- + * gfx_set_decoder_vbi_enable + * + * This routine enables or disables VBI transfer in the decoder. + *---------------------------------------------------------------------------- + */ +#if GFX_DECODER_DYNAMIC +int +saa7114_set_decoder_vbi_enable(int enable) +#else +int +gfx_set_decoder_vbi_enable(int enable) +#endif +{ + unsigned char data; + + saa7114_read_reg(SAA7114_IPORT_CONTROL, &data); + if (enable) + data |= 0x80; + else + data &= ~0x80; + saa7114_write_reg(SAA7114_IPORT_CONTROL, data); + return GFX_STATUS_OK; +} + +/*---------------------------------------------------------------------------- + * gfx_set_decoder_TV_standard + * + * This routine configures the decoder for the required TV standard. + *---------------------------------------------------------------------------- + */ +#if GFX_DECODER_DYNAMIC +int +saa7114_set_decoder_TV_standard(TVStandardType TVStandard) +#else +int +gfx_set_decoder_TV_standard(TVStandardType TVStandard) +#endif +{ + switch (TVStandard) { + case TV_STANDARD_NTSC: + saa7114_write_reg(0x0E, 0x89); + saa7114_write_reg(0x5A, 0x06); + break; + case TV_STANDARD_PAL: + saa7114_write_reg(0x0E, 0x81); + saa7114_write_reg(0x5A, 0x03); + break; + default: + return GFX_STATUS_BAD_PARAMETER; + } + gfx_decoder_software_reset(); + return GFX_STATUS_OK; +} + +/*---------------------------------------------------------------------------- + * gfx_set_decoder_luminance_filter + * + * This routine sets the hue control of the video decoder. + *---------------------------------------------------------------------------- + */ +#if GFX_DECODER_DYNAMIC +int +saa7114_set_decoder_luminance_filter(unsigned char lufi) +#else +int +gfx_set_decoder_luminance_filter(unsigned char lufi) +#endif +{ + unsigned char data; + + saa7114_read_reg(SAA7114_LUMINANCE_CONTROL, &data); + saa7114_write_reg(SAA7114_LUMINANCE_CONTROL, + (unsigned char)((data & ~0x0F) | (lufi & 0x0F))); + return (0); +} + +/*************************************************************/ +/* READ ROUTINES | INCLUDED FOR DIAGNOSTIC PURPOSES ONLY */ +/*************************************************************/ + +#if GFX_READ_ROUTINES + +/*---------------------------------------------------------------------------- + * gfx_get_decoder_brightness + * + * This routine returns the current brightness of the video decoder. + *---------------------------------------------------------------------------- + */ +#if GFX_DECODER_DYNAMIC +unsigned char +saa7114_get_decoder_brightness(void) +#else +unsigned char +gfx_get_decoder_brightness(void) +#endif +{ + unsigned char brightness = 0; + + saa7114_read_reg(SAA7114_BRIGHTNESS, &brightness); + return (brightness); +} + +/*---------------------------------------------------------------------------- + * gfx_get_decoder_contrast + * + * This routine returns the current contrast of the video decoder. + *---------------------------------------------------------------------------- + */ +#if GFX_DECODER_DYNAMIC +unsigned char +saa7114_get_decoder_contrast(void) +#else +unsigned char +gfx_get_decoder_contrast(void) +#endif +{ + unsigned char contrast = 0; + + saa7114_read_reg(SAA7114_CONTRAST, &contrast); + contrast <<= 1; + return (contrast); +} + +/*---------------------------------------------------------------------------- + * gfx_get_decoder_hue + * + * This routine returns the current hue of the video decoder. + *---------------------------------------------------------------------------- + */ +#if GFX_DECODER_DYNAMIC +char +saa7114_get_decoder_hue(void) +#else +char +gfx_get_decoder_hue(void) +#endif +{ + unsigned char hue = 0; + + saa7114_read_reg(SAA7114_HUE, &hue); + return ((char)hue); +} + +/*---------------------------------------------------------------------------- + * gfx_get_decoder_saturation + * + * This routine returns the current saturation of the video decoder. + *---------------------------------------------------------------------------- + */ +#if GFX_DECODER_DYNAMIC +unsigned char +saa7114_get_decoder_saturation(void) +#else +unsigned char +gfx_get_decoder_saturation(void) +#endif +{ + unsigned char saturation = 0; + + saa7114_read_reg(SAA7114_SATURATION, &saturation); + saturation <<= 1; + return (saturation); +} + +/*---------------------------------------------------------------------------- + * gfx_get_decoder_input_offset + * + * This routine returns the offset into the input window. + *---------------------------------------------------------------------------- + */ +#if GFX_DECODER_DYNAMIC +unsigned long +saa7114_get_decoder_input_offset(void) +#else +unsigned long +gfx_get_decoder_input_offset(void) +#endif +{ + unsigned long value = 0; + unsigned char data; + + saa7114_read_reg(SAA7114_HORZ_OFFSET_LO, &data); + value = (unsigned long)data; + saa7114_read_reg(SAA7114_HORZ_OFFSET_HI, &data); + value |= ((unsigned long)data) << 8; + saa7114_read_reg(SAA7114_VERT_OFFSET_LO, &data); + value |= ((unsigned long)data) << 16; + saa7114_read_reg(SAA7114_VERT_OFFSET_HI, &data); + value |= ((unsigned long)data) << 24; + return (value); +} + +/*---------------------------------------------------------------------------- + * gfx_get_decoder_input_size + * + * This routine returns the current size of the input window + *---------------------------------------------------------------------------- + */ +#if GFX_DECODER_DYNAMIC +unsigned long +saa7114_get_decoder_input_size(void) +#else +unsigned long +gfx_get_decoder_input_size(void) +#endif +{ + unsigned long value = 0; + unsigned char data; + + saa7114_read_reg(SAA7114_HORZ_INPUT_LO, &data); + value = (unsigned long)data; + saa7114_read_reg(SAA7114_HORZ_INPUT_HI, &data); + value |= ((unsigned long)data) << 8; + saa7114_read_reg(SAA7114_VERT_INPUT_LO, &data); + value |= ((unsigned long)data) << 17; + saa7114_read_reg(SAA7114_VERT_INPUT_HI, &data); + value |= ((unsigned long)data) << 25; + return (value); +} + +/*---------------------------------------------------------------------------- + * gfx_get_decoder_output_size + * + * This routine returns the current size of the output window. + *---------------------------------------------------------------------------- + */ +#if GFX_DECODER_DYNAMIC +unsigned long +saa7114_get_decoder_output_size(void) +#else +unsigned long +gfx_get_decoder_output_size(void) +#endif +{ + unsigned long value = 0; + unsigned char data; + + saa7114_read_reg(SAA7114_HORZ_OUTPUT_LO, &data); + value = (unsigned long)data; + saa7114_read_reg(SAA7114_HORZ_OUTPUT_HI, &data); + value |= ((unsigned long)data) << 8; + saa7114_read_reg(SAA7114_VERT_OUTPUT_LO, &data); + value |= ((unsigned long)data) << 17; + saa7114_read_reg(SAA7114_VERT_OUTPUT_HI, &data); + value |= ((unsigned long)data) << 25; + return (value); +} + +/*---------------------------------------------------------------------------- + * gfx_get_decoder_vbi_format + * + * This routine returns the current format of VBI data for the specified line. + *---------------------------------------------------------------------------- + */ +#if GFX_DECODER_DYNAMIC +int +saa7114_get_decoder_vbi_format(int line) +#else +int +gfx_get_decoder_vbi_format(int line) +#endif +{ + unsigned char format = 0, data; + + saa7114_read_reg((unsigned char)(0x3F + line), &data); + switch (data) { + case 0xFF: + format = VBI_FORMAT_VIDEO; + break; /* Active video */ + case 0x77: + format = VBI_FORMAT_RAW; + break; /* Raw VBI data */ + case 0x55: + format = VBI_FORMAT_CC; + break; /* US CC */ + case 0xCC: + format = VBI_FORMAT_NABTS; + break; /* US NABTS */ + } + return (format); +} + +#endif /* GFX_READ_ROUTINES */ + +/* END OF FILE */ diff --git a/driver/xf86-video-geode/src/gfx/tv_1200.c b/driver/xf86-video-geode/src/gfx/tv_1200.c new file mode 100644 index 000000000..a75cc327f --- /dev/null +++ b/driver/xf86-video-geode/src/gfx/tv_1200.c @@ -0,0 +1,967 @@ +/* Copyright (c) 2005 Advanced Micro Devices, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + * + * Neither the name of the Advanced Micro Devices, Inc. nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * */ + +/* + * This file contains routines to control the SC1200 TVOUT and TV encoder. + * */ + +/*---------------------------------------------------------------------------- + * gfx_set_tv_format + * + * This routine sets the TV encoder registers to the specified format + * and resolution. + *---------------------------------------------------------------------------- + */ +#if GFX_TV_DYNAMIC +int +sc1200_set_tv_format(TVStandardType format, GfxOnTVType resolution) +#else +int +gfx_set_tv_format(TVStandardType format, GfxOnTVType resolution) +#endif +{ + unsigned long ctrl2, mode; + + /* Save TV output mode */ + ctrl2 = + READ_VID32(SC1200_TVENC_TIM_CTRL_2) & (SC1200_TVENC_OUTPUT_YCBCR | + SC1200_TVENC_CFS_MASK); + /* Save flicker filter setting */ + mode = + READ_VID32(SC1200_TVOUT_HORZ_SCALING) & + SC1200_TVOUT_FLICKER_FILTER_MASK; + + switch (format) { + case TV_STANDARD_NTSC: + /* Horizontal Sync Start is 848 */ + /* Horizontal Sync End is 856 */ + WRITE_VID32(SC1200_TVOUT_HORZ_SYNC, 0x03580350); + /* Vertical Sync Start is 0 */ + /* Vertical Sync End is 1 */ + /* Vertical Display Start Skew is 1 */ + /* Vertical Display End Skew is 1 */ + WRITE_VID32(SC1200_TVOUT_VERT_SYNC, 0x05001000); + /* Disable vertical down scaling, take all lines */ + if (gfx_chip_revision <= SC1200_REV_B3) + WRITE_VID32(SC1200_TVOUT_VERT_DOWNSCALE, 0xffffffff); + /* Enable video timing */ + /* Reset sub carrier every two frames */ + /* Disable BLANK */ + /* Enable color burst */ + /* Add the IRE offset */ + /* NTSC color encoding */ + /* Video generator timing is 525 lines / 60Hz */ + /* Horizontal and Vertical counters are initialized to HPHASE & + * VPHASE */ + /* VPHASE is 2, HPHASE is 0x50 */ + WRITE_VID32(SC1200_TVENC_TIM_CTRL_1, 0xa2a01050); + /* Increase horizontal blanking interval */ + /* Low Water Mark for Y is 0x1F */ + /* Low Water Mark for Cb is 0xF */ + /* HUE is 0 */ + /* SCPHASE is 0xF9 */ + WRITE_VID32(SC1200_TVENC_TIM_CTRL_2, 0x9ff000f9 | ctrl2); + /* Subcarrier Frequency is 3.579545 MHz */ + WRITE_VID32(SC1200_TVENC_SUB_FREQ, 0x21f07c1f); + /* VSTART is 18, HSTART is 113 */ + WRITE_VID32(SC1200_TVENC_DISP_POS, 0x00120071); + /* Display size: HEIGHT is 239, WIDTH is 719 */ + WRITE_VID32(SC1200_TVENC_DISP_SIZE, 0x00ef02cf); + switch (resolution) { + case GFX_ON_TV_SQUARE_PIXELS: + if (gfx_chip_revision <= SC1200_REV_B3) { + /* Horizontal Display start is 116 */ + /* Total number of pixels per line is 857 */ + WRITE_VID32(SC1200_TVOUT_HORZ_TIM, 0x00740359); + /* HSYNC generated in the TV Encoder module */ + /* Interval between resets of TV Encoder is once every odd + * field */ + /* Enable Horizontal interpolation */ + /* Enable Horizontal up scaling 9/8 */ + /* Disable Horizontal downscale */ + WRITE_VID32(SC1200_TVOUT_HORZ_SCALING, 0x10020700 | mode); + /* Horizontal display end is 919, i.e. 720 active pixels */ + /* Total number of display lines per field is 240 */ + WRITE_VID32(SC1200_TVOUT_LINE_END, 0x039700f0); + } else { /* Use new scaler available in Rev. C */ + /* Horizontal Display start is 111 */ + /* Total number of pixels per line is 857 */ + WRITE_VID32(SC1200_TVOUT_HORZ_TIM, 0x006f0359); + /* HSYNC generated in the TV Encoder module */ + /* Interval between resets of TV Encoder is once every odd + * field */ + /* Enable Horizontal interpolation */ + /* Disable Horizontal up scaling 9/8 */ + /* Disable Horizontal downscale */ + WRITE_VID32(SC1200_TVOUT_HORZ_SCALING, 0x10020500 | mode); + /* Set Horizontal upscaling to 64/58 (~ 11/10) */ + WRITE_VID32(SC1200_TVOUT_HORZ_PRE_ENCODER_SCALE, 0x3A000000); + /* Horizontal display end is 900, i.e. 706 active pixels */ + /* Total number of display lines per field is 240 */ + WRITE_VID32(SC1200_TVOUT_LINE_END, 0x038400f0); + } + break; + case GFX_ON_TV_NO_SCALING: + /* Horizontal Display start is 116 */ + /* Total number of pixels per line is 857 */ + WRITE_VID32(SC1200_TVOUT_HORZ_TIM, 0x00740359); + /* HSYNC generated in the TV Encoder module */ + /* Interval between resets of TV Encoder is once every odd field */ + /* Enable Horizontal interpolation */ + /* Disable Horizontal up scaling 9/8 */ + /* Disable Horizontal downscale */ + WRITE_VID32(SC1200_TVOUT_HORZ_SCALING, 0x10020500 | mode); + /* Disable Horizontal scaling (set to 64/64) */ + if (gfx_chip_revision >= SC1200_REV_C1) + WRITE_VID32(SC1200_TVOUT_HORZ_PRE_ENCODER_SCALE, 0x40000000); + /* Horizontal display end is 919, i.e. 720 active pixels */ + /* Total number of display lines per field is 240 */ + WRITE_VID32(SC1200_TVOUT_LINE_END, 0x039700f0); + break; + default: + return (GFX_STATUS_BAD_PARAMETER); + } + break; + case TV_STANDARD_PAL: + /* Horizontal Sync Start is 854 */ + /* Horizontal Sync End is 862 */ + WRITE_VID32(SC1200_TVOUT_HORZ_SYNC, 0x035e0356); + /* Vertical Sync Start is 0 */ + /* Vertical Sync End is 1 */ + /* Vertical Display Start Skew is 1 */ + /* Vertical Display End Skew is 1 */ + WRITE_VID32(SC1200_TVOUT_VERT_SYNC, 0x05001000); + /* Disable vertical down scaling, take all lines */ + if (gfx_chip_revision <= SC1200_REV_B3) + WRITE_VID32(SC1200_TVOUT_VERT_DOWNSCALE, 0xffffffff); + /* Enable video timing */ + /* Never reset sub carrier (should be every 4 frames but doesn't work + * with genlock) */ + /* Disable BLANK */ + /* Enable color burst */ + /* Do not add the IRE offset */ + /* NTSC color encoding */ + /* Video generator timing is 625 lines / 50Hz */ + /* Horizontal and Vertical counters are initialized to HPHASE & VPHASE + * */ + /* VPHASE is 2, HPHASE is 50 */ + WRITE_VID32(SC1200_TVENC_TIM_CTRL_1, 0xB1201050); + /* Increase horizontal blanking interval */ + /* Low Water Mark for Y is 0x1F */ + /* Low Water Mark for Cb is 0xF */ + /* HUE is 0 */ + /* SCPHASE is 0xD9 */ + WRITE_VID32(SC1200_TVENC_TIM_CTRL_2, 0x9ff000d9 | ctrl2); + /* Subcarrier Frequency is 4.43361875 MHz */ + WRITE_VID32(SC1200_TVENC_SUB_FREQ, 0x2a098acb); + /* VSTART is 22, HSTART is 123 */ + WRITE_VID32(SC1200_TVENC_DISP_POS, 0x0016007b); + /* Display size: HEIGHT is 287, WIDTH is 719 */ + WRITE_VID32(SC1200_TVENC_DISP_SIZE, 0x011f02cf); + switch (resolution) { + case GFX_ON_TV_NO_SCALING: + /* Horizontal Display start is 124 */ + /* Total number of pixels per line is 863 */ + WRITE_VID32(SC1200_TVOUT_HORZ_TIM, 0x007c035f); + /* HSYNC generated in the TV Encoder module */ + /* Interval between resets of TV Encoder is once every odd field */ + /* Enable Horizontal interpolation */ + /* Disable Horizontal up scaling 9/8 */ + /* Disable Horizontal downscale */ + WRITE_VID32(SC1200_TVOUT_HORZ_SCALING, 0x10020500 | mode); + /* Disable Horizontal scaling (set to 64/64) */ + if (gfx_chip_revision >= SC1200_REV_C1) + WRITE_VID32(SC1200_TVOUT_HORZ_PRE_ENCODER_SCALE, 0x40000000); + /* Horizontal display end is 924, i.e. 720 active pixels */ + /* Total number of display lines per field is 288 */ + WRITE_VID32(SC1200_TVOUT_LINE_END, 0x039c0120); + break; + case GFX_ON_TV_SQUARE_PIXELS: + /* Horizontal Display start is 122 */ + /* Total number of pixels per line is 863 */ + WRITE_VID32(SC1200_TVOUT_HORZ_TIM, 0x007a035f); + if (gfx_chip_revision <= SC1200_REV_B3) { + /* HSYNC generated in the TV Encoder module */ + /* Interval between resets of TV Encoder is once every odd + * field */ + /* Enable Horizontal interpolation */ + /* Disable Horizontal up scaling 9/8 */ + /* Horizontal downscale m/(m+1), m = 11, (i.e. 11/12 - closest + * possible to 54/59) */ + WRITE_VID32(SC1200_TVOUT_HORZ_SCALING, 0x1002040b | mode); + /* Horizontal display end is 906, i.e. 704 active pixels */ + /* Total number of display lines per field is 288 */ + WRITE_VID32(SC1200_TVOUT_LINE_END, 0x038a0120); + } else { + /* HSYNC generated in the TV Encoder module */ + /* Interval between resets of TV Encoder is once every odd + * field */ + /* Enable Horizontal interpolation */ + /* Disable Horizontal up scaling 9/8 */ + /* Disable Horizontal downscale */ + WRITE_VID32(SC1200_TVOUT_HORZ_SCALING, 0x10020500 | mode); + /* Set Horizontal down scaling to 64/70 (closest possible to + * 54/59) */ + WRITE_VID32(SC1200_TVOUT_HORZ_PRE_ENCODER_SCALE, 0x46000000); + /* Horizontal display end is 904, i.e. 702 active pixels */ + /* Total number of display lines per field is 288 */ + WRITE_VID32(SC1200_TVOUT_LINE_END, 0x03880120); + } + break; + default: + return (GFX_STATUS_BAD_PARAMETER); + } + break; + default: + return (GFX_STATUS_BAD_PARAMETER); + } + return (GFX_STATUS_OK); +} + +/*---------------------------------------------------------------------------- + * gfx_set_tv_output + * + * This routine sets the TV encoder registers to the specified output type. + * Supported output types are : S-VIDEO, Composite, YUV and SCART. + *---------------------------------------------------------------------------- + */ +#if GFX_TV_DYNAMIC +int +sc1200_set_tv_output(int output) +#else +int +gfx_set_tv_output(int output) +#endif +{ + unsigned long ctrl2, ctrl3; + + ctrl2 = READ_VID32(SC1200_TVENC_TIM_CTRL_2); + ctrl3 = READ_VID32(SC1200_TVENC_TIM_CTRL_3); + ctrl2 &= ~(SC1200_TVENC_OUTPUT_YCBCR | SC1200_TVENC_CFS_MASK); + ctrl3 &= + ~(SC1200_TVENC_CM | SC1200_TVENC_SYNCMODE_MASK | SC1200_TVENC_CS); + switch (output) { + case TV_OUTPUT_COMPOSITE: + /* Analog outputs provide Y, C and CVBS */ + /* Chrominance Lowpass filter is 1.3MHz (for composite video output) */ + WRITE_VID32(SC1200_TVENC_TIM_CTRL_2, ctrl2 | SC1200_TVENC_CFS_CVBS); + WRITE_VID32(SC1200_TVENC_TIM_CTRL_3, ctrl3); + break; + case TV_OUTPUT_S_VIDEO: + /* Analog outputs provide Y, C and CVBS */ + /* Chrominance Lowpass filter is 1.8MHz (for S-video output) */ + WRITE_VID32(SC1200_TVENC_TIM_CTRL_2, ctrl2 | SC1200_TVENC_CFS_SVIDEO); + WRITE_VID32(SC1200_TVENC_TIM_CTRL_3, ctrl3); + break; + case TV_OUTPUT_YUV: + /* Analog outputs provide Y, Cb and Cr */ + /* A 7.5 IRE setup is applied to the output */ + WRITE_VID32(SC1200_TVENC_TIM_CTRL_2, + ctrl2 | SC1200_TVENC_OUTPUT_YCBCR | SC1200_TVENC_CFS_BYPASS); + WRITE_VID32(SC1200_TVENC_TIM_CTRL_3, + ctrl3 | SC1200_TVENC_CM | SC1200_TVENC_CS); + break; + case TV_OUTPUT_SCART: + /* Analog outputs provide SCART (RGB and CVBS) */ + /* Sync is added to green signal */ + WRITE_VID32(SC1200_TVENC_TIM_CTRL_2, ctrl2 | SC1200_TVENC_CFS_CVBS); + WRITE_VID32(SC1200_TVENC_TIM_CTRL_3, + ctrl3 | SC1200_TVENC_CM | SC1200_TVENC_SYNC_ON_GREEN); + break; + default: + return (GFX_STATUS_BAD_PARAMETER); + } + + /* Adjusts the internal voltage reference */ + ctrl2 = READ_VID32(SC1200_TVENC_DAC_CONTROL); + ctrl2 &= ~SC1200_TVENC_TRIM_MASK; + + /* Bypass for issue #926 : Inadequate chroma level of S-Video output */ + if ((gfx_chip_revision == SC1200_REV_B3) && (output == TV_OUTPUT_S_VIDEO)) + ctrl2 |= 0x7; + else + ctrl2 |= 0x5; + + WRITE_VID32(SC1200_TVENC_DAC_CONTROL, ctrl2); + + /* Disable 4:2:2 to 4:4:4 converter interpolation */ + WRITE_VID32(SC1200_TVOUT_DEBUG, SC1200_TVOUT_CONVERTER_INTERPOLATION); + + return (GFX_STATUS_OK); +} + +/*---------------------------------------------------------------------------- + * gfx_set_tv_enable + * + * This routine enables or disables the TV output. + *---------------------------------------------------------------------------- + */ +#if GFX_TV_DYNAMIC +int +sc1200_set_tv_enable(int enable) +#else +int +gfx_set_tv_enable(int enable) +#endif +{ + unsigned long value_tim, value_dac; + + value_tim = READ_VID32(SC1200_TVENC_TIM_CTRL_1); + value_dac = READ_VID32(SC1200_TVENC_DAC_CONTROL); + + if (enable) { + value_tim |= SC1200_TVENC_VIDEO_TIMING_ENABLE; + value_dac &= ~SC1200_TVENC_POWER_DOWN; + /* ENABLE GRAPHICS DISPLAY LOGIC IN VIDEO PROCESSOR */ + gfx_set_screen_enable(1); + } else { + value_tim &= ~SC1200_TVENC_VIDEO_TIMING_ENABLE; + value_dac |= SC1200_TVENC_POWER_DOWN; + /* Do not disable the graphics display logic because it might be + * needed for CRT */ + } + + WRITE_VID32(SC1200_TVENC_TIM_CTRL_1, value_tim); + WRITE_VID32(SC1200_TVENC_DAC_CONTROL, value_dac); + + return (GFX_STATUS_OK); +} + +/*---------------------------------------------------------------------------- + * gfx_set_tv_flicker_filter + * + * This routine configures the TV out flicker filter. + *---------------------------------------------------------------------------- + */ +#if GFX_TV_DYNAMIC +int +sc1200_set_tv_flicker_filter(int ff) +#else +int +gfx_set_tv_flicker_filter(int ff) +#endif +{ + unsigned long mode; + + mode = READ_VID32(SC1200_TVOUT_HORZ_SCALING); + mode &= ~SC1200_TVOUT_FLICKER_FILTER_MASK; + switch (ff) { + case TV_FLICKER_FILTER_NONE: + WRITE_VID32(SC1200_TVOUT_HORZ_SCALING, + mode | SC1200_TVOUT_FLICKER_FILTER_DISABLED); + break; + case TV_FLICKER_FILTER_NORMAL: + WRITE_VID32(SC1200_TVOUT_HORZ_SCALING, + mode | SC1200_TVOUT_FLICKER_FILTER_FOURTH_HALF_FOURTH); + break; + case TV_FLICKER_FILTER_INTERLACED: + WRITE_VID32(SC1200_TVOUT_HORZ_SCALING, + mode | SC1200_TVOUT_FLICKER_FILTER_HALF_ONE_HALF); + break; + default: + return GFX_STATUS_BAD_PARAMETER; + } + return (GFX_STATUS_OK); +} + +/*---------------------------------------------------------------------------- + * gfx_set_tv_sub_carrier_reset + * + * This routine configures the TV encoder sub carrier reset interval. + *---------------------------------------------------------------------------- + */ +#if GFX_TV_DYNAMIC +int +sc1200_set_tv_sub_carrier_reset(int screset) +#else +int +gfx_set_tv_sub_carrier_reset(int screset) +#endif +{ + unsigned long mode; + + mode = READ_VID32(SC1200_TVENC_TIM_CTRL_1); + mode &= ~SC1200_TVENC_SUB_CARRIER_RESET_MASK; + switch (screset) { + case TV_SUB_CARRIER_RESET_NEVER: + WRITE_VID32(SC1200_TVENC_TIM_CTRL_1, + mode | SC1200_TVENC_SUB_CARRIER_RESET_NEVER); + break; + case TV_SUB_CARRIER_RESET_EVERY_TWO_LINES: + WRITE_VID32(SC1200_TVENC_TIM_CTRL_1, + mode | SC1200_TVENC_SUB_CARRIER_RESET_EVERY_TWO_LINES); + break; + case TV_SUB_CARRIER_RESET_EVERY_TWO_FRAMES: + WRITE_VID32(SC1200_TVENC_TIM_CTRL_1, + mode | SC1200_TVENC_SUB_CARRIER_RESET_EVERY_TWO_FRAMES); + break; + case TV_SUB_CARRIER_RESET_EVERY_FOUR_FRAMES: + WRITE_VID32(SC1200_TVENC_TIM_CTRL_1, + mode | SC1200_TVENC_SUB_CARRIER_RESET_EVERY_FOUR_FRAMES); + break; + default: + return GFX_STATUS_BAD_PARAMETER; + } + return (GFX_STATUS_OK); +} + +/*---------------------------------------------------------------------------- + * gfx_set_tv_vphase + * + * This routine sets the tv encoder VPHASE value. + *---------------------------------------------------------------------------- + */ +#if GFX_TV_DYNAMIC +int +sc1200_set_tv_vphase(int vphase) +#else +int +gfx_set_tv_vphase(int vphase) +#endif +{ + unsigned long mode = READ_VID32(SC1200_TVENC_TIM_CTRL_1); + + mode &= ~SC1200_TVENC_VPHASE_MASK; + mode |= (vphase << SC1200_TVENC_VPHASE_POS) & SC1200_TVENC_VPHASE_MASK; + WRITE_VID32(SC1200_TVENC_TIM_CTRL_1, mode); + return (GFX_STATUS_OK); +} + +/*---------------------------------------------------------------------------- + * gfx_set_tv_YC_delay + * + * This routine configures the TV out Y/C delay. + *---------------------------------------------------------------------------- + */ +#if GFX_TV_DYNAMIC +int +sc1200_set_tv_YC_delay(int delay) +#else +int +gfx_set_tv_YC_delay(int delay) +#endif +{ + unsigned long mode; + + /* This feature is implemented in Rev C1 */ + if (gfx_chip_revision < SC1200_REV_C1) + return (GFX_STATUS_OK); + + mode = READ_VID32(SC1200_TVOUT_HORZ_PRE_ENCODER_SCALE); + mode &= ~SC1200_TVOUT_YC_DELAY_MASK; + switch (delay) { + case TV_YC_DELAY_NONE: + WRITE_VID32(SC1200_TVOUT_HORZ_PRE_ENCODER_SCALE, + mode | SC1200_TVOUT_YC_DELAY_NONE); + break; + case TV_Y_DELAY_ONE_PIXEL: + WRITE_VID32(SC1200_TVOUT_HORZ_PRE_ENCODER_SCALE, + mode | SC1200_TVOUT_Y_DELAY_ONE_PIXEL); + break; + case TV_C_DELAY_ONE_PIXEL: + WRITE_VID32(SC1200_TVOUT_HORZ_PRE_ENCODER_SCALE, + mode | SC1200_TVOUT_C_DELAY_ONE_PIXEL); + break; + case TV_C_DELAY_TWO_PIXELS: + WRITE_VID32(SC1200_TVOUT_HORZ_PRE_ENCODER_SCALE, + mode | SC1200_TVOUT_C_DELAY_TWO_PIXELS); + break; + default: + return GFX_STATUS_BAD_PARAMETER; + } + return (GFX_STATUS_OK); +} + +/*---------------------------------------------------------------------------- + * gfx_set_tvenc_reset_interval + * + * This routine sets the interval between external resets of the TV encoder + * timing generator by the TV out. + *---------------------------------------------------------------------------- + */ +#if GFX_TV_DYNAMIC +int +sc1200_set_tvenc_reset_interval(int interval) +#else +int +gfx_set_tvenc_reset_interval(int interval) +#endif +{ + unsigned long value; + + value = READ_VID32(SC1200_TVOUT_HORZ_SCALING); + value &= ~SC1200_TVENC_EXTERNAL_RESET_INTERVAL_MASK; + switch (interval) { + case TVENC_RESET_EVERY_ODD_FIELD: + WRITE_VID32(SC1200_TVOUT_HORZ_SCALING, + value | SC1200_TVENC_EXTERNAL_RESET_EVERY_ODD_FIELD); + break; + case TVENC_RESET_EVERY_EVEN_FIELD: + WRITE_VID32(SC1200_TVOUT_HORZ_SCALING, + value | SC1200_TVENC_EXTERNAL_RESET_EVERY_EVEN_FIELD); + break; + case TVENC_RESET_NEXT_ODD_FIELD: + WRITE_VID32(SC1200_TVOUT_HORZ_SCALING, + value | SC1200_TVENC_EXTERNAL_RESET_NEXT_ODD_FIELD); + break; + case TVENC_RESET_NEXT_EVEN_FIELD: + WRITE_VID32(SC1200_TVOUT_HORZ_SCALING, + value | SC1200_TVENC_EXTERNAL_RESET_NEXT_EVEN_FIELD); + break; + case TVENC_RESET_EVERY_FIELD: + WRITE_VID32(SC1200_TVOUT_HORZ_SCALING, + value | SC1200_TVENC_EXTERNAL_RESET_EVERY_FIELD); + break; + case TVENC_RESET_EVERY_X_ODD_FIELDS: + case TVENC_RESET_EVERY_X_EVEN_FIELDS: + return GFX_STATUS_UNSUPPORTED; + default: + return GFX_STATUS_BAD_PARAMETER; + } + return (GFX_STATUS_OK); +} + +/*---------------------------------------------------------------------------- + * gfx_set_tv_cc_enable + * + * This routine enables or disables the use of the hardware CC registers + * in the TV encoder. + *---------------------------------------------------------------------------- + */ +#if GFX_TV_DYNAMIC +int +sc1200_set_tv_cc_enable(int enable) +#else +int +gfx_set_tv_cc_enable(int enable) +#endif +{ + unsigned long value; + + value = READ_VID32(SC1200_TVENC_CC_CONTROL); + value &= ~(0x0005F); + if (enable) + value |= 0x51; + WRITE_VID32(SC1200_TVENC_CC_CONTROL, value); + return (0); +} + +/*--------------------------------------------------------------------------- + * gfx_set_tv_display + * + * This routine sets the timings in the display controller to support a + * TV resolution. + *--------------------------------------------------------------------------- + */ +#if GFX_TV_DYNAMIC +int +sc1200_set_tv_display(int width, int height) +#else +int +gfx_set_tv_display(int width, int height) +#endif +{ + DISPLAYMODE *pMode; + unsigned int i; + + for (i = 0; i < NUM_TV_MODES; i++) { + pMode = &TVTimings[i]; + if ((unsigned)width == pMode->hactive + && (unsigned)height == pMode->vactive) + break; + } + + if (i == NUM_TV_MODES) + return 0; + + gfx_set_display_timings(gfx_get_display_bpp(), + (unsigned short)pMode->flags, pMode->hactive, pMode->hblankstart, + pMode->hsyncstart, pMode->hsyncend, pMode->hblankend, pMode->htotal, + pMode->vactive, pMode->vblankstart, pMode->vsyncstart, + pMode->vsyncend, pMode->vblankend, pMode->vtotal, pMode->frequency); + + return 1; +} + +/*---------------------------------------------------------------------------- + * cc_add_parity_bit + * + * This routine adds the (odd) parity bit to the data character. + *---------------------------------------------------------------------------- + */ +unsigned char +cc_add_parity_bit(unsigned char data) +{ + int i, num = 0; + unsigned char d = data; + + for (i = 0; i < 7; i++) { + if (d & 0x1) + num++; + d >>= 1; + } + if (num & 0x1) + return (data & ~0x80); + else + return (data | 0x80); +} + +/*---------------------------------------------------------------------------- + * gfx_set_tv_cc_data + * + * This routine writes the two specified characters to the CC data register + * of the TV encoder. + *---------------------------------------------------------------------------- + */ +#if GFX_TV_DYNAMIC +int +sc1200_set_tv_cc_data(unsigned char data1, unsigned char data2) +#else +int +gfx_set_tv_cc_data(unsigned char data1, unsigned char data2) +#endif +{ + unsigned long value; + + value = cc_add_parity_bit(data1) | (cc_add_parity_bit(data2) << 8); + WRITE_VID32(SC1200_TVENC_CC_DATA, value); + return (0); +} + +/*--------------------------------------------------------------------------- + * gfx_test_tvout_odd_field + * + * This routine returns 1 if the current TVout field is odd. Otherwise returns + * 0. + *--------------------------------------------------------------------------- + */ +#if GFX_TV_DYNAMIC +int +sc1200_test_tvout_odd_field(void) +#else +int +gfx_test_tvout_odd_field(void) +#endif +{ + unsigned long debug = READ_VID32(SC1200_TVOUT_DEBUG); + + WRITE_VID32(SC1200_TVOUT_DEBUG, debug | SC1200_TVOUT_FIELD_STATUS_TV); + if (READ_VID32(SC1200_TVOUT_DEBUG) & SC1200_TVOUT_FIELD_STATUS_EVEN) + return (0); + else + return (1); +} + +/*--------------------------------------------------------------------------- + * gfx_test_tvenc_odd_field + * + * This routine returns 1 if the current TV encoder field is odd. Otherwise + * returns 0. + *--------------------------------------------------------------------------- + */ +#if GFX_TV_DYNAMIC +int +sc1200_test_tvenc_odd_field(void) +#else +int +gfx_test_tvenc_odd_field(void) +#endif +{ + unsigned long debug = READ_VID32(SC1200_TVOUT_DEBUG); + + WRITE_VID32(SC1200_TVOUT_DEBUG, debug & ~SC1200_TVOUT_FIELD_STATUS_TV); + if (READ_VID32(SC1200_TVOUT_DEBUG) & SC1200_TVOUT_FIELD_STATUS_EVEN) + return (0); + else + return (1); +} + +/*---------------------------------------------------------------------------- + * gfx_set_tv_field_status_invert + * + * This routines determines whether the tvout/tvencoder field status bit is + * inverted (enable = 1) or not (enable = 0). + *---------------------------------------------------------------------------- + */ +#if GFX_TV_DYNAMIC +int +sc1200_set_tv_field_status_invert(int enable) +#else +int +gfx_set_tv_field_status_invert(int enable) +#endif +{ + unsigned long value; + + value = READ_VID32(SC1200_TVOUT_DEBUG); + + if (enable) { + value |= SC1200_TVOUT_FIELD_STATUS_INVERT; + } else { + value &= ~(SC1200_TVOUT_FIELD_STATUS_INVERT); + } + + WRITE_VID32(SC1200_TVOUT_DEBUG, value); + + return (GFX_STATUS_OK); +} + +/*--------------------------------------------------------------------------- + * gfx_get_tv_vphase + * + * This routine returns the tv encoder vertical phase. + *--------------------------------------------------------------------------- + */ +#if GFX_TV_DYNAMIC +int +sc1200_get_tv_vphase(void) +#else +int +gfx_get_tv_vphase(void) +#endif +{ + unsigned long mode = READ_VID32(SC1200_TVENC_TIM_CTRL_1); + + return (int)((mode & SC1200_TVENC_VPHASE_MASK) >> + SC1200_TVENC_VPHASE_POS); +} + +/*--------------------------------------------------------------------------- + * gfx_get_tv_enable + * + * This routine returns the current tv enable status + *--------------------------------------------------------------------------- + */ +#if GFX_TV_DYNAMIC +int +sc1200_get_tv_enable(unsigned int *p_on) +#else +int +gfx_get_tv_enable(unsigned int *p_on) +#endif +{ + unsigned long control = READ_VID32(SC1200_TVENC_DAC_CONTROL); + + *p_on = (unsigned int)(!(control & SC1200_TVENC_POWER_DOWN)); + + return GFX_STATUS_OK; +} + +/*--------------------------------------------------------------------------- + * gfx_get_tv_output + * + * This routine returns the current programmed TV output type. It does not + * detect invalid configurations. + *--------------------------------------------------------------------------- + */ +#if GFX_TV_DYNAMIC +int +sc1200_get_tv_output(void) +#else +int +gfx_get_tv_output(void) +#endif +{ + unsigned long ctrl2, ctrl3; + int format = 0; + + ctrl2 = READ_VID32(SC1200_TVENC_TIM_CTRL_2); + ctrl3 = READ_VID32(SC1200_TVENC_TIM_CTRL_3); + + if ((ctrl2 & SC1200_TVENC_CFS_MASK) == SC1200_TVENC_CFS_SVIDEO) + format = TV_OUTPUT_S_VIDEO; + else if (ctrl2 & SC1200_TVENC_OUTPUT_YCBCR) + format = TV_OUTPUT_YUV; + else if ((ctrl2 & SC1200_TVENC_CFS_MASK) == SC1200_TVENC_CFS_CVBS) { + if (ctrl3 & SC1200_TVENC_CM) + format = TV_OUTPUT_SCART; + else + format = TV_OUTPUT_COMPOSITE; + } + + return format; +} + +/*--------------------------------------------------------------------------- + * gfx_get_tv_mode_count + * + * This routine returns the number of valid TV out resolutions. + *--------------------------------------------------------------------------- + */ +#if GFX_TV_DYNAMIC +int +sc1200_get_tv_mode_count(TVStandardType format) +#else +int +gfx_get_tv_mode_count(TVStandardType format) +#endif +{ + unsigned int mode, count = 0; + unsigned long flag; + + switch (format) { + case TV_STANDARD_NTSC: + flag = GFX_MODE_TV_NTSC; + break; + case TV_STANDARD_PAL: + flag = GFX_MODE_TV_PAL; + break; + default: + return 0; + } + + for (mode = 0; mode < NUM_TV_MODES; mode++) { + if (TVTimings[mode].flags & flag) + count++; + } + + return count; +} + +/*--------------------------------------------------------------------------- + * gfx_get_tv_display_mode + * + * This routine returns the current TV display parameters. + *--------------------------------------------------------------------------- + */ +#if GFX_TV_DYNAMIC +int +sc1200_get_tv_display_mode(int *width, int *height, int *bpp, int *hz) +#else +int +gfx_get_tv_display_mode(int *width, int *height, int *bpp, int *hz) +#endif +{ + unsigned long frequency; + unsigned long mode, flags; + + *width = gfx_get_hactive(); + *height = gfx_get_vactive(); + *bpp = gfx_get_display_bpp(); + frequency = gfx_get_clock_frequency(); + + for (mode = 0; mode < NUM_TV_MODES; mode++) { + if (TVTimings[mode].hactive == (unsigned short)(*width) && + TVTimings[mode].vactive == (unsigned short)(*height) && + TVTimings[mode].frequency == frequency) { + flags = TVTimings[mode].flags; + + if (flags & GFX_MODE_TV_NTSC) + *hz = 60; + else if (flags & GFX_MODE_TV_PAL) + *hz = 50; + else + *hz = 0; + return (1); + } + } + + return -1; +} + +/*--------------------------------------------------------------------------- + * gfx_get_tv_display_mode_frequency + * + * This routine returns the PLL frequency of a given TV mode. + *--------------------------------------------------------------------------- + */ +#if GFX_TV_DYNAMIC +int +sc1200_get_tv_display_mode_frequency(unsigned short width, + unsigned short height, TVStandardType format, int *frequency) +#else +int +gfx_get_tv_display_mode_frequency(unsigned short width, unsigned short height, + TVStandardType format, int *frequency) +#endif +{ + unsigned long mode, flag; + int retval = -1; + + *frequency = 0; + + switch (format) { + case TV_STANDARD_NTSC: + flag = GFX_MODE_TV_NTSC; + break; + case TV_STANDARD_PAL: + flag = GFX_MODE_TV_PAL; + break; + default: + return -1; + } + + for (mode = 0; mode < NUM_TV_MODES; mode++) { + if ((TVTimings[mode].hactive == width) && + (TVTimings[mode].vactive == height) && + (TVTimings[mode].flags & flag)) { + *frequency = TVTimings[mode].frequency; + retval = 1; + } + } + return retval; +} + +/*--------------------------------------------------------------------------- + * gfx_is_tv_display_mode_supported + * + * Returns >= 0 if the mode is available, -1 if the mode could not be found + *--------------------------------------------------------------------------- + */ +#if GFX_TV_DYNAMIC +int +sc1200_is_tv_display_mode_supported(unsigned short width, + unsigned short height, TVStandardType format) +#else +int +gfx_is_tv_display_mode_supported(unsigned short width, unsigned short height, + TVStandardType format) +#endif +{ + unsigned long mode, flag; + + switch (format) { + case TV_STANDARD_NTSC: + flag = GFX_MODE_TV_NTSC; + break; + case TV_STANDARD_PAL: + flag = GFX_MODE_TV_PAL; + break; + default: + return -1; + } + + for (mode = 0; mode < NUM_TV_MODES; mode++) { + if (TVTimings[mode].hactive == width && + TVTimings[mode].vactive == height && + (TVTimings[mode].flags & flag)) { + return ((int)mode); + } + } + + return -1; +} + +/* END OF FILE */ diff --git a/driver/xf86-video-geode/src/gfx/tv_fs450.c b/driver/xf86-video-geode/src/gfx/tv_fs450.c new file mode 100644 index 000000000..942907b42 --- /dev/null +++ b/driver/xf86-video-geode/src/gfx/tv_fs450.c @@ -0,0 +1,3261 @@ +/* Copyright (c) 2005 Advanced Micro Devices, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + * + * Neither the name of the Advanced Micro Devices, Inc. nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * */ + +#define FS450_DIRECTREG 0 + +#include "tv_fs450.h" + +/*========================================================================== + * Macros + *========================================================================== + */ +#undef fsmax +#undef fsmin +#define fsmax(a, b) ((a) > (b) ? (a) : (b)) +#define fsmin(a, b) ((a) < (b) ? (a) : (b)) + +#undef range_limit +#define range_limit(val,min_val,max_val) (fsmax((min_val),fsmin((val),(max_val)))) + +/*========================================================================== + * Registers + *========================================================================== + */ + +#define MAX_REGISTERS 32 +#define MAX_BITS 32 + +#define READ 1 +#define WRITE 2 +#define READ_WRITE (READ | WRITE) + +typedef struct +{ + char *name; + unsigned long offset; + unsigned char bit_length; + unsigned char valid_bits; + unsigned char read_write; + char *bitfield_names[MAX_BITS]; +} S_REGISTER_DESCRIP; + +typedef struct +{ + int source; + char *name; + S_REGISTER_DESCRIP registers[MAX_REGISTERS]; +} S_SET_DESCRIP; + +const S_SET_DESCRIP *houston_regs(void); +const S_SET_DESCRIP *encoder_regs(void); +const S_SET_DESCRIP *macrovision_regs(void); +const S_SET_DESCRIP *gcc_regs(void); + +/*========================================================================== + * Houston Register Addresses & Bit Definitions + *========================================================================== + */ +#define HOUSTON_IHO 0x00 /* Input Horizontal Offset */ +#define HOUSTON_IVO 0x02 /* Input Vertical Offset */ +#define HOUSTON_IHA 0x04 /* Input Horizontal Active Width */ +#define HOUSTON_VSC 0x06 /* Vertical Scaling Coeficient */ +#define HOUSTON_HSC 0x08 /* Horizontal Scaling Coeficient */ +#define HOUSTON_BYP 0x0A /* Bypass Register */ +#define HOUSTON_CR 0x0C /* Control Register */ +#define HOUSTON_SP 0x0E /* Status */ +#define HOUSTON_NCONL 0x10 /* NCO numerator low word */ +#define HOUSTON_NCONH 0x12 /* NCO numerator high word */ +#define HOUSTON_NCODL 0x14 /* NCO denominator low word */ +#define HOUSTON_NCODH 0x16 /* NCO denominator high word */ +#define HOUSTON_APO 0x18 +#define HOUSTON_ALO 0x1A +#define HOUSTON_AFO 0x1C +#define HOUSTON_HSOUTWID 0x1E +#define HOUSTON_HSOUTST 0x20 +#define HOUSTON_HSOUTEND 0x22 +#define HOUSTON_SHP 0x24 /* Sharpness */ +#define HOUSTON_FLK 0x26 /* Flicker Filter */ +#define HOUSTON_BCONTL 0x28 +#define HOUSTON_BCONTH 0x2A +#define HOUSTON_BDONE 0x2C +#define HOUSTON_BDIAGL 0x2E +#define HOUSTON_BDIAGH 0x30 +#define HOUSTON_REV 0x32 +#define HOUSTON_MISC 0x34 +#define HOUSTON_FFO 0x36 +#define HOUSTON_FFO_LAT 0x38 +#define HOUSTON_VSOUTWID 0x3A +#define HOUSTON_VSOUTST 0x3C +#define HOUSTON_VSOUTEND 0x3E +/* BYP Register Bits */ +#define BYP_RGB_BYPASS 0x0001 +#define BYP_HDS_BYPASS 0x0002 +#define BYP_HDS_TBYPASS 0x0004 +#define BYP_CAC_BYPASS 0x0008 +#define BYP_R2V_SBYPASS 0x0010 +#define BYP_R2V_BYPASS 0x0020 +#define BYP_VDS_BYPASS 0x0040 +#define BYP_FFT_BYPASS 0x0080 +#define BYP_FIF_BYPASS 0x0100 +#define BYP_FIF_TBYPASS 0x0200 +#define BYP_HUS_BYPASS 0x0400 +#define BYP_HUS_TBYPASS 0x0800 +#define BYP_CCR_BYPASS 0x1000 +#define BYP_PLL_BYPASS 0x2000 +#define BYP_NCO_BYPASS 0x4000 +#define BYP_ENC_BYPASS 0x8000 +/* CR Register Bits */ +#define CR_RESET 0x0001 +#define CR_CLKOFF 0x0002 +#define CR_NCO_EN 0x0004 +#define CR_COMPOFF 0x0008 +#define CR_YCOFF 0x0010 +#define CR_LP_EN 0x0020 +#define CR_CACQ_CLR 0x0040 +#define CR_FFO_CLR 0x0080 +#define CR_656_PAL_NTSC 0x0100 +#define CR_656_STD_VMI 0x0200 +#define CR_OFMT 0x0400 +#define CR_UIM_CLK 0x0800 +#define CR_UIM_DEC 0x1000 +#define CR_BIPGEN_EN1 0x2000 +#define CR_UIM_MOD0 0x4000 +#define CR_UIM_MOD1 0x8000 +/* Status Register Bits */ +#define SP_CACQ_ST 0x0001 +#define SP_FFO_ST 0x0002 +#define SP_REVID_MASK 0x7FFC +#define SP_MV_EN 0x8000 +/* BDONE Register Bits */ +#define BDONE_BIST_DONE_A 0x0001 +#define BDONE_BIST_DONE_B 0x0002 +#define BDONE_BIST_DONE_C 0x0004 +#define BDONE_BIST_DONE_D 0x0008 +#define BDONE_BIST_DONE_E 0x0010 +#define BDONE_BIST_DONE_F 0x0020 +#define BDONE_BIST_DONE_G 0x0040 +/* BDIAGL Register Bits */ +#define BDIAGL_BIST_DIAG_A 0x000F +#define BDIAGL_BIST_DIAG_B 0x00F0 +#define BDIAGL_BIST_DIAG_C 0x0F00 +#define BDIAGL_BIST_DIAG_D 0xF000 +/* BDIAGH Register Bits */ +#define BDIAGH_BIST_DIAG_E 0x000F +#define BDIAGH_BIST_DIAG_F 0x000F +#define BDIAGH_BIST_DIAG_G 0x000F +/* MISC Register Bits */ +#define MISC_TV_SHORT_FLD 0x0001 +#define MISC_ENC_TEST 0x0002 +#define MISC_DAC_TEST 0x0004 +#define MISC_MV_SOFT_EN 0x0008 +#define MISC_NCO_LOAD0 0x0010 +#define MISC_NCO_LOAD1 0x0020 +#define MISC_VGACKDIV 0x0200 +#define MISC_BRIDGE_SYNC 0x0400 +#define MISC_GTLIO_PD 0x8000 +/*========================================================================== + * Encoder Registers & Bit Definitions + *========================================================================== + */ +#define ENC_CHROMA_FREQ 0x40 +#define ENC_CHROMA_PHASE 0x44 +#define ENC_REG05 0x45 +#define ENC_REG06 0x46 +#define ENC_REG07 0x47 +#define ENC_HSYNC_WIDTH 0x48 +#define ENC_BURST_WIDTH 0x49 +#define ENC_BACK_PORCH 0x4A +#define ENC_CB_BURST_LEVEL 0x4B +#define ENC_CR_BURST_LEVEL 0x4C +#define ENC_SLAVE_MODE 0x4D +#define ENC_BLACK_LEVEL 0x4e +#define ENC_BLANK_LEVEL 0x50 +#define ENC_NUM_LINES 0x57 +#define ENC_WHITE_LEVEL 0x5e +#define ENC_CB_GAIN 0x60 +#define ENC_CR_GAIN 0x62 +#define ENC_TINT 0x65 +#define ENC_BREEZE_WAY 0x69 +#define ENC_FRONT_PORCH 0x6C +#define ENC_ACTIVELINE 0x71 +#define ENC_FIRST_LINE 0x73 +#define ENC_REG34 0x74 +#define ENC_SYNC_LEVEL 0x75 +#define ENC_VBI_BLANK_LEVEL 0x7C +#define ENC_RESET 0x7e +#define ENC_NOTCH_FILTER 0x8d +/*========================================================================== + * Macrovision Registers & Bit Definitions + *========================================================================== + */ +#define MV_N0 0x59 +#define MV_N1 0x52 +#define MV_N2 0x7b +#define MV_N3 0x53 +#define MV_N4 0x79 +#define MV_N5 0x5d +#define MV_N6 0x7a +#define MV_N7 0x64 +#define MV_N8 0x54 +#define MV_N9 0x55 +#define MV_N10 0x56 +#define MV_N11 0x6d +#define MV_N12 0x6f +#define MV_N13 0x5a +#define MV_N14 0x5b +#define MV_N15 0x5c +#define MV_N16 0x63 +#define MV_N17 0x66 +#define MV_N18 0x68 +#define MV_N19 0x67 +#define MV_N20 0x61 +#define MV_N21 0x6a +#define MV_N22 0x76 +#define MV_AGC_PULSE_LEVEL 0x77 +#define MV_BP_PULSE_LEVEL 0x78 +/*========================================================================== + * The TRACE macro can be used to display debug information. It can display + * one or more parameters in a formatted string like printf. No code will be + * generated for a release build. Use double parentheses for compatibility + * with C #define statements. Newline characters are not added + * automatically. Usage example: + * + * TRACE(("Number is %d, Name is %s.\n",iNumber,lpszName)) + *========================================================================== + */ +#define TRACE(parameters) {} +/* GCC timing structure */ +typedef struct _S_TIMING_SPECS +{ + int vga_width; + int vga_lines; + int tv_width; + int tv_lines; + int h_total; + int h_sync; + int v_total; + int v_sync; +} S_TIMING_SPECS; + +/* Revision of Houston chip */ +#define HOUSTON_REV_A 0 +#define HOUSTON_REV_B 1 +static int houston_Rev(void); + +/*========================================================================== + * Functions + *========================================================================== + */ +static int houston_init(void); + +static unsigned char PLAL_FS450_i2c_address(void); +static int PLAL_FS450_UIM_mode(void); +static int PLAL_ReadRegister(S_REG_INFO * p_reg); +static int PLAL_WriteRegister(const S_REG_INFO * p_reg); +static int PLAL_IsTVOn(void); +static int PLAL_EnableVga(void); +static int PLAL_PrepForTVout(void); +static int PLAL_SetTVTimingRegisters(const S_TIMING_SPECS * p_specs); +static int PLAL_FinalEnableTVout(unsigned long vga_mode); + +/* Direct Memory Access Functions */ +/* NOTE: Cx5530 is assumed hardcoded at 0x10000 offset from MediaGX base. + * F4Bar is bogus as described in the Cx5530 datasheet (actually points to GX + * frame buffer). */ +static int +DMAL_ReadUInt32(unsigned long phys_addr, unsigned long *p_data) +{ + *p_data = READ_REG32(phys_addr); + return 0; +} + +static int +DMAL_WriteUInt32(unsigned long phys_addr, unsigned long data) +{ + WRITE_REG32(phys_addr, data); + return 0; +} + +/* Houston register access functions. */ +static int +houston_ReadReg(unsigned int reg, unsigned long *p_value, unsigned int bytes) +{ + return gfx_i2c_read(1, PLAL_FS450_i2c_address(), (unsigned char)reg, + (unsigned char)bytes, (unsigned char *)p_value); +} + +static int +houston_WriteReg(unsigned int reg, unsigned long value, unsigned int bytes) +{ + return gfx_i2c_write(1, PLAL_FS450_i2c_address(), (unsigned char)reg, + (unsigned char)bytes, (unsigned char *)&value); +} + +/* TV configuration functions. */ +static int config_init(void); +static const S_TIMING_SPECS *p_specs(void); +static void config_power(int on); +static void config_vga_mode(unsigned long vga_mode); +static void config_tv_std(unsigned long tv_std, unsigned int trigger_bits); +static void conget_tv_std(unsigned long *p_tv_std); +static unsigned long supported_standards(void); +static void config_tvout_mode(unsigned long tvout_mode); +static void conget_tvout_mode(unsigned long *p_tvout_mode); +static void config_overscan_xy(unsigned long tv_std, unsigned long vga_mode, + int overscan_x, int overscan_y, int pos_x, int pos_y); +static void config_nco(unsigned long tv_std, unsigned long vga_mode); +static void config_sharpness(int sharpness); +static void conget_sharpness(int *p_sharpness); +static void config_flicker(int flicker); +static void conget_flicker(int *p_flicker); +static void config_color(int color); +static void conget_color(int *p_color); +static void config_brightness_contrast(unsigned long tv_std, + unsigned int trigger_bits, int brightness, int contrast); +static void conget_brightness_contrast(unsigned long tv_std, + unsigned int trigger_bits, int *p_brightness, int *p_contrast); +static void config_yc_filter(unsigned long tv_std, int luma_filter, + int chroma_filter); +static void conget_yc_filter(int *p_luma_filter, int *p_chroma_filter); +static void config_macrovision(unsigned long tv_std, + unsigned int cp_trigger_bits); +static void conget_macrovision(unsigned long tv_std, + unsigned int *p_cp_trigger_bits); + +/* Device settings. */ +typedef struct _S_DEVICE_SETTINGS +{ + int tv_on; + unsigned long vga_mode; + unsigned long tv_std; + unsigned long tvout_mode; + int overscan_x; + int overscan_y; + int position_x; + int position_y; + int sharpness; + int flicker; + int color; + int brightness; + int contrast; + unsigned char yc_filter; + unsigned int aps_trigger_bits; + int last_overscan_y; +} S_DEVICE_SETTINGS; + +static S_DEVICE_SETTINGS d; + +/*========================================================================== + * TV Setup Parameters + *========================================================================== + * */ + +static const struct +{ + unsigned long chroma_freq[5]; + unsigned short chroma_phase[5]; + unsigned short cphase_rst[5]; + unsigned short color[5]; + unsigned short cr_burst_level[5]; + unsigned short cb_burst_level[5]; + unsigned short sys625_50[5]; + unsigned short vsync5[5]; + unsigned short pal_mode[5]; + unsigned short hsync_width[5]; + unsigned short burst_width[5]; + unsigned short back_porch[5]; + unsigned short front_porch[5]; + unsigned short breeze_way[5]; + unsigned short activeline[5]; + unsigned short blank_level[5]; + unsigned short vbi_blank_level[5]; + unsigned short black_level[5]; + unsigned short white_level[5]; + unsigned short hamp_offset[5]; + unsigned short sync_level[5]; + unsigned short tv_lines[5]; + unsigned short tv_width[5]; + unsigned short tv_active_lines[5]; + unsigned short tv_active_width[5]; + unsigned char notch_filter[5]; + unsigned short houston_cr[5]; + unsigned short houston_ncodl[5]; + unsigned short houston_ncodh[5]; +} tvsetup = { + /* ntsc, pal, ntsc-eij, pal-m, pal-n */ + { + 0x1f7cf021, 0xcb8a092a, 0x1f7cf021, 0xe3efe621, 0xcb8a092a}, + /* chroma_freq */ + { + 0, 0, 0, 0, 0}, + /* chroma_phase */ + { + 2, 0, 2, 0, 0}, + /* cphase_rst */ + { + 54, 43, 54, 43, 43}, + /* color */ + { + 0, 31, 0, 29, 29}, + /* cr_burst_level */ + { + 59, 44, 59, 41, 41}, + /* cb_burst_level */ + { + 0, 1, 0, 0, 1}, + /* sys625_50 */ + { + 0, 1, 0, 0, 0}, + /* vsync5 */ + { + 0, 1, 0, 1, 1}, + /* pal_mode */ + { + 0x7a, 0x7a, 0x7a, 0x7a, 0x7a}, + /* hsync_width */ + { + 0x40, 0x3c, 0x40, 0x40, 0x3c}, + /* burst_width */ + { + 0x80, 0x9a, 0x80, 0x80, 0x9a}, + /* back_porch */ + { + 0x24, 0x1e, 0x24, 0x24, 0x1e}, + /* front_porch */ + { + 0x19, 0x1a, 0x19, 0x12, 0x1a}, + /* breeze_way */ + { + 0xb4, 0xb4, 0xb4, 0xb4, 0xb4}, + /* active_line */ + { + 240, 251, 240, 240, 240}, + /* blank_level */ + { + 240, 251, 240, 240, 240}, + /* vbi_blank_level */ + { + 284, 252, 240, 252, 252}, + /* black_level */ + { + 823, 821, 823, 821, 821}, + /* white_level */ + { + 60, 48, 60, 48, 48}, + /* hamp_offset */ + { + 0x08, 0x08, 0x08, 0x08, 0x08}, + /* sync_level */ + { + 525, 625, 525, 525, 625}, + /* tv_lines */ + { + 858, 864, 858, 858, 864}, + /* tv_width */ + { + 487, 576, 487, 487, 576}, + /* tv_active_lines */ + { + 800, 800, 800, 800, 800}, + /* tv_active_width */ + { + 0x1a, 0x1d, 0x1a, 0x1d, 0x1d}, + /* notch filter enabled */ + { + 0x0000, 0x0100, 0x0000, 0x0000, 0x0100}, + /* houston cr pal */ + { + 0x7e48, 0xf580, 0x7e48, 0x7e48, 0xf580}, + /* houston ncodl */ + { + 0x001b, 0x0020, 0x001b, 0x001b, 0x0020} + /* houston ncodh */ +}; + +/* MediaGX default underscan and centered position setups. */ +#define SCANTABLE_ENTRIES 5 +struct _scantable +{ + unsigned long mode; + unsigned short v_total[5]; + unsigned short v_sync[5]; + unsigned short iha[5]; + signed short iho[5]; + signed short hsc[5]; +}; + +static struct _scantable scantable[SCANTABLE_ENTRIES] = { + { + GFX_VGA_MODE_640X480, + {617, 624, 617, 624, 624}, /* v_total */ + {69, 88, 69, 88, 88}, /* v_sync */ + {720, 720, 720, 720, 720}, /* iha */ + {0, 0, 0, 0, 0}, /* iho */ + {-12, 0, -6, 0, 0} /* hsc */ + }, + { + GFX_VGA_MODE_800X600, + {740, 740, 740, 740, 740}, /* v_total */ + {90, 88, 90, 88, 88}, /* v_sync */ + {720, 720, 508, 720, 720}, /* iha */ + {-8, 11, -8, -8, 11}, /* iho */ + {-27, -27, -27, -27, -27} /* hsc */ + }, + { + GFX_VGA_MODE_720X487, + {525, 720, 525, 720, 720}, /* v_total */ + {23, 230, 23, 230, 230}, /* v_sync */ + {720, 720, 720, 720, 720}, /* iha */ + {0xa2, 0xa2, 0xa2, 0xa2, 0xa2}, /* iho */ + {0, 0, 0, 0, 0} /* hsc */ + }, + { + GFX_VGA_MODE_720X576, + {720, 625, 720, 625, 625}, /* v_total */ + {129, 25, 129, 25, 25}, /* v_sync */ + {720, 720, 720, 720, 720}, /* iha */ + {0xaa, 0xaa, 0xaa, 0xaa, 0xaa}, /* iho */ + {0, 0, 0, 0, 0} /* hsc */ + }, + { + GFX_VGA_MODE_1024X768, + {933, 942, 933, 806, 806}, /* v_total */ + {121, 112, 121, 88, 88}, /* v_sync */ + {600, 600, 600, 600, 600}, /* iha */ + {0x3c, 0x23, 0x3c, 0x65, 0x65}, /* iho */ + {35, 26, 35, 26, 26} /* hsc */ + }, +}; + +/* Houston fifo configuration constants. */ +struct _ffolat +{ + int v_total; + unsigned short ffolat; +}; + +struct _ffolativo +{ + int v_total; + unsigned short ivo; + unsigned short ffolat; +}; + +/* h_total=832, ivo=40, tv_width=858, tv_lines=525, vga_lines=480 */ +#define SIZE6X4NTSC 66 +static struct _ffolat ffo6x4ntsc[SIZE6X4NTSC + 1] = { + {541, 0x40}, {545, 0x40}, {549, 0x40}, {553, 0x40}, + {557, 0x58}, {561, 0x40}, {565, 0x40}, {569, 0x40}, + {573, 0x48}, {577, 0x40}, {581, 0x40}, {585, 0x40}, + {589, 0x40}, {593, 0x48}, {597, 0x40}, {601, 0x40}, + {605, 0x40}, {609, 0x40}, {613, 0x5b}, {617, 0x48}, + {621, 0x60}, {625, 0x48}, {629, 0x48}, {633, 0x40}, + {637, 0x5e}, {641, 0x40}, {645, 0x50}, {649, 0x56}, + {653, 0x58}, {657, 0x6c}, {661, 0x40}, {665, 0x40}, + {669, 0x40}, {673, 0x40}, {677, 0x40}, {681, 0x40}, + {685, 0x40}, {689, 0x40}, {693, 0x40}, {697, 0x40}, + {701, 0x40}, {705, 0x40}, {709, 0x40}, {713, 0x40}, + {717, 0x40}, {721, 0x40}, {725, 0x40}, {729, 0x40}, + {733, 0x40}, {737, 0x40}, {741, 0x40}, {745, 0x40}, + {749, 0x40}, {753, 0x40}, {757, 0x40}, {761, 0x40}, + {765, 0x40}, {769, 0x40}, {773, 0x40}, {777, 0x40}, + {781, 0x40}, {785, 0x40}, {789, 0x40}, {793, 0x40}, + {797, 0x30}, {801, 0x40}, + {-1, 0} +}; + +#define SIZE6X4PAL 45 +static struct _ffolat ffo6x4pal[SIZE6X4PAL + 1] = { + {625, 0x60}, {629, 0x60}, {633, 0x60}, {637, 0x60}, + {641, 0x50}, {645, 0x60}, {649, 0x60}, {653, 0x60}, + {657, 0x60}, {661, 0x60}, {665, 0x60}, {669, 0x60}, + {673, 0x60}, {677, 0x60}, {681, 0x60}, {685, 0x60}, + {689, 0x60}, {693, 0x60}, {697, 0x60}, {701, 0x60}, + {705, 0x60}, {709, 0x60}, {713, 0x60}, {717, 0x60}, + {721, 0x60}, {725, 0x60}, {729, 0x60}, {733, 0x60}, + {737, 0x60}, {741, 0x60}, {745, 0x60}, {749, 0x60}, + {753, 0x60}, {757, 0x60}, {761, 0x60}, {765, 0x60}, + {769, 0x60}, {773, 0x60}, {777, 0x60}, {781, 0x60}, + {785, 0x60}, {789, 0x60}, {793, 0x60}, {797, 0x60}, + {801, 0x60}, + {-1, 0} +}; + +#define SIZE7X4NTSC 40 +static struct _ffolat ffo7x4ntsc[SIZE7X4NTSC + 1] = { + {525, 0x52}, {529, 0x52}, {533, 0x52}, {537, 0x52}, + {541, 0x52}, {545, 0x40}, {549, 0x40}, {553, 0x40}, + {557, 0x58}, {561, 0x40}, {565, 0x58}, {569, 0x40}, + {573, 0x48}, {577, 0x40}, {581, 0x40}, {585, 0x40}, + {589, 0x40}, {593, 0x48}, {597, 0x40}, {601, 0x40}, + {605, 0x40}, {609, 0x40}, {613, 0x5b}, {617, 0x48}, + {621, 0x60}, {625, 0x48}, {629, 0x48}, {633, 0x40}, + {637, 0x5e}, {641, 0x40}, {645, 0x50}, {649, 0x56}, + {653, 0x58}, {657, 0x6c}, {661, 0x40}, {665, 0x40}, + {669, 0x40}, {673, 0x40}, {677, 0x40}, {681, 0x40}, + {-1, 0} +}; + +#define SIZE7X4PAL 24 +static struct _ffolat ffo7x4pal[SIZE7X4PAL + 1] = { + {625, 0x60}, {629, 0x60}, {633, 0x60}, {637, 0x60}, + {641, 0x50}, {645, 0x60}, {649, 0x60}, {653, 0x60}, + {657, 0x60}, {661, 0x60}, {665, 0x60}, {669, 0x60}, + {673, 0x60}, {677, 0x60}, {681, 0x60}, {685, 0x60}, + {689, 0x60}, {693, 0x60}, {697, 0x60}, {701, 0x60}, + {705, 0x60}, {709, 0x60}, {713, 0x60}, {717, 0x60}, + {-1, 0} +}; + +#define SIZE7X5NTSC 54 +static struct _ffolat ffo7x5ntsc[SIZE7X5NTSC + 1] = { + {590, 0x40}, {594, 0x48}, {598, 0x40}, {602, 0x40}, + {606, 0x40}, {610, 0x40}, {614, 0x5b}, {618, 0x48}, + {622, 0x60}, {626, 0x48}, {630, 0x48}, {634, 0x40}, + {638, 0x5e}, {642, 0x40}, {646, 0x50}, {650, 0x56}, + {654, 0x58}, {658, 0x6c}, {662, 0x40}, {666, 0x40}, + {670, 0x40}, {674, 0x40}, {678, 0x40}, {682, 0x40}, + {686, 0x40}, {690, 0x40}, {694, 0x40}, {698, 0x40}, + {702, 0x40}, {706, 0x40}, {710, 0x40}, {714, 0x40}, + {718, 0x40}, {722, 0x40}, {726, 0x40}, {730, 0x40}, + {734, 0x40}, {738, 0x40}, {742, 0x40}, {746, 0x40}, + {750, 0x40}, {754, 0x40}, {758, 0x40}, {762, 0x40}, + {766, 0x40}, {770, 0x40}, {774, 0x40}, {778, 0x40}, + {782, 0x40}, {786, 0x40}, {790, 0x40}, {794, 0x40}, + {798, 0x30}, {802, 0x40}, + {-1, 0} +}; + +#define SIZE7X5PAL 45 +static struct _ffolat ffo7x5pal[SIZE7X5PAL + 1] = { + {625, 0x60}, {629, 0x60}, {633, 0x60}, {637, 0x60}, + {641, 0x50}, {645, 0x60}, {649, 0x60}, {653, 0x60}, + {657, 0x60}, {661, 0x60}, {665, 0x60}, {669, 0x60}, + {673, 0x60}, {677, 0x60}, {681, 0x60}, {685, 0x60}, + {689, 0x60}, {693, 0x60}, {697, 0x60}, {701, 0x60}, + {705, 0x60}, {709, 0x60}, {713, 0x60}, {717, 0x60}, + {721, 0x60}, {725, 0x60}, {729, 0x60}, {733, 0x60}, + {737, 0x60}, {741, 0x60}, {745, 0x60}, {749, 0x60}, + {753, 0x60}, {757, 0x60}, {761, 0x60}, {765, 0x60}, + {769, 0x60}, {773, 0x60}, {777, 0x60}, {781, 0x60}, + {785, 0x60}, {789, 0x60}, {793, 0x60}, {797, 0x60}, + {801, 0x60}, + {-1, 0} +}; + +/* h_total=1056, vga_lines=600 */ +#define SIZE8X6NTSC 37 +static struct _ffolat ffo8x6ntsc[SIZE8X6NTSC + 1] = { + {620, 0x40}, /* v_total_min >= vsync+10 >= vga_lines+10 = 610 */ + {625, 0x58}, {630, 0x40}, {635, 0x40}, {640, 0x40}, + {645, 0x46}, {650, 0x46}, {655, 0x4f}, {660, 0x4c}, + {665, 0x4a}, {670, 0x50}, {675, 0x2f}, {680, 0x48}, + {685, 0x38}, {690, 0x31}, {695, 0x40}, {700, 0x21}, + {705, 0x25}, {710, 0x40}, {715, 0x48}, {720, 0x50}, + {725, 0x30}, {730, 0x50}, {735, 0x50}, {740, 0x50}, + {745, 0x40}, {750, 0x38}, {755, 0x50}, {760, 0x50}, + {765, 0x40}, {770, 0x38}, {775, 0x40}, {780, 0x40}, + {785, 0x40}, {790, 0x38}, {795, 0x50}, {800, 0x50}, + {-1, 0} +}; + +/* h_total=1056, vga_lines=600 */ +#define SIZE8X6PAL 36 +static struct _ffolat ffo8x6pal[SIZE8X6PAL + 1] = { + {625, 0x80}, {630, 0x80}, {635, 0x5a}, {640, 0x55}, + {645, 0x48}, {650, 0x65}, {655, 0x65}, {660, 0x50}, + {665, 0x80}, {670, 0x70}, {675, 0x56}, {680, 0x80}, + {685, 0x58}, {690, 0x31}, {695, 0x80}, {700, 0x60}, + {705, 0x45}, {710, 0x4a}, {715, 0x50}, {720, 0x50}, + {725, 0x50}, {730, 0x45}, {735, 0x50}, {740, 0x50}, + {745, 0x50}, {750, 0x50}, {755, 0x50}, {760, 0x50}, + {765, 0x50}, {770, 0x50}, {775, 0x50}, {780, 0x50}, + {785, 0x50}, {790, 0x50}, {795, 0x50}, {800, 0x50}, + {-1, 0} +}; + +/* h_total=1344, vga_lines=768 */ +#define SIZE10X7NTSC 45 +static struct _ffolativo ffo10x7ntsc[SIZE10X7NTSC] = { + {783, 0x4d, 0x40}, + {789, 0x47, 0x14}, + {795, 0x47, 0x7f}, + {801, 0x47, 0x53}, + {807, 0x47, 0x11}, + {813, 0x47, 0x78}, + {819, 0x47, 0x54}, + {825, 0x47, 0x40}, + {831, 0x47, 0x0f}, + {837, 0x4d, 0x40}, + {843, 0x47, 0x5a}, + {849, 0x4d, 0x40}, + {855, 0x47, 0x4b}, + {861, 0x4d, 0x40}, + {867, 0x47, 0x4b}, + {873, 0x4d, 0x40}, + {879, 0x47, 0x07}, + {885, 0x48, 0x20}, + {891, 0x47, 0x82}, + {897, 0x47, 0x60}, + {903, 0x47, 0x7f}, + {909, 0x4d, 0x40}, + {915, 0x48, 0x40}, + {921, 0x4c, 0x40}, + {927, 0x49, 0x40}, + {933, 0x48, 0x40}, + {939, 0x4a, 0x40}, + {945, 0x46, 0x40}, + {951, 0x4a, 0x40}, + {957, 0x4a, 0x40}, + {963, 0x4b, 0x40}, + {969, 0x4b, 0x40}, + {975, 0x48, 0x40}, + {981, 0x47, 0x40}, + {987, 0x47, 0x40}, + {993, 0x47, 0x40}, + {999, 0x48, 0x40}, + {1005, 0x48, 0x40}, + {1011, 0x47, 0x40}, + {1017, 0x47, 0x40}, + {1023, 0x48, 0x40}, + {1029, 0x48, 0x40}, + {1035, 0x46, 0x40}, + {1041, 0x47, 0x40}, + {1047, 0x47, 0x40} +}; + +/* h_total=1344, vga_lines=768 */ +#define SIZE10X7PAL 46 +static struct _ffolativo ffo10x7pal[SIZE10X7PAL] = { + {781, 0x49, 0x40}, + {787, 0x46, 0x40}, + {793, 0x48, 0x40}, + {799, 0x46, 0x40}, + {805, 0x49, 0x40}, + {811, 0x47, 0x40}, + {817, 0x46, 0x40}, + {823, 0x46, 0x56}, + {829, 0x46, 0x2d}, + {835, 0x46, 0x40}, + {841, 0x46, 0x2d}, + {847, 0x46, 0x3f}, + {853, 0x46, 0x10}, + {859, 0x46, 0x86}, + {865, 0x46, 0xc9}, + {871, 0x46, 0x83}, + {877, 0x46, 0xa8}, + {883, 0x46, 0x81}, + {889, 0x46, 0xa5}, + {895, 0x46, 0xa9}, + {901, 0x46, 0x81}, + {907, 0x46, 0xa4}, + {913, 0x46, 0xa5}, + {919, 0x46, 0x7f}, + {925, 0x46, 0xa2}, + {931, 0x46, 0x9d}, + {937, 0x46, 0xc1}, + {943, 0x46, 0x96}, + {949, 0x46, 0xb7}, + {955, 0x46, 0xb1}, + {961, 0x46, 0x8a}, + {967, 0x46, 0xa9}, + {973, 0x46, 0xa0}, + {979, 0x46, 0x40}, + {985, 0x46, 0x97}, + {991, 0x46, 0xb5}, + {997, 0x46, 0xaa}, + {1003, 0x46, 0x83}, + {1009, 0x46, 0x9f}, + {1015, 0x47, 0x40}, + {1021, 0x46, 0xad}, + {1027, 0x46, 0x87}, + {1033, 0x46, 0xa2}, + {1039, 0x47, 0x40}, + {1045, 0x46, 0xac}, + {1051, 0x46, 0x86} +}; + +/*==========================================================================*/ +/*FS450 API Functions. */ +/*==========================================================================*/ + +/* Initialize device settings */ +static void +initialize_houston_static_registers(void) +{ + houston_WriteReg(HOUSTON_BYP, 0, 2); + houston_WriteReg(HOUSTON_APO, 0, 2); + houston_WriteReg(HOUSTON_ALO, 0, 2); + houston_WriteReg(HOUSTON_AFO, 0, 2); + houston_WriteReg(HOUSTON_BCONTL, 0, 2); + houston_WriteReg(HOUSTON_BCONTH, 0, 2); + houston_WriteReg(HOUSTON_BDONE, 0, 2); + houston_WriteReg(HOUSTON_BDIAGL, 0, 2); + houston_WriteReg(HOUSTON_BDIAGH, 0, 2); + houston_WriteReg(HOUSTON_MISC, 0, 2); +} + +int +FS450_init(void) +{ + int err; + + TRACE(("FS450_Init()\n")) + + err = houston_init(); + if (err) + return err; + + initialize_houston_static_registers(); + + d.tv_on = PLAL_IsTVOn()? 1 : 0; + + /* get the current tv standard */ + conget_tv_std(&d.tv_std); + + d.vga_mode = 0; + + /* default to VP_TVOUT_MODE_CVBS_YC */ + d.tvout_mode = GFX_TVOUT_MODE_CVBS_YC; + + /* default to 1000 out of 1000 */ + d.sharpness = 1000; + config_sharpness(d.sharpness); + + /* default to 800 out of 1000 */ + d.flicker = 800; + config_flicker(d.flicker); + + /* default to zeros */ + d.overscan_x = 0; + d.overscan_y = 0; + d.position_x = 0; + d.position_y = 0; + + d.color = 50; + /* d.color = tvsetup.color[k]; */ + config_color(d.color); + + /* default */ + d.brightness = 50; + d.contrast = 60; + config_brightness_contrast(d.tv_std, d.aps_trigger_bits, d.brightness, + d.contrast); + + /* get the current yc filtering */ + { + int luma_filter, chroma_filter; + + conget_yc_filter(&luma_filter, &chroma_filter); + d.yc_filter = 0; + if (luma_filter) + d.yc_filter |= GFX_LUMA_FILTER; + if (chroma_filter) + d.yc_filter |= GFX_CHROMA_FILTER; + } + + d.aps_trigger_bits = 0; + config_macrovision(d.tv_std, d.aps_trigger_bits); + + d.last_overscan_y = -10000; + + return 0; +} + +void +FS450_cleanup(void) +{ +} + +/*==========================================================================*/ +/* Required configuration calls to write new settings to the device */ +/*==========================================================================*/ + +#define REQ_TV_STANDARD_BIT 0x0002 +#define REQ_VGA_MODE_BIT 0x0004 +#define REQ_TVOUT_MODE_BIT 0x0008 +#define REQ_SHARPNESS_BIT 0x0010 +#define REQ_FLICKER_BIT 0x0020 +#define REQ_OVERSCAN_POSITION_BIT 0x0040 +#define REQ_COLOR_BIT 0x0080 +#define REQ_BRIGHTNESS_CONTRAST_BIT 0x0100 +#define REQ_YC_FILTER_BIT 0x0200 +#define REQ_MACROVISION_BIT 0x0400 +#define REQ_NCO_BIT 0x1000 + +#define REQ_TV_STANDARD (REQ_TV_STANDARD_BIT | REQ_OVERSCAN_POSITION \ + | REQ_BRIGHTNESS_CONTRAST \ + | REQ_MACROVISION_BIT | REQ_YC_FILTER) +#define REQ_VGA_MODE (REQ_VGA_MODE_BIT | REQ_OVERSCAN_POSITION) +#define REQ_TVOUT_MODE (REQ_TVOUT_MODE_BIT) +#define REQ_SHARPNESS (REQ_SHARPNESS_BIT) +#define REQ_FLICKER (REQ_FLICKER_BIT) +#define REQ_OVERSCAN_POSITION (REQ_OVERSCAN_POSITION_BIT | REQ_NCO) +#define REQ_COLOR (REQ_COLOR_BIT) +#define REQ_BRIGHTNESS_CONTRAST (REQ_BRIGHTNESS_CONTRAST_BIT) +#define REQ_YC_FILTER (REQ_YC_FILTER_BIT) +#define REQ_MACROVISION (REQ_TV_STANDARD_BIT | \ + REQ_BRIGHTNESS_CONTRAST_BIT | \ + REQ_MACROVISION_BIT) +#define REQ_NCO (REQ_NCO_BIT) +#define REQ_ENCODER (REQ_TV_STANDARD | REQ_COLOR | \ + REQ_BRIGHTNESS_CONTRAST | REQ_YC_FILTER) + +static int +write_config(int req) +{ + unsigned long reg, reg_encoder_reset = 0; + int reset; + + /*if we're changing the nco, and the vertical scaling has changed... */ + reset = ((REQ_NCO_BIT & req) && (d.overscan_y != d.last_overscan_y)); + if (reset) { + /*put the encoder into reset while making changes */ + houston_ReadReg(ENC_RESET, ®, 1); + houston_WriteReg(ENC_RESET, reg | 0x01, 1); + reg_encoder_reset = reg & 0x01; + } + + if (REQ_TV_STANDARD_BIT & req) + config_tv_std(d.tv_std, d.aps_trigger_bits); + + if (REQ_VGA_MODE_BIT & req) + config_vga_mode(d.vga_mode); + + if (REQ_TVOUT_MODE_BIT & req) + config_tvout_mode(d.tvout_mode); + + if (REQ_OVERSCAN_POSITION_BIT & req) { + config_overscan_xy(d.tv_std, + d.vga_mode, + d.overscan_x, d.overscan_y, d.position_x, d.position_y); + + /*h_timing and v_timing and syncs. */ + if (PLAL_IsTVOn()) + PLAL_SetTVTimingRegisters(p_specs()); + } + + if (REQ_NCO_BIT & req) + config_nco(d.tv_std, d.vga_mode); + + if (REQ_SHARPNESS_BIT & req) + config_sharpness(d.sharpness); + + if (REQ_FLICKER_BIT & req) + config_flicker(d.flicker); + + if (REQ_COLOR_BIT & req) + config_color(d.color); + + if (REQ_BRIGHTNESS_CONTRAST_BIT & req) { + config_brightness_contrast(d.tv_std, + d.aps_trigger_bits, d.brightness, d.contrast); + } + + if (REQ_YC_FILTER_BIT & req) { + config_yc_filter(d.tv_std, + (d.yc_filter & GFX_LUMA_FILTER), + (d.yc_filter & GFX_CHROMA_FILTER)); + } + + if (REQ_MACROVISION_BIT & req) + config_macrovision(d.tv_std, d.aps_trigger_bits); + + /*if we decided to put the encoder into reset, put it back */ + if (reset) { + houston_ReadReg(ENC_RESET, ®, 1); + houston_WriteReg(ENC_RESET, reg_encoder_reset | (reg & ~0x01), 1); + + d.last_overscan_y = d.overscan_y; + } + return 0; +} + +/*==========================================================================*/ +/* TV On */ +/*==========================================================================*/ + +#if GFX_TV_DYNAMIC +int +fs450_get_tv_enable(unsigned int *p_on) +#else +int +gfx_get_tv_enable(unsigned int *p_on) +#endif +{ + if (!p_on) + return ERR_INVALID_PARAMETER; + + *p_on = d.tv_on; + + return 0; +} + +/*//int FS450_set_tv_on(unsigned int on)*/ +#if GFX_TV_DYNAMIC +int +fs450_set_tv_enable(int on) +#else +int +gfx_set_tv_enable(int on) +#endif +{ + unsigned long reg; + + /*if not mode change, just return */ + if ((d.tv_on && on) || (!d.tv_on && !on)) + return 0; + + /*if turning off... */ + if (!on) { + /*reenable vga. */ + PLAL_EnableVga(); + + /*power down houston */ + config_power(0); + + d.tv_on = 0; + + return 0; + } + + /*turning on... */ + + /*power up houston */ + config_power(1); + + /*assert encoder reset. */ + houston_WriteReg(ENC_RESET, 0x01, 1); + + /*initial platform preparation */ + PLAL_PrepForTVout(); + + /*configure encoder and nco. */ + write_config(REQ_VGA_MODE | + REQ_TV_STANDARD | + REQ_TVOUT_MODE | + REQ_OVERSCAN_POSITION | REQ_YC_FILTER | REQ_MACROVISION); + + /*set LP_EN and UIM */ + houston_ReadReg(HOUSTON_CR, ®, 2); + reg |= CR_LP_EN; + reg &= ~(CR_UIM_MOD0 | CR_UIM_MOD1); + reg |= (PLAL_FS450_UIM_mode() << 14); + houston_WriteReg(HOUSTON_CR, reg, 2); + + /*set platform timing registers */ + PLAL_SetTVTimingRegisters(p_specs()); + + PLAL_FinalEnableTVout(d.vga_mode); + + /*sync bridge */ + { + int retry_count = 0; + + /*sync 50 times */ + while (retry_count++ < 50) { + /*sync bridge. */ + houston_ReadReg(HOUSTON_MISC, ®, 2); + reg |= MISC_BRIDGE_SYNC; + houston_WriteReg(HOUSTON_MISC, reg, 2); + reg &= ~MISC_BRIDGE_SYNC; + houston_WriteReg(HOUSTON_MISC, reg, 2); + } + } + + /*deassert encoder reset. */ + houston_WriteReg(ENC_RESET, 0x00, 1); + + d.tv_on = 1; + + return 0; +} + +#if GFX_TV_DYNAMIC +int +fs450_set_tv_defaults(int format) +#else +int +gfx_set_tv_defaults(int format) +#endif +{ + return 0; +} + +/*==========================================================================*/ +/* TV standard */ +/*==========================================================================*/ + +#if GFX_TV_DYNAMIC +int +fs450_get_tv_standard(unsigned long *p_standard) +#else +int +gfx_get_tv_standard(unsigned long *p_standard) +#endif +{ + if (!p_standard) + return ERR_INVALID_PARAMETER; + + *p_standard = d.tv_std; + + return 0; +} + +#if GFX_TV_DYNAMIC +int +fs450_get_available_tv_standards(unsigned long *p_standards) +#else +int +gfx_get_available_tv_standards(unsigned long *p_standards) +#endif +{ + if (!p_standards) + return ERR_INVALID_PARAMETER; + + *p_standards = supported_standards(); + + return 0; +} + +#if GFX_TV_DYNAMIC +int +fs450_set_tv_standard(unsigned long standard) +#else +int +gfx_set_tv_standard(unsigned long standard) +#endif +{ + /* verify supported standard. */ + if (!(standard & supported_standards())) + return ERR_INVALID_PARAMETER; + + /* disallow if tv is on */ + if (d.tv_on) + return ERR_CANNOT_CHANGE_WHILE_TV_ON; + + d.tv_std = standard; + /* d.color = tvsetup.color[k]; */ + + return write_config(REQ_TV_STANDARD); +} + +/*==========================================================================*/ +/* vga mode as known by the driver */ +/*==========================================================================*/ + +#if GFX_TV_DYNAMIC +int +fs450_get_tv_vga_mode(unsigned long *p_vga_mode) +#else +int +gfx_get_tv_vga_mode(unsigned long *p_vga_mode) +#endif +{ + if (!p_vga_mode) + return ERR_INVALID_PARAMETER; + + *p_vga_mode = d.vga_mode; + + return 0; +} + +#if GFX_TV_DYNAMIC +int +fs450_get_available_tv_vga_modes(unsigned long *p_vga_modes) +#else +int +gfx_get_available_tv_vga_modes(unsigned long *p_vga_modes) +#endif +{ + if (!p_vga_modes) + return ERR_INVALID_PARAMETER; + + *p_vga_modes = + GFX_VGA_MODE_640X480 | + GFX_VGA_MODE_720X487 | GFX_VGA_MODE_720X576 | GFX_VGA_MODE_800X600; + if (houston_Rev() >= HOUSTON_REV_B) + *p_vga_modes |= GFX_VGA_MODE_1024X768; + + return 0; +} + +#if GFX_TV_DYNAMIC +int +fs450_set_tv_vga_mode(unsigned long vga_mode) +#else +int +gfx_set_tv_vga_mode(unsigned long vga_mode) +#endif +{ + /*reject if not a single valid VGA mode */ + switch (vga_mode) { + default: + return ERR_INVALID_PARAMETER; + case GFX_VGA_MODE_640X480: + case GFX_VGA_MODE_720X487: + case GFX_VGA_MODE_720X576: + case GFX_VGA_MODE_800X600: + break; + case GFX_VGA_MODE_1024X768: + if (houston_Rev() >= HOUSTON_REV_B) + break; + return ERR_INVALID_PARAMETER; + } + + /*if the mode has changed... */ + if (vga_mode != d.vga_mode) { + d.vga_mode = vga_mode; + + return write_config(REQ_VGA_MODE); + } + + return 0; +} + +/*==========================================================================*/ +/* tvout mode */ +/*==========================================================================*/ + +#if GFX_TV_DYNAMIC +int +fs450_get_tvout_mode(unsigned long *p_tvout_mode) +#else +int +gfx_get_tvout_mode(unsigned long *p_tvout_mode) +#endif +{ + if (!p_tvout_mode) + return ERR_INVALID_PARAMETER; + + *p_tvout_mode = d.tvout_mode; + + return 0; +} + +#if GFX_TV_DYNAMIC +int +fs450_set_tvout_mode(unsigned long tvout_mode) +#else +int +gfx_set_tvout_mode(unsigned long tvout_mode) +#endif +{ + d.tvout_mode = tvout_mode; + + return write_config(REQ_TVOUT_MODE); +} + +/*==========================================================================*/ +/* Sharpness */ +/*==========================================================================*/ + +#if GFX_TV_DYNAMIC +int +fs450_get_sharpness(int *p_sharpness) +#else +int +gfx_get_sharpness(int *p_sharpness) +#endif +{ + if (!p_sharpness) + return ERR_INVALID_PARAMETER; + + *p_sharpness = d.sharpness; + + return 0; +} + +#if GFX_TV_DYNAMIC +int +fs450_set_sharpness(int sharpness) +#else +int +gfx_set_sharpness(int sharpness) +#endif +{ + d.sharpness = range_limit(sharpness, 0, 1000); + + return write_config(REQ_SHARPNESS); +} + +/*==========================================================================*/ +/* flicker filter control. */ +/*==========================================================================*/ + +#if GFX_TV_DYNAMIC +int +fs450_get_flicker_filter(int *p_flicker) +#else +int +gfx_get_flicker_filter(int *p_flicker) +#endif +{ + if (!p_flicker) + return ERR_INVALID_PARAMETER; + + *p_flicker = d.flicker; + + return 0; +} + +#if GFX_TV_DYNAMIC +int +fs450_set_flicker_filter(int flicker) +#else +int +gfx_set_flicker_filter(int flicker) +#endif +{ + d.flicker = range_limit(flicker, 0, 1000); + + return write_config(REQ_FLICKER); +} + +/*==========================================================================*/ +/* Overscan and Position */ +/*==========================================================================*/ + +#if GFX_TV_DYNAMIC +int +fs450_get_overscan(int *p_x, int *p_y) +#else +int +gfx_get_overscan(int *p_x, int *p_y) +#endif +{ + if (!p_x || !p_y) + return ERR_INVALID_PARAMETER; + + *p_x = d.overscan_x; + *p_y = d.overscan_y; + + return 0; +} + +#if GFX_TV_DYNAMIC +int +fs450_set_overscan(int x, int y) +#else +int +gfx_set_overscan(int x, int y) +#endif +{ + d.overscan_x = range_limit(x, -1000, 1000); + d.overscan_y = range_limit(y, -1000, 1000); + + return write_config(REQ_OVERSCAN_POSITION); +} + +#if GFX_TV_DYNAMIC +int +fs450_get_position(int *p_x, int *p_y) +#else +int +gfx_get_position(int *p_x, int *p_y) +#endif +{ + if (!p_x || !p_y) + return ERR_INVALID_PARAMETER; + + *p_x = d.position_x; + *p_y = d.position_y; + + return 0; +} + +#if GFX_TV_DYNAMIC +int +fs450_set_position(int x, int y) +#else +int +gfx_set_position(int x, int y) +#endif +{ + d.position_x = range_limit(x, -1000, 1000); + d.position_y = range_limit(y, -1000, 1000); + + return write_config(REQ_OVERSCAN_POSITION); +} + +/*==========================================================================*/ +/* Color, Brightness, and Contrast */ +/*==========================================================================*/ + +#if GFX_TV_DYNAMIC +int +fs450_get_color(int *p_color) +#else +int +gfx_get_color(int *p_color) +#endif +{ + if (!p_color) + return ERR_INVALID_PARAMETER; + + *p_color = d.color; + + return 0; +} + +#if GFX_TV_DYNAMIC +int +fs450_set_color(int color) +#else +int +gfx_set_color(int color) +#endif +{ + d.color = range_limit(color, 0, 100); + + return write_config(REQ_COLOR); +} + +#if GFX_TV_DYNAMIC +int +fs450_get_brightness(int *p_brightness) +#else +int +gfx_get_brightness(int *p_brightness) +#endif +{ + if (!p_brightness) + return ERR_INVALID_PARAMETER; + + *p_brightness = d.brightness; + + return 0; +} + +#if GFX_TV_DYNAMIC +int +fs450_set_brightness(int brightness) +#else +int +gfx_set_brightness(int brightness) +#endif +{ + d.brightness = range_limit(brightness, 0, 100); + + return write_config(REQ_BRIGHTNESS_CONTRAST); +} + +#if GFX_TV_DYNAMIC +int +fs450_get_contrast(int *p_contrast) +#else +int +gfx_get_contrast(int *p_contrast) +#endif +{ + if (!p_contrast) + return ERR_INVALID_PARAMETER; + + *p_contrast = d.contrast; + + return 0; +} + +#if GFX_TV_DYNAMIC +int +fs450_set_contrast(int constrast) +#else +int +gfx_set_contrast(int constrast) +#endif +{ + d.contrast = range_limit(constrast, 0, 100); + + return write_config(REQ_BRIGHTNESS_CONTRAST); +} + +/*==========================================================================*/ +/* YC filters */ +/*==========================================================================*/ + +#if GFX_TV_DYNAMIC +int +fs450_get_yc_filter(unsigned int *p_yc_filter) +#else +int +gfx_get_yc_filter(unsigned int *p_yc_filter) +#endif +{ + if (!p_yc_filter) + return ERR_INVALID_PARAMETER; + + if (houston_Rev() < HOUSTON_REV_B) + return ERR_NOT_SUPPORTED; + + *p_yc_filter = d.yc_filter; + + return 0; +} + +#if GFX_TV_DYNAMIC +int +fs450_set_yc_filter(unsigned int yc_filter) +#else +int +gfx_set_yc_filter(unsigned int yc_filter) +#endif +{ + if (houston_Rev() < HOUSTON_REV_B) + return ERR_NOT_SUPPORTED; + + /*luma filter. */ + if (yc_filter & GFX_LUMA_FILTER) + d.yc_filter |= GFX_LUMA_FILTER; + else + d.yc_filter &= ~GFX_LUMA_FILTER; + + /*chroma filter. */ + if (yc_filter & GFX_CHROMA_FILTER) + d.yc_filter |= GFX_CHROMA_FILTER; + else + d.yc_filter &= ~GFX_CHROMA_FILTER; + + return write_config(REQ_YC_FILTER); +} + +#if GFX_TV_DYNAMIC +int +fs450_get_aps_trigger_bits(unsigned int *p_trigger_bits) +#else +int +gfx_get_aps_trigger_bits(unsigned int *p_trigger_bits) +#endif +{ + if (!p_trigger_bits) + return ERR_INVALID_PARAMETER; + + *p_trigger_bits = d.aps_trigger_bits; + + return 0; +} + +#if GFX_TV_DYNAMIC +int +fs450_set_aps_trigger_bits(unsigned int trigger_bits) +#else +int +gfx_set_aps_trigger_bits(unsigned int trigger_bits) +#endif +{ + d.aps_trigger_bits = trigger_bits; + + return write_config(REQ_MACROVISION); +} + +/*---------------------------------------------------------------------------- + * gfx_set_tv_format + * + * This routine sets the TV encoder registers to the specified format + * and resolution. + * Currently only NTSC 640x480 is supported. + *---------------------------------------------------------------------------- + */ +#if GFX_TV_DYNAMIC +int +fs450_set_tv_format(TVStandardType format, GfxOnTVType resolution) +#else +int +gfx_set_tv_format(TVStandardType format, GfxOnTVType resolution) +#endif +{ + /* ### ADD ### IMPLEMENTATION */ + return (0); +} + +/*---------------------------------------------------------------------------- + * gfx_set_tv_output + * + * This routine sets the TV encoder registers to the specified output type. + * Supported output types are : S-VIDEO and Composite. + *---------------------------------------------------------------------------- + */ +#if GFX_TV_DYNAMIC +int +fs450_set_tv_output(int output) +#else +int +gfx_set_tv_output(int output) +#endif +{ + /* ### ADD ### IMPLEMENTATION */ + return (0); +} + +/*---------------------------------------------------------------------------- + * gfx_set_tv_cc_enable + * + * This routine enables or disables the use of the hardware CC registers + * in the TV encoder. + *---------------------------------------------------------------------------- + */ +#if GFX_TV_DYNAMIC +int +fs450_set_tv_cc_enable(int enable) +#else +int +gfx_set_tv_cc_enable(int enable) +#endif +{ + /* ### ADD ### IMPLEMENTATION */ + return (0); +} + +/*---------------------------------------------------------------------------- + * gfx_set_tv_cc_data + * + * This routine writes the two specified characters to the CC data register + * of the TV encoder. + *---------------------------------------------------------------------------- + */ +#if GFX_TV_DYNAMIC +int +fs450_set_tv_cc_data(unsigned char data1, unsigned char data2) +#else +int +gfx_set_tv_cc_data(unsigned char data1, unsigned char data2) +#endif +{ + /* ### ADD ### IMPLEMENTATION */ + return (0); +} + +#ifdef FS450_DIRECTREG + +/*==========================================================================*/ +/* Direct Read and Write registers */ +/*==========================================================================*/ + +int +FS450_ReadRegister(S_REG_INFO * p_reg) +{ + unsigned long tmp; + + if (PLAL_ReadRegister(p_reg)) + return 0; + + if (SOURCE_HOUSTON == p_reg->source) { + switch (p_reg->size) { + case 1: + case 2: + { + houston_ReadReg((int)p_reg->offset, &tmp, (int)p_reg->size); + p_reg->value = tmp; + } + return 0; + + case 4: + { + houston_ReadReg((unsigned int)p_reg->offset, &tmp, 2); + p_reg->value = (tmp << 16); + houston_ReadReg((unsigned int)(p_reg->offset + 2), &tmp, 2); + p_reg->value |= tmp; + } + return 0; + } + } + + return ERR_INVALID_PARAMETER; +} + +int +FS450_WriteRegister(S_REG_INFO * p_reg) +{ + if (PLAL_WriteRegister(p_reg)) + return 0; + + if (SOURCE_HOUSTON == p_reg->source) { + houston_WriteReg((unsigned int)p_reg->offset, p_reg->value, + p_reg->size); + + return 0; + } + + return ERR_INVALID_PARAMETER; +} + +#endif + +/* Houston initialization function. */ +static int g_houston_rev = -1; + +static int +houston_init(void) +{ + /*//int errc; */ + unsigned long write, read; + + TRACE(("houston_init()\n")) + + /*Before we begin, we must enable power to the TFT */ + read = READ_VID32(CS5530_DISPLAY_CONFIG); + read |= CS5530_DCFG_FP_PWR_EN | CS5530_DCFG_FP_DATA_EN; + WRITE_VID32(CS5530_DISPLAY_CONFIG, read); + + /*simple w/r test. */ + write = 0x0055; + read = 0; + + houston_WriteReg(HOUSTON_IHO, write, 2); + houston_ReadReg(HOUSTON_IHO, &read, 2); + if (read != write) { + houston_WriteReg(HOUSTON_IHO, write, 2); + houston_ReadReg(HOUSTON_IHO, &read, 2); + if (read != write) { + /*chip is not there, do something appropriate? */ + TRACE(("wrote HOUSTON_IHO=0x0055, read 0x%04x\n", read)) + return ERR_DEVICE_NOT_FOUND; + } + } + + /*read chip revision. */ + houston_ReadReg(HOUSTON_REV, &read, 2); + g_houston_rev = (int)read; + + /*ok. */ + return 0; +} + +static int +houston_Rev(void) +{ + return g_houston_rev; +} + +static S_TIMING_SPECS g_specs; + +static const S_TIMING_SPECS * +p_specs(void) +{ + return &g_specs; +} + +/*==========================================================================*/ +/* FS450 configuration functions. */ +/*==========================================================================*/ +static int +config_init(void) +{ + int err; + + TRACE(("config_init()\n")) + + err = houston_init(); + if (err) + return err; + + return 0; +} + +/*==========================================================================*/ +/* convert word to encoder 10 bit value. */ +/*==========================================================================*/ + +static unsigned short +w10bit2z(unsigned short w) +{ + return (w >> 2) | ((w & 0x03) << 8); +} + +static unsigned short +z2w10bit(unsigned short z) +{ + return (0x03 & (z >> 8)) | ((0xFF & z) << 2); +} + +/*==========================================================================*/ +/* TV Standards */ +/*==========================================================================*/ + +static const struct +{ + unsigned long standard; + int tvsetup_index; +} g_tv_standards[] = { + { + GFX_TV_STANDARD_NTSC_M, 0}, { + GFX_TV_STANDARD_NTSC_M_J, 2}, { + GFX_TV_STANDARD_PAL_B, 1}, { + GFX_TV_STANDARD_PAL_D, 1}, { + GFX_TV_STANDARD_PAL_H, 1}, { + GFX_TV_STANDARD_PAL_I, 1}, { + GFX_TV_STANDARD_PAL_M, 3}, { + GFX_TV_STANDARD_PAL_N, 4}, { +GFX_TV_STANDARD_PAL_G, 1},}; + +static int +map_tvstd_to_index(unsigned long tv_std) +{ + unsigned int i; + + for (i = 0; i < sizeof(g_tv_standards) / sizeof(*g_tv_standards); i++) { + if (tv_std == g_tv_standards[i].standard) + return g_tv_standards[i].tvsetup_index; + } + + return -1; +} + +static unsigned long +supported_standards(void) +{ + unsigned long standards = 0; + unsigned int i; + + for (i = 0; i < sizeof(g_tv_standards) / sizeof(*g_tv_standards); i++) { + if (g_tv_standards[i].tvsetup_index >= 0) + standards |= g_tv_standards[i].standard; + } + + return standards; +} + +/*==========================================================================*/ + +static void +config_power(int on) +{ + unsigned long reg; + + if (houston_Rev() < HOUSTON_REV_B) { + /* no power down supported, but still turn of clock in off mode */ + if (on) { + houston_ReadReg(HOUSTON_CR, ®, 2); + reg &= ~(CR_CLKOFF | CR_RESET); + houston_WriteReg(HOUSTON_CR, reg, 2); + reg |= CR_RESET; + houston_WriteReg(HOUSTON_CR, reg, 2); + reg &= ~CR_RESET; + houston_WriteReg(HOUSTON_CR, reg, 2); + } else { + houston_ReadReg(HOUSTON_CR, ®, 2); + reg |= CR_CLKOFF; + houston_WriteReg(HOUSTON_CR, reg, 2); + } + + return; + } + + if (on) { + /* !CLKOFF, !COMPOFF, !YCOFF */ + /* and reset Houston */ + houston_ReadReg(HOUSTON_CR, ®, 2); + reg &= ~(CR_CLKOFF | CR_RESET | CR_COMPOFF | CR_YCOFF); + houston_WriteReg(HOUSTON_CR, reg, 2); + reg |= CR_RESET; + houston_WriteReg(HOUSTON_CR, reg, 2); + reg &= ~CR_RESET; + houston_WriteReg(HOUSTON_CR, reg, 2); + + /* !GTLIO_PD */ + houston_ReadReg(HOUSTON_MISC, ®, 2); + reg &= ~MISC_GTLIO_PD; + houston_WriteReg(HOUSTON_MISC, reg, 2); + } else { + /* CLKOFF, COMPOFF, YCOFF */ + houston_ReadReg(HOUSTON_CR, ®, 2); + reg |= (CR_CLKOFF | CR_COMPOFF | CR_YCOFF); + houston_WriteReg(HOUSTON_CR, reg, 2); + + /* GTLIO_PD */ + houston_ReadReg(HOUSTON_MISC, ®, 2); + reg |= MISC_GTLIO_PD; + houston_WriteReg(HOUSTON_MISC, reg, 2); + } +} + +/*==========================================================================*/ +/* VGA mode */ +/*==========================================================================*/ + +static void +config_vga_mode(unsigned long vga_mode) +{ + /*h_total must be evenly divisible by 32? */ + + static struct + { + unsigned long mode; + int width; + int lines; + int h_total; + } vgaparams[] = { + { + GFX_VGA_MODE_640X480, 640, 480, 1056}, { + GFX_VGA_MODE_720X487, 720, 487, 1056}, { + GFX_VGA_MODE_720X576, 720, 576, 1056}, { + GFX_VGA_MODE_800X600, 800, 600, 1056}, { + GFX_VGA_MODE_1024X768, 1024, 768, 1344},}; + + unsigned long cr, misc, byp; + unsigned int i; + + g_specs.vga_width = 0; + g_specs.vga_lines = 0; + g_specs.h_total = 0; + + for (i = 0; i < sizeof(vgaparams) / sizeof(*vgaparams); i++) { + if (vga_mode == vgaparams[i].mode) { + g_specs.vga_width = vgaparams[i].width; + g_specs.vga_lines = vgaparams[i].lines; + g_specs.h_total = vgaparams[i].h_total; + break; + } + } + if (!g_specs.h_total) + return; + + /*clock mux decimator and vga dual. */ + houston_ReadReg(HOUSTON_CR, &cr, 2); + houston_ReadReg(HOUSTON_MISC, &misc, 2); + houston_ReadReg(HOUSTON_BYP, &byp, 2); + + if (vga_mode == GFX_VGA_MODE_1024X768) { + /*XGA*/ cr |= CR_UIM_DEC; + misc |= MISC_VGACKDIV; + byp |= (BYP_HDS_BYPASS | BYP_CAC_BYPASS); + } else { + /*VGA,SVGA */ + cr &= ~CR_UIM_DEC; + misc &= ~MISC_VGACKDIV; + byp &= ~(BYP_HDS_BYPASS | BYP_CAC_BYPASS); + } + + houston_WriteReg(HOUSTON_CR, cr, 2); + houston_WriteReg(HOUSTON_MISC, misc, 2); + houston_WriteReg(HOUSTON_BYP, byp, 2); +} + +/*==========================================================================*/ +/* Write settings for TV standard to device */ +/*==========================================================================*/ + +static void +config_tv_std(unsigned long tv_std, unsigned int trigger_bits) +{ + int k; + unsigned short reg34; + unsigned long cr, w; + unsigned long l; + + /*verify supported standard. */ + k = map_tvstd_to_index(tv_std); + if (k < 0) + return; + + /*store tv width and lines */ + g_specs.tv_width = tvsetup.tv_width[k]; + g_specs.tv_lines = tvsetup.tv_lines[k]; + + /*houston CR register. */ + houston_ReadReg(HOUSTON_CR, &cr, 2); + cr &= ~CR_656_PAL_NTSC; + cr |= tvsetup.houston_cr[k]; + houston_WriteReg(HOUSTON_CR, cr, 2); + + /*setup the encoder. */ + l = tvsetup.chroma_freq[k]; + houston_WriteReg(ENC_CHROMA_FREQ, (int)(l & 0x00ff), 1); + houston_WriteReg(ENC_CHROMA_FREQ + 1, (int)((l >> 8) & 0x00ff), 1); + houston_WriteReg(ENC_CHROMA_FREQ + 2, (int)((l >> 16) & 0x00ff), 1); + houston_WriteReg(ENC_CHROMA_FREQ + 3, (int)((l >> 24) & 0x00ff), 1); + + houston_WriteReg(ENC_CHROMA_PHASE, tvsetup.chroma_phase[k], 1); + houston_WriteReg(ENC_REG05, 0x00, 1); /*reg 0x05 */ + houston_WriteReg(ENC_REG06, 0x89, 1); /*reg 0x06 */ + houston_WriteReg(ENC_REG07, 0x00, 1); /*reg 0x07 */ + houston_WriteReg(ENC_HSYNC_WIDTH, tvsetup.hsync_width[k], 1); + houston_WriteReg(ENC_BURST_WIDTH, tvsetup.burst_width[k], 1); + houston_WriteReg(ENC_BACK_PORCH, tvsetup.back_porch[k], 1); + houston_WriteReg(ENC_CB_BURST_LEVEL, tvsetup.cb_burst_level[k], 1); + houston_WriteReg(ENC_CR_BURST_LEVEL, tvsetup.cr_burst_level[k], 1); + houston_WriteReg(ENC_SLAVE_MODE, 0x01, 1); /*slave mode */ + if (trigger_bits == 0) + w = w10bit2z(tvsetup.blank_level[k]); /*blank level */ + else + w = w10bit2z((unsigned short)(tvsetup.blank_level[k] - + tvsetup.hamp_offset[k])); + houston_WriteReg(ENC_BLANK_LEVEL, w & 0x00ff, 1); + houston_WriteReg(ENC_BLANK_LEVEL + 1, w >> 8, 1); + w = w10bit2z(tvsetup.tv_lines[k]); /*num_lines */ + houston_WriteReg(ENC_NUM_LINES, w & 0x00ff, 1); + houston_WriteReg(ENC_NUM_LINES + 1, w >> 8, 1); + + houston_WriteReg(ENC_TINT, 0x00, 1); /*tint */ + houston_WriteReg(ENC_BREEZE_WAY, tvsetup.breeze_way[k], 1); + houston_WriteReg(ENC_FRONT_PORCH, tvsetup.front_porch[k], 1); + houston_WriteReg(ENC_ACTIVELINE, tvsetup.activeline[k], 1); + houston_WriteReg(ENC_FIRST_LINE, 0x15, 1); /*firstvideoline */ + reg34 = + 0x80 | + (tvsetup.pal_mode[k] << 6) | + (tvsetup.sys625_50[k] << 3) | + (tvsetup.cphase_rst[k] << 1) | (tvsetup.vsync5[k]); + houston_WriteReg(ENC_REG34, reg34, 1); /*reg 0x34 */ + houston_WriteReg(ENC_SYNC_LEVEL, tvsetup.sync_level[k], 1); + if (trigger_bits == 0) + w = w10bit2z(tvsetup.vbi_blank_level[k]); /*blank level */ + else + w = w10bit2z((unsigned short)(tvsetup.vbi_blank_level[k] - 1)); + houston_WriteReg(ENC_VBI_BLANK_LEVEL, w & 0x00ff, 1); + houston_WriteReg(ENC_VBI_BLANK_LEVEL + 1, w >> 8, 1); +} + +static void +conget_tv_std(unsigned long *p_tv_standard) +{ + unsigned long cr; + + if (!p_tv_standard) + return; + + /*just pick between NTSC and PAL */ + houston_ReadReg(HOUSTON_CR, &cr, 2); + if (CR_656_PAL_NTSC & cr) + *p_tv_standard = GFX_TV_STANDARD_PAL_B; + else + *p_tv_standard = GFX_TV_STANDARD_NTSC_M; +} + +/*==========================================================================*/ +/* TVout mode */ +/*==========================================================================*/ + +static void +config_tvout_mode(unsigned long tvout_mode) +{ + unsigned long cr; + + houston_ReadReg(HOUSTON_CR, &cr, 2); + + /*all dacs off */ + cr |= (CR_COMPOFF | CR_YCOFF); + /*not rgb */ + cr &= ~CR_OFMT; + + /*turn on requested output */ + if (GFX_TVOUT_MODE_CVBS & tvout_mode) + cr &= ~CR_COMPOFF; + if (GFX_TVOUT_MODE_YC & tvout_mode) + cr &= ~CR_YCOFF; + if (GFX_TVOUT_MODE_RGB & tvout_mode) { + cr &= ~(CR_COMPOFF | CR_YCOFF); + cr |= CR_OFMT; + } + + houston_WriteReg(HOUSTON_CR, cr, 2); +} + +static void +conget_tvout_mode(unsigned long *p_tvout_mode) +{ + unsigned long cr; + + if (!p_tvout_mode) + return; + + houston_ReadReg(HOUSTON_CR, &cr, 2); + + if (CR_OFMT & cr) + *p_tvout_mode = GFX_TVOUT_MODE_RGB; + else { + *p_tvout_mode = 0; + if (!(CR_YCOFF & cr)) + *p_tvout_mode |= GFX_TVOUT_MODE_YC; + if (!(CR_COMPOFF & cr)) + *p_tvout_mode |= GFX_TVOUT_MODE_CVBS; + } +} + +/*==========================================================================*/ +/* Size & Position */ +/*==========================================================================*/ + +#define IS_NTSC(tv_std) \ + (tv_std & ( \ + GFX_TV_STANDARD_NTSC_M | \ + GFX_TV_STANDARD_NTSC_M_J | \ + GFX_TV_STANDARD_PAL_M)) +#define IS_PAL(tv_std) \ + (tv_std & ( \ + GFX_TV_STANDARD_PAL_B | \ + GFX_TV_STANDARD_PAL_D | \ + GFX_TV_STANDARD_PAL_H | \ + GFX_TV_STANDARD_PAL_I | \ + GFX_TV_STANDARD_PAL_N | \ + GFX_TV_STANDARD_PAL_G)) + +/*return fifo delay setting for mode, std, and total lines.*/ + +static void +get_ffolat_ivo(unsigned long vga_mode, + unsigned long tv_std, long i, unsigned short *ffolat, unsigned short *ivo) +{ + switch (vga_mode) { + case GFX_VGA_MODE_640X480: + if (IS_NTSC(tv_std)) { + if (i > SIZE6X4NTSC - 1) + i = SIZE6X4NTSC - 1; + *ffolat = ffo6x4ntsc[i].ffolat; + *ivo = 0x20; + } else { + if (i > SIZE6X4PAL - 1) + i = SIZE6X4PAL - 1; + *ffolat = ffo6x4pal[i].ffolat; + *ivo = 0x28; + } + break; + + case GFX_VGA_MODE_800X600: + if (IS_NTSC(tv_std)) { + if (i > SIZE8X6NTSC - 1) + i = SIZE8X6NTSC - 1; + *ffolat = ffo8x6ntsc[i].ffolat; + *ivo = 0x3a; + } else { + if (i > SIZE8X6PAL - 1) + i = SIZE8X6PAL - 1; + *ffolat = ffo8x6pal[i].ffolat; + *ivo = 0x39; + } + break; + + case GFX_VGA_MODE_720X487: + *ffolat = 0x40; /*FFO7x4; */ + *ivo = 0x1a; + break; + + case GFX_VGA_MODE_720X576: + *ffolat = 0x40; /*FFO7x5; */ + *ivo = 0x1a; + break; + + case GFX_VGA_MODE_1024X768: + default: + if (IS_NTSC(tv_std)) { + if (i > SIZE10X7NTSC - 1) + i = SIZE10X7NTSC - 1; + *ffolat = ffo10x7ntsc[i].ffolat; + *ivo = ffo10x7ntsc[i].ivo; + } else { + if (i > SIZE10X7PAL - 1) + i = SIZE10X7PAL - 1; + *ffolat = ffo10x7pal[i].ffolat; + *ivo = ffo10x7pal[i].ivo; + } + break; + } +} + +/*get vertical line min and max for mode and std.*/ + +static void +get_vtotal_min_max(unsigned long vga_mode, + unsigned long tv_std, int *v_total_min, int *v_total_max, int *v_step) +{ + int k = map_tvstd_to_index(tv_std); + + switch (vga_mode) { + case GFX_VGA_MODE_640X480: + if (IS_NTSC(tv_std)) { + *v_total_min = ffo6x4ntsc[0].v_total; + *v_total_max = ffo6x4ntsc[SIZE6X4NTSC - 1].v_total; + } else { + *v_total_min = ffo6x4pal[0].v_total; + *v_total_max = ffo6x4pal[SIZE6X4PAL - 1].v_total; + } + *v_step = 4; + break; + + case GFX_VGA_MODE_800X600: + if (IS_NTSC(tv_std)) { + *v_total_min = ffo8x6ntsc[0].v_total; + *v_total_max = ffo8x6ntsc[SIZE8X6NTSC - 1].v_total; + } else { + *v_total_min = ffo8x6pal[0].v_total; + *v_total_max = ffo8x6pal[SIZE8X6PAL - 1].v_total; + } + *v_step = 5; + break; + + case GFX_VGA_MODE_720X487: + case GFX_VGA_MODE_720X576: + *v_total_min = tvsetup.tv_lines[k]; + *v_total_max = tvsetup.tv_lines[k]; + *v_step = 4; + break; + + case GFX_VGA_MODE_1024X768: + if (IS_NTSC(tv_std)) { + *v_total_min = ffo10x7ntsc[0].v_total; + *v_total_max = ffo10x7ntsc[SIZE10X7NTSC - 1].v_total; + } else { + *v_total_min = ffo10x7pal[0].v_total; + *v_total_max = ffo10x7pal[SIZE10X7PAL - 1].v_total; + } + *v_step = 6; + break; + } +} + +static void +config_overscan_xy(unsigned long tv_std, + unsigned long vga_mode, + int overscan_x, int overscan_y, int pos_x, int pos_y) +{ + unsigned int vga_index; + unsigned long reg; + double vsc; + int k; + unsigned short ffolat, ivo; + int base_v_total, range, v_offset; + int v_total_min, v_total_max, v_step; + float r, f; + int vga_pixels, pre_pixels; + float hscale, hscale_min, hscale_max; + int hsc; + int iho, iho_max, ihw; + + /*tv_std is valid. */ + k = map_tvstd_to_index(tv_std); + + /*store tv width and lines */ + g_specs.tv_width = tvsetup.tv_width[k]; + g_specs.tv_lines = tvsetup.tv_lines[k]; + + /*determine vga mode index */ + for (vga_index = 0; vga_index < SCANTABLE_ENTRIES; vga_index++) { + if (scantable[vga_index].mode == vga_mode) + break; + } + if (vga_index >= SCANTABLE_ENTRIES) + return; + + /*vertical scaling (v_total setup). */ + /*calculate vertical range. */ + get_vtotal_min_max(vga_mode, tv_std, &v_total_min, &v_total_max, &v_step); + TRACE(("v_total min=%d, max=%d\n", v_total_min, v_total_max)) + base_v_total = scantable[vga_index].v_total[k]; + range = fsmax(base_v_total - v_total_min, v_total_max - base_v_total); + TRACE(("v_total range = %d\n", range)) + + /*map +/-1000 overscan y into +/-range. */ + v_offset = (int)((((float)overscan_y * range) / 1000.f) + .5f); + TRACE(("v_offset = %d\n", v_offset)) + + /*range limit v_total. */ + g_specs.v_total = + range_limit(base_v_total + v_offset, v_total_min, v_total_max); + + /*round to calibrated value. */ + v_offset = (g_specs.v_total - v_total_min + (v_step / 2)) / v_step; + g_specs.v_total = v_total_min + v_offset * v_step; + TRACE(("desired v_total=%d\n", g_specs.v_total)) + + /*vertical positioning (vsync setup). */ + get_ffolat_ivo(vga_mode, tv_std, v_offset, &ffolat, &ivo); + houston_WriteReg(HOUSTON_IVO, ivo, 2); + + /*scale base sync offset by scaling ratio. */ + r = (float)g_specs.v_total / (float)base_v_total; + v_offset = (int)(r * (float)scantable[vga_index].v_sync[k]); + + /*scale ivo. */ + f = (float)ivo; + v_offset -= (int)(f - f / r); + + /*compensate for center screen. */ + f = (float)tvsetup.tv_active_lines[k] / 2.f; + v_offset += (int)(f * r - f); + + /*calculate vsync. */ + g_specs.v_sync = g_specs.v_total - v_offset + pos_y; + TRACE(("desired v_total=%d, desired v_sync=%d\n", g_specs.v_total, + g_specs.v_sync)) + if (g_specs.v_sync < g_specs.vga_lines + 10) { + TRACE(("vsync too low\n")) + /*d.v_total += d.vga_lines+10-d.v_sync; */ + g_specs.v_sync = g_specs.vga_lines + 10; + } else if (g_specs.v_sync > g_specs.v_total - 10) { + TRACE(("vsync too high\n")) + g_specs.v_sync = g_specs.v_total - 10; + } + TRACE(("v_total=%d v_sync=%d\n", g_specs.v_total, g_specs.v_sync)) + + /* FFOLAT. */ + houston_WriteReg(HOUSTON_FFO_LAT, ffolat, 2); + + /* VSC. */ + vsc = + (65536.0f * (1.0f - + (double)g_specs.tv_lines / (double)g_specs.v_total)) + 0.5f; + reg = ((unsigned long)-vsc) & 0xffff; + TRACE(("vsc=%04x, tv_lines=%d, v_total=%d\n", reg, g_specs.tv_lines, + g_specs.v_total)) + houston_WriteReg(HOUSTON_VSC, (int)reg, 2); + + /* horizontal scaling. */ + + /* vga pixels is vga width, except in 1024x768, where it's half that. */ + vga_pixels = g_specs.vga_width; + if (1024 == vga_pixels) + vga_pixels /= 2; + + /* maximum scaling coefficient is tv_width / vga_pixels */ + /* minimum is about 1/2, but that is quite small. arbitrarily set + * minimum at 75% maximum. */ + hscale_max = (720.0f / vga_pixels); + hscale_min = fsmax((0.75f * hscale_max), (1.0f - (63.0f / 128.0f))); + TRACE(("hscale_min = %u.%u, hscale_max = %u.%u\n", + (int)hscale_min, + (int)((hscale_min - (int)hscale_min) * 1000), + (int)hscale_max, (int)((hscale_max - (int)hscale_max) * 1000))) + + /* map overscan_x into min to max. */ + hscale = + hscale_min + ((overscan_x + 1000.0f) / 2000.0f) * (hscale_max - + hscale_min); + TRACE(("hscale = %u.%u\n", (int)hscale, + (int)((hscale - (int)hscale) * 1000))) + + /* determine hsc where hscale = (1 + hsc/128) */ + if (hscale >= 1.0f) + hsc = (int)(128.f * (hscale - 1.0f) + .5f); + else + hsc = (int)(128.f * (hscale - 1.0f) - .5f); + + TRACE(("hsc = %d\n", hsc)) + if (hsc >= 0) + houston_WriteReg(HOUSTON_HSC, hsc << 8, 2); + else + houston_WriteReg(HOUSTON_HSC, hsc & 0xFF, 2); + + /* recalculate hscale for future formulas */ + hscale = 1.0f + (hsc / 128.0f); + TRACE(("recalculated hscale = %u.%u\n", (int)hscale, + (int)((hscale - (int)hscale) * 1000))) + + /* horizontal offset. */ + /* place hsync 40 before halfway from vga_width to htotal */ + /* but not less than vga_width + 10 */ + g_specs.h_sync = + fsmax((g_specs.h_total + g_specs.vga_width) / 2 - 40, + g_specs.vga_width + 10); + /* also, make it even */ + g_specs.h_sync &= ~1; + TRACE(("hsync = %u\n", g_specs.h_sync)) + + /* iho range is 0 to iho_max. */ + /* iho_max is 2 * iho_center. */ + /* iho_center is pre_pixels - (tvwidth / hscale - vga pixels) / 2. */ + /* pre_pixels = (htotal - hsync) * (vga_pixels / vga_width) */ + /* note that the range is inverted also, because it specifies the number + * of pixels */ + /* to skip, or subtract. iho=0 maps to farthest right. */ + /* map -pos_x = +/-1000 into (0 to iho_max) */ + pre_pixels = + (int)((long)(g_specs.h_total - + g_specs.h_sync) * vga_pixels / g_specs.vga_width); + iho_max = (2 * pre_pixels) - ((int)(720.0f / hscale + 0.5f) - vga_pixels); + TRACE(("iho_max = %u\n", iho_max)) + iho = + (int)range_limit(((long)(1000 - pos_x) * iho_max / 2000) + + scantable[vga_index].iho[k], 0, iho_max); + TRACE(("iho = %u\n", iho)) + houston_WriteReg(HOUSTON_IHO, iho, 2); + + /* input horizontal width. */ + + /* input horizontal width is vga pixels + pre_pixels - iho */ + /* additionally, ihw cannot exceed tv width / hscale */ + /* and if hsc is negative, (ihw)(-hsc/128) cannot exceed ~250. */ + /* and ihw should be even. */ + ihw = fsmin(vga_pixels + pre_pixels - iho, (int)(720.0f / hscale)); + if (hsc < 0) + ihw = (int)fsmin(ihw, 253L * 128 / (-hsc)); + ihw &= ~1; + TRACE(("ihw = %u\n", ihw)) + houston_WriteReg(HOUSTON_IHA, ihw, 2); + + f = (((float)g_specs.h_total * g_specs.v_total) * 27.f) / + ((float)g_specs.tv_width * g_specs.tv_lines); + + TRACE(("freq=%u.%uMHz\n", (int)f, (int)((f - (int)f) * 1000))) +} + +/*==========================================================================*/ +/* configure houston nco. */ +/*==========================================================================*/ + +static void +config_nco(unsigned long tv_std, unsigned long vga_mode) +{ + unsigned long cr, misc; + unsigned long reg; + int k = map_tvstd_to_index(tv_std); + + /*read and store CR. */ + houston_ReadReg(HOUSTON_CR, &cr, 2); + + /*make sure NCO_EN (enable latch) bit is clear */ + cr &= ~CR_NCO_EN; + houston_WriteReg(HOUSTON_CR, cr, 2); + + /*clear NCO_LOADX. */ + houston_ReadReg(HOUSTON_MISC, &misc, 2); + misc &= ~(MISC_NCO_LOAD1 + MISC_NCO_LOAD0); + houston_WriteReg(HOUSTON_MISC, misc, 2); + + if (vga_mode == GFX_VGA_MODE_1024X768) { + /*setup for M and N load (Nco_load=1). */ + misc |= (MISC_NCO_LOAD0); + houston_WriteReg(HOUSTON_MISC, misc, 2); + + /*M and N. */ + houston_WriteReg(HOUSTON_NCONL, 1024 - 2, 2); + houston_WriteReg(HOUSTON_NCODL, 128 - 1, 2); + + /*latch M/N in. */ + cr |= CR_NCO_EN; + houston_WriteReg(HOUSTON_CR, cr, 2); + cr &= ~CR_NCO_EN; + houston_WriteReg(HOUSTON_CR, cr, 2); + + /*setup ncon and ncod load (Nco_load=0). */ + misc &= ~(MISC_NCO_LOAD1 + MISC_NCO_LOAD0); + houston_WriteReg(HOUSTON_MISC, misc, 2); + + /*NCON. */ + reg = ((unsigned long)g_specs.v_total * g_specs.h_total) / 2; + houston_WriteReg(HOUSTON_NCONH, reg >> 16, 2); + houston_WriteReg(HOUSTON_NCONL, reg & 0xffff, 2); + + /*NCOD. */ + houston_WriteReg(HOUSTON_NCODL, tvsetup.houston_ncodl[k], 2); + houston_WriteReg(HOUSTON_NCODH, tvsetup.houston_ncodh[k], 2); + } else { + /*setup for M and N load (Nco_load=2). */ + misc |= (MISC_NCO_LOAD1); + houston_WriteReg(HOUSTON_MISC, misc, 2); + + /*NCON. */ + reg = (unsigned long)g_specs.v_total * g_specs.h_total; + houston_WriteReg(HOUSTON_NCONH, reg >> 16, 2); + houston_WriteReg(HOUSTON_NCONL, reg & 0xffff, 2); + + /*NCOD. */ + houston_WriteReg(HOUSTON_NCODL, tvsetup.houston_ncodl[k], 2); + houston_WriteReg(HOUSTON_NCODH, tvsetup.houston_ncodh[k], 2); + + TRACE(("NCON = %lu (0x%08lx), NCOD = %lu (0x%08lx)\n", + reg, + reg, + ((unsigned long)tvsetup.houston_ncodh[k] << 16) + + tvsetup.houston_ncodl[k], + ((unsigned long)tvsetup.houston_ncodh[k] << 16) + + tvsetup.houston_ncodl[k])) + } + + /*latch M/N and NCON/NCOD in. */ + cr |= CR_NCO_EN; + houston_WriteReg(HOUSTON_CR, cr, 2); + cr &= ~CR_NCO_EN; + houston_WriteReg(HOUSTON_CR, cr, 2); +} + +/*==========================================================================*/ +/* Write sharpness settings to device */ +/*==========================================================================*/ + +static void +config_sharpness(int sharpness) +{ + unsigned int shp; + + /*map 0-1000 to 0-20. */ + shp = (unsigned int)(0.5f + ((float)sharpness * 20.0f / 1000.0f)); + shp = range_limit(shp, 0, 20); + + houston_WriteReg(HOUSTON_SHP, shp, 2); +} + +static void +conget_sharpness(int *p_sharpness) +{ + unsigned long shp; + + if (!p_sharpness) + return; + + houston_ReadReg(HOUSTON_SHP, &shp, 2); + + /*map 0-20 to 0-1000. */ + *p_sharpness = (int)(0.5f + ((float)shp * 1000.0f / 20.0f)); +} + +/*==========================================================================*/ +/* Write flicker settings to device */ +/*==========================================================================*/ + +static void +config_flicker(int flicker) +{ + unsigned int flk; + + /*map 0-1000 to 0-16. */ + flk = (unsigned int)(0.5f + ((float)flicker * 16.0f / 1000.0f)); + flk = range_limit(flk, 0, 16); + + houston_WriteReg(HOUSTON_FLK, flk, 2); +} + +static void +conget_flicker(int *p_flicker) +{ + unsigned long flk; + + if (!p_flicker) + return; + + houston_ReadReg(HOUSTON_FLK, &flk, 2); + + /*map 0-16 to 0-1000. */ + *p_flicker = (int)(0.5f + ((float)flk * 1000.0f / 16.0f)); +} + +/*==========================================================================*/ +/* Write color settings to device */ +/*==========================================================================*/ + +static void +config_color(int color) +{ + unsigned long clr; + + /*map 0-100 to 0-255. */ + /*montreal production test needs 169 to be mappable, so */ + /*use .8 rounding factor, 169=(int)(66.*2.55+.8). */ + clr = (unsigned long)(0.8f + ((float)color * 255.0f / 100.0f)); + clr = range_limit(clr, 0, 255); + + houston_WriteReg(ENC_CR_GAIN, clr, 1); + houston_WriteReg(ENC_CB_GAIN, clr, 1); +} + +static void +conget_color(int *p_color) +{ + unsigned long cr_gain; + + if (!p_color) + return; + + /*just get CR GAIN, CB GAIN should match. */ + houston_ReadReg(ENC_CR_GAIN, &cr_gain, 1); + + /*map 0-255 to 0-100. */ + *p_color = (int)(0.5f + ((float)cr_gain * 100.0f / 255.0f)); +} + +/*==========================================================================*/ +/* Write brightness and contrast settings to device */ +/*==========================================================================*/ + +#define NTSC_BLANK_LEVEL 240 + +static const int min_black_level = NTSC_BLANK_LEVEL + 1; +static const int max_white_level = 1023; + +static void +config_brightness_contrast(unsigned long tv_std, unsigned int trigger_bits, + int brightness, int contrast) +{ + int brightness_off; + float contrast_mult; + int black, white; + unsigned short w; + int k = map_tvstd_to_index(tv_std); + + /*0-100 maps to +/-220. */ + brightness_off = + (int)(0.5f + ((float)brightness * 440.0f / 100.0f)) - 220; + + /*0-100 maps to .75-1.25. */ + contrast_mult = ((float)contrast * 0.5f / 100.0f) + 0.75f; + + black = tvsetup.black_level[k]; + if (trigger_bits != 0) + black -= tvsetup.hamp_offset[k]; + + white = tvsetup.white_level[k]; + if (trigger_bits != 0) + white -= tvsetup.hamp_offset[k]; + + black = (int)((float)(black + brightness_off) * contrast_mult); + white = (int)((float)(white + brightness_off) * contrast_mult); + if (black < min_black_level) + black = min_black_level; + if (white > max_white_level) + white = max_white_level; + + w = w10bit2z((unsigned short)black); + houston_WriteReg(ENC_BLACK_LEVEL, w & 0x00ff, 1); + houston_WriteReg(ENC_BLACK_LEVEL + 1, w >> 8, 1); + w = w10bit2z((unsigned short)white); + houston_WriteReg(ENC_WHITE_LEVEL, w & 0x00ff, 1); + houston_WriteReg(ENC_WHITE_LEVEL + 1, w >> 8, 1); +} + +static void +conget_brightness_contrast(unsigned long tv_std, unsigned int trigger_bits, + int *p_brightness, int *p_contrast) +{ + int brightness_off; + float contrast_mult; + unsigned short black, white; + unsigned long zh, zl; + int k; + + if (!p_brightness || !p_contrast) + return; + + k = map_tvstd_to_index(tv_std); + + houston_ReadReg(ENC_BLACK_LEVEL, &zl, 1); + houston_ReadReg(ENC_BLACK_LEVEL + 1, &zh, 1); + black = z2w10bit((unsigned short)(zl + (zh << 8))); + if (trigger_bits != 0) + black += tvsetup.hamp_offset[k]; + houston_ReadReg(ENC_WHITE_LEVEL, &zl, 1); + houston_ReadReg(ENC_WHITE_LEVEL + 1, &zh, 1); + white = z2w10bit((unsigned short)(zl + (zh << 8))); + if (trigger_bits != 0) + white += tvsetup.hamp_offset[k]; + + /*this reverse computation does not account for clipping, but should */ + /*provide somewhat reasonable numbers */ + contrast_mult = + ((float)white - (float)black) / ((float)tvsetup.white_level[k] - + (float)tvsetup.black_level[k]); + brightness_off = + (int)(((float)black / contrast_mult) - tvsetup.black_level[k]); + + /*+/-220 maps to 0-100. */ + *p_brightness = + range_limit((int)(0.5f + ((float)(brightness_off + + 220) * 100.0f / 440.0f)), 0, 100); + + /*.75-1.25 maps to 0-100. */ + *p_contrast = + range_limit((int)(0.5f + ((float)(contrast_mult - + 0.75f) * 100.0f / 0.5f)), 0, 100); +} + +/*==========================================================================*/ +/* configure luma/chroma filters. */ +/*==========================================================================*/ + +static void +config_yc_filter(unsigned long tv_std, int luma_filter, int chroma_filter) +{ + unsigned long reg, reg07, reg34; + + if (houston_Rev() < HOUSTON_REV_B) + return; + + /*luma filter. */ + if (luma_filter) + reg = tvsetup.notch_filter[map_tvstd_to_index(tv_std)]; + else + reg = 0; + houston_WriteReg(ENC_NOTCH_FILTER, reg, 1); + + /*chroma filter. */ + houston_ReadReg(ENC_REG07, ®07, 1); + houston_ReadReg(ENC_REG34, ®34, 1); + if (chroma_filter) { + reg07 &= ~0x08; + reg34 &= ~0x20; + } else { + reg07 |= 0x08; + reg34 |= 0x20; + } + houston_WriteReg(ENC_REG07, reg07, 1); + houston_WriteReg(ENC_REG34, reg34, 1); +} + +static void +conget_yc_filter(int *p_luma_filter, int *p_chroma_filter) +{ + unsigned long reg, reg07, reg34; + + if (!p_luma_filter || !p_chroma_filter) + return; + + if (houston_Rev() < HOUSTON_REV_B) { + *p_luma_filter = 0; + *p_chroma_filter = 0; + return; + } + + /*luma filter. */ + houston_ReadReg(ENC_NOTCH_FILTER, ®, 1); + *p_luma_filter = (reg ? 1 : 0); + + /*chroma filter. */ + houston_ReadReg(ENC_REG07, ®07, 1); + houston_ReadReg(ENC_REG34, ®34, 1); + *p_chroma_filter = !((0x08 & reg07) || (0x20 & reg34)); +} + +/*==========================================================================*/ +/* Macrovision */ +/*==========================================================================*/ + +static void +config_macrovision(unsigned long tv_std, unsigned int trigger_bits) +{ +/*Constants to index into mvsetup columns.*/ +#define nNTSC_APS00 0 /*ntsc mv off. */ +#define nNTSC_APS01 1 /*ntsc AGC only. */ +#define nNTSC_APS10 2 /*ntsc AGC + 2-line CS. */ +#define nNTSC_APS11 3 /*ntsc AGC + 4-line CS. */ +#define nPAL_APS00 4 /*pal mv off. */ +#define nPAL_APSXX 5 /*pal mv on. */ +#define nMVModes 6 + + /*Macrovision setup table. */ + static const struct mvparms + { + unsigned short n0[nMVModes]; + unsigned short n1[nMVModes]; + unsigned short n2[nMVModes]; + unsigned short n3[nMVModes]; + unsigned short n4[nMVModes]; + unsigned short n5[nMVModes]; + unsigned short n6[nMVModes]; + unsigned short n7[nMVModes]; + unsigned short n8[nMVModes]; + unsigned short n9[nMVModes]; + unsigned short n10[nMVModes]; + unsigned short n11[nMVModes]; + unsigned short n12[nMVModes]; + unsigned short n13[nMVModes]; + unsigned short n14[nMVModes]; + unsigned short n15[nMVModes]; + unsigned short n16[nMVModes]; + unsigned short n17[nMVModes]; + unsigned short n18[nMVModes]; + unsigned short n19[nMVModes]; + unsigned short n20[nMVModes]; + unsigned short n21[nMVModes]; + unsigned short n22[nMVModes]; + unsigned short agc_pulse_level[nMVModes]; + unsigned short bp_pulse_level[nMVModes]; + } + + mvsetup = { + /* ntsc ntsc ntsc ntsc pal pal */ + /* MV AGC AGC + AGC + MV MV */ + /* off. only 2-line 4-line off. on. */ + /* CS. CS. */ + { + 0x00, 0x36, 0x3e, 0x3e, 0x00, 0x3e}, /*n0 */ + { + 0x1d, 0x1d, 0x1d, 0x17, 0x1a, 0x1a}, /*n1 */ + { + 0x11, 0x11, 0x11, 0x15, 0x22, 0x22}, /*n2 */ + { + 0x25, 0x25, 0x25, 0x21, 0x2a, 0x2a}, /*n3 */ + { + 0x11, 0x11, 0x11, 0x15, 0x22, 0x22}, /*n4 */ + { + 0x01, 0x01, 0x01, 0x05, 0x05, 0x05}, /*n5 */ + { + 0x07, 0x07, 0x07, 0x05, 0x02, 0x02}, /*n6 */ + { + 0x00, 0x00, 0x00, 0x02, 0x00, 0x00}, /*n7 */ + { + 0x1b, 0x1b, 0x1b, 0x1b, 0x1c, 0x1c}, /*n8 */ + { + 0x1b, 0x1b, 0x1b, 0x1b, 0x3d, 0x3d}, /*n9 */ + { + 0x24, 0x24, 0x24, 0x24, 0x14, 0x14}, /*n10 */ + { + 0x780f, 0x780f, 0x780f, 0x780f, 0x7e07, 0x7e07}, /*n11 */ + { + 0x0000, 0x0000, 0x0000, 0x0000, 0x5402, 0x5402}, /*n12 */ + { + 0x0f, 0x0f, 0x0f, 0x0f, 0xfe, 0xfe}, /*n13 */ + { + 0x0f, 0x0f, 0x0f, 0x0f, 0x7e, 0x7e}, /*n14 */ + { + 0x60, 0x60, 0x60, 0x60, 0x60, 0x60}, /*n15 */ + { + 0x01, 0x01, 0x01, 0x01, 0x00, 0x00}, /*n16 */ + { + 0x0a, 0x0a, 0x0a, 0x0a, 0x08, 0x08}, /*n17 */ + { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*n18 */ + { + 0x05, 0x05, 0x05, 0x05, 0x04, 0x04}, /*n19 */ + { + 0x04, 0x04, 0x04, 0x04, 0x07, 0x07}, /*n20 */ + { + 0x03ff, 0x03ff, 0x03ff, 0x03ff, 0x0155, 0x0155}, /*n21 */ + { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*n22 */ + { + 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3}, /*agc_pulse_level */ + { + 0xc8, 0xc8, 0xc8, 0xc8, 0xc8, 0xc8}, /*bp_pulse_level */ + }; + + int nMode; + unsigned long misc; + unsigned short n0; + + trigger_bits &= 0x3; + + /*Determine the OEM Macrovision Program Mode and Register 0 Data. */ + if (IS_NTSC(tv_std)) { + /*NTSC TV Standard. */ + if (trigger_bits == 0) { + /*turn Macrovision OFF. */ + nMode = nNTSC_APS00; + } else if (trigger_bits == 1) { + /*AGC Only. */ + nMode = nNTSC_APS01; + } else if (trigger_bits == 2) { + /*AGC + 2-line CS. */ + nMode = nNTSC_APS10; + } else { + /*AGC + 4-line CS. */ + nMode = nNTSC_APS11; + } + } else { + /*PAL TV Standard. */ + if (trigger_bits == 0) { + /*turn Macrovision OFF. */ + nMode = nPAL_APS00; + } else { + /*APS 01, 10, or 11. */ + nMode = nPAL_APSXX; + } + } + + /*Retrieve the Macrovision Program Mode Data */ + if (tv_std != GFX_TV_STANDARD_PAL_M) + n0 = mvsetup.n0[nMode]; + else { + /*PAL-M sets up like NTSC except for n0. */ + if ((trigger_bits & 0x03) == 0) + n0 = mvsetup.n0[nPAL_APS00]; + else + n0 = mvsetup.n0[nPAL_APSXX]; + } + + /*download settings now. */ + houston_WriteReg(MV_N0, n0, 1); + houston_WriteReg(MV_N1, mvsetup.n1[nMode], 1); + houston_WriteReg(MV_N2, mvsetup.n2[nMode], 1); + houston_WriteReg(MV_N3, mvsetup.n3[nMode], 1); + houston_WriteReg(MV_N4, mvsetup.n4[nMode], 1); + houston_WriteReg(MV_N5, mvsetup.n5[nMode], 1); + houston_WriteReg(MV_N6, mvsetup.n6[nMode], 1); + houston_WriteReg(MV_N7, mvsetup.n7[nMode], 1); + houston_WriteReg(MV_N8, mvsetup.n8[nMode], 1); + houston_WriteReg(MV_N9, mvsetup.n9[nMode], 1); + houston_WriteReg(MV_N10, mvsetup.n10[nMode], 1); + houston_WriteReg(MV_N11, mvsetup.n11[nMode] & 0xff, 1); + houston_WriteReg(MV_N11 + 1, mvsetup.n11[nMode] >> 8, 1); + houston_WriteReg(MV_N12, mvsetup.n12[nMode] & 0xff, 1); + houston_WriteReg(MV_N12 + 1, mvsetup.n12[nMode] >> 8, 1); + houston_WriteReg(MV_N13, mvsetup.n13[nMode], 1); + houston_WriteReg(MV_N14, mvsetup.n14[nMode], 1); + houston_WriteReg(MV_N15, mvsetup.n15[nMode], 1); + houston_WriteReg(MV_N16, mvsetup.n16[nMode], 1); + houston_WriteReg(MV_N17, mvsetup.n17[nMode], 1); + houston_WriteReg(MV_N18, mvsetup.n18[nMode], 1); + houston_WriteReg(MV_N19, mvsetup.n19[nMode], 1); + houston_WriteReg(MV_N20, mvsetup.n20[nMode], 1); + houston_WriteReg(MV_N21, mvsetup.n21[nMode] & 0xff, 1); + houston_WriteReg(MV_N21 + 1, mvsetup.n21[nMode] >> 8, 1); + houston_WriteReg(MV_N22, mvsetup.n22[nMode], 1); + houston_WriteReg(MV_AGC_PULSE_LEVEL, mvsetup.agc_pulse_level[nMode], 1); + houston_WriteReg(MV_BP_PULSE_LEVEL, mvsetup.bp_pulse_level[nMode], 1); + + houston_ReadReg(HOUSTON_MISC, &misc, 2); + if (trigger_bits == 0) + misc &= ~MISC_MV_SOFT_EN; + else + misc |= MISC_MV_SOFT_EN; + houston_WriteReg(HOUSTON_MISC, misc, 2); +} + +static void +conget_macrovision(unsigned long tv_std, unsigned int *p_cp_trigger_bits) +{ + unsigned long n0, n1; + + if (!p_cp_trigger_bits) + return; + + houston_ReadReg(MV_N0, &n0, 1); + houston_ReadReg(MV_N1, &n1, 1); + + *p_cp_trigger_bits = 0; + + if (IS_NTSC(tv_std)) { + switch (n0) { + case 0: + *p_cp_trigger_bits = 0; + break; + + case 0x36: + *p_cp_trigger_bits = 1; + break; + + case 0x3E: + { + if (0x1D == n1) + *p_cp_trigger_bits = 2; + else + *p_cp_trigger_bits = 3; + } + break; + } + } else if (IS_PAL(tv_std)) { + if (0 == n0) + *p_cp_trigger_bits = 0; + else { + /*don't know here what the non-zero trigger bits were */ + *p_cp_trigger_bits = 1; + } + } +} + +/* PLAL_MediaGX.cpp */ +/*==========================================================================*/ +/* These functions provides implementation of platform-specific functions */ +/* MediaGX platform. */ +/*==========================================================================*/ + +/*MediaGX control registers.*/ +#define CCR3 0xC3 +#define GCR 0xb8 + +/*Media GX general config register.*/ +#define GX_DCLK_MUL 0x00c0 +#define GX_DCLKx1 0x0040 +#define GX_DCLKx2 0x0080 +#define GX_DCLKx4 0x00c0 + +/*Media GX timing config register.*/ +#define GX_TGEN 0x0020 + +/*Cx5530 register offsets (from GX_BASE).*/ +#define CX_DISPLAY_CONFIG 0x10004 +#define CX_DOT_CLK 0x10024 +#define CX_TV_CONFIG 0x10028 + +/*Cx5530 display configuration register.*/ +#define CX_FPVSYNC_POL 0x0800 +#define CX_FPHSYNC_POL 0x0400 +#define CX_FPDATA_ENB 0x0080 +#define CX_FPPOWER_ENB 0x0040 +#define CX_CRTVSYNC_POL 0x0200 +#define CX_CRTHSYNC_POL 0x0100 + +/*Cx5530 dot clock configuration register.*/ +#define CX_TVCLK_SELECT 0x0400 + +/*Cx5530 tv configuration register*/ +#define CX_INVERT_FPCLK (1 << 6) + +/*========================================================================== + * FS450 I2C Address + * There are two possible 7-bit addresses, 0x4A and 0x6A. + * The address if selectable via pins on the FS450. + * There are also two possible 10-bit addresses, 0x224 and 0x276, but this + * source is not designed to use them. + *==========================================================================*/ + +#define FS450_I2C_ADDRESS (0x4A) + +static unsigned char +PLAL_FS450_i2c_address(void) +{ + return FS450_I2C_ADDRESS; +} + +/*========================================================================== + * FS450 UIM mode + * This mode is programmed in the FS450 command register when enabling TV + * out. + *========================================================================== + */ +static int +PLAL_FS450_UIM_mode(void) +{ + return 3; +} + +/*==========================================================================*/ +/* Read and Write MediaGX registers */ +/*==========================================================================*/ +static unsigned long +ReadGx(unsigned long inRegAddr) +{ + unsigned long data; + + DMAL_ReadUInt32(inRegAddr, &data); + + return data; +} + +static void +WriteGx(unsigned long inRegAddr, unsigned long inData) +{ + int is_timing_register; + unsigned long reg_timing_cfg; + + /*because the unlock register for the MediaGx video registers may not */ + /*persist, we will write the unlock code before every write. */ + DMAL_WriteUInt32(DC_UNLOCK, 0x4758); + + /*see if register is a timing register */ + is_timing_register = + (DC_H_TIMING_1 == inRegAddr) || + (DC_H_TIMING_2 == inRegAddr) || + (DC_H_TIMING_3 == inRegAddr) || + (DC_FP_H_TIMING == inRegAddr) || + (DC_V_TIMING_1 == inRegAddr) || + (DC_V_TIMING_2 == inRegAddr) || + (DC_V_TIMING_3 == inRegAddr) || (DC_FP_V_TIMING == inRegAddr); + + /*if the register is a timing register, clear the TGEN bit to allow + * modification */ + if (is_timing_register) { + DMAL_ReadUInt32(DC_TIMING_CFG, ®_timing_cfg); + DMAL_WriteUInt32(DC_TIMING_CFG, reg_timing_cfg & ~GX_TGEN); + } + + /*write the requested register */ + DMAL_WriteUInt32(inRegAddr, inData); + + /*reset the TGEN bit to previous state */ + if (is_timing_register) { + DMAL_WriteUInt32(DC_TIMING_CFG, reg_timing_cfg); + } +} + +#ifdef FS450_DIRECTREG + +/*==========================================================================*/ +/* Platform-specific processing for a Read or Write Register calls. */ +/* The functions should return true if the specified register belongs to */ +/* this platform. */ +/*==========================================================================*/ + +static int +PLAL_ReadRegister(S_REG_INFO * p_reg) +{ + if (!p_reg) + return 0; + + if (SOURCE_GCC == p_reg->source) { + p_reg->value = ReadGx(p_reg->offset); + + return 1; + } + + return 0; +} + +static int +PLAL_WriteRegister(const S_REG_INFO * p_reg) +{ + if (!p_reg) + return 0; + + if (SOURCE_GCC == p_reg->source) { + WriteGx(p_reg->offset, p_reg->value); + + return 1; + } + + return 0; +} + +#endif + +/*========================================================================== + * Determine if TV is on + *==========================================================================*/ +static int +PLAL_IsTVOn(void) +{ + unsigned long reg; + + /*check Cx5530 dot clock */ + reg = ReadGx(CX_DOT_CLK); + return (reg & CX_TVCLK_SELECT) ? 1 : 0; +} + +/*========================================================================== + * Platform-specific actions to reset to VGA mode + *==========================================================================*/ + +static int +PLAL_EnableVga(void) +{ + unsigned long reg; + + /*2 x dclk */ + reg = ReadGx(DC_GENERAL_CFG); + reg &= ~GX_DCLK_MUL; + reg |= GX_DCLKx2; + WriteGx(DC_GENERAL_CFG, reg); + + /*select pll dot clock. */ + reg = ReadGx(CX_DOT_CLK); + reg &= ~CX_TVCLK_SELECT; + WriteGx(CX_DOT_CLK, reg); + + /*timing config, reset everything on dclk. */ + reg = ReadGx(DC_TIMING_CFG); + reg &= ~GX_TGEN; + WriteGx(DC_TIMING_CFG, reg); + reg |= GX_TGEN; + WriteGx(DC_TIMING_CFG, reg); + + /*un-invert FP clock */ + reg = ReadGx(CX_TV_CONFIG); + reg &= ~CX_INVERT_FPCLK; + WriteGx(CX_TV_CONFIG, reg); + + return 0; +} + +/*==========================================================================*/ +/*Platform-specific actions to enter TVout mode */ +/*==========================================================================*/ + +static int +PLAL_PrepForTVout(void) +{ + unsigned int reg; + + /*Cx5530 tv config. */ + reg = 0; + WriteGx(CX_TV_CONFIG, reg); + + /*invert FP clock */ + reg = (int)ReadGx(CX_TV_CONFIG); + reg |= CX_INVERT_FPCLK; + WriteGx(CX_TV_CONFIG, reg); + + return 0; +} + +static int +PLAL_SetTVTimingRegisters(const S_TIMING_SPECS * p_specs) +{ + unsigned long reg; + + /*timing config, reset everything on dclk. */ + reg = ReadGx(DC_TIMING_CFG); + reg &= ~GX_TGEN; + WriteGx(DC_TIMING_CFG, reg); + + /*htotal and hactive. */ + reg = ((p_specs->h_total - 1) << 16) | (p_specs->vga_width - 1); + WriteGx(DC_H_TIMING_1, reg); + + /*hblank. */ + reg = ((p_specs->h_total - 1) << 16) | (p_specs->vga_width - 1); + WriteGx(DC_H_TIMING_2, reg); + + /*hsync. */ + reg = ((p_specs->h_sync + 63) << 16) | p_specs->h_sync; + WriteGx(DC_H_TIMING_3, reg); + + /*fp hsync. */ + WriteGx(DC_FP_H_TIMING, reg); + + /*vtotal and vactive. */ + reg = ((p_specs->v_total - 1) << 16) | (p_specs->vga_lines - 1); + WriteGx(DC_V_TIMING_1, reg); + + /*vblank. */ + reg = ((p_specs->v_total - 1) << 16) | (p_specs->vga_lines - 1); + WriteGx(DC_V_TIMING_2, reg); + + /*vsync. */ + reg = ((p_specs->v_sync) << 16) | (p_specs->v_sync - 1); + WriteGx(DC_V_TIMING_3, reg); + + /*fp vsync. */ + reg = ((p_specs->v_sync - 1) << 16) | (p_specs->v_sync - 2); + WriteGx(DC_FP_V_TIMING, reg); + + /*timing config, reenable all dclk stuff. */ + reg = ReadGx(DC_TIMING_CFG); + reg |= GX_TGEN; + WriteGx(DC_TIMING_CFG, reg); + + return 0; +} + +static int +PLAL_FinalEnableTVout(unsigned long vga_mode) +{ + unsigned int reg; + + /*Cx5530 select tv dot clock. */ + reg = (int)ReadGx(CX_DOT_CLK); + reg |= CX_TVCLK_SELECT; + WriteGx(CX_DOT_CLK, reg); + + /*2 x dclk (actually 1x) */ + reg = (int)ReadGx(DC_GENERAL_CFG); + reg &= ~GX_DCLK_MUL; + WriteGx(DC_GENERAL_CFG, reg); + + reg |= GX_DCLKx2; + WriteGx(DC_GENERAL_CFG, reg); + + /*Cx5530 display configuration register. */ + reg = (int)ReadGx(CX_DISPLAY_CONFIG); + reg |= (CX_FPVSYNC_POL | CX_FPHSYNC_POL | CX_FPDATA_ENB | CX_FPPOWER_ENB); + WriteGx(CX_DISPLAY_CONFIG, reg); + + return 0; +} diff --git a/driver/xf86-video-geode/src/gfx/tv_fs450.h b/driver/xf86-video-geode/src/gfx/tv_fs450.h new file mode 100644 index 000000000..7e917c035 --- /dev/null +++ b/driver/xf86-video-geode/src/gfx/tv_fs450.h @@ -0,0 +1,206 @@ +/* Copyright (c) 2005 Advanced Micro Devices, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + * + * Neither the name of the Advanced Micro Devices, Inc. nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * */ + +/* + * This file defines the common FS450 API. + * */ + +#ifndef __FS450_H__ +#define __FS450_H__ + +#ifdef __cplusplus +extern "C" +{ +#endif + +/*==========================================================================*/ +/* Init and cleanup functions*/ + + int FS450_init(void); + void FS450_cleanup(void); + /* call FS450_init at startup to probe for and initialize FS450. */ + /* returns 0 if successful. */ + +/*==========================================================================*/ +/* TV output on or off*/ + + int FS450_get_tv_enable(unsigned int *p_on); + int FS450_set_tv_enable(unsigned int on); + /* on is 1 for TV on, 0 for off */ + +/*==========================================================================*/ +/* TV standard*/ + + int FS450_get_tv_standard(unsigned long *p_standard); + int FS450_get_available_tv_standards(unsigned long *p_standards); + int FS450_set_tv_standard(unsigned long standard); + /* standard is one of the FS450_TV_STANDARD constants */ + /* standards is a bitmask of zero or more FS450_TV_STANDARD constants */ + +/* FS450 TV Standard flags*/ +#define FS450_TV_STANDARD_NTSC_M 0x0001 +#define FS450_TV_STANDARD_NTSC_M_J 0x0002 +#define FS450_TV_STANDARD_PAL_B 0x0004 +#define FS450_TV_STANDARD_PAL_D 0x0008 +#define FS450_TV_STANDARD_PAL_H 0x0010 +#define FS450_TV_STANDARD_PAL_I 0x0020 +#define FS450_TV_STANDARD_PAL_M 0x0040 +#define FS450_TV_STANDARD_PAL_N 0x0080 +#define FS450_TV_STANDARD_PAL_G 0x0100 + +/*==========================================================================*/ +/* VGA mode assumed by FS450*/ + + int FS450_get_vga_mode(unsigned long *p_vga_mode); + int FS450_get_available_vga_modes(unsigned long *p_vga_modes); + int FS450_set_vga_mode(unsigned long vga_mode); + /* vga_mode is one of the FS450_VGA_MODE constants */ + /* vga_modes is a bitmask of zero or more FS450_VGA_MODE constants */ + +/* FS450 VGA Mode flags*/ +#define FS450_VGA_MODE_UNKNOWN 0 +#define FS450_VGA_MODE_640X480 0x0001 +#define FS450_VGA_MODE_720X487 0x0002 +#define FS450_VGA_MODE_720X576 0x0004 +#define FS450_VGA_MODE_800X600 0x0008 +#define FS450_VGA_MODE_1024X768 0x0010 + +/*==========================================================================*/ +/* TVout mode*/ + + int FS450_get_tvout_mode(unsigned long *p_tvout_mode); + int FS450_set_tvout_mode(unsigned long tvout_mode); + /* tvout_mode is a bitmask of FS450_TVOUT_MODE constants */ + +/* FS450 TVout mode flags*/ +#define FS450_TVOUT_MODE_CVBS 0x0001 +#define FS450_TVOUT_MODE_YC 0x0002 +#define FS450_TVOUT_MODE_RGB 0x0004 +#define FS450_TVOUT_MODE_CVBS_YC (FS450_TVOUT_MODE_CVBS | FS450_TVOUT_MODE_YC) + +/*==========================================================================*/ +/* Flicker control*/ + + int FS450_get_sharpness(int *p_sharpness); + int FS450_set_sharpness(int sharpness); + /* sharpness is a percentage in tenths of a percent, 0 to 1000 */ + + int FS450_get_flicker_filter(int *p_flicker); + int FS450_set_flicker_filter(int flicker); + /* flicker_filter is a percentage in tenths of a percent, 0 to 1000 */ + +/*==========================================================================*/ +/* Size and Position*/ + + int FS450_get_overscan(int *p_x, int *p_y); + int FS450_set_overscan(int x, int y); + int FS450_get_position(int *p_x, int *p_y); + int FS450_set_position(int x, int y); + /* x and y are horizontal and vertical adjustments, -1000 to +1000 */ + +/*==========================================================================*/ +/* Visual adjustments*/ + + int FS450_get_color(int *p_color); + int FS450_set_color(int color); + /* color is a percentage, 0 to 100 */ + + int FS450_get_brightness(int *p_brightness); + int FS450_set_brightness(int brightness); + /* brightness is a percentage, 0 to 100 */ + + int FS450_get_contrast(int *p_contrast); + int FS450_set_contrast(int constrast); + /* contrast is a percentage, 0 to 100 */ + +/*==========================================================================*/ +/* Luma and Chroma filter*/ + + int FS450_get_yc_filter(unsigned int *p_yc_filter); + int FS450_set_yc_filter(unsigned int yc_filter); + /* yc_filter is a bitmask of FS450_LUMA_FILTER and/or FS450_CHROMA_FILTER */ + +/* FS450 Luma and Chroma Filters*/ +#define FS450_LUMA_FILTER 0x0001 +#define FS450_CHROMA_FILTER 0x0002 + +/*==========================================================================*/ +/* Macrovision*/ + + int FS450_get_aps_trigger_bits(unsigned int *p_trigger_bits); + int FS450_set_aps_trigger_bits(unsigned int trigger_bits); + /* trigger_bits is one of the FS450_APS_TRIGGER constants */ + +/* APS Trigger Bits*/ +#define FS450_APS_TRIGGER_OFF 0 +#define FS450_APS_TRIGGER_AGC_ONLY 1 +#define FS450_APS_TRIGGER_AGC_2_LINE 2 +#define FS450_APS_TRIGGER_AGC_4_LINE 3 + +/*==========================================================================*/ +/* direct access to Houston and platform registers (debug builds only) + * The two functions FS450_ReadRegister and FS450_WriteRegister allow access + * to device registers. These functions are intended for debugging purposes + * only and should not be included in a shipping product. + * */ + +#ifdef FS450_DIRECTREG + +#define SOURCE_HOUSTON 0 +#define SOURCE_GCC 1 + + typedef struct _S_REG_INFO + { + int source; + unsigned int size; + unsigned long offset; + unsigned long value; + } S_REG_INFO; + + int FS450_ReadRegister(S_REG_INFO * p_reg); + int FS450_WriteRegister(S_REG_INFO * p_reg); + +#endif + +/*==========================================================================*/ +/* Error Codes*/ + +#define ERR_INVALID_PARAMETER 0x1000 +#define ERR_NOT_SUPPORTED 0x1001 +#define ERR_CANNOT_CHANGE_WHILE_TV_ON 0x1002 + +#define ERR_DRIVER_NOT_FOUND 0x1100 +#define ERR_DRIVER_ERROR 0x1101 +#define ERR_DEVICE_NOT_FOUND 0x1120 + +#define ERR_I2C_MISSING_DEVICE 0x1200 +#define ERR_I2C_WRITE_FAILED 0x1201 +#define ERR_I2C_READ_FAILED 0x1202 + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/driver/xf86-video-geode/src/gfx/vga_gu1.c b/driver/xf86-video-geode/src/gfx/vga_gu1.c new file mode 100644 index 000000000..20cf232eb --- /dev/null +++ b/driver/xf86-video-geode/src/gfx/vga_gu1.c @@ -0,0 +1,680 @@ +/* Copyright (c) 2005 Advanced Micro Devices, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + * + * Neither the name of the Advanced Micro Devices, Inc. nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * */ + +/* + * This file contains routines to set modes using the VGA registers. + * Since this file is for the first generation graphics unit, it interfaces + * to SoftVGA registers. It works for both VSA1 and VSA2. + * */ + +/* SoftVGA Extended CRTC register indices and bit definitions */ + +#define CRTC_EXTENDED_REGISTER_LOCK 0x30 +#define CRTC_MODE_SWITCH_CONTROL 0x3F + +/* BIT DEFINITIONS */ + +#define CRTC_BIT_16BPP 0x01 +#define CRTC_BIT_555 0x02 + +/* LOCAL ROUTINE DEFINITIONS */ + +int gu1_detect_vsa2(void); + +/*---------------------------------*/ +/* MODE TABLES FOR VGA REGISTERS */ +/*---------------------------------*/ + +/* FOR SoftVGA, the CRTC_EXTENDED_ADDRESS_CONTROL (0x43) is always equal to + * 0x03 for a packed linear frame buffer organization. The + * CRTC_EXTENDED_DAC_CONTROL (0x4B) is always equal to 0x03 to work with + * older versions of VSA1 (that needed to specify 8 or 16 bit bus to an + * external RAMDAC. This is not used in VSA2. The clock frequency is + * specified in register 0x4D if clock control (0x4C) is set to 0x80. + * Higher resolutions (1280x1024) use the CRTC_EXTENDED_VERTICAL_TIMING + * register (index 0x41). + */ + +gfx_vga_struct gfx_vga_modes[] = { +/*--------------------------------------------------------------------------*/ + { + 640, 480, 60, /* 640x480 */ + 25, /* 25 MHz clock = 60 Hz refresh rate */ + 0xE3, /* miscOutput register */ + { + 0x5F, 0x4F, 0x50, 0x82, 0x54, 0x80, 0x0B, 0x3E, + /* standard CRTC */ + 0x80, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xEA, 0x0C, 0xDF, 0x50, 0x00, 0xE7, 0x04, 0xE3, 0xFF}, + { + 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, + /* extended CRTC */ + 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00} + }, +/*--------------------------------------------------------------------------*/ + { + 640, 480, 72, /* 640x480 */ + 29, /* 29 MHz clock = 72 Hz refresh rate */ + 0xE3, /* miscOutput register */ + { + 0x63, 0x4f, 0x50, 0x86, 0x55, 0x99, 0x06, 0x3e, + /* standard CRTC */ + 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xe9, 0x0c, 0xdf, 0x00, 0x00, 0xe7, 0x00, 0xe3, 0xff}, + { + 0x6D, 0x00, 0x00, 0x03, 0x00, 0x01, 0x01, 0x00, + /* extended CRTC */ + 0x00, 0x00, 0x01, 0x08, 0x80, 0x1F, 0x00, 0x4B} + }, +/*--------------------------------------------------------------------------*/ + { + 640, 480, 75, /* 640x480 */ + 31, + /* 31.5 MHz clock = 75 Hz refresh rate */ + 0xE3, /* miscOutput register */ + { + 0x64, 0x4F, 0x4F, 0x88, 0x54, 0x9B, 0xF2, 0x1F, + /* standard CRTC */ + 0x80, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xE1, 0x04, 0xDF, 0x50, 0x00, 0xDF, 0xF3, 0xE3, 0xFF}, + { + 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, + /* extended CRTC */ + 0x00, 0x00, 0x00, 0x03, 0x80, 0x1F, 0x00, 0x00} + }, +/*--------------------------------------------------------------------------*/ + { + 800, 600, 60, /* 800x600 */ + 40, /* 40 MHz clock = 60 Hz refresh rate */ + 0x23, /* miscOutput register */ + { + 0x7F, 0x63, 0x64, 0x82, 0x6B, 0x1B, 0x72, 0xF0, + /* standard CRTC */ + 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x59, 0x0D, 0x57, 0x64, 0x00, 0x57, 0x73, 0xE3, 0xFF}, + { + 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, + /* extended CRTC */ + 0x00, 0x00, 0x00, 0x03, 0x80, 0x28, 0x00, 0x00} + }, +/*--------------------------------------------------------------------------*/ + { + 800, 600, 72, /* 800x600 */ + 47, /* 47 MHz clock = 72 Hz refresh rate */ + 0x2B, /* miscOutput register */ + { + 0x7D, 0x63, 0x63, 0x81, 0x6D, 0x1B, 0x98, 0xF0, + /* standard CRTC */ + 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x7D, 0x03, 0x57, 0x00, 0x00, 0x57, 0x9A, 0xE3, 0xFF}, + { + 0x6F, 0x00, 0x00, 0x03, 0x00, 0x01, 0x01, 0x00, + /* extended CRTC */ + 0x00, 0x00, 0x01, 0x08, 0x80, 0x32, 0x00, 0x4B} + }, +/*--------------------------------------------------------------------------*/ + { + 800, 600, 75, /* 800x600 */ + 49, + /* 49.5 MHz clock = 75 Hz refresh rate */ + 0x23, /* miscOutput register */ + { + 0x7F, 0x63, 0x63, 0x83, 0x68, 0x11, 0x6F, 0xF0, + /* standard CRTC */ + 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x59, 0x1C, 0x57, 0x64, 0x00, 0x57, 0x70, 0xE3, 0xFF}, + { + 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, + /* extended CRTC */ + 0x00, 0x00, 0x00, 0x03, 0x80, 0x31, 0x00, 0x00} + }, +/*--------------------------------------------------------------------------*/ + { + 1024, 768, 60, /* 1024x768 */ + 65, /* 65 MHz clock = 60 Hz refresh rate */ + 0xE3, /* miscOutput register */ + { + 0xA3, 0x7F, 0x80, 0x86, 0x85, 0x96, 0x24, 0xF5, + /* standard CRTC */ + 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x04, 0x0A, 0xFF, 0x80, 0x00, 0xFF, 0x25, 0xE3, 0xFF}, + { + 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, + /* extended CRTC */ + 0x00, 0x00, 0x00, 0x03, 0x80, 0x41, 0x00, 0x00} + }, +/*--------------------------------------------------------------------------*/ + { + 1024, 768, 70, /* 1024x768 */ + 76, /* 76 MHz clock = 70 Hz refresh rate */ + 0x2B, /* miscOutput register */ + { + 0xA1, 0x7F, 0x7F, 0x85, 0x85, 0x95, 0x24, 0xF5, + /* standard CRTC */ + 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x03, 0x09, 0xFF, 0x00, 0x00, 0xFF, 0x26, 0xE3, 0xFF}, + { + 0x62, 0x00, 0x00, 0x03, 0x00, 0x01, 0x01, 0x00, + /* extended CRTC */ + 0x00, 0x00, 0x01, 0x02, 0x80, 0x4B, 0x00, 0x4B} + }, +/*--------------------------------------------------------------------------*/ + { + 1024, 768, 75, /* 1024x768 */ + 79, /* 79 MHz clock = 75 Hz refresh rate */ + 0xE3, /* miscOutput register */ + { + 0x9F, 0x7F, 0x7F, 0x83, 0x84, 0x8F, 0x1E, 0xF5, + /* standard CRTC */ + 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x01, 0x04, 0xFF, 0x80, 0x00, 0xFF, 0x1F, 0xE3, 0xFF}, + { + 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, + /* extended CRTC */ + 0x00, 0x00, 0x00, 0x03, 0x80, 0x4F, 0x00, 0x00} + }, +/*--------------------------------------------------------------------------*/ + { + 1280, 1024, 60, /* 1280x1024 */ + 108, + /* 108 MHz clock = 60 Hz refresh rate */ + 0x23, /* miscOutput register */ + { + 0xCF, 0x9F, 0xA0, 0x92, 0xAA, 0x19, 0x28, 0x52, + /* standard CRTC */ + 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x01, 0x04, 0xFF, 0xA0, 0x00, 0x00, 0x29, 0xE3, 0xFF}, + { + 0x00, 0x51, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, + /* extended CRTC */ + 0x00, 0x00, 0x00, 0x03, 0x80, 0x6C, 0x00, 0x00} + }, +/*--------------------------------------------------------------------------*/ + { + 1280, 1024, 75, /* 1280x1024 */ + 135, + /* 135 MHz clock = 75 Hz refresh rate */ + 0x23, /* miscOutput register */ + { + 0xCE, 0x9F, 0x9F, 0x92, 0xA4, 0x15, 0x28, 0x52, + /* standard CRTC */ + 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x01, 0x04, 0xFF, 0xA0, 0x00, 0x00, 0x29, 0xE3, 0xFF}, + { + 0x00, 0x51, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, + /* extended CRTC */ + 0x00, 0x00, 0x00, 0x03, 0x80, 0x87, 0x00, 0x00} + }, +/*--------------------------------------------------------------------------*/ + { + 1280, 1024, 85, /* 1280x1024 */ + 159, + /* 159 MHz clock = 85 Hz refresh rate */ + 0x2B, /* miscOutput register */ + { + 0xD3, 0x9F, 0xA0, 0x98, 0xA8, 0x9C, 0x2E, 0x5A, + /* standard CRTC */ + 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x01, 0x04, 0xFF, 0x00, 0x00, 0xFF, 0x30, 0xE3, 0xFF}, + { + 0x6B, 0x41, 0x00, 0x03, 0x00, 0x01, 0x00, 0x00, + /* extended CRTC */ + 0x00, 0x00, 0x01, 0x00, 0x80, 0x9D, 0x00, 0x4B} + }, +/*--------------------------------------------------------------------------*/ +}; + +#define GFX_VGA_MODES sizeof(gfx_vga_modes)/sizeof(gfx_vga_struct) + +/*---------------------------------------------------------------------------- + * gfx_get_softvga_active + * + * This returns the active status of SoftVGA + *---------------------------------------------------------------------------- + */ +int +gfx_get_softvga_active(void) +{ + unsigned short crtcindex, crtcdata; + + if (gu1_detect_vsa2()) + return (gfx_get_vsa2_softvga_enable()); + + crtcindex = (INB(0x3CC) & 0x01) ? 0x3D4 : 0x3B4; + crtcdata = crtcindex + 1; + + OUTB(crtcindex, CRTC_MODE_SWITCH_CONTROL); + return (INB(crtcdata) & 0x1); +} + +/*---------------------------------------------------------------------------- + * gfx_vga_test_pci + * + * This routine looks for the VGA PCI header. It checks to see that bit 1 + * of the command register is writable to know that SoftVGA is trapping + * the PCI config cuscles. If SoftVGA is not emulating the header, the + * hardware will still respond with the proper device ID, etc. + * + * We need to know that SoftVGA is really there so that we can set the + * command register and have the proper effect (enable trapping of VGA). + * Otherwise, if we enable VGA via the PCI header, trapping really won't be + * enabled and the VGA register writes will go out to the external card. + *---------------------------------------------------------------------------- + */ +int +gfx_vga_test_pci(void) +{ + int softvga = 1; + unsigned long value; + + value = gfx_pci_config_read(0x80009400); + if ((value & 0x0000FFFF) != 0x1078) + softvga = 0; + else { + value = gfx_pci_config_read(0x80009404); + gfx_pci_config_write(0x80009404, value | 0x02); + if (!(gfx_pci_config_read(0x80009404) & 0x02)) + softvga = 0; + gfx_pci_config_write(0x80009404, value); + } + return (softvga); +} + +/*---------------------------------------------------------------------------- + * gfx_vga_get_pci_command + * + * This routine returns the value of the PCI command register. + *---------------------------------------------------------------------------- + */ +unsigned char +gfx_vga_get_pci_command(void) +{ + unsigned long value; + + value = gfx_pci_config_read(0x80009404); + return ((unsigned char)value); +} + +/*---------------------------------------------------------------------------- + * gfx_vga_set_pci_command + * + * This routine writes the value of the PCI command register. It is used + * to enable or disable SoftVGA. + * + * Bit 0: Enable VGA IO + * Bit 1: Enable VGA memory + *---------------------------------------------------------------------------- + */ +int +gfx_vga_set_pci_command(unsigned char command) +{ + unsigned long value; + + value = gfx_pci_config_read(0x80009404) & 0xFFFFFF00; + value |= (unsigned long)command; + gfx_pci_config_write(0x80009404, value); + return (GFX_STATUS_OK); +} + +/*---------------------------------------------------------------------------- + * gfx_vga_seq_reset + * + * This routine enables or disables SoftVGA. It is used to make SoftVGA + * "be quiet" and not interfere with any of the direct hardware access from + * Durango. For VSA1, the sequencer is reset to stop text redraws. VSA2 may + * provide a better way to have SoftVGA sit in the background. + *---------------------------------------------------------------------------- + */ +int +gfx_vga_seq_reset(int reset) +{ + OUTB(0x3C4, 0); + OUTB(0x3C5, (unsigned char)(reset ? 0x00 : 0x03)); + return (GFX_STATUS_OK); +} + +/*---------------------------------------------------------------------------- + * gfx_vga_set_graphics_bits + * + * This routine sets the standard VGA sequencer, graphics controller, and + * attribute registers to appropriate values for a graphics mode (packed, + * 8 BPP or greater). This is also known as "VESA" modes. The timings for + * a particular mode are handled by the CRTC registers, which are set by + * the "gfx_vga_restore" routine. Most OSs that use VGA to set modes save + * and restore the standard VGA registers themselves, which is why these + * registers are not part of the save/restore paradigm. + *---------------------------------------------------------------------------- + */ +int +gfx_vga_set_graphics_bits(void) +{ + /* SET GRAPHICS BIT IN GRAPHICS CONTROLLER REG 0x06 */ + + OUTB(0x3CE, 0x06); + OUTB(0x3CF, 0x01); + + /* SET GRAPHICS BIT IN ATTRIBUTE CONTROLLER REG 0x10 */ + + INB(0x3BA); /* Reset flip-flop */ + INB(0x3DA); + OUTB(0x3C0, 0x10); + OUTB(0x3C0, 0x01); + return (GFX_STATUS_OK); +} + +/*---------------------------------------------------------------------------- + * gfx_vga_mode + * + * This routine searches the VGA mode table for a match of the specified + * mode and then fills in the VGA structure with the associated VGA register + * values. The "gfx_vga_restore" routine can then be called to actually + * set the mode. + *---------------------------------------------------------------------------- + */ +int +gfx_vga_mode(gfx_vga_struct * vga, int xres, int yres, int bpp, int hz) +{ + unsigned int i; + unsigned short pitch; + + for (i = 0; i < GFX_VGA_MODES; i++) { + if ((gfx_vga_modes[i].xsize == xres) && + (gfx_vga_modes[i].ysize == yres) && (gfx_vga_modes[i].hz == hz)) { + /* COPY ENTIRE STRUCTURE FROM THE TABLE */ + + *vga = gfx_vga_modes[i]; + + /* SET PITCH TO 1K OR 2K */ + /* CRTC_EXTENDED_OFFSET index is 0x45, so offset = 0x05 */ + + pitch = (unsigned short)xres; + if (bpp > 8) + pitch <<= 1; + if (pitch <= 1024) + pitch = 1024 >> 3; + else + pitch = 2048 >> 3; + vga->stdCRTCregs[0x13] = (unsigned char)pitch; + vga->extCRTCregs[0x05] = (unsigned char)((pitch >> 8) & 0x03); + + /* SET PROPER COLOR DEPTH VALUE */ + /* CRTC_EXTENDED_COLOR_CONTROL index is 0x46, so offset = 0x06 */ + + switch (bpp) { + case 15: + vga->extCRTCregs[0x06] = CRTC_BIT_16BPP | CRTC_BIT_555; + break; + case 16: + vga->extCRTCregs[0x06] = CRTC_BIT_16BPP; + break; + default: + vga->extCRTCregs[0x06] = 0; + break; + } + return (GFX_STATUS_OK); + } + } + return (GFX_STATUS_UNSUPPORTED); +} + +/*---------------------------------------------------------------------------- + * gfx_vga_pitch + * + * This routine updates the VGA regisers in the specified VGA structure for + * the specified pitch. It does not program the hardware. + *---------------------------------------------------------------------------- + */ +int +gfx_vga_pitch(gfx_vga_struct * vga, unsigned short pitch) +{ + pitch >>= 3; + vga->stdCRTCregs[0x13] = (unsigned char)pitch; + vga->extCRTCregs[0x05] = (unsigned char)((pitch >> 8) & 0x03); + return (0); +} + +/*---------------------------------------------------------------------------- + * gfx_vga_save + * + * This routine saves the state of the VGA registers into the specified + * structure. Flags indicate what portions of the register state need to + * be saved. + *---------------------------------------------------------------------------- + */ +int +gfx_vga_save(gfx_vga_struct * vga, int flags) +{ + int i; + unsigned short crtcindex, crtcdata; + + crtcindex = (INB(0x3CC) & 0x01) ? 0x3D4 : 0x3B4; + crtcdata = crtcindex + 1; + + /* CHECK MISCELLANEOUS OUTPUT FLAG */ + + if (flags & GFX_VGA_FLAG_MISC_OUTPUT) { + /* SAVE MISCCELLANEOUS OUTPUT REGISTER */ + + vga->miscOutput = INB(0x3CC); + } + + /* CHECK STANDARD CRTC FLAG */ + + if (flags & GFX_VGA_FLAG_STD_CRTC) { + /* SAVE STANDARD CRTC REGISTERS */ + + for (i = 0; i < GFX_STD_CRTC_REGS; i++) { + OUTB(crtcindex, (unsigned char)i); + vga->stdCRTCregs[i] = INB(crtcdata); + } + } + + /* CHECK EXTENDED CRTC FLAG */ + + if (flags & GFX_VGA_FLAG_EXT_CRTC) { + /* SAVE EXTENDED CRTC REGISTERS */ + + for (i = 0; i < GFX_EXT_CRTC_REGS; i++) { + OUTB(crtcindex, (unsigned char)(0x40 + i)); + vga->extCRTCregs[i] = INB(crtcdata); + } + } + return (0); +} + +/*---------------------------------------------------------------------------- + * gfx_vga_clear_extended + * + * This routine clears the extended SoftVGA register values to have SoftVGA + * behave like standard VGA. + *---------------------------------------------------------------------------- + */ +void +gfx_vga_clear_extended(void) +{ + int i; + unsigned short crtcindex, crtcdata; + + crtcindex = (INB(0x3CC) & 0x01) ? 0x3D4 : 0x3B4; + crtcdata = crtcindex + 1; + + OUTB(crtcindex, 0x30); + OUTB(crtcdata, 0x57); + OUTB(crtcdata, 0x4C); + for (i = 0x40; i <= 0x4F; i++) { + OUTB(crtcindex, (unsigned char)i); + OUTB(crtcdata, 0); + } + OUTB(crtcindex, 0x30); + OUTB(crtcdata, 0x00); +} + +/*---------------------------------------------------------------------------- + * gfx_vga_restore + * + * This routine restores the state of the VGA registers from the specified + * structure. Flags indicate what portions of the register state need to + * be saved. + *---------------------------------------------------------------------------- + */ +int +gfx_vga_restore(gfx_vga_struct * vga, int flags) +{ + int i; + unsigned short crtcindex, crtcdata; + + crtcindex = (INB(0x3CC) & 0x01) ? 0x3D4 : 0x3B4; + crtcdata = crtcindex + 1; + + /* CHECK MISCELLANEOUS OUTPUT FLAG */ + + if (flags & GFX_VGA_FLAG_MISC_OUTPUT) { + /* RESTORE MISCELLANEOUS OUTPUT REGISTER VALUE */ + + OUTB(0x3C2, vga->miscOutput); + } + + /* CHECK STANDARD CRTC FLAG */ + + if (flags & GFX_VGA_FLAG_STD_CRTC) { + /* UNLOCK STANDARD CRTC REGISTERS */ + + OUTB(crtcindex, 0x11); + OUTB(crtcdata, 0); + + /* RESTORE STANDARD CRTC REGISTERS */ + + for (i = 0; i < GFX_STD_CRTC_REGS; i++) { + OUTB(crtcindex, (unsigned char)i); + OUTB(crtcdata, vga->stdCRTCregs[i]); + } + } + + /* CHECK EXTENDED CRTC FLAG */ + + if (flags & GFX_VGA_FLAG_EXT_CRTC) { + /* UNLOCK EXTENDED CRTC REGISTERS */ + + OUTB(crtcindex, 0x30); + OUTB(crtcdata, 0x57); + OUTB(crtcdata, 0x4C); + + /* RESTORE EXTENDED CRTC REGISTERS */ + + for (i = 0; i < GFX_EXT_CRTC_REGS; i++) { + OUTB(crtcindex, (unsigned char)(0x40 + i)); + OUTB(crtcdata, vga->extCRTCregs[i]); + } + + /* LOCK EXTENDED CRTC REGISTERS */ + + OUTB(crtcindex, 0x30); + OUTB(crtcdata, 0x00); + + /* CHECK IF DIRECT FRAME BUFFER MODE (VESA MODE) */ + + if (vga->extCRTCregs[0x03] & 1) { + /* SET BORDER COLOR TO BLACK */ + /* This really should be another thing saved/restored, but */ + /* Durango currently doesn't do the attr controller registers. */ + + INB(0x3BA); /* Reset flip-flop */ + INB(0x3DA); + OUTB(0x3C0, 0x11); + OUTB(0x3C0, 0x00); + } + } + return (0); +} + +/*---------------------------------------------------------------------------- + * gfx_vga_mode_switch + * + * This routine programs the SoftVGA register to indicate that a mode switch + * is in progress. This results in a cleaner mode switch since SoftVGA will + * not validate the hardware with intermediate values. + *---------------------------------------------------------------------------- + */ +int +gfx_vga_mode_switch(int active) +{ + unsigned short crtcindex, crtcdata; + + crtcindex = (INB(0x3CC) & 0x01) ? 0x3D4 : 0x3B4; + crtcdata = crtcindex + 1; + + /* UNLOCK EXTENDED CRTC REGISTERS */ + + OUTB(crtcindex, CRTC_EXTENDED_REGISTER_LOCK); + OUTB(crtcdata, 0x57); + OUTB(crtcdata, 0x4C); + + /* SIGNAL THE BEGINNING OR END OF THE MODE SWITCH */ + /* SoftVGA will hold off validating the back end hardware. */ + + OUTB(crtcindex, CRTC_MODE_SWITCH_CONTROL); + active = active ? 1 : 0; + OUTB(crtcdata, (unsigned char)active); + + /* WAIT UNTIL SOFTVGA HAS VALIDATED MODE IF ENDING MODE SWITCH */ + /* This is for VSA1 only, where SoftVGA waits until the next */ + /* vertical blank to validate the hardware state. */ + + if ((!active) && (!(gu1_detect_vsa2()))) { + OUTB(crtcindex, 0x33); + while (INB(crtcdata) & 0x80) ; + } + + /* LOCK EXTENDED CRTC REGISTERS */ + + OUTB(crtcindex, CRTC_EXTENDED_REGISTER_LOCK); + OUTB(crtcdata, 0x00); + return (0); +} + +/*---------------------------------------------------------------------------- + * gu1_detect_vsa2 + * + * This routine detects if VSA2 is present. The interface to SoftVGA + * changed slightly. + *---------------------------------------------------------------------------- + */ +int +gu1_detect_vsa2(void) +{ + unsigned short crtcindex, crtcdata; + + crtcindex = (INB(0x3CC) & 0x01) ? 0x3D4 : 0x3B4; + crtcdata = crtcindex + 1; + OUTB(crtcindex, 0x35); + if (INB(crtcdata) != 'C') + return (0); + OUTB(crtcindex, 0x36); + if (INB(crtcdata) != 'X') + return (0); + return (1); +} + +/* END OF FILE */ diff --git a/driver/xf86-video-geode/src/gfx/vid_1200.c b/driver/xf86-video-geode/src/gfx/vid_1200.c new file mode 100644 index 000000000..5eb5793ba --- /dev/null +++ b/driver/xf86-video-geode/src/gfx/vid_1200.c @@ -0,0 +1,2849 @@ +/* Copyright (c) 2005 Advanced Micro Devices, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + * + * Neither the name of the Advanced Micro Devices, Inc. nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * */ + +/* + * This file contains routines to control the SC1200 video overlay hardware. + * */ + +/*---------------------------------------------------------------------------- + * SC1200 GAMMA RAM TABLE + *---------------------------------------------------------------------------- + */ + +unsigned long gfx_gamma_ram_1200[] = { + 0x00000000, 0x00040003, 0x00050104, 0x00060205, 0x00070306, 0x00080407, + 0x00090508, 0x000A0609, 0x000B070A, 0x000C080B, 0x000D090C, 0x000E0A0D, + 0x000F0B0E, 0x00100C0F, 0x00110D10, 0x00110E11, 0x00120F12, 0x00141013, + 0x00151114, 0x00161215, 0x00171316, 0x00181417, 0x00191518, 0x001A1619, + 0x001B171A, 0x001C181B, 0x001D191C, 0x001D1A1D, 0x001E1B1E, 0x00201C1F, + 0x00201D20, 0x00221E21, 0x00231F22, 0x00242023, 0x00252124, 0x00262225, + 0x00262326, 0x00282427, 0x00292528, 0x00292629, 0x002B272A, 0x002C282B, + 0x002D292C, 0x002E2A2D, 0x002F2B2E, 0x00302C2F, 0x00312D30, 0x00322E31, + 0x00332F32, 0x00343033, 0x00353134, 0x00363235, 0x00373336, 0x00383437, + 0x00393538, 0x003A3639, 0x003B373A, 0x003C383B, 0x003D393C, 0x003E3A3D, + 0x003F3B3E, 0x00403C3F, 0x00413D40, 0x00423E41, 0x00433F42, 0x00444043, + 0x00444144, 0x00454245, 0x00474346, 0x00484447, 0x00494548, 0x004A4649, + 0x004B474A, 0x004C484B, 0x004D494C, 0x004E4A4D, 0x004F4B4E, 0x00504C4F, + 0x00514D50, 0x00524E51, 0x00534F52, 0x00545053, 0x00555154, 0x00565255, + 0x00575356, 0x00585457, 0x00595558, 0x005A5659, 0x005B575A, 0x005C585B, + 0x005D595C, 0x005E5A5D, 0x005F5B5E, 0x00605C5F, 0x00615D60, 0x00625E61, + 0x00635F62, 0x00646063, 0x00656164, 0x00666265, 0x00676366, 0x00686467, + 0x00696568, 0x006A6669, 0x006B676A, 0x006C686B, 0x006D696C, 0x006E6A6D, + 0x006F6B6E, 0x00706C6F, 0x00716D70, 0x00726E71, 0x00736F72, 0x00747073, + 0x00757174, 0x00767275, 0x00777376, 0x00787477, 0x00797578, 0x007A7679, + 0x007B777A, 0x007C787B, 0x007D797C, 0x007E7A7D, 0x007F7B7E, 0x00807C7F, + 0x00817D80, 0x00827E81, 0x00837F82, 0x00848083, 0x00858184, 0x00868285, + 0x00878386, 0x00888487, 0x00898588, 0x008A8689, 0x008B878A, 0x008C888B, + 0x008D898C, 0x008E8A8D, 0x008F8B8E, 0x00908C8F, 0x00918D90, 0x00928E91, + 0x00938F92, 0x00949093, 0x00959194, 0x00969295, 0x00979396, 0x00989497, + 0x00999598, 0x009A9699, 0x009B979A, 0x009C989B, 0x009D999C, 0x009E9A9D, + 0x009F9B9E, 0x00A09C9F, 0x00A19DA0, 0x00A29EA1, 0x00A39FA2, 0x00A4A0A3, + 0x00A5A1A4, 0x00A6A2A5, 0x00A7A3A6, 0x00A8A4A7, 0x00A9A5A8, 0x00AAA6A9, + 0x00ABA7AA, 0x00ACA8AB, 0x00ADA9AC, 0x00AEAAAD, 0x00AFABAE, 0x00B0ACAF, + 0x00B1ADB0, 0x00B2AEB1, 0x00B3AFB2, 0x00B4B0B3, 0x00B5B1B4, 0x00B6B2B5, + 0x00B7B3B6, 0x00B8B4B7, 0x00B9B5B8, 0x00BAB6B9, 0x00BBB7BA, 0x00BCB8BB, + 0x00BDB9BC, 0x00BEBABD, 0x00BFBBBE, 0x00C0BCBF, 0x00C1BDC0, 0x00C2BEC1, + 0x00C3BFC2, 0x00C4C0C3, 0x00C5C1C4, 0x00C6C2C5, 0x00C7C3C6, 0x00C8C4C7, + 0x00C9C5C8, 0x00CAC6C9, 0x00CBC7CA, 0x00CCC8CB, 0x00CDC9CC, 0x00CECACD, + 0x00CFCBCE, 0x00D0CCCF, 0x00D1CDD0, 0x00D2CED1, 0x00D3CFD2, 0x00D4D0D3, + 0x00D5D1D4, 0x00D6D2D5, 0x00D7D3D6, 0x00D8D4D7, 0x00D9D5D8, 0x00DAD6D9, + 0x00DBD7DA, 0x00DCD8DB, 0x00DDD9DC, 0x00DEDADD, 0x00DFDBDE, 0x00E0DCDF, + 0x00E1DDE0, 0x00E2DEE1, 0x00E3DFE2, 0x00E4E0E3, 0x00E5E1E4, 0x00E6E2E5, + 0x00E7E3E6, 0x00E8E4E7, 0x00E9E5E8, 0x00EAE6E9, 0x00EBE7EA, 0x00ECE8EB, + 0x00EDE9EC, 0x00EEEAED, 0x00EFEBEE, 0x00F0ECEF, 0x00F1EDF0, 0x00F2EEF1, + 0x00F3EFF2, 0x00F4F0F3, 0x00F5F1F4, 0x00F6F2F5, 0x00F7F3F6, 0x00F8F4F7, + 0x00F9F5F8, 0x00FAF6F9, 0x00FBF7FA, 0x00FCF8FB, 0x00FDF9FC, 0x00FEFAFD, + 0x00FFFBFE, 0x00FFFCFE, 0x00FFFDFE, 0x00FFFFFF +}; + +/*---------------------------------------------------------------------------- + * SC1200 PLL TABLE + *---------------------------------------------------------------------------- + */ + +typedef struct tagSC1200PLL +{ + long frequency; /* 16.16 fixed point frequency */ + unsigned long clock_select; /* clock select register (0x2C) */ +} SC1200PLL; + +SC1200PLL gfx_sc1200_clock_table[] = { + {(25L << 16) | ((1750L * 65536L) / 10000L), 0x0070E00C}, /* 25.1750 + * (sc=24.9231) */ + {(27L << 16) | ((0000L * 65536L) / 10000L), 0x00300100}, /* 27.0000 */ + {(28L << 16) | ((3220L * 65536L) / 10000L), 0x0070EC0C}, /* 28.3220 + * (SC=27.000) */ + {(31L << 16) | ((5000L * 65536L) / 10000L), 0x00500D02}, /* 31.5000 */ + {(36L << 16) | ((0000L * 65536L) / 10000L), 0x00500F02}, /* 36.0000 */ + {(37L << 16) | ((5000L * 65536L) / 10000L), 0x0050B108}, /* 37.5000 */ + {(40L << 16) | ((0000L * 65536L) / 10000L), 0x0050D20D}, /* 40.0000 */ + {(44L << 16) | ((9000L * 65536L) / 10000L), 0x0050DC0D}, /* 44.9000 */ + {(49L << 16) | ((5000L * 65536L) / 10000L), 0x00501502}, /* 49.5000 */ + {(50L << 16) | ((0000L * 65536L) / 10000L), 0x0050A404}, /* 50.0000 */ + {(50L << 16) | ((3500L * 65536L) / 10000L), 0x0050E00C}, /* 50.3500 */ + {(54L << 16) | ((0000L * 65536L) / 10000L), 0x00300300}, /* 54.0000 */ + {(56L << 16) | ((3916L * 65536L) / 10000L), 0x0050F40D}, /* 56.3916 */ + {(56L << 16) | ((6440L * 65536L) / 10000L), 0x0050EC0C}, /* 56.6440 */ + {(59L << 16) | ((0000L * 65536L) / 10000L), 0x0030A207}, /* 59.0000 */ + {(63L << 16) | ((0000L * 65536L) / 10000L), 0x00300D02}, /* 63.0000 */ + {(65L << 16) | ((0000L * 65536L) / 10000L), 0x0030CC0F}, /* 65.0000 */ + {(67L << 16) | ((5000L * 65536L) / 10000L), 0x00300400}, /* 67.5000 */ + {(70L << 16) | ((8000L * 65536L) / 10000L), 0x00301403}, /* 70.8000 */ + {(72L << 16) | ((0000L * 65536L) / 10000L), 0x00300F02}, /* 72.0000 */ + {(75L << 16) | ((0000L * 65536L) / 10000L), 0x0030B108}, /* 75.0000 */ + {(78L << 16) | ((7500L * 65536L) / 10000L), 0x0030A205}, /* 78.7500 */ + {(80L << 16) | ((0000L * 65536L) / 10000L), 0x0030D20D}, /* 80.0000 */ + {(87L << 16) | ((2728L * 65536L) / 10000L), 0x0030E00E}, /* 87.2728 */ + {(89L << 16) | ((8000L * 65536L) / 10000L), 0x0030DC0D}, /* 89.8000 */ + {(94L << 16) | ((5000L * 65536L) / 10000L), 0x00300600}, /* 99.0000 */ + {(99L << 16) | ((0000L * 65536L) / 10000L), 0x00301502}, /* 99.0000 */ + {(100L << 16) | ((0000L * 65536L) / 10000L), 0x0030A404}, /* 100.00 */ + {(108L << 16) | ((0000L * 65536L) / 10000L), 0x00100300}, /* 108.00 */ + {(112L << 16) | ((5000L * 65536L) / 10000L), 0x00301802}, /* 108.00 */ + {(130L << 16) | ((0000L * 65536L) / 10000L), 0x0010CC0F}, /* 130.00 */ + {(135L << 16) | ((0000L * 65536L) / 10000L), 0x00100400}, /* 135.00 */ + {(157L << 16) | ((5000L * 65536L) / 10000L), 0x0010A205}, /* 157.50 */ + {(162L << 16) | ((0000L * 65536L) / 10000L), 0x00100500}, /* 162.00 */ + {(175L << 16) | ((0000L * 65536L) / 10000L), 0x0010E00E}, /* 175.50 */ + {(189L << 16) | ((0000L * 65536L) / 10000L), 0x00100600}, /* 189.00 */ + {(202L << 16) | ((0000L * 65536L) / 10000L), 0x0010EF0E}, /* 202.50 */ + {(232L << 16) | ((0000L * 65536L) / 10000L), 0x0010AA04}, /* 232.50 */ + + /* Precomputed inidces in the hardware */ + {0x0018EC4D, 0x000F0000}, /* 24.923052 */ + {0x00192CCC, 0x00000000}, /* 25.1750 */ + {0x001B0000, 0x00300100}, /* 27.0000 */ + {0x001F8000, 0x00010000}, /* 31.5000 */ + {0x00240000, 0x00020000}, /* 36.0000 */ + {0x00280000, 0x00030000}, /* 40.0000 */ + {0x00318000, 0x00050000}, /* 49.5000 */ + {0x00320000, 0x00040000}, /* 50.0000 */ + {0x00384000, 0x00060000}, /* 56.2500 */ + {0x00410000, 0x00080000}, /* 65.0000 */ + {0x004E8000, 0x000A0000}, /* 78.5000 */ + {0x005E8000, 0x000B0000}, /* 94.5000 */ + {0x006C0000, 0x000C0000}, /* 108.0000 */ + {0x00870000, 0x000D0000}, /* 135.0000 */ +}; + +#define NUM_SC1200_FREQUENCIES \ + sizeof(gfx_sc1200_clock_table)/sizeof(SC1200PLL) + +/*--------------------------------------------------------------------------- + * gfx_reset_video (PRIVATE ROUTINE: NOT PART OF DURANGO API) + * + * This routine is used to disable all components of video overlay before + * performing a mode switch. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +void +sc1200_reset_video(void) +#else +void +gfx_reset_video(void) +#endif +{ + int i; + + gfx_set_video_enable(0); + + /* SET WINDOW 0 AFTER RESET */ + + for (i = 2; i >= 0; i--) { + gfx_select_alpha_region(i); + gfx_set_alpha_enable(0); + gfx_set_alpha_color_enable(0); + } + + /* CLEAR THE DISPLAY BUFFER SIZE TO ZERO */ + /* During a modeset,if FIFO load is enabled with a large buffer size, */ + /* the FIFO can hang. To prevent this, we set the buffer size to zero */ + /* and wait for this new size to be latched */ + + gfx_set_display_video_size(0, 0); + + if (gfx_test_timing_active()) { + while (!gfx_test_vertical_active()) ; + while (gfx_test_vertical_active()) ; + while (!gfx_test_vertical_active()) ; + while (gfx_test_vertical_active()) ; + } +} + +/*----------------------------------------------------------------------------- + * gfx_set_display_control (PRIVATE ROUTINE: NOT PART OF DURANGO API) + * + * This routine configures the display output. + * + * "sync_polarities" is used to set the polarities of the sync pulses + * according to the following mask: + * + * Bit 0: If set to 1, negative horizontal polarity is programmed, + * otherwise positive horizontal polarity is programmed. + * Bit 1: If set to 1, negative vertical polarity is programmed, + * otherwise positive vertical polarity is programmed. + * + *----------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +sc1200_set_display_control(int sync_polarities) +#else +int +gfx_set_display_control(int sync_polarities) +#endif +{ + unsigned long dcfg; + + /* CONFIGURE DISPLAY OUTPUT FROM VIDEO PROCESSOR */ + + dcfg = READ_VID32(SC1200_DISPLAY_CONFIG); + dcfg &= ~(SC1200_DCFG_CRT_SYNC_SKW_MASK | SC1200_DCFG_PWR_SEQ_DLY_MASK | + SC1200_DCFG_CRT_HSYNC_POL | SC1200_DCFG_CRT_VSYNC_POL | + SC1200_DCFG_FP_PWR_EN | SC1200_DCFG_FP_DATA_EN); + + dcfg |= (SC1200_DCFG_CRT_SYNC_SKW_INIT | + SC1200_DCFG_PWR_SEQ_DLY_INIT | SC1200_DCFG_GV_PAL_BYP); + + if (PanelEnable) + dcfg |= SC1200_DCFG_FP_PWR_EN; + + /* SET APPROPRIATE SYNC POLARITIES */ + + if (sync_polarities & 0x1) + dcfg |= SC1200_DCFG_CRT_HSYNC_POL; + if (sync_polarities & 0x2) + dcfg |= SC1200_DCFG_CRT_VSYNC_POL; + + WRITE_VID32(SC1200_DISPLAY_CONFIG, dcfg); + + return (0); +} + +/*--------------------------------------------------------------------------- + * gfx_set_clock_frequency + * + * This routine sets the clock frequency, specified as a 16.16 fixed point + * value (0x00318000 = 49.5 MHz). It will set the closest frequency found + * in the lookup table. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +void +sc1200_set_clock_frequency(unsigned long frequency) +#else +void +gfx_set_clock_frequency(unsigned long frequency) +#endif +{ + unsigned int index; + unsigned long value, pll; + long min, diff; + + /* FIND THE REGISTER VALUES FOR THE DESIRED FREQUENCY */ + /* Search the table for the closest frequency (16.16 format). */ + + value = gfx_sc1200_clock_table[0].clock_select; + min = (long)gfx_sc1200_clock_table[0].frequency - frequency; + if (min < 0L) + min = -min; + for (index = 1; index < NUM_SC1200_FREQUENCIES; index++) { + diff = (long)gfx_sc1200_clock_table[index].frequency - frequency; + if (diff < 0L) + diff = -diff; + if (diff < min) { + min = diff; + value = gfx_sc1200_clock_table[index].clock_select; + } + } + + /* SET THE DOT CLOCK REGISTER */ + + pll = READ_VID32(SC1200_VID_MISC); + WRITE_VID32(SC1200_VID_MISC, pll | SC1200_PLL_POWER_NORMAL); + WRITE_VID32(SC1200_VID_CLOCK_SELECT, value); + return; +} + +/*--------------------------------------------------------------------------- + * gfx_set_screen_enable (PRIVATE ROUTINE - NOT PART OF API) + * + * This routine enables or disables the graphics display logic of the video + * processor. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +sc1200_set_screen_enable(int enable) +#else +int +gfx_set_screen_enable(int enable) +#endif +{ + unsigned long config; + + config = READ_VID32(SC1200_DISPLAY_CONFIG); + if (enable) + WRITE_VID32(SC1200_DISPLAY_CONFIG, config | SC1200_DCFG_DIS_EN); + else + WRITE_VID32(SC1200_DISPLAY_CONFIG, config & ~SC1200_DCFG_DIS_EN); + return (GFX_STATUS_OK); +} + +/*--------------------------------------------------------------------------- + * gfx_set_crt_enable + * + * This routine enables or disables the CRT output from the video processor. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +sc1200_set_crt_enable(int enable) +#else +int +gfx_set_crt_enable(int enable) +#endif +{ + unsigned long config, misc; + + config = READ_VID32(SC1200_DISPLAY_CONFIG); + misc = READ_VID32(SC1200_VID_MISC); + + /* + * IMPORTANT: For all modes do NOT disable the graphics display logic + * because it might be needed for TV + */ + + switch (enable) { + case CRT_DISABLE: /* HSync:Off VSync:Off */ + WRITE_VID32(SC1200_DISPLAY_CONFIG, config & ~(SC1200_DCFG_HSYNC_EN + | SC1200_DCFG_VSYNC_EN | SC1200_DCFG_DAC_BL_EN)); + WRITE_VID32(SC1200_VID_MISC, misc | SC1200_DAC_POWER_DOWN); + break; + case CRT_ENABLE: /* Enable CRT display, including + * display logic */ + WRITE_VID32(SC1200_DISPLAY_CONFIG, config | SC1200_DCFG_HSYNC_EN + | SC1200_DCFG_VSYNC_EN | SC1200_DCFG_DAC_BL_EN); + WRITE_VID32(SC1200_VID_MISC, misc & ~SC1200_DAC_POWER_DOWN); + + /* ENABLE GRAPHICS DISPLAY LOGIC */ + gfx_set_screen_enable(1); + break; + case CRT_STANDBY: /* HSync:Off VSync:On */ + WRITE_VID32(SC1200_DISPLAY_CONFIG, (config & ~(SC1200_DCFG_HSYNC_EN + | SC1200_DCFG_DAC_BL_EN)) + | SC1200_DCFG_VSYNC_EN); + WRITE_VID32(SC1200_VID_MISC, misc | SC1200_DAC_POWER_DOWN); + break; + case CRT_SUSPEND: /* HSync:On VSync:Off */ + WRITE_VID32(SC1200_DISPLAY_CONFIG, (config & ~(SC1200_DCFG_VSYNC_EN + | SC1200_DCFG_DAC_BL_EN)) + | SC1200_DCFG_HSYNC_EN); + WRITE_VID32(SC1200_VID_MISC, misc | SC1200_DAC_POWER_DOWN); + break; + default: + return GFX_STATUS_BAD_PARAMETER; + } + return (GFX_STATUS_OK); +} + +/*---------------------------------------------------------------------------- + * gfx_set_video_enable + * + * This routine enables or disables the video overlay functionality. + *---------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +sc1200_set_video_enable(int enable) +#else +int +gfx_set_video_enable(int enable) +#endif +{ + unsigned long vcfg; + + /* WAIT FOR VERTICAL BLANK TO START */ + /* Otherwise a glitch can be observed. */ + + if (gfx_test_timing_active()) { + if (!gfx_test_vertical_active()) { + while (!gfx_test_vertical_active()) ; + } + while (gfx_test_vertical_active()) ; + } + + vcfg = READ_VID32(SC1200_VIDEO_CONFIG); + if (enable) { + /* ENABLE SC1200 VIDEO OVERLAY */ + + vcfg |= SC1200_VCFG_VID_EN; + WRITE_VID32(SC1200_VIDEO_CONFIG, vcfg); + } else { + /* DISABLE SC1200 VIDEO OVERLAY */ + + vcfg &= ~SC1200_VCFG_VID_EN; + WRITE_VID32(SC1200_VIDEO_CONFIG, vcfg); + } + return (0); +} + +/*---------------------------------------------------------------------------- + * gfx_set_video_format + * + * Sets input video format type, to one of the YUV formats or to RGB. + *---------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +sc1200_set_video_format(unsigned long format) +#else +int +gfx_set_video_format(unsigned long format) +#endif +{ + unsigned long ctrl, vcfg = 0; + + /* SET THE SC1200 VIDEO INPUT FORMAT */ + + vcfg = READ_VID32(SC1200_VIDEO_CONFIG); + ctrl = READ_VID32(SC1200_VID_ALPHA_CONTROL); + ctrl &= ~(SC1200_VIDEO_INPUT_IS_RGB); + vcfg &= ~(SC1200_VCFG_VID_INP_FORMAT | SC1200_VCFG_4_2_0_MODE); + switch (format) { + case VIDEO_FORMAT_UYVY: + vcfg |= SC1200_VCFG_UYVY_FORMAT; + break; + case VIDEO_FORMAT_YUYV: + vcfg |= SC1200_VCFG_YUYV_FORMAT; + break; + case VIDEO_FORMAT_Y2YU: + vcfg |= SC1200_VCFG_Y2YU_FORMAT; + break; + case VIDEO_FORMAT_YVYU: + vcfg |= SC1200_VCFG_YVYU_FORMAT; + break; + case VIDEO_FORMAT_Y0Y1Y2Y3: + vcfg |= SC1200_VCFG_UYVY_FORMAT; + vcfg |= SC1200_VCFG_4_2_0_MODE; + break; + case VIDEO_FORMAT_Y3Y2Y1Y0: + vcfg |= SC1200_VCFG_Y2YU_FORMAT; + vcfg |= SC1200_VCFG_4_2_0_MODE; + break; + case VIDEO_FORMAT_Y1Y0Y3Y2: + vcfg |= SC1200_VCFG_YUYV_FORMAT; + vcfg |= SC1200_VCFG_4_2_0_MODE; + break; + case VIDEO_FORMAT_Y1Y2Y3Y0: + vcfg |= SC1200_VCFG_YVYU_FORMAT; + vcfg |= SC1200_VCFG_4_2_0_MODE; + break; + case VIDEO_FORMAT_RGB: + ctrl |= SC1200_VIDEO_INPUT_IS_RGB; + vcfg |= SC1200_VCFG_UYVY_FORMAT; + break; + case VIDEO_FORMAT_P2M_P2L_P1M_P1L: + ctrl |= SC1200_VIDEO_INPUT_IS_RGB; + vcfg |= SC1200_VCFG_Y2YU_FORMAT; + break; + case VIDEO_FORMAT_P1M_P1L_P2M_P2L: + ctrl |= SC1200_VIDEO_INPUT_IS_RGB; + vcfg |= SC1200_VCFG_YUYV_FORMAT; + break; + case VIDEO_FORMAT_P1M_P2L_P2M_P1L: + ctrl |= SC1200_VIDEO_INPUT_IS_RGB; + vcfg |= SC1200_VCFG_YVYU_FORMAT; + break; + default: + return GFX_STATUS_BAD_PARAMETER; + } + + /* ALWAYS DISABLE GRAPHICS CSC */ + /* This is enabled in the function gfx_set_color_space_YUV for */ + /* YUV blending on TV. */ + + ctrl &= ~SC1200_CSC_GFX_RGB_TO_YUV; + + if (ctrl & SC1200_VIDEO_INPUT_IS_RGB) + ctrl &= ~SC1200_CSC_VIDEO_YUV_TO_RGB; + else + ctrl |= SC1200_CSC_VIDEO_YUV_TO_RGB; + + WRITE_VID32(SC1200_VIDEO_CONFIG, vcfg); + WRITE_VID32(SC1200_VID_ALPHA_CONTROL, ctrl); + + return (0); +} + +/*---------------------------------------------------------------------------- + * gfx_set_video_size + * + * This routine specifies the size of the source data. It is used only + * to determine how much data to transfer per frame, and is not used to + * calculate the scaling value (that is handled by a separate routine). + *---------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +sc1200_set_video_size(unsigned short width, unsigned short height) +#else +int +gfx_set_video_size(unsigned short width, unsigned short height) +#endif +{ + unsigned long size, vcfg; + + /* SET THE SC1200 VIDEO LINE SIZE */ + + vcfg = READ_VID32(SC1200_VIDEO_CONFIG); + vcfg &= ~(SC1200_VCFG_LINE_SIZE_LOWER_MASK | SC1200_VCFG_LINE_SIZE_UPPER); + size = (width >> 1); + vcfg |= (size & 0x00FF) << 8; + if (size & 0x0100) + vcfg |= SC1200_VCFG_LINE_SIZE_UPPER; + WRITE_VID32(SC1200_VIDEO_CONFIG, vcfg); + + /* SET TOTAL VIDEO BUFFER SIZE IN DISPLAY CONTROLLER */ + /* Use private routine to abstract the display controller. */ + + /* Add 1 line to bypass issue #803 */ + gfx_set_display_video_size(width, (unsigned short)(height + 2)); + return (0); +} + +/*---------------------------------------------------------------------------- + * gfx_set_video_offset + * + * This routine sets the starting offset for the video buffer when only + * one offset needs to be specified. + *---------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +sc1200_set_video_offset(unsigned long offset) +#else +int +gfx_set_video_offset(unsigned long offset) +#endif +{ + /* SAVE VALUE FOR FUTURE CLIPPING OF THE TOP OF THE VIDEO WINDOW */ + + gfx_vid_offset = offset; + + /* SET VIDEO BUFFER OFFSET IN DISPLAY CONTROLLER */ + /* Use private routine to abstract the display controller. */ + + gfx_set_display_video_offset(offset); + return (0); +} + +/*--------------------------------------------------------------------------- + * gfx_set_video_upscale + * + * This routine sets the scale factor for the video overlay window. The + * size of the source and destination regions are specified in pixels. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +sc1200_set_video_upscale(unsigned short srcw, unsigned short srch, + unsigned short dstw, unsigned short dsth) +#else +int +gfx_set_video_upscale(unsigned short srcw, unsigned short srch, + unsigned short dstw, unsigned short dsth) +#endif +{ + unsigned long xscale, yscale; + + /* SAVE PARAMETERS (unless don't-care zero destination arguments are used) + * */ + /* These are needed for clipping the video window later. */ + + if (dstw != 0) { + gfx_vid_srcw = srcw; + gfx_vid_dstw = dstw; + } + if (dsth != 0) { + gfx_vid_srch = srch; + gfx_vid_dsth = dsth; + } + + /* CALCULATE SC1200 SCALE FACTORS */ + + if (dstw == 0) + xscale = READ_VID32(SC1200_VIDEO_UPSCALE) & 0xffff; + /* keep previous if don't-care argument */ + else if (dstw <= srcw) + xscale = 0x2000l; + /* horizontal downscaling is currently done in a separate function */ + else if ((srcw == 1) || (dstw == 1)) + return GFX_STATUS_BAD_PARAMETER; + else + xscale = (0x2000l * (srcw - 1l)) / (dstw - 1l); + + if (dsth == 0) + yscale = (READ_VID32(SC1200_VIDEO_UPSCALE) & 0xffff0000) >> 16; + /* keep previous if don't-care argument */ + else if (dsth <= srch) + yscale = 0x2000l; + /* No vertical downscaling in SC1200 so force to 1x if attempted */ + else if ((srch == 1) || (dsth == 1)) + return GFX_STATUS_BAD_PARAMETER; + else + yscale = (0x2000l * (srch - 1l)) / (dsth - 1l); + + WRITE_VID32(SC1200_VIDEO_UPSCALE, (yscale << 16) | xscale); + + /* CALL ROUTINE TO UPDATE WINDOW POSITION */ + /* This is required because the scale values effect the number of */ + /* source data pixels that need to be clipped, as well as the */ + /* amount of data that needs to be transferred. */ + + gfx_set_video_window(gfx_vid_xpos, gfx_vid_ypos, gfx_vid_width, + gfx_vid_height); + return (0); +} + +/*--------------------------------------------------------------------------- + * gfx_set_video_scale + * + * This routine sets the scale factor for the video overlay window. The + * size of the source and destination regions are specified in pixels. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +sc1200_set_video_scale(unsigned short srcw, unsigned short srch, + unsigned short dstw, unsigned short dsth) +#else +int +gfx_set_video_scale(unsigned short srcw, unsigned short srch, + unsigned short dstw, unsigned short dsth) +#endif +{ + return gfx_set_video_upscale(srcw, srch, dstw, dsth); +} + +/*--------------------------------------------------------------------------- + * gfx_set_video_downscale_config + * + * This routine sets the downscale type and factor for the video overlay + * window. + * Note: No downscaling support for RGB565 and YUV420 video formats. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +sc1200_set_video_downscale_config(unsigned short type, unsigned short m) +#else +int +gfx_set_video_downscale_config(unsigned short type, unsigned short m) +#endif +{ + unsigned long downscale; + + if ((m < 1) || (m > 16)) + return GFX_STATUS_BAD_PARAMETER; + + downscale = READ_VID32(SC1200_VIDEO_DOWNSCALER_CONTROL); + downscale &= + ~(SC1200_VIDEO_DOWNSCALE_FACTOR_MASK | + SC1200_VIDEO_DOWNSCALE_TYPE_MASK); + downscale |= ((m - 1l) << SC1200_VIDEO_DOWNSCALE_FACTOR_POS); + switch (type) { + case VIDEO_DOWNSCALE_KEEP_1_OF: + downscale |= SC1200_VIDEO_DOWNSCALE_TYPE_A; + break; + case VIDEO_DOWNSCALE_DROP_1_OF: + downscale |= SC1200_VIDEO_DOWNSCALE_TYPE_B; + break; + default: + return GFX_STATUS_BAD_PARAMETER; + } + WRITE_VID32(SC1200_VIDEO_DOWNSCALER_CONTROL, downscale); + return (0); +} + +/*--------------------------------------------------------------------------- + * gfx_set_video_downscale_coefficients + * + * This routine sets the downscale filter coefficients. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +sc1200_set_video_downscale_coefficients(unsigned short coef1, + unsigned short coef2, unsigned short coef3, unsigned short coef4) +#else +int +gfx_set_video_downscale_coefficients(unsigned short coef1, + unsigned short coef2, unsigned short coef3, unsigned short coef4) +#endif +{ + if ((coef1 + coef2 + coef3 + coef4) != 16) + return GFX_STATUS_BAD_PARAMETER; + + WRITE_VID32(SC1200_VIDEO_DOWNSCALER_COEFFICIENTS, + ((unsigned long)coef1 << SC1200_VIDEO_DOWNSCALER_COEF1_POS) | + ((unsigned long)coef2 << SC1200_VIDEO_DOWNSCALER_COEF2_POS) | + ((unsigned long)coef3 << SC1200_VIDEO_DOWNSCALER_COEF3_POS) | + ((unsigned long)coef4 << SC1200_VIDEO_DOWNSCALER_COEF4_POS)); + return (0); +} + +/*--------------------------------------------------------------------------- + * gfx_set_video_downscale_enable + * + * This routine enables or disables downscaling for the video overlay window. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +sc1200_set_video_downscale_enable(int enable) +#else +int +gfx_set_video_downscale_enable(int enable) +#endif +{ + unsigned long downscale; + + downscale = READ_VID32(SC1200_VIDEO_DOWNSCALER_CONTROL); + downscale &= ~SC1200_VIDEO_DOWNSCALE_ENABLE; + if (enable) + downscale |= SC1200_VIDEO_DOWNSCALE_ENABLE; + WRITE_VID32(SC1200_VIDEO_DOWNSCALER_CONTROL, downscale); + return (0); +} + +/*--------------------------------------------------------------------------- + * gfx_set_video_window + * + * This routine sets the position and size of the video overlay window. The + * y position is specified in screen relative coordinates, and may be negative. + * The size of destination region is specified in pixels. The line size + * indicates the number of bytes of source data per scanline. + * For the effect of negative x values, call the function + * gfx_set_video_left_crop(). + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +sc1200_set_video_window(short x, short y, unsigned short w, unsigned short h) +#else +int +gfx_set_video_window(short x, short y, unsigned short w, unsigned short h) +#endif +{ + unsigned long control; + unsigned long hadjust, vadjust; + unsigned long xstart, ystart, xend, yend; + + /* For left cropping call the function gfx_set_video_left_crop() */ + + if (x < 0) + return GFX_STATUS_BAD_PARAMETER; + + /* SAVE PARAMETERS */ + /* These are needed to call this routine if the scale value changes. */ + /* In the case of SC1200 they are also needed for restoring when video + * is re-enabled */ + + gfx_vid_xpos = x; + gfx_vid_ypos = y; + gfx_vid_width = w; + gfx_vid_height = h; + + /* GET ADJUSTMENT VALUES */ + /* Use routines to abstract version of display controller. */ + + hadjust = gfx_get_htotal() - gfx_get_hsync_end() - 14l; + vadjust = gfx_get_vtotal() - gfx_get_vsync_end() + 1l; + + /* HORIZONTAL START */ + + xstart = (unsigned long)x + hadjust; + + /* HORIZONTAL END */ + /* End positions in register are non-inclusive (one more than the actual + * end) */ + + if ((x + w) < gfx_get_hactive()) + xend = (unsigned long)x + (unsigned long)w + hadjust; + else /* right clipping needed */ + xend = (unsigned long)gfx_get_hactive() + hadjust; + + /* VERTICAL START */ + + ystart = (unsigned long)y + vadjust; + + /* VERTICAL END */ + + if ((y + h) < gfx_get_vactive()) + yend = (unsigned long)y + (unsigned long)h + vadjust; + else /* bottom clipping needed */ + yend = (unsigned long)gfx_get_vactive() + vadjust; + + /* SET VIDEO LINE INVERT BIT */ + + control = READ_VID32(SC1200_VID_ALPHA_CONTROL); + if (y & 0x1) + WRITE_VID32(SC1200_VID_ALPHA_CONTROL, + control | SC1200_VIDEO_LINE_OFFSET_ODD); + else + WRITE_VID32(SC1200_VID_ALPHA_CONTROL, + control & ~SC1200_VIDEO_LINE_OFFSET_ODD); + + /* SET VIDEO POSITION */ + + WRITE_VID32(SC1200_VIDEO_X_POS, (xend << 16) | xstart); + WRITE_VID32(SC1200_VIDEO_Y_POS, (yend << 16) | ystart); + + return (0); +} + +/*--------------------------------------------------------------------------- + * gfx_set_video_left_crop + * + * This routine sets the number of pixels which will be cropped from the + * beginning of each video line. The video window will begin to display only + * from the pixel following the cropped pixels, and the cropped pixels + * will be ignored. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +sc1200_set_video_left_crop(unsigned short x) +#else +int +gfx_set_video_left_crop(unsigned short x) +#endif +{ + unsigned long vcfg, initread; + + /* CLIPPING ON LEFT */ + /* Adjust initial read for scale, checking for divide by zero */ + + if (gfx_vid_dstw) + initread = (unsigned long)x *gfx_vid_srcw / gfx_vid_dstw; + + else + initread = 0l; + + /* SET INITIAL READ ADDRESS */ + + vcfg = READ_VID32(SC1200_VIDEO_CONFIG); + vcfg &= ~SC1200_VCFG_INIT_READ_MASK; + vcfg |= (initread << 15) & SC1200_VCFG_INIT_READ_MASK; + WRITE_VID32(SC1200_VIDEO_CONFIG, vcfg); + return (0); +} + +/*--------------------------------------------------------------------------- + * gfx_set_video_color_key + * + * This routine specifies the color key value and mask for the video overlay + * hardware. To disable color key, the color and mask should both be set to + * zero. The hardware uses the color key in the following equation: + * + * ((source data) & (color key mask)) == ((color key) & (color key mask)) + * + * If "graphics" is set to TRUE, the source data is graphics, and color key + * is an RGB value. If "graphics" is set to FALSE, the source data is the + * video, and color key is a YUV value. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +sc1200_set_video_color_key(unsigned long key, unsigned long mask, + int graphics) +#else +int +gfx_set_video_color_key(unsigned long key, unsigned long mask, int graphics) +#endif +{ + unsigned long dcfg = 0; + + /* SET SC1200 COLOR KEY VALUE */ + + WRITE_VID32(SC1200_VIDEO_COLOR_KEY, key); + WRITE_VID32(SC1200_VIDEO_COLOR_MASK, mask); + + /* SELECT GRAPHICS OR VIDEO DATA TO COMPARE TO THE COLOR KEY */ + + dcfg = READ_VID32(SC1200_DISPLAY_CONFIG); + if (graphics & 0x01) + dcfg &= ~SC1200_DCFG_VG_CK; + else + dcfg |= SC1200_DCFG_VG_CK; + WRITE_VID32(SC1200_DISPLAY_CONFIG, dcfg); + return (0); +} + +/*--------------------------------------------------------------------------- + * gfx_set_video_filter + * + * This routine enables or disables the video overlay filters. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +sc1200_set_video_filter(int xfilter, int yfilter) +#else +int +gfx_set_video_filter(int xfilter, int yfilter) +#endif +{ + unsigned long vcfg = 0; + + /* ENABLE OR DISABLE SC1200 VIDEO OVERLAY FILTERS */ + + vcfg = READ_VID32(SC1200_VIDEO_CONFIG); + vcfg &= ~(SC1200_VCFG_X_FILTER_EN | SC1200_VCFG_Y_FILTER_EN); + if (xfilter) + vcfg |= SC1200_VCFG_X_FILTER_EN; + if (yfilter) + vcfg |= SC1200_VCFG_Y_FILTER_EN; + WRITE_VID32(SC1200_VIDEO_CONFIG, vcfg); + return (0); +} + +/*--------------------------------------------------------------------------- + * gfx_set_video_palette + * + * This routine loads the video hardware palette. If a NULL pointer is + * specified, the palette is bypassed (for SC1200, this means loading the + * palette with identity values). + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +sc1200_set_video_palette(unsigned long *palette) +#else +int +gfx_set_video_palette(unsigned long *palette) +#endif +{ + unsigned long i, entry; + unsigned long dcfg, misc; + + /* WAIT FOR VERTICAL BLANK TO END */ + /* Otherwise palette will not be written properly. */ + + if (gfx_test_timing_active()) { + if (gfx_test_vertical_active()) { + while (gfx_test_vertical_active()) ; + } + while (!gfx_test_vertical_active()) ; + } + + /* LOAD SC1200 VIDEO PALETTE */ + + WRITE_VID32(SC1200_PALETTE_ADDRESS, 0); + for (i = 0; i < 256; i++) { + if (palette) + entry = palette[i]; + else + entry = gfx_gamma_ram_1200[i] << 8; + WRITE_VID32(SC1200_PALETTE_DATA, entry); + } + + /* ENABLE THE VIDEO PALETTE */ + /* Ensure that the video palette has an effect by routing video data */ + /* through the palette RAM and clearing the 'Bypass Both' bit. */ + + dcfg = READ_VID32(SC1200_DISPLAY_CONFIG); + misc = READ_VID32(SC1200_VID_MISC); + + dcfg |= SC1200_DCFG_GV_PAL_BYP; + misc &= ~SC1200_GAMMA_BYPASS_BOTH; + + WRITE_VID32(SC1200_DISPLAY_CONFIG, dcfg); + WRITE_VID32(SC1200_VID_MISC, misc); + + return (0); +} + +/*--------------------------------------------------------------------------- + * gfx_set_video_palette_entry + * + * This routine loads a single entry of the video hardware palette. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +sc1200_set_video_palette_entry(unsigned long index, unsigned long palette) +#else +int +gfx_set_video_palette_entry(unsigned long index, unsigned long palette) +#endif +{ + unsigned long dcfg, misc; + + if (index > 0xFF) + return GFX_STATUS_BAD_PARAMETER; + + /* WAIT FOR VERTICAL BLANK TO END */ + /* Otherwise palette will not be written properly. */ + + if (gfx_test_timing_active()) { + if (gfx_test_vertical_active()) { + while (gfx_test_vertical_active()) ; + } + while (!gfx_test_vertical_active()) ; + } + + /* SET A SINGLE ENTRY */ + + WRITE_VID32(SC1200_PALETTE_ADDRESS, index); + WRITE_VID32(SC1200_PALETTE_DATA, palette); + + /* ENABLE THE VIDEO PALETTE */ + /* Ensure that the video palette has an effect by routing video data */ + /* through the palette RAM and clearing the 'Bypass Both' bit. */ + + dcfg = READ_VID32(SC1200_DISPLAY_CONFIG); + misc = READ_VID32(SC1200_VID_MISC); + + dcfg |= SC1200_DCFG_GV_PAL_BYP; + misc &= ~SC1200_GAMMA_BYPASS_BOTH; + + WRITE_VID32(SC1200_DISPLAY_CONFIG, dcfg); + WRITE_VID32(SC1200_VID_MISC, misc); + + return (0); +} + +/*--------------------------------------------------------------------------- + * gfx_set_video_palette_bypass + * + * This routine enables/disables the pallete RAM bypass. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +sc1200_set_video_palette_bypass(int enable) +#else +int +gfx_set_video_palette_bypass(int enable) +#endif +{ + unsigned long misc; + + misc = READ_VID32(SC1200_VID_MISC); + + if (enable) + misc |= SC1200_GAMMA_BYPASS_BOTH; + else + misc &= ~SC1200_GAMMA_BYPASS_BOTH; + + WRITE_VID32(SC1200_VID_MISC, misc); + + return 0; +} + +/*--------------------------------------------------------------------------- + * gfx_set_video_request() + * + * This routine sets the horizontal (pixel) and vertical (line) video request + * values. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +sc1200_set_video_request(short x, short y) +#else +int +gfx_set_video_request(short x, short y) +#endif +{ + /* SET SC1200 VIDEO REQUEST */ + + x += gfx_get_htotal() - gfx_get_hsync_end() - 2; + y += gfx_get_vtotal() - gfx_get_vsync_end() + 1; + + if ((x < 0) || (x > SC1200_VIDEO_REQUEST_MASK) || + (y < 0) || (y > SC1200_VIDEO_REQUEST_MASK)) + return GFX_STATUS_BAD_PARAMETER; + + WRITE_VID32(SC1200_VIDEO_REQUEST, + ((unsigned long)x << SC1200_VIDEO_X_REQUEST_POS) | ((unsigned long)y + << SC1200_VIDEO_Y_REQUEST_POS)); + return (0); +} + +/*--------------------------------------------------------------------------- + * gfx_set_video_source() + * + * This routine sets the video source to either memory or Direct VIP. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +sc1200_set_video_source(VideoSourceType source) +#else +int +gfx_set_video_source(VideoSourceType source) +#endif +{ + unsigned long display_mode; + + display_mode = READ_VID32(SC1200_VIDEO_DISPLAY_MODE); + + /* SET SC1200 VIDEO SOURCE */ + switch (source) { + case VIDEO_SOURCE_MEMORY: + WRITE_VID32(SC1200_VIDEO_DISPLAY_MODE, + (display_mode & ~SC1200_VIDEO_SOURCE_MASK) | + SC1200_VIDEO_SOURCE_GX1); + break; + case VIDEO_SOURCE_DVIP: + WRITE_VID32(SC1200_VIDEO_DISPLAY_MODE, + (display_mode & ~SC1200_VIDEO_SOURCE_MASK) | + SC1200_VIDEO_SOURCE_DVIP); + break; + default: + return GFX_STATUS_BAD_PARAMETER; + } + return (0); +} + +/*--------------------------------------------------------------------------- + * gfx_set_vbi_source() + * + * This routine sets the vbi source to either memory or Direct VIP. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +sc1200_set_vbi_source(VbiSourceType source) +#else +int +gfx_set_vbi_source(VbiSourceType source) +#endif +{ + unsigned long display_mode; + + display_mode = READ_VID32(SC1200_VIDEO_DISPLAY_MODE); + + /* SET SC1200 VBI SOURCE */ + switch (source) { + case VBI_SOURCE_MEMORY: + WRITE_VID32(SC1200_VIDEO_DISPLAY_MODE, + (display_mode & ~SC1200_VBI_SOURCE_MASK) | SC1200_VBI_SOURCE_GX1); + break; + case VBI_SOURCE_DVIP: + WRITE_VID32(SC1200_VIDEO_DISPLAY_MODE, + (display_mode & ~SC1200_VBI_SOURCE_MASK) | + SC1200_VBI_SOURCE_DVIP); + break; + default: + return GFX_STATUS_BAD_PARAMETER; + } + return (0); +} + +/*--------------------------------------------------------------------------- + * gfx_set_vbi_lines() + * + * This routine sets the VBI lines to pass to the TV encoder. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +sc1200_set_vbi_lines(unsigned long even, unsigned long odd) +#else +int +gfx_set_vbi_lines(unsigned long even, unsigned long odd) +#endif +{ + /* SET SC1200 VBI LINES */ + WRITE_VID32(SC1200_VIDEO_EVEN_VBI_LINE_ENABLE, + even & SC1200_VIDEO_VBI_LINE_ENABLE_MASK); + WRITE_VID32(SC1200_VIDEO_ODD_VBI_LINE_ENABLE, + odd & SC1200_VIDEO_VBI_LINE_ENABLE_MASK); + return (0); +} + +/*--------------------------------------------------------------------------- + * gfx_set_vbi_total() + * + * This routine sets the total number of VBI bytes for each field. + * The total is needed when both VBI and active video are received from memory + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +sc1200_set_vbi_total(unsigned long even, unsigned long odd) +#else +int +gfx_set_vbi_total(unsigned long even, unsigned long odd) +#endif +{ + /* SET SC1200 VBI TOTAL */ + WRITE_VID32(SC1200_VIDEO_EVEN_VBI_TOTAL_COUNT, + even & SC1200_VIDEO_VBI_TOTAL_COUNT_MASK); + WRITE_VID32(SC1200_VIDEO_ODD_VBI_TOTAL_COUNT, + odd & SC1200_VIDEO_VBI_TOTAL_COUNT_MASK); + return (0); +} + +/*--------------------------------------------------------------------------- + * gfx_set_video_interlaced() + * + * This routine configures the video processor video overlay mode to be + * interlaced YUV. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +sc1200_set_video_interlaced(int enable) +#else +int +gfx_set_video_interlaced(int enable) +#endif +{ + unsigned long control; + + control = READ_VID32(SC1200_VID_ALPHA_CONTROL); + /* SET INTERLACED VIDEO */ + if (enable) + WRITE_VID32(SC1200_VID_ALPHA_CONTROL, + control | SC1200_VIDEO_IS_INTERLACED); + else + WRITE_VID32(SC1200_VID_ALPHA_CONTROL, + control & ~SC1200_VIDEO_IS_INTERLACED); + return (0); +} + +/*--------------------------------------------------------------------------- + * gfx_set_color_space_YUV() + * + * This routine configures the video processor to process graphics and video + * in either YUV or RGB color space. The mode should be set to tune image + * quality. + * Setting "enable" to TRUE improves image quality on TV, + * but in this mode colors on CRT will not be correct. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +sc1200_set_color_space_YUV(int enable) +#else +int +gfx_set_color_space_YUV(int enable) +#endif +{ + unsigned long control; + + control = READ_VID32(SC1200_VID_ALPHA_CONTROL); + + /* SET SC1200 VIDEO COLOR SPACE TO YUV OR RGB */ + + if (enable) { + /* ENABLE YUV BLENDING */ + /* YUV blending cannot be enabled in RGB video formats */ + + control |= SC1200_CSC_GFX_RGB_TO_YUV; /* Convert graphics to YUV */ + control &= ~SC1200_CSC_VIDEO_YUV_TO_RGB; /* Leave video in YUV */ + + if (control & SC1200_VIDEO_INPUT_IS_RGB) + return (GFX_STATUS_UNSUPPORTED); /* Can't convert video from + * RGB to YUV */ + } else { + /* RGB BLENDING */ + + control &= ~SC1200_CSC_GFX_RGB_TO_YUV; /* Leave graphics in RGB */ + if (control & SC1200_VIDEO_INPUT_IS_RGB) + control &= ~SC1200_CSC_VIDEO_YUV_TO_RGB; /* Leave video in RGB */ + else + control |= SC1200_CSC_VIDEO_YUV_TO_RGB; /* Convert video to RGB */ + } + WRITE_VID32(SC1200_VID_ALPHA_CONTROL, control); + return (0); +} + +/*--------------------------------------------------------------------------- + * gfx_set_vertical_scaler_offset() + * + * This routine sets the value by which the odd frame is shifted with respect + * to the even frame. This is useful for de-interlacing in Bob method, by + * setting the shift value to be one line. + * If offset is 0, no shifting occurs. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +sc1200_set_vertical_scaler_offset(char offset) +#else +int +gfx_set_vertical_scaler_offset(char offset) +#endif +{ + unsigned long control; + + control = READ_VID32(SC1200_VID_ALPHA_CONTROL); + if (offset == 1) { + control &= ~SC1200_VERTICAL_SCALER_SHIFT_MASK; + /* Clear shifting value */ + control |= SC1200_VERTICAL_SCALER_SHIFT_INIT; + /* Set shifting value */ + control |= SC1200_VERTICAL_SCALER_SHIFT_EN; + /* Enable odd frame shifting */ + } else if (offset == 0) { + control &= ~SC1200_VERTICAL_SCALER_SHIFT_EN; + /* No shifting occurs */ + control &= ~SC1200_VERTICAL_SCALER_SHIFT_MASK; + /* Clear shifting value */ + } else + return (GFX_STATUS_BAD_PARAMETER); + /* TODO: how to program other values ? */ + WRITE_VID32(SC1200_VID_ALPHA_CONTROL, control); + return (0); +} + +/*--------------------------------------------------------------------------- + * gfx_set_top_line_in_odd() + * + * This routine sets the field in which the top line of input video resides. + * If enable is "0", this is the even field (default). [not to be confused + * with the odd field being the top field on TV]. + * If enable is "1", this is the odd field. + * Use enable "1" for input devices whose field indication is reversed from + * normal, i.e. an indication of "odd" field is given for even field data, + * and vice versa. + * This setting affects the video processor only when it is in either + * interlaced or Bob (scaler offset active) modes. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +sc1200_set_top_line_in_odd(int enable) +#else +int +gfx_set_top_line_in_odd(int enable) +#endif +{ + unsigned long control; + + control = READ_VID32(SC1200_VID_ALPHA_CONTROL); + if (enable) + control |= SC1200_TOP_LINE_IN_ODD; /* Set shifting value */ + else + control &= ~SC1200_TOP_LINE_IN_ODD; /* No shifting occurs */ + WRITE_VID32(SC1200_VID_ALPHA_CONTROL, control); + return (0); +} + +/*--------------------------------------------------------------------------- + * gfx_set_genlock_delay() + * + * This routine sets the delay between VIP VSYNC and display controller VSYNC. + * The delay is in 27 MHz clocks. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +sc1200_set_genlock_delay(unsigned long delay) +#else +int +gfx_set_genlock_delay(unsigned long delay) +#endif +{ + /* SET SC1200 GENLOCK DELAY */ + WRITE_VID32(SC1200_GENLOCK_DELAY, delay & SC1200_GENLOCK_DELAY_MASK); + return (0); +} + +/*--------------------------------------------------------------------------- + * gfx_set_genlock_enable() + * + * This routine sets and configures the genlock according to the flags + * parameter. + * Flags value of 0 disables genlock and resets its configuration. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +sc1200_set_genlock_enable(int flags) +#else +int +gfx_set_genlock_enable(int flags) +#endif +{ + unsigned long genlock = 0; + + if (flags) { + /* SET SC1200 GENLOCK CONFIGURATION */ + if (flags & GENLOCK_SINGLE) + genlock |= SC1200_GENLOCK_SINGLE_ENABLE; + if (flags & GENLOCK_FIELD_SYNC) + genlock |= SC1200_GENLOCK_FIELD_SYNC_ENABLE; + if (flags & GENLOCK_CONTINUOUS) + genlock |= SC1200_GENLOCK_CONTINUOUS_ENABLE; + if (flags & GENLOCK_SYNCED_EDGE_FALLING) + genlock |= SC1200_GENLOCK_GX_VSYNC_FALLING_EDGE; + if (flags & GENLOCK_SYNCING_EDGE_FALLING) + genlock |= SC1200_GENLOCK_VIP_VSYNC_FALLING_EDGE; + if (flags & GENLOCK_TIMEOUT) + genlock |= SC1200_GENLOCK_TIMEOUT_ENABLE; + if (flags & GENLOCK_TVENC_RESET_EVEN_FIELD) + genlock |= SC1200_GENLOCK_TVENC_RESET_EVEN_FIELD; + if (flags & GENLOCK_TVENC_RESET_BEFORE_DELAY) + genlock |= SC1200_GENLOCK_TVENC_RESET_BEFORE_DELAY; + if (flags & GENLOCK_TVENC_RESET) + genlock |= SC1200_GENLOCK_TVENC_RESET_ENABLE; + if (flags & GENLOCK_SYNC_TO_TVENC) + genlock |= SC1200_GENLOCK_SYNC_TO_TVENC; + } + WRITE_VID32(SC1200_GENLOCK, genlock); + return (0); +} + +/*--------------------------------------------------------------------------- + * gfx_set_video_cursor() + * + * This routine configures the video hardware cursor. + * If the "mask"ed bits in the graphics pixel match "key", then either + * "color1" or "color2" will be used for this pixel, according to the value of + * bit number "select_color2" of the graphics pixel. + * + * key - 24 bit RGB value + * mask - 24 bit mask + * color1, color2 - RGB or YUV, depending on the current color space + * conversion select_color2 - value between 0 to 23 + * + * To disable match, a "mask" and "key" value of 0xffffff should be set, + * because the graphics pixels incoming to the video processor have maximum 16 + * bits set (0xF8FCF8). + * + * This feature is useful for disabling alpha blending of the cursor. + * Otherwise cursor image would be blurred (or completely invisible if video + * alpha is maximum value). + * Note: the cursor pixel replacements take place both inside and outside the + * video overlay window. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +sc1200_set_video_cursor(unsigned long key, unsigned long mask, + unsigned short select_color2, unsigned long color1, unsigned long color2) +#else +int +gfx_set_video_cursor(unsigned long key, unsigned long mask, + unsigned short select_color2, unsigned long color1, unsigned long color2) +#endif +{ + if (select_color2 > SC1200_CURSOR_COLOR_BITS) + return GFX_STATUS_BAD_PARAMETER; + key = + (key & SC1200_COLOR_MASK) | ((unsigned long)select_color2 << + SC1200_CURSOR_COLOR_KEY_OFFSET_POS); + WRITE_VID32(SC1200_CURSOR_COLOR_KEY, key); + WRITE_VID32(SC1200_CURSOR_COLOR_MASK, mask); + WRITE_VID32(SC1200_CURSOR_COLOR_1, color1); + WRITE_VID32(SC1200_CURSOR_COLOR_2, color2); + return (0); +} + +/*--------------------------------------------------------------------------- + * gfx_set_alpha_enable + * + * This routine enables or disables the currently selected alpha region. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +sc1200_set_alpha_enable(int enable) +#else +int +gfx_set_alpha_enable(int enable) +#endif +{ + unsigned long address = 0, value = 0; + + if (gfx_alpha_select > 2) + return (GFX_STATUS_UNSUPPORTED); + address = SC1200_ALPHA_CONTROL_1 + ((unsigned long)gfx_alpha_select << 4); + value = READ_VID32(address); + if (enable) + value |= (SC1200_ACTRL_WIN_ENABLE | SC1200_ACTRL_LOAD_ALPHA); + else + value &= ~(SC1200_ACTRL_WIN_ENABLE); + WRITE_VID32(address, value); + return (GFX_STATUS_OK); +} + +/*--------------------------------------------------------------------------- + * gfx_set_alpha_window + * + * This routine sets the size of the currently selected alpha region. + * Note: "x" and "y" are signed to enable using negative values needed for + * implementing workarounds of hardware issues. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +sc1200_set_alpha_window(short x, short y, + unsigned short width, unsigned short height) +#else +int +gfx_set_alpha_window(short x, short y, + unsigned short width, unsigned short height) +#endif +{ + unsigned long address = 0; + + /* CHECK FOR CLIPPING */ + + if ((x + width) > gfx_get_hactive()) + width = gfx_get_hactive() - x; + if ((y + height) > gfx_get_vactive()) + height = gfx_get_vactive() - y; + + /* ADJUST POSITIONS */ + + x += gfx_get_htotal() - gfx_get_hsync_end() - 2; + y += gfx_get_vtotal() - gfx_get_vsync_end() + 1; + + if (gfx_alpha_select > 2) + return (GFX_STATUS_UNSUPPORTED); + address = SC1200_ALPHA_XPOS_1 + ((unsigned long)gfx_alpha_select << 4); + + /* End positions in register are non-inclusive (one more than the actual + * end) */ + + WRITE_VID32(address, (unsigned long)x | + ((unsigned long)(x + width) << 16)); + WRITE_VID32(address + 4l, (unsigned long)y | + ((unsigned long)(y + height) << 16)); + return (GFX_STATUS_OK); +} + +/*--------------------------------------------------------------------------- + * gfx_set_alpha_value + * + * This routine sets the alpha value for the currently selected alpha + * region. It also specifies an increment/decrement value for fading. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +sc1200_set_alpha_value(unsigned char alpha, char delta) +#else +int +gfx_set_alpha_value(unsigned char alpha, char delta) +#endif +{ + unsigned long address = 0, value = 0; + unsigned char new_value = 0; + int loop = 1; + + if (gfx_alpha_select > 2) + return (GFX_STATUS_UNSUPPORTED); + address = SC1200_ALPHA_CONTROL_1 + ((unsigned long)gfx_alpha_select << 4); + value = READ_VID32(address); + value &= SC1200_ACTRL_WIN_ENABLE; /* keep only enable bit */ + value |= (unsigned long)alpha; + value |= (((unsigned long)delta) & 0xff) << 8; + value |= SC1200_ACTRL_LOAD_ALPHA; + WRITE_VID32(address, value); + + /* WORKAROUND FOR ISSUE #1187 */ + /* Need to verify that the alpha operation succeeded */ + + while (1) { + /* WAIT FOR VERTICAL BLANK TO END */ + if (gfx_test_timing_active()) { + if (gfx_test_vertical_active()) + while (gfx_test_vertical_active()) ; + while (!gfx_test_vertical_active()) ; + } + new_value = + (unsigned char)((READ_VID32(SC1200_ALPHA_WATCH) >> + (gfx_alpha_select << 3)) & 0xff); + if (new_value == alpha) + return GFX_STATUS_OK; + if (++loop > 10) + return GFX_STATUS_ERROR; + WRITE_VID32(address, value); + } +} + +/*--------------------------------------------------------------------------- + * gfx_set_alpha_priority + * + * This routine sets the priority of the currently selected alpha region. + * A higher value indicates a higher priority. + * Note: Priority of enabled alpha windows must be different. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +sc1200_set_alpha_priority(int priority) +#else +int +gfx_set_alpha_priority(int priority) +#endif +{ + unsigned long pos = 0, value = 0; + + if (priority > 3) + return (GFX_STATUS_BAD_PARAMETER); + if (gfx_alpha_select > 2) + return (GFX_STATUS_UNSUPPORTED); + value = READ_VID32(SC1200_VID_ALPHA_CONTROL); + pos = 16 + (gfx_alpha_select << 1); + value &= ~(0x03l << pos); + value |= (unsigned long)priority << pos; + WRITE_VID32(SC1200_VID_ALPHA_CONTROL, value); + return (GFX_STATUS_OK); +} + +/*--------------------------------------------------------------------------- + * gfx_set_alpha_color + * + * This routine sets the color to be displayed inside the currently selected + * alpha window when there is a color key match (when the alpha color + * mechanism is enabled). + * "color" is a 24 bit RGB value (for RGB blending) or YUV value (for YUV + * blending). + * In Interlaced YUV blending mode, Y/2 value should be used. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +sc1200_set_alpha_color(unsigned long color) +#else +int +gfx_set_alpha_color(unsigned long color) +#endif +{ + unsigned long address = 0; + + if (gfx_alpha_select > 2) + return (GFX_STATUS_UNSUPPORTED); + address = SC1200_ALPHA_COLOR_1 + ((unsigned long)gfx_alpha_select << 4); + + /* ONLY 24 VALID BITS */ + color &= 0xffffffl; + + /* KEEP UPPER BYTE UNCHANGED */ + WRITE_VID32(address, (color | (READ_VID32(address) & ~0xffffffl))); + return (GFX_STATUS_OK); +} + +/*--------------------------------------------------------------------------- + * gfx_set_alpha_color_enable + * + * Enable or disable the color mechanism in the alpha window. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +sc1200_set_alpha_color_enable(int enable) +#else +int +gfx_set_alpha_color_enable(int enable) +#endif +{ + unsigned long color; + unsigned long address = 0; + + if (gfx_alpha_select > 2) + return (GFX_STATUS_UNSUPPORTED); + address = SC1200_ALPHA_COLOR_1 + ((unsigned long)gfx_alpha_select << 4); + color = READ_VID32(address); + if (enable) + color |= SC1200_ALPHA_COLOR_ENABLE; + else + color &= ~SC1200_ALPHA_COLOR_ENABLE; + WRITE_VID32(address, color); + return (GFX_STATUS_OK); +} + +/*--------------------------------------------------------------------------- + * gfx_set_no_ck_outside_alpha + * + * This function affects where inside the video window color key or chroma + * key comparison is done: + * If enable is TRUE, color/chroma key comparison is performed only inside + * the enabled alpha windows. Outside the (enabled) alpha windows, only video + * is displayed if color key is used, and only graphics is displayed if chroma + * key is used. + * If enable is FALSE, color/chroma key comparison is performed in all the + * video window area. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +sc1200_set_no_ck_outside_alpha(int enable) +#else +int +gfx_set_no_ck_outside_alpha(int enable) +#endif +{ + unsigned long value; + + value = READ_VID32(SC1200_VID_ALPHA_CONTROL); + if (enable) + WRITE_VID32(SC1200_VID_ALPHA_CONTROL, + value | SC1200_NO_CK_OUTSIDE_ALPHA); + else + WRITE_VID32(SC1200_VID_ALPHA_CONTROL, + value & ~SC1200_NO_CK_OUTSIDE_ALPHA); + return (0); +} + +/*--------------------------------------------------------------------------- + * gfx_set_macrovision_enable + * + * This routine enables or disables macrovision on the tv encoder output. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +sc1200_set_macrovision_enable(int enable) +#else +int +gfx_set_macrovision_enable(int enable) +#endif +{ + if (enable) + WRITE_VID32(SC1200_TVENC_MV_CONTROL, SC1200_TVENC_MV_ENABLE); + else + WRITE_VID32(SC1200_TVENC_MV_CONTROL, 0); + return (GFX_STATUS_OK); +} + +#define SC1200_VIDEO_PCI_44 0x80009444 + +/*--------------------------------------------------------------------------- + * gfx_disable_softvga + * + * Disables SoftVga. This function is only valid with VSA2, Returns 1 if + * SoftVga can be disabled; 0 if not. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +sc1200_disable_softvga(void) +#else +int +gfx_disable_softvga(void) +#endif +{ + unsigned long reg_val; + + /* get the current value */ + reg_val = gfx_pci_config_read(SC1200_VIDEO_PCI_44); + /* setting video PCI register 44 bit 0 to 1 disables SoftVga */ + reg_val |= 0x1; + gfx_pci_config_write(SC1200_VIDEO_PCI_44, reg_val); + + /* see if we set the bit and return the appropriate value */ + reg_val = gfx_pci_config_read(SC1200_VIDEO_PCI_44); + if ((reg_val & 0x1) == 0x1) + return (1); + else + return (0); +} + +/*--------------------------------------------------------------------------- + * gfx_enable_softvga + * + * Enables SoftVga. This function is only valid with VSA2, Returns 1 if + * SoftVga can be enbled; 0 if not. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +sc1200_enable_softvga(void) +#else +int +gfx_enable_softvga(void) +#endif +{ + unsigned long reg_val; + + /* get the current value */ + reg_val = gfx_pci_config_read(SC1200_VIDEO_PCI_44); + /* clearing video PCI register 44 bit 0 enables SoftVga */ + gfx_pci_config_write(SC1200_VIDEO_PCI_44, reg_val & 0xfffffffel); + + /* see if we cleared the bit and return the appropriate value */ + reg_val = gfx_pci_config_read(SC1200_VIDEO_PCI_44); + if ((reg_val & 0x1) == 0) + return (1); + else + return (0); +} + +/*--------------------------------------------------------------------------- + * gfx_get_clock_frequency + * + * This routine returns the current clock frequency in 16.16 format. + * It reads the current register value and finds the match in the table. + * If no match is found, this routine returns 0. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +unsigned long +sc1200_get_clock_frequency(void) +#else +unsigned long +gfx_get_clock_frequency(void) +#endif +{ + unsigned int index; + unsigned long value, mask; + + mask = 0x007FFF0F; + value = READ_VID32(SC1200_VID_CLOCK_SELECT) & mask; + for (index = 0; index < NUM_SC1200_FREQUENCIES; index++) { + if ((gfx_sc1200_clock_table[index].clock_select & mask) == value) + return (gfx_sc1200_clock_table[index].frequency); + } + return (0); +} + +/*--------------------------------------------------------------------------- + * gfx_get_max_video_width + * + * This routine returns the maximum theoretical video width for the current + * display mode. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +unsigned long +sc1200_get_max_video_width(void) +#else +unsigned long +gfx_get_max_video_width(void) +#endif +{ + /* RETURN MPEG2 MAXIMUM */ + + return 720; +} + +/*************************************************************/ +/* READ ROUTINES | INCLUDED FOR DIAGNOSTIC PURPOSES ONLY */ +/*************************************************************/ + +#if GFX_READ_ROUTINES + +/*--------------------------------------------------------------------------- + * gfx_get_vsa2_softvga_enable + * + * This function returns the enable status of SoftVGA. It is valid + * only if VSAII is present. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +sc1200_get_vsa2_softvga_enable(void) +#else +int +gfx_get_vsa2_softvga_enable(void) +#endif +{ + unsigned long reg_val; + + reg_val = gfx_pci_config_read(SC1200_VIDEO_PCI_44); + if ((reg_val & 0x1) == 0) + return (1); + else + return (0); + +} + +/*--------------------------------------------------------------------------- + * gfx_get_sync_polarities + * + * This routine returns the polarities of the sync pulses: + * Bit 0: Set if negative horizontal polarity. + * Bit 1: Set if negative vertical polarity. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +sc1200_get_sync_polarities(void) +#else +int +gfx_get_sync_polarities(void) +#endif +{ + int polarities = 0; + + if (READ_VID32(SC1200_DISPLAY_CONFIG) & SC1200_DCFG_CRT_HSYNC_POL) + polarities |= 1; + if (READ_VID32(SC1200_DISPLAY_CONFIG) & SC1200_DCFG_CRT_VSYNC_POL) + polarities |= 2; + return (polarities); +} + +/*--------------------------------------------------------------------------- + * gfx_get_video_palette_entry + * + * This routine returns a single palette entry. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +sc1200_get_video_palette_entry(unsigned long index, unsigned long *palette) +#else +int +gfx_get_video_palette_entry(unsigned long index, unsigned long *palette) +#endif +{ + if (index > 0xFF) + return GFX_STATUS_BAD_PARAMETER; + + /* READ A SINGLE ENTRY */ + + WRITE_VID32(SC1200_PALETTE_ADDRESS, index); + *palette = READ_VID32(SC1200_PALETTE_DATA); + + return (GFX_STATUS_OK); +} + +/*----------------------------------------------------------------------------- + * gfx_get_video_enable + * + * This routine returns the value "one" if video overlay is currently enabled, + * otherwise it returns the value "zero". + *----------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +sc1200_get_video_enable(void) +#else +int +gfx_get_video_enable(void) +#endif +{ + if (READ_VID32(SC1200_VIDEO_CONFIG) & SC1200_VCFG_VID_EN) + return (1); + return (0); +} + +/*----------------------------------------------------------------------------- + * gfx_get_video_format + * + * This routine returns the current video overlay format. + *----------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +sc1200_get_video_format(void) +#else +int +gfx_get_video_format(void) +#endif +{ + unsigned long ctrl, vcfg; + + ctrl = READ_VID32(SC1200_VID_ALPHA_CONTROL); + vcfg = READ_VID32(SC1200_VIDEO_CONFIG); + + if (ctrl & SC1200_VIDEO_INPUT_IS_RGB) { + switch (vcfg & SC1200_VCFG_VID_INP_FORMAT) { + case SC1200_VCFG_UYVY_FORMAT: + return VIDEO_FORMAT_RGB; + case SC1200_VCFG_Y2YU_FORMAT: + return VIDEO_FORMAT_P2M_P2L_P1M_P1L; + case SC1200_VCFG_YUYV_FORMAT: + return VIDEO_FORMAT_P1M_P1L_P2M_P2L; + case SC1200_VCFG_YVYU_FORMAT: + return VIDEO_FORMAT_P1M_P2L_P2M_P1L; + } + } + + if (vcfg & SC1200_VCFG_4_2_0_MODE) { + switch (vcfg & SC1200_VCFG_VID_INP_FORMAT) { + case SC1200_VCFG_UYVY_FORMAT: + return VIDEO_FORMAT_Y0Y1Y2Y3; + case SC1200_VCFG_Y2YU_FORMAT: + return VIDEO_FORMAT_Y3Y2Y1Y0; + case SC1200_VCFG_YUYV_FORMAT: + return VIDEO_FORMAT_Y1Y0Y3Y2; + case SC1200_VCFG_YVYU_FORMAT: + return VIDEO_FORMAT_Y1Y2Y3Y0; + } + } else { + switch (vcfg & SC1200_VCFG_VID_INP_FORMAT) { + case SC1200_VCFG_UYVY_FORMAT: + return VIDEO_FORMAT_UYVY; + case SC1200_VCFG_Y2YU_FORMAT: + return VIDEO_FORMAT_Y2YU; + case SC1200_VCFG_YUYV_FORMAT: + return VIDEO_FORMAT_YUYV; + case SC1200_VCFG_YVYU_FORMAT: + return VIDEO_FORMAT_YVYU; + } + } + return (GFX_STATUS_ERROR); +} + +/*---------------------------------------------------------------------------- + * gfx_get_video_src_size + * + * This routine returns the size of the source video overlay buffer. The + * return value is (height << 16) | width. + *---------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +unsigned long +sc1200_get_video_src_size(void) +#else +unsigned long +gfx_get_video_src_size(void) +#endif +{ + unsigned long width = 0, height = 0; + + /* DETERMINE SOURCE WIDTH FROM THE SC1200 VIDEO LINE SIZE */ + + width = (READ_VID32(SC1200_VIDEO_CONFIG) >> 7) & 0x000001FE; + if (READ_VID32(SC1200_VIDEO_CONFIG) & SC1200_VCFG_LINE_SIZE_UPPER) + width += 512l; + + if (width) { + /* DETERMINE HEIGHT BY DIVIDING TOTAL SIZE BY WIDTH */ + /* Get total size from display controller - abtracted. */ + + height = gfx_get_display_video_size() / (width << 1); + } + return ((height << 16) | width); +} + +/*---------------------------------------------------------------------------- + * gfx_get_video_line_size + * + * This routine returns the line size of the source video overlay buffer, in + * pixels. + *---------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +unsigned long +sc1200_get_video_line_size(void) +#else +unsigned long +gfx_get_video_line_size(void) +#endif +{ + unsigned long width = 0; + + /* DETERMINE SOURCE WIDTH FROM THE SC1200 VIDEO LINE SIZE */ + + width = (READ_VID32(SC1200_VIDEO_CONFIG) >> 7) & 0x000001FE; + if (READ_VID32(SC1200_VIDEO_CONFIG) & SC1200_VCFG_LINE_SIZE_UPPER) + width += 512l; + return (width); +} + +/*---------------------------------------------------------------------------- + * gfx_get_video_xclip + * + * This routine returns the number of bytes clipped on the left side of a + * video overlay line (skipped at beginning). + *---------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +unsigned long +sc1200_get_video_xclip(void) +#else +unsigned long +gfx_get_video_xclip(void) +#endif +{ + unsigned long clip = 0; + + /* DETERMINE SOURCE WIDTH FROM THE SC1200 VIDEO LINE SIZE */ + + clip = (READ_VID32(SC1200_VIDEO_CONFIG) >> 14) & 0x000007FC; + return (clip); +} + +/*---------------------------------------------------------------------------- + * gfx_get_video_offset + * + * This routine returns the current offset for the video overlay buffer. + *---------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +unsigned long +sc1200_get_video_offset(void) +#else +unsigned long +gfx_get_video_offset(void) +#endif +{ + return (gfx_get_display_video_offset()); +} + +/*--------------------------------------------------------------------------- + * gfx_get_video_upscale + * + * This routine returns the scale factor for the video overlay window. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +unsigned long +sc1200_get_video_upscale(void) +#else +unsigned long +gfx_get_video_upscale(void) +#endif +{ + return (READ_VID32(SC1200_VIDEO_UPSCALE)); +} + +/*--------------------------------------------------------------------------- + * gfx_get_video_scale + * + * This routine returns the scale factor for the video overlay window. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +unsigned long +sc1200_get_video_scale(void) +#else +unsigned long +gfx_get_video_scale(void) +#endif +{ + return gfx_get_video_upscale(); +} + +/*--------------------------------------------------------------------------- + * gfx_get_video_downscale_config + * + * This routine returns the current type and value of video downscaling. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +sc1200_get_video_downscale_config(unsigned short *type, unsigned short *m) +#else +int +gfx_get_video_downscale_config(unsigned short *type, unsigned short *m) +#endif +{ + unsigned long downscale; + + downscale = READ_VID32(SC1200_VIDEO_DOWNSCALER_CONTROL); + *m = (unsigned short)((downscale & SC1200_VIDEO_DOWNSCALE_FACTOR_MASK) >> + SC1200_VIDEO_DOWNSCALE_FACTOR_POS) + 1; + + switch (downscale & SC1200_VIDEO_DOWNSCALE_TYPE_MASK) { + case SC1200_VIDEO_DOWNSCALE_TYPE_A: + *type = VIDEO_DOWNSCALE_KEEP_1_OF; + break; + case SC1200_VIDEO_DOWNSCALE_TYPE_B: + *type = VIDEO_DOWNSCALE_DROP_1_OF; + break; + default: + return GFX_STATUS_ERROR; + break; + } + return (0); +} + +/*--------------------------------------------------------------------------- + * gfx_get_video_downscale_coefficients + * + * This routine returns the current video downscaling coefficients. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +void +sc1200_get_video_downscale_coefficients(unsigned short *coef1, + unsigned short *coef2, unsigned short *coef3, unsigned short *coef4) +#else +void +gfx_get_video_downscale_coefficients(unsigned short *coef1, + unsigned short *coef2, unsigned short *coef3, unsigned short *coef4) +#endif +{ + unsigned long coef; + + coef = READ_VID32(SC1200_VIDEO_DOWNSCALER_COEFFICIENTS); + *coef1 = + (unsigned short)((coef >> SC1200_VIDEO_DOWNSCALER_COEF1_POS) & + SC1200_VIDEO_DOWNSCALER_COEF_MASK); + *coef2 = + (unsigned short)((coef >> SC1200_VIDEO_DOWNSCALER_COEF2_POS) & + SC1200_VIDEO_DOWNSCALER_COEF_MASK); + *coef3 = + (unsigned short)((coef >> SC1200_VIDEO_DOWNSCALER_COEF3_POS) & + SC1200_VIDEO_DOWNSCALER_COEF_MASK); + *coef4 = + (unsigned short)((coef >> SC1200_VIDEO_DOWNSCALER_COEF4_POS) & + SC1200_VIDEO_DOWNSCALER_COEF_MASK); + return; +} + +/*--------------------------------------------------------------------------- + * gfx_get_video_downscale_enable + * + * This routine returns 1 if video downscaling is currently enabled, + * or 0 if it is currently disabled. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +void +sc1200_get_video_downscale_enable(int *enable) +#else +void +gfx_get_video_downscale_enable(int *enable) +#endif +{ + if (READ_VID32(SC1200_VIDEO_DOWNSCALER_CONTROL) & + SC1200_VIDEO_DOWNSCALE_ENABLE) + *enable = 1; + else + *enable = 0; + return; +} + +/*--------------------------------------------------------------------------- + * gfx_get_video_dst_size + * + * This routine returns the size of the displayed video overlay window. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +unsigned long +sc1200_get_video_dst_size(void) +#else +unsigned long +gfx_get_video_dst_size(void) +#endif +{ + unsigned long xsize, ysize; + + xsize = READ_VID32(SC1200_VIDEO_X_POS); + xsize = ((xsize >> 16) & 0x7FF) - (xsize & 0x7FF); + ysize = READ_VID32(SC1200_VIDEO_Y_POS); + ysize = ((ysize >> 16) & 0x7FF) - (ysize & 0x7FF); + return ((ysize << 16) | xsize); +} + +/*--------------------------------------------------------------------------- + * gfx_get_video_position + * + * This routine returns the position of the video overlay window. The + * return value is (ypos << 16) | xpos. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +unsigned long +sc1200_get_video_position(void) +#else +unsigned long +gfx_get_video_position(void) +#endif +{ + unsigned long hadjust, vadjust; + unsigned long xpos, ypos; + + /* READ HARDWARE POSITION */ + + xpos = READ_VID32(SC1200_VIDEO_X_POS) & 0x000007FF; + ypos = READ_VID32(SC1200_VIDEO_Y_POS) & 0x000007FF; + + /* GET ADJUSTMENT VALUES */ + /* Use routines to abstract version of display controller. */ + + hadjust = + (unsigned long)gfx_get_htotal() - (unsigned long)gfx_get_hsync_end() - + 14l; + vadjust = + (unsigned long)gfx_get_vtotal() - (unsigned long)gfx_get_vsync_end() + + 1l; + xpos -= hadjust; + ypos -= vadjust; + return ((ypos << 16) | (xpos & 0x0000FFFF)); +} + +/*--------------------------------------------------------------------------- + * gfx_get_video_color_key + * + * This routine returns the current video color key value. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +unsigned long +sc1200_get_video_color_key(void) +#else +unsigned long +gfx_get_video_color_key(void) +#endif +{ + return (READ_VID32(SC1200_VIDEO_COLOR_KEY)); +} + +/*--------------------------------------------------------------------------- + * gfx_get_video_color_key_mask + * + * This routine returns the current video color mask value. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +unsigned long +sc1200_get_video_color_key_mask(void) +#else +unsigned long +gfx_get_video_color_key_mask(void) +#endif +{ + return (READ_VID32(SC1200_VIDEO_COLOR_MASK)); +} + +/*--------------------------------------------------------------------------- + * gfx_get_video_color_key_src + * + * This routine returns 0 for video data compare, 1 for graphics data. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +sc1200_get_video_color_key_src(void) +#else +int +gfx_get_video_color_key_src(void) +#endif +{ + if (READ_VID32(SC1200_DISPLAY_CONFIG) & SC1200_DCFG_VG_CK) + return (0); + return (1); +} + +/*--------------------------------------------------------------------------- + * gfx_get_video_filter + * + * This routine returns if the filters are currently enabled. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +sc1200_get_video_filter(void) +#else +int +gfx_get_video_filter(void) +#endif +{ + int retval = 0; + + if (READ_VID32(SC1200_VIDEO_CONFIG) & SC1200_VCFG_X_FILTER_EN) + retval |= 1; + if (READ_VID32(SC1200_VIDEO_CONFIG) & SC1200_VCFG_Y_FILTER_EN) + retval |= 2; + return (retval); +} + +/*--------------------------------------------------------------------------- + * gfx_get_video_request + * + * This routine returns the horizontal (pixel) and vertical (lines) video + * request values. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +sc1200_get_video_request(short *x, short *y) +#else +int +gfx_get_video_request(short *x, short *y) +#endif +{ + int request = 0; + + request = (int)(READ_VID32(SC1200_VIDEO_REQUEST)); + *x = (request >> SC1200_VIDEO_X_REQUEST_POS) & SC1200_VIDEO_REQUEST_MASK; + *y = (request >> SC1200_VIDEO_Y_REQUEST_POS) & SC1200_VIDEO_REQUEST_MASK; + + *x -= gfx_get_htotal() - gfx_get_hsync_end() - 2; + *y -= gfx_get_vtotal() - gfx_get_vsync_end() + 1; + + return (0); +} + +/*--------------------------------------------------------------------------- + * gfx_get_video_source + * + * This routine returns the current video source. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +sc1200_get_video_source(VideoSourceType * source) +#else +int +gfx_get_video_source(VideoSourceType * source) +#endif +{ + switch (READ_VID32(SC1200_VIDEO_DISPLAY_MODE) & SC1200_VIDEO_SOURCE_MASK) { + case SC1200_VIDEO_SOURCE_GX1: + *source = VIDEO_SOURCE_MEMORY; + break; + case SC1200_VIDEO_SOURCE_DVIP: + *source = VIDEO_SOURCE_DVIP; + break; + default: + return GFX_STATUS_ERROR; + } + return (0); +} + +/*--------------------------------------------------------------------------- + * gfx_get_vbi_source + * + * This routine returns the current vbi source. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +sc1200_get_vbi_source(VbiSourceType * source) +#else +int +gfx_get_vbi_source(VbiSourceType * source) +#endif +{ + switch (READ_VID32(SC1200_VIDEO_DISPLAY_MODE) & SC1200_VBI_SOURCE_MASK) { + case SC1200_VBI_SOURCE_GX1: + *source = VBI_SOURCE_MEMORY; + break; + case SC1200_VBI_SOURCE_DVIP: + *source = VBI_SOURCE_DVIP; + break; + default: + return GFX_STATUS_ERROR; + } + return (0); +} + +/*--------------------------------------------------------------------------- + * gfx_get_vbi_lines + * + * This routine returns the VBI lines which are sent to the TV encoder. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +unsigned long +sc1200_get_vbi_lines(int odd) +#else +unsigned long +gfx_get_vbi_lines(int odd) +#endif +{ + if (odd) + return (READ_VID32(SC1200_VIDEO_ODD_VBI_LINE_ENABLE) & + SC1200_VIDEO_VBI_LINE_ENABLE_MASK); + return (READ_VID32(SC1200_VIDEO_EVEN_VBI_LINE_ENABLE) & + SC1200_VIDEO_VBI_LINE_ENABLE_MASK); +} + +/*--------------------------------------------------------------------------- + * gfx_get_vbi_total + * + * This routine returns the total number of VBI bytes in the field. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +unsigned long +sc1200_get_vbi_total(int odd) +#else +unsigned long +gfx_get_vbi_total(int odd) +#endif +{ + if (odd) + return (READ_VID32(SC1200_VIDEO_ODD_VBI_TOTAL_COUNT) & + SC1200_VIDEO_VBI_TOTAL_COUNT_MASK); + return (READ_VID32(SC1200_VIDEO_EVEN_VBI_TOTAL_COUNT) & + SC1200_VIDEO_VBI_TOTAL_COUNT_MASK); +} + +/*--------------------------------------------------------------------------- + * gfx_get_video_interlaced() + * + * This routine returns "1" if input video is currently in interlaced mode. + * "0" otherwise. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +sc1200_get_video_interlaced(void) +#else +int +gfx_get_video_interlaced(void) +#endif +{ + if (READ_VID32(SC1200_VID_ALPHA_CONTROL) & SC1200_VIDEO_IS_INTERLACED) + return (1); + else + return (0); +} + +/*--------------------------------------------------------------------------- + * gfx_get_color_space_YUV() + * + * This routine returns "1" if video processor color space mode is currently + * YUV. "0" otherwise. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +sc1200_get_color_space_YUV(void) +#else +int +gfx_get_color_space_YUV(void) +#endif +{ + unsigned long control; + + control = READ_VID32(SC1200_VID_ALPHA_CONTROL); + + /* IS SC1200 VIDEO COLOR SPACE RGB OR CONVERTED TO RGB */ + if ((control & SC1200_VIDEO_INPUT_IS_RGB) + || (control & SC1200_CSC_VIDEO_YUV_TO_RGB)) + return (0); + else + return (1); +} + +/*--------------------------------------------------------------------------- + * gfx_get_vertical_scaler_offset() + * + * This routine sets "offset" to the value by which odd frames are shifted, + * if insert is enabled, and to 0 if no shifting occurs. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +sc1200_get_vertical_scaler_offset(char *offset) +#else +int +gfx_get_vertical_scaler_offset(char *offset) +#endif +{ + unsigned long control; + + control = READ_VID32(SC1200_VID_ALPHA_CONTROL); + if (control & SC1200_VERTICAL_SCALER_SHIFT_EN) { + if ((control & SC1200_VERTICAL_SCALER_SHIFT_MASK) == + SC1200_VERTICAL_SCALER_SHIFT_INIT) + *offset = 1; + else + return GFX_STATUS_ERROR; + /* TODO: find the interpretation of other values */ + } else + *offset = 0; + return (0); +} + +/*--------------------------------------------------------------------------- + * gfx_get_genlock_delay + * + * This routine returns the genlock delay in 27 MHz clocks. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +unsigned long +sc1200_get_genlock_delay(void) +#else +unsigned long +gfx_get_genlock_delay(void) +#endif +{ + return (READ_VID32(SC1200_GENLOCK_DELAY) & SC1200_GENLOCK_DELAY_MASK); +} + +/*--------------------------------------------------------------------------- + * gfx_get_genlock_enable + * + * This routine returns "1" if genlock is currently enabled, "0" otherwise. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +sc1200_get_genlock_enable(void) +#else +int +gfx_get_genlock_enable(void) +#endif +{ + if (READ_VID32(SC1200_GENLOCK) & + (SC1200_GENLOCK_SINGLE_ENABLE | SC1200_GENLOCK_CONTINUOUS_ENABLE)) + return (1); + else + return (0); +} + +/*--------------------------------------------------------------------------- + * gfx_get_video_cursor() + * + * This routine configures the video hardware cursor. + * If the "mask"ed bits in the graphics pixel match "key", then either + * "color1" or "color2" will be used for this pixel, according to the value of + * the bit in offset "select_color2". + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +sc1200_get_video_cursor(unsigned long *key, unsigned long *mask, + unsigned short *select_color2, unsigned long *color1, + unsigned short *color2) +#else +int +gfx_get_video_cursor(unsigned long *key, unsigned long *mask, + unsigned short *select_color2, unsigned long *color1, + unsigned short *color2) +#endif +{ + *select_color2 = + (unsigned short)(READ_VID32(SC1200_CURSOR_COLOR_KEY) >> + SC1200_CURSOR_COLOR_KEY_OFFSET_POS); + *key = READ_VID32(SC1200_CURSOR_COLOR_KEY) & SC1200_COLOR_MASK; + *mask = READ_VID32(SC1200_CURSOR_COLOR_MASK) & SC1200_COLOR_MASK; + *color1 = READ_VID32(SC1200_CURSOR_COLOR_1) & SC1200_COLOR_MASK; + *color2 = + (unsigned short)(READ_VID32(SC1200_CURSOR_COLOR_2) & + SC1200_COLOR_MASK); + return (0); +} + +/*--------------------------------------------------------------------------- + * gfx_read_crc + * + * This routine returns the hardware CRC value, which is used for automated + * testing. The value is like a checksum, but will change if pixels move + * locations. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +unsigned long +sc1200_read_crc(void) +#else +unsigned long +gfx_read_crc(void) +#endif +{ + unsigned long crc = 0xFFFFFFFF; + + if (gfx_test_timing_active()) { + /* WAIT UNTIL ACTIVE DISPLAY */ + + while (!gfx_test_vertical_active()) ; + + /* RESET CRC DURING ACTIVE DISPLAY */ + + WRITE_VID32(SC1200_VID_CRC, 0); + WRITE_VID32(SC1200_VID_CRC, 1); + + /* WAIT UNTIL NOT ACTIVE, THEN ACTIVE, NOT ACTIVE, THEN ACTIVE */ + + while (gfx_test_vertical_active()) ; + while (!gfx_test_vertical_active()) ; + while (gfx_test_vertical_active()) ; + while (!gfx_test_vertical_active()) ; + crc = READ_VID32(SC1200_VID_CRC) >> 8; + } + return (crc); +} + +/*---------------------------------------------------------------------------- + * gfx_get_macrovision_enable + * + * This routine returns the value "one" if macrovision currently enabled in + * the TV encoder, otherwise it returns the value "zero". + *---------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +sc1200_get_macrovision_enable(void) +#else +int +gfx_get_macrovision_enable(void) +#endif +{ + if (READ_VID32(SC1200_TVENC_MV_CONTROL) == SC1200_TVENC_MV_ENABLE) + return (1); + return (0); +} + +/*--------------------------------------------------------------------------- + * gfx_get_alpha_enable + * + * This routine returns 1 if the selected alpha window is currently + * enabled, or 0 if it is currently disabled. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +void +sc1200_get_alpha_enable(int *enable) +#else +void +gfx_get_alpha_enable(int *enable) +#endif +{ + unsigned long value = 0; + + *enable = 0; + if (gfx_alpha_select <= 2) { + value = + READ_VID32(SC1200_ALPHA_CONTROL_1 + + ((unsigned long)gfx_alpha_select << 4)); + if (value & SC1200_ACTRL_WIN_ENABLE) + *enable = 1; + } + return; +} + +/*--------------------------------------------------------------------------- + * gfx_get_alpha_size + * + * This routine returns the size of the currently selected alpha region. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +void +sc1200_get_alpha_size(unsigned short *x, unsigned short *y, + unsigned short *width, unsigned short *height) +#else +void +gfx_get_alpha_size(unsigned short *x, unsigned short *y, + unsigned short *width, unsigned short *height) +#endif +{ + unsigned long value = 0; + + *x = 0; + *y = 0; + *width = 0; + *height = 0; + if (gfx_alpha_select <= 2) { + value = + READ_VID32(SC1200_ALPHA_XPOS_1 + + ((unsigned long)gfx_alpha_select << 4)); + *x = (unsigned short)(value & 0x000007FF); + *width = (unsigned short)((value >> 16) & 0x000007FF) - *x; + value = + READ_VID32(SC1200_ALPHA_YPOS_1 + + ((unsigned long)gfx_alpha_select << 4)); + *y = (unsigned short)(value & 0x000007FF); + *height = (unsigned short)((value >> 16) & 0x000007FF) - *y; + } + *x -= gfx_get_htotal() - gfx_get_hsync_end() - 2; + *y -= gfx_get_vtotal() - gfx_get_vsync_end() + 1; + return; +} + +/*--------------------------------------------------------------------------- + * gfx_get_alpha_value + * + * This routine returns the alpha value and increment/decrement value of + * the currently selected alpha region. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +void +sc1200_get_alpha_value(unsigned char *alpha, char *delta) +#else +void +gfx_get_alpha_value(unsigned char *alpha, char *delta) +#endif +{ + unsigned long value = 0; + + *alpha = 0; + *delta = 0; + if (gfx_alpha_select <= 2) { + value = + READ_VID32(SC1200_ALPHA_CONTROL_1 + + ((unsigned long)gfx_alpha_select << 4)); + *alpha = (unsigned char)(value & 0x00FF); + *delta = (char)((value >> 8) & 0x00FF); + } + return; +} + +/*--------------------------------------------------------------------------- + * gfx_get_alpha_priority + * + * This routine returns the priority of the currently selected alpha region. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +void +sc1200_get_alpha_priority(int *priority) +#else +void +gfx_get_alpha_priority(int *priority) +#endif +{ + unsigned long pos = 0, value = 0; + + *priority = 0; + if (gfx_alpha_select <= 2) { + value = READ_VID32(SC1200_VID_ALPHA_CONTROL); + pos = 16 + (gfx_alpha_select << 1); + *priority = (int)((value >> pos) & 3); + } + return; +} + +/*--------------------------------------------------------------------------- + * gfx_get_alpha_color + * + * This routine returns the color register value for the currently selected + * alpha region. Bit 24 is set if the color register is enabled. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +void +sc1200_get_alpha_color(unsigned long *color) +#else +void +gfx_get_alpha_color(unsigned long *color) +#endif +{ + *color = 0; + if (gfx_alpha_select <= 2) { + *color = + READ_VID32(SC1200_ALPHA_COLOR_1 + + ((unsigned long)gfx_alpha_select << 4)); + } + return; +} + +#endif /* GFX_READ_ROUTINES */ + +/* END OF FILE */ diff --git a/driver/xf86-video-geode/src/gfx/vid_5530.c b/driver/xf86-video-geode/src/gfx/vid_5530.c new file mode 100644 index 000000000..40e3ffce1 --- /dev/null +++ b/driver/xf86-video-geode/src/gfx/vid_5530.c @@ -0,0 +1,1354 @@ +/* Copyright (c) 2005 Advanced Micro Devices, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + * + * Neither the name of the Advanced Micro Devices, Inc. nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * */ + +/* + * This file contains routines to control the CS5530 video overlay hardware. + */ + +/*---------------------------------------------------------------------------- + * CS5530 PLL TABLE + *---------------------------------------------------------------------------- + */ +typedef struct tagCS5530PLLENTRY +{ + long frequency; /* 16.16 fixed point frequency */ + unsigned long pll_value; /* associated register value */ +} CS5530PLLENTRY; + +CS5530PLLENTRY CS5530_PLLtable[] = { + {0x00192CCC, 0x31C45801,}, /* 25.1750 */ + {0x001C526E, 0x20E36802,}, /* 28.3220 */ + {0x001F8000, 0x33915801,}, /* 31.5000 */ + {0x00240000, 0x31EC4801,}, /* 36.0000 */ + {0x00258000, 0x21E22801,}, /* 37.5000 */ + {0x00280000, 0x33088801,}, /* 40.0000 */ + {0x002CE666, 0x33E22801,}, /* 44.9000 */ + {0x00318000, 0x336C4801,}, /* 49.5000 */ + {0x00320000, 0x23088801,}, /* 50.0000 */ + {0x00325999, 0x23088801,}, /* 50.3500 */ + {0x00360000, 0x3708A801,}, /* 54.0000 */ + {0x00384000, 0x23E36802,}, /* 56.2500 */ + {0x0038643F, 0x23E36802,}, /* 56.3916 */ + {0x0038A4DD, 0x23E36802,}, /* 56.6444 */ + {0x003B0000, 0x37C45801,}, /* 59.0000 */ + {0x003F0000, 0x23EC4801,}, /* 63.0000 */ + {0x00410000, 0x37911801,}, /* 65.0000 */ + {0x00438000, 0x37963803,}, /* 67.5000 */ + {0x0046CCCC, 0x37058803,}, /* 70.8000 */ + {0x00480000, 0x3710C805,}, /* 72.0000 */ + {0x004B0000, 0x37E22801,}, /* 75.0000 */ + {0x004EC000, 0x27915801,}, /* 78.7500 */ + {0x00500000, 0x37D8D802,}, /* 80.0000 */ + {0x0059CCCC, 0x27588802,}, /* 89.8000 */ + {0x005E8000, 0x27EC4802,}, /* 94.5000 */ + {0x00630000, 0x27AC6803,}, /* 99.0000 */ + {0x00640000, 0x27088801,}, /* 100.0000 */ + {0x006C0000, 0x2710C805,}, /* 108.0000 */ + {0x00708000, 0x27E36802,}, /* 112.5000 */ + {0x00820000, 0x27C58803,}, /* 130.0000 */ + {0x00870000, 0x27316803,}, /* 135.0000 */ + {0x009D8000, 0x2F915801,}, /* 157.5000 */ + {0x00A20000, 0x2F08A801,}, /* 162.0000 */ + {0x00AF0000, 0x2FB11802,}, /* 175.0000 */ + {0x00BD0000, 0x2FEC4802,}, /* 189.0000 */ + {0x00CA0000, 0x2F963803,}, /* 202.0000 */ + {0x00E80000, 0x2FB1B802,}, /* 232.0000 */ +}; + +#define NUM_CS5530_FREQUENCIES sizeof(CS5530_PLLtable)/sizeof(CS5530PLLENTRY) + +/*--------------------------------------------------------------------------- + * gfx_set_crt_enable + * + * This routine enables or disables the CRT output from the video processor. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +cs5530_set_crt_enable(int enable) +#else +int +gfx_set_crt_enable(int enable) +#endif +{ + unsigned long config; + + config = READ_VID32(CS5530_DISPLAY_CONFIG); + + switch (enable) { + case CRT_DISABLE: /* Disable everything */ + + WRITE_VID32(CS5530_DISPLAY_CONFIG, + config & ~(CS5530_DCFG_DIS_EN | CS5530_DCFG_HSYNC_EN | + CS5530_DCFG_VSYNC_EN | CS5530_DCFG_DAC_BL_EN | + CS5530_DCFG_DAC_PWDNX)); + break; + + case CRT_ENABLE: /* Enable CRT display, including display logic */ + + WRITE_VID32(CS5530_DISPLAY_CONFIG, + config | CS5530_DCFG_DIS_EN | CS5530_DCFG_HSYNC_EN | + CS5530_DCFG_VSYNC_EN | CS5530_DCFG_DAC_BL_EN | + CS5530_DCFG_DAC_PWDNX); + break; + + case CRT_STANDBY: /* HSync:Off VSync:On */ + + WRITE_VID32(CS5530_DISPLAY_CONFIG, + (config & ~(CS5530_DCFG_DIS_EN | CS5530_DCFG_HSYNC_EN | + CS5530_DCFG_DAC_BL_EN | CS5530_DCFG_DAC_PWDNX)) + | CS5530_DCFG_VSYNC_EN); + break; + + case CRT_SUSPEND: /* HSync:On VSync:Off */ + + WRITE_VID32(CS5530_DISPLAY_CONFIG, + (config & ~(CS5530_DCFG_DIS_EN | CS5530_DCFG_VSYNC_EN | + CS5530_DCFG_DAC_BL_EN | CS5530_DCFG_DAC_PWDNX)) + | CS5530_DCFG_HSYNC_EN); + break; + + default: + return (GFX_STATUS_BAD_PARAMETER); + } + return (GFX_STATUS_OK); +} + +/*--------------------------------------------------------------------------- + * gfx_reset_video (PRIVATE ROUTINE: NOT PART OF DURANGO API) + * + * This routine is used to disable all components of video overlay before + * performing a mode switch. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +void +cs5530_reset_video(void) +#else +void +gfx_reset_video(void) +#endif +{ + gfx_set_video_enable(0); + + /* CLEAR THE DISPLAY BUFFER SIZE TO ZERO */ + /* During a modeset,if FIFO load is enabled with a large buffer size, */ + /* the FIFO can hang. To prevent this, we set the buffer size to zero */ + /* and wait for this new size to be latched */ + + gfx_set_display_video_size(0, 0); + + if (gfx_test_timing_active()) { + while (!gfx_test_vertical_active()) ; + while (gfx_test_vertical_active()) ; + while (!gfx_test_vertical_active()) ; + while (gfx_test_vertical_active()) ; + } +} + +/*---------------------------------------------------------------------------- + * gfx_set_display_control (PRIVATE ROUTINE: NOT PART OF DURANGO API) + * + * This routine configures the display output. + * + * "sync_polarities" is used to set the polarities of the sync pulses + * according to the following mask: + * + * Bit 0: If set to 1, negative horizontal polarity is programmed, + * otherwise positive horizontal polarity is programmed. + * Bit 1: If set to 1, negative vertical polarity is programmed, + * otherwise positive vertical polarity is programmed. + * + *---------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +cs5530_set_display_control(int sync_polarities) +#else +int +gfx_set_display_control(int sync_polarities) +#endif +{ + unsigned long dcfg; + + /* ENABLE DISPLAY OUTPUT FROM CX5530 */ + + dcfg = READ_VID32(CS5530_DISPLAY_CONFIG); + + /* CLEAR RELEVANT FIELDS */ + + dcfg &= ~(CS5530_DCFG_CRT_SYNC_SKW_MASK | CS5530_DCFG_PWR_SEQ_DLY_MASK | + CS5530_DCFG_CRT_HSYNC_POL | CS5530_DCFG_CRT_VSYNC_POL | + CS5530_DCFG_FP_PWR_EN | CS5530_DCFG_FP_DATA_EN); + + /* INITIALIZATION */ + + dcfg |= (CS5530_DCFG_CRT_SYNC_SKW_INIT | + CS5530_DCFG_PWR_SEQ_DLY_INIT | CS5530_DCFG_GV_PAL_BYP); + + if (PanelEnable) { + dcfg |= CS5530_DCFG_FP_PWR_EN; + dcfg |= CS5530_DCFG_FP_DATA_EN; + } + + /* SET APPROPRIATE SYNC POLARITIES */ + + if (sync_polarities & 1) + dcfg |= CS5530_DCFG_CRT_HSYNC_POL; + if (sync_polarities & 2) + dcfg |= CS5530_DCFG_CRT_VSYNC_POL; + + WRITE_VID32(CS5530_DISPLAY_CONFIG, dcfg); + return (0); +} + +/*--------------------------------------------------------------------------- + * gfx_set_clock_frequency + * + * This routine sets the clock frequency, specified as a 16.16 fixed point + * value (0x00318000 = 49.5 MHz). It will set the closest frequency found + * in the lookup table. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +void +cs5530_set_clock_frequency(unsigned long frequency) +#else +void +gfx_set_clock_frequency(unsigned long frequency) +#endif +{ + unsigned int index; + unsigned long value; + long min, diff; + + /* FIND THE REGISTER VALUES FOR THE DESIRED FREQUENCY */ + /* Search the table for the closest frequency (16.16 format). */ + + value = CS5530_PLLtable[0].pll_value; + min = (long)CS5530_PLLtable[0].frequency - frequency; + if (min < 0L) + min = -min; + for (index = 1; index < NUM_CS5530_FREQUENCIES; index++) { + diff = (long)CS5530_PLLtable[index].frequency - frequency; + if (diff < 0L) + diff = -diff; + if (diff < min) { + min = diff; + value = CS5530_PLLtable[index].pll_value; + } + } + + /* SET THE DOT CLOCK REGISTER */ + + WRITE_VID32(CS5530_DOT_CLK_CONFIG, value); + WRITE_VID32(CS5530_DOT_CLK_CONFIG, value | 0x80000100); + /* set reset/bypass */ + gfx_delay_milliseconds(1); /* wait for PLL to settle */ + WRITE_VID32(CS5530_DOT_CLK_CONFIG, value & 0x7FFFFFFF); + /* clear reset */ + WRITE_VID32(CS5530_DOT_CLK_CONFIG, value & 0x7FFFFEFF); + /* clear bypass */ + return; +} + +/*---------------------------------------------------------------------------- + * gfx_set_video_enable + * + * This routine enables or disables the video overlay functionality. + *---------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +cs5530_set_video_enable(int enable) +#else +int +gfx_set_video_enable(int enable) +#endif +{ + unsigned long vcfg; + + /* WAIT FOR VERTICAL BLANK TO START */ + /* Otherwise a glitch can be observed. */ + + if (gfx_test_timing_active()) { + if (!gfx_test_vertical_active()) { + while (!gfx_test_vertical_active()) ; + } + while (gfx_test_vertical_active()) ; + } + vcfg = READ_VID32(CS5530_VIDEO_CONFIG); + if (enable) { + /* SET CS5530 BUS CONTROL PARAMETERS */ + /* Currently always high speed, 8-bit interface. */ + + vcfg |= CS5530_VCFG_HIGH_SPD_INT; + vcfg &= ~(CS5530_VCFG_EARLY_VID_RDY | CS5530_VCFG_16_BIT_EN); + + /* ENABLE CS5530 VIDEO OVERLAY */ + + vcfg |= CS5530_VCFG_VID_EN; + WRITE_VID32(CS5530_VIDEO_CONFIG, vcfg); + } else { + /* DISABLE CS5530 VIDEO OVERLAY */ + + vcfg &= ~CS5530_VCFG_VID_EN; + WRITE_VID32(CS5530_VIDEO_CONFIG, vcfg); + } + return (0); +} + +/*---------------------------------------------------------------------------- + * gfx_set_video_format + * + * Currently only sets 4:2:0 format, Y1 V Y0 U. + *---------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +cs5530_set_video_format(unsigned long format) +#else +int +gfx_set_video_format(unsigned long format) +#endif +{ + unsigned long vcfg = 0; + + /* SET THE CS5530 VIDEO INPUT FORMAT */ + + vcfg = READ_VID32(CS5530_VIDEO_CONFIG); + vcfg &= ~(CS5530_VCFG_VID_INP_FORMAT | CS5530_VCFG_4_2_0_MODE); + vcfg &= ~(CS5530_VCFG_CSC_BYPASS); + vcfg &= ~(CS5530_VCFG_GV_SEL); + + if (format < 4) + vcfg |= (format << 2); + else { + if (format == VIDEO_FORMAT_Y0Y1Y2Y3) { + vcfg |= CS5530_VCFG_4_2_0_MODE; + vcfg |= 1 << 2; + } + if (format == VIDEO_FORMAT_RGB) { + vcfg |= CS5530_VCFG_CSC_BYPASS; + vcfg |= CS5530_VCFG_GV_SEL; + } + } + + WRITE_VID32(CS5530_VIDEO_CONFIG, vcfg); + return (0); +} + +/*---------------------------------------------------------------------------- + * gfx_set_video_size + * + * This routine specifies the size of the source data. It is used only + * to determine how much data to transfer per frame, and is not used to + * calculate the scaling value (that is handled by a separate routine). + *---------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +cs5530_set_video_size(unsigned short width, unsigned short height) +#else +int +gfx_set_video_size(unsigned short width, unsigned short height) +#endif +{ + unsigned long size, vcfg; + + /* SET THE CS5530 VIDEO LINE SIZE */ + + vcfg = READ_VID32(CS5530_VIDEO_CONFIG); + vcfg &= ~(CS5530_VCFG_LINE_SIZE_LOWER_MASK | CS5530_VCFG_LINE_SIZE_UPPER); + size = (width >> 1); + vcfg |= (size & 0x00FF) << 8; + if (size & 0x0100) + vcfg |= CS5530_VCFG_LINE_SIZE_UPPER; + WRITE_VID32(CS5530_VIDEO_CONFIG, vcfg); + + /* SET TOTAL VIDEO BUFFER SIZE IN DISPLAY CONTROLLER */ + /* Use private routine to abstract the display controller. */ + + gfx_set_display_video_size(width, height); + return (0); +} + +/*---------------------------------------------------------------------------- + * gfx_set_video_offset + * + * This routine sets the starting offset for the video buffer when only + * one offset needs to be specified. + *---------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +cs5530_set_video_offset(unsigned long offset) +#else +int +gfx_set_video_offset(unsigned long offset) +#endif +{ + /* SAVE VALUE FOR FUTURE CLIPPING OF THE TOP OF THE VIDEO WINDOW */ + + gfx_vid_offset = offset; + + /* SET VIDEO BUFFER OFFSET IN DISPLAY CONTROLLER */ + /* Use private routine to abstract the display controller. */ + + gfx_set_display_video_offset(offset); + return (0); +} + +/*--------------------------------------------------------------------------- + * gfx_set_video_scale + * + * This routine sets the scale factor for the video overlay window. The + * size of the source and destination regions are specified in pixels. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +cs5530_set_video_scale(unsigned short srcw, unsigned short srch, + unsigned short dstw, unsigned short dsth) +#else +int +gfx_set_video_scale(unsigned short srcw, unsigned short srch, + unsigned short dstw, unsigned short dsth) +#endif +{ + unsigned long xscale, yscale; + + /* SAVE PARAMETERS */ + /* These are needed for clipping the video window later. */ + + gfx_vid_srcw = srcw; + gfx_vid_srch = srch; + gfx_vid_dstw = dstw; + gfx_vid_dsth = dsth; + + /* CALCULATE CS5530 SCALE FACTORS */ + /* No downscaling in CS5530 so force to 1x if attempted. */ + + if (dstw <= srcw) + xscale = 0x1FFF; + else if (dstw == 1 || srcw == 1) + return GFX_STATUS_BAD_PARAMETER; + else + xscale = (0x2000l * (srcw - 1l)) / (dstw - 1l); + if (dsth <= srch) + yscale = 0x1FFF; + else if (dsth == 1 || srch == 1) + return GFX_STATUS_BAD_PARAMETER; + else + yscale = (0x2000l * (srch - 1l)) / (dsth - 1l); + WRITE_VID32(CS5530_VIDEO_SCALE, (yscale << 16) | xscale); + + /* CALL ROUTINE TO UPDATE WINDOW POSITION */ + /* This is required because the scale values effect the number of */ + /* source data pixels that need to be clipped, as well as the */ + /* amount of data that needs to be transferred. */ + + gfx_set_video_window(gfx_vid_xpos, gfx_vid_ypos, gfx_vid_width, + gfx_vid_height); + return (0); +} + +/*--------------------------------------------------------------------------- + * gfx_set_video_window + * + * This routine sets the position and size of the video overlay window. The + * position is specified in screen relative coordinates, and may be negative. + * The size of destination region is specified in pixels. The line size + * indicates the number of bytes of source data per scanline. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +cs5530_set_video_window(short x, short y, unsigned short w, unsigned short h) +#else +int +gfx_set_video_window(short x, short y, unsigned short w, unsigned short h) +#endif +{ + unsigned long vcfg = 0; + unsigned long hadjust, vadjust; + unsigned long xstart, ystart, xend, yend; + unsigned long offset, line_size; + + /* SAVE PARAMETERS */ + /* These are needed to call this routine if the scale value changes. */ + + gfx_vid_xpos = x; + gfx_vid_ypos = y; + gfx_vid_width = w; + gfx_vid_height = h; + + /* GET ADJUSTMENT VALUES */ + /* Use routines to abstract version of display controller. */ + + hadjust = gfx_get_htotal() - gfx_get_hsync_end() - 13l; + vadjust = gfx_get_vtotal() - gfx_get_vsync_end() + 1l; + + /* LEFT CLIPPING */ + + if (x < 0) { + gfx_set_video_left_crop((unsigned short)(-x)); + xstart = hadjust; + } else { + gfx_set_video_left_crop(0); + xstart = (unsigned long)x + hadjust; + } + + /* CLIPPING ON RIGHT */ + + xend = x + w; + if (xend > gfx_get_hactive()) + xend = gfx_get_hactive(); + xend += hadjust; + + /* CLIPPING ON TOP */ + + offset = gfx_vid_offset; + if (y >= 0) { + ystart = y + vadjust; + } else { + ystart = vadjust; + line_size = (READ_VID32(CS5530_VIDEO_CONFIG) >> 7) & 0x000001FE; + if (READ_VID32(CS5530_VIDEO_CONFIG) & CS5530_VCFG_LINE_SIZE_UPPER) + line_size += 512l; + if (gfx_vid_dsth) + offset = gfx_vid_offset + (line_size << 1) * + (((-y) * gfx_vid_srch) / gfx_vid_dsth); + } + + /* CLIPPING ON BOTTOM */ + + yend = y + h; + if (yend >= gfx_get_vactive()) + yend = gfx_get_vactive(); + yend += vadjust; + + /* SET VIDEO BUFFER OFFSET IN DISPLAY CONTROLLER */ + /* Use private routine to abstract the display controller. */ + + gfx_set_display_video_offset(offset); + + /* DISABLE REGISTER UPDATES */ + + vcfg = READ_VID32(CS5530_VIDEO_CONFIG); + vcfg &= ~CS5530_VCFG_VID_REG_UPDATE; + WRITE_VID32(CS5530_VIDEO_CONFIG, vcfg); + + /* SET VIDEO POSITION */ + + WRITE_VID32(CS5530_VIDEO_X_POS, (xend << 16) | xstart); + WRITE_VID32(CS5530_VIDEO_Y_POS, (yend << 16) | ystart); + + vcfg |= CS5530_VCFG_VID_REG_UPDATE; + WRITE_VID32(CS5530_VIDEO_CONFIG, vcfg); + + return (0); +} + +/*--------------------------------------------------------------------------- + * gfx_set_video_left_crop + * + * This routine sets the number of pixels which will be cropped from the + * beginning of each video line. The video window will begin to display only + * from the pixel following the cropped pixels, and the cropped pixels + * will be ignored. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +cs5530_set_video_left_crop(unsigned short x) +#else +int +gfx_set_video_left_crop(unsigned short x) +#endif +{ + unsigned long vcfg, initread; + + /* CLIPPING ON LEFT */ + /* Adjust initial read for scale, checking for divide by zero */ + + if (gfx_vid_dstw) + initread = (unsigned long)x *gfx_vid_srcw / gfx_vid_dstw; + + else + initread = 0; + + /* SET INITIAL READ ADDRESS AND ENABLE REGISTER UPDATES */ + + vcfg = READ_VID32(CS5530_VIDEO_CONFIG); + vcfg &= ~CS5530_VCFG_INIT_READ_MASK; + vcfg |= (initread << 15) & CS5530_VCFG_INIT_READ_MASK; + vcfg |= CS5530_VCFG_VID_REG_UPDATE; + WRITE_VID32(CS5530_VIDEO_CONFIG, vcfg); + return (0); +} + +/*--------------------------------------------------------------------------- + * gfx_set_video_color_key + * + * This routine specifies the color key value and mask for the video overlay + * hardware. To disable color key, the color and mask should both be set to + * zero. The hardware uses the color key in the following equation: + * + * ((source data) & (color key mask)) == ((color key) & (color key mask)) + * + * The source data can be either graphics data or video data. The bluescreen + * parameter is set to have the hardware compare video data and clear to + * comapare graphics data. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +cs5530_set_video_color_key(unsigned long key, unsigned long mask, + int graphics) +#else +int +gfx_set_video_color_key(unsigned long key, unsigned long mask, int graphics) +#endif +{ + unsigned long dcfg = 0; + + /* SET CS5530 COLOR KEY VALUE */ + + WRITE_VID32(CS5530_VIDEO_COLOR_KEY, key); + WRITE_VID32(CS5530_VIDEO_COLOR_MASK, mask); + + /* SELECT GRAPHICS OR VIDEO DATA TO COMPARE TO THE COLOR KEY */ + + dcfg = READ_VID32(CS5530_DISPLAY_CONFIG); + if (graphics & 0x01) + dcfg &= ~CS5530_DCFG_VG_CK; + else + dcfg |= CS5530_DCFG_VG_CK; + WRITE_VID32(CS5530_DISPLAY_CONFIG, dcfg); + return (0); +} + +/*--------------------------------------------------------------------------- + * gfx_set_video_filter + * + * This routine enables or disables the video overlay filters. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +cs5530_set_video_filter(int xfilter, int yfilter) +#else +int +gfx_set_video_filter(int xfilter, int yfilter) +#endif +{ + unsigned long vcfg = 0; + + /* ENABLE OR DISABLE CS5530 VIDEO OVERLAY FILTERS */ + + vcfg = READ_VID32(CS5530_VIDEO_CONFIG); + vcfg &= ~(CS5530_VCFG_X_FILTER_EN | CS5530_VCFG_Y_FILTER_EN); + if (xfilter) + vcfg |= CS5530_VCFG_X_FILTER_EN; + if (yfilter) + vcfg |= CS5530_VCFG_Y_FILTER_EN; + WRITE_VID32(CS5530_VIDEO_CONFIG, vcfg); + + return (0); +} + +/*--------------------------------------------------------------------------- + * gfx_set_video_palette + * + * This routine loads the video hardware palette. If a NULL pointer is + * specified, the palette is bypassed (for CS5530, this means loading the + * palette with identity values). + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +cs5530_set_video_palette(unsigned long *palette) +#else +int +gfx_set_video_palette(unsigned long *palette) +#endif +{ + unsigned long i, entry; + + /* LOAD CS5530 VIDEO PALETTE */ + + WRITE_VID32(CS5530_PALETTE_ADDRESS, 0); + for (i = 0; i < 256; i++) { + if (palette) + entry = palette[i]; + else + entry = i | (i << 8) | (i << 16); + WRITE_VID32(CS5530_PALETTE_DATA, entry); + } + return (0); +} + +/*--------------------------------------------------------------------------- + * gfx_set_video_palette_entry + * + * This routine loads a single entry of the video hardware palette. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +cs5530_set_video_palette_entry(unsigned long index, unsigned long palette) +#else +int +gfx_set_video_palette_entry(unsigned long index, unsigned long palette) +#endif +{ + if (index > 0xFF) + return GFX_STATUS_BAD_PARAMETER; + + /* SET A SINGLE ENTRY */ + + WRITE_VID32(CS5530_PALETTE_ADDRESS, index); + WRITE_VID32(CS5530_PALETTE_DATA, palette); + + return (0); +} + +#define CX55xx_VIDEO_PCI_44 0x80009444 + +/*--------------------------------------------------------------------------- + * gfx_disable_softvga + * + * Disables SoftVga. This function is only valid with VSA2, Returns 1 if + * SoftVga can be disabled; 0 if not. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +cs5530_disable_softvga(void) +#else +int +gfx_disable_softvga(void) +#endif +{ + unsigned long reg_val; + + /* get the current value */ + reg_val = gfx_pci_config_read(CX55xx_VIDEO_PCI_44); + /* setting video PCI register 44 bit 0 to 1 disables SoftVga */ + reg_val |= 0x1; + gfx_pci_config_write(CX55xx_VIDEO_PCI_44, reg_val); + + /* see if we set the bit and return the appropriate value */ + reg_val = gfx_pci_config_read(CX55xx_VIDEO_PCI_44); + if ((reg_val & 0x1) == 0x1) + return (1); + else + return (0); + +} + +/*--------------------------------------------------------------------------- + * gfx_enable_softvga + * + * Enables SoftVga. This function is only valid with VSA2, Returns 1 if + * SoftVga can be enbled; 0 if not. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +cs5530_enable_softvga(void) +#else +int +gfx_enable_softvga(void) +#endif +{ + unsigned long reg_val; + + /* get the current value */ + reg_val = gfx_pci_config_read(CX55xx_VIDEO_PCI_44); + /* clearing video PCI register 44 bit 0 enables SoftVga */ + gfx_pci_config_write(CX55xx_VIDEO_PCI_44, reg_val & 0xfffffffe); + + /* see if we cleared the bit and return the appropriate value */ + reg_val = gfx_pci_config_read(CX55xx_VIDEO_PCI_44); + if ((reg_val & 0x1) == 0) + return (1); + else + return (0); + +} + +/*--------------------------------------------------------------------------- + * gfx_get_clock_frequency + * + * This routine returns the current clock frequency in 16.16 format. + * It reads the current register value and finds the match in the table. + * If no match is found, this routine returns 0. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +unsigned long +cs5530_get_clock_frequency(void) +#else +unsigned long +gfx_get_clock_frequency(void) +#endif +{ + unsigned int index; + unsigned long value, mask; + + mask = 0x7FFFFEDC; + value = READ_VID32(CS5530_DOT_CLK_CONFIG) & mask; + for (index = 0; index < NUM_CS5530_FREQUENCIES; index++) { + if ((CS5530_PLLtable[index].pll_value & mask) == value) + return (CS5530_PLLtable[index].frequency); + } + return (0); +} + +/*--------------------------------------------------------------------------- + * gfx_get_max_video_width + * + * This routine returns the maximum theoretical video width for the current + * display mode. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +unsigned long +cs5530_get_max_video_width(void) +#else +unsigned long +gfx_get_max_video_width(void) +#endif +{ + unsigned long htotal, vidclk, dotpll; + unsigned long low, high, sublow, subhigh; + unsigned long width, value; + unsigned long temp0, temp1; + unsigned long highshift; + unsigned long divisor, dividend; + + htotal = gfx_get_htotal(); + + vidclk = gfx_cpu_frequency << 15; + if (READ_REG32(DC_GENERAL_CFG) & DC_GCFG_VCLK_DIV) + vidclk >>= 1; + + dotpll = gfx_get_clock_frequency(); + + /* CHECK FOR UNKNOWN DOT CLOCK */ + + if (!dotpll) + return 0; + + /* DERIVE THEORETICAL MAXIMUM */ + /* The GX/CS5530 video interface transfers 8 bytes for every 9 video */ + /* clocks. This implies that 4 video pixels are transferred for every */ + /* 9 clocks. The time allowed to fill a line buffer is an entire */ + /* display line, or (HTotal * DotPll). The time needed to fill the */ + /* line buffer is thus ((4/9) * VidClk * VidWidth). Solving for */ + /* equality yields the theoretical maximum: */ + /* */ + /* 4 * VidClk * HTotal */ + /* VidWidth = ----------------------- */ + /* 9 * DotPLL */ + + /* CALCULATE TOP OF EQUATION */ + /* The equation as it stands will overflow 32-bit integer math. We must */ + /* therefore use tricks to perform a 64-bit equation to calculate the */ + /* correct value. We assume in this equation that the upper 16 bits of */ + /* htotal are 0, i.e. that htotal is never greater than 65535. */ + + vidclk <<= 2; + + low = (vidclk & 0xFFFF) * (htotal & 0xFFFF); + temp0 = (vidclk >> 16) * (htotal & 0xFFFF); + temp1 = temp0 << 16; + + high = temp0 >> 16; + if ((0xFFFFFFFF - temp1) < low) + high++; + low += temp1; + + /* DIVIDE BY BOTTOM OF EQUATION */ + /* Use an iterative divide to avoid floating point or inline assembly */ + /* Costly, but so is the price of OS independence. */ + + divisor = 9 * dotpll; + highshift = 0; + width = 0; + while (highshift <= 32) { + if (highshift == 0) + dividend = high; + else if (highshift == 32) + dividend = low; + else + dividend = (high << highshift) | (low >> (32 - highshift)); + + value = dividend / divisor; + + width = (width << 4) + value; + + value *= divisor; + + subhigh = value >> highshift; + sublow = value << (32 - highshift); + + if (low < sublow) + high = high - subhigh - 1; + else + high = high - subhigh; + + low -= sublow; + + highshift += 4; + } + + /* ALIGN TO 8 PIXEL BOUNDARY */ + + width &= 0xFFFC; + + return width; +} + +/*************************************************************/ +/* READ ROUTINES | INCLUDED FOR DIAGNOSTIC PURPOSES ONLY */ +/*************************************************************/ + +#if GFX_READ_ROUTINES + +/*--------------------------------------------------------------------------- + * gfx_get_vsa2_softvga_enable + * + * This function returns the enable status of SoftVGA. It is valid + * only if VSAII is present. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +cs5530_get_vsa2_softvga_enable(void) +#else +int +gfx_get_vsa2_softvga_enable(void) +#endif +{ + unsigned long reg_val; + + reg_val = gfx_pci_config_read(CX55xx_VIDEO_PCI_44); + if ((reg_val & 0x1) == 0) + return (1); + else + return (0); + +} + +/*--------------------------------------------------------------------------- + * gfx_get_sync_polarities + * + * This routine returns the polarities of the sync pulses: + * Bit 0: Set if negative horizontal polarity. + * Bit 1: Set if negative vertical polarity. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +cs5530_get_sync_polarities(void) +#else +int +gfx_get_sync_polarities(void) +#endif +{ + int polarities = 0; + + if (READ_VID32(CS5530_DISPLAY_CONFIG) & 0x00000100) + polarities |= 1; + if (READ_VID32(CS5530_DISPLAY_CONFIG) & 0x00000200) + polarities |= 2; + return (polarities); +} + +/*--------------------------------------------------------------------------- + * gfx_get_video_palette_entry + * + * This routine returns a single palette entry. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +cs5530_get_video_palette_entry(unsigned long index, unsigned long *palette) +#else +int +gfx_get_video_palette_entry(unsigned long index, unsigned long *palette) +#endif +{ + if (index > 0xFF) + return GFX_STATUS_BAD_PARAMETER; + + /* READ A SINGLE ENTRY */ + + WRITE_VID32(CS5530_PALETTE_ADDRESS, index); + *palette = READ_VID32(CS5530_PALETTE_DATA); + + return (GFX_STATUS_OK); +} + +/*---------------------------------------------------------------------------- + * gfx_get_video_enable + * + * This routine returns the value "one" if video overlay is currently enabled, + * otherwise it returns the value "zero". + *---------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +cs5530_get_video_enable(void) +#else +int +gfx_get_video_enable(void) +#endif +{ + if (READ_VID32(CS5530_VIDEO_CONFIG) & CS5530_VCFG_VID_EN) + return (1); + return (0); +} + +/*---------------------------------------------------------------------------- + * gfx_get_video_format + * + * This routine returns the current video overlay format. + *---------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +cs5530_get_video_format(void) +#else +int +gfx_get_video_format(void) +#endif +{ + unsigned long vcfg; + + vcfg = READ_VID32(CS5530_VIDEO_CONFIG); + if (vcfg & CS5530_VCFG_CSC_BYPASS) + return (VIDEO_FORMAT_RGB); + if (vcfg & CS5530_VCFG_4_2_0_MODE) + return (VIDEO_FORMAT_Y0Y1Y2Y3); + + return ((int)((vcfg >> 2) & 3)); +} + +/*---------------------------------------------------------------------------- + * gfx_get_video_src_size + * + * This routine returns the size of the source video overlay buffer. The + * return value is (height << 16) | width. + *---------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +unsigned long +cs5530_get_video_src_size(void) +#else +unsigned long +gfx_get_video_src_size(void) +#endif +{ + unsigned long width = 0, height = 0; + + /* DETERMINE SOURCE WIDTH FROM THE CS5530 VIDEO LINE SIZE */ + + width = (READ_VID32(CS5530_VIDEO_CONFIG) >> 7) & 0x000001FE; + if (READ_VID32(CS5530_VIDEO_CONFIG) & CS5530_VCFG_LINE_SIZE_UPPER) + width += 512l; + + if (width) { + /* DETERMINE HEIGHT BY DIVIDING TOTAL SIZE BY WIDTH */ + /* Get total size from display controller - abtracted. */ + + height = gfx_get_display_video_size() / (width << 1); + } + return ((height << 16) | width); +} + +/*---------------------------------------------------------------------------- + * gfx_get_video_line_size + * + * This routine returns the line size of the source video overlay buffer, in + * pixels. + *---------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +unsigned long +cs5530_get_video_line_size(void) +#else +unsigned long +gfx_get_video_line_size(void) +#endif +{ + unsigned long width = 0; + + /* DETERMINE SOURCE WIDTH FROM THE CS5530 VIDEO LINE SIZE */ + + width = (READ_VID32(CS5530_VIDEO_CONFIG) >> 7) & 0x000001FE; + if (READ_VID32(CS5530_VIDEO_CONFIG) & CS5530_VCFG_LINE_SIZE_UPPER) + width += 512l; + return (width); +} + +/*---------------------------------------------------------------------------- + * gfx_get_video_xclip + * + * This routine returns the number of bytes clipped on the left side of a + * video overlay line (skipped at beginning). + *---------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +unsigned long +cs5530_get_video_xclip(void) +#else +unsigned long +gfx_get_video_xclip(void) +#endif +{ + unsigned long clip = 0; + + /* DETERMINE SOURCE WIDTH FROM THE CS5530 VIDEO LINE SIZE */ + + clip = (READ_VID32(CS5530_VIDEO_CONFIG) >> 14) & 0x000007FC; + return (clip); +} + +/*---------------------------------------------------------------------------- + * gfx_get_video_offset + * + * This routine returns the current offset for the video overlay buffer. + *---------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +unsigned long +cs5530_get_video_offset(void) +#else +unsigned long +gfx_get_video_offset(void) +#endif +{ + return (gfx_get_display_video_offset()); +} + +/*--------------------------------------------------------------------------- + * gfx_get_video_scale + * + * This routine returns the scale factor for the video overlay window. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +unsigned long +cs5530_get_video_scale(void) +#else +unsigned long +gfx_get_video_scale(void) +#endif +{ + return (READ_VID32(CS5530_VIDEO_SCALE)); +} + +/*--------------------------------------------------------------------------- + * gfx_get_video_dst_size + * + * This routine returns the size of the displayed video overlay window. + * NOTE: This is the displayed window size, which may be different from + * the real window size if clipped. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +unsigned long +cs5530_get_video_dst_size(void) +#else +unsigned long +gfx_get_video_dst_size(void) +#endif +{ + unsigned long xsize, ysize; + + xsize = READ_VID32(CS5530_VIDEO_X_POS); + xsize = ((xsize >> 16) & 0x7FF) - (xsize & 0x07FF); + ysize = READ_VID32(CS5530_VIDEO_Y_POS); + ysize = ((ysize >> 16) & 0x7FF) - (ysize & 0x07FF); + return ((ysize << 16) | xsize); +} + +/*--------------------------------------------------------------------------- + * gfx_get_video_position + * + * This routine returns the position of the video overlay window. The + * return value is (ypos << 16) | xpos. + * NOTE: This is the displayed window position, which may be different from + * the real window position if clipped. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +unsigned long +cs5530_get_video_position(void) +#else +unsigned long +gfx_get_video_position(void) +#endif +{ + unsigned long hadjust, vadjust; + unsigned long xpos, ypos; + + /* READ HARDWARE POSITION */ + + xpos = READ_VID32(CS5530_VIDEO_X_POS) & 0x000007FF; + ypos = READ_VID32(CS5530_VIDEO_Y_POS) & 0x000007FF; + + /* GET ADJUSTMENT VALUES */ + /* Use routines to abstract version of display controller. */ + + hadjust = gfx_get_htotal() - gfx_get_hsync_end() - 13l; + vadjust = gfx_get_vtotal() - gfx_get_vsync_end() + 1l; + xpos -= hadjust; + ypos -= vadjust; + return ((ypos << 16) | (xpos & 0x0000FFFF)); +} + +/*--------------------------------------------------------------------------- + * gfx_get_video_color_key + * + * This routine returns the current video color key value. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +unsigned long +cs5530_get_video_color_key(void) +#else +unsigned long +gfx_get_video_color_key(void) +#endif +{ + return (READ_VID32(CS5530_VIDEO_COLOR_KEY)); +} + +/*--------------------------------------------------------------------------- + * gfx_get_video_color_key_mask + * + * This routine returns the current video color mask value. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +unsigned long +cs5530_get_video_color_key_mask(void) +#else +unsigned long +gfx_get_video_color_key_mask(void) +#endif +{ + return (READ_VID32(CS5530_VIDEO_COLOR_MASK)); +} + +/*--------------------------------------------------------------------------- + * gfx_get_video_color_key_src + * + * This routine returns 0 for video data compare, 1 for graphics data. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +cs5530_get_video_color_key_src(void) +#else +int +gfx_get_video_color_key_src(void) +#endif +{ + if (READ_VID32(CS5530_DISPLAY_CONFIG) & CS5530_DCFG_VG_CK) + return (0); + return (1); +} + +/*--------------------------------------------------------------------------- + * gfx_get_video_filter + * + * This routine returns if the filters are currently enabled. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +cs5530_get_video_filter(void) +#else +int +gfx_get_video_filter(void) +#endif +{ + int retval = 0; + + if (READ_VID32(CS5530_VIDEO_CONFIG) & CS5530_VCFG_X_FILTER_EN) + retval |= 1; + if (READ_VID32(CS5530_VIDEO_CONFIG) & CS5530_VCFG_Y_FILTER_EN) + retval |= 2; + return (retval); +} + +/*--------------------------------------------------------------------------- + * gfx_read_crc + * + * This routine returns the hardware CRC value, which is used for automated + * testing. The value is like a checksum, but will change if pixels move + * locations. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +unsigned long +cs5530_read_crc(void) +#else +unsigned long +gfx_read_crc(void) +#endif +{ + unsigned long crc = 0xFFFFFFFF; + + if (gfx_test_timing_active()) { + /* WAIT UNTIL ACTIVE DISPLAY */ + + while (!gfx_test_vertical_active()) ; + + /* RESET CRC DURING ACTIVE DISPLAY */ + + WRITE_VID32(CS5530_CRCSIG_TFT_TV, 0); + WRITE_VID32(CS5530_CRCSIG_TFT_TV, 1); + + /* WAIT UNTIL NOT ACTIVE, THEN ACTIVE, NOT ACTIVE, THEN ACTIVE */ + + while (gfx_test_vertical_active()) ; + while (!gfx_test_vertical_active()) ; + while (gfx_test_vertical_active()) ; + while (!gfx_test_vertical_active()) ; + crc = READ_VID32(CS5530_CRCSIG_TFT_TV) >> 8; + } + return (crc); +} + +#endif /* GFX_READ_ROUTINES */ + +/* END OF FILE */ diff --git a/driver/xf86-video-geode/src/gfx/vid_rdcl.c b/driver/xf86-video-geode/src/gfx/vid_rdcl.c new file mode 100644 index 000000000..7c98d2d30 --- /dev/null +++ b/driver/xf86-video-geode/src/gfx/vid_rdcl.c @@ -0,0 +1,2896 @@ +/* Copyright (c) 2005 Advanced Micro Devices, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + * + * Neither the name of the Advanced Micro Devices, Inc. nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * */ + +/* + * This file contains routines to control the Redcloud display filter video + * overlay hardware. + * */ + +unsigned long gfx_gamma_ram_redcloud[] = { + 0x00000000, 0x00040003, 0x00050104, 0x00060205, 0x00070306, 0x00080407, + 0x00090508, 0x000A0609, 0x000B070A, 0x000C080B, 0x000D090C, 0x000E0A0D, + 0x000F0B0E, 0x00100C0F, 0x00110D10, 0x00110E11, 0x00120F12, 0x00141013, + 0x00151114, 0x00161215, 0x00171316, 0x00181417, 0x00191518, 0x001A1619, + 0x001B171A, 0x001C181B, 0x001D191C, 0x001D1A1D, 0x001E1B1E, 0x00201C1F, + 0x00201D20, 0x00221E21, 0x00231F22, 0x00242023, 0x00252124, 0x00262225, + 0x00262326, 0x00282427, 0x00292528, 0x00292629, 0x002B272A, 0x002C282B, + 0x002D292C, 0x002E2A2D, 0x002F2B2E, 0x00302C2F, 0x00312D30, 0x00322E31, + 0x00332F32, 0x00343033, 0x00353134, 0x00363235, 0x00373336, 0x00383437, + 0x00393538, 0x003A3639, 0x003B373A, 0x003C383B, 0x003D393C, 0x003E3A3D, + 0x003F3B3E, 0x00403C3F, 0x00413D40, 0x00423E41, 0x00433F42, 0x00444043, + 0x00444144, 0x00454245, 0x00474346, 0x00484447, 0x00494548, 0x004A4649, + 0x004B474A, 0x004C484B, 0x004D494C, 0x004E4A4D, 0x004F4B4E, 0x00504C4F, + 0x00514D50, 0x00524E51, 0x00534F52, 0x00545053, 0x00555154, 0x00565255, + 0x00575356, 0x00585457, 0x00595558, 0x005A5659, 0x005B575A, 0x005C585B, + 0x005D595C, 0x005E5A5D, 0x005F5B5E, 0x00605C5F, 0x00615D60, 0x00625E61, + 0x00635F62, 0x00646063, 0x00656164, 0x00666265, 0x00676366, 0x00686467, + 0x00696568, 0x006A6669, 0x006B676A, 0x006C686B, 0x006D696C, 0x006E6A6D, + 0x006F6B6E, 0x00706C6F, 0x00716D70, 0x00726E71, 0x00736F72, 0x00747073, + 0x00757174, 0x00767275, 0x00777376, 0x00787477, 0x00797578, 0x007A7679, + 0x007B777A, 0x007C787B, 0x007D797C, 0x007E7A7D, 0x007F7B7E, 0x00807C7F, + 0x00817D80, 0x00827E81, 0x00837F82, 0x00848083, 0x00858184, 0x00868285, + 0x00878386, 0x00888487, 0x00898588, 0x008A8689, 0x008B878A, 0x008C888B, + 0x008D898C, 0x008E8A8D, 0x008F8B8E, 0x00908C8F, 0x00918D90, 0x00928E91, + 0x00938F92, 0x00949093, 0x00959194, 0x00969295, 0x00979396, 0x00989497, + 0x00999598, 0x009A9699, 0x009B979A, 0x009C989B, 0x009D999C, 0x009E9A9D, + 0x009F9B9E, 0x00A09C9F, 0x00A19DA0, 0x00A29EA1, 0x00A39FA2, 0x00A4A0A3, + 0x00A5A1A4, 0x00A6A2A5, 0x00A7A3A6, 0x00A8A4A7, 0x00A9A5A8, 0x00AAA6A9, + 0x00ABA7AA, 0x00ACA8AB, 0x00ADA9AC, 0x00AEAAAD, 0x00AFABAE, 0x00B0ACAF, + 0x00B1ADB0, 0x00B2AEB1, 0x00B3AFB2, 0x00B4B0B3, 0x00B5B1B4, 0x00B6B2B5, + 0x00B7B3B6, 0x00B8B4B7, 0x00B9B5B8, 0x00BAB6B9, 0x00BBB7BA, 0x00BCB8BB, + 0x00BDB9BC, 0x00BEBABD, 0x00BFBBBE, 0x00C0BCBF, 0x00C1BDC0, 0x00C2BEC1, + 0x00C3BFC2, 0x00C4C0C3, 0x00C5C1C4, 0x00C6C2C5, 0x00C7C3C6, 0x00C8C4C7, + 0x00C9C5C8, 0x00CAC6C9, 0x00CBC7CA, 0x00CCC8CB, 0x00CDC9CC, 0x00CECACD, + 0x00CFCBCE, 0x00D0CCCF, 0x00D1CDD0, 0x00D2CED1, 0x00D3CFD2, 0x00D4D0D3, + 0x00D5D1D4, 0x00D6D2D5, 0x00D7D3D6, 0x00D8D4D7, 0x00D9D5D8, 0x00DAD6D9, + 0x00DBD7DA, 0x00DCD8DB, 0x00DDD9DC, 0x00DEDADD, 0x00DFDBDE, 0x00E0DCDF, + 0x00E1DDE0, 0x00E2DEE1, 0x00E3DFE2, 0x00E4E0E3, 0x00E5E1E4, 0x00E6E2E5, + 0x00E7E3E6, 0x00E8E4E7, 0x00E9E5E8, 0x00EAE6E9, 0x00EBE7EA, 0x00ECE8EB, + 0x00EDE9EC, 0x00EEEAED, 0x00EFEBEE, 0x00F0ECEF, 0x00F1EDF0, 0x00F2EEF1, + 0x00F3EFF2, 0x00F4F0F3, 0x00F5F1F4, 0x00F6F2F5, 0x00F7F3F6, 0x00F8F4F7, + 0x00F9F5F8, 0x00FAF6F9, 0x00FBF7FA, 0x00FCF8FB, 0x00FDF9FC, 0x00FEFAFD, + 0x00FFFBFE, 0x00FFFCFE, 0x00FFFDFE, 0x00FFFFFF +}; + +/* REDCLOUD PLL TABLE */ + +typedef struct RCDFPLL +{ + long frequency; /* 16.16 fixed point frequency */ + unsigned long post_div3; /* MCP Frequency dividers and multipliers */ + unsigned long pre_mul2; + unsigned long pre_div2; + unsigned long pll_value; /* MCP DotPLL Register Upper 32(0x0015) */ +} RCDFPLLENTRY; + +RCDFPLLENTRY RCDF_PLLtable[] = { + {0x0018EC4D, 1, 0, 0, 0x0000099E}, /* 24.9230 */ + {0x00192CCC, 0, 0, 0, 0x00000037}, /* 25.1750 */ + {0x001C526E, 1, 0, 0, 0x000009DA}, /* 28.3220 */ + {0x001C8F5C, 1, 0, 0, 0x0000005E}, /* 28.5600 */ + {0x001F8000, 1, 0, 0, 0x000002D2}, /* 31.5000 */ + {0x00240000, 1, 0, 0, 0x000007E2}, /* 36.0000 */ + {0x00258000, 1, 0, 0, 0x0000057A}, /* 37.5000 */ + {0x0025E395, 1, 0, 0, 0x000007FA}, /* 37.8890 */ + {0x00280000, 1, 0, 0, 0x0000030A}, /* 40.0000 */ + {0x002B29BA, 0, 0, 0, 0x0000005F}, /* 43.1630 */ + {0x002CE666, 0, 0, 0, 0x00000063}, /* 44.9000 */ + {0x002DB851, 1, 0, 0, 0x00000BC9}, /* 45.7200 */ + {0x00318000, 0, 0, 0, 0x0000054B}, /* 49.5000 */ + {0x00320000, 0, 0, 0, 0x0000006F}, /* 50.0000 */ + {0x00325999, 0, 1, 0, 0x00000037}, /* 50.3500 */ + {0x00360000, 1, 1, 0, 0x00000B0D}, /* 54.0000 */ + {0x00384000, 0, 0, 0, 0x000007F7}, /* 56.2500 */ + {0x0038643F, 0, 0, 0, 0x000007F7}, /* 56.3916 */ + {0x0038A4DD, 0, 0, 0, 0x0000057B}, /* 56.6444 */ + {0x003B0000, 0, 1, 0, 0x00000707}, /* 59.0000 */ + {0x003C10A3, 0, 0, 0, 0x0000030B}, /* 60.0650 */ + {0x003F0000, 1, 1, 0, 0x00000B39}, /* 63.0000 */ + {0x00410000, 1, 0, 0, 0x00000545}, /* 65.0000 */ + {0x00442DD2, 1, 0, 0, 0x000002E1}, /* 68.1790 */ + {0x00438000, 1, 1, 0, 0x00000FC1}, /* 67.5000 */ + {0x0046CCCC, 1, 0, 0, 0x00000561}, /* 70.8000 */ + {0x00480000, 1, 0, 0, 0x000007E1}, /* 72.0000 */ + {0x004A7B22, 0, 1, 0, 0x00000F4A}, /* 74.4810 */ + {0x004B0000, 1, 0, 0, 0x000007F5}, /* 75.0000 */ + {0x004EC000, 1, 0, 0, 0x00000305}, /* 78.7500 */ + {0x00500000, 1, 1, 0, 0x00000709}, /* 80.0000 */ + {0x00519999, 0, 0, 0, 0x000009C6}, /* 81.6000 */ + {0x0059CCCC, 0, 1, 0, 0x00000262}, /* 89.8000 */ + {0x005E8000, 0, 0, 0, 0x000002D2}, /* 94.5000 */ + {0x00618560, 0, 0, 0, 0x00000546}, /* 97.5200 */ + {0x00630000, 0, 1, 0, 0x00000B4A}, /* 99.0000 */ + {0x00642FDF, 0, 0, 0, 0x0000006E}, /* 100.1870 */ + {0x00656B85, 0, 0, 0, 0x00000552}, /* 101.4200 */ + {0x006C0000, 0, 0, 0, 0x000007E2}, /* 108.0000 */ + {0x00708000, 0, 0, 0, 0x000007F6}, /* 112.5000 */ + {0x00714F1A, 0, 0, 0, 0x0000057A}, /* 113.3090 */ + {0x0077A666, 0, 0, 0, 0x0000030A}, /* 119.6500 */ + {0x00806666, 1, 0, 0, 0x00000068}, /* 128.4000 */ + {0x00820000, 1, 1, 0, 0x00000FB0}, /* 130.0000 */ + {0x00821999, 1, 0, 0, 0x00000544}, /* 130.1000 */ + {0x00858000, 1, 0, 0, 0x0000006C}, /* 133.5000 */ + {0x00870000, 1, 0, 0, 0x00000550}, /* 135.0000 */ + {0x00906147, 1, 0, 0, 0x000007E0}, /* 144.3800 */ + {0x009D8000, 1, 0, 0, 0x00000304}, /* 157.5000 */ + {0x00A20000, 0, 0, 0, 0x000002B1}, /* 162.0000 */ + {0x00A933F7, 0, 0, 0, 0x000002B9}, /* 169.2030 */ + {0x00ACCC49, 0, 1, 0, 0x0000002D}, /* 172.798 */ + {0x00AF8000, 0, 0, 0, 0x000002C1}, /* 175.5000 */ + {0x00BD0000, 0, 0, 0, 0x000002D1}, /* 189.0000 */ + {0x00BEF5C2, 0, 0, 0, 0x0000053D}, /* 190.9600 */ + {0x00C60000, 0, 0, 0, 0x00000549}, /* 198.0000 */ + {0x00CA8000, 0, 0, 0, 0x00000551}, /* 202.5000 */ + {0x00E58000, 0, 0, 0, 0x0000057D}, /* 229.5000 */ +}; + +#define NUM_RCDF_FREQUENCIES sizeof(RCDF_PLLtable)/sizeof(RCDFPLLENTRY) + +/*--------------------------------------------------------------------------- + * gfx_reset_video (PRIVATE ROUTINE: NOT PART OF DURANGO API) + * + * This routine is used to disable all components of video overlay before + * performing a mode switch. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +void +redcloud_reset_video(void) +#else +void +gfx_reset_video(void) +#endif +{ + gfx_set_video_enable(0); + gfx_select_alpha_region(1); + gfx_set_alpha_enable(0); + gfx_select_alpha_region(2); + gfx_set_alpha_enable(0); + + /* SET REGION 0 AFTER RESET */ + + gfx_select_alpha_region(0); + gfx_set_alpha_enable(0); +} + +/*---------------------------------------------------------------------------- + * gfx_set_display_control (PRIVATE ROUTINE: NOT PART OF DURANGO API) + * + * This routine configures the display output. + * + * "sync_polarities" is used to set the polarities of the sync pulses + * according to the following mask: + * + * Bit 0: If set to 1, negative horizontal polarity is programmed, + * otherwise positive horizontal polarity is programmed. + * Bit 1: If set to 1, negative vertical polarity is programmed, + * otherwise positive vertical polarity is programmed. + * + *---------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +redcloud_set_display_control(int sync_polarities) +#else +int +gfx_set_display_control(int sync_polarities) +#endif +{ + unsigned long power; + unsigned long dcfg; + + /* CONFIGURE DISPLAY OUTPUT FROM VIDEO PROCESSOR */ + + dcfg = READ_VID32(RCDF_DISPLAY_CONFIG); + dcfg &= ~(RCDF_DCFG_CRT_SYNC_SKW_MASK | RCDF_DCFG_PWR_SEQ_DLY_MASK | + RCDF_DCFG_CRT_HSYNC_POL | RCDF_DCFG_CRT_VSYNC_POL | + RCDF_DCFG_FP_PWR_EN | RCDF_DCFG_FP_DATA_EN); + + /* Don't blindly set the PAL_BYP bit - assume that somebody along + * the line has set up the gamma correctly before this point */ + + dcfg |= (RCDF_DCFG_CRT_SYNC_SKW_INIT | RCDF_DCFG_PWR_SEQ_DLY_INIT); + + if (PanelEnable) { + power = READ_VID32(RCDF_POWER_MANAGEMENT); + power |= RCDF_PM_PANEL_POWER_ON; + WRITE_VID32(RCDF_POWER_MANAGEMENT, power); + } + + /* SET APPROPRIATE SYNC POLARITIES */ + + if (PanelEnable) { + unsigned int pt2 = READ_VID32(0x408); + + pt2 &= ~((1 << 22) | (1 << 23)); + WRITE_VID32(0x408, pt2); + } + + if (sync_polarities & 0x1) + dcfg |= RCDF_DCFG_CRT_HSYNC_POL; + if (sync_polarities & 0x2) + dcfg |= RCDF_DCFG_CRT_VSYNC_POL; + + WRITE_VID32(RCDF_DISPLAY_CONFIG, dcfg); + + return (0); +} + +/*--------------------------------------------------------------------------- + * gfx_set_clock_frequency + * + * This routine sets the clock frequency, specified as a 16.16 fixed point + * value (0x00318000 = 49.5 MHz). It will set the closest frequency found + * in the lookup table. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +void +redcloud_set_clock_frequency(unsigned long frequency) +#else +void +gfx_set_clock_frequency(unsigned long frequency) +#endif +{ + Q_WORD msr_value, sys_value; + unsigned long sys_low; + unsigned int i, index = 0; + unsigned long value; + long timeout = 1000; + long min, diff; + + /* FIND THE REGISTER VALUES FOR THE DESIRED FREQUENCY */ + /* Search the table for the closest frequency (16.16 format). */ + + value = RCDF_PLLtable[0].pll_value; + min = (long)RCDF_PLLtable[0].frequency - frequency; + if (min < 0L) + min = -min; + for (i = 1; i < NUM_RCDF_FREQUENCIES; i++) { + diff = (long)RCDF_PLLtable[i].frequency - frequency; + if (diff < 0L) + diff = -diff; + if (diff < min) { + min = diff; + index = i; + } + } + + /* VERIFY THAT WE ARE NOT WRITING WHAT IS ALREADY IN THE REGISTERS */ + /* The Dot PLL reset bit is tied to VDD for flat panels. This can */ + /* cause a brief drop in flat panel power, which can cause serious */ + /* glitches on some panels. */ + + gfx_msr_read(RC_ID_MCP, MCP_DOTPLL, &msr_value); + gfx_msr_read(RC_ID_MCP, MCP_SYS_RSTPLL, &sys_value); + + sys_low = 0; + if (RCDF_PLLtable[index].post_div3) + sys_low |= MCP_DOTPOSTDIV3; + if (RCDF_PLLtable[index].pre_div2) + sys_low |= MCP_DOTPREDIV2; + if (RCDF_PLLtable[index].pre_mul2) + sys_low |= MCP_DOTPREMULT2; + + if ((msr_value.low & MCP_DOTPLL_LOCK) && + (msr_value.high == RCDF_PLLtable[index].pll_value) && + ((sys_value. + low & (MCP_DOTPOSTDIV3 | MCP_DOTPREDIV2 | MCP_DOTPREMULT2)) == + sys_low)) { + return; + } + + /* PROGRAM THE SETTINGS WITH THE RESET BIT SET */ + /* Clear the bypass bit to ensure that the programmed */ + /* M, N and P values are being used. */ + + msr_value.high = RCDF_PLLtable[index].pll_value; + msr_value.low |= 0x00000001; + msr_value.low &= ~MCP_DOTPLL_BYPASS; + gfx_msr_write(RC_ID_MCP, MCP_DOTPLL, &msr_value); + + /* PROGRAM THE MCP DIVIDER VALUES */ + + sys_value.low &= ~(MCP_DOTPOSTDIV3 | MCP_DOTPREDIV2 | MCP_DOTPREMULT2); + sys_value.low |= sys_low; + gfx_msr_write(RC_ID_MCP, MCP_SYS_RSTPLL, &sys_value); + + /* CLEAR THE RESET BIT */ + + msr_value.low &= 0xFFFFFFFE; + gfx_msr_write(RC_ID_MCP, MCP_DOTPLL, &msr_value); + + /* WAIT FOR LOCK BIT */ + + do { + gfx_msr_read(RC_ID_MCP, MCP_DOTPLL, &msr_value); + } while (timeout-- && !(msr_value.low & MCP_DOTPLL_LOCK)); +} + +/*--------------------------------------------------------------------------- + * gfx_set_crt_enable + * + * This routine enables or disables the CRT output from the video processor. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +redcloud_set_crt_enable(int enable) +#else +int +gfx_set_crt_enable(int enable) +#endif +{ + unsigned long config, misc; + + config = READ_VID32(RCDF_DISPLAY_CONFIG); + misc = READ_VID32(RCDF_VID_MISC); + + switch (enable) { + case CRT_DISABLE: /* DISABLE EVERYTHING */ + + WRITE_VID32(RCDF_DISPLAY_CONFIG, + config & ~(RCDF_DCFG_DIS_EN | RCDF_DCFG_HSYNC_EN | + RCDF_DCFG_VSYNC_EN | RCDF_DCFG_DAC_BL_EN)); + WRITE_VID32(RCDF_VID_MISC, misc | RCDF_DAC_POWER_DOWN); + break; + + case CRT_ENABLE: /* ENABLE CRT DISPLAY, INCLUDING DISPLAY LOGIC */ + + WRITE_VID32(RCDF_DISPLAY_CONFIG, + config | RCDF_DCFG_DIS_EN | RCDF_DCFG_HSYNC_EN | + RCDF_DCFG_VSYNC_EN | RCDF_DCFG_DAC_BL_EN); + WRITE_VID32(RCDF_VID_MISC, + misc & ~RCDF_DAC_POWER_DOWN & ~RCDF_ANALOG_POWER_DOWN); + break; + + case CRT_STANDBY: /* HSYNC:OFF VSYNC:ON */ + + WRITE_VID32(RCDF_DISPLAY_CONFIG, + (config & ~(RCDF_DCFG_DIS_EN | RCDF_DCFG_HSYNC_EN | + RCDF_DCFG_DAC_BL_EN)) | RCDF_DCFG_VSYNC_EN); + WRITE_VID32(RCDF_VID_MISC, misc | RCDF_DAC_POWER_DOWN); + break; + + case CRT_SUSPEND: /* HSYNC:ON VSYNC:OFF */ + + WRITE_VID32(RCDF_DISPLAY_CONFIG, + (config & ~(RCDF_DCFG_DIS_EN | RCDF_DCFG_VSYNC_EN | + RCDF_DCFG_DAC_BL_EN)) | RCDF_DCFG_HSYNC_EN); + WRITE_VID32(RCDF_VID_MISC, misc | RCDF_DAC_POWER_DOWN); + break; + + default: + return (GFX_STATUS_BAD_PARAMETER); + } + return (GFX_STATUS_OK); +} + +/*---------------------------------------------------------------------------- + * gfx_set_video_enable + * + * This routine enables or disables the video overlay functionality. + *---------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +redcloud_set_video_enable(int enable) +#else +int +gfx_set_video_enable(int enable) +#endif +{ + unsigned long vcfg; + + /* WAIT FOR VERTICAL BLANK TO START */ + /* Otherwise a glitch can be observed. */ + + if (gfx_test_timing_active()) { + if (!gfx_test_vertical_active()) { + while (!gfx_test_vertical_active()) ; + } + while (gfx_test_vertical_active()) ; + } + + vcfg = READ_VID32(RCDF_VIDEO_CONFIG); + if (enable) { + /* ENABLE VIDEO OVERLAY FROM DISPLAY CONTROLLER */ + /* Use private routine to abstract the display controller. */ + + gfx_set_display_video_enable(1); + + /* ENABLE DISPLAY FILTER VIDEO OVERLAY */ + + vcfg |= RCDF_VCFG_VID_EN; + WRITE_VID32(RCDF_VIDEO_CONFIG, vcfg); + } else { + /* DISABLE DISPLAY FILTER VIDEO OVERLAY */ + + vcfg &= ~RCDF_VCFG_VID_EN; + WRITE_VID32(RCDF_VIDEO_CONFIG, vcfg); + + /* DISABLE VIDEO OVERLAY FROM DISPLAY CONTROLLER */ + /* Use private routine to abstract the display controller. */ + + gfx_set_display_video_enable(0); + } + return (0); +} + +/*---------------------------------------------------------------------------- + * gfx_set_video_format + * + * Sets input video format type, to one of the YUV formats or to RGB. + *---------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +redcloud_set_video_format(unsigned long format) +#else +int +gfx_set_video_format(unsigned long format) +#endif +{ + unsigned long ctrl, vcfg = 0; + + /* SET THE DISPLAY FILTER VIDEO INPUT FORMAT */ + + vcfg = READ_VID32(RCDF_VIDEO_CONFIG); + ctrl = READ_VID32(RCDF_VID_ALPHA_CONTROL); + ctrl &= ~(RCDF_VIDEO_INPUT_IS_RGB | RCDF_CSC_VIDEO_YUV_TO_RGB); + vcfg &= ~(RCDF_VCFG_VID_INP_FORMAT | RCDF_VCFG_4_2_0_MODE); + switch (format) { + case VIDEO_FORMAT_UYVY: + vcfg |= RCDF_VCFG_UYVY_FORMAT; + ctrl |= RCDF_CSC_VIDEO_YUV_TO_RGB; + break; + case VIDEO_FORMAT_YUYV: + vcfg |= RCDF_VCFG_YUYV_FORMAT; + ctrl |= RCDF_CSC_VIDEO_YUV_TO_RGB; + break; + case VIDEO_FORMAT_Y2YU: + vcfg |= RCDF_VCFG_Y2YU_FORMAT; + ctrl |= RCDF_CSC_VIDEO_YUV_TO_RGB; + break; + case VIDEO_FORMAT_YVYU: + vcfg |= RCDF_VCFG_YVYU_FORMAT; + ctrl |= RCDF_CSC_VIDEO_YUV_TO_RGB; + break; + case VIDEO_FORMAT_Y0Y1Y2Y3: + vcfg |= RCDF_VCFG_UYVY_FORMAT; + ctrl |= RCDF_CSC_VIDEO_YUV_TO_RGB; + vcfg |= RCDF_VCFG_4_2_0_MODE; + break; + case VIDEO_FORMAT_Y3Y2Y1Y0: + vcfg |= RCDF_VCFG_Y2YU_FORMAT; + ctrl |= RCDF_CSC_VIDEO_YUV_TO_RGB; + vcfg |= RCDF_VCFG_4_2_0_MODE; + break; + case VIDEO_FORMAT_Y1Y0Y3Y2: + vcfg |= RCDF_VCFG_YUYV_FORMAT; + ctrl |= RCDF_CSC_VIDEO_YUV_TO_RGB; + vcfg |= RCDF_VCFG_4_2_0_MODE; + break; + case VIDEO_FORMAT_Y1Y2Y3Y0: + vcfg |= RCDF_VCFG_YVYU_FORMAT; + ctrl |= RCDF_CSC_VIDEO_YUV_TO_RGB; + vcfg |= RCDF_VCFG_4_2_0_MODE; + break; + case VIDEO_FORMAT_RGB: + ctrl |= RCDF_VIDEO_INPUT_IS_RGB; + vcfg |= RCDF_VCFG_UYVY_FORMAT; + break; + case VIDEO_FORMAT_P2M_P2L_P1M_P1L: + ctrl |= RCDF_VIDEO_INPUT_IS_RGB; + vcfg |= RCDF_VCFG_Y2YU_FORMAT; + break; + case VIDEO_FORMAT_P1M_P1L_P2M_P2L: + ctrl |= RCDF_VIDEO_INPUT_IS_RGB; + vcfg |= RCDF_VCFG_YUYV_FORMAT; + break; + case VIDEO_FORMAT_P1M_P2L_P2M_P1L: + ctrl |= RCDF_VIDEO_INPUT_IS_RGB; + vcfg |= RCDF_VCFG_YVYU_FORMAT; + break; + default: + return GFX_STATUS_BAD_PARAMETER; + } + WRITE_VID32(RCDF_VIDEO_CONFIG, vcfg); + WRITE_VID32(RCDF_VID_ALPHA_CONTROL, ctrl); + + /* SET THE VIDEO FORMAT IN THE DISPLAY CONTROLLER */ + /* Use private routine to abstract display controller. */ + + gfx_set_display_video_format(format); + return (0); +} + +/*---------------------------------------------------------------------------- + * gfx_set_video_size + * + * This routine specifies the size of the source data. It is used only + * to determine how much data to transfer per frame, and is not used to + * calculate the scaling value (that is handled by a separate routine). + *---------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +redcloud_set_video_size(unsigned short width, unsigned short height) +#else +int +gfx_set_video_size(unsigned short width, unsigned short height) +#endif +{ + unsigned long size, vcfg, vid_420, pitch; + + /* SET THE DISPLAY FILTER VIDEO LINE SIZE */ + /* Match the DC hardware alignment requirement. The line size must */ + /* always be 32-byte aligned. However, we can manage smaller */ + /* alignments by decreasing the pitch and clipping the video window. */ + /* The VG will fetch extra data for each line, but the decreased */ + /* pitch will ensure that it always begins fetching at the start of */ + /* the video line. */ + + vcfg = READ_VID32(RCDF_VIDEO_CONFIG); + + vid_420 = vcfg & RCDF_VCFG_4_2_0_MODE; + + vcfg &= ~(RCDF_VCFG_LINE_SIZE_LOWER_MASK | RCDF_VCFG_LINE_SIZE_UPPER); + + size = ((width >> 1) + 7) & 0xFFF8; + pitch = ((width << 1) + 7) & 0xFFF8; + + vcfg |= (size & 0x00FF) << 8; + if (size & 0x0100) + vcfg |= RCDF_VCFG_LINE_SIZE_UPPER; + WRITE_VID32(RCDF_VIDEO_CONFIG, vcfg); + + /* SET VIDEO BUFFER LINE SIZE IN DISPLAY CONTROLLER */ + /* Use private routine to abstract the display controller. */ + + gfx_set_display_video_size(width, height); + + /* SET VIDEO PITCH */ + /* We are only maintaining legacy for 4:2:2 video formats. */ + /* 4:2:0 video in previous chips was inadequate for most */ + /* common video formats. */ + + if (!vid_420) + gfx_set_video_yuv_pitch(pitch, pitch << 1); + + return (0); +} + +/*---------------------------------------------------------------------------- + * gfx_set_video_offset + * + * This routine sets the starting offset for the video buffer when only + * one offset needs to be specified. + *---------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +redcloud_set_video_offset(unsigned long offset) +#else +int +gfx_set_video_offset(unsigned long offset) +#endif +{ + /* SAVE VALUE FOR FUTURE CLIPPING OF THE TOP OF THE VIDEO WINDOW */ + + gfx_vid_offset = offset; + + /* SET VIDEO BUFFER OFFSET IN DISPLAY CONTROLLER */ + /* Use private routine to abstract the display controller. */ + + gfx_set_display_video_offset(offset); + return (0); +} + +/*---------------------------------------------------------------------------- + * gfx_set_video_yuv_offsets + * + * This routine sets the starting offset for the video buffer when displaying + * 4:2:0 video. + *---------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +redcloud_set_video_yuv_offsets(unsigned long yoffset, unsigned long uoffset, + unsigned long voffset) +#else +int +gfx_set_video_yuv_offsets(unsigned long yoffset, unsigned long uoffset, + unsigned long voffset) +#endif +{ + /* SAVE VALUE FOR FUTURE CLIPPING OF THE TOP OF THE VIDEO WINDOW */ + + gfx_vid_offset = yoffset; + gfx_vid_uoffset = uoffset; + gfx_vid_voffset = voffset; + + /* SET VIDEO BUFFER OFFSET IN DISPLAY CONTROLLER */ + /* Use private routine to abstract the display controller. */ + + gfx_set_display_video_yuv_offsets(yoffset, uoffset, voffset); + + return (0); +} + +/*---------------------------------------------------------------------------- + * gfx_set_video_yuv_pitch + * + * This routine sets the byte offset between consecutive scanlines of YUV video data + *---------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +redcloud_set_video_yuv_pitch(unsigned long ypitch, unsigned long uvpitch) +#else +int +gfx_set_video_yuv_pitch(unsigned long ypitch, unsigned long uvpitch) +#endif +{ + /* SET VIDEO PITCH IN DISPLAY CONTROLLER */ + /* Use private routine to abstract the display controller. */ + + gfx_set_display_video_yuv_pitch(ypitch, uvpitch); + + return (0); +} + +/*--------------------------------------------------------------------------- + * gfx_set_video_scale + * + * This routine sets the scale factor for the video overlay window. The + * size of the source and destination regions are specified in pixels. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +redcloud_set_video_scale(unsigned short srcw, unsigned short srch, + unsigned short dstw, unsigned short dsth) +#else +int +gfx_set_video_scale(unsigned short srcw, unsigned short srch, + unsigned short dstw, unsigned short dsth) +#endif +{ + unsigned long xscale, yscale; + + /* SAVE PARAMETERS (unless don't-care zero destination arguments are used) */ + /* These are needed for clipping the video window later. */ + + if (dstw != 0) { + gfx_vid_srcw = srcw; + gfx_vid_dstw = dstw; + } + if (dsth != 0) { + gfx_vid_srch = srch; + gfx_vid_dsth = dsth; + } + + /* CALCULATE DISPLAY FILTER SCALE FACTORS */ + /* Zero width and height indicate don't care conditions */ + /* Downscaling is performed in a separate function. */ + + if (dstw == 0) + xscale = READ_VID32(RCDF_VIDEO_SCALE) & 0xffff; + /* keep previous if don't-care argument */ + else if (dstw <= srcw) + xscale = 0x2000; + /* horizontal downscaling is currently done in a separate function */ + else if ((srcw == 1) || (dstw == 1)) + return GFX_STATUS_BAD_PARAMETER; + else + xscale = (0x2000l * (srcw - 1l)) / (dstw - 1l); + + if (dsth == 0) + yscale = (READ_VID32(RCDF_VIDEO_SCALE) & 0xffff0000) >> 16; + /* keep previous if don't-care argument */ + else if (dsth <= srch) + yscale = 0x2000; + /* vertical downscaling is handled in a separate function */ + else if ((srch == 1) || (dsth == 1)) + return GFX_STATUS_BAD_PARAMETER; + else + yscale = (0x2000l * (srch - 1l)) / (dsth - 1l); + + WRITE_VID32(RCDF_VIDEO_SCALE, (yscale << 16) | xscale); + + /* CALL ROUTINE TO UPDATE WINDOW POSITION */ + /* This is required because the scale values affect the number of */ + /* source data pixels that need to be clipped, as well as the */ + /* amount of data that needs to be transferred. */ + + gfx_set_video_window(gfx_vid_xpos, gfx_vid_ypos, gfx_vid_width, + gfx_vid_height); + return (0); +} + +/*--------------------------------------------------------------------------- + * gfx_set_video_vertical_downscale + * + * This routine sets the vertical downscale factor for the video overlay + * window. + * The height of the source and destination regions are specified in pixels. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +redcloud_set_video_vertical_downscale(unsigned short srch, + unsigned short dsth) +#else +int +gfx_set_video_vertical_downscale(unsigned short srch, unsigned short dsth) +#endif +{ + /* SET VIDEO SCALE IN DISPLAY CONTROLLER */ + /* Use private routine to abstract hardware */ + + gfx_set_display_video_downscale(srch, dsth); + return 0; +} + +/*--------------------------------------------------------------------------- + * gfx_set_video_vertical_downscale_enable + * + * This routine sets the vertical downscale enable for the video overlay + * window. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +void +redcloud_set_video_vertical_downscale_enable(int enable) +#else +void +gfx_set_video_vertical_downscale_enable(int enable) +#endif +{ + /* SET VIDEO SCALE IN DISPLAY CONTROLLER */ + /* Use private routine to abstract hardware */ + + gfx_set_display_video_vertical_downscale_enable(enable); +} + +/*--------------------------------------------------------------------------- + * gfx_set_video_downscale_config + * + * This routine sets the downscale type and factor for the video overlay + * window. + * Note: No downscaling support for RGB565 and YUV420 video formats. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +redcloud_set_video_downscale_config(unsigned short type, unsigned short m) +#else +int +gfx_set_video_downscale_config(unsigned short type, unsigned short m) +#endif +{ + unsigned long downscale; + + if ((m < 1) || (m > 16)) + return GFX_STATUS_BAD_PARAMETER; + + downscale = READ_VID32(RCDF_VIDEO_DOWNSCALER_CONTROL); + downscale &= + ~(RCDF_VIDEO_DOWNSCALE_FACTOR_MASK | RCDF_VIDEO_DOWNSCALE_TYPE_MASK); + downscale |= ((unsigned long)(m - 1) << RCDF_VIDEO_DOWNSCALE_FACTOR_POS); + switch (type) { + case VIDEO_DOWNSCALE_KEEP_1_OF: + downscale |= RCDF_VIDEO_DOWNSCALE_TYPE_A; + break; + case VIDEO_DOWNSCALE_DROP_1_OF: + downscale |= RCDF_VIDEO_DOWNSCALE_TYPE_B; + break; + default: + return GFX_STATUS_BAD_PARAMETER; + } + WRITE_VID32(RCDF_VIDEO_DOWNSCALER_CONTROL, downscale); + return (0); +} + +/*--------------------------------------------------------------------------- + * gfx_set_video_downscale_coefficients + * + * This routine sets the downscale filter coefficients. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +redcloud_set_video_downscale_coefficients(unsigned short coef1, + unsigned short coef2, unsigned short coef3, unsigned short coef4) +#else +int +gfx_set_video_downscale_coefficients(unsigned short coef1, + unsigned short coef2, unsigned short coef3, unsigned short coef4) +#endif +{ + if ((coef1 + coef2 + coef3 + coef4) != 16) + return GFX_STATUS_BAD_PARAMETER; + + WRITE_VID32(RCDF_VIDEO_DOWNSCALER_COEFFICIENTS, + ((unsigned long)coef1 << RCDF_VIDEO_DOWNSCALER_COEF1_POS) | + ((unsigned long)coef2 << RCDF_VIDEO_DOWNSCALER_COEF2_POS) | + ((unsigned long)coef3 << RCDF_VIDEO_DOWNSCALER_COEF3_POS) | + ((unsigned long)coef4 << RCDF_VIDEO_DOWNSCALER_COEF4_POS)); + return (0); +} + +/*--------------------------------------------------------------------------- + * gfx_set_video_downscale_enable + * + * This routine enables or disables downscaling for the video overlay window. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +redcloud_set_video_downscale_enable(int enable) +#else +int +gfx_set_video_downscale_enable(int enable) +#endif +{ + unsigned long downscale; + + downscale = READ_VID32(RCDF_VIDEO_DOWNSCALER_CONTROL); + if (enable) + downscale |= RCDF_VIDEO_DOWNSCALE_ENABLE; + else + downscale &= ~RCDF_VIDEO_DOWNSCALE_ENABLE; + WRITE_VID32(RCDF_VIDEO_DOWNSCALER_CONTROL, downscale); + return (0); +} + +/*--------------------------------------------------------------------------- + * gfx_set_video_window + * + * This routine sets the position and size of the video overlay window. The + * x and y positions are specified in screen relative coordinates, and may be + * negative. + * The size of destination region is specified in pixels. The line size + * indicates the number of bytes of source data per scanline. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +redcloud_set_video_window(short x, short y, unsigned short w, + unsigned short h) +#else +int +gfx_set_video_window(short x, short y, unsigned short w, unsigned short h) +#endif +{ + unsigned long hadjust, vadjust; + unsigned long xstart, ystart, xend, yend; + + /* SAVE PARAMETERS */ + /* These are needed to call this routine if the scale value changes. */ + + gfx_vid_xpos = x; + gfx_vid_ypos = y; + gfx_vid_width = w; + gfx_vid_height = h; + + /* GET ADJUSTMENT VALUES */ + /* Use routines to abstract version of display controller. */ + + hadjust = gfx_get_htotal() - gfx_get_hsync_end() - 14l; + vadjust = gfx_get_vtotal() - gfx_get_vsync_end() + 1l; + + /* LEFT CLIPPING */ + + if (x < 0) { + gfx_set_video_left_crop((unsigned short)(-x)); + xstart = hadjust; + } else { + gfx_set_video_left_crop(0); + xstart = (unsigned long)x + hadjust; + } + + /* HORIZONTAL END */ + /* End positions in register are non-inclusive (one more than the actual + * end) */ + + if ((x + w) < gfx_get_hactive()) + xend = (unsigned long)x + (unsigned long)w + hadjust; + + /* RIGHT-CLIPPING */ + else + xend = (unsigned long)gfx_get_hactive() + hadjust; + + /* VERTICAL START */ + + ystart = (unsigned long)y + vadjust; + + /* VERTICAL END */ + + if ((y + h) < gfx_get_vactive()) + yend = (unsigned long)y + (unsigned long)h + vadjust; + + /* BOTTOM-CLIPPING */ + else + yend = (unsigned long)gfx_get_vactive() + vadjust; + + /* SET VIDEO POSITION */ + + WRITE_VID32(RCDF_VIDEO_X_POS, (xend << 16) | xstart); + WRITE_VID32(RCDF_VIDEO_Y_POS, (yend << 16) | ystart); + + return (0); +} + +/*--------------------------------------------------------------------------- + * gfx_set_video_left_crop + * + * This routine sets the number of pixels which will be cropped from the + * beginning of each video line. The video window will begin to display only + * from the pixel following the cropped pixels, and the cropped pixels + * will be ignored. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +redcloud_set_video_left_crop(unsigned short x) +#else +int +gfx_set_video_left_crop(unsigned short x) +#endif +{ + unsigned long vcfg, initread; + + vcfg = READ_VID32(RCDF_VIDEO_CONFIG); + + /* CLIPPING ON LEFT */ + /* Adjust initial read for scale, checking for divide by zero. Mask the + * lower three bits when clipping 4:2:0 video. By masking the bits instead + * of rounding up we ensure that we always clip less than or equal to the + * desired number of pixels. This prevents visual artifacts from + * over-clipping. We mask three bits to meet the HW requirement that 4:2:0 + * clipping be 16-byte or 8-pixel aligned. + * */ + + if (gfx_vid_dstw) { + initread = (unsigned long)x *gfx_vid_srcw / gfx_vid_dstw; + + if (vcfg & RCDF_VCFG_4_2_0_MODE) + initread &= 0xFFF8; + } else + initread = 0; + + /* SET INITIAL READ ADDRESS */ + + vcfg &= ~RCDF_VCFG_INIT_READ_MASK; + vcfg |= (initread << 15) & RCDF_VCFG_INIT_READ_MASK; + WRITE_VID32(RCDF_VIDEO_CONFIG, vcfg); + return (0); +} + +/*--------------------------------------------------------------------------- + * gfx_set_video_color_key + * + * This routine specifies the color key value and mask for the video overlay + * hardware. To disable color key, the color and mask should both be set to + * zero. The hardware uses the color key in the following equation: + * + * ((source data) & (color key mask)) == ((color key) & (color key mask)) + * + * If "graphics" is set to TRUE, the source data is graphics, and color key + * is an RGB value. If "graphics" is set to FALSE, the source data is the + * video, and color key is a YUV value. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +redcloud_set_video_color_key(unsigned long key, unsigned long mask, + int graphics) +#else +int +gfx_set_video_color_key(unsigned long key, unsigned long mask, int graphics) +#endif +{ + unsigned long dcfg = 0; + + /* SET RCDF COLOR KEY VALUE */ + + WRITE_VID32(RCDF_VIDEO_COLOR_KEY, key); + WRITE_VID32(RCDF_VIDEO_COLOR_MASK, mask); + + /* SELECT GRAPHICS OR VIDEO DATA TO COMPARE TO THE COLOR KEY */ + + dcfg = READ_VID32(RCDF_DISPLAY_CONFIG); + if (graphics & 0x01) + dcfg &= ~RCDF_DCFG_VG_CK; + else + dcfg |= RCDF_DCFG_VG_CK; + WRITE_VID32(RCDF_DISPLAY_CONFIG, dcfg); + return (0); +} + +/*--------------------------------------------------------------------------- + * gfx_set_video_filter + * + * This routine enables or disables the video overlay filters. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +redcloud_set_video_filter(int xfilter, int yfilter) +#else +int +gfx_set_video_filter(int xfilter, int yfilter) +#endif +{ + unsigned long vcfg = 0; + + /* ENABLE OR DISABLE DISPLAY FILTER VIDEO OVERLAY FILTERS */ + + vcfg = READ_VID32(RCDF_VIDEO_CONFIG); + vcfg &= ~(RCDF_VCFG_X_FILTER_EN | RCDF_VCFG_Y_FILTER_EN); + if (xfilter) + vcfg |= RCDF_VCFG_X_FILTER_EN; + if (yfilter) + vcfg |= RCDF_VCFG_Y_FILTER_EN; + WRITE_VID32(RCDF_VIDEO_CONFIG, vcfg); + return (0); +} + +/*--------------------------------------------------------------------------- + * gfx_set_video_palette + * + * This routine loads the video hardware palette. If a NULL pointer is + * specified, the palette is bypassed (for Redcloud, this means loading the + * palette with identity values). + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +redcloud_set_video_palette(unsigned long *palette) +#else +int +gfx_set_video_palette(unsigned long *palette) +#endif +{ + unsigned long i, entry; + unsigned long misc, dcfg; + + /* ENABLE THE VIDEO PALETTE */ + /* Ensure that the video palette has an effect by routing video data */ + /* through the palette RAM and clearing the 'Bypass Both' bit. */ + + dcfg = READ_VID32(RCDF_DISPLAY_CONFIG); + misc = READ_VID32(RCDF_VID_MISC); + + dcfg |= RCDF_DCFG_GV_PAL_BYP; + misc &= ~RCDF_GAMMA_BYPASS_BOTH; + + WRITE_VID32(RCDF_DISPLAY_CONFIG, dcfg); + WRITE_VID32(RCDF_VID_MISC, misc); + + if (gfx_test_timing_active()) { + while (!gfx_test_vertical_active()) ; + while (gfx_test_vertical_active()) ; + while (!gfx_test_vertical_active()) ; + } + + /* LOAD REDCLOUD VIDEO PALETTE */ + + WRITE_VID32(RCDF_PALETTE_ADDRESS, 0); + for (i = 0; i < 256; i++) { + if (palette) + entry = palette[i]; + else + entry = gfx_gamma_ram_redcloud[i]; + WRITE_VID32(RCDF_PALETTE_DATA, entry); + } + + return (0); +} + +/*--------------------------------------------------------------------------- + * gfx_set_graphics_palette + * + * This routine loads the video hardware palette. If a NULL pointer is + * specified, the palette is bypassed (for Redcloud, this means loading the + * palette with identity values). Note that this routine is identical to + * gfx_set_video_palette, except that the hardware is updated to route + * graphics data through the palette. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +redcloud_set_graphics_palette(unsigned long *palette) +#else +int +gfx_set_graphics_palette(unsigned long *palette) +#endif +{ + unsigned long i, entry; + unsigned long misc, dcfg; + + /* ENABLE THE VIDEO PALETTE */ + /* Ensure that the video palette has an effect by routing video data */ + /* through the palette RAM and clearing the 'Bypass Both' bit. */ + + dcfg = READ_VID32(RCDF_DISPLAY_CONFIG); + misc = READ_VID32(RCDF_VID_MISC); + + dcfg &= ~RCDF_DCFG_GV_PAL_BYP; + misc &= ~RCDF_GAMMA_BYPASS_BOTH; + + WRITE_VID32(RCDF_DISPLAY_CONFIG, dcfg); + WRITE_VID32(RCDF_VID_MISC, misc); + + if (gfx_test_timing_active()) { + while (!gfx_test_vertical_active()) ; + while (gfx_test_vertical_active()) ; + while (!gfx_test_vertical_active()) ; + } + + /* LOAD REDCLOUD VIDEO PALETTE */ + + WRITE_VID32(RCDF_PALETTE_ADDRESS, 0); + for (i = 0; i < 256; i++) { + if (palette) + entry = palette[i]; + else + entry = gfx_gamma_ram_redcloud[i]; + WRITE_VID32(RCDF_PALETTE_DATA, entry); + } + + return (0); +} + +/*--------------------------------------------------------------------------- + * gfx_set_graphics_palette_entry + * + * This routine loads a single entry of the video hardware palette. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +redcloud_set_graphics_palette_entry(unsigned long index, + unsigned long palette) +#else +int +gfx_set_graphics_palette_entry(unsigned long index, unsigned long palette) +#endif +{ + unsigned long dcfg, misc; + + if (index > 0xFF) + return GFX_STATUS_BAD_PARAMETER; + + /* ENABLE THE VIDEO PALETTE */ + /* Ensure that the video palette has an effect by routing video data */ + /* through the palette RAM and clearing the 'Bypass Both' bit. */ + + dcfg = READ_VID32(RCDF_DISPLAY_CONFIG); + misc = READ_VID32(RCDF_VID_MISC); + + dcfg &= ~RCDF_DCFG_GV_PAL_BYP; + misc &= ~RCDF_GAMMA_BYPASS_BOTH; + + WRITE_VID32(RCDF_DISPLAY_CONFIG, dcfg); + WRITE_VID32(RCDF_VID_MISC, misc); + + /* SET A SINGLE ENTRY */ + + WRITE_VID32(RCDF_PALETTE_ADDRESS, index); + WRITE_VID32(RCDF_PALETTE_DATA, palette); + + return (0); +} + +/*--------------------------------------------------------------------------- + * gfx_set_video_palette_entry + * + * This routine loads a single entry of the video hardware palette. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +redcloud_set_video_palette_entry(unsigned long index, unsigned long palette) +#else +int +gfx_set_video_palette_entry(unsigned long index, unsigned long palette) +#endif +{ + unsigned long dcfg, misc; + + if (index > 0xFF) + return GFX_STATUS_BAD_PARAMETER; + + /* ENABLE THE VIDEO PALETTE */ + /* Ensure that the video palette has an effect by routing video data */ + /* through the palette RAM and clearing the 'Bypass Both' bit. */ + + dcfg = READ_VID32(RCDF_DISPLAY_CONFIG); + misc = READ_VID32(RCDF_VID_MISC); + + dcfg |= RCDF_DCFG_GV_PAL_BYP; + misc &= ~RCDF_GAMMA_BYPASS_BOTH; + + WRITE_VID32(RCDF_DISPLAY_CONFIG, dcfg); + WRITE_VID32(RCDF_VID_MISC, misc); + + /* SET A SINGLE ENTRY */ + + WRITE_VID32(RCDF_PALETTE_ADDRESS, index); + WRITE_VID32(RCDF_PALETTE_DATA, palette); + + return (0); +} + +/*--------------------------------------------------------------------------- + * gfx_set_video_palette_bypass + * + * This routine enables/disables the pallete RAM bypass. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +redcloud_set_video_palette_bypass(int enable) +#else +int +gfx_set_video_palette_bypass(int enable) +#endif +{ + unsigned long misc; + + misc = READ_VID32(RCDF_VID_MISC); + + if (enable) + misc |= RCDF_GAMMA_BYPASS_BOTH; + else + misc &= ~RCDF_GAMMA_BYPASS_BOTH; + + WRITE_VID32(RCDF_VID_MISC, misc); + + return 0; +} + +/*--------------------------------------------------------------------------- + * gfx_set_video_request() + * + * This routine sets the horizontal (pixel) and vertical (line) video request + * values. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +redcloud_set_video_request(short x, short y) +#else +int +gfx_set_video_request(short x, short y) +#endif +{ + /* SET DISPLAY FILTER VIDEO REQUEST */ + + x += gfx_get_htotal() - gfx_get_hsync_end() - 2; + y += gfx_get_vtotal() - gfx_get_vsync_end() + 1; + + if ((x < 0) || (x > RCDF_VIDEO_REQUEST_MASK) || + (y < 0) || (y > RCDF_VIDEO_REQUEST_MASK)) + return GFX_STATUS_BAD_PARAMETER; + + WRITE_VID32(RCDF_VIDEO_REQUEST, + ((unsigned long)x << RCDF_VIDEO_X_REQUEST_POS) | ((unsigned long)y << + RCDF_VIDEO_Y_REQUEST_POS)); + return (0); +} + +/*--------------------------------------------------------------------------- + * gfx_set_video_cursor() + * + * This routine configures the video hardware cursor. + * If the "mask"ed bits in the graphics pixel match "key", then either + * "color1" or "color2" will be used for this pixel, according to the value of + * bit number "select_color2" of the graphics pixel. + * + * key - 24 bit RGB value + * mask - 24 bit mask + * color1, color2 - RGB or YUV, depending on the current color space + * conversion select_color2 - value between 0 to 23 + * + * To disable match, a "mask" and "key" value of 0xffffff should be set, + * because the graphics pixels incoming to the video processor have maximum 16 + * bits set (0xF8FCF8). + * + * This feature is useful for disabling alpha blending of the cursor. + * Otherwise cursor image would be blurred (or completely invisible if video + * alpha is maximum value). + * Note: the cursor pixel replacements take place both inside and outside the + * video overlay window. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +redcloud_set_video_cursor(unsigned long key, unsigned long mask, + unsigned short select_color2, unsigned long color1, unsigned long color2) +#else +int +gfx_set_video_cursor(unsigned long key, unsigned long mask, + unsigned short select_color2, unsigned long color1, unsigned long color2) +#endif +{ + if (select_color2 > RCDF_CURSOR_COLOR_BITS) + return GFX_STATUS_BAD_PARAMETER; + key = + (key & RCDF_COLOR_MASK) | ((unsigned long)select_color2 << + RCDF_CURSOR_COLOR_KEY_OFFSET_POS); + WRITE_VID32(RCDF_CURSOR_COLOR_KEY, key); + WRITE_VID32(RCDF_CURSOR_COLOR_MASK, mask); + WRITE_VID32(RCDF_CURSOR_COLOR_1, color1); + WRITE_VID32(RCDF_CURSOR_COLOR_2, color2); + return (0); +} + +/*--------------------------------------------------------------------------- + * gfx_set_video_cursor() + * + * This routine configures the video hardware cursor. + * If the "mask"ed bits in the graphics pixel match "key", then either + * "color1"or "color2" will be used for this pixel, according to the value of + * bit number "select_color2" of the graphics pixel. + * + * key - 24 bit RGB value + * mask - 24 bit mask + * color1, color2 - RGB or YUV, depending on the current color space + * conversion select_color2 - value between 0 to 23 + * + * To disable match, a "mask" and "key" value of 0xffffff should be set, + * because the graphics pixels incoming to the video processor have maximum 16 + * bits set (0xF8FCF8). + * + * This feature is useful for disabling alpha blending of the cursor. + * Otherwise cursor image would be blurred (or completely invisible if video + * alpha is maximum value). + * Note: the cursor pixel replacements take place both inside and outside the + * video overlay window. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +redcloud_set_video_cursor_enable(int enable) +#else +int +gfx_set_video_cursor_enable(int enable) +#endif +{ + unsigned long temp = READ_VID32(RCDF_CURSOR_COLOR_KEY); + + if (enable) + temp |= RCDF_CURSOR_COLOR_KEY_ENABLE; + else + temp &= ~RCDF_CURSOR_COLOR_KEY_ENABLE; + + WRITE_VID32(RCDF_CURSOR_COLOR_KEY, temp); + return (0); +} + +/*--------------------------------------------------------------------------- + * gfx_set_alpha_enable + * + * This routine enables or disables the currently selected alpha region. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +redcloud_set_alpha_enable(int enable) +#else +int +gfx_set_alpha_enable(int enable) +#endif +{ + unsigned long address = 0, value = 0; + + if (gfx_alpha_select > 2) + return (GFX_STATUS_UNSUPPORTED); + address = RCDF_ALPHA_CONTROL_1 + ((unsigned long)gfx_alpha_select << 5); + value = READ_VID32(address); + if (enable) + value |= RCDF_ACTRL_WIN_ENABLE; + else + value &= ~(RCDF_ACTRL_WIN_ENABLE); + WRITE_VID32(address, value); + return (GFX_STATUS_OK); +} + +/*--------------------------------------------------------------------------- + * gfx_set_alpha_window + * + * This routine sets the size of the currently selected alpha region. + * Note: "x" and "y" are signed to enable using negative values needed for + * implementing workarounds of hardware issues. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +redcloud_set_alpha_window(short x, short y, + unsigned short width, unsigned short height) +#else +int +gfx_set_alpha_window(short x, short y, + unsigned short width, unsigned short height) +#endif +{ + unsigned long address = 0; + + /* CHECK FOR CLIPPING */ + + if ((x + width) > gfx_get_hactive()) + width = gfx_get_hactive() - x; + if ((y + height) > gfx_get_vactive()) + height = gfx_get_vactive() - y; + + /* ADJUST POSITIONS */ + + x += gfx_get_htotal() - gfx_get_hsync_end() - 2; + y += gfx_get_vtotal() - gfx_get_vsync_end() + 1; + + if (gfx_alpha_select > 2) + return (GFX_STATUS_UNSUPPORTED); + address = RCDF_ALPHA_XPOS_1 + ((unsigned long)gfx_alpha_select << 5); + + /* END POSITIONS IN REGISTERS ARE NON-INCLUSIVE (ONE MORE THAN ACTUAL END) + * */ + + WRITE_VID32(address, (unsigned long)x | + ((unsigned long)(x + width) << 16)); + WRITE_VID32(address + 8, (unsigned long)y | + ((unsigned long)(y + height) << 16)); + return (GFX_STATUS_OK); +} + +/*--------------------------------------------------------------------------- + * gfx_set_alpha_value + * + * This routine sets the alpha value for the currently selected alpha + * region. It also specifies an increment/decrement value for fading. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +redcloud_set_alpha_value(unsigned char alpha, char delta) +#else +int +gfx_set_alpha_value(unsigned char alpha, char delta) +#endif +{ + unsigned long address = 0, value = 0; + + if (gfx_alpha_select > 2) + return (GFX_STATUS_UNSUPPORTED); + address = RCDF_ALPHA_CONTROL_1 + ((unsigned long)gfx_alpha_select << 5); + value = READ_VID32(address); + value &= RCDF_ACTRL_WIN_ENABLE; /* keep only enable bit */ + value |= (unsigned long)alpha; + value |= (((unsigned long)delta) & 0xff) << 8; + value |= RCDF_ACTRL_LOAD_ALPHA; + WRITE_VID32(address, value); + return (GFX_STATUS_OK); +} + +/*--------------------------------------------------------------------------- + * gfx_set_alpha_priority + * + * This routine sets the priority of the currently selected alpha region. + * A higher value indicates a higher priority. + * Note: Priority of enabled alpha windows must be different. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +redcloud_set_alpha_priority(int priority) +#else +int +gfx_set_alpha_priority(int priority) +#endif +{ + unsigned long pos = 0, value = 0; + + if (priority > 3) + return (GFX_STATUS_BAD_PARAMETER); + if (gfx_alpha_select > 2) + return (GFX_STATUS_UNSUPPORTED); + value = READ_VID32(RCDF_VID_ALPHA_CONTROL); + pos = 16 + (gfx_alpha_select << 1); + value &= ~(0x03l << pos); + value |= (unsigned long)priority << pos; + WRITE_VID32(RCDF_VID_ALPHA_CONTROL, value); + return (GFX_STATUS_OK); +} + +/*--------------------------------------------------------------------------- + * gfx_set_alpha_color + * + * This routine sets the color to be displayed inside the currently selected + * alpha window when there is a color key match (when the alpha color + * mechanism is enabled). + * "color" is an RGB value (for RGB blending) or a YUV value (for YUV + * blending). + * In Interlaced YUV blending mode, Y/2 value should be used. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +redcloud_set_alpha_color(unsigned long color) +#else +int +gfx_set_alpha_color(unsigned long color) +#endif +{ + unsigned long address = 0; + + if (gfx_alpha_select > 2) + return (GFX_STATUS_UNSUPPORTED); + address = RCDF_ALPHA_COLOR_1 + ((unsigned long)gfx_alpha_select << 5); + WRITE_VID32(address, color); + return (GFX_STATUS_OK); +} + +/*--------------------------------------------------------------------------- + * gfx_set_alpha_color_enable + * + * Enable or disable the color mechanism in the alpha window. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +redcloud_set_alpha_color_enable(int enable) +#else +int +gfx_set_alpha_color_enable(int enable) +#endif +{ + unsigned long color; + unsigned long address = 0; + + if (gfx_alpha_select > 2) + return (GFX_STATUS_UNSUPPORTED); + address = RCDF_ALPHA_COLOR_1 + ((unsigned long)gfx_alpha_select << 5); + color = READ_VID32(address); + if (enable) + color |= RCDF_ALPHA_COLOR_ENABLE; + else + color &= ~RCDF_ALPHA_COLOR_ENABLE; + WRITE_VID32(address, color); + return (GFX_STATUS_OK); +} + +/*--------------------------------------------------------------------------- + * gfx_set_no_ck_outside_alpha + * + * This function affects where inside the video window color key or chroma + * key comparison is done: + * If enable is TRUE, color/chroma key comparison is performed only inside + * the enabled alpha windows. Outside the (enabled) alpha windows, only video + * is displayed if color key is used, and only graphics is displayed if chroma + * key is used. + * If enable is FALSE, color/chroma key comparison is performed in all the + * video window area. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +redcloud_set_no_ck_outside_alpha(int enable) +#else +int +gfx_set_no_ck_outside_alpha(int enable) +#endif +{ + unsigned long value; + + value = READ_VID32(RCDF_VID_ALPHA_CONTROL); + if (enable) + WRITE_VID32(RCDF_VID_ALPHA_CONTROL, value | RCDF_NO_CK_OUTSIDE_ALPHA); + else + WRITE_VID32(RCDF_VID_ALPHA_CONTROL, + value & ~RCDF_NO_CK_OUTSIDE_ALPHA); + return (0); +} + +/*--------------------------------------------------------------------------- + * gfx_get_clock_frequency + * + * This routine returns the current clock frequency in 16.16 format. + * It reads the current register value and finds the match in the table. + * If no match is found, this routine returns 0. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +unsigned long +redcloud_get_clock_frequency(void) +#else +unsigned long +gfx_get_clock_frequency(void) +#endif +{ + Q_WORD msr_value; + unsigned int index; + unsigned long value, mask = 0x00001FFF; + unsigned long post_div3 = 0, pre_mult2 = 0; + + /* READ PLL SETTING */ + + gfx_msr_read(RC_ID_MCP, MCP_DOTPLL, &msr_value); + value = msr_value.high & mask; + + /* READ DIVISOR SETTINGS */ + + gfx_msr_read(RC_ID_MCP, MCP_SYS_RSTPLL, &msr_value); + post_div3 = (msr_value.low & MCP_DOTPOSTDIV3) ? 1 : 0; + pre_mult2 = (msr_value.low & MCP_DOTPREMULT2) ? 1 : 0; + + /* SEARCH FOR A MATCH */ + + for (index = 0; index < NUM_RCDF_FREQUENCIES; index++) { + if ((RCDF_PLLtable[index].pll_value & mask) == value && + post_div3 == RCDF_PLLtable[index].post_div3 && + pre_mult2 == RCDF_PLLtable[index].pre_mul2) + return (RCDF_PLLtable[index].frequency); + } + return (0); +} + +/*************************************************************/ +/* READ ROUTINES | INCLUDED FOR DIAGNOSTIC PURPOSES ONLY */ +/*************************************************************/ + +#if GFX_READ_ROUTINES + +/*--------------------------------------------------------------------------- + * gfx_get_sync_polarities + * + * This routine returns the polarities of the sync pulses: + * Bit 0: Set if negative horizontal polarity. + * Bit 1: Set if negative vertical polarity. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +redcloud_get_sync_polarities(void) +#else +int +gfx_get_sync_polarities(void) +#endif +{ + int polarities = 0; + + if (READ_VID32(RCDF_DISPLAY_CONFIG) & RCDF_DCFG_CRT_HSYNC_POL) + polarities |= 1; + if (READ_VID32(RCDF_DISPLAY_CONFIG) & RCDF_DCFG_CRT_VSYNC_POL) + polarities |= 2; + return (polarities); +} + +/*--------------------------------------------------------------------------- + * gfx_get_video_palette_entry + * + * This routine returns a single palette entry. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +redcloud_get_video_palette_entry(unsigned long index, unsigned long *palette) +#else +int +gfx_get_video_palette_entry(unsigned long index, unsigned long *palette) +#endif +{ + if (index > 0xFF) + return GFX_STATUS_BAD_PARAMETER; + + /* READ A SINGLE ENTRY */ + + WRITE_VID32(RCDF_PALETTE_ADDRESS, index); + *palette = READ_VID32(RCDF_PALETTE_DATA); + + return (GFX_STATUS_OK); +} + +/*---------------------------------------------------------------------------- + * gfx_get_video_enable + * + * This routine returns the value "one" if video overlay is currently enabled, + * otherwise it returns the value "zero". + *---------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +redcloud_get_video_enable(void) +#else +int +gfx_get_video_enable(void) +#endif +{ + if (READ_VID32(RCDF_VIDEO_CONFIG) & RCDF_VCFG_VID_EN) + return (1); + return (0); +} + +/*---------------------------------------------------------------------------- + * gfx_get_video_format + * + * This routine returns the current video overlay format. + *---------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +redcloud_get_video_format(void) +#else +int +gfx_get_video_format(void) +#endif +{ + unsigned long ctrl, vcfg; + + ctrl = READ_VID32(RCDF_VID_ALPHA_CONTROL); + vcfg = READ_VID32(RCDF_VIDEO_CONFIG); + + if (ctrl & RCDF_VIDEO_INPUT_IS_RGB) { + switch (vcfg & RCDF_VCFG_VID_INP_FORMAT) { + case RCDF_VCFG_UYVY_FORMAT: + return VIDEO_FORMAT_RGB; + case RCDF_VCFG_Y2YU_FORMAT: + return VIDEO_FORMAT_P2M_P2L_P1M_P1L; + case RCDF_VCFG_YUYV_FORMAT: + return VIDEO_FORMAT_P1M_P1L_P2M_P2L; + case RCDF_VCFG_YVYU_FORMAT: + return VIDEO_FORMAT_P1M_P2L_P2M_P1L; + } + } + + if (vcfg & RCDF_VCFG_4_2_0_MODE) { + switch (vcfg & RCDF_VCFG_VID_INP_FORMAT) { + case RCDF_VCFG_UYVY_FORMAT: + return VIDEO_FORMAT_Y0Y1Y2Y3; + case RCDF_VCFG_Y2YU_FORMAT: + return VIDEO_FORMAT_Y3Y2Y1Y0; + case RCDF_VCFG_YUYV_FORMAT: + return VIDEO_FORMAT_Y1Y0Y3Y2; + case RCDF_VCFG_YVYU_FORMAT: + return VIDEO_FORMAT_Y1Y2Y3Y0; + } + } else { + switch (vcfg & RCDF_VCFG_VID_INP_FORMAT) { + case RCDF_VCFG_UYVY_FORMAT: + return VIDEO_FORMAT_UYVY; + case RCDF_VCFG_Y2YU_FORMAT: + return VIDEO_FORMAT_Y2YU; + case RCDF_VCFG_YUYV_FORMAT: + return VIDEO_FORMAT_YUYV; + case RCDF_VCFG_YVYU_FORMAT: + return VIDEO_FORMAT_YVYU; + } + } + return (GFX_STATUS_ERROR); +} + +/*---------------------------------------------------------------------------- + * gfx_get_video_src_size + * + * This routine returns the size of the source video overlay buffer. The + * return value is (height << 16) | width. + *---------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +unsigned long +redcloud_get_video_src_size(void) +#else +unsigned long +gfx_get_video_src_size(void) +#endif +{ + unsigned long width, height, scale, delta; + int down_enable; + + /* DETERMINE SOURCE WIDTH FROM THE DISPLAY FILTER VIDEO LINE SIZE */ + + width = (READ_VID32(RCDF_VIDEO_CONFIG) >> 7) & 0x000001FE; + if (READ_VID32(RCDF_VIDEO_CONFIG) & RCDF_VCFG_LINE_SIZE_UPPER) + width += 512l; + + /* DETERMINE SOURCE HEIGHT FROM THE DISPLAY FILTER HEIGHT AND SCALE VALUES + * There is no true "source buffer size" in Redcloud. Instead, the VG + * module provides video data as needed on a per-line basis. The source + * buffer size is always assumed to equal the amount of required video + * data. The returned height is equal to the height of the required video + * buffer data (before all scaling.) + * */ + + scale = (READ_VID32(RCDF_VIDEO_SCALE) >> 16) & 0x3FFF; + height = ((READ_VID32(RCDF_VIDEO_Y_POS) >> 16) & 0x7FF) - + (READ_VID32(RCDF_VIDEO_Y_POS) & 0x7FF); + delta = gfx_get_video_downscale_delta(); + down_enable = gfx_get_video_vertical_downscale_enable(); + + /* REVERSE UPSCALING */ + + if (height) + height = ((scale * (height - 1l)) / 0x2000l) + 2l; + + /* REVERSE DOWNSCALING */ + /* Original lines = height * (0x3FFF + delta) / 0x3FFF */ + /* As this may cause rounding errors, we add 1 to the */ + /* returned source size. The return value of this */ + /* function could thus be off by 1. */ + + if (down_enable && height) + height = ((height * (0x3FFFl + delta)) / 0x3FFFl) + 1; + + return ((height << 16) | width); +} + +/*---------------------------------------------------------------------------- + * gfx_get_video_line_size + * + * This routine returns the line size of the source video overlay buffer, in + * pixels. + *---------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +unsigned long +redcloud_get_video_line_size(void) +#else +unsigned long +gfx_get_video_line_size(void) +#endif +{ + unsigned long width = 0; + + /* DETERMINE SOURCE WIDTH FROM THE RCDF VIDEO LINE SIZE */ + + width = (READ_VID32(RCDF_VIDEO_CONFIG) >> 7) & 0x000001FE; + if (READ_VID32(RCDF_VIDEO_CONFIG) & RCDF_VCFG_LINE_SIZE_UPPER) + width += 512l; + return (width); +} + +/*---------------------------------------------------------------------------- + * gfx_get_video_xclip + * + * This routine returns the number of bytes clipped on the left side of a + * video overlay line (skipped at beginning). + *---------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +unsigned long +redcloud_get_video_xclip(void) +#else +unsigned long +gfx_get_video_xclip(void) +#endif +{ + unsigned long clip = 0; + + /* DETERMINE SOURCE WIDTH FROM THE RCDF VIDEO LINE SIZE */ + + clip = (READ_VID32(RCDF_VIDEO_CONFIG) >> 14) & 0x000007FC; + return (clip); +} + +/*---------------------------------------------------------------------------- + * gfx_get_video_offset + * + * This routine returns the current offset for the video overlay buffer. + *---------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +unsigned long +redcloud_get_video_offset(void) +#else +unsigned long +gfx_get_video_offset(void) +#endif +{ + return (gfx_get_display_video_offset()); +} + +/*---------------------------------------------------------------------------- + * gfx_get_video_yuv_offsets + * + * This routine returns the current offsets for the video overlay buffer when in 4:2:0. + *---------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +void +redcloud_get_video_yuv_offsets(unsigned long *yoffset, unsigned long *uoffset, + unsigned long *voffset) +#else +void +gfx_get_video_yuv_offsets(unsigned long *yoffset, unsigned long *uoffset, + unsigned long *voffset) +#endif +{ + gfx_get_display_video_yuv_offsets(yoffset, uoffset, voffset); +} + +/*---------------------------------------------------------------------------- + * gfx_get_video_yuv_pitch + * + * This routine returns the current pitch values for the video overlay buffer. + *---------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +void +redcloud_get_video_yuv_pitch(unsigned long *ypitch, unsigned long *uvpitch) +#else +void +gfx_get_video_yuv_pitch(unsigned long *ypitch, unsigned long *uvpitch) +#endif +{ + gfx_get_display_video_yuv_pitch(ypitch, uvpitch); +} + +/*--------------------------------------------------------------------------- + * gfx_get_video_scale + * + * This routine returns the scale factor for the video overlay window. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +unsigned long +redcloud_get_video_scale(void) +#else +unsigned long +gfx_get_video_scale(void) +#endif +{ + return (READ_VID32(RCDF_VIDEO_SCALE)); +} + +/*--------------------------------------------------------------------------- + * gfx_get_video_downscale_delta + * + * This routine returns the vertical downscale factor for the video overlay + * window. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +unsigned long +redcloud_get_video_downscale_delta(void) +#else +unsigned long +gfx_get_video_downscale_delta(void) +#endif +{ + /* USE PRIVATE ROUTINE TO ABSTRACT THE DIPSLAY CONTROLLER */ + + return (gfx_get_display_video_downscale_delta()); +} + +/*--------------------------------------------------------------------------- + * gfx_get_video_vertical_downscale_enable + * + * This routine returns the vertical downscale enable for the video overlay + * window. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +redcloud_get_video_vertical_downscale_enable(void) +#else +int +gfx_get_video_vertical_downscale_enable(void) +#endif +{ + /* USE PRIVATE ROUTINE TO ABSTRACT THE DIPSLAY CONTROLLER */ + + return (gfx_get_display_video_downscale_enable()); +} + +/*--------------------------------------------------------------------------- + * gfx_get_video_downscale_config + * + * This routine returns the current type and value of video downscaling. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +redcloud_get_video_downscale_config(unsigned short *type, unsigned short *m) +#else +int +gfx_get_video_downscale_config(unsigned short *type, unsigned short *m) +#endif +{ + unsigned long downscale; + + downscale = READ_VID32(RCDF_VIDEO_DOWNSCALER_CONTROL); + *m = (unsigned short)((downscale & RCDF_VIDEO_DOWNSCALE_FACTOR_MASK) >> + RCDF_VIDEO_DOWNSCALE_FACTOR_POS) + 1; + + switch (downscale & RCDF_VIDEO_DOWNSCALE_TYPE_MASK) { + case RCDF_VIDEO_DOWNSCALE_TYPE_A: + *type = VIDEO_DOWNSCALE_KEEP_1_OF; + break; + case RCDF_VIDEO_DOWNSCALE_TYPE_B: + *type = VIDEO_DOWNSCALE_DROP_1_OF; + break; + default: + return GFX_STATUS_ERROR; + break; + } + return (0); +} + +/*--------------------------------------------------------------------------- + * gfx_get_video_downscale_coefficients + * + * This routine returns the current video downscaling coefficients. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +void +redcloud_get_video_downscale_coefficients(unsigned short *coef1, + unsigned short *coef2, unsigned short *coef3, unsigned short *coef4) +#else +void +gfx_get_video_downscale_coefficients(unsigned short *coef1, + unsigned short *coef2, unsigned short *coef3, unsigned short *coef4) +#endif +{ + unsigned long coef; + + coef = READ_VID32(RCDF_VIDEO_DOWNSCALER_COEFFICIENTS); + *coef1 = + (unsigned short)((coef >> RCDF_VIDEO_DOWNSCALER_COEF1_POS) & + RCDF_VIDEO_DOWNSCALER_COEF_MASK); + *coef2 = + (unsigned short)((coef >> RCDF_VIDEO_DOWNSCALER_COEF2_POS) & + RCDF_VIDEO_DOWNSCALER_COEF_MASK); + *coef3 = + (unsigned short)((coef >> RCDF_VIDEO_DOWNSCALER_COEF3_POS) & + RCDF_VIDEO_DOWNSCALER_COEF_MASK); + *coef4 = + (unsigned short)((coef >> RCDF_VIDEO_DOWNSCALER_COEF4_POS) & + RCDF_VIDEO_DOWNSCALER_COEF_MASK); + return; +} + +/*--------------------------------------------------------------------------- + * gfx_get_video_downscale_enable + * + * This routine returns 1 if video downscaling is currently enabled, + * or 0 if it is currently disabled. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +void +redcloud_get_video_downscale_enable(int *enable) +#else +void +gfx_get_video_downscale_enable(int *enable) +#endif +{ + if (READ_VID32(RCDF_VIDEO_DOWNSCALER_CONTROL) & + RCDF_VIDEO_DOWNSCALE_ENABLE) + *enable = 1; + else + *enable = 0; + return; +} + +/*--------------------------------------------------------------------------- + * gfx_get_video_dst_size + * + * This routine returns the size of the displayed video overlay window. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +unsigned long +redcloud_get_video_dst_size(void) +#else +unsigned long +gfx_get_video_dst_size(void) +#endif +{ + unsigned long xsize, ysize; + + xsize = READ_VID32(RCDF_VIDEO_X_POS); + xsize = ((xsize >> 16) & 0x7FF) - (xsize & 0x7FF); + ysize = READ_VID32(RCDF_VIDEO_Y_POS); + ysize = ((ysize >> 16) & 0x7FF) - (ysize & 0x7FF); + return ((ysize << 16) | xsize); +} + +/*--------------------------------------------------------------------------- + * gfx_get_video_position + * + * This routine returns the position of the video overlay window. The + * return value is (ypos << 16) | xpos. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +unsigned long +redcloud_get_video_position(void) +#else +unsigned long +gfx_get_video_position(void) +#endif +{ + unsigned long hadjust, vadjust; + unsigned long xpos, ypos; + + /* READ HARDWARE POSITION */ + + xpos = READ_VID32(RCDF_VIDEO_X_POS) & 0x000007FF; + ypos = READ_VID32(RCDF_VIDEO_Y_POS) & 0x000007FF; + + /* GET ADJUSTMENT VALUES */ + /* Use routines to abstract version of display controller. */ + + hadjust = + (unsigned long)gfx_get_htotal() - (unsigned long)gfx_get_hsync_end() - + 14l; + vadjust = + (unsigned long)gfx_get_vtotal() - (unsigned long)gfx_get_vsync_end() + + 1l; + xpos -= hadjust; + ypos -= vadjust; + return ((ypos << 16) | (xpos & 0x0000FFFF)); +} + +/*--------------------------------------------------------------------------- + * gfx_get_video_color_key + * + * This routine returns the current video color key value. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +unsigned long +redcloud_get_video_color_key(void) +#else +unsigned long +gfx_get_video_color_key(void) +#endif +{ + return (READ_VID32(RCDF_VIDEO_COLOR_KEY)); +} + +/*--------------------------------------------------------------------------- + * gfx_get_video_color_key_mask + * + * This routine returns the current video color mask value. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +unsigned long +redcloud_get_video_color_key_mask(void) +#else +unsigned long +gfx_get_video_color_key_mask(void) +#endif +{ + return (READ_VID32(RCDF_VIDEO_COLOR_MASK)); +} + +/*--------------------------------------------------------------------------- + * gfx_get_video_color_key_src + * + * This routine returns 0 for video data compare, 1 for graphics data. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +redcloud_get_video_color_key_src(void) +#else +int +gfx_get_video_color_key_src(void) +#endif +{ + if (READ_VID32(RCDF_DISPLAY_CONFIG) & RCDF_DCFG_VG_CK) + return (0); + return (1); +} + +/*--------------------------------------------------------------------------- + * gfx_get_video_filter + * + * This routine returns if the filters are currently enabled. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +redcloud_get_video_filter(void) +#else +int +gfx_get_video_filter(void) +#endif +{ + int retval = 0; + + if (READ_VID32(RCDF_VIDEO_CONFIG) & RCDF_VCFG_X_FILTER_EN) + retval |= 1; + if (READ_VID32(RCDF_VIDEO_CONFIG) & RCDF_VCFG_Y_FILTER_EN) + retval |= 2; + return (retval); +} + +/*--------------------------------------------------------------------------- + * gfx_get_video_request + * + * This routine returns the horizontal (pixel) and vertical (lines) video + * request values. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +redcloud_get_video_request(short *x, short *y) +#else +int +gfx_get_video_request(short *x, short *y) +#endif +{ + unsigned long request = 0; + + request = (READ_VID32(RCDF_VIDEO_REQUEST)); + *x = (short)((request >> RCDF_VIDEO_X_REQUEST_POS) & + RCDF_VIDEO_REQUEST_MASK); + *y = (short)((request >> RCDF_VIDEO_Y_REQUEST_POS) & + RCDF_VIDEO_REQUEST_MASK); + + *x -= gfx_get_htotal() - gfx_get_hsync_end() - 2; + *y -= gfx_get_vtotal() - gfx_get_vsync_end() + 1; + + return (0); +} + +/*--------------------------------------------------------------------------- + * gfx_get_video_cursor() + * + * This routine configures the video hardware cursor. + * If the "mask"ed bits in the graphics pixel match "key", then either + * "color1" or "color2" will be used for this pixel, according to the value of + * the bit in offset "select_color2". + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +int +redcloud_get_video_cursor(unsigned long *key, unsigned long *mask, + unsigned short *select_color2, unsigned long *color1, + unsigned short *color2) +#else +int +gfx_get_video_cursor(unsigned long *key, unsigned long *mask, + unsigned short *select_color2, unsigned long *color1, + unsigned short *color2) +#endif +{ + *select_color2 = + (unsigned short)(READ_VID32(RCDF_CURSOR_COLOR_KEY) >> + RCDF_CURSOR_COLOR_KEY_OFFSET_POS); + *key = READ_VID32(RCDF_CURSOR_COLOR_KEY) & RCDF_COLOR_MASK; + *mask = READ_VID32(RCDF_CURSOR_COLOR_MASK) & RCDF_COLOR_MASK; + *color1 = READ_VID32(RCDF_CURSOR_COLOR_1) & RCDF_COLOR_MASK; + *color2 = + (unsigned short)(READ_VID32(RCDF_CURSOR_COLOR_2) & RCDF_COLOR_MASK); + return (0); +} + +/*--------------------------------------------------------------------------- + * gfx_read_crc + * + * This routine returns the hardware CRC value, which is used for automated + * testing. The value is like a checksum, but will change if pixels move + * locations. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +unsigned long +redcloud_read_crc(void) +#else +unsigned long +gfx_read_crc(void) +#endif +{ + Q_WORD msr_value; + unsigned long crc = 0xFFFFFFFF; + + /* DISABLE 32-BIT CRCS */ + /* For GX1.x, this is a reserved bit, and is assumed to be a benign + * access */ + + gfx_msr_read(RC_ID_DF, RCDF_MBD_MSR_DIAG_DF, &msr_value); + msr_value.low &= ~RCDF_DIAG_32BIT_CRC; + gfx_msr_write(RC_ID_DF, RCDF_MBD_MSR_DIAG_DF, &msr_value); + + if (gfx_test_timing_active()) { + /* WAIT UNTIL ACTIVE DISPLAY */ + + while (!gfx_test_vertical_active()) ; + + /* RESET CRC DURING ACTIVE DISPLAY */ + + WRITE_VID32(RCDF_VID_CRC, 0); + WRITE_VID32(RCDF_VID_CRC, 1); + + /* WAIT UNTIL NOT ACTIVE, THEN ACTIVE, NOT ACTIVE, THEN ACTIVE */ + + while (!gfx_test_vertical_active()) ; + while (gfx_test_vertical_active()) ; + while (!gfx_test_vertical_active()) ; + while (gfx_test_vertical_active()) ; + while (!gfx_test_vertical_active()) ; + crc = READ_VID32(RCDF_VID_CRC) >> 8; + } + return (crc); +} + +/*--------------------------------------------------------------------------- + * gfx_read_crc32 + * + * This routine returns the 32-bit hardware CRC value, which is used for + * automated testing. The value is like a checksum, but will change if pixels + * move locations. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +unsigned long +redcloud_read_crc32(void) +#else +unsigned long +gfx_read_crc32(void) +#endif +{ + Q_WORD msr_value; + unsigned long crc = 0xFFFFFFFF; + + /* ENABLE 32-BIT CRCS */ + /* For GX1.x, this is a reserved bit, and is assumed to be a benign + * access */ + + gfx_msr_read(RC_ID_DF, RCDF_MBD_MSR_DIAG_DF, &msr_value); + msr_value.low |= RCDF_DIAG_32BIT_CRC; + gfx_msr_write(RC_ID_DF, RCDF_MBD_MSR_DIAG_DF, &msr_value); + + if (gfx_test_timing_active()) { + /* WAIT UNTIL ACTIVE DISPLAY */ + + while (!gfx_test_vertical_active()) ; + + /* RESET CRC DURING ACTIVE DISPLAY */ + + WRITE_VID32(RCDF_VID_CRC, 0); + WRITE_VID32(RCDF_VID_CRC, 1); + + /* WAIT UNTIL NOT ACTIVE, THEN ACTIVE, NOT ACTIVE, THEN ACTIVE */ + + while (!gfx_test_vertical_active()) ; + while (gfx_test_vertical_active()) ; + while (!gfx_test_vertical_active()) ; + while (gfx_test_vertical_active()) ; + while (!gfx_test_vertical_active()) ; + crc = READ_VID32(RCDF_VID_CRC32); + } + return (crc); +} + +/*--------------------------------------------------------------------------- + * gfx_read_window_crc + * + * This routine returns the hardware CRC value for a subsection of the display + * This value is used to debug whole-screen CRC failures. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +unsigned long +redcloud_read_window_crc(int source, unsigned short x, unsigned short y, + unsigned short width, unsigned short height, int crc32) +#else +unsigned long +gfx_read_window_crc(int source, unsigned short x, unsigned short y, + unsigned short width, unsigned short height, int crc32) +#endif +{ + Q_WORD msr_value; + unsigned long xpos, ypos, crc = 0; + unsigned long old_fmt = 0; + unsigned int vsync_active_base, vsync_inactive_base, hsync_active_base; + unsigned int vsync_active_shift, vsync_inactive_shift, hsync_active_shift; + unsigned int vsync_bit, hsync_bit, sync_polarities = 0; + + /* CONFIGURE DISPLAY FILTER TO LOAD DATA ONTO LOWER 32-BITS */ + + msr_value.high = 0; + msr_value.low = + (source == CRC_SOURCE_GFX_DATA) ? (RCDF_MBD_DIAG_EN0 | 0x0000000F) + : (RCDF_MBD_DIAG_EN0 | 0x0000000B); + gfx_msr_write(RC_ID_DF, MBD_MSR_DIAG, &msr_value); + + /* CONFIGURE DISPLAY FILTER FOR APPROPRIATE OUTPUT */ + + if (source != CRC_SOURCE_GFX_DATA) { + gfx_msr_read(RC_ID_DF, MBD_MSR_CONFIG, &msr_value); + old_fmt = msr_value.low; + msr_value.low &= ~(RCDF_CONFIG_FMT_MASK); + msr_value.low |= + ((source == + CRC_SOURCE_FP_DATA) ? RCDF_CONFIG_FMT_FP : + RCDF_CONFIG_FMT_CRT); + gfx_msr_write(RC_ID_DF, MBD_MSR_CONFIG, &msr_value); + } + + /* CONFIGURE MCP TO LOAD REGB DATA ONTO UPPER 32-BITS */ + + msr_value.low = MCP_MBD_DIAG_EN1 | 0x00050000; + gfx_msr_write(RC_ID_MCP, MBD_MSR_DIAG, &msr_value); + + /* ENABLE HW CLOCK GATING AND SET MCP CLOCK TO DOT CLOCK */ + + msr_value.low = 1l; + gfx_msr_write(RC_ID_MCP, MBD_MSR_PM, &msr_value); + msr_value.low = 0; + gfx_msr_write(RC_ID_MCP, MCP_DBGCLKCTL, &msr_value); + msr_value.low = 3; + gfx_msr_write(RC_ID_MCP, MCP_DBGCLKCTL, &msr_value); + + /* DISABLE MCP ACTIONS */ + + msr_value.high = 0x00000000; + msr_value.low = 0x00000000; + gfx_msr_write(RC_ID_MCP, MCP_DIAGCTL, &msr_value); + + /* SET APPROPRIATE BASE ADDRESS */ + /* M-Sets use normal diag bits, while N-Sets use inverted diag bits */ + /* We thus use the M-sets when polling for a high signal and the N */ + /* sets when polling for a low signal. */ + + if (source != CRC_SOURCE_GFX_DATA) { + sync_polarities = gfx_get_sync_polarities(); + vsync_bit = 29; + hsync_bit = 30; + } else { + vsync_bit = 25; + hsync_bit = 26; + } + + if (sync_polarities & 1) { + hsync_active_base = MCP_SETM0CTL; + hsync_active_shift = 2; + } else { + hsync_active_base = MCP_SETN0CTL; + hsync_active_shift = 1; + } + if (sync_polarities & 2) { + vsync_active_base = MCP_SETM0CTL; + vsync_inactive_base = MCP_SETN0CTL; + vsync_active_shift = 2; + vsync_inactive_shift = 1; + } else { + vsync_active_base = MCP_SETN0CTL; + vsync_inactive_base = MCP_SETM0CTL; + vsync_active_shift = 1; + vsync_inactive_shift = 2; + } + + /* SET STATE TRANSITIONS */ + + /* STATE 0-1 TRANSITION (SET 0) */ + /* XState = 00 and VSync Inactive */ + /* Note: DF VSync = Diag Bus Bit 29 */ + /* VG VSync = Diag Bus Bit 25 */ + + msr_value.low = 0x000000A0; + msr_value.high = 0x00008000 | ((unsigned long)vsync_bit << 16) | + ((unsigned long)vsync_bit << 21) | ((unsigned long)vsync_bit << 26); + gfx_msr_write(RC_ID_MCP, vsync_inactive_base, &msr_value); + + /* STATE 1-2 TRANSITION (SET 4) */ + /* XState = 01 and VSync Active */ + + msr_value.low = 0x000000C0; + gfx_msr_write(RC_ID_MCP, vsync_active_base + 4, &msr_value); + + /* STATE 2-3 TRANSITION (SET 1) */ + /* XState = 10 and VSync Inactive */ + + msr_value.low = 0x00000120; + gfx_msr_write(RC_ID_MCP, vsync_inactive_base + 1, &msr_value); + + /* HORIZONTAL COUNTER (SET 5) */ + /* XState = 10 and HSync Active */ + /* Notes: DF HSync = Diag Bus Bit 30 */ + /* VG HSync = Diag Bus Bit 26 */ + + msr_value.high = 0x00008000 | ((unsigned long)hsync_bit << 16) | + ((unsigned long)hsync_bit << 21) | ((unsigned long)hsync_bit << 26); + msr_value.low = 0x00000120; + gfx_msr_write(RC_ID_MCP, hsync_active_base + 5, &msr_value); + + /* HORIZONTAL COUNTER RESET (SET 4) */ + /* XState = 10 and H. Counter = limit */ + /* Note: H. Counter is lower 16-bits of */ + /* RegB. */ + + msr_value.high = 0x00000000; + msr_value.low = 0x00000128; + gfx_msr_write(RC_ID_MCP, vsync_inactive_base + 4, &msr_value); + + /* CRC TRIGGER (SET 0) */ + /* Cmp0 <= xpos < Cmp1 */ + /* Cmp2 <= ypos < Cmp2 */ + + msr_value.high = 0x00000000; + msr_value.low = 0x10C20120; + gfx_msr_write(RC_ID_MCP, vsync_active_base, &msr_value); + + /* SET COMPARATOR VALUES */ + /* Note: The VG data outputs from the DF are delayed by one pixel clock. */ + /* In this mode, we thus add one to horizontal comparator limits. */ + + /* COMPARATOR 0 */ + /* Lower limit = xpos + (h_blank_pixels - 1) - 3 */ + /* Notes: */ + /* 1. 3 is the pipeline delay for MCP register */ + /* data to access the diag bus */ + /* 2. h_blank_pixels = HTOTAL - HSYNC_END */ + + xpos = (unsigned long)x + ((unsigned long)gfx_get_htotal() - + (unsigned long)gfx_get_hsync_end() - 1l) - 3l; + if (source == CRC_SOURCE_GFX_DATA) + xpos++; + msr_value.high = 0x00000000; + msr_value.low = xpos; + gfx_msr_write(RC_ID_MCP, MCP_CMPVAL0, &msr_value); + + /* COMPARATOR 1 */ + /* Upper limit = xpos + width + (h_blank_pixels - 1) - 3 */ + + msr_value.low = xpos + (unsigned long)width; + gfx_msr_write(RC_ID_MCP, MCP_CMPVAL0 + 2, &msr_value); + + /* COMPARATOR 2 */ + /* Lower limit = ypos + v_blank_pixels */ + /* Notes: */ + /* 1. v_blank_pixels = VTOTAL - VSYNC_END */ + + ypos = + (unsigned long)y + (unsigned long)gfx_get_vtotal() - + (unsigned long)gfx_get_vsync_end(); + msr_value.low = ypos << 16; + gfx_msr_write(RC_ID_MCP, MCP_CMPVAL0 + 4, &msr_value); + + /* COMPARATOR 3 */ + /* Upper limit = ypos + height + v_blank_pixels */ + + msr_value.low = (ypos + (unsigned long)height) << 16; + gfx_msr_write(RC_ID_MCP, MCP_CMPVAL0 + 6, &msr_value); + + /* SET COMPARATOR MASKS */ + + /* COMPARATORS 0 AND 1 REFER TO LOWER 16 BITS OF REGB */ + + msr_value.high = 0x00000000; + msr_value.low = 0x0000FFFF; + gfx_msr_write(RC_ID_MCP, MCP_CMPMASK0, &msr_value); + gfx_msr_write(RC_ID_MCP, MCP_CMPMASK0 + 2, &msr_value); + + /* COMPARATORS 2 AND 3 REFER TO UPPER 16 BITS OF REGB */ + + msr_value.low = 0xFFFF0000; + gfx_msr_write(RC_ID_MCP, MCP_CMPMASK0 + 4, &msr_value); + gfx_msr_write(RC_ID_MCP, MCP_CMPMASK0 + 6, &msr_value); + + /* SET REGA MASK TO CRC ONLY 24 BITS OF DATA */ + + msr_value.high = 0x00000000; + msr_value.low = 0x00FFFFFF; + gfx_msr_write(RC_ID_MCP, MCP_REGAMASK, &msr_value); + + /* SET REGB VALUE */ + /* Lower 16 bits use HTOTAL - SYNC TIME - 1 to set the counter rollover + * limit. */ + /* Upper 16 bits use 0xFFFF to remove auto-clear behavior. */ + + msr_value.high = 0x00000000; + msr_value.low = 0xFFFF0000 | + ((gfx_get_htotal() - (gfx_get_hsync_end() - gfx_get_hsync_start()) - + 1) & 0xFFFF); + gfx_msr_write(RC_ID_MCP, MCP_REGBVAL, &msr_value); + + /* PROGRAM ACTIONS */ + + /* GOTO STATE 01 */ + + msr_value.high = 0x00000000; + msr_value.low = 0x00000008 | (1l << vsync_inactive_shift); + gfx_msr_write(RC_ID_MCP, MCP_ACTION0 + 14, &msr_value); + + /* GOTO STATE 10 */ + + msr_value.low = 0x00080000 | (1l << (vsync_active_shift + 16)); + gfx_msr_write(RC_ID_MCP, MCP_ACTION0 + 15, &msr_value); + + /* GOTO STATE 11 */ + + msr_value.low = 0x00000080 | (1l << (vsync_inactive_shift + 4)); + gfx_msr_write(RC_ID_MCP, MCP_ACTION0 + 16, &msr_value); + + /* CLEAR REGB (COUNTERS) */ + /* RegB is cleared upon transitioning to state 10 */ + /* RegA is not cleared as the initial value must be 0x00000001 */ + + msr_value.low = 0x00080000 | (1l << (vsync_active_shift + 16)); + gfx_msr_write(RC_ID_MCP, MCP_ACTION0, &msr_value); + + /* CRC INTO REGA */ + /* INCREMENT H. COUNTER */ + /* cmp0 <= xpos < cmp1 */ + /* cmp2 <= ypos < cmp3 */ + /* XState = 10 */ + + msr_value.low = 0x00000008 | (1l << vsync_active_shift) | + 0x00800000 | (1l << (hsync_active_shift + 20)); + gfx_msr_write(RC_ID_MCP, MCP_ACTION0 + 1, &msr_value); + + /* INCREMENT V. COUNTER */ + /* V. Counter is incremented when the H. Counter */ + /* rolls over. */ + + msr_value.low = 0x00080000 | (1l << (vsync_inactive_shift + 16)); + gfx_msr_write(RC_ID_MCP, MCP_ACTION0 + 2, &msr_value); + + /* CLEAR ALL OTHER ACTIONS */ + /* This prevents side-effects from previous accesses to the MCP */ + /* debug logic. */ + msr_value.low = 0x00000000; + msr_value.high = 0x00000000; + gfx_msr_write(RC_ID_MCP, MCP_ACTION0 + 3, &msr_value); + gfx_msr_write(RC_ID_MCP, MCP_ACTION0 + 4, &msr_value); + gfx_msr_write(RC_ID_MCP, MCP_ACTION0 + 5, &msr_value); + gfx_msr_write(RC_ID_MCP, MCP_ACTION0 + 6, &msr_value); + gfx_msr_write(RC_ID_MCP, MCP_ACTION0 + 7, &msr_value); + gfx_msr_write(RC_ID_MCP, MCP_ACTION0 + 8, &msr_value); + gfx_msr_write(RC_ID_MCP, MCP_ACTION0 + 9, &msr_value); + gfx_msr_write(RC_ID_MCP, MCP_ACTION0 + 10, &msr_value); + gfx_msr_write(RC_ID_MCP, MCP_ACTION0 + 11, &msr_value); + gfx_msr_write(RC_ID_MCP, MCP_ACTION0 + 12, &msr_value); + gfx_msr_write(RC_ID_MCP, MCP_ACTION0 + 13, &msr_value); + gfx_msr_write(RC_ID_MCP, MCP_ACTION0 + 17, &msr_value); + gfx_msr_write(RC_ID_MCP, MCP_ACTION0 + 18, &msr_value); + gfx_msr_write(RC_ID_MCP, MCP_ACTION0 + 19, &msr_value); + gfx_msr_write(RC_ID_MCP, MCP_ACTION0 + 20, &msr_value); + + /* SET REGA CRC VALUE TO 1 OR 0 */ + + if (!crc32) + msr_value.low = 0x00000001; + gfx_msr_write(RC_ID_MCP, MCP_REGA, &msr_value); + + /* SET XSTATE TO 0 */ + + msr_value.low = 0; + msr_value.high = 0; + gfx_msr_write(RC_ID_MCP, MCP_XSTATE, &msr_value); + + /* CONFIGURE DIAG CONTROL */ + /* Set all four comparators to watch the upper diag bus. */ + /* Set REGA action1 to legacy CRC or 32-bit CRC. */ + /* Set REGB action1 to increment lower 16 bits and clear at limit. */ + /* Set REGB action2 to increment upper 16 bits. */ + /* Enable all actions. */ + + if (crc32) + msr_value.low = 0x9A820055; + else + msr_value.low = 0x9A840055; + msr_value.high = 0x00000000; + gfx_msr_write(RC_ID_MCP, MCP_DIAGCTL, &msr_value); + + /* DELAY TWO FRAMES */ + + while (!gfx_test_vertical_active()) ; + while (gfx_test_vertical_active()) ; + while (!gfx_test_vertical_active()) ; + while (gfx_test_vertical_active()) ; + while (!gfx_test_vertical_active()) ; + + /* VERIFY THAT XSTATE = 11 */ + + gfx_msr_read(RC_ID_MCP, MCP_XSTATE, &msr_value); + if ((msr_value.low & 3) == 3) { + gfx_msr_read(RC_ID_MCP, MCP_REGA, &msr_value); + + crc = msr_value.low; + if (!crc32) + crc &= 0xFFFFFF; + } + + /* DISABLE MCP AND DF DIAG BUS OUTPUTS */ + + msr_value.low = 0x00000000; + msr_value.high = 0x00000000; + gfx_msr_write(RC_ID_DF, MBD_MSR_DIAG, &msr_value); + gfx_msr_write(RC_ID_MCP, MBD_MSR_DIAG, &msr_value); + + /* DISABLE MCP ACTIONS */ + + msr_value.high = 0x00000000; + msr_value.low = 0x00000000; + gfx_msr_write(RC_ID_MCP, MCP_DIAGCTL, &msr_value); + + /* RESTORE PREVIOUS OUTPUT FORMAT */ + + if (source != CRC_SOURCE_GFX_DATA) { + gfx_msr_read(RC_ID_DF, MBD_MSR_CONFIG, &msr_value); + msr_value.low = old_fmt; + gfx_msr_write(RC_ID_DF, MBD_MSR_CONFIG, &msr_value); + } + return crc; +} + +/*--------------------------------------------------------------------------- + * gfx_get_alpha_enable + * + * This routine returns 1 if the selected alpha window is currently + * enabled, or 0 if it is currently disabled. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +void +redcloud_get_alpha_enable(int *enable) +#else +void +gfx_get_alpha_enable(int *enable) +#endif +{ + unsigned long value = 0; + + *enable = 0; + if (gfx_alpha_select <= 2) { + value = + READ_VID32(RCDF_ALPHA_CONTROL_1 + + ((unsigned long)gfx_alpha_select << 5)); + if (value & RCDF_ACTRL_WIN_ENABLE) + *enable = 1; + } + return; +} + +/*--------------------------------------------------------------------------- + * gfx_get_alpha_size + * + * This routine returns the size of the currently selected alpha region. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +void +redcloud_get_alpha_size(unsigned short *x, unsigned short *y, + unsigned short *width, unsigned short *height) +#else +void +gfx_get_alpha_size(unsigned short *x, unsigned short *y, + unsigned short *width, unsigned short *height) +#endif +{ + unsigned long value = 0; + + *x = 0; + *y = 0; + *width = 0; + *height = 0; + if (gfx_alpha_select <= 2) { + value = + READ_VID32(RCDF_ALPHA_XPOS_1 + + ((unsigned long)gfx_alpha_select << 5)); + *x = (unsigned short)(value & 0x000007FF); + *width = (unsigned short)((value >> 16) & 0x000007FF) - *x; + value = + READ_VID32(RCDF_ALPHA_YPOS_1 + + ((unsigned long)gfx_alpha_select << 5)); + *y = (unsigned short)(value & 0x000007FF); + *height = (unsigned short)((value >> 16) & 0x000007FF) - *y; + } + *x -= gfx_get_htotal() - gfx_get_hsync_end() - 2; + *y -= gfx_get_vtotal() - gfx_get_vsync_end() + 1; + return; +} + +/*--------------------------------------------------------------------------- + * gfx_get_alpha_value + * + * This routine returns the alpha value and increment/decrement value of + * the currently selected alpha region. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +void +redcloud_get_alpha_value(unsigned char *alpha, char *delta) +#else +void +gfx_get_alpha_value(unsigned char *alpha, char *delta) +#endif +{ + unsigned long value = 0; + + *alpha = 0; + *delta = 0; + if (gfx_alpha_select <= 2) { + value = + READ_VID32(RCDF_ALPHA_CONTROL_1 + + ((unsigned long)gfx_alpha_select << 5)); + *alpha = (unsigned char)(value & 0x00FF); + *delta = (char)((value >> 8) & 0x00FF); + } + return; +} + +/*--------------------------------------------------------------------------- + * gfx_get_alpha_priority + * + * This routine returns the priority of the currently selected alpha region. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +void +redcloud_get_alpha_priority(int *priority) +#else +void +gfx_get_alpha_priority(int *priority) +#endif +{ + unsigned long pos = 0, value = 0; + + *priority = 0; + if (gfx_alpha_select <= 2) { + value = READ_VID32(RCDF_VID_ALPHA_CONTROL); + pos = 16 + (gfx_alpha_select << 1); + *priority = (int)((value >> pos) & 3); + } + return; +} + +/*--------------------------------------------------------------------------- + * gfx_get_alpha_color + * + * This routine returns the color register value for the currently selected + * alpha region. Bit 24 is set if the color register is enabled. + *--------------------------------------------------------------------------- + */ +#if GFX_VIDEO_DYNAMIC +void +redcloud_get_alpha_color(unsigned long *color) +#else +void +gfx_get_alpha_color(unsigned long *color) +#endif +{ + *color = 0; + if (gfx_alpha_select <= 2) { + *color = + READ_VID32(RCDF_ALPHA_COLOR_1 + + ((unsigned long)gfx_alpha_select << 5)); + } + return; +} + +#endif /* GFX_READ_ROUTINES */ + +/* END OF FILE */ diff --git a/driver/xf86-video-geode/src/gfx/vip_1200.c b/driver/xf86-video-geode/src/gfx/vip_1200.c new file mode 100644 index 000000000..731e1b8d1 --- /dev/null +++ b/driver/xf86-video-geode/src/gfx/vip_1200.c @@ -0,0 +1,663 @@ +/* Copyright (c) 2005 Advanced Micro Devices, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + * + * Neither the name of the Advanced Micro Devices, Inc. nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * */ + +/* + * This file contains routines to control the SC1200 video input port (VIP) + * hardware. + * */ + +/*---------------------------------------------------------------------------- + * gfx_set_vip_enable + * + * This routine enables or disables the writes to memory from the video port. + *---------------------------------------------------------------------------- + */ +#if GFX_VIP_DYNAMIC +int +sc1200_set_vip_enable(int enable) +#else +int +gfx_set_vip_enable(int enable) +#endif +{ + unsigned long value; + + value = READ_VIP32(SC1200_VIP_CONTROL); + if (enable) + value |= SC1200_VIP_DATA_CAPTURE_EN; + else + value &= ~SC1200_VIP_DATA_CAPTURE_EN; + WRITE_VIP32(SC1200_VIP_CONTROL, value); + return (0); +} + +/*---------------------------------------------------------------------------- + * gfx_set_vip_capture_run_mode + * + * This routine selects VIP capture run mode. + *---------------------------------------------------------------------------- + */ +#if GFX_VIP_DYNAMIC +int +sc1200_set_vip_capture_run_mode(int mode) +#else +int +gfx_set_vip_capture_run_mode(int mode) +#endif +{ + unsigned long value; + + value = READ_VIP32(SC1200_VIP_CONTROL); + value &= ~SC1200_CAPTURE_RUN_MODE_MASK; + switch (mode) { + case VIP_CAPTURE_STOP_LINE: + value |= SC1200_CAPTURE_RUN_MODE_STOP_LINE; + break; + case VIP_CAPTURE_STOP_FIELD: + value |= SC1200_CAPTURE_RUN_MODE_STOP_FIELD; + break; + case VIP_CAPTURE_START_FIELD: + value |= SC1200_CAPTURE_RUN_MODE_START; + break; + default: + return GFX_STATUS_BAD_PARAMETER; + } + WRITE_VIP32(SC1200_VIP_CONTROL, value); + return (0); +} + +/*---------------------------------------------------------------------------- + * gfx_set_vip_base + * + * This routine sets the odd and even base address values for the VIP memory + * buffer. + *---------------------------------------------------------------------------- + */ +#if GFX_VIP_DYNAMIC +int +sc1200_set_vip_base(unsigned long even, unsigned long odd) +#else +int +gfx_set_vip_base(unsigned long even, unsigned long odd) +#endif +{ + /* TRUE OFFSET IS SPECIFIED, NEED TO SET BIT 23 FOR HARDWARE */ + + if (even) + WRITE_VIP32(SC1200_VIP_EVEN_BASE, + even + (unsigned long)gfx_phys_fbptr); + if (odd) + WRITE_VIP32(SC1200_VIP_ODD_BASE, odd + (unsigned long)gfx_phys_fbptr); + return (0); +} + +/*---------------------------------------------------------------------------- + * gfx_set_vip_pitch + * + * This routine sets the number of bytes between scanlines for the VIP data. + *---------------------------------------------------------------------------- + */ +#if GFX_VIP_DYNAMIC +int +sc1200_set_vip_pitch(unsigned long pitch) +#else +int +gfx_set_vip_pitch(unsigned long pitch) +#endif +{ + WRITE_VIP32(SC1200_VIP_PITCH, pitch & SC1200_VIP_PITCH_MASK); + return (0); +} + +/*---------------------------------------------------------------------------- + * gfx_set_vip_mode + * + * This routine sets the VIP operating mode. + *---------------------------------------------------------------------------- + */ +#if GFX_VIP_DYNAMIC +int +sc1200_set_vip_mode(int mode) +#else +int +gfx_set_vip_mode(int mode) +#endif +{ + unsigned long config; + + config = READ_VIP32(SC1200_VIP_CONFIG); + config &= ~SC1200_VIP_MODE_MASK; + switch (mode) { + case VIP_MODE_C: + WRITE_VIP32(SC1200_VIP_CONFIG, config | SC1200_VIP_MODE_C); + break; + default: + return GFX_STATUS_BAD_PARAMETER; + } + return (0); +} + +/*---------------------------------------------------------------------------- + * gfx_set_vbi_enable + * + * This routine enables or disables the VBI data capture. + *---------------------------------------------------------------------------- + */ +#if GFX_VIP_DYNAMIC +int +sc1200_set_vbi_enable(int enable) +#else +int +gfx_set_vbi_enable(int enable) +#endif +{ + unsigned long value; + + value = READ_VIP32(SC1200_VIP_CONTROL); + if (enable) + value |= SC1200_VIP_VBI_CAPTURE_EN; + else + value &= ~SC1200_VIP_VBI_CAPTURE_EN; + WRITE_VIP32(SC1200_VIP_CONTROL, value); + return (0); +} + +/*---------------------------------------------------------------------------- + * gfx_set_vbi_mode + * + * This routine sets the VBI data types captured to memory. + * It receives a mask of all enabled types. + *---------------------------------------------------------------------------- + */ +#if GFX_VIP_DYNAMIC +int +sc1200_set_vbi_mode(int mode) +#else +int +gfx_set_vbi_mode(int mode) +#endif +{ + unsigned long config; + + config = READ_VIP32(SC1200_VIP_CONFIG); + config &= + ~(SC1200_VBI_ANCILLARY_TO_MEMORY | SC1200_VBI_TASK_A_TO_MEMORY | + SC1200_VBI_TASK_B_TO_MEMORY); + + if (mode & VBI_ANCILLARY) + config |= SC1200_VBI_ANCILLARY_TO_MEMORY; + if (mode & VBI_TASK_A) + config |= SC1200_VBI_TASK_A_TO_MEMORY; + if (mode & VBI_TASK_B) + config |= SC1200_VBI_TASK_B_TO_MEMORY; + WRITE_VIP32(SC1200_VIP_CONFIG, config); + return (0); +} + +/*---------------------------------------------------------------------------- + * gfx_set_vbi_base + * + * This routine sets the odd and even base address values for VBI capture. + * + * "even" and "odd" should contain 16-byte aligned physical addresses. + *---------------------------------------------------------------------------- + */ +#if GFX_VIP_DYNAMIC +int +sc1200_set_vbi_base(unsigned long even, unsigned long odd) +#else +int +gfx_set_vbi_base(unsigned long even, unsigned long odd) +#endif +{ + /* VIP HW REQUIRES THAT BASE ADDRESSES BE 16-BYTE ALIGNED */ + + if (even) + WRITE_VIP32(SC1200_VBI_EVEN_BASE, even & ~0xf); + if (odd) + WRITE_VIP32(SC1200_VBI_ODD_BASE, odd & ~0xf); + + return (0); +} + +/*---------------------------------------------------------------------------- + * gfx_set_vbi_pitch + * + * This routine sets the number of bytes between scanlines for VBI capture. + *---------------------------------------------------------------------------- + */ +#if GFX_VIP_DYNAMIC +int +sc1200_set_vbi_pitch(unsigned long pitch) +#else +int +gfx_set_vbi_pitch(unsigned long pitch) +#endif +{ + WRITE_VIP32(SC1200_VBI_PITCH, pitch & SC1200_VBI_PITCH_MASK); + return (0); +} + +/*---------------------------------------------------------------------------- + * gfx_set_vbi_direct + * + * This routine sets the VBI lines to be passed to the Direct VIP. + *---------------------------------------------------------------------------- + */ +#if GFX_VIP_DYNAMIC +int +sc1200_set_vbi_direct(unsigned long even_lines, unsigned long odd_lines) +#else +int +gfx_set_vbi_direct(unsigned long even_lines, unsigned long odd_lines) +#endif +{ + WRITE_VIP32(SC1200_EVEN_DIRECT_VBI_LINE_ENABLE, + even_lines & SC1200_DIRECT_VBI_LINE_ENABLE_MASK); + WRITE_VIP32(SC1200_ODD_DIRECT_VBI_LINE_ENABLE, + odd_lines & SC1200_DIRECT_VBI_LINE_ENABLE_MASK); + return (0); +} + +/*---------------------------------------------------------------------------- + * gfx_set_vbi_interrupt + * + * This routine enables or disables the VBI field interrupt. + *---------------------------------------------------------------------------- + */ +#if GFX_VIP_DYNAMIC +int +sc1200_set_vbi_interrupt(int enable) +#else +int +gfx_set_vbi_interrupt(int enable) +#endif +{ + unsigned long value; + + value = READ_VIP32(SC1200_VIP_CONTROL); + if (enable) + value |= SC1200_VIP_VBI_FIELD_INTERRUPT_EN; + else + value &= ~SC1200_VIP_VBI_FIELD_INTERRUPT_EN; + WRITE_VIP32(SC1200_VIP_CONTROL, value); + return (0); +} + +/*---------------------------------------------------------------------------- + * gfx_set_vip_bus_request_threshold_high + * + * This routine sets the VIP FIFO bus request threshold. + * If enable is TRUE, VIP FIFO will be set to issue a bus request when it + * filled with 64 bytes. If enable is FALSE, VIP FIFO will be set to issue a + * bus request when it filled with 32 bytes. + *---------------------------------------------------------------------------- + */ +#if GFX_VIP_DYNAMIC +int +sc1200_set_vip_bus_request_threshold_high(int enable) +#else +int +gfx_set_vip_bus_request_threshold_high(int enable) +#endif +{ + unsigned long value; + + value = READ_VIP32(SC1200_VIP_CONFIG); + if (enable) + value &= ~SC1200_VIP_BUS_REQUEST_THRESHOLD; + else + value |= SC1200_VIP_BUS_REQUEST_THRESHOLD; + WRITE_VIP32(SC1200_VIP_CONFIG, value); + return (0); +} + +/*---------------------------------------------------------------------------- + * gfx_set_vip_last_line + * + * This routine sets the maximum number of lines captured in each field. + *---------------------------------------------------------------------------- + */ +#if GFX_VIP_DYNAMIC +int +sc1200_set_vip_last_line(int last_line) +#else +int +gfx_set_vip_last_line(int last_line) +#endif +{ + unsigned long value; + + /* This feature is implemented in Rev C1 */ + if (gfx_chip_revision < SC1200_REV_C1) + return (GFX_STATUS_OK); + + value = READ_VIP32(SC1200_VIP_LINE_TARGET); + value &= ~SC1200_VIP_LAST_LINE_MASK; + value |= ((last_line & 0x3FF) << 16); + WRITE_VIP32(SC1200_VIP_LINE_TARGET, value); + return (GFX_STATUS_OK); +} + +/*---------------------------------------------------------------------------- + * gfx_test_vip_odd_field + * + * This routine returns 1 if the current VIP field is odd. Otherwise returns 0 + *---------------------------------------------------------------------------- + */ +#if GFX_VIP_DYNAMIC +int +sc1200_test_vip_odd_field(void) +#else +int +gfx_test_vip_odd_field(void) +#endif +{ + if (READ_VIP32(SC1200_VIP_STATUS) & SC1200_VIP_CURRENT_FIELD_ODD) + return (1); + else + return (0); +} + +/*---------------------------------------------------------------------------- + * gfx_test_vip_bases_updated + * + * This routine returns 1 if all of the VIP base registers have been updated, + * i.e. there is no base register which has been written with a new address, + * that VIP has not already captured or started capturing into the new address + *---------------------------------------------------------------------------- + */ +#if GFX_VIP_DYNAMIC +int +sc1200_test_vip_bases_updated(void) +#else +int +gfx_test_vip_bases_updated(void) +#endif +{ + if (READ_VIP32(SC1200_VIP_STATUS) & SC1200_VIP_BASE_NOT_UPDATED) + return (0); + else + return (1); +} + +/*---------------------------------------------------------------------------- + * gfx_test_vip_fifo_overflow + * + * This routine returns 1 if an overflow occurred on the FIFO between the VIP + * and the fast X-bus, 0 otherwise. + * If an overflow occurred, the overflow status indication is reset. + *---------------------------------------------------------------------------- + */ +#if GFX_VIP_DYNAMIC +int +sc1200_test_vip_fifo_overflow(void) +#else +int +gfx_test_vip_fifo_overflow(void) +#endif +{ + if (READ_VIP32(SC1200_VIP_STATUS) & SC1200_VIP_FIFO_OVERFLOW) { + /* Bits in vip status register are either read only or reset by + * writing 1 */ + WRITE_VIP32(SC1200_VIP_STATUS, SC1200_VIP_FIFO_OVERFLOW); + return (1); + } else { + return (0); + } +} + +/*---------------------------------------------------------------------------- + * gfx_get_vip_line + * + * This routine returns the number of the current video line being + * received by the VIP interface. + *---------------------------------------------------------------------------- + */ +#if GFX_VIP_DYNAMIC +int +sc1200_get_vip_line(void) +#else +int +gfx_get_vip_line(void) +#endif +{ + return (int)(READ_VIP32(SC1200_VIP_CURRENT_LINE) & + SC1200_VIP_CURRENT_LINE_MASK); +} + +/*---------------------------------------------------------------------------- + * gfx_get_vip_base + *---------------------------------------------------------------------------- + */ +#if GFX_VIP_DYNAMIC +unsigned long +sc1200_get_vip_base(int odd) +#else +unsigned long +gfx_get_vip_base(int odd) +#endif +{ + /* MASK BIT 23 AND ABOVE TO MAKE IT A TRUE OFFSET */ + + if (odd) + return (READ_VIP32(SC1200_VIP_ODD_BASE)); + return (READ_VIP32(SC1200_VIP_EVEN_BASE)); +} + +/*---------------------------------------------------------------------------- + * gfx_get_vbi_pitch + *---------------------------------------------------------------------------- + */ +#if GFX_VIP_DYNAMIC +unsigned long +sc1200_get_vbi_pitch(void) +#else +unsigned long +gfx_get_vbi_pitch(void) +#endif +{ + return (READ_VIP32(SC1200_VBI_PITCH) & SC1200_VBI_PITCH_MASK); +} + +/*************************************************************/ +/* READ ROUTINES | INCLUDED FOR DIAGNOSTIC PURPOSES ONLY */ +/*************************************************************/ + +#if GFX_READ_ROUTINES + +/*---------------------------------------------------------------------------- + * gfx_get_vip_enable + *---------------------------------------------------------------------------- + */ +#if GFX_VIP_DYNAMIC +int +sc1200_get_vip_enable(void) +#else +int +gfx_get_vip_enable(void) +#endif +{ + if (READ_VIP32(SC1200_VIP_CONTROL) & SC1200_VIP_DATA_CAPTURE_EN) + return (1); + return (0); +} + +/*---------------------------------------------------------------------------- + * gfx_get_vip_pitch + *---------------------------------------------------------------------------- + */ +#if GFX_VIP_DYNAMIC +unsigned long +sc1200_get_vip_pitch(void) +#else +unsigned long +gfx_get_vip_pitch(void) +#endif +{ + return (READ_VIP32(SC1200_VIP_PITCH) & SC1200_VIP_PITCH_MASK); +} + +/*---------------------------------------------------------------------------- + * gfx_get_vip_mode + *---------------------------------------------------------------------------- + */ +#if GFX_VIP_DYNAMIC +int +sc1200_get_vip_mode(void) +#else +int +gfx_get_vip_mode(void) +#endif +{ + switch (READ_VIP32(SC1200_VIP_CONFIG) & SC1200_VIP_MODE_MASK) { + case SC1200_VIP_MODE_C: + return VIP_MODE_C; + default: + return (0); + } +} + +/*---------------------------------------------------------------------------- + * gfx_get_vbi_enable + *---------------------------------------------------------------------------- + */ +#if GFX_VIP_DYNAMIC +int +sc1200_get_vbi_enable(void) +#else +int +gfx_get_vbi_enable(void) +#endif +{ + if (READ_VIP32(SC1200_VIP_CONTROL) & SC1200_VIP_VBI_CAPTURE_EN) + return (1); + return (0); +} + +/*---------------------------------------------------------------------------- + * gfx_get_vbi_mode + *---------------------------------------------------------------------------- + */ +#if GFX_VIP_DYNAMIC +int +sc1200_get_vbi_mode(void) +#else +int +gfx_get_vbi_mode(void) +#endif +{ + int config; + int mode = 0; + + config = + (int)(READ_VIP32(SC1200_VIP_CONFIG) & (SC1200_VBI_ANCILLARY_TO_MEMORY + | SC1200_VBI_TASK_A_TO_MEMORY | SC1200_VBI_TASK_B_TO_MEMORY)); + if (config & SC1200_VBI_ANCILLARY_TO_MEMORY) + mode |= VBI_ANCILLARY; + if (config & SC1200_VBI_TASK_A_TO_MEMORY) + mode |= VBI_TASK_A; + if (config & SC1200_VBI_TASK_B_TO_MEMORY) + mode |= VBI_TASK_B; + return mode; +} + +/*---------------------------------------------------------------------------- + * gfx_get_vbi_base + *---------------------------------------------------------------------------- + */ +#if GFX_VIP_DYNAMIC +unsigned long +sc1200_get_vbi_base(int odd) +#else +unsigned long +gfx_get_vbi_base(int odd) +#endif +{ + /* MASK BIT 23 AND ABOVE TO MAKE IT A TRUE OFFSET */ + + if (odd) + return (READ_VIP32(SC1200_VBI_ODD_BASE)); + return (READ_VIP32(SC1200_VBI_EVEN_BASE)); +} + +/*---------------------------------------------------------------------------- + * gfx_get_vbi_direct + *---------------------------------------------------------------------------- + */ +#if GFX_VIP_DYNAMIC +unsigned long +sc1200_get_vbi_direct(int odd) +#else +unsigned long +gfx_get_vbi_direct(int odd) +#endif +{ + /* MASK BIT 23 AND ABOVE TO MAKE IT A TRUE OFFSET */ + + if (odd) + return (READ_VIP32(SC1200_ODD_DIRECT_VBI_LINE_ENABLE) & + SC1200_DIRECT_VBI_LINE_ENABLE_MASK); + return (READ_VIP32(SC1200_EVEN_DIRECT_VBI_LINE_ENABLE) & + SC1200_DIRECT_VBI_LINE_ENABLE_MASK); +} + +/*--------------------------------------------------------------------------- + * gfx_get_vbi_interrupt + *---------------------------------------------------------------------------- + */ +#if GFX_VIP_DYNAMIC +int +sc1200_get_vbi_interrupt(void) +#else +int +gfx_get_vbi_interrupt(void) +#endif +{ + if (READ_VIP32(SC1200_VIP_CONTROL) & SC1200_VIP_VBI_FIELD_INTERRUPT_EN) + return (1); + return (0); +} + +/*---------------------------------------------------------------------------- + * gfx_get_vip_bus_request_threshold_high + *---------------------------------------------------------------------------- + */ +#if GFX_VIP_DYNAMIC +int +sc1200_get_vip_bus_request_threshold_high(void) +#else +int +gfx_get_vip_bus_request_threshold_high(void) +#endif +{ + if (READ_VIP32(SC1200_VIP_CONFIG) & SC1200_VIP_BUS_REQUEST_THRESHOLD) + return (1); + return (0); +} + +#endif /* GFX_READ_ROUTINES */ + +/* END OF FILE */ diff --git a/driver/xf86-video-geode/src/gx_accel.c b/driver/xf86-video-geode/src/gx_accel.c new file mode 100644 index 000000000..025b06a11 --- /dev/null +++ b/driver/xf86-video-geode/src/gx_accel.c @@ -0,0 +1,2066 @@ +/* Copyright (c) 2003-2005 Advanced Micro Devices, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + * + * Neither the name of the Advanced Micro Devices, Inc. nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * */ + +/* + * File Contents: This file is consists of main Xfree acceleration supported + * routines like solid fill used here. + * + * Project: Geode Xfree Frame buffer device driver. + * */ + +/* #undef OPT_ACCEL */ + +/* Xfree86 header files */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "vgaHW.h" +#include "xf86.h" +#include "xaalocal.h" +#include "xf86fbman.h" +#include "miline.h" +#include "xaarop.h" +#include "servermd.h" +#include "picture.h" +#include "xf86.h" +#include "xf86_OSproc.h" +#include "xf86Pci.h" +#include "xf86PciInfo.h" +#include "geode.h" +#include "gfx_defs.h" +#include "gfx_regs.h" + +/* Common macros for blend operations are here */ + +#include "geode_blend.h" + +#undef ulong +typedef unsigned long ulong; + +#undef uint +typedef unsigned int uint; + +#undef ushort +typedef unsigned short ushort; + +#undef uchar +typedef unsigned char uchar; + +#define CALC_FBOFFSET(x, y) \ + (((ulong)(y) * gu2_pitch + ((ulong)(x) << gu2_xshift))) + +#define FBADDR(x,y) \ + ((unsigned char *)pGeode->FBBase + CALC_FBOFFSET(x, y)) + +#define OS_UDELAY 0 +#if OS_UDELAY > 0 +#define OS_USLEEP(usec) usleep(usec); +#else +#define OS_USLEEP(usec) +#endif + +#ifdef OPT_ACCEL +static unsigned int BPP; +static unsigned int BLT_MODE, VEC_MODE; +static unsigned int ACCEL_STRIDE; + +#define GU2_WAIT_PENDING while(READ_GP32(MGP_BLT_STATUS) & MGP_BS_BLT_PENDING) +#define GU2_WAIT_BUSY while(READ_GP32(MGP_BLT_STATUS) & MGP_BS_BLT_BUSY) +#endif + +#define HOOK(fn) localRecPtr->fn = GX##fn + +#define DLOG(l, fmt, args...) ErrorF(fmt, ##args) + +/* static storage declarations */ + +typedef struct sGBltBox +{ + ulong x, y; + ulong w, h; + ulong color; + int bpp, transparent; +} GBltBox; + +#if GX_SCANLINE_SUPPORT +static GBltBox giwr; +#endif +#if GX_CPU2SCREXP_SUPPORT +static GBltBox gc2s; +#endif +#if GX_CLREXP_8X8_PAT_SUPPORT +static ulong *gc8x8p; +#endif + +#if GX_DASH_LINE_SUPPORT +typedef struct sGDashLine +{ + ulong pat[2]; + int len; + int fg; + int bg; +} GDashLine; + +static GDashLine gdln; +#endif + +static unsigned int gu2_xshift, gu2_yshift; +static unsigned int gu2_pitch; + +static XAAInfoRecPtr localRecPtr; + +/* pat 0xF0 */ +/* src 0xCC */ +/* dst 0xAA */ + +/* (src FUNC dst) */ + +static const int SDfn[16] = { + 0x00, 0x88, 0x44, 0xCC, 0x22, 0xAA, 0x66, 0xEE, + 0x11, 0x99, 0x55, 0xDD, 0x33, 0xBB, 0x77, 0xFF +}; + +/* ((src FUNC dst) AND pat-mask) OR (dst AND (NOT pat-mask)) */ + +static const int SDfn_PM[16] = { + 0x0A, 0x8A, 0x4A, 0xCA, 0x2A, 0xAA, 0x6A, 0xEA, + 0x1A, 0x9A, 0x5A, 0xDA, 0x3A, 0xBA, 0x7A, 0xFA +}; + +/* (pat FUNC dst) */ + +static const int PDfn[16] = { + 0x00, 0xA0, 0x50, 0xF0, 0x0A, 0xAA, 0x5A, 0xFA, + 0x05, 0xA5, 0x55, 0xF5, 0x0F, 0xAF, 0x5F, 0xFF +}; + +/* ((pat FUNC dst) AND src-mask) OR (dst AND (NOT src-mask)) */ + +static const int PDfn_SM[16] = { + 0x22, 0xA2, 0x62, 0xE2, 0x2A, 0xAA, 0x6A, 0xEA, + 0x26, 0xA6, 0x66, 0xE6, 0x2E, 0xAE, 0x6E, 0xEE +}; + +#ifdef OPT_ACCEL +static inline CARD32 +amd_gx_BppToRasterMode(int bpp) +{ + switch (bpp) { + case 16: + return MGP_RM_BPPFMT_565; + case 32: + return MGP_RM_BPPFMT_8888; + case 8: + return MGP_RM_BPPFMT_332; + default: + return 0; + } +} +#endif /* OPT_ACCEL */ + +/*---------------------------------------------------------------------------- + * GXAccelSync. + * + * Description :This function is called to synchronize with the graphics + * engine and it waits the graphic engine is idle. This is + * required before allowing direct access to the framebuffer. + * + * Arg Type Comment + * pScrni ScrnInfoPtr pointer to Screeen info + * + * Returns :none + *---------------------------------------------------------------------------*/ +void +GXAccelSync(ScrnInfoPtr pScrni) +{ + //ErrorF("GXAccelSync()\n"); +#ifndef OPT_ACCEL + gfx_wait_until_idle(); +#else + GU2_WAIT_BUSY; +#endif +} + +#if GX_FILL_RECT_SUPPORT +/*---------------------------------------------------------------------------- + * GXSetupForSolidFill. + * + * Description :The SetupFor and Subsequent SolidFill(Rect) provide + * filling rectangular areas of the screen with a + * foreground color. + * + * Parameters. + * Arg Type Comment + * pScrni ScrnInfoPtr pointer to Screeen info + * color int foreground fill color + * rop int unmapped raster op + * planemask uint -1 (fill) or pattern data + * + * Returns :none + *--------------------------------------------------------------------------*/ +static void +GXSetupForSolidFill(ScrnInfoPtr pScrni, + int color, int rop, unsigned int planemask) +{ + //ErrorF("GXSetupForSolidFill(%#x,%#x,%#x)\n", color, rop, planemask); + rop &= 0x0F; +#ifndef OPT_ACCEL + gfx_set_solid_pattern(planemask); + gfx_set_solid_source(color); + gfx_set_raster_operation(planemask == ~0U ? SDfn[rop] : SDfn_PM[rop]); +#else + { + unsigned int ROP = + BPP | (planemask == ~0U ? SDfn[rop] : SDfn_PM[rop]); + BLT_MODE = ((ROP ^ (ROP >> 2)) & 0x33) == 0 ? MGP_BM_SRC_MONO : 0; + if (((ROP ^ (ROP >> 1)) & 0x55) != 0) + BLT_MODE |= MGP_BM_DST_REQ; + GU2_WAIT_PENDING; + WRITE_GP32(MGP_RASTER_MODE, ROP); + WRITE_GP32(MGP_PAT_COLOR_0, planemask); + WRITE_GP32(MGP_SRC_COLOR_FG, color); + WRITE_GP32(MGP_STRIDE, ACCEL_STRIDE); + } +#endif +} + +/*---------------------------------------------------------------------------- + * GXSubsequentSolidFillRect. + * + * Description :see GXSetupForSolidFill. + * + * Parameters. + * Arg Type Comment + * pScrni ScrnInfoPtr pointer to Screeen info + * x int destination x offset + * y int destination y offset + * w int fill area width (pixels) + * h int fill area height (pixels) + * + * Returns :none + * + * Sample application uses: + * - Window backgrounds. + * - pull down highlighting. + * - x11perf: rectangle tests (-rect500). + * - x11perf: fill trapezoid tests (-trap100). + * - x11perf: horizontal line segments (-hseg500). + *----------------------------------------------------------------------------*/ +static void +GXSubsequentSolidFillRect(ScrnInfoPtr pScrni, int x, int y, int w, int h) +{ + //ErrorF("GXSubsequentSolidFillRect() at %d,%d %dx%d\n", x, y, w, h); +#ifndef OPT_ACCEL + gfx_pattern_fill(x, y, w, h); +#else + { + unsigned int offset = CALC_FBOFFSET(x, y); + unsigned int size = (w << 16) | h; + + GU2_WAIT_PENDING; + WRITE_GP32(MGP_DST_OFFSET, offset); + WRITE_GP32(MGP_WID_HEIGHT, size); + WRITE_GP32(MGP_BLT_MODE, BLT_MODE); + } +#endif +} + +#endif /* if GX_FILL_RECT_SUPPORT */ + +#if GX_CLREXP_8X8_PAT_SUPPORT +/*---------------------------------------------------------------------------- + * GXSetupForColor8x8PatternFill + * + * Description :8x8 color pattern data is 64 pixels of full color data + * stored linearly in offscreen video memory. These patterns + * are useful as a substitute for 8x8 mono patterns when tiling, + * doing opaque stipples, or regular stipples. + * + * Arg Type Comment + * pScrni ScrnInfoPtr pointer to Screeen info + * patx int x offset to pattern data + * paty int y offset to pattern data + * rop int unmapped raster operation + * planemask uint -1 (copy) or pattern data + * trans_color int -1 (copy) or transparent color (not enabled) + * trans color only supported on source channel + * or in monochrome pattern channel + * + * Returns :none. + * + *---------------------------------------------------------------------------*/ + +static void +GXSetupForColor8x8PatternFill(ScrnInfoPtr pScrni, int patx, int paty, int rop, + uint planemask, int trans_color) +{ + GeodeRec *pGeode = GEODEPTR(pScrni); + + //ErrorF("GXSetupForColor8x8PatternFill() pat %#x,%#x rop %#x %#x %#x\n", + // patx, paty, rop, planemask, trans_color); + rop &= 0x0F; + gc8x8p = (unsigned long *)FBADDR(patx, paty); + /* gfx_set_solid_pattern is needed to clear src/pat transparency */ + gfx_set_solid_pattern(0); + gfx_set_raster_operation(planemask == ~0U ? PDfn[rop] : + (gfx_set_solid_source(planemask), PDfn_SM[rop])); + gfx2_set_source_stride(pGeode->Pitch); + gfx2_set_destination_stride(pGeode->Pitch); + if (trans_color == -1) + gfx2_set_source_transparency(0, 0); + else + gfx2_set_source_transparency(trans_color, ~0); +} + +/*---------------------------------------------------------------------------- + * GXSubsequentColor8x8PatternFillRect + * + * Description :see GXSetupForColor8x8PatternFill. + * + * Arg Type Comment + * pScrni ScrnInfoPtr pointer to Screeen info + * patx int pattern phase x offset + * paty int pattern phase y offset + * x int destination x offset + * y int destination y offset + * w int fill area width (pixels) + * h int fill area height (pixels) + * + * Returns :none + * + * Sample application uses: + * - Patterned desktops + * - x11perf: stippled rectangle tests (-srect500). + * - x11perf: opaque stippled rectangle tests (-osrect500). + *--------------------------------------------------------------------------*/ +static void +GXSubsequentColor8x8PatternFillRect(ScrnInfoPtr pScrni, int patx, int paty, + int x, int y, int w, int h) +{ + //ErrorF( + // "GXSubsequentColor8x8PatternFillRect() patxy %d,%d at %d,%d %dsx%d\n", + // patx, paty, x, y, w, h); + gfx2_set_pattern_origin(patx, paty); + gfx2_color_pattern_fill(CALC_FBOFFSET(x, y), w, h, gc8x8p); +} + +/* GX_CLREXP_8X8_PAT_SUPPORT */ +#endif + +#if GX_MONO_8X8_PAT_SUPPORT +/*---------------------------------------------------------------------------- + * GXSetupForMono8x8PatternFill + * + * Description :8x8 mono pattern data is 64 bits of color expansion data + * with ones indicating the foreground color and zeros + * indicating the background color. These patterns are + * useful when tiling, doing opaque stipples, or regular + * stipples. + * + * Arg Type Comment + * pScrni ScrnInfoPtr pointer to Screeen info + * patx int x offset to pattern data + * paty int y offset to pattern data + * fg int foreground color + * bg int -1 (transparent) or background color + * rop int unmapped raster operation + * planemask uint -1 (copy) or pattern data + * + * Returns :none. + * + * Comments :none. + * + *--------------------------------------------------------------------------*/ +static void +GXSetupForMono8x8PatternFill(ScrnInfoPtr pScrni, int patx, int paty, + int fg, int bg, int rop, uint planemask) +{ + //ErrorF( + //"GXSetupForMono8x8PatternFill() pat %#x,%#x fg %#x bg %#x %#x %#x\n", + //patx, paty, fg, bg, rop, planemask); + rop &= 0x0F; +#ifndef OPT_ACCEL + gfx_set_mono_pattern(bg, fg, patx, paty, bg == -1 ? 1 : 0); + gfx_set_raster_operation(planemask == ~0U ? PDfn[rop] : + (gfx_set_solid_source(planemask), PDfn_SM[rop])); +#else + { + unsigned int ROP = BPP | + (bg == + -1 ? MGP_RM_PAT_MONO | MGP_RM_PAT_TRANS : MGP_RM_PAT_MONO) | + (planemask == ~0U ? PDfn[rop] : PDfn_SM[rop]); + BLT_MODE = ((ROP ^ (ROP >> 2)) & 0x33) == 0 ? MGP_BM_SRC_MONO : 0; + if (((ROP ^ (ROP >> 1)) & 0x55) != 0) + BLT_MODE |= MGP_BM_DST_REQ; + GU2_WAIT_PENDING; + WRITE_GP32(MGP_RASTER_MODE, ROP); + WRITE_GP32(MGP_SRC_COLOR_FG, planemask); + WRITE_GP32(MGP_PAT_COLOR_0, bg); + WRITE_GP32(MGP_PAT_COLOR_1, fg); + WRITE_GP32(MGP_PAT_DATA_0, patx); + WRITE_GP32(MGP_PAT_DATA_1, paty); + WRITE_GP32(MGP_STRIDE, ACCEL_STRIDE); + } +#endif +} + +/*---------------------------------------------------------------------------- + * GXSubsequentMono8x8PatternFillRect + * + * Description :see GXSetupForMono8x8PatternFill + * + * Arg Type Comment + * pScrni ScrnInfoPtr pointer to Screeen info + * patx int pattern phase x offset + * paty int pattern phase y offset + * x int destination x offset + * y int destination y offset + * w int fill area width (pixels) + * h int fill area height (pixels) + + * Returns :none + * + * Sample application uses: + * - Patterned desktops + * - x11perf: stippled rectangle tests (-srect500). + * - x11perf: opaque stippled rectangle tests (-osrect500). + *--------------------------------------------------------------------------*/ +static void +GXSubsequentMono8x8PatternFillRect(ScrnInfoPtr pScrni, int patx, int paty, + int x, int y, int w, int h) +{ + DEBUGMSG(1, (0, X_INFO, "%s() pat %#x,%#x at %d,%d %dx%d\n", + __func__, patx, paty, x, y, w, h)); +#ifndef OPT_ACCEL + gfx_pattern_fill(x, y, w, h); +#else + { + unsigned int offset = + CALC_FBOFFSET(x, y) | ((x & 7) << 26) | ((y & 7) << 29); + unsigned int size = (w << 16) | h; + + GU2_WAIT_PENDING; + WRITE_GP32(MGP_DST_OFFSET, offset); + WRITE_GP32(MGP_WID_HEIGHT, size); + WRITE_GP32(MGP_BLT_MODE, BLT_MODE); + } +#endif +} + +#endif /* GX_MONO_8X8_PAT_SUPPORT */ + +#if GX_SCR2SCRCPY_SUPPORT +/*---------------------------------------------------------------------------- + * GXSetupForScreenToScreenCopy + * + * Description :SetupFor and Subsequent ScreenToScreenCopy functions + * provide an interface for copying rectangular areas from + * video memory to video memory. + * + * Arg Type Comment + * pScrni ScrnInfoPtr pointer to Screeen info + * xdir int x copy direction (up/dn) + * ydir int y copy direction (up/dn) + * rop int unmapped raster operation + * planemask uint -1 (copy) or pattern data + * trans_color int -1 (copy) or transparent color + * + * Returns :none + *---------------------------------------------------------------------------*/ +static void +GXSetupForScreenToScreenCopy(ScrnInfoPtr pScrni, int xdir, int ydir, int rop, + uint planemask, int trans_color) +{ + DEBUGMSG(1, (0, X_INFO, "%s() xd%d yd%d rop %#x %#x %#x\n", + __func__, xdir, ydir, rop, planemask, trans_color)); + rop &= 0x0F; +#ifndef OPT_ACCEL + { + GeodeRec *pGeode = GEODEPTR(pScrni); + + gfx_set_solid_pattern(planemask); + /* transparency is a parameter to set_rop, but set...pattern clears + * transparency */ + if (trans_color == -1) + gfx2_set_source_transparency(0, 0); + else + gfx2_set_source_transparency(trans_color, ~0); + gfx_set_raster_operation(planemask == ~0U ? SDfn[rop] : SDfn_PM[rop]); + gfx2_set_source_stride(pGeode->Pitch); + gfx2_set_destination_stride(pGeode->Pitch); + } +#else + { + unsigned int ROP = + BPP | (planemask == ~0U ? SDfn[rop] : SDfn_PM[rop]); + if (trans_color != -1) + ROP |= MGP_RM_SRC_TRANS; + BLT_MODE = ((ROP ^ (ROP >> 1)) & 0x55) != 0 ? + MGP_BM_SRC_FB | MGP_BM_DST_REQ : MGP_BM_SRC_FB; + GU2_WAIT_PENDING; + WRITE_GP32(MGP_RASTER_MODE, ROP); + WRITE_GP32(MGP_PAT_COLOR_0, planemask); + WRITE_GP32(MGP_SRC_COLOR_FG, trans_color); + WRITE_GP32(MGP_SRC_COLOR_BG, ~0); + WRITE_GP32(MGP_STRIDE, ACCEL_STRIDE); + } +#endif +} + +/*---------------------------------------------------------------------------- + * GXSubsquentScreenToScreenCopy + * + * Description :see GXSetupForScreenToScreenCopy. + * + * Arg Type Comment + * pScrni ScrnInfoPtr pointer to Screeen info + * x1 int source x offset + * y1 int source y offset + * x2 int destination x offset + * y2 int destination y offset + * w int copy area width (pixels) + * h int copy area height (pixels) + * + * Returns :none + * + * Sample application uses (non-transparent): + * - Moving windows. + * - x11perf: scroll tests (-scroll500). + * - x11perf: copy from window to window (-copywinwin500). + *---------------------------------------------------------------------------*/ +static void +GXSubsequentScreenToScreenCopy(ScrnInfoPtr pScrni, + int x1, int y1, int x2, int y2, int w, int h) +{ + DEBUGMSG(1, (0, X_INFO, "%s() from %d,%d to %d,%d %dx%d\n", + __func__, x1, y1, x2, y2, w, h)); +#ifndef OPT_ACCEL + { + int flags = 0; + + if (x2 > x1) + flags |= 1; + if (y2 > y1) + flags |= 2; + gfx2_screen_to_screen_blt(CALC_FBOFFSET(x1, y1), CALC_FBOFFSET(x2, + y2), w, h, flags); + } +#else + { + GeodeRec *pGeode = GEODEPTR(pScrni); + unsigned int src = CALC_FBOFFSET(x1, y1); + unsigned int dst = CALC_FBOFFSET(x2, y2); + unsigned int size = (w << 16) | h; + unsigned int blt_mode = BLT_MODE; + + if (x2 > x1) { + int n = (w << gu2_xshift) - 1; + + src += n; + dst += n; + blt_mode |= MGP_BM_NEG_XDIR; + } + if (y2 > y1) { + int n = (h - 1) * pGeode->Pitch; + + src += n; + dst += n; + blt_mode |= MGP_BM_NEG_YDIR; + } + GU2_WAIT_PENDING; + WRITE_GP32(MGP_SRC_OFFSET, src); + WRITE_GP32(MGP_DST_OFFSET, dst); + WRITE_GP32(MGP_WID_HEIGHT, size); + WRITE_GP16(MGP_BLT_MODE, blt_mode); + } +#endif +} + +#endif /* if GX_SCR2SCRCPY_SUPPORT */ + +#if GX_SCANLINE_SUPPORT +/*---------------------------------------------------------------------------- + * GXSetupForScanlineImageWrite + * + * Description :SetupFor/Subsequent ScanlineImageWrite and ImageWriteScanline + * transfer full color pixel data from system memory to video + * memory. This is useful for dealing with alignment issues and + * performing raster ops on the data. + * + * Arg Type Comment + * pScrni ScrnInfoPtr pointer to Screeen info + * rop int unmapped raster operation + * planemask uint -1 (copy) or pattern data + * bpp int bits per pixel (unused) + * depth int color depth (unused) + * + * Returns :none + * + * x11perf -putimage10 + * x11perf -putimage100 + * x11perf -putimage500 + *---------------------------------------------------------------------------- + */ +static void +GXSetupForScanlineImageWrite(ScrnInfoPtr pScrni, int rop, uint planemask, + int trans_color, int bpp, int depth) +{ + GeodeRec *pGeode = GEODEPTR(pScrni); + + DEBUGMSG(1, (0, X_INFO, "%s() rop %#x %#x %#x %d %d\n", + __func__, rop, planemask, trans_color, bpp, depth)); + rop &= 0x0F; + /* transparency is a parameter to set_rop, but set...pattern clears + * transparency */ + gfx_set_solid_pattern(planemask); + if (trans_color == -1) + gfx2_set_source_transparency(0, 0); + else + gfx2_set_source_transparency(trans_color, ~0); + gfx_set_raster_operation(planemask == ~0U ? SDfn[rop] : SDfn_PM[rop]); + gfx2_set_source_stride(pGeode->Pitch); + gfx2_set_destination_stride(pGeode->Pitch); +} + +/*---------------------------------------------------------------------------- + * GXSubsequentScanlineImageWriteRect + * + * Description : see GXSetupForScanlineImageWrite. + * + * Arg Type Comment + * pScrni ScrnInfoPtr pointer to Screeen info + * x int destination x offset + * y int destination y offset + * w int copy area width (pixels) + * h int copy area height (pixels) + * skipleft int x margin (pixels) to skip (not enabled) + * + * Returns :none + *---------------------------------------------------------------------------*/ +static void +GXSubsequentScanlineImageWriteRect(ScrnInfoPtr pScrni, + int x, int y, int w, int h, int skipleft) +{ + DEBUGMSG(1, (0, X_INFO, "%s() rop %d,%d %dx%d %d\n", + __func__, x, y, w, h, skipleft)); + giwr.x = x; + giwr.y = y; + giwr.w = w; + giwr.h = h; +#if !GX_USE_OFFSCRN_MEM +#if !GX_ONE_LINE_AT_A_TIME + GXAccelSync(pScrni); +#endif +#endif +} + +/*---------------------------------------------------------------------------- + * GXSubsquentImageWriteScanline + * + * Description : see GXSetupForScanlineImageWrite. + * + * Arg Type Comment + * pScrni ScrnInfoPtr pointer to Screeen info + * bufno int scanline number in write group + * + * Returns :none + * + * Sample application uses (non-transparent): + * - Moving windows. + * - x11perf: scroll tests (-scroll500). + * - x11perf: copy from window to window (-copywinwin500). + * + *---------------------------------------------------------------------------*/ +static void +GXSubsequentImageWriteScanline(ScrnInfoPtr pScrni, int bufno) +{ + GeodeRec *pGeode = GEODEPTR(pScrni); + +#if !GX_USE_OFFSCRN_MEM + unsigned long offset; +#endif + +#if GX_ONE_LINE_AT_A_TIME + DEBUGMSG(1, (0, X_INFO, "%s() %d\n", __func__, bufno)); +#if !GX_USE_OFFSCRN_MEM + offset = pGeode->AccelImageWriteBuffers[bufno] - pGeode->FBBase; + gfx2_screen_to_screen_blt(offset, CALC_FBOFFSET(giwr.x, giwr.y), giwr.w, + 1, 0); +#else /* if !GX_USE_OFFSCRN_MEM */ + gfx2_color_bitmap_to_screen_blt(0, 0, CALC_FBOFFSET(giwr.x, giwr.y), + giwr.w, 1, pGeode->AccelImageWriteBuffers[bufno], pGeode->Pitch); +#endif /* if !GX_USE_OFFSCRN_MEM */ + ++giwr.y; +#else /* if GX_ONE_LINE_AT_A_TIME */ + int blt_height; + + DEBUGMSG(1, (0, X_INFO, "%s() %d\n", __func__, bufno)); + + if ((blt_height = pGeode->NoOfImgBuffers) > giwr.h) + blt_height = giwr.h; + if (++bufno < blt_height) + return; +#if !GX_USE_OFFSCRN_MEM + offset = pGeode->AccelImageWriteBuffers[0] - pGeode->FBBase; + gfx2_screen_to_screen_blt(offset, CALC_FBOFFSET(giwr.x, giwr.y), giwr.w, + blt_height, 0); + GXAccelSync(pScrni); +#else /* if !GX_USE_OFFSCRN_MEM */ + gfx2_color_bitmap_to_screen_blt(0, 0, CALC_FBOFFSET(giwr.x, giwr.y), + giwr.w, blt_height, pGeode->AccelImageWriteBuffers[0], pGeode->Pitch); +#endif /* if !GX_USE_OFFSCRN_MEM */ + giwr.h -= blt_height; + giwr.y += blt_height; +#endif /* if GX_ONE_LINE_AT_A_TIME */ +} +#endif /* GX_SCANLINE_SUPPORT */ + +#if GX_CPU2SCREXP_SUPPORT +/*---------------------------------------------------------------------------- + * GXSetupForScanlineCPUToScreenColorExpandFill + * + * Description :SetupFor/Subsequent CPUToScreenColorExpandFill and + * ColorExpandScanline routines provide an interface for + * doing expansion blits from source patterns stored in + * system memory. + * + * Arg Type Comment + * pScrni ScrnInfoPtr pointer to Screeen info + * fg int foreground color + * bg int -1 (transparent) or background color + * rop int unmapped raster operation + * planemask uint -1 (copy) or pattern data + * + * Returns :none. + *---------------------------------------------------------------------------*/ + +static void +GXSetupForScanlineCPUToScreenColorExpandFill(ScrnInfoPtr pScrni, + int fg, int bg, int rop, uint planemask) +{ + GeodeRec *pGeode = GEODEPTR(pScrni); + ulong srcpitch; + + DEBUGMSG(1, (0, X_INFO, "%s() fg %#x bg %#x rop %#x %#x\n", + __func__, fg, bg, rop, planemask)); + rop &= 0x0F; + srcpitch = ((pGeode->Pitch + 31) >> 5) << 2; +#ifndef OPT_ACCEL + gfx_set_solid_pattern(planemask); + gfx_set_mono_source(bg, fg, bg == -1 ? 1 : 0); + gfx_set_raster_operation(planemask == ~0U ? SDfn[rop] : SDfn_PM[rop]); + gfx2_set_source_stride(srcpitch); + gfx2_set_destination_stride(pGeode->Pitch); +#else + { + unsigned int stride = (srcpitch << 16) | pGeode->Pitch; + unsigned int ROP = + BPP | (planemask == ~0U ? SDfn[rop] : SDfn_PM[rop]); + if (bg == -1) + ROP |= MGP_RM_SRC_TRANS; + BLT_MODE = ((ROP ^ (ROP >> 1)) & 0x55) != 0 ? + MGP_BM_SRC_MONO | MGP_BM_SRC_FB | MGP_BM_DST_REQ : + MGP_BM_SRC_MONO | MGP_BM_SRC_FB; + GU2_WAIT_PENDING; + WRITE_GP32(MGP_RASTER_MODE, ROP); + WRITE_GP32(MGP_PAT_COLOR_0, planemask); + WRITE_GP32(MGP_SRC_COLOR_BG, bg); + WRITE_GP32(MGP_SRC_COLOR_FG, fg); + WRITE_GP32(MGP_STRIDE, stride); + } +#endif +} + +/*---------------------------------------------------------------------------- + * GXSubsequentScanlineCPUToScreenColorExpandFill + * + Description :see GXSetupForScanlineCPUToScreenColorExpandFill + * + * Parameters: + * Arg Type Comment + * pScrni ScrnInfoPtr pointer to Screeen info + * x int destination x offset + * y int destination y offset + * w int fill area width (pixels) + * h int fill area height (pixels) + * + * Returns :none + * + *---------------------------------------------------------------------------*/ +static void +GXSubsequentScanlineCPUToScreenColorExpandFill(ScrnInfoPtr pScrni, + int x, int y, int w, int h, int skipleft) +{ + DEBUGMSG(1, (0, X_INFO, "%s() %d,%d %dx%d %d\n", + __func__, x, y, w, h, skipleft)); + gc2s.x = x; + gc2s.y = y; + gc2s.w = w; + gc2s.h = h; +#ifdef OPT_ACCEL + { +#if GX_ONE_LINE_AT_A_TIME + unsigned int size = (gc2s.w << 16) | 1; + + GU2_WAIT_PENDING; + WRITE_GP32(MGP_WID_HEIGHT, size); +#else + GeodeRec *pGeode = GEODEPTR(pScrni); + unsigned int src = + pGeode->AccelColorExpandBuffers[0] - pGeode->FBBase; + GU2_WAIT_PENDING; + WRITE_GP32(MGP_SRC_OFFSET, src); +#endif + } +#endif +} + +/*---------------------------------------------------------------------------- + * GXSubsequentColorExpandScanline + * + * Description :see GXSetupForScanlineCPUToScreenColorExpandFill + * + * Arg Type Comment + * pScrni ScrnInfoPtr pointer to Screeen info + * bufno int scanline number in write group + * + * Returns :none + *---------------------------------------------------------------------------- + */ +static void +GXSubsequentColorExpandScanline(ScrnInfoPtr pScrni, int bufno) +{ + GeodeRec *pGeode = GEODEPTR(pScrni); + + DEBUGMSG(1, (0, X_INFO, "%s() %d\n", __func__, bufno)); +#ifndef OPT_ACCEL + { +#if GX_ONE_LINE_AT_A_TIME + ulong offset = + pGeode->AccelColorExpandBuffers[bufno] - pGeode->FBBase; + gfx2_mono_expand_blt(offset, 0, 0, CALC_FBOFFSET(gc2s.x, gc2s.y), + gc2s.w, 1, 0); + ++gc2s.y; +#else /* if GX_ONE_LINE_AT_A_TIME */ + ulong srcpitch; + int blt_height; + + if ((blt_height = pGeode->NoOfImgBuffers) > gc2s.h) + blt_height = gc2s.h; + if (++bufno < blt_height) + return; + + /* convert from bits to dwords */ + srcpitch = ((pGeode->Pitch + 31) >> 5) << 2; + gfx2_mono_bitmap_to_screen_blt(0, 0, CALC_FBOFFSET(gc2s.x, gc2s.y), + gc2s.w, blt_height, pGeode->AccelColorExpandBuffers[0], srcpitch); + gc2s.h -= blt_height; + gc2s.y += blt_height; +#endif /* if GX_ONE_LINE_AT_A_TIME */ + } +#else /* ifndef OPT_ACCEL */ + { +#if GX_ONE_LINE_AT_A_TIME + unsigned int src = + pGeode->AccelColorExpandBuffers[bufno] - pGeode->FBBase; + unsigned int dst = CALC_FBOFFSET(gc2s.x, gc2s.y); + + ++gc2s.y; + GU2_WAIT_PENDING; + WRITE_GP32(MGP_SRC_OFFSET, src); + WRITE_GP32(MGP_DST_OFFSET, dst); + WRITE_GP16(MGP_BLT_MODE, BLT_MODE); +#else /* if GX_ONE_LINE_AT_A_TIME */ + unsigned int dst, size; + int blt_height; + + GU2_WAIT_BUSY; + if ((blt_height = pGeode->NoOfImgBuffers) > gc2s.h) + blt_height = gc2s.h; + if (++bufno < blt_height) + return; + dst = CALC_FBOFFSET(gc2s.x, gc2s.y); + size = (gc2s.w << 16) | blt_height; + gc2s.h -= blt_height; + gc2s.y += blt_height; + GU2_WAIT_PENDING; + WRITE_GP32(MGP_DST_OFFSET, dst); + WRITE_GP32(MGP_WID_HEIGHT, size); + WRITE_GP16(MGP_BLT_MODE, BLT_MODE); +#endif /* if GX_ONE_LINE_AT_A_TIME */ + } +#endif /* ifndef OPT_ACCEL */ +} +#endif /* GX_CPU2SCREXP_SUPPORT */ + +#if GX_SCR2SCREXP_SUPPORT +/*---------------------------------------------------------------------------- + * GXSetupForScreenToScreenColorExpandFill + * + * Description :SetupFor/Subsequent ScreenToScreenColorExpandFill and + * ColorExpandScanline routines provide an interface for + * doing expansion blits from source patterns stored in + * video memory. + * + * Arg Type Comment + * pScrni ScrnInfoPtr pointer to Screeen info + * fg int foreground color + * bg int -1 (transparent) or background color + * rop int unmapped raster operation + * planemask uint -1 (copy) or pattern data + * + * Returns :none. + *---------------------------------------------------------------------------*/ + +static void +GXSetupForScreenToScreenColorExpandFill(ScrnInfoPtr pScrni, int fg, int bg, + int rop, uint planemask) +{ + DEBUGMSG(1, (0, X_INFO, "%s() fg %#x bg %#x rop %#x %#x\n", + __func__, fg, bg, rop, planemask)); + rop &= 0x0F; +#ifndef OPT_ACCEL + { + GeodeRec *pGeode = GEODEPTR(pScrni); + + gfx_set_solid_pattern(planemask); + gfx_set_mono_source(bg, fg, bg == -1 ? 1 : 0); + gfx_set_raster_operation(planemask == ~0U ? SDfn[rop] : SDfn_PM[rop]); + gfx2_set_source_stride(pGeode->Pitch); + gfx2_set_destination_stride(pGeode->Pitch); + } +#else + { + unsigned int ROP = + BPP | (planemask == ~0U ? SDfn[rop] : SDfn_PM[rop]); + if (bg == -1) + ROP |= MGP_RM_SRC_TRANS; + BLT_MODE = ((ROP ^ (ROP >> 1)) & 0x55) != 0 ? + MGP_BM_SRC_MONO | MGP_BM_SRC_FB | MGP_BM_DST_REQ : + MGP_BM_SRC_MONO | MGP_BM_SRC_FB; + GU2_WAIT_PENDING; + WRITE_GP32(MGP_RASTER_MODE, ROP); + WRITE_GP32(MGP_PAT_COLOR_0, planemask); + WRITE_GP32(MGP_SRC_COLOR_BG, bg); + WRITE_GP32(MGP_SRC_COLOR_FG, fg); + WRITE_GP32(MGP_STRIDE, ACCEL_STRIDE); + } +#endif +} + +/*---------------------------------------------------------------------------- + * GXSubsequentScreenToScreenColorExpandFill + * + * Description :see GXSetupForScreenToScreenColorExpandFill + * + * Parameters: + * Arg Type Comment + * pScrni ScrnInfoPtr pointer to Screeen info + * x int destination x offset + * y int destination y offset + * w int fill area width (pixels) + * h int fill area height (pixels) + * offset int initial x offset + * + * Returns :none + * + *---------------------------------------------------------------------------*/ +static void +GXSubsequentScreenToScreenColorExpandFill(ScrnInfoPtr pScrni, + int x, int y, int w, int h, int srcx, int srcy, int offset) +{ + DEBUGMSG(1, (0, X_INFO, "%s() %d,%d %dx%d %d,%d %d\n", + __func__, x, y, w, h, srcx, srcy, offset)); +#ifndef OPT_ACCEL + gfx2_mono_expand_blt(CALC_FBOFFSET(srcx, srcy), offset, 0, + CALC_FBOFFSET(x, y), w, h, 0); +#else + { + unsigned int src = (CALC_FBOFFSET(srcx, + srcy) + (offset >> 3)) | ((offset & 7) << 26); + unsigned int dst = CALC_FBOFFSET(x, y); + unsigned int size = (w << 16) | h; + + GU2_WAIT_PENDING; + WRITE_GP32(MGP_SRC_OFFSET, src); + WRITE_GP32(MGP_DST_OFFSET, dst); + WRITE_GP32(MGP_WID_HEIGHT, size); + WRITE_GP16(MGP_BLT_MODE, BLT_MODE); + } +#endif +} +#endif /* GX_SCR2SCREXP_SUPPORT */ + +#define VM_MAJOR_DEC 0 +#define VM_MINOR_DEC 0 + +static unsigned short vmode[] = { + VM_X_MAJOR | VM_MAJOR_INC | VM_MINOR_INC, + /* !XDECREASING !YDECREASING !YMAJOR */ + VM_Y_MAJOR | VM_MAJOR_INC | VM_MINOR_INC, + /* !XDECREASING !YDECREASING YMAJOR */ + VM_X_MAJOR | VM_MAJOR_INC | VM_MINOR_DEC, + /* !XDECREASING YDECREASING !YMAJOR */ + VM_Y_MAJOR | VM_MAJOR_DEC | VM_MINOR_INC, + /* !XDECREASING YDECREASING YMAJOR */ + VM_X_MAJOR | VM_MAJOR_DEC | VM_MINOR_INC, + /* XDECREASING !YDECREASING !YMAJOR */ + VM_Y_MAJOR | VM_MAJOR_INC | VM_MINOR_DEC, + /* XDECREASING !YDECREASING YMAJOR */ + VM_X_MAJOR | VM_MAJOR_DEC | VM_MINOR_DEC, + /* XDECREASING YDECREASING !YMAJOR */ + VM_Y_MAJOR | VM_MAJOR_DEC | VM_MINOR_DEC, + /* XDECREASING YDECREASING YMAJOR */ +}; + +#if GX_BRES_LINE_SUPPORT +/*---------------------------------------------------------------------------- + * GXSetupForSolidLine + * + * Description :SetupForSolidLine and Subsequent HorVertLine TwoPointLine + * BresenhamLine provides an interface for drawing thin + * solid lines. + * + * Arg Type Comment + * pScrni ScrnInfoPtr pointer to Screeen info + * color int foreground fill color + * rop int unmapped raster op + * planemask uint -1 (fill) or pattern data (not enabled) + * + * Returns :none + *---------------------------------------------------------------------------*/ +static void +GXSetupForSolidLine(ScrnInfoPtr pScrni, int color, int rop, uint planemask) +{ + DEBUGMSG(1, (0, X_INFO, "%s() %#x %#x %#x\n", + __func__, color, rop, planemask)); + rop &= 0x0F; +#ifndef OPT_ACCEL + gfx_set_solid_pattern(color); + gfx_set_raster_operation(planemask == ~0U ? PDfn[rop] : + (gfx_set_solid_source(planemask), PDfn_SM[rop])); +#else + { + unsigned int ROP = + BPP | (planemask == ~0U ? PDfn[rop] : PDfn_SM[rop]); + BLT_MODE = ((ROP ^ (ROP >> 2)) & 0x33) == 0 ? MGP_BM_SRC_MONO : 0; + VEC_MODE = ((ROP ^ (ROP >> 1)) & 0x55) != 0 ? ((BLT_MODE |= + MGP_BM_DST_REQ), MGP_VM_DST_REQ) : 0; + GU2_WAIT_PENDING; + WRITE_GP32(MGP_RASTER_MODE, ROP); + WRITE_GP32(MGP_PAT_COLOR_0, color); + WRITE_GP32(MGP_SRC_COLOR_FG, planemask); + WRITE_GP32(MGP_STRIDE, ACCEL_STRIDE); + } +#endif +} + +/*--------------------------------------------------------------------------- + * GXSubsequentSolidBresenhamLine + * + * Description :see GXSetupForSolidLine + * + * Arg Type Comment + * pScrni ScrnInfoPtr pointer to Screeen info + * x1 int destination x offset + * y1 int destination y offset + * absmaj int Bresenman absolute major + * absmin int Bresenman absolute minor + * err int Bresenman initial error term + * len int length of the vector (pixels) + * octant int specifies sign and magnitude relationships + * used to determine axis of magor rendering + * and direction of vector progress. + * + * Returns :none + * + * - Window outlines on window move. + * - x11perf: line segments (-line500). + * - x11perf: line segments (-seg500). + *---------------------------------------------------------------------------*/ +static void +GXSubsequentSolidBresenhamLine(ScrnInfoPtr pScrni, int x1, int y1, + int absmaj, int absmin, int err, int len, int octant) +{ + long axial, diagn; + + DEBUGMSG(1, (0, X_INFO, "%s() %d,%d %d %d, %d %d, %d\n", + __func__, x1, y1, absmaj, absmin, err, len, octant)); + if (len <= 0) + return; + axial = absmin; + err += axial; + diagn = absmin - absmaj; +#ifndef OPT_ACCEL + gfx_bresenham_line(x1, y1, len, err, axial, diagn, vmode[octant]); +#else + { + unsigned int offset = CALC_FBOFFSET(x1, y1); + unsigned int vec_err = (axial << 16) | (unsigned short)diagn; + unsigned int vec_len = (len << 16) | (unsigned short)err; + unsigned int vec_mode = VEC_MODE | vmode[octant]; + + GU2_WAIT_PENDING; + WRITE_GP32(MGP_DST_OFFSET, offset); + WRITE_GP32(MGP_VEC_ERR, vec_err); + WRITE_GP32(MGP_VEC_LEN, vec_len); + WRITE_GP32(MGP_VECTOR_MODE, vec_mode); + } +#endif +} + +/*--------------------------------------------------------------------------- + * GXSubsequentSolidTwoPointLine + * + * Description :see GXSetupForSolidLine + * + * Arg Type Comment + * pScrni ScrnInfoPtr pointer to Screeen info + * x0 int destination x start offset + * y0 int destination y start offset + * x1 int destination x end offset + * y1 int destination y end offset + * flags int OMIT_LAST, dont draw last pixel (not used) + * + * Returns :none + *---------------------------------------------------------------------------*/ +static void +GXSubsequentSolidTwoPointLine(ScrnInfoPtr pScrni, int x0, int y0, + int x1, int y1, int flags) +{ + long dx, dy, dmaj, dmin, octant, bias; + long axial, diagn, err, len; + + DEBUGMSG(1, (0, X_INFO, "%s() %d,%d %d,%d, %#x\n", + __func__, x0, y0, x1, y1, flags)); + + if ((dx = x1 - x0) < 0) + dx = -dx; + if ((dy = y1 - y0) < 0) + dy = -dy; + if (dy >= dx) { + dmaj = dy; + dmin = dx; + octant = YMAJOR; + } else { + dmaj = dx; + dmin = dy; + octant = 0; + } + len = dmaj; + if ((flags & OMIT_LAST) == 0) + ++len; + if (len <= 0) + return; + if (x1 < x0) + octant |= XDECREASING; + if (y1 < y0) + octant |= YDECREASING; + + axial = dmin << 1; + bias = miGetZeroLineBias(pScrni->pScreen); + err = axial - dmaj - ((bias >> octant) & 1); + diagn = (dmin - dmaj) << 1; + +#ifndef OPT_ACCEL + gfx_bresenham_line(x0, y0, len, err, axial, diagn, vmode[octant]); +#else + { + unsigned int offset = CALC_FBOFFSET(x0, y0); + unsigned int vec_err = (axial << 16) | (unsigned short)diagn; + unsigned int vec_len = (len << 16) | (unsigned short)err; + unsigned int vec_mode = VEC_MODE | vmode[octant]; + + GU2_WAIT_PENDING; + WRITE_GP32(MGP_DST_OFFSET, offset); + WRITE_GP32(MGP_VEC_ERR, vec_err); + WRITE_GP32(MGP_VEC_LEN, vec_len); + WRITE_GP32(MGP_VECTOR_MODE, vec_mode); + } +#endif +} + +/*--------------------------------------------------------------------------- + * GXSubsequentSolidHorVertLine + * + * Description :see GXSetupForSolidLine + * + * Arg Type Comment + * pScrni ScrnInfoPtr pointer to Screeen info + * x int destination x offset + * y int destination y offset + * len int length of the vector (pixels) + * dir int DEGREES_270 or DEGREES_0 line direction + * + * Sample application uses: + * - Window outlines on window move. + * - x11perf: line segments (-hseg500). + * - x11perf: line segments (-vseg500). + *--------------------------------------------------------------------------- + */ +static void +GXSubsequentSolidHorVertLine(ScrnInfoPtr pScrni, + int x, int y, int len, int dir) +{ + DEBUGMSG(1, (0, X_INFO, "%s() %d,%d %d %d\n", __func__, x, y, len, dir)); +#ifndef OPT_ACCEL + if (dir == DEGREES_0) + gfx_pattern_fill(x, y, len, 1); + else + gfx_pattern_fill(x, y, 1, len); +#else + { + unsigned int offset = CALC_FBOFFSET(x, y); + unsigned int size = + dir == DEGREES_0 ? (len << 16) | 1 : (1 << 16) | len; + GU2_WAIT_PENDING; + WRITE_GP32(MGP_DST_OFFSET, offset); + WRITE_GP32(MGP_WID_HEIGHT, size); + WRITE_GP32(MGP_BLT_MODE, BLT_MODE); + } +#endif +} +#endif /* GX_BRES_LINE_SUPPORT */ + +#if GX_DASH_LINE_SUPPORT +/*---------------------------------------------------------------------------- + * GXSetupForDashedLine + * + * Description :SetupForDashedLine and Subsequent TwoPointLine + * BresenhamLine provides an interface for drawing thin + * dashed lines. + * + * Arg Type Comment + * pScrni ScrnInfoPtr pointer to Screeen info + * fg int foreground fill color + * bg int -1 (transp) or background fill color + * rop int unmapped raster op + * planemask uint -1 (fill) or pattern data (not enabled) + * length int pattern length (bits) + * pattern uchar* dash pattern mask + * + * Returns :none + *---------------------------------------------------------------------------*/ +static void +GXSetupForDashedLine(ScrnInfoPtr pScrn, int fg, int bg, int rop, + unsigned int planemask, int length, unsigned char *pattern) +{ + int i, l, n, m; + CARD32 pat = *pattern; + CARD32 pat8x8[2]; + + if (length <= 0) + return; + i = l = m = 0; + while (i < 2) { + m |= pat >> l; + l += length; + if ((n = l - 32) >= 0) { + pat8x8[i++] = m; + m = pat << (length - n); + l = n; + } + } + gdln.pat[0] = pat8x8[0]; + gdln.pat[1] = pat8x8[1]; + gdln.len = length; + gdln.fg = fg; + gdln.bg = bg; + rop &= 0x0F; + gfx_set_solid_pattern(0); + gfx_set_raster_operation(planemask == ~0U ? PDfn[rop] : + (gfx_set_solid_source(planemask), PDfn_SM[rop])); +} + +/*--------------------------------------------------------------------------- + * GXSubsequentDashedBresenhamLine + * + * Description: This function is used to render a vector using the + * specified bresenham parameters. + * + * Parameters: + * pScrni: Screen handler pointer having screen information. + * x1: Specifies the starting x position + * y1: Specifies starting y possition + * absmaj: Specfies the Bresenman absolute major. + * absmin: Specfies the Bresenman absolute minor. + * err: Specifies the bresenham err term. + * len: Specifies the length of the vector interms of pixels. + * octant: not used in this function,may be added for standard + * interface. + * + * Returns: none + * + * Comments: none + * + * Sample application uses: + * - Window outlines on window move. + * - x11perf: line segments (-line500). + * - x11perf: line segments (-seg500). + *---------------------------------------------------------------------------- + */ +static void +GXSubsequentDashedBresenhamLine(ScrnInfoPtr pScrni, + int x1, int y1, int absmaj, int absmin, + int err, int len, int octant, int phase) +{ + int i, n; + int axial, diagn; + int trans = (gdln.bg == -1); + unsigned long pat8x8[2]; + + //ErrorF("BLine %d, %d, %d, %d, %d, %d, %d\n" x1, y1, absmaj, absmin, + //err, len, octant); + + i = phase >= 32 ? (phase -= 32, 1) : 0; + n = 32 - phase; + pat8x8[0] = + ((gdln.pat[i] >> phase) & ((1UL << n) - 1)) | (gdln.pat[1 - i] << n); + pat8x8[1] = + ((gdln.pat[1 - i] >> phase) & ((1UL << n) - 1)) | (gdln.pat[i] << n); + axial = absmin; + err += axial; + diagn = absmin - absmaj; + gfx_set_mono_pattern(gdln.bg, gdln.fg, pat8x8[0], pat8x8[1], trans); + gfx2_set_pattern_origin(x1, y1); + gfx2_bresenham_line(CALC_FBOFFSET(x1, y1), len, err, axial, diagn, + vmode[octant]); +} + +/*--------------------------------------------------------------------------- + * GXSubsequentDashedTwoPointLine + * + * Description :see GXSetupForDashedLine + * + * Arg Type Comment + * pScrni ScrnInfoPtr pointer to Screeen info + * x0 int destination x start offset + * y0 int destination y start offset + * x1 int destination x end offset + * y1 int destination y end offset + * flags int OMIT_LAST, dont draw last pixel (not used) + * phase int initial pattern offset at x1,y1 + * + * Returns :none + *---------------------------------------------------------------------------*/ +static void +GXSubsequentDashedTwoPointLine(ScrnInfoPtr pScrni, int x0, int y0, + int x1, int y1, int flags, int phase) +{ + int i, n; + long dx, dy, dmaj, dmin, octant, bias; + long axial, diagn, err, len, pat8x8[2]; + + //ErrorF("GXSubsequentDashedTwoPointLine() %d,%d %d,%d, %#x %d\n", + // x0, y0, x1, y1, flags, phase); + + i = phase >= 32 ? (phase -= 32, 1) : 0; + n = 32 - phase; + pat8x8[0] = + ((gdln.pat[i] >> phase) & ((1UL << n) - 1)) | (gdln.pat[1 - i] << n); + pat8x8[1] = + ((gdln.pat[1 - i] >> phase) & ((1UL << n) - 1)) | (gdln.pat[i] << n); + + if ((dx = x1 - x0) < 0) + dx = -dx; + if ((dy = y1 - y0) < 0) + dy = -dy; + if (dy >= dx) { + dmaj = dy; + dmin = dx; + octant = YMAJOR; + } else { + dmaj = dx; + dmin = dy; + octant = 0; + } + len = dmaj; + if ((flags & OMIT_LAST) == 0) + ++len; + if (len <= 0) + return; + if (x1 < x0) + octant |= XDECREASING; + if (y1 < y0) + octant |= YDECREASING; + + axial = dmin << 1; + bias = miGetZeroLineBias(pScrni->pScreen); + err = axial - dmaj - ((bias >> octant) & 1); + diagn = (dmin - dmaj) << 1; + + gfx2_set_pattern_origin(x0, y0); + gfx2_bresenham_line(CALC_FBOFFSET(x0, y0), len, err, axial, diagn, + vmode[octant]); + +} +#endif /* GX_DASH_LINE_SUPPORT */ + +#if GX_WRITE_PIXMAP_SUPPORT +static void +GXWritePixmap(ScrnInfoPtr pScrni, int x, int y, int w, int h, + unsigned char *src, int srcwidth, int rop, unsigned int planemask, + int trans, int bpp, int depth) +{ + GeodeRec *pGeode = GEODEPTR(pScrni); + + //ErrorF("GXWritePixmap() %d,%d %dx%d, s%#x sp%d %#x %#x %#x %d %d\n", + // x, y, w, h, src, srcwidth, rop, planemask, trans, bpp, depth); + + if (bpp == pScrni->bitsPerPixel) { + rop &= 0x0F; + if (rop == GXcopy && trans == -1) { + gfx_wait_until_idle(); + geode_memory_to_screen_blt((unsigned long)src, + (unsigned long)FBADDR(x, y), srcwidth, pGeode->Pitch, w, + h, bpp); + } else { + gfx_set_solid_pattern(planemask); + gfx_set_raster_operation(planemask == + ~0U ? SDfn[rop] : SDfn_PM[rop]); + if (trans != -1) + gfx_color_bitmap_to_screen_xblt(0, 0, x, y, w, h, src, + srcwidth, trans); + else + gfx_color_bitmap_to_screen_blt(0, 0, x, y, w, h, src, + srcwidth); + SET_SYNC_FLAG(pGeode->AccelInfoRec); + } + } else + pGeode->WritePixmap(pScrni, x, y, w, h, src, srcwidth, rop, planemask, + trans, bpp, depth); +} +#endif /* if GX_WRITE_PIXMAP_SUPPORT */ + +#if XF86EXA + +static void +amd_gx_exa_WaitMarker(ScreenPtr pScreen, int Marker) +{ + GU2_WAIT_BUSY; +} + +static void +amd_gx_exa_Done(PixmapPtr p) +{ +} + +static Bool +amd_gx_exa_UploadToScreen(PixmapPtr pDst, int x, int y, int w, int h, + char *src, int src_pitch) +{ + char *dst = pDst->devPrivate.ptr; + int dst_pitch = exaGetPixmapPitch(pDst); + int bpp = pDst->drawable.bitsPerPixel; + + dst += y * dst_pitch + x * (bpp >> 3); + GU2_WAIT_BUSY; + geode_memory_to_screen_blt((unsigned long)src, (unsigned long)dst, + src_pitch, dst_pitch, w, h, bpp); + return TRUE; +} + +static Bool +amd_gx_exa_DownloadFromScreen(PixmapPtr pSrc, int x, int y, int w, int h, + char *dst, int dst_pitch) +{ + char *src = pSrc->devPrivate.ptr; + int src_pitch = exaGetPixmapPitch(pSrc); + int bpp = pSrc->drawable.bitsPerPixel; + + src += (y * src_pitch) + (x * (bpp >> 3)); + GU2_WAIT_BUSY; + geode_memory_to_screen_blt((unsigned long)src, (unsigned long)dst, + src_pitch, dst_pitch, w, h, bpp); + return TRUE; +} + +/* Solid */ + +static Bool +amd_gx_exa_PrepareSolid(PixmapPtr pxMap, int alu, Pixel planemask, Pixel fg) +{ + int dstPitch = exaGetPixmapPitch(pxMap); + unsigned int ROP = amd_gx_BppToRasterMode(pxMap->drawable.bitsPerPixel) + | (planemask == ~0U ? SDfn[alu] : SDfn_PM[alu]); + + // FIXME: this should go away -- workaround for the blockparty icon corruption + //if (pxMap->drawable.bitsPerPixel == 32) + // return FALSE; + + BLT_MODE = ((ROP ^ (ROP >> 2)) & 0x33) == 0 ? MGP_BM_SRC_MONO : 0; + if (((ROP ^ (ROP >> 1)) & 0x55) != 0) + BLT_MODE |= MGP_BM_DST_REQ; + //ErrorF("amd_gx_exa_PrepareSolid(%#x,%#x,%#x - ROP=%x,BLT_MODE=%x)\n", alu, planemask, fg, ROP, BLT_MODE); + GU2_WAIT_PENDING; + WRITE_GP32(MGP_RASTER_MODE, ROP); + WRITE_GP32(MGP_PAT_COLOR_0, planemask); + WRITE_GP32(MGP_SRC_COLOR_FG, fg); + WRITE_GP32(MGP_STRIDE, dstPitch); + return TRUE; +} + +static void +amd_gx_exa_Solid(PixmapPtr pxMap, int x1, int y1, int x2, int y2) +{ + int bpp = (pxMap->drawable.bitsPerPixel + 7) / 8; + int pitch = exaGetPixmapPitch(pxMap); + unsigned int offset = exaGetPixmapOffset(pxMap) + pitch * y1 + bpp * x1; + unsigned int size = ((x2 - x1) << 16) | (y2 - y1); + + //ErrorF("amd_gx_exa_Solid() at %d,%d %d,%d - offset=%d, bpp=%d\n", x1, y1, x2, y2, offset, bpp); + + GU2_WAIT_PENDING; + WRITE_GP32(MGP_DST_OFFSET, offset); + WRITE_GP32(MGP_WID_HEIGHT, size); + WRITE_GP32(MGP_BLT_MODE, BLT_MODE); +} + +/* Copy */ + +static Bool +amd_gx_exa_PrepareCopy(PixmapPtr pxSrc, PixmapPtr pxDst, int dx, int dy, + int alu, Pixel planemask) +{ + GeodeRec *pGeode = GEODEPTR_FROM_PIXMAP(pxDst); + int dstPitch = exaGetPixmapPitch(pxDst); + unsigned int ROP; + + /* Punt if the color formats aren't the same */ + + if (pxSrc->drawable.bitsPerPixel != pxDst->drawable.bitsPerPixel) + return FALSE; + + //ErrorF("amd_gx_exa_PrepareCopy() dx%d dy%d alu %#x %#x\n", + // dx, dy, alu, planemask); + + pGeode->cpySrcOffset = exaGetPixmapOffset(pxSrc); + pGeode->cpySrcPitch = exaGetPixmapPitch(pxSrc); + pGeode->cpySrcBpp = (pxSrc->drawable.bitsPerPixel + 7) / 8; + pGeode->cpyDx = dx; + pGeode->cpyDy = dy; + ROP = amd_gx_BppToRasterMode(pxSrc->drawable.bitsPerPixel) | + (planemask == ~0U ? SDfn[alu] : SDfn_PM[alu]); + + BLT_MODE = ((ROP ^ (ROP >> 1)) & 0x55) != 0 ? + MGP_BM_SRC_FB | MGP_BM_DST_REQ : MGP_BM_SRC_FB; + GU2_WAIT_PENDING; + WRITE_GP32(MGP_RASTER_MODE, ROP); + WRITE_GP32(MGP_PAT_COLOR_0, planemask); + WRITE_GP32(MGP_SRC_COLOR_FG, ~0); + WRITE_GP32(MGP_SRC_COLOR_BG, ~0); + WRITE_GP32(MGP_STRIDE, (pGeode->cpySrcPitch << 16) | dstPitch); + return TRUE; +} + +static void +amd_gx_exa_Copy(PixmapPtr pxDst, int srcX, int srcY, int dstX, int dstY, + int w, int h) +{ + GeodeRec *pGeode = GEODEPTR_FROM_PIXMAP(pxDst); + int dstBpp = (pxDst->drawable.bitsPerPixel + 7) / 8; + int dstPitch = exaGetPixmapPitch(pxDst); + unsigned int srcOffset = + pGeode->cpySrcOffset + (pGeode->cpySrcPitch * srcY) + + (pGeode->cpySrcBpp * srcX); + unsigned int dstOffset = + exaGetPixmapOffset(pxDst) + (dstPitch * dstY) + (dstBpp * dstX); + unsigned int size = (w << 16) | h; + unsigned int blt_mode = BLT_MODE; + + //ErrorF("amd_gx_exa_Copy() from %d,%d to %d,%d %dx%d\n", srcX, srcY, + // dstX, dstY, w, h); + + if (pGeode->cpyDx < 0) { + srcOffset += w * pGeode->cpySrcBpp - 1; + dstOffset += w * dstBpp - 1; + blt_mode |= MGP_BM_NEG_XDIR; + } + if (pGeode->cpyDy < 0) { + srcOffset += (h - 1) * pGeode->cpySrcPitch; + dstOffset += (h - 1) * dstPitch; + blt_mode |= MGP_BM_NEG_YDIR; + } + GU2_WAIT_PENDING; + WRITE_GP32(MGP_SRC_OFFSET, srcOffset); + WRITE_GP32(MGP_DST_OFFSET, dstOffset); + WRITE_GP32(MGP_WID_HEIGHT, size); + WRITE_GP16(MGP_BLT_MODE, blt_mode); +} + +/* A=SRC, B=DST */ +#define SRC_DST 0 +/* B=SRC, A=DST */ +#define DST_SRC MGP_RM_DEST_FROM_CHAN_A +/* A*alpha + B*0 */ +#define Aa_B0 MGP_RM_ALPHA_TIMES_A +/* A*0 + B*(1-alpha) */ +#define A0_B1a MGP_RM_BETA_TIMES_B +/* A*1 + B*(1-alpha) */ +#define A1_B1a MGP_RM_A_PLUS_BETA_B +/* A*alpha + B*(1-alpha) */ +#define Aa_B1a MGP_RM_ALPHA_A_PLUS_BETA_B +/* alpha from A */ +#define a_A MGP_RM_SELECT_ALPHA_A +/* alpha from B */ +#define a_B MGP_RM_SELECT_ALPHA_B +/* alpha from const */ +#define a_C MGP_RM_SELECT_ALPHA_R +/* alpha = 1 */ +#define a_1 MGP_RM_SELECT_ALPHA_1 + +#define MGP_RM_ALPHA_TO_ARGB (MGP_RM_ALPHA_TO_ALPHA | MGP_RM_ALPHA_TO_RGB) +#define gxPictOpMAX PictOpAdd /* highest accelerated op */ + +unsigned int amd_gx_exa_alpha_ops[] = +/* A B OP AS const = 0 */ +{ + (SRC_DST | Aa_B0 | a_C), 0, /* clear (src*0) */ + (SRC_DST | Aa_B0 | a_1), 0, /* src (src*1) */ + (DST_SRC | Aa_B0 | a_1), 0, /* dst (dst*1) */ + (SRC_DST | A1_B1a | a_A), 0, /* src-over (src*1 + dst(1-A)) */ + (DST_SRC | A1_B1a | a_A), 0, /* dst-over (dst*1 + src(1-B)) */ + (SRC_DST | Aa_B0 | a_B), 0, /* src-in (src*B) */ + (DST_SRC | Aa_B0 | a_B), 0, /* dst-in (dst*A) */ + (DST_SRC | A0_B1a | a_A), 0, /* src-out (src*(1-B)) */ + (SRC_DST | A0_B1a | a_A), 0, /* dst-out (dst*(1-A)) */ +/* pass1 (SRC=dst DST=scr=src), pass2 (SRC=src, DST=dst) */ + (DST_SRC | Aa_B0 | a_B), /* srcatop (src*B) */ + (SRC_DST | A0_B1a | a_A), /* + (dst(1-A)) */ + (SRC_DST | Aa_B0 | a_B), /* dstatop (dst*A) */ + (DST_SRC | A0_B1a | a_A), /* + (src(1-B) */ + (SRC_DST | A0_B1a | a_A), /* xor (src*(1-B) */ + (SRC_DST | A0_B1a | a_A), /* + (dst(1-A) */ + (SRC_DST | A1_B1a | a_C), 0, /* add (src*1 + dst*1) */ +}; + +typedef struct +{ + int exa_fmt; + int bpp; + int gx_fmt; + int alpha_bits; +} amd_gx_exa_fmt_t; + +amd_gx_exa_fmt_t amd_gx_exa_fmts[] = { + {PICT_a8r8g8b8, 32, MGP_RM_BPPFMT_8888, 8}, + {PICT_x8r8g8b8, 32, MGP_RM_BPPFMT_8888, 0}, + {PICT_a4r4g4b4, 16, MGP_RM_BPPFMT_4444, 4}, + {PICT_a1r5g5b5, 16, MGP_RM_BPPFMT_1555, 1}, + {PICT_r5g6b5, 16, MGP_RM_BPPFMT_565, 0}, + {PICT_r3g3b2, 8, MGP_RM_BPPFMT_332, 0}, +}; + +static amd_gx_exa_fmt_t * +amd_gx_exa_check_format(PicturePtr p) +{ + int i; + int bpp = p->pDrawable ? p->pDrawable->bitsPerPixel : 0; + amd_gx_exa_fmt_t *fp = &amd_gx_exa_fmts[0]; + + for (i = sizeof(amd_gx_exa_fmts) / sizeof(amd_gx_exa_fmts[0]); --i >= 0; + ++fp) { + if (fp->bpp < bpp) + return NULL; + if (fp->bpp != bpp) + continue; + if (fp->exa_fmt == p->format) + break; + } + return i < 0 ? NULL : fp; +} + +/* Composite */ + +static Bool +amd_gx_exa_CheckComposite(int op, PicturePtr pSrc, PicturePtr pMsk, + PicturePtr pDst) +{ + GeodeRec *pGeode = GEODEPTR_FROM_PICTURE(pDst); + + if (op > gxPictOpMAX) + return FALSE; + if (pMsk) + return FALSE; + if (usesPasses(op) && pGeode->exaBfrSz == 0) + return FALSE; + if (pSrc->filter != PictFilterNearest && + pSrc->filter != PictFilterFast && + pSrc->filter != PictFilterGood && pSrc->filter != PictFilterBest) + return FALSE; + if (pSrc->repeat) + return FALSE; + if (pSrc->transform) + return FALSE; + return TRUE; +} + +static Bool +amd_gx_exa_PrepareComposite(int op, PicturePtr pSrc, PicturePtr pMsk, + PicturePtr pDst, PixmapPtr pxSrc, PixmapPtr pxMsk, PixmapPtr pxDst) +{ + int srcPitch; + + GeodeRec *pGeode = GEODEPTR_FROM_PIXMAP(pxDst); + amd_gx_exa_fmt_t *sfp, *dfp; + + //ErrorF("amd_gx_exa_PrepareComposite()\n"); + + if ((sfp = amd_gx_exa_check_format(pSrc)) == NULL) + return FALSE; + if (sfp->alpha_bits == 0 && usesSrcAlpha(op)) + return FALSE; + if ((dfp = amd_gx_exa_check_format(pDst)) == NULL) + return FALSE; + if (dfp->alpha_bits == 0 && usesDstAlpha(op)) + return FALSE; + if (sfp->gx_fmt != dfp->gx_fmt) + return FALSE; + srcPitch = exaGetPixmapPitch(pxSrc); + if (usesPasses(op) && srcPitch > pGeode->exaBfrSz) + return FALSE; + pGeode->cmpSrcPitch = srcPitch; + pGeode->cmpOp = op; + pGeode->cmpSrcOffset = exaGetPixmapOffset(pxSrc); + pGeode->cmpSrcBpp = (pxSrc->drawable.bitsPerPixel + 7) / 8; + pGeode->cmpSrcFmt = sfp->gx_fmt; + pGeode->cmpDstFmt = dfp->gx_fmt | (dfp->alpha_bits == 0 ? + MGP_RM_ALPHA_TO_RGB : MGP_RM_ALPHA_TO_ARGB); + return TRUE; +} + +static void +amd_gx_exa_Composite(PixmapPtr pxDst, int srcX, int srcY, int maskX, + int maskY, int dstX, int dstY, int width, int height) +{ + int op, current_line, max_lines, lines, pass, scratchPitch; + unsigned int srcOffset, srcOfs=0, srcPitch, srcPch=0, srcBpp; + unsigned int dstOffset, dstOfs=0, dstPitch, dstPch=0, dstBpp; + unsigned int sizes, strides, blt_mode = 0, rop = 0; + GeodeRec *pGeode = GEODEPTR_FROM_PIXMAP(pxDst); + + //ErrorF("amd_gx_exa_Composite() from %d,%d to %d,%d %dx%d\n", + // srcX, srcY, dstX, dstY, width, height); + + op = pGeode->cmpOp; + if (usesPasses(op)) { + int cacheLineSz = 32; + int cachelines = + (width * pGeode->cmpSrcBpp + cacheLineSz - 1) / cacheLineSz; + scratchPitch = cachelines * cacheLineSz; + if (scratchPitch > pGeode->cmpSrcPitch) + scratchPitch = pGeode->cmpSrcPitch; + max_lines = pGeode->exaBfrSz / scratchPitch; + } else { + scratchPitch = 0; + max_lines = height; + } + + dstBpp = (pxDst->drawable.bitsPerPixel + 7) / 8; + dstPitch = exaGetPixmapPitch(pxDst); + dstOffset = exaGetPixmapOffset(pxDst) + dstPitch * dstY + dstBpp * dstX; + srcBpp = pGeode->cmpSrcBpp; + srcPitch = pGeode->cmpSrcPitch; + srcOffset = pGeode->cmpSrcOffset + srcPitch * srcY + srcBpp * srcX; + + current_line = pass = 0; + while (current_line < height) { + if (usesPasses(op)) { + lines = height - current_line; + if (lines > max_lines) + lines = max_lines; + switch (pass) { + case 0: /* copy src to scratch */ + srcPch = srcPitch; + srcOfs = srcOffset + current_line * srcPch; + dstPch = scratchPitch; + dstOfs = pGeode->exaBfrOffset; + rop = pGeode->cmpSrcFmt | MGP_RM_ALPHA_TO_ARGB; + rop |= amd_gx_exa_alpha_ops[PictOpSrc * 2]; + blt_mode = usesChanB0(PictOpSrc) ? + MGP_BM_SRC_FB | MGP_BM_DST_REQ : MGP_BM_SRC_FB; + ++pass; + break; + case 1: /* pass1 */ + srcPch = dstPitch; + srcOfs = dstOffset + current_line * srcPch; + dstPch = scratchPitch; + dstOfs = pGeode->exaBfrOffset; + rop = pGeode->cmpSrcFmt | MGP_RM_ALPHA_TO_ARGB; + rop |= amd_gx_exa_alpha_ops[op * 2]; + blt_mode = usesChanB1(op) ? + MGP_BM_SRC_FB | MGP_BM_DST_REQ : MGP_BM_SRC_FB; + ++pass; + break; + case 2: /* pass2 */ + srcPch = srcPitch; + srcOfs = srcOffset + current_line * srcPch; + dstPch = dstPitch; + dstOfs = dstOffset + current_line * dstPch; + rop = pGeode->cmpSrcFmt | MGP_RM_ALPHA_TO_ARGB; + rop |= amd_gx_exa_alpha_ops[op * 2 + 1]; + blt_mode = usesChanB2(op) ? + MGP_BM_SRC_FB | MGP_BM_DST_REQ : MGP_BM_SRC_FB; + ++pass; + break; + case 3: /* add */ + srcPch = scratchPitch; + srcOfs = pGeode->exaBfrOffset; + dstPch = dstPitch; + dstOfs = dstOffset + current_line * dstPch; + rop = pGeode->cmpDstFmt; + rop |= amd_gx_exa_alpha_ops[PictOpAdd * 2]; + blt_mode = usesChanB0(PictOpAdd) ? + MGP_BM_SRC_FB | MGP_BM_DST_REQ : MGP_BM_SRC_FB; + current_line += lines; + pass = 0; + break; + } + strides = (srcPch << 16) | dstPch; + } else { /* not multi pass */ + srcOfs = srcOffset; + dstOfs = dstOffset; + current_line = lines = height; + strides = (srcPitch << 16) | dstPitch; + rop = pGeode->cmpDstFmt | amd_gx_exa_alpha_ops[op * 2]; + blt_mode = usesChanB0(op) ? + MGP_BM_SRC_FB | MGP_BM_DST_REQ : MGP_BM_SRC_FB; + } + sizes = (width << 16) | lines; + if (srcOfs < dstOfs) { + srcOfs += (lines - 1) * srcPitch + width * srcBpp - 1; + dstOfs += (lines - 1) * dstPitch + width * dstBpp - 1; + blt_mode |= MGP_BM_NEG_XDIR | MGP_BM_NEG_YDIR; + } + GU2_WAIT_PENDING; + WRITE_GP32(MGP_RASTER_MODE, rop); + WRITE_GP32(MGP_SRC_OFFSET, srcOfs); + WRITE_GP32(MGP_DST_OFFSET, dstOfs); + WRITE_GP32(MGP_WID_HEIGHT, sizes); + WRITE_GP32(MGP_STRIDE, strides); + WRITE_GP16(MGP_BLT_MODE, blt_mode); + } +} +#endif /* #if XF86EXA */ + +/*---------------------------------------------------------------------------- + * GXAccelInit. + * + * Description: This function sets up the supported acceleration routines and + * appropriate flags. + * + * Parameters: + * pScrn: Screeen pointer structure. + * + * Returns: TRUE on success and FALSE on Failure + * + * Comments: This function is called in GXScreenInit in + * geode_driver.c to set * the acceleration. + *---------------------------------------------------------------------------- + */ +Bool +GXAccelInit(ScreenPtr pScrn) +{ + ScrnInfoPtr pScrni = xf86Screens[pScrn->myNum]; + GeodeRec *pGeode = GEODEPTR(pScrni); + +#if XF86EXA + ExaDriverPtr pExa = pGeode->pExa; +#endif + + gu2_xshift = pScrni->bitsPerPixel >> 4; + + /* XXX - fixme - this will change - we'll need to update it */ + + gu2_pitch = pGeode->Pitch; + + switch (pGeode->Pitch) { + case 1024: + gu2_yshift = 10; + break; + case 2048: + gu2_yshift = 11; + break; + case 4096: + gu2_yshift = 12; + break; + default: + gu2_yshift = 13; + break; + } + +#ifdef OPT_ACCEL + ACCEL_STRIDE = (pGeode->Pitch << 16) | pGeode->Pitch; + BPP = amd_gx_BppToRasterMode(pScrni->bitsPerPixel); +#endif + +#if XF86EXA + if (pExa && pGeode->useEXA) { + pExa->exa_major = EXA_VERSION_MAJOR; + pExa->exa_minor = EXA_VERSION_MINOR; + + /* Sync */ + pExa->WaitMarker = amd_gx_exa_WaitMarker; + /* UploadToScreen */ + pExa->UploadToScreen = amd_gx_exa_UploadToScreen; + pExa->DownloadFromScreen = amd_gx_exa_DownloadFromScreen; + + /* Solid fill */ + pExa->PrepareSolid = amd_gx_exa_PrepareSolid; + pExa->Solid = amd_gx_exa_Solid; + pExa->DoneSolid = amd_gx_exa_Done; + + /* Copy */ + pExa->PrepareCopy = amd_gx_exa_PrepareCopy; + pExa->Copy = amd_gx_exa_Copy; + pExa->DoneCopy = amd_gx_exa_Done; + + /* Composite */ + pExa->CheckComposite = amd_gx_exa_CheckComposite; + pExa->PrepareComposite = amd_gx_exa_PrepareComposite; + pExa->Composite = amd_gx_exa_Composite; + pExa->DoneComposite = amd_gx_exa_Done; + + return exaDriverInit(pScrn, pGeode->pExa); + } +#endif + + /* Getting the pointer for acceleration Inforecord */ + pGeode->AccelInfoRec = localRecPtr = XAACreateInfoRec(); + if (!pGeode->AccelInfoRec) + return FALSE; + + /* SET ACCELERATION FLAGS */ + localRecPtr->Flags = + PIXMAP_CACHE | OFFSCREEN_PIXMAPS | LINEAR_FRAMEBUFFER; + + /* HOOK SYNCRONIZARION ROUTINE */ + localRecPtr->Sync = GXAccelSync; + +#if GX_FILL_RECT_SUPPORT + /* HOOK FILLED RECTANGLES */ + HOOK(SetupForSolidFill); + HOOK(SubsequentSolidFillRect); + localRecPtr->SolidFillFlags = 0; +#endif + +#if GX_MONO_8X8_PAT_SUPPORT + /* Color expansion */ + HOOK(SetupForMono8x8PatternFill); + HOOK(SubsequentMono8x8PatternFillRect); +/* BIT_ORDER_IN_BYTE_MSBFIRST | SCANLINE_PAD_DWORD | NO_TRANSPARENCY | */ + localRecPtr->Mono8x8PatternFillFlags = BIT_ORDER_IN_BYTE_MSBFIRST | + HARDWARE_PATTERN_PROGRAMMED_BITS | HARDWARE_PATTERN_SCREEN_ORIGIN; +#endif + +#if GX_CLREXP_8X8_PAT_SUPPORT + /* Color expansion */ + HOOK(SetupForColor8x8PatternFill); + HOOK(SubsequentColor8x8PatternFillRect); +/* BIT_ORDER_IN_BYTE_MSBFIRST | SCANLINE_PAD_DWORD | NO_TRANSPARENCY | */ + localRecPtr->Color8x8PatternFillFlags = + BIT_ORDER_IN_BYTE_MSBFIRST | SCANLINE_PAD_DWORD | + HARDWARE_PATTERN_PROGRAMMED_BITS | HARDWARE_PATTERN_PROGRAMMED_ORIGIN; +#endif + +#if GX_SCR2SCRCPY_SUPPORT + /* HOOK SCREEN TO SCREEN COPIES + * Set flag to only allow copy if transparency is enabled. + */ + HOOK(SetupForScreenToScreenCopy); + HOOK(SubsequentScreenToScreenCopy); + localRecPtr->ScreenToScreenCopyFlags = + BIT_ORDER_IN_BYTE_MSBFIRST | SCANLINE_PAD_DWORD; +#endif + +#if GX_BRES_LINE_SUPPORT + /* HOOK BRESENHAM SOLID LINES */ + localRecPtr->SolidLineFlags = NO_PLANEMASK; + HOOK(SetupForSolidLine); + HOOK(SubsequentSolidBresenhamLine); + HOOK(SubsequentSolidHorVertLine); + HOOK(SubsequentSolidTwoPointLine); + localRecPtr->SolidBresenhamLineErrorTermBits = 15; +#endif + +#if GX_DASH_LINE_SUPPORT + /* HOOK BRESENHAM DASHED LINES */ + HOOK(SetupForDashedLine); + HOOK(SubsequentDashedBresenhamLine); + HOOK(SubsequentDashedTwoPointLine); + localRecPtr->DashedBresenhamLineErrorTermBits = 15; + localRecPtr->DashPatternMaxLength = 64; + localRecPtr->DashedLineFlags = NO_PLANEMASK | /* TRANSPARENCY_ONLY | */ + LINE_PATTERN_POWER_OF_2_ONLY | LINE_PATTERN_MSBFIRST_MSBJUSTIFIED; +#endif + +#if GX_SCR2SCREXP_SUPPORT + /* Color expansion */ + HOOK(SetupForScreenToScreenColorExpandFill); + HOOK(SubsequentScreenToScreenColorExpandFill); + localRecPtr->ScreenToScreenColorExpandFillFlags = + BIT_ORDER_IN_BYTE_MSBFIRST | SCANLINE_PAD_DWORD | NO_TRANSPARENCY; +#endif + + if (pGeode->AccelImageWriteBuffers) { +#if GX_SCANLINE_SUPPORT + localRecPtr->ScanlineImageWriteBuffers = + pGeode->AccelImageWriteBuffers; + localRecPtr->NumScanlineImageWriteBuffers = pGeode->NoOfImgBuffers; + HOOK(SetupForScanlineImageWrite); + HOOK(SubsequentScanlineImageWriteRect); + HOOK(SubsequentImageWriteScanline); + localRecPtr->ScanlineImageWriteFlags = NO_PLANEMASK | NO_GXCOPY | + BIT_ORDER_IN_BYTE_MSBFIRST | SCANLINE_PAD_DWORD; +#endif + + } else { + localRecPtr->PixmapCacheFlags = DO_NOT_BLIT_STIPPLES; + } + + if (pGeode->AccelColorExpandBuffers) { +#if GX_CPU2SCREXP_SUPPORT + /* Color expansion */ + localRecPtr->ScanlineColorExpandBuffers = + pGeode->AccelColorExpandBuffers; + localRecPtr->NumScanlineColorExpandBuffers = + pGeode->NoOfColorExpandLines; + HOOK(SetupForScanlineCPUToScreenColorExpandFill); + HOOK(SubsequentScanlineCPUToScreenColorExpandFill); + HOOK(SubsequentColorExpandScanline); + localRecPtr->ScanlineCPUToScreenColorExpandFillFlags = NO_PLANEMASK | + BIT_ORDER_IN_BYTE_MSBFIRST | SCANLINE_PAD_DWORD; +#endif + } +#if GX_WRITE_PIXMAP_SUPPORT + pGeode->WritePixmap = localRecPtr->WritePixmap; + HOOK(WritePixmap); +#endif + + return (XAAInit(pScrn, localRecPtr)); +} + +/* END OF FILE */ diff --git a/driver/xf86-video-geode/src/gx_cursor.c b/driver/xf86-video-geode/src/gx_cursor.c new file mode 100644 index 000000000..9221dfaab --- /dev/null +++ b/driver/xf86-video-geode/src/gx_cursor.c @@ -0,0 +1,337 @@ +/* Copyright (c) 2003-2006 Advanced Micro Devices, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + * + * Neither the name of the Advanced Micro Devices, Inc. nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * */ + +/* + * File Contents: Xfree cursor implementation routines for geode HWcursor + * init.setting cursor color,image etc. are done here. + * + * Project: Geode Xfree Frame buffer device driver. + * */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "xf86.h" +#include "xf86_OSproc.h" +#include "xf86Pci.h" +#include "xf86PciInfo.h" +#include "geode.h" + +/* Forward declarations of the functions */ +static void GXSetCursorColors(ScrnInfoPtr pScrni, int bg, int fg); +static void GXSetCursorPosition(ScrnInfoPtr pScrni, int x, int y); +static Bool GXUseHWCursor(ScreenPtr pScrn, CursorPtr pCurs); +extern void GXSetVideoPosition(int x, int y, int width, int height, + short src_w, short src_h, short drw_w, + short drw_h, int id, int offset, ScrnInfoPtr pScrn); + +/*---------------------------------------------------------------------------- + * GXHWCursorInit. + * + * Description :This function sets the cursor information by probing the + * hardware. + * + * Parameters. + * pScrn :Screeen pointer structure. + * + * Returns :TRUE on success and FALSE on Failure + * + * Comments :Geode supports the hardware_cursor,no need to enable SW + * cursor. + *---------------------------------------------------------------------------- + */ +Bool +GXHWCursorInit(ScreenPtr pScrn) +{ + ScrnInfoPtr pScrni = xf86Screens[pScrn->myNum]; + GeodeRec *pGeode = GEODEPTR(pScrni); + xf86CursorInfoPtr infoPtr; + + infoPtr = xf86CreateCursorInfoRec(); + if (!infoPtr) + return FALSE; + /* the geode structure is intiallized with the cursor infoRec */ + pGeode->CursorInfo = infoPtr; + infoPtr->MaxWidth = 32; + infoPtr->MaxHeight = 32; + /* seeting up the cursor flags */ + infoPtr->Flags = HARDWARE_CURSOR_BIT_ORDER_MSBFIRST | + HARDWARE_CURSOR_TRUECOLOR_AT_8BPP | + HARDWARE_CURSOR_SOURCE_MASK_NOT_INTERLEAVED; + /* cursor info ptr is intiallized with the values obtained from + * * durnago calls + */ + infoPtr->SetCursorColors = GXSetCursorColors; + infoPtr->SetCursorPosition = GXSetCursorPosition; + infoPtr->LoadCursorImage = GXLoadCursorImage; + infoPtr->HideCursor = GXHideCursor; + infoPtr->ShowCursor = GXShowCursor; + infoPtr->UseHWCursor = GXUseHWCursor; + return (xf86InitCursor(pScrn, infoPtr)); +} + +/*---------------------------------------------------------------------------- + * GXSetCursorColors. + * + * Description :This function sets the cursor foreground and background + * colors + * Parameters: + * pScrn: Screeen pointer structure. + * bg: Specifies the color value of cursor background color. + * fg: Specifies the color value of cursor foreground color. + * + * Returns: none. + * + * Comments: The integer color value passed by this function is + * converted into * RGB value by the gfx_set_color routines. + *---------------------------------------------------------------------------- + */ +static void +GXSetCursorColors(ScrnInfoPtr pScrni, int bg, int fg) +{ + GFX(set_cursor_colors(bg, fg)); +} + +/*---------------------------------------------------------------------------- + * GXSetCursorPosition. + * + * Description :This function sets the cursor co -ordinates and enable the + * cursor. + * + * Parameters: + * pScrn: Screeen pointer structure. + * x: Specifies the x-cordinates of the cursor. + * y: Specifies the y co-ordinate of the cursor. + * + * Returns: none. + * + *---------------------------------------------------------------------------- + */ +static void +GXSetCursorPosition(ScrnInfoPtr pScrni, int x, int y) +{ + static unsigned long panOffset = 0; + GeodeRec *pGeode = GEODEPTR(pScrni); + int savex, savey; + int newX, newY; + + /* Adjust xf86HWCursor messing about */ + + savex = x + pScrni->frameX0; + savey = y + pScrni->frameY0; + + switch (pGeode->rotation) { + default: + ErrorF("%s:%d invalid rotation %d\n", __func__, __LINE__, + pGeode->rotation); + case RR_Rotate_0: + newX = savex; + newY = savey; + break; + + case RR_Rotate_90: + newX = savey; + newY = pScrni->pScreen->width - savex; + break; + + case RR_Rotate_180: + newX = pScrni->pScreen->width - savex; + newY = pScrni->pScreen->height - savey; + break; + + case RR_Rotate_270: + newX = pScrni->pScreen->height - savey; + newY = savex; + break; + } + + newX += pScrni->frameX0; + newY += pScrni->frameY0; + + //ErrorF("Turned (%d,%d) into (%d,%d)\n", x,y,newX, newY); + + if (newX < -31) + newX = -31; + if (newY < -31) + newY = -31; + + gfx_set_cursor_position(pGeode->CursorStartOffset, newX + 31, newY + 31, + 31, 31); + gfx_set_cursor_enable(1); + + if ((pGeode->OverlayON) && (pGeode->Panel)) { + pGeode->PrevDisplayOffset = gfx_get_display_offset(); + if (pGeode->PrevDisplayOffset != panOffset) { + GXSetVideoPosition(pGeode->video_x, pGeode->video_y, + pGeode->video_w, pGeode->video_h, + pGeode->video_srcw, pGeode->video_srch, + pGeode->video_dstw, pGeode->video_dsth, + pGeode->video_id, pGeode->video_offset, + pGeode->video_scrnptr); + panOffset = pGeode->PrevDisplayOffset; + } + } +} + +/*---------------------------------------------------------------------------- + * GXLoadCursorImage + * + * Description: This function loads the 32x32 cursor pattern.The shape + * and color is set by AND and XOR masking of arrays of 32 + * DWORD. + * Parameters: + * pScrn: Screeen pointer structure. + * src: Specifies cursor data. + * + * Returns: none + * + *---------------------------------------------------------------------------- + */ +void +GXLoadCursorImage(ScrnInfoPtr pScrni, unsigned char *src) +{ + int i, n, x, y, newX, newY; + unsigned long andMask[32], xorMask[32]; + GeodeRec *pGeode = GEODEPTR(pScrni); + unsigned long mskb, rowb; + unsigned char *rowp = &src[0]; + unsigned char *mskp = &src[128]; + + if (src != NULL) { + mskb = rowb = 0; + for (y = 32; --y >= 0;) + andMask[y] = xorMask[y] = 0; + for (y = 0; y < 32; ++y) { + for (x = 0; x < 32; ++x) { + if ((i = x & 7) == 0) { + rowb = (*rowp & *mskp); + mskb = ~(*mskp); + ++rowp; + ++mskp; + } + + switch (pGeode->rotation) { + default: + ErrorF("%s:%d invalid rotation %d\n", __func__, __LINE__, + pGeode->rotation); + case RR_Rotate_0: + newX = x; + newY = y; + break; + case RR_Rotate_90: + newX = y; + newY = 31 - x; + break; + case RR_Rotate_180: + newX = 31 - x; + newY = 31 - y; + break; + case RR_Rotate_270: + newX = 31 - y; + newY = x; + break; + } + + i = 7 - i; + n = 31 - newX; + andMask[newY] |= (((mskb >> i) & 1) << n); + xorMask[newY] |= (((rowb >> i) & 1) << n); + } + } + } else { + for (y = 32; --y >= 0;) { + andMask[y] = ~0; + xorMask[y] = 0; + } + } + + gfx_set_cursor_shape32(pGeode->CursorStartOffset, &andMask[0], + &xorMask[0]); +} + +/*---------------------------------------------------------------------------- + * GXHideCursor. + * + * Description: This function will disable the cursor. + * + * Parameters: + * pScrn: Handles to the Screeen pointer structure. + * + * Returns: none. + * + * Comments: gfx_set_cursor enable function is hardcoded to disable + * the cursor. + *---------------------------------------------------------------------------- + */ +void +GXHideCursor(ScrnInfoPtr pScrni) +{ + gfx_set_cursor_enable(0); +} + +/*---------------------------------------------------------------------------- + * GXShowCursor + * + * Description :This function will enable the cursor. + * + * Parameters: + * pScrn :Handles to the Screeen pointer structure. + * + * Returns :none + * + * Comments :gfx_set_cursor enable function is hardcoded to enable the + * cursor + *---------------------------------------------------------------------------- + */ +void +GXShowCursor(ScrnInfoPtr pScrni) +{ + GFX(set_cursor_enable(1)); +} + +/*---------------------------------------------------------------------------- + * GXUseHwCursor. + * + * Description :This function will sets the hardware cursor flag in + * pscreen structure. + * + * Parameters. + * pScrn :Handles to the Screeen pointer structure. + * + * Returns :none + * + * Comments :none + * + *---------------------------------------------------------------------------- + */ +static Bool +GXUseHWCursor(ScreenPtr pScrn, CursorPtr pCurs) +{ + ScrnInfoPtr pScrni = XF86SCRNINFO(pScrn); + GeodeRec *pGeode = GEODEPTR(pScrni); + + return pGeode->HWCursor; +} diff --git a/driver/xf86-video-geode/src/gx_driver.c b/driver/xf86-video-geode/src/gx_driver.c new file mode 100644 index 000000000..928a59a05 --- /dev/null +++ b/driver/xf86-video-geode/src/gx_driver.c @@ -0,0 +1,1596 @@ +/* Copyright (c) 2003-2006 Advanced Micro Devices, Inc. + * + * Portioned modeled from xf86-video-intel/src/i830_driver.c + * Copyright 2001 VA Linux Systems Inc., Fremont, California. + * Copyright \ufffd 2002 by David Dawes + + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + * + * Neither the name of the Advanced Micro Devices, Inc. nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include + +#include "xf86.h" +#include "xf86_OSproc.h" +#include "xf86Resources.h" +#include "xf86cmap.h" +#include "compiler.h" +#include "mipointer.h" +#include "shadow.h" +#include +#include "fb.h" +#include "miscstruct.h" +#include "micmap.h" +#include "vbe.h" +#include "fb.h" +#include "randrstr.h" + +#include "geode.h" +#include "gfx_defs.h" +#include "gfx_regs.h" +#include "panel.h" + +/* Bring in VGA functions */ +#include "gx_vga.c" + +#define GX_MIN_PITCH 1024 +#define GX_MAX_PITCH 8192 +#define GX_MAX_WIDTH 1600 +#define GX_MIN_HEIGHT 400 +#define GX_MAX_HEIGHT 1200 +#define GX_CB_PITCH 544 +#define GX_CB_SIZE 544 + +#define GX_CPU_REG_SIZE 0x4000 +#define GX_GP_REG_SIZE 0x4000 +#define GX_VID_REG_SIZE 0x4000 + +extern OptionInfoRec GX_GeodeOptions[]; + +extern const char *amdVgahwSymbols[]; +extern const char *amdVbeSymbols[]; +extern const char *amdInt10Symbols[]; +extern const char *amdFbSymbols[]; +extern const char *amdXaaSymbols[]; +extern const char *amdExaSymbols[]; +extern const char *amdRamdacSymbols[]; + +unsigned char *XpressROMPtr; + +static inline void +gx_enable_dac_power(void) +{ + gfx_write_vid32(RCDF_VID_MISC, + gfx_read_vid32(RCDF_VID_MISC) & RCDF_GAMMA_BYPASS_BOTH); +} + +static inline void +gx_disable_dac_power(void) +{ + gfx_write_vid32(RCDF_VID_MISC, + RCDF_DAC_POWER_DOWN | RCDF_ANALOG_POWER_DOWN | + (gfx_read_vid32(RCDF_VID_MISC) & RCDF_GAMMA_BYPASS_BOTH)); +} + +static void +GXInitEXAMemory(ScrnInfoPtr pScrni, unsigned int *offset, unsigned int *avail) +{ + GeodePtr pGeode = GEODEPTR(pScrni); + + if (pGeode->exaBfrSz > 0 && pGeode->exaBfrSz <= *avail) { + pGeode->exaBfrOffset = *offset; + *offset += pGeode->exaBfrOffset; + *avail -= pGeode->exaBfrOffset; + } +} + +static void +GXInitXAAMemory(ScrnInfoPtr pScrni, unsigned int *offset, unsigned int *avail) +{ + GeodePtr pGeode = GEODEPTR(pScrni); + unsigned int size, i, pitch; + + /* XXX - FIXME - What if we are out of room? Then what? */ + /* For now, we NULL them all out. */ + + if (pGeode->NoOfImgBuffers > 0) { + size = pGeode->displayPitch * pGeode->NoOfImgBuffers; + if (size <= *avail) { + for (i = 0; i < pGeode->NoOfImgBuffers; i++) { + pGeode->AccelImageWriteBuffers[i] = pGeode->FBBase + *offset; + *offset += pGeode->displayPitch; + *avail -= pGeode->displayPitch; + } + } else { + xf86DrvMsg(pScrni->scrnIndex, X_ERROR, + "Not enough memory for image write buffers.\n"); + + for (i = 0; i < pGeode->NoOfImgBuffers; i++) + pGeode->AccelImageWriteBuffers[i] = NULL; + } + } + + if (pGeode->NoOfColorExpandLines > 0) { + pitch = ((pGeode->displayPitch + 31) >> 5) << 2; + size = pitch * pGeode->NoOfColorExpandLines; + + if (size <= *avail) { + for (i = 0; i < pGeode->NoOfColorExpandLines; i++) { + pGeode->AccelColorExpandBuffers[i] = pGeode->FBBase + *offset; + *offset += pitch; + *avail -= pitch; + } + } else { + xf86DrvMsg(pScrni->scrnIndex, X_ERROR, + "Not enough memory for color expansion buffers.\n"); + + for (i = 0; i < pGeode->NoOfImgBuffers; i++) + pGeode->AccelColorExpandBuffers[i] = NULL; + } + } +} + +static Bool +GXAllocateMemory(ScreenPtr pScrn, ScrnInfoPtr pScrni, int rotate) +{ + GeodePtr pGeode = GEODEPTR(pScrni); + + unsigned int fboffset, fbavail; + unsigned int size; + unsigned int bytpp = (pScrni->bitsPerPixel + 7) / 8; + BOOL ret = TRUE; + + if (pGeode->tryCompression) + pGeode->displayPitch = + GeodeCalculatePitchBytes(pScrni->virtualX, pScrni->bitsPerPixel); + else + pGeode->displayPitch = + ((pScrni->virtualX + 3) & ~3) * (pScrni->bitsPerPixel >> 3); + + pGeode->Pitch = pGeode->displayPitch; + pGeode->displayWidth = pGeode->displayPitch / bytpp; + pScrni->displayWidth = pGeode->displayWidth; + + fbavail = pGeode->FBAvail - 0x4000; + + pGeode->displayOffset = fboffset = 0; + pGeode->displaySize = pScrni->virtualY * pGeode->displayPitch; + + fbavail -= pGeode->displaySize; + fboffset += pGeode->displaySize; + + if (pGeode->tryCompression) { + size = pScrni->virtualY * GX_CB_PITCH; + + if (size <= fbavail) { + pGeode->CBData.compression_offset = fboffset; + + fboffset += size; + fbavail -= size; + + pGeode->Compression = TRUE; + } else { + xf86DrvMsg(pScrni->scrnIndex, X_ERROR, + "Not enough memory for compression\n"); + pGeode->Compression = FALSE; + } + } + + if (pGeode->tryHWCursor) { + pGeode->CursorSize = 1024; + + if (pGeode->CursorSize <= fbavail) { + pGeode->CursorStartOffset = fboffset; + fboffset += pGeode->CursorSize; + fbavail -= pGeode->CursorSize; + pGeode->HWCursor = TRUE; + } else { + xf86DrvMsg(pScrni->scrnIndex, X_ERROR, + "Not enough memory for the hardware cursor\n"); + pGeode->HWCursor = FALSE; + } + } + + if (!pGeode->NoAccel) { + if (pGeode->useEXA) + GXInitEXAMemory(pScrni, &fboffset, &fbavail); + else + GXInitXAAMemory(pScrni, &fboffset, &fbavail); + } + + pGeode->shadowSize = 0; + + if (rotate != RR_Rotate_0) { + if (rotate & (RR_Rotate_90 | RR_Rotate_270)) + size = pGeode->displayPitch * pScrni->virtualX; + else + size = pGeode->displayPitch * pScrni->virtualY; + + if (size <= fbavail) { + pGeode->shadowOffset = fboffset; + pGeode->shadowSize = size; + + fboffset += size; + fbavail -= size; + } else { + xf86DrvMsg(pScrni->scrnIndex, X_ERROR, + "Not enough memory for the shadow framebuffer\n"); + ret = FALSE; + } + } + + /* XAA always exists - we can't remove it on demand like we can with EXA. + * So we assume the worse, and only give XAA enough offspace room to + * account for any eventuality that RandR might throw at us. */ + + if (!pGeode->NoAccel) { + + if (pGeode->useEXA && pGeode->pExa) { + ExaDriverPtr pExa = pGeode->pExa; + + pExa->offScreenBase = fboffset; + pExa->memorySize = fboffset + fbavail; + } + + if (!pGeode->useEXA) { + + if (!xf86FBManagerRunning(pScrn)) { + + unsigned int offset = fboffset; + unsigned int avail = fbavail; + RegionRec OffscreenRegion; + BoxRec AvailBox; + + /* Assume the shadow FB exists even if it doesnt */ + + if (pGeode->shadowSize == 0) { + size = (pScrn->width * bytpp) * pScrni->virtualX; + offset += size; + avail -= size; + } + + AvailBox.x1 = 0; + AvailBox.y1 = + (offset + pGeode->displayPitch - + 1) / pGeode->displayPitch; + + AvailBox.x2 = pGeode->displayWidth; + AvailBox.y2 = (offset + avail) / pGeode->displayPitch; + + if (AvailBox.y1 < AvailBox.y2) { + REGION_INIT(pScrn, &OffscreenRegion, &AvailBox, 2); + + if (!xf86InitFBManagerRegion(pScrn, &OffscreenRegion)) + xf86DrvMsg(pScrni->scrnIndex, X_ERROR, + "Memory manager initialization failed.\n"); + + REGION_UNINIT(pScrn, &OffscreenRegion); + } else + xf86DrvMsg(pScrni->scrnIndex, X_INFO, + "Cache disabled - no offscreen memory available.\n"); + } else + xf86DrvMsg(pScrni->scrnIndex, X_INFO, + "XAA offscreen memory has already been allocated.\n"); + } + } + return ret; +} + +static Bool +GXSaveScreen(ScreenPtr pScrn, int mode) +{ + ScrnInfoPtr pScrni = xf86Screens[pScrn->myNum]; + GeodePtr pGeode = GEODEPTR(pScrni); + + if (pGeode->useVGA && !pScrni->vtSema) + return vgaHWSaveScreen(pScrn, mode); + + return TRUE; +} + +/* Common function - used by the LX too */ +#ifdef XSERVER_LIBPCIACCESS +static inline void * +map_pci_mem(ScrnInfoPtr pScrni, int vram, + struct pci_device *dev, int bar, int size) +{ + void *ptr; + void **result = (void **)&ptr; + int map_size = size ? size : dev->regions[bar].size; + + int err = pci_device_map_range(dev, + dev->regions[bar].base_addr, + map_size, + PCI_DEV_MAP_FLAG_WRITABLE | + (vram ? PCI_DEV_MAP_FLAG_WRITE_COMBINE : 0), + result); + + if (err) + return NULL; + return ptr; +} +#endif + +extern unsigned long gfx_gx2_scratch_base; + +static Bool +GXMapMem(ScrnInfoPtr pScrni) +{ + GeodeRec *pGeode = GEODEPTR(pScrni); + int index = pScrni->scrnIndex; + + pciVideoPtr pci = xf86GetPciInfoForEntity(pGeode->pEnt->index); + +#ifndef XSERVER_LIBPCIACCESS + gfx_virt_regptr = (unsigned char *)xf86MapVidMem(index, VIDMEM_MMIO, + pci->memBase[2], pci->size[2]); + + gfx_virt_gpptr = (unsigned char *)xf86MapVidMem(index, VIDMEM_MMIO, + pci->memBase[1], pci->size[1]); + + gfx_virt_vidptr = (unsigned char *)xf86MapVidMem(index, VIDMEM_MMIO, + pci->memBase[3], pci->size[3]); + + gfx_virt_fbptr = (unsigned char *)xf86MapVidMem(index, VIDMEM_FRAMEBUFFER, + pci->memBase[0], pGeode->FBAvail); +#else + gfx_virt_regptr = map_pci_mem(pScrni, 0, pci, 2, 0); + gfx_virt_gpptr = map_pci_mem(pScrni, 0, pci, 1, 0); + gfx_virt_vidptr = map_pci_mem(pScrni, 0, pci, 3, 0); + gfx_virt_fbptr = map_pci_mem(pScrni, 1, pci, 0, pGeode->FBAvail); +#endif + + gfx_gx2_scratch_base = pGeode->FBAvail - 0x4000; + + XpressROMPtr = xf86MapVidMem(index, VIDMEM_FRAMEBUFFER, 0xF0000, 0x10000); + + pGeode->FBBase = gfx_virt_fbptr; + + if ((!gfx_virt_regptr) || (!gfx_virt_gpptr) || + (!gfx_virt_vidptr) || (!gfx_virt_fbptr)) + return FALSE; + + if (!pGeode->NoAccel && pGeode->useEXA) + pGeode->pExa->memoryBase = pGeode->FBBase; + + xf86DrvMsg(index, X_INFO, "Found Geode %x %p\n", + pGeode->FBAvail, pGeode->FBBase); + + return TRUE; +} + +/* Check to see if VGA exists - we map the space and look for a + signature - if it doesn't match exactly, then we assume no VGA. +*/ + +static Bool +GXCheckVGA(ScrnInfoPtr pScrni) +{ + + unsigned char *ptr; + const char *vgasig = "IBM VGA Compatible"; + int ret; + + ptr = + xf86MapVidMem(pScrni->scrnIndex, VIDMEM_FRAMEBUFFER, 0xC001E, + strlen(vgasig)); + + if (ptr == NULL) + return FALSE; + + ret = memcmp(ptr, vgasig, strlen(vgasig)); + xf86UnMapVidMem(pScrni->scrnIndex, (pointer) ptr, strlen(vgasig)); + + return ret ? FALSE : TRUE; +} + +static Bool +GXPreInit(ScrnInfoPtr pScrni, int flags) +{ + GeodePtr pGeode; + ClockRangePtr GeodeClockRange; + OptionInfoRec *GeodeOptions = &GX_GeodeOptions[0]; + int ret; + QQ_WORD msrValue; + EntityInfoPtr pEnt; + rgb defaultWeight = { 0, 0, 0 }; + int modecnt; + char *s, *panelgeo; + Bool useVGA; + + if (pScrni->numEntities != 1) + return FALSE; + + pEnt = xf86GetEntityInfo(pScrni->entityList[0]); + if (pEnt->resources) + return FALSE; + + pGeode = pScrni->driverPrivate = xnfcalloc(sizeof(GeodeRec), 1); + + if (pGeode == NULL) + return FALSE; + + useVGA = GXCheckVGA(pScrni); + + if (flags & PROBE_DETECT) { + GeodeProbeDDC(pScrni, pEnt->index); + return TRUE; + } + + /* Probe for VGA */ + pGeode->useVGA = useVGA; + pGeode->pEnt = pEnt; + + if (pGeode->useVGA) { + if (!xf86LoadSubModule(pScrni, "vgahw") || !vgaHWGetHWRec(pScrni)) + pGeode->useVGA = FALSE; + +#if INT10_SUPPORT + pGeode->vesa = xcalloc(sizeof(VESARec), 1); +#endif + } + + gfx_msr_init(); + + ret = gfx_msr_read(RC_ID_DF, MBD_MSR_CONFIG, &msrValue); + + if (!ret) { + pGeode->Output = + ((msrValue.low & RCDF_CONFIG_FMT_MASK) == + RCDF_CONFIG_FMT_FP) ? OUTPUT_PANEL : OUTPUT_CRT; + } + + /* Fill in the monitor information */ + pScrni->monitor = pScrni->confScreen->monitor; + + if (!xf86SetDepthBpp(pScrni, 16, 16, 16, Support24bppFb | Support32bppFb)) + return FALSE; + + switch (pScrni->depth) { + case 8: + pScrni->rgbBits = 8; + case 16: + case 24: + case 32: + break; + default: + xf86DrvMsg(pScrni->scrnIndex, X_ERROR, + "The driver does not support %d as a depth.\n", pScrni->depth); + return FALSE; + } + + xf86PrintDepthBpp(pScrni); + + if (!xf86SetWeight(pScrni, defaultWeight, defaultWeight)) + return FALSE; + + if (!xf86SetDefaultVisual(pScrni, -1)) + return FALSE; + + /* + * If the driver can do gamma correction, it should call xf86SetGamma() + * here. + */ + { + Gamma zeros = { 0.0, 0.0, 0.0 }; + + if (!xf86SetGamma(pScrni, zeros)) { + return FALSE; + } + } + + pScrni->progClock = TRUE; + xf86CollectOptions(pScrni, NULL); + xf86ProcessOptions(pScrni->scrnIndex, pScrni->options, GeodeOptions); + + /* Set up our various options that may get reversed as we go on */ + + pGeode->FBVGAActive = FALSE; + pGeode->tryHWCursor = TRUE; + pGeode->tryCompression = TRUE; + + pGeode->NoAccel = FALSE; + pGeode->useEXA = TRUE; + + pGeode->Panel = (pGeode->Output & OUTPUT_PANEL) ? TRUE : FALSE; + + pGeode->NoOfImgBuffers = DEFAULT_IMG_LINE_BUFS; + pGeode->NoOfColorExpandLines = DEFAULT_CLR_LINE_BUFS; + pGeode->exaBfrSz = DEFAULT_EXA_SCRATCH_BFRSZ; + + xf86GetOptValBool(GeodeOptions, GX_OPTION_HW_CURSOR, + &pGeode->tryHWCursor); + + if (!xf86GetOptValInteger(GeodeOptions, GX_OPTION_FBSIZE, + (int *)&(pGeode->FBAvail))) + pGeode->FBAvail = 0; + + /* For compatability - allow SWCursor too */ + + if (xf86ReturnOptValBool(GeodeOptions, GX_OPTION_SW_CURSOR, FALSE)) + pGeode->tryHWCursor = FALSE; + + if (xf86ReturnOptValBool(GeodeOptions, GX_OPTION_NOCOMPRESSION, FALSE)) + pGeode->tryCompression = FALSE; + + if (xf86ReturnOptValBool(GeodeOptions, GX_OPTION_NOACCEL, FALSE)) + pGeode->NoAccel = TRUE; + + pGeode->rotation = RR_Rotate_0; + + if ((s = xf86GetOptValString(GeodeOptions, GX_OPTION_ROTATE))) { + + if (!xf86NameCmp(s, "LEFT")) + pGeode->rotation = RR_Rotate_90; + else if (!xf86NameCmp(s, "INVERT")) + pGeode->rotation = RR_Rotate_180; + else if (!xf86NameCmp(s, "CCW")) + pGeode->rotation = RR_Rotate_270; + else + xf86DrvMsg(pScrni->scrnIndex, X_ERROR, + "Invalid rotation %s.\n", s); + } + + xf86GetOptValInteger(GeodeOptions, GX_OPTION_OSM_IMG_BUFS, + &(pGeode->NoOfImgBuffers)); + + if (pGeode->NoOfImgBuffers <= 0) + pGeode->NoOfImgBuffers = 0; + + xf86GetOptValInteger(GeodeOptions, GX_OPTION_OSM_CLR_BUFS, + &(pGeode->NoOfColorExpandLines)); + + if (pGeode->NoOfColorExpandLines <= 0) + pGeode->NoOfColorExpandLines = 0; + + xf86GetOptValInteger(GeodeOptions, GX_OPTION_OSM_CLR_BUFS, + (int *)&(pGeode->exaBfrSz)); + + if (pGeode->exaBfrSz <= 0) + pGeode->exaBfrSz = 0; + + if (pGeode->Panel == TRUE) { + if (xf86ReturnOptValBool(GeodeOptions, GX_OPTION_NOPANEL, FALSE)) + pGeode->Panel = FALSE; + } + + panelgeo = xf86GetOptValString(GeodeOptions, GX_OPTION_PANEL_GEOMETRY); + + if ((s = xf86GetOptValString(GeodeOptions, GX_OPTION_ACCEL_METHOD))) { + if (!xf86NameCmp(s, "XAA")) + pGeode->useEXA = FALSE; + else if (xf86NameCmp(s, "EXA")) + xf86DrvMsg(pScrni->scrnIndex, X_ERROR, + "Unknown accleration method %s. Defaulting to EXA.\n", s); + } + + xf86DrvMsg(pScrni->scrnIndex, X_INFO, + "Using %s acceleration architecture\n", + pGeode->useEXA ? "EXA" : "XAA"); + + /* Set up the panel */ + + if (pGeode->Panel) { + if (panelgeo != NULL) { + if (GeodeGetFPGeometry(panelgeo, &pGeode->PanelX, + &pGeode->PanelY)) + pGeode->Panel = FALSE; + } +#ifdef PNL_SUP + else { + int b, f; + + /* The bitdepth and refresh isn't used anywhere else in the driver */ + + if ((pGeode->Panel = Pnl_IsPanelEnabledInBIOS())) + Pnl_GetPanelInfoFromBIOS(&pGeode->PanelX, &pGeode->PanelY, &b, + &f); + } +#endif + } + + /* Set up the VGA */ + + if (pGeode->useVGA) { +#if INT10_SUPPORT + VESARec *pVesa; + + if (!xf86LoadSubModule(pScrni, "int10")) + return FALSE; + xf86LoaderReqSymLists(amdInt10Symbols, NULL); + + pVesa = pGeode->vesa; + + if ((pVesa->pInt = xf86InitInt10(pGeode->pEnt->index)) == NULL) { + xf86DrvMsg(pScrni->scrnIndex, X_ERROR, + "Unable to initialize 1NT10 support\n"); + pGeode->useVGA = FALSE; + } +#endif + } + + /* First try to get the framebuffer size from the framebuffer, + * and if that fails, revert all the way back to the legacy + * method + */ + + if (pGeode->FBAvail == 0) { + if (GeodeGetSizeFromFB(&pGeode->FBAvail)) + pGeode->FBAvail = gfx_get_frame_buffer_size(); + } + + if (pScrni->memPhysBase == 0) + pScrni->memPhysBase = gfx_get_frame_buffer_base(); + + pScrni->fbOffset = 0; + + if (pGeode->pEnt->device->videoRam == 0) + pScrni->videoRam = pGeode->FBAvail / 1024; + else + pScrni->videoRam = pGeode->pEnt->device->videoRam; + + pGeode->maxWidth = GX_MAX_WIDTH; + pGeode->maxHeight = GX_MAX_HEIGHT; + + GeodeClockRange = (ClockRangePtr) xnfcalloc(sizeof(ClockRange), 1); + GeodeClockRange->next = NULL; + GeodeClockRange->minClock = 25175; + GeodeClockRange->maxClock = 229500; + GeodeClockRange->clockIndex = -1; + GeodeClockRange->interlaceAllowed = TRUE; + GeodeClockRange->doubleScanAllowed = FALSE; + + pScrni->monitor->DDC = GeodeDoDDC(pScrni, pGeode->pEnt->index); + + /* I'm still not 100% sure this uses the right values */ + + modecnt = xf86ValidateModes(pScrni, + pScrni->monitor->Modes, + pScrni->display->modes, + GeodeClockRange, + NULL, GX_MIN_PITCH, GX_MAX_PITCH, + 32, GX_MIN_HEIGHT, GX_MAX_HEIGHT, + pScrni->display->virtualX, + pScrni->display->virtualY, pGeode->FBAvail, LOOKUP_BEST_REFRESH); + + if (modecnt <= 0) { + xf86DrvMsg(pScrni->scrnIndex, X_ERROR, "No valid modes were found\n"); + return FALSE; + } + + xf86PruneDriverModes(pScrni); + + if (pScrni->modes == NULL) { + xf86DrvMsg(pScrni->scrnIndex, X_ERROR, "No valid modes were found\n"); + return FALSE; + } + + xf86SetCrtcForModes(pScrni, 0); + pScrni->currentMode = pScrni->modes; + + xf86PrintModes(pScrni); + xf86SetDpi(pScrni, 0, 0); + + /* Load the modules we'll need */ + + if (xf86LoadSubModule(pScrni, "fb") == NULL) { + return FALSE; + } + + xf86LoaderReqSymLists(amdFbSymbols, NULL); + + if (pGeode->NoAccel == FALSE) { + const char *module = (pGeode->useEXA) ? "exa" : "xaa"; + const char **symbols = (pGeode->useEXA) ? + &amdExaSymbols[0] : &amdXaaSymbols[0]; + + if (!xf86LoadSubModule(pScrni, module)) { + return FALSE; + } + + xf86LoaderReqSymLists(symbols, NULL); + } + + if (pGeode->tryHWCursor == TRUE) { + if (!xf86LoadSubModule(pScrni, "ramdac")) { + return FALSE; + } + + xf86LoaderReqSymLists(amdRamdacSymbols, NULL); + } + + if (xf86RegisterResources(pGeode->pEnt->index, NULL, ResExclusive)) { + xf86DrvMsg(pScrni->scrnIndex, X_ERROR, + "Couldn't register the resources.\n"); + return FALSE; + } + + return TRUE; +} + +static void +GXRestore(ScrnInfoPtr pScrni) +{ + GeodeRec *pGeode = GEODEPTR(pScrni); + + if (pGeode->useVGA && pGeode->FBVGAActive) { + vgaHWPtr pvgaHW = VGAHWPTR(pScrni); + + vgaHWProtect(pScrni, TRUE); + vgaHWRestore(pScrni, &pvgaHW->SavedReg, VGA_SR_ALL); + vgaHWProtect(pScrni, FALSE); + } +} + +static Bool +GXUnmapMem(ScrnInfoPtr pScrni) +{ + GeodeRec *pGeode = GEODEPTR(pScrni); + + /* unmap all the memory map's */ + + xf86UnMapVidMem(pScrni->scrnIndex, gfx_virt_regptr, GX_CPU_REG_SIZE); + xf86UnMapVidMem(pScrni->scrnIndex, gfx_virt_gpptr, GX_GP_REG_SIZE); + xf86UnMapVidMem(pScrni->scrnIndex, gfx_virt_vidptr, GX_VID_REG_SIZE); + xf86UnMapVidMem(pScrni->scrnIndex, gfx_virt_fbptr, pGeode->FBAvail); + return TRUE; +} + +static void +GXSetDvLineSize(unsigned int pitch) +{ + unsigned long temp, dv_size = MDC_DV_LINE_SIZE_1024; + + if (pitch > 1024) { + dv_size = MDC_DV_LINE_SIZE_2048; + } + if (pitch > 2048) { + dv_size = MDC_DV_LINE_SIZE_4096; + } + if (pitch > 4096) { + dv_size = MDC_DV_LINE_SIZE_8192; + } + + /* WRITE DIRTY/VALID CONTROL WITH LINE LENGTH */ + + temp = READ_REG32(MDC_DV_CTL); + WRITE_REG32(MDC_DV_CTL, (temp & ~MDC_DV_LINE_SIZE_MASK) | dv_size); +} + +/* XXX - this is nothing like the original function - not sure exactly what the purpose is for this quite yet */ + +static void +GXAdjustFrame(int scrnIndex, int x, int y, int flags) +{ + ScrnInfoPtr pScrni = xf86Screens[scrnIndex]; + GeodeRec *pGeode = GEODEPTR(pScrni); + unsigned long offset; + + offset = + pGeode->FBOffset + y * pGeode->Pitch + + x * (pScrni->bitsPerPixel >> 3); + + gfx_set_display_offset(offset); +} + +static Bool +GXSetVideoMode(ScrnInfoPtr pScrni, DisplayModePtr pMode) +{ + GeodeRec *pGeode = GEODEPTR(pScrni); + int flags = 0; + int custom = 0; + + pScrni->vtSema = TRUE; + + gx_disable_dac_power(); + + if (pMode->Flags & V_NHSYNC) + flags |= 1; + if (pMode->Flags & V_NVSYNC) + flags |= 2; + + /* Check to see if we should use custom or built-in timings */ + + if (pGeode->Panel) + custom = (pMode->type & M_T_USERDEF); + else + custom = !(pMode->type & (M_T_BUILTIN | M_T_DEFAULT)); + + /* If we're not doing a custom mode, then just set the fixed timings, + * otherwise, do the whole shooting match */ + + if (!custom) { + GFX(set_fixed_timings(pGeode->PanelX, pGeode->PanelY, + pMode->CrtcHDisplay, pMode->CrtcVDisplay, + pScrni->bitsPerPixel)); + } else { + if (pGeode->Panel) + GFX(set_panel_present(pGeode->PanelX, pGeode->PanelY, + pMode->CrtcHDisplay, pMode->CrtcVDisplay, + pScrni->bitsPerPixel)); + + GFX(set_display_timings(pScrni->bitsPerPixel, flags, + pMode->CrtcHDisplay, pMode->CrtcHBlankStart, + pMode->CrtcHSyncStart, pMode->CrtcHSyncEnd, + pMode->CrtcHBlankEnd, pMode->CrtcHTotal, + pMode->CrtcVDisplay, pMode->CrtcVBlankStart, + pMode->CrtcVSyncStart, pMode->CrtcVSyncEnd, + pMode->CrtcVBlankEnd, pMode->CrtcVTotal, + (int)((pMode->SynthClock / 1000.0) * 0x10000))); + } + + GFX(set_crt_enable(CRT_ENABLE)); + GFX(set_display_pitch(pGeode->displayPitch)); + GFX(set_display_offset(0L)); + GFX(wait_vertical_blank()); + + if (pGeode->Compression) { + GXSetDvLineSize(pGeode->Pitch); + + gfx_set_compression_offset(pGeode->CBData.compression_offset); + gfx_set_compression_pitch(GX_CB_PITCH); + gfx_set_compression_size(GX_CB_SIZE); + + gfx_set_compression_enable(1); + } + + if (pGeode->HWCursor && !(pMode->Flags & V_DBLSCAN)) { + GXLoadCursorImage(pScrni, NULL); + GFX(set_cursor_position(pGeode->CursorStartOffset, 0, 0, 0, 0)); + GXShowCursor(pScrni); + } else { + GFX(set_cursor_enable(0)); + pGeode->HWCursor = FALSE; + } + + GXAdjustFrame(pScrni->scrnIndex, pScrni->frameX0, pScrni->frameY0, 0); + gx_enable_dac_power(); + + return TRUE; +} + +static Bool +GXSwitchMode(int index, DisplayModePtr pMode, int flags) +{ + ScrnInfoPtr pScrni = xf86Screens[index]; + GeodeRec *pGeode = GEODEPTR(pScrni); + int ret = TRUE; + int rotate; + + /* Syn the engine and shutdown the DAC momentarily */ + + gfx_wait_until_idle(); + + /* Set up the memory for the new mode */ + rotate = GXGetRotation(pScrni->pScreen); + ret = GXAllocateMemory(pScrni->pScreen, pScrni, rotate); + + if (ret) { + if (pGeode->curMode != pMode) + ret = GXSetVideoMode(pScrni, pMode); + } + + if (ret) + ret = GXRotate(pScrni, pMode); + + /* Go back the way it was */ + + if (ret == FALSE) { + if (!GXSetVideoMode(pScrni, pGeode->curMode)) + xf86DrvMsg(pScrni->scrnIndex, X_ERROR, + "Could not restore the previous mode\n"); + } else + pGeode->curMode = pMode; + + return ret; +} + +static void +GXLeaveGraphics(ScrnInfoPtr pScrni) +{ + GeodeRec *pGeode = GEODEPTR(pScrni); + + gfx_wait_until_idle(); + + /* Restore VG registers */ + gfx_set_display_timings(pGeode->FBgfxdisplaytiming.wBpp, + pGeode->FBgfxdisplaytiming.wPolarity, + pGeode->FBgfxdisplaytiming.wHActive, + pGeode->FBgfxdisplaytiming.wHBlankStart, + pGeode->FBgfxdisplaytiming.wHSyncStart, + pGeode->FBgfxdisplaytiming.wHSyncEnd, + pGeode->FBgfxdisplaytiming.wHBlankEnd, + pGeode->FBgfxdisplaytiming.wHTotal, + pGeode->FBgfxdisplaytiming.wVActive, + pGeode->FBgfxdisplaytiming.wVBlankStart, + pGeode->FBgfxdisplaytiming.wVSyncStart, + pGeode->FBgfxdisplaytiming.wVSyncEnd, + pGeode->FBgfxdisplaytiming.wVBlankEnd, + pGeode->FBgfxdisplaytiming.wVTotal, + pGeode->FBgfxdisplaytiming.dwDotClock); + + gfx_set_compression_enable(0); + + /* Restore the previous Compression state */ + if (pGeode->FBCompressionEnable) { + gfx_set_compression_offset(pGeode->FBCompressionOffset); + gfx_set_compression_pitch(pGeode->FBCompressionPitch); + gfx_set_compression_size(pGeode->FBCompressionSize); + gfx_set_compression_enable(1); + } + + gfx_set_display_pitch(pGeode->FBgfxdisplaytiming.wPitch); + + gfx_set_display_offset(pGeode->FBDisplayOffset); + + /* Restore Cursor */ + gfx_set_cursor_position(pGeode->FBCursorOffset, 0, 0, 0, 0); + + if (pGeode->useVGA) { + pGeode->vesa->pInt->num = 0x10; + pGeode->vesa->pInt->ax = 0x0 | pGeode->FBBIOSMode; + pGeode->vesa->pInt->bx = 0; + xf86ExecX86int10(pGeode->vesa->pInt); + gfx_delay_milliseconds(3); + } + + GXRestore(pScrni); + + gx_enable_dac_power(); +} + +static Bool +GXCloseScreen(int scrnIndex, ScreenPtr pScrn) +{ + ScrnInfoPtr pScrni = xf86Screens[scrnIndex]; + GeodeRec *pGeode = GEODEPTR(pScrni); + + if (pScrni->vtSema) + GXLeaveGraphics(pScrni); + + if (pGeode->AccelInfoRec) + XAADestroyInfoRec(pGeode->AccelInfoRec); + + if (pGeode->AccelImageWriteBuffers) { + xfree(pGeode->AccelImageWriteBuffers[0]); + xfree(pGeode->AccelImageWriteBuffers); + pGeode->AccelImageWriteBuffers = NULL; + } + + if (pGeode->AccelColorExpandBuffers) { + xfree(pGeode->AccelColorExpandBuffers); + pGeode->AccelColorExpandBuffers = NULL; + } + + if (pGeode->pExa) { + exaDriverFini(pScrn); + xfree(pGeode->pExa); + pGeode->pExa = NULL; + } + + pScrni->vtSema = FALSE; + + GXUnmapMem(pScrni); + + pScrni->PointerMoved = pGeode->PointerMoved; + pScrn->CloseScreen = pGeode->CloseScreen; + + if (pScrn->CloseScreen) + return (*pScrn->CloseScreen) (scrnIndex, pScrn); + + return TRUE; +} + +static Bool +GXEnterGraphics(ScreenPtr pScrn, ScrnInfoPtr pScrni) +{ + GeodeRec *pGeode = GEODEPTR(pScrni); + + if (!GXMapMem(pScrni)) + return FALSE; + + if (pGeode->useVGA) + pGeode->FBVGAActive = gu2_get_vga_active(); + + gfx_wait_until_idle(); + + /* Save off the current state (should this be somewhere else)? */ + + pGeode->FBgfxdisplaytiming.dwDotClock = gfx_get_clock_frequency(); + pGeode->FBgfxdisplaytiming.wPitch = gfx_get_display_pitch(); + pGeode->FBgfxdisplaytiming.wBpp = gfx_get_display_bpp(); + pGeode->FBgfxdisplaytiming.wHTotal = gfx_get_htotal(); + pGeode->FBgfxdisplaytiming.wHActive = gfx_get_hactive(); + pGeode->FBgfxdisplaytiming.wHSyncStart = gfx_get_hsync_start(); + pGeode->FBgfxdisplaytiming.wHSyncEnd = gfx_get_hsync_end(); + pGeode->FBgfxdisplaytiming.wHBlankStart = gfx_get_hblank_start(); + pGeode->FBgfxdisplaytiming.wHBlankEnd = gfx_get_hblank_end(); + pGeode->FBgfxdisplaytiming.wVTotal = gfx_get_vtotal(); + pGeode->FBgfxdisplaytiming.wVActive = gfx_get_vactive(); + pGeode->FBgfxdisplaytiming.wVSyncStart = gfx_get_vsync_start(); + pGeode->FBgfxdisplaytiming.wVSyncEnd = gfx_get_vsync_end(); + pGeode->FBgfxdisplaytiming.wVBlankStart = gfx_get_vblank_start(); + pGeode->FBgfxdisplaytiming.wVBlankEnd = gfx_get_vblank_end(); + pGeode->FBgfxdisplaytiming.wPolarity = gfx_get_sync_polarities(); + + pGeode->FBDisplayOffset = gfx_get_display_offset(); + + if (pGeode->useVGA) { + vgaHWPtr pvgaHW = VGAHWPTR(pScrni); + + pGeode->FBBIOSMode = pvgaHW->readCrtc(pvgaHW, 0x040); + } + + pGeode->FBCompressionEnable = gfx_get_compression_enable(); + pGeode->FBCompressionOffset = gfx_get_compression_offset(); + pGeode->FBCompressionPitch = gfx_get_compression_pitch(); + pGeode->FBCompressionSize = gfx_get_compression_size(); + +#ifdef PNL_SUP + Pnl_SavePanelState(); +#endif + + /* Turn off the VGA */ + + if (pGeode->useVGA && pGeode->FBVGAActive) { + unsigned short sequencer; + vgaHWPtr pvgaHW = VGAHWPTR(pScrni); + + /* Map VGA aperture */ + if (!vgaHWMapMem(pScrni)) + return FALSE; + + /* Unlock VGA registers */ + vgaHWUnlock(pvgaHW); + + /* Save the current state and setup the current mode */ + vgaHWSave(pScrni, &VGAHWPTR(pScrni)->SavedReg, VGA_SR_ALL); + + /* DISABLE VGA SEQUENCER */ + /* This allows the VGA state machine to terminate. We must delay */ + /* such that there are no pending MBUS requests. */ + + gfx_outb(MDC_SEQUENCER_INDEX, MDC_SEQUENCER_CLK_MODE); + sequencer = gfx_inb(MDC_SEQUENCER_DATA); + sequencer |= MDC_CLK_MODE_SCREEN_OFF; + gfx_outb(MDC_SEQUENCER_DATA, sequencer); + + gfx_delay_milliseconds(1); + + /* BLANK THE VGA DISPLAY */ + gfx_outw(MDC_SEQUENCER_INDEX, MDC_SEQUENCER_RESET); + sequencer = gfx_inb(MDC_SEQUENCER_DATA); + sequencer &= ~MDC_RESET_VGA_DISP_ENABLE; + gfx_outb(MDC_SEQUENCER_DATA, sequencer); + + gfx_delay_milliseconds(1); + } + + /* Set up the memory */ + /* XXX - FIXME - when we alow inital rotation, it should be here */ + GXAllocateMemory(pScrn, pScrni, pGeode->rotation); + + /* Clear the framebuffer */ + memset(pGeode->FBBase + pGeode->displayOffset, 0, pGeode->displaySize); + + /* Set up the video mode */ + GXSetVideoMode(pScrni, pScrni->currentMode); + pGeode->curMode = pScrni->currentMode; + + return TRUE; +} + +static void +GXLoadPalette(ScrnInfoPtr pScrni, + int numColors, int *indizes, LOCO * colors, VisualPtr pVisual) +{ + int i, index, color; + + for (i = 0; i < numColors; i++) { + index = indizes[i] & 0xFF; + color = (((unsigned long)(colors[index].red & 0xFF)) << 16) | + (((unsigned long)(colors[index].green & 0xFF)) << 8) | + ((unsigned long)(colors[index].blue & 0xFF)); + + GFX(set_display_palette_entry(index, color)); + } +} + +#ifdef DPMSExtension +static void +GXPanelPower(int enable) +{ + unsigned long power = READ_VID32(RCDF_POWER_MANAGEMENT); + + if (enable != 0) + power |= RCDF_PM_PANEL_POWER_ON; + else + power &= ~RCDF_PM_PANEL_POWER_ON; + + WRITE_VID32(RCDF_POWER_MANAGEMENT, power); +} + +static void +GXDPMSSet(ScrnInfoPtr pScrni, int mode, int flags) +{ + GeodeRec *pGeode; + + pGeode = GEODEPTR(pScrni); + + if (!pScrni->vtSema) + return; + + switch (mode) { + case DPMSModeOn: + /* Screen: On; HSync: On; VSync: On */ + GFX(set_crt_enable(CRT_ENABLE)); +#if defined(PNL_SUP) + if (pGeode->Panel) { + Pnl_PowerUp(); + GXPanelPower(1); + } +#endif + break; + + case DPMSModeStandby: + /* Screen: Off; HSync: Off; VSync: On */ + GFX(set_crt_enable(CRT_STANDBY)); +#if defined(PNL_SUP) + if (pGeode->Panel) { + Pnl_PowerDown(); + GXPanelPower(0); + } +#endif + break; + + case DPMSModeSuspend: + /* Screen: Off; HSync: On; VSync: Off */ + GFX(set_crt_enable(CRT_SUSPEND)); +#if defined(PNL_SUP) + if (pGeode->Panel) { + Pnl_PowerDown(); + GXPanelPower(0); + } +#endif + break; + + case DPMSModeOff: + /* Screen: Off; HSync: Off; VSync: Off */ + GFX(set_crt_enable(CRT_DISABLE)); +#if defined(PNL_SUP) + if (pGeode->Panel) { + Pnl_PowerDown(); + GXPanelPower(0); + } +#endif + break; + } +} +#endif + +static Bool +GXCreateScreenResources(ScreenPtr pScreen) +{ + ScrnInfoPtr pScrni = xf86Screens[pScreen->myNum]; + GeodeRec *pGeode = GEODEPTR(pScrni); + + pScreen->CreateScreenResources = pGeode->CreateScreenResources; + if (!(*pScreen->CreateScreenResources) (pScreen)) + return FALSE; + + if (xf86LoaderCheckSymbol("GXRandRSetConfig") + && pGeode->rotation != RR_Rotate_0) { + Rotation(*GXRandRSetConfig) (ScreenPtr pScreen, Rotation rr, int rate, + RRScreenSizePtr pSize) = NULL; + + RRScreenSize p; + Rotation requestedRotation = pGeode->rotation; + + pGeode->rotation = RR_Rotate_0; + + /* Just setup enough for an initial rotate */ + + p.width = pScreen->width; + p.height = pScreen->height; + p.mmWidth = pScreen->mmWidth; + p.mmHeight = pScreen->mmHeight; + + GXRandRSetConfig = LoaderSymbol("GXRandRSetConfig"); + if (GXRandRSetConfig) { + pGeode->starting = TRUE; + (*GXRandRSetConfig) (pScreen, requestedRotation, 0, &p); + pGeode->starting = FALSE; + } + } + + return TRUE; +} + +static Bool +GXScreenInit(int scrnIndex, ScreenPtr pScrn, int argc, char **argv) +{ + ScrnInfoPtr pScrni = xf86Screens[scrnIndex]; + GeodeRec *pGeode = GEODEPTR(pScrni); + XF86ModReqInfo shadowReq; + int maj, min, ret, rotate; + + pGeode->starting = TRUE; + + /* If we are using VGA then go ahead and map the memory */ + + if (pGeode->useVGA) { + + if (!vgaHWMapMem(pScrni)) + return FALSE; + + vgaHWGetIOBase(VGAHWPTR(pScrni)); + } + + if (!pGeode->NoAccel) { + + if (pGeode->useEXA) { + + if (!(pGeode->pExa = xnfcalloc(sizeof(ExaDriverRec), 1))) { + xf86DrvMsg(scrnIndex, X_ERROR, + "Couldn't allocate the EXA structure.\n"); + pGeode->NoAccel = TRUE; + } else { + ExaDriverPtr pExa = pGeode->pExa; + + /* THis is set in GXAllocMem */ + pExa->memoryBase = 0; + + /* This is set in GXAllocateMemory */ + pExa->memorySize = 0; + + pExa->pixmapOffsetAlign = 32; + pExa->pixmapPitchAlign = 32; + pExa->flags = EXA_OFFSCREEN_PIXMAPS; + pExa->maxX = pGeode->maxWidth - 1; + pExa->maxY = pGeode->maxHeight - 1; + } + } else { + pGeode->AccelImageWriteBuffers = + xcalloc(sizeof(pGeode->AccelImageWriteBuffers[0]), + pGeode->NoOfImgBuffers); + pGeode->AccelColorExpandBuffers = + xcalloc(sizeof(pGeode->AccelColorExpandBuffers[0]), + pGeode->NoOfColorExpandLines); + } + } + + /* XXX FIXME - Take down any of the structures on failure? */ + + if (!GXEnterGraphics(pScrn, pScrni)) + return FALSE; + + miClearVisualTypes(); + + /* XXX Again - take down anything? */ + + if (pScrni->bitsPerPixel > 8) { + if (!miSetVisualTypes(pScrni->depth, + TrueColorMask, pScrni->rgbBits, pScrni->defaultVisual)) { + return FALSE; + } + } else { + if (!miSetVisualTypes(pScrni->depth, + miGetDefaultVisualMask(pScrni->depth), + pScrni->rgbBits, pScrni->defaultVisual)) { + return FALSE; + } + } + + miSetPixmapDepths(); + + /* Point at the visible area to start */ + + ret = fbScreenInit(pScrn, pGeode->FBBase + pGeode->displayOffset, + pScrni->virtualX, pScrni->virtualY, + pScrni->xDpi, pScrni->yDpi, pGeode->displayWidth, + pScrni->bitsPerPixel); + + if (!ret) + return FALSE; + + xf86SetBlackWhitePixels(pScrn); + + /* Set up the color ordering */ + + if (pScrni->bitsPerPixel > 8) { + VisualPtr visual = pScrn->visuals + pScrn->numVisuals; + + while (--visual >= pScrn->visuals) { + if ((visual->class | DynamicClass) == DirectColor) { + visual->offsetRed = pScrni->offset.red; + visual->offsetGreen = pScrni->offset.green; + visual->offsetBlue = pScrni->offset.blue; + visual->redMask = pScrni->mask.red; + visual->greenMask = pScrni->mask.green; + visual->blueMask = pScrni->mask.blue; + } + } + } + + /* Must follow the color ordering */ + fbPictureInit(pScrn, 0, 0); + + if (!pGeode->NoAccel) + GXAccelInit(pScrn); + + miInitializeBackingStore(pScrn); + xf86SetBackingStore(pScrn); + + /* Set up the soft cursor */ + miDCInitialize(pScrn, xf86GetPointerScreenFuncs()); + + /* Set up the HW cursor - must follow the soft cursor init */ + + if (pGeode->tryHWCursor) { + if (!GXHWCursorInit(pScrn)) + xf86DrvMsg(scrnIndex, X_ERROR, + "Hardware cursor initialization failed.\n"); + } + + /* Set up the color map */ + + if (!miCreateDefColormap(pScrn)) + return FALSE; + + if (pScrni->bitsPerPixel == 8) { + /* Must follow initialization of the default colormap */ + + if (!xf86HandleColormaps(pScrn, 256, 8, + GXLoadPalette, NULL, + CMAP_PALETTED_TRUECOLOR | CMAP_RELOAD_ON_MODE_SWITCH)) { + return FALSE; + } + } +#ifdef DPMSExtension + xf86DPMSInit(pScrn, GXDPMSSet, 0); +#endif + + GXInitVideo(pScrn); + + /* Set up RandR */ + + xf86DisableRandR(); /* We provide our own RandR goodness */ + + /* Try to set up the shadow FB for rotation */ + + memset(&shadowReq, 0, sizeof(shadowReq)); + shadowReq.majorversion = 1; + shadowReq.minorversion = 1; + + if (LoadSubModule(pScrni->module, "shadow", + NULL, NULL, NULL, &shadowReq, &maj, &min)) { + + rotate = RR_Rotate_0 | RR_Rotate_90 | RR_Rotate_180 | RR_Rotate_270; + shadowSetup(pScrn); + } else { + LoaderErrorMsg(NULL, "shadow", maj, min); + xf86DrvMsg(pScrni->scrnIndex, X_ERROR, + "Error loading shadow - rotation not available.\n"); + + if (pGeode->rotation != RR_Rotate_0) + xf86DrvMsg(pScrni->scrnIndex, X_ERROR, + "Reverting back to normal rotation.\n"); + + rotate = pGeode->rotation = RR_Rotate_0; + } + + GXRandRInit(pScrn, rotate); + + pGeode->PointerMoved = pScrni->PointerMoved; + pScrni->PointerMoved = GeodePointerMoved; + + pGeode->CreateScreenResources = pScrn->CreateScreenResources; + pScrn->CreateScreenResources = GXCreateScreenResources; + + pGeode->CloseScreen = pScrn->CloseScreen; + pScrn->CloseScreen = GXCloseScreen; + pScrn->SaveScreen = GXSaveScreen; + + if (serverGeneration == 1) + xf86ShowUnusedOptions(pScrni->scrnIndex, pScrni->options); + + pGeode->starting = FALSE; + + return TRUE; +} + +static int +GXValidMode(int scrnIndex, DisplayModePtr pMode, Bool Verbose, int flags) +{ + ScrnInfoPtr pScrni = xf86Screens[scrnIndex]; + GeodeRec *pGeode = GEODEPTR(pScrni); + int p, ret; + int custom = 0; + + if (pGeode->Panel) + custom = (pMode->type & M_T_USERDEF); + else + custom = (pMode->type & (M_T_BUILTIN | M_T_DEFAULT)); + + /* Use the durango lookup for !custom modes */ + + if (!custom) { + if (pGeode->Panel) { + if (pMode->CrtcHDisplay > pGeode->PanelX || + pMode->CrtcVDisplay > pGeode->PanelY || + gfx_is_panel_mode_supported(pGeode->PanelX, pGeode->PanelY, + pMode->CrtcHDisplay, pMode->CrtcVDisplay, + pScrni->bitsPerPixel) < 0) { + + return MODE_BAD; + } + } + + ret = gfx_is_display_mode_supported(pMode->CrtcHDisplay, + pMode->CrtcVDisplay, + pScrni->bitsPerPixel, GeodeGetRefreshRate(pMode)); + if (ret < 0) + return MODE_BAD; + } + + if (pMode->Flags & V_INTERLACE) + return MODE_NO_INTERLACE; + + if (pGeode->tryCompression) + p = GeodeCalculatePitchBytes(pMode->CrtcHDisplay, + pScrni->bitsPerPixel); + else + p = ((pMode->CrtcHDisplay + 3) & ~3) * (pScrni->bitsPerPixel >> 3); + + if (p * pMode->CrtcVDisplay > pGeode->FBAvail) + return MODE_MEM; + + return MODE_OK; +} + +/* XXX - Way more to do here */ + +static Bool +GXEnterVT(int scrnIndex, int flags) +{ + return GXEnterGraphics(NULL, xf86Screens[scrnIndex]); +} + +static void +GXLeaveVT(int scrnIndex, int flags) +{ + ScrnInfoPtr pScrni = xf86Screens[scrnIndex]; + GeodeRec *pGeode = GEODEPTR(pScrni); + + pGeode->PrevDisplayOffset = gfx_get_display_offset(); + GXLeaveGraphics(xf86Screens[scrnIndex]); +} + +void +GXSetupChipsetFPtr(ScrnInfoPtr pScrn) +{ + pScrn->PreInit = GXPreInit; + pScrn->ScreenInit = GXScreenInit; + pScrn->SwitchMode = GXSwitchMode; + pScrn->AdjustFrame = GXAdjustFrame; + pScrn->EnterVT = GXEnterVT; + pScrn->LeaveVT = GXLeaveVT; + pScrn->FreeScreen = GeodeFreeScreen; + pScrn->ValidMode = GXValidMode; +} + +/* ====== Common functions ====== + * These are all the common functions that we use for both GX and LX - They live here + * because most of them came along for the GX first, and then were adapted to the LX. + * We could move these to a common function, but there is no hurry + * ============================== */ + +void +GeodePointerMoved(int index, int x, int y) +{ + ScrnInfoPtr pScrni = xf86Screens[index]; + GeodeRec *pGeode = GEODEPTR(pScrni); + + int newX = x, newY = y; + + switch (pGeode->rotation) { + case RR_Rotate_0: + break; + case RR_Rotate_90: + newX = y; + newY = pScrni->pScreen->width - x - 1; + break; + case RR_Rotate_180: + newX = pScrni->pScreen->width - x - 1; + newY = pScrni->pScreen->height - y - 1; + break; + case RR_Rotate_270: + newX = pScrni->pScreen->height - y - 1; + newY = x; + break; + } + + (*pGeode->PointerMoved) (index, newX, newY); +} + +int +GeodeGetFPGeometry(const char *str, int *width, int *height) +{ + + int ret = sscanf(str, "%dx%d", width, height); + + return (ret == 2) ? 0 : 1; +} + +static void +GeodeFreeRec(ScrnInfoPtr pScrni) +{ + if (pScrni->driverPrivate != NULL) { + xfree(pScrni->driverPrivate); + pScrni->driverPrivate = NULL; + } +} + +void +GeodeFreeScreen(int scrnIndex, int flags) +{ + GeodeRec *pGeode = GEODEPTR(xf86Screens[scrnIndex]); + + if (pGeode == NULL) + return; + + if (pGeode->useVGA) { + if (xf86LoaderCheckSymbol("vgaHWFreeHWRec")) + vgaHWFreeHWRec(xf86Screens[scrnIndex]); + } + + GeodeFreeRec(xf86Screens[scrnIndex]); +} + +int +GeodeCalculatePitchBytes(unsigned int width, unsigned int bpp) +{ + + int delta = width * (bpp >> 3); + + /* Less then 640 has doubling enabled */ + + if (width < 640) + delta <<= 1; + + /* Calculate the pitch (compression rquires a power of 2) */ + + if (delta > 4096) + delta = 8192; + else if (delta > 2048) + delta = 4096; + else if (delta > 1024) + delta = 2048; + else + delta = 1024; + + return delta; +} diff --git a/driver/xf86-video-geode/src/gx_randr.c b/driver/xf86-video-geode/src/gx_randr.c new file mode 100644 index 000000000..553fce2fd --- /dev/null +++ b/driver/xf86-video-geode/src/gx_randr.c @@ -0,0 +1,371 @@ +/* Originally derived from the Intel example + * Copyright (C) 2002 Keith Packard, member of The XFree86 Project, Inc. + + * Copyright (c) 2006 Advanced Micro Devices, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + * + * Neither the name of the Advanced Micro Devices, Inc. nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + */ + +#include "xf86.h" +#include "os.h" +#include "mibank.h" +#include "globals.h" +#include "xf86.h" +#include "xf86Priv.h" +#include "xf86DDC.h" +#include "xf86Module.h" +#include "mipointer.h" +#include "windowstr.h" +#include +#include + +#include "geode.h" + +static int GXRandRGeneration; + +typedef struct _GXRandRInfo +{ + int virtualX; + int virtualY; + int mmWidth; + int mmHeight; + int maxX; + int maxY; + Rotation rotation; /* current mode */ + Rotation supported_rotations; /* driver supported */ +} XF86RandRInfoRec, *XF86RandRInfoPtr; + +#define AMD_OLDPRIV (GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) < 4) + +#if AMD_OLDPRIV + +static int GXRandRIndex; + +#define XF86RANDRINFO(p) ((XF86RandRInfoPtr) (p)->devPrivates[GXRandRIndex].ptr) +#else + +static DevPrivateKey GXRandRKey; + +#define XF86RANDRINFO(p) ((XF86RandRInfoPtr) \ + dixLookupPrivate(&(p)->devPrivates, GXRandRKey)); + +#endif + +static int +GXRandRModeRefresh(DisplayModePtr mode) +{ + if (mode->VRefresh) + return (int)(mode->VRefresh + 0.5); + else + return (int)(mode->Clock * 1000.0 / mode->HTotal / mode->VTotal + + 0.5); +} + +static Bool +GXRandRGetInfo(ScreenPtr pScreen, Rotation * rotations) +{ + RRScreenSizePtr pSize; + ScrnInfoPtr pScrni = XF86SCRNINFO(pScreen); + XF86RandRInfoPtr pRandr = XF86RANDRINFO(pScreen); + DisplayModePtr mode; + int refresh0 = 60; + int maxX = 0, maxY = 0; + + *rotations = pRandr->supported_rotations; + + if (pRandr->virtualX == -1 || pRandr->virtualY == -1) { + pRandr->virtualX = pScrni->virtualX; + pRandr->virtualY = pScrni->virtualY; + } + + for (mode = pScrni->modes;; mode = mode->next) { + int refresh = GXRandRModeRefresh(mode); + + if (pRandr->maxX == 0 || pRandr->maxY == 0) { + if (maxX < mode->HDisplay) + maxX = mode->HDisplay; + if (maxY < mode->VDisplay) + maxY = mode->VDisplay; + } + + if (mode == pScrni->modes) + refresh0 = refresh; + + pSize = RRRegisterSize(pScreen, + mode->HDisplay, mode->VDisplay, + pRandr->mmWidth, pRandr->mmHeight); + if (!pSize) + return FALSE; + + RRRegisterRate(pScreen, pSize, refresh); + + if (mode == pScrni->currentMode && + mode->HDisplay == pScrni->virtualX + && mode->VDisplay == pScrni->virtualY) + RRSetCurrentConfig(pScreen, pRandr->rotation, refresh, pSize); + if (mode->next == pScrni->modes) + break; + } + + if (pRandr->maxX == 0 || pRandr->maxY == 0) { + pRandr->maxX = maxX; + pRandr->maxY = maxY; + } + + if (pScrni->currentMode->HDisplay != pScrni->virtualX || + pScrni->currentMode->VDisplay != pScrni->virtualY) { + + mode = pScrni->modes; + pSize = RRRegisterSize(pScreen, + pRandr->virtualX, pRandr->virtualY, + pRandr->mmWidth, pRandr->mmHeight); + if (!pSize) + return FALSE; + + RRRegisterRate(pScreen, pSize, refresh0); + if (pScrni->virtualX == pRandr->virtualX && + pScrni->virtualY == pRandr->virtualY) { + RRSetCurrentConfig(pScreen, pRandr->rotation, refresh0, pSize); + } + } + + return TRUE; +} + +static Bool +GXRandRSetMode(ScreenPtr pScreen, + DisplayModePtr mode, Bool useVirtual, int mmWidth, int mmHeight) +{ + ScrnInfoPtr pScrni = XF86SCRNINFO(pScreen); + XF86RandRInfoPtr pRandr = XF86RANDRINFO(pScreen); + + int oldWidth = pScreen->width; + int oldHeight = pScreen->height; + int oldmmWidth = pScreen->mmWidth; + int oldmmHeight = pScreen->mmHeight; + WindowPtr pRoot = WindowTable[pScreen->myNum]; + DisplayModePtr currentMode = NULL; + Bool ret = TRUE; + PixmapPtr pspix = NULL; + + if (pRoot) + (*pScrni->EnableDisableFBAccess) (pScreen->myNum, FALSE); + + if (useVirtual) { + pScrni->virtualX = pRandr->virtualX; + pScrni->virtualY = pRandr->virtualY; + } else { + pScrni->virtualX = mode->HDisplay; + pScrni->virtualY = mode->VDisplay; + } + + if (pRandr->rotation & (RR_Rotate_90 | RR_Rotate_270)) { + pScreen->width = pScrni->virtualY; + pScreen->height = pScrni->virtualX; + pScreen->mmWidth = mmHeight; + pScreen->mmHeight = mmWidth; + } else { + pScreen->width = pScrni->virtualX; + pScreen->height = pScrni->virtualY; + pScreen->mmWidth = mmWidth; + pScreen->mmHeight = mmHeight; + } + + if (pScrni->currentMode == mode) { + currentMode = pScrni->currentMode; + pScrni->currentMode = NULL; + } + + if (!xf86SwitchMode(pScreen, mode)) { + ret = FALSE; + pScrni->virtualX = pScreen->width = oldWidth; + pScrni->virtualY = pScreen->height = oldHeight; + pScreen->mmWidth = oldmmWidth; + pScreen->mmHeight = oldmmHeight; + pScrni->currentMode = currentMode; + } + + /* + * Get the new Screen pixmap ptr as SwitchMode might have called + * ModifyPixmapHeader and xf86EnableDisableFBAccess will put it back... + * Unfortunately. + + */ + + pspix = (*pScreen->GetScreenPixmap) (pScreen); + if (pspix->devPrivate.ptr) + pScrni->pixmapPrivate = pspix->devPrivate; + + xf86ReconfigureLayout(); + + xf86SetViewport(pScreen, pScreen->width, pScreen->height); + xf86SetViewport(pScreen, 0, 0); + + if (pRoot) + (*pScrni->EnableDisableFBAccess) (pScreen->myNum, TRUE); + + return ret; +} + +Bool +GXRandRSetConfig(ScreenPtr pScreen, Rotation rotation, + int rate, RRScreenSizePtr pSize) +{ + ScrnInfoPtr pScrni = XF86SCRNINFO(pScreen); + XF86RandRInfoPtr pRandr = XF86RANDRINFO(pScreen); + + DisplayModePtr mode; + int px, py; + Bool useVirtual = FALSE; + int maxX = 0, maxY = 0; + Rotation oldRotation = pRandr->rotation; + + pRandr->rotation = rotation; + + if (pRandr->virtualX == -1 || pRandr->virtualY == -1) { + pRandr->virtualX = pScrni->virtualX; + pRandr->virtualY = pScrni->virtualY; + } + +/* FIXME: we don't have a new video ABI yet */ +#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) == 3 + miPointerGetPosition(inputInfo.pointer, &px, &py); +#else + miPointerPosition(&px, &py); +#endif + + for (mode = pScrni->modes;; mode = mode->next) { + if (pRandr->maxX == 0 || pRandr->maxY == 0) { + if (maxX < mode->HDisplay) + maxX = mode->HDisplay; + if (maxY < mode->VDisplay) + maxY = mode->VDisplay; + } + if (mode->HDisplay == pSize->width && + mode->VDisplay == pSize->height && + (rate == 0 || GXRandRModeRefresh(mode) == rate)) + break; + if (mode->next == pScrni->modes) { + if (pSize->width == pRandr->virtualX && + pSize->height == pRandr->virtualY) { + mode = pScrni->modes; + useVirtual = TRUE; + break; + } + if (pRandr->maxX == 0 || pRandr->maxY == 0) { + pRandr->maxX = maxX; + pRandr->maxY = maxY; + } + return FALSE; + } + } + + if (pRandr->maxX == 0 || pRandr->maxY == 0) { + pRandr->maxX = maxX; + pRandr->maxY = maxY; + } + + if (!GXRandRSetMode(pScreen, mode, useVirtual, pSize->mmWidth, + pSize->mmHeight)) { + pRandr->rotation = oldRotation; + return FALSE; + } + +/* FIXME: we don't have a new video ABI yet */ +#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) == 3 + if (pScreen == miPointerGetScreen(inputInfo.pointer)) +#else + if (pScreen == miPointerCurrentScreen()) +#endif + { + px = (px >= pScreen->width ? (pScreen->width - 1) : px); + py = (py >= pScreen->height ? (pScreen->height - 1) : py); + + xf86SetViewport(pScreen, px, py); + +/* FIXME: we don't have a new video ABI yet */ + (*pScreen->SetCursorPosition) ( +#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) == 3 + inputInfo.pointer, +#endif + pScreen, + px, py, + FALSE); + } + + return TRUE; +} + +Rotation +GXGetRotation(ScreenPtr pScreen) +{ + XF86RandRInfoPtr pRandr = XF86RANDRINFO(pScreen); + + return pRandr->rotation; +} + +Bool +GXRandRInit(ScreenPtr pScreen, int rotation) +{ + XF86RandRInfoPtr pRandr; + rrScrPrivPtr rp; + + if (GXRandRGeneration != serverGeneration) { + GXRandRGeneration = serverGeneration; + } +#if AMD_OLDPRIV + GXRandRIndex = AllocateScreenPrivateIndex(); +#else + GXRandRKey = &GXRandRKey; +#endif + + pRandr = xcalloc(sizeof(XF86RandRInfoRec), 1); + if (pRandr == NULL) + return FALSE; + + if (!RRScreenInit(pScreen)) { + xfree(pRandr); + return FALSE; + } + + rp = rrGetScrPriv(pScreen); + rp->rrGetInfo = GXRandRGetInfo; + rp->rrSetConfig = GXRandRSetConfig; + + pRandr->virtualX = -1; + pRandr->virtualY = -1; + + pRandr->mmWidth = pScreen->mmWidth; + pRandr->mmHeight = pScreen->mmHeight; + + pRandr->rotation = RR_Rotate_0; + pRandr->supported_rotations = rotation; + pRandr->maxX = pRandr->maxY = 0; + +#if AMD_OLDPRIV + pScreen->devPrivates[GXRandRIndex].ptr = pRandr; +#else + dixSetPrivate(&pScreen->devPrivates, GXRandRKey, pRandr); +#endif + return TRUE; +} diff --git a/driver/xf86-video-geode/src/gx_regacc.c b/driver/xf86-video-geode/src/gx_regacc.c new file mode 100644 index 000000000..315672637 --- /dev/null +++ b/driver/xf86-video-geode/src/gx_regacc.c @@ -0,0 +1,304 @@ +/* Copyright (c) 2003-2005 Advanced Micro Devices, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + * + * Neither the name of the Advanced Micro Devices, Inc. nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * */ + +/* + * This is the main file used to add Durango graphics support to a software + * project. The main reason to have a single file include the other files + * is that it centralizes the location of the compiler options. This file + * should be tuned for a specific implementation, and then modified as needed + * for new Durango releases. The releases.txt file indicates any updates to + * this main file, such as a new definition for a new hardware platform. + * + * In other words, this file should be copied from the Durango source files + * once when a software project starts, and then maintained as necessary. + * It should not be recopied with new versions of Durango unless the + * developer is willing to tune the file again for the specific project. + * */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "gfx_rtns.h" +#include "gfx_defs.h" +#include "gfx_regs.h" + +#define GU2_WAIT_PENDING \ + while(READ_GP32(MGP_BLT_STATUS) & MGP_BS_BLT_PENDING) +#define GU2_WAIT_HALF_EMPTY \ + while(!(READ_GP32(MGP_BLT_STATUS) & MGP_BS_HALF_EMPTY)) + +extern unsigned long gu2_pitch; +extern unsigned long gu2_xshift; +extern unsigned short GFXpatternFlags; +extern unsigned long gu2_rop32; +extern unsigned short gu2_blt_mode; + +void gfx_write_reg8(unsigned long offset, unsigned char value); +void gfx_write_reg16(unsigned long offset, unsigned short value); +void gfx_write_reg32(unsigned long offset, unsigned long value); +unsigned short gfx_read_reg16(unsigned long offset); +unsigned long gfx_read_reg32(unsigned long offset); +void gfx_write_vid32(unsigned long offset, unsigned long value); +unsigned long gfx_read_vid32(unsigned long offset); +unsigned long gfx_read_vip32(unsigned long offset); +void gfx_write_vip32(unsigned long offset, unsigned long value); +void gfx_mono_bitmap_to_screen_blt_swp(unsigned short srcx, + unsigned short srcy, + unsigned short dstx, + unsigned short dsty, + unsigned short width, + unsigned short height, unsigned char *data, short pitch); +unsigned int GetVideoMemSize(void); + +/* ROUTINES added accessing hardware reg */ +void +gfx_write_reg8(unsigned long offset, unsigned char value) +{ + WRITE_REG8(offset, value); +} + +void +gfx_write_reg16(unsigned long offset, unsigned short value) +{ + WRITE_REG16(offset, value); +} + +void +gfx_write_reg32(unsigned long offset, unsigned long value) +{ + WRITE_REG32(offset, value); +} +unsigned short +gfx_read_reg16(unsigned long offset) +{ + unsigned short value; + + value = READ_REG16(offset); + return value; +} +unsigned long +gfx_read_reg32(unsigned long offset) +{ + unsigned long value; + + value = READ_REG32(offset); + return value; +} + +void +gfx_write_vid32(unsigned long offset, unsigned long value) +{ + WRITE_VID32(offset, value); +} +unsigned long +gfx_read_vid32(unsigned long offset) +{ + unsigned long value; + + value = READ_VID32(offset); + return value; +} + +/*Addition for the VIP code */ +unsigned long +gfx_read_vip32(unsigned long offset) +{ + unsigned long value; + + value = READ_VIP32(offset); + return value; +} + +void +gfx_write_vip32(unsigned long offset, unsigned long value) +{ + WRITE_VIP32(offset, value); +} + +#define SWAP_BITS_IN_BYTES(v) \ + (((0x01010101 & (v)) << 7) | ((0x02020202 & (v)) << 5) | \ + ((0x04040404 & (v)) << 3) | ((0x08080808 & (v)) << 1) | \ + ((0x10101010 & (v)) >> 1) | ((0x20202020 & (v)) >> 3) | \ + ((0x40404040 & (v)) >> 5) | ((0x80808080 & (v)) >> 7)) + +#define WRITE_GPREG_STRING32_SWP(regoffset, dwords, \ + counter, array, array_offset, temp) \ +{ \ + temp = (unsigned long)array + (array_offset); \ + for (counter = 0; counter < dwords; counter++) \ + WRITE_GP32 (regoffset, \ + SWAP_BITS_IN_BYTES(*((unsigned long *)temp + counter))); \ +} + +void +gfx_mono_bitmap_to_screen_blt_swp(unsigned short srcx, unsigned short srcy, + unsigned short dstx, unsigned short dsty, + unsigned short width, unsigned short height, + unsigned char *data, short pitch) +{ + unsigned long dstoffset, size, bytes; + unsigned long offset, temp_offset, temp1 = 0, temp2 = 0; + unsigned long i, j = 0, fifo_lines, dwords_extra, bytes_extra; + unsigned long shift = 0; + + size = (((unsigned long)width) << 16) | height; + + /* CALCULATE STARTING OFFSETS */ + + offset = (unsigned long)srcy *pitch + ((unsigned long)srcx >> 3); + + dstoffset = (unsigned long)dsty *gu2_pitch + + (((unsigned long)dstx) << gu2_xshift); + + /* CHECK IF PATTERN ORIGINS NEED TO BE SET */ + + if (GFXpatternFlags) { + /* COMBINE X AND Y PATTERN ORIGINS WITH OFFSET */ + + dstoffset |= ((unsigned long)(dstx & 7)) << 26; + dstoffset |= ((unsigned long)(dsty & 7)) << 29; + } + + bytes = ((srcx & 7) + width + 7) >> 3; + fifo_lines = bytes >> 5; + dwords_extra = (bytes & 0x0000001Cl) >> 2; + bytes_extra = bytes & 0x00000003l; + + /* POLL UNTIL ABLE TO WRITE TO THE REGISTERS */ + /* Put off poll for as long as possible (do most calculations first). */ + /* The source offset is always 0 since we allow misaligned dword reads. */ + /* Need to wait for busy instead of pending, since hardware clears */ + /* the host data FIFO at the beginning of a BLT. */ + + GU2_WAIT_PENDING; + WRITE_GP32(MGP_RASTER_MODE, gu2_rop32); + WRITE_GP32(MGP_SRC_OFFSET, ((unsigned long)srcx & 7) << 26); + WRITE_GP32(MGP_DST_OFFSET, dstoffset); + WRITE_GP32(MGP_WID_HEIGHT, size); + WRITE_GP32(MGP_STRIDE, gu2_pitch); + WRITE_GP16(MGP_BLT_MODE, + gu2_blt_mode | MGP_BM_SRC_HOST | MGP_BM_SRC_MONO); + + /* WAIT FOR BLT TO BE LATCHED */ + + GU2_WAIT_PENDING; + + /* WRITE ALL OF THE DATA TO THE HOST SOURCE REGISTER */ + + while (height--) { + temp_offset = offset; + + /* WRITE ALL FULL FIFO LINES */ + + for (i = 0; i < fifo_lines; i++) { + GU2_WAIT_HALF_EMPTY; + WRITE_GPREG_STRING32_SWP(MGP_HST_SOURCE, 8, j, data, temp_offset, + temp1); + temp_offset += 32; + } + + /* WRITE ALL FULL DWORDS */ + + GU2_WAIT_HALF_EMPTY; + if (dwords_extra) { + WRITE_GPREG_STRING32_SWP(MGP_HST_SOURCE, dwords_extra, i, data, + temp_offset, temp1); + temp_offset += (dwords_extra << 2); + } + + /* WRITE REMAINING BYTES */ + + shift = 0; + if (bytes_extra) + WRITE_GPREG_STRING8(MGP_HST_SOURCE, bytes_extra, shift, i, data, + temp_offset, temp1, temp2); + + offset += pitch; + } +} + +unsigned int +GetVideoMemSize(void) +{ + unsigned int graphicsMemBaseAddr; + unsigned int totalMem = 0; + int i; + unsigned int graphicsMemMask, graphicsMemShift; + unsigned int mcBankCfg = gfx_read_reg32(0x8408); + unsigned int dimmShift = 4; + + /* Read graphics base address. */ + + graphicsMemBaseAddr = gfx_read_reg32(0x8414); + + graphicsMemMask = 0x7FF; + graphicsMemShift = 19; + + /* Calculate total memory size for GXm. */ + + for (i = 0; i < 2; i++) { + if (((mcBankCfg >> dimmShift) & 0x7) != 0x7) { + switch ((mcBankCfg >> (dimmShift + 4)) & 0x7) { + case 0: + totalMem += 0x400000; + break; + case 1: + totalMem += 0x800000; + break; + case 2: + totalMem += 0x1000000; + break; + case 3: + totalMem += 0x2000000; + break; + case 4: + totalMem += 0x4000000; + break; + case 5: + totalMem += 0x8000000; + break; + case 6: + totalMem += 0x10000000; + break; + case 7: + totalMem += 0x20000000; + break; + default: + break; + } + } + dimmShift += 16; + } + + /* Calculate graphics memory base address */ + + graphicsMemBaseAddr &= graphicsMemMask; + graphicsMemBaseAddr <<= graphicsMemShift; + + return (totalMem - graphicsMemBaseAddr); +} + +/* END OF FILE */ diff --git a/driver/xf86-video-geode/src/gx_rotate.c b/driver/xf86-video-geode/src/gx_rotate.c new file mode 100644 index 000000000..e473a3475 --- /dev/null +++ b/driver/xf86-video-geode/src/gx_rotate.c @@ -0,0 +1,190 @@ +/* Copyrightg (c) 2006 Advanced Micro Devices, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + * + * Neither the name of the Advanced Micro Devices, Inc. nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "xf86.h" +#include "shadow.h" +#include "geode.h" + +static void * +GXWindowLinear(ScreenPtr pScreen, CARD32 row, CARD32 offset, int mode, + CARD32 * size, void *closure) +{ + ScrnInfoPtr pScrni = xf86Screens[pScreen->myNum]; + GeodeRec *pGeode = GEODEPTR(pScrni); + + *size = pGeode->displayPitch; + + return (pGeode->FBBase + pGeode->displayOffset) + + row * pGeode->displayPitch + offset; +} + +static void +GXUpdate(ScreenPtr pScreen, shadowBufPtr pBuf) +{ + ScrnInfoPtr pScrni = xf86Screens[pScreen->myNum]; + GeodeRec *pGeode = GEODEPTR(pScrni); + int rotate = pGeode->rotation; + + switch (rotate) { + case RR_Rotate_90: + + if (pScrni->bitsPerPixel == 8) + shadowUpdateRotate8_90(pScreen, pBuf); + else if (pScrni->bitsPerPixel == 16) + shadowUpdateRotate16_90(pScreen, pBuf); + else + shadowUpdateRotate32_90(pScreen, pBuf); + + break; + + case RR_Rotate_180: + + if (pScrni->bitsPerPixel == 8) + shadowUpdateRotate8_180(pScreen, pBuf); + else if (pScrni->bitsPerPixel == 16) + shadowUpdateRotate16_180(pScreen, pBuf); + else + shadowUpdateRotate32_180(pScreen, pBuf); + + break; + + case RR_Rotate_270: + if (pScrni->bitsPerPixel == 8) + shadowUpdateRotate8_270(pScreen, pBuf); + else if (pScrni->bitsPerPixel == 16) + shadowUpdateRotate16_270(pScreen, pBuf); + else + shadowUpdateRotate32_270(pScreen, pBuf); + + break; + } +} + +Bool +GXRotate(ScrnInfoPtr pScrni, DisplayModePtr mode) +{ + GeodeRec *pGeode = GEODEPTR(pScrni); + Rotation curr = pGeode->rotation; + unsigned int curdw = pScrni->displayWidth; + PixmapPtr pPixmap; + BOOL ret; + + pPixmap = pScrni->pScreen->GetScreenPixmap(pScrni->pScreen); + pGeode->rotation = GXGetRotation(pScrni->pScreen); + + /* Leave if we have nothing to do */ + + if (pGeode->rotation == curr && pGeode->curMode == mode) { + return TRUE; + } + + shadowRemove(pScrni->pScreen, NULL); + + switch (pGeode->rotation) { + case RR_Rotate_0: + ErrorF("Rotate to 0 degrees\n"); + pScrni->displayWidth = pGeode->displayWidth; + pGeode->Pitch = pGeode->displayPitch; + break; + + case RR_Rotate_90: + ErrorF("Rotate to 90 degrees\n"); + pScrni->displayWidth = pScrni->pScreen->width; + break; + + case RR_Rotate_180: + ErrorF("Rotate to 180 degrees\n"); + pScrni->displayWidth = pGeode->displayWidth; + break; + + case RR_Rotate_270: + ErrorF("Rotate to 270 degrees\n"); + pScrni->displayWidth = pScrni->pScreen->width; + break; + } + + if (pGeode->rotation != RR_Rotate_0) { + + ret = + shadowAdd(pScrni->pScreen, pPixmap, GXUpdate, GXWindowLinear, + pGeode->rotation, NULL); + + if (!ret) { + ErrorF("shadowAdd failed\n"); + goto error; + } + } + + if (pGeode->rotation == RR_Rotate_0) + pScrni->fbOffset = pGeode->displayOffset; + else + pScrni->fbOffset = pGeode->shadowOffset; + + pScrni->pScreen->ModifyPixmapHeader(pPixmap, + pScrni->pScreen->width, + pScrni->pScreen->height, + pScrni->pScreen->rootDepth, + pScrni->bitsPerPixel, + PixmapBytePad(pScrni->displayWidth, pScrni->pScreen->rootDepth), + (pointer) (pGeode->FBBase + pScrni->fbOffset)); + + /* Don't use XAA pixmap cache or offscreen pixmaps when rotated */ + + if (pGeode->AccelInfoRec) { + if (pGeode->rotation == RR_Rotate_0) { + pGeode->AccelInfoRec->Flags = + LINEAR_FRAMEBUFFER | OFFSCREEN_PIXMAPS | PIXMAP_CACHE; + pGeode->AccelInfoRec->UsingPixmapCache = TRUE; + pGeode->AccelInfoRec->maxOffPixWidth = 0; + pGeode->AccelInfoRec->maxOffPixHeight = 0; + } else { + pGeode->AccelInfoRec->Flags = LINEAR_FRAMEBUFFER; + pGeode->AccelInfoRec->UsingPixmapCache = FALSE; + pGeode->AccelInfoRec->maxOffPixWidth = 1; + pGeode->AccelInfoRec->maxOffPixHeight = 1; + } + } + + return TRUE; + + error: + /* Restore the old rotation */ + pScrni->displayWidth = curdw; + + if (curr & (RR_Rotate_0 | RR_Rotate_180)) { + pScrni->pScreen->width = pScrni->virtualX; + pScrni->pScreen->height = pScrni->virtualY; + } else { + pScrni->pScreen->width = pScrni->virtualY; + pScrni->pScreen->height = pScrni->virtualX; + } + + pGeode->rotation = curr; + return FALSE; +} diff --git a/driver/xf86-video-geode/src/gx_vga.c b/driver/xf86-video-geode/src/gx_vga.c new file mode 100644 index 000000000..e5d642726 --- /dev/null +++ b/driver/xf86-video-geode/src/gx_vga.c @@ -0,0 +1,457 @@ +/* Copyright (c) 2003-2005 Advanced Micro Devices, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + * + * Neither the name of the Advanced Micro Devices, Inc. nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * */ + +/* + * This file contains routines to set modes using the VGA registers. + * Since this file is for the first generation graphics unit, it interfaces + * to SoftVGA registers. It works for both VSA1 and VSA2. + * */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include +#include + +/* VGA STRUCTURE */ + +#define GU2_STD_CRTC_REGS 25 +#define GU2_EXT_CRTC_REGS 15 +#define GU2_GDC_REGS 9 +#define GU2_SEQ_REGS 5 + +#define GU2_VGA_FLAG_MISC_OUTPUT 0x1 +#define GU2_VGA_FLAG_STD_CRTC 0x2 +#define GU2_VGA_FLAG_EXT_CRTC 0x4 +#define GU2_VGA_FLAG_GDC 0x10 +#define GU2_VGA_FLAG_SEQ 0x20 +#define GU2_VGA_FLAG_PALETTE 0x40 +#define GU2_VGA_FLAG_ATTR 0x80 + +static unsigned int GDCregs[10]; +static unsigned int SEQregs[10]; +static unsigned int palette[256]; +static unsigned int ATTRregs[32]; +static unsigned char *font_data = NULL; + +#define VGA_BLOCK 0x40000 /* 256 k */ + +void gu2_vga_extcrtc(char offset, int reset); +int gu2_get_vga_active(void); +void gu2_vga_font_data(int flag); +void gu2_set_vga(int reset); +int gu2_vga_seq_blanking(void); +int gu2_vga_attr_ctrl(int reset); +void gu2_vga_to_gfx(void); +void gu2_gfx_to_vga(int vga_mode); +int gu2_vga_seq_reset(int reset); +int gu2_vga_save(gfx_vga_struct * vga, int flags); +void gu2_vga_clear_extended(void); +int gu2_vga_restore(gfx_vga_struct * vga, int flags); + +int +gu2_get_vga_active(void) +{ + int data = gfx_read_reg32(MDC_GENERAL_CFG); + + if (data & MDC_GCFG_VGAE) + return 1; + + return 0; +} + +void +gu2_vga_font_data(int flag) +{ + if (flag == 0) { + if (font_data == NULL) { + font_data = malloc(VGA_BLOCK); + } + + DEBUGMSG(1, (0, X_NONE, "Saving VGA Data\n")); + memcpy(font_data, gfx_virt_fbptr, VGA_BLOCK); + } else if (font_data) { + DEBUGMSG(1, (0, X_NONE, "Restore VGA Data\n")); + memcpy(gfx_virt_fbptr, font_data, VGA_BLOCK); + free(font_data); + font_data = NULL; + } +} + +void +gu2_set_vga(int reset) +{ + int data = gfx_read_reg32(MDC_GENERAL_CFG); + + if (reset) + data |= MDC_GCFG_VGAE; + else + data &= ~MDC_GCFG_VGAE; + + gfx_write_reg32(MDC_GENERAL_CFG, data); +} + +int +gu2_vga_seq_blanking(void) +{ + int tmp; + + gfx_outb(0x3C4, 1); + tmp = gfx_inb(0x3C5); + tmp |= 0x20; + tmp |= tmp << 8; + gfx_outw(0x3C4, tmp); + + gfx_delay_milliseconds(1); + return (GFX_STATUS_OK); +} + +int +gu2_vga_attr_ctrl(int reset) +{ + int tmp; + + tmp = gfx_inb(0x3DA); + gfx_outb(0x3C0, (unsigned char)(reset ? 0x00 : 0x20)); + if (reset) + tmp = gfx_inb(0x3DA); + + return (GFX_STATUS_OK); +} + +void +gu2_vga_to_gfx(void) +{ + gu2_vga_attr_ctrl(0); + + gu2_vga_seq_blanking(); + gfx_delay_milliseconds(2); + + gu2_vga_extcrtc(0x3F, 1); +} + +void +gu2_gfx_to_vga(int vga_mode) +{ + int tmp; + char sequencer; + + gu2_vga_extcrtc(0x40, vga_mode); + + /* clear the display blanking bit */ + gfx_outb(MDC_SEQUENCER_INDEX, MDC_SEQUENCER_CLK_MODE); + sequencer = gfx_inb(MDC_SEQUENCER_DATA); + sequencer &= ~MDC_CLK_MODE_SCREEN_OFF; + sequencer |= 1; + gfx_outb(MDC_SEQUENCER_DATA, sequencer); + + gfx_delay_milliseconds(1); + + /*restart the sequencer */ + gfx_outw(0x3C4, 0x300); + + /* turn on the attribute controler */ + tmp = gfx_inb(0x3DA); + gfx_outb(0x3C0, 0x20); + tmp = gfx_inb(0x3DA); + + gu2_vga_extcrtc(0x3F, 0); +} + +/*--------------------------------------------------------------------------- + * gfx_vga_seq_reset + * + * This routine enables or disables SoftVGA. It is used to make SoftVGA + * "be quiet" and not interfere with any of the direct hardware access from + * Durango. For VSA1, the sequencer is reset to stop text redraws. VSA2 may + * provide a better way to have SoftVGA sit in the background. + *--------------------------------------------------------------------------- + */ +int +gu2_vga_seq_reset(int reset) +{ + gfx_outb(0x3C4, 0); + gfx_outb(0x3C5, (unsigned char)(reset ? 0x00 : 0x03)); + return (GFX_STATUS_OK); +} + +/*--------------------------------------------------------------------------- + * gfx_vga_save + * + * This routine saves the state of the VGA registers into the specified + * structure. Flags indicate what portions of the register state need to + * be saved. + *---------------------------------------------------------------------------- + */ +int +gu2_vga_save(gfx_vga_struct * vga, int flags) +{ + int i; + unsigned short crtcindex, crtcdata; + + crtcindex = (gfx_inb(0x3CC) & 0x01) ? 0x3D4 : 0x3B4; + crtcdata = crtcindex + 1; + + /* CHECK MISCELLANEOUS OUTPUT FLAG */ + + if (flags & GU2_VGA_FLAG_MISC_OUTPUT) { + /* SAVE MISCCELLANEOUS OUTPUT REGISTER */ + vga->miscOutput = gfx_inb(0x3CC); + } + + /* CHECK SEQ */ + + if (flags & GU2_VGA_FLAG_SEQ) { + /* SAVE STANDARD CRTC REGISTERS */ + for (i = 1; i < GU2_SEQ_REGS; i++) { + gfx_outb(0x3C4, (unsigned char)i); + SEQregs[i] = gfx_inb(0x3C5); + } + } + + /* CHECK STANDARD CRTC FLAG */ + + if (flags & GU2_VGA_FLAG_STD_CRTC) { + /* SAVE STANDARD CRTC REGISTERS */ + for (i = 0; i < GU2_STD_CRTC_REGS; i++) { + gfx_outb(crtcindex, (unsigned char)i); + vga->stdCRTCregs[i] = gfx_inb(crtcdata); + } + } + + /* CHECK GDC */ + + if (flags & GU2_VGA_FLAG_GDC) { + /* SAVE STANDARD CRTC REGISTERS */ + for (i = 0; i < GU2_GDC_REGS; i++) { + gfx_outb(0x3CE, (unsigned char)i); + GDCregs[i] = gfx_inb(0x3CF); + } + } + + /* CHECK EXTENDED CRTC FLAG */ + + if (flags & GU2_VGA_FLAG_EXT_CRTC) { + /* SAVE EXTENDED CRTC REGISTERS */ + for (i = 0; i < GU2_EXT_CRTC_REGS; i++) { + gfx_outb(crtcindex, (unsigned char)(0x40 + i)); + vga->extCRTCregs[i] = gfx_inb(crtcdata); + } + } + + if (flags & GU2_VGA_FLAG_PALETTE) { + /* SAVE PALETTE DATA */ + for (i = 0; i < 0x100; i++) { + gfx_outb(0x3C7, i); + palette[i] = gfx_inb(0x3C9); + } + } + + if (flags & GU2_VGA_FLAG_ATTR) { + /* SAVE Attribute DATA */ + for (i = 0; i < 21; i++) { + gfx_inb(0x3DA); + gfx_outb(0x3C0, i); + ATTRregs[i] = gfx_inb(0x3C1); + } + } + + /* save the VGA data */ + gu2_vga_font_data(0); + return (0); +} + +/*---------------------------------------------------------------------------- + * gfx_vga_clear_extended + * + * This routine clears the extended SoftVGA register values to have SoftVGA + * behave like standard VGA. + *---------------------------------------------------------------------------- + */ +void +gu2_vga_clear_extended(void) +{ + int i; + unsigned short crtcindex, crtcdata; + + crtcindex = (gfx_inb(0x3CC) & 0x01) ? 0x3D4 : 0x3B4; + crtcdata = crtcindex + 1; + + gfx_outb(crtcindex, 0x30); + gfx_outb(crtcdata, 0x57); + gfx_outb(crtcdata, 0x4C); + for (i = 0x41; i <= 0x4F; i++) { + gfx_outb(crtcindex, (unsigned char)i); + gfx_outb(crtcdata, 0); + } + + gfx_outb(crtcindex, 0x30); + gfx_outb(crtcdata, 0x00); +} + +void +gu2_vga_extcrtc(char offset, int reset) +{ + unsigned short crtcindex, crtcdata; + + crtcindex = (gfx_inb(0x3CC) & 0x01) ? 0x3D4 : 0x3B4; + crtcdata = crtcindex + 1; + + /* UNLOCK EXTENDED CRTC REGISTERS */ + + gfx_outb(crtcindex, 0x30); + gfx_outb(crtcdata, 0x57); + gfx_outb(crtcdata, 0x4C); + + /* RESTORE EXTENDED CRTC REGISTERS */ + + gfx_outb(crtcindex, offset); + gfx_outb(crtcdata, reset); +} + +/*---------------------------------------------------------------------------- + * gfx_vga_restore + * + * This routine restores the state of the VGA registers from the specified + * structure. Flags indicate what portions of the register state need to + * be saved. + *---------------------------------------------------------------------------- + */ +int +gu2_vga_restore(gfx_vga_struct * vga, int flags) +{ + int i; + unsigned short crtcindex, crtcdata; + + crtcindex = (gfx_inb(0x3CC) & 0x01) ? 0x3D4 : 0x3B4; + crtcdata = crtcindex + 1; + + /* CHECK MISCELLANEOUS OUTPUT FLAG */ + + if (flags & GU2_VGA_FLAG_MISC_OUTPUT) { + /* RESTORE MISCELLANEOUS OUTPUT REGISTER VALUE */ + gfx_outb(0x3C2, vga->miscOutput); + } + + /* CHECK SEQ */ + + if (flags & GU2_VGA_FLAG_SEQ) { + /* RESTORE STANDARD CRTC REGISTERS */ + for (i = 1; i < GU2_SEQ_REGS; i++) { + gfx_outb(0x3C4, (unsigned char)i); + gfx_outb(0x3C5, SEQregs[i]); + } + } + + /* CHECK STANDARD CRTC FLAG */ + + if (flags & GU2_VGA_FLAG_STD_CRTC) { + /* UNLOCK STANDARD CRTC REGISTERS */ + gfx_outb(crtcindex, 0x11); + gfx_outb(crtcdata, 0); + + /* RESTORE STANDARD CRTC REGISTERS */ + + for (i = 0; i < GU2_STD_CRTC_REGS; i++) { + gfx_outb(crtcindex, (unsigned char)i); + gfx_outb(crtcdata, vga->stdCRTCregs[i]); + } + } + + /* CHECK GDC */ + + if (flags & GU2_VGA_FLAG_GDC) { + /* SAVE STANDARD CRTC REGISTERS */ + for (i = 0; i < GU2_GDC_REGS; i++) { + gfx_outb(0x3CE, (unsigned char)i); + gfx_outb(0x3CF, GDCregs[i]); + } + } + + /* CHECK EXTENDED CRTC FLAG */ + + if (flags & GU2_VGA_FLAG_EXT_CRTC) { + /* UNLOCK EXTENDED CRTC REGISTERS */ + gfx_outb(crtcindex, 0x30); + gfx_outb(crtcdata, 0x57); + gfx_outb(crtcdata, 0x4C); + + /* RESTORE EXTENDED CRTC REGISTERS */ + + for (i = 1; i < GU2_EXT_CRTC_REGS; i++) { + gfx_outb(crtcindex, (unsigned char)(0x40 + i)); + gfx_outb(crtcdata, vga->extCRTCregs[i]); + } + + /* LOCK EXTENDED CRTC REGISTERS */ + + gfx_outb(crtcindex, 0x30); + gfx_outb(crtcdata, 0x00); + + /* CHECK IF DIRECT FRAME BUFFER MODE (VESA MODE) */ + + if (vga->extCRTCregs[0x03] & 1) { + /* SET BORDER COLOR TO BLACK */ + /* This really should be another thing saved/restored, but */ + /* Durango currently doesn't do the attr controller registers. */ + + gfx_inb(0x3BA); /* Reset flip-flop */ + gfx_inb(0x3DA); + gfx_outb(0x3C0, 0x11); + gfx_outb(0x3C0, 0x00); + } + } + + if (flags & GU2_VGA_FLAG_PALETTE) { + /* RESTORE PALETTE DATA */ + for (i = 0; i < 0x100; i++) { + gfx_outb(0x3C8, i); + gfx_outb(0x3C9, palette[i]); + } + } + + if (flags & GU2_VGA_FLAG_ATTR) { + /* RESTORE Attribute DATA */ + for (i = 0; i < 21; i++) { + gfx_inb(0x3DA); + gfx_outb(0x3C0, i); + gfx_outb(0x3C0, ATTRregs[i]); + } + /* SAVE Attribute DATA */ + + for (i = 0; i < 21; i++) { + gfx_inb(0x3DA); + gfx_outb(0x3C0, i); + } + } + + /* restore the VGA data */ + gu2_vga_font_data(1); + + return (0); +} + +/* END OF FILE */ diff --git a/driver/xf86-video-geode/src/gx_video.c b/driver/xf86-video-geode/src/gx_video.c new file mode 100644 index 000000000..aecb0ff14 --- /dev/null +++ b/driver/xf86-video-geode/src/gx_video.c @@ -0,0 +1,1565 @@ +/* Copyright (c) 2003-2005 Advanced Micro Devices, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and 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 + * IMPDIs2IED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + * + * Neither the name of the Advanced Micro Devices, Inc. nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * */ + +/* + * File Contents: This file consists of main Xfree video supported routines. + * + * Project: Geode Xfree Frame buffer device driver. + * */ + +/* + * Fixes & Extensions to support Y800 greyscale modes + * Alan Hourihane + + * code to allocate offscreen memory from EXA - is borrowed from Radeon + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include +#include + +#include "xf86.h" +#include "xf86_OSproc.h" +#include "xf86Resources.h" +#include "compiler.h" +#include "xf86PciInfo.h" +#include "xf86Pci.h" +#include "xf86fbman.h" +#include "regionstr.h" + +#include "geode.h" +#include "xf86xv.h" +#include +#include "xaa.h" +#include "xaalocal.h" +#include "dixstruct.h" +#include "fourcc.h" +#include "geode_fourcc.h" + +#define OFF_DELAY 200 /* milliseconds */ +#define FREE_DELAY 60000 + +#define OFF_TIMER 0x01 +#define FREE_TIMER 0x02 +#define CLIENT_VIDEO_ON 0x04 + +#define TIMER_MASK (OFF_TIMER | FREE_TIMER) +#define XV_PROFILE 0 +#define REINIT 1 + +#ifndef XvExtension +#error "It didn't work!" +void +GXInitVideo(ScreenPtr pScrn) +{ +} + +void +GXResetVideo(ScrnInfoPtr pScrni) +{ +} + +void +GXSetVideoPosition() +{ +} +#else + +#define DBUF 1 +void GXResetVideo(ScrnInfoPtr pScrni); +static XF86VideoAdaptorPtr GXSetupImageVideo(ScreenPtr); +static void GXInitOffscreenImages(ScreenPtr); +static void GXStopVideo(ScrnInfoPtr, pointer, Bool); +static int GXSetPortAttribute(ScrnInfoPtr, Atom, INT32, pointer); +static int GXGetPortAttribute(ScrnInfoPtr, Atom, INT32 *, pointer); +static void GXQueryBestSize(ScrnInfoPtr, Bool, + short, short, short, short, unsigned int *, unsigned int *, pointer); +static int GXPutImage(ScrnInfoPtr, short, short, short, short, short, short, + short, short, int, unsigned char *, short, short, Bool, + RegionPtr, pointer, DrawablePtr pDraw); + +static void GXBlockHandler(int, pointer, pointer, pointer); +void GXSetVideoPosition(int x, int y, int width, int height, + short src_w, short src_h, short drw_w, + short drw_h, int id, int offset, ScrnInfoPtr pScrni); + +extern void GXAccelSync(ScrnInfoPtr pScrni); + +int DeltaX, DeltaY; + +unsigned long graphics_lut[256]; +static int lutflag = 0; + +#define MAKE_ATOM(a) MakeAtom(a, sizeof(a) - 1, TRUE) + +static Atom xvColorKey, xvColorKeyMode, xvFilter +#if DBUF + , xvDoubleBuffer +#endif + ; + +#define PALETTE_ADDRESS 0x038 +#define PALETTE_DATA 0x040 +#define DISPLAY_CONFIG 0x008 +#define MISC 0x050 + +static void +get_gamma_ram(unsigned long *lut) +{ + + int i; + + gfx_write_vid32(PALETTE_ADDRESS, 0); + + for (i = 0; i < 256; i++) + lut[i] = gfx_read_vid32(PALETTE_DATA); +} + +/*---------------------------------------------------------------------------- + * GXInitVideo + * + * Description :This is the initialization routine.It creates a new video + * adapter and calls GXSetupImageVideo to initialize the adaptor + * by filling XF86VideoAdaptorREc.Then it lists the existing + * adaptors and adds the new one to it. Finally the list of + * XF86VideoAdaptorPtr pointers are passed to the + * xf86XVScreenInit(). + * + * Parameters. + * pScrn :Screen handler pointer having screen information. + * + * Returns :none + * + * Comments :none + *---------------------------------------------------------------------------- + */ +void +GXInitVideo(ScreenPtr pScrn) +{ + GeodeRec *pGeode; + ScrnInfoPtr pScrni = xf86Screens[pScrn->myNum]; + + pGeode = GEODEPTR(pScrni); + + if (!pGeode->NoAccel) { + XF86VideoAdaptorPtr *adaptors, *newAdaptors = NULL; + XF86VideoAdaptorPtr newAdaptor = NULL; + + int num_adaptors; + + newAdaptor = GXSetupImageVideo(pScrn); + GXInitOffscreenImages(pScrn); + + num_adaptors = xf86XVListGenericAdaptors(pScrni, &adaptors); + + if (newAdaptor) { + if (!num_adaptors) { + num_adaptors = 1; + adaptors = &newAdaptor; + } else { + newAdaptors = /* need to free this someplace */ + xalloc((num_adaptors + + 1) * sizeof(XF86VideoAdaptorPtr *)); + if (newAdaptors) { + memcpy(newAdaptors, adaptors, num_adaptors * + sizeof(XF86VideoAdaptorPtr)); + newAdaptors[num_adaptors] = newAdaptor; + adaptors = newAdaptors; + num_adaptors++; + } + } + } + + if (num_adaptors) + xf86XVScreenInit(pScrn, adaptors, num_adaptors); + + if (newAdaptors) + xfree(newAdaptors); + } +} + +/* client libraries expect an encoding */ +static XF86VideoEncodingRec DummyEncoding[1] = { + { + 0, + "XV_IMAGE", + 1024, 1024, + {1, 1} + } +}; + +#define NUM_FORMATS 4 + +static XF86VideoFormatRec Formats[NUM_FORMATS] = { + {8, PseudoColor}, {15, TrueColor}, {16, TrueColor}, {24, TrueColor} +}; + +#if DBUF +#define NUM_ATTRIBUTES 4 +#else +#define NUM_ATTRIBUTES 3 +#endif + +static XF86AttributeRec Attributes[NUM_ATTRIBUTES] = { +#if DBUF + {XvSettable | XvGettable, 0, 1, "XV_DOUBLE_BUFFER"}, +#endif + {XvSettable | XvGettable, 0, (1 << 24) - 1, "XV_COLORKEY"}, + {XvSettable | XvGettable, 0, 1, "XV_FILTER"}, + {XvSettable | XvGettable, 0, 1, "XV_COLORKEYMODE"} +}; + +#define NUM_IMAGES 8 + +static XF86ImageRec Images[NUM_IMAGES] = { + XVIMAGE_UYVY, + XVIMAGE_YUY2, + XVIMAGE_Y2YU, + XVIMAGE_YVYU, + XVIMAGE_Y800, + XVIMAGE_I420, + XVIMAGE_YV12, + XVIMAGE_RGB565 +}; + +typedef struct +{ + void *area; + int offset; + RegionRec clip; + CARD32 filter; + CARD32 colorKey; + CARD32 colorKeyMode; + CARD32 videoStatus; + Time offTime; + Time freeTime; +#if DBUF + Bool doubleBuffer; + int currentBuffer; +#endif +} GeodePortPrivRec, *GeodePortPrivPtr; + +#define GET_PORT_PRIVATE(pScrni) \ + (GeodePortPrivRec *)((GEODEPTR(pScrni))->adaptor->pPortPrivates[0].ptr) + +/*---------------------------------------------------------------------------- + * GXSetColorKey + * + * Description :This function reads the color key for the pallete and + * sets the video color key register. + * + * Parameters. + * ScreenInfoPtr + * pScrni :Screen pointer having screen information. + * pPriv :Video port private data + * + * Returns :none + * + * Comments :none + * + *---------------------------------------------------------------------------- + */ +static INT32 +GXSetColorkey(ScrnInfoPtr pScrni, GeodePortPrivRec * pPriv) +{ + int red, green, blue; + unsigned long key; + + switch (pScrni->depth) { + case 8: + GFX(get_display_palette_entry(pPriv->colorKey & 0xFF, &key)); + red = ((key >> 16) & 0xFF); + green = ((key >> 8) & 0xFF); + blue = (key & 0xFF); + break; + case 16: + red = (pPriv->colorKey & pScrni->mask.red) >> + pScrni->offset.red << (8 - pScrni->weight.red); + green = (pPriv->colorKey & pScrni->mask.green) >> + pScrni->offset.green << (8 - pScrni->weight.green); + blue = (pPriv->colorKey & pScrni->mask.blue) >> + pScrni->offset.blue << (8 - pScrni->weight.blue); + break; + default: + /* for > 16 bpp we send in the mask in xf86SetWeight. This + * function is providing the offset by 1 more. So we take + * this as a special case and subtract 1 for > 16 + */ + red = (pPriv->colorKey & pScrni->mask.red) >> + (pScrni->offset.red - 1) << (8 - pScrni->weight.red); + green = (pPriv->colorKey & pScrni->mask.green) >> + (pScrni->offset.green - 1) << (8 - pScrni->weight.green); + blue = (pPriv->colorKey & pScrni->mask.blue) >> + (pScrni->offset.blue - 1) << (8 - pScrni->weight.blue); + break; + } + + GFX(set_video_color_key((blue | (green << 8) | (red << 16)), 0xFFFFFF, + (pPriv->colorKeyMode == 0))); + REGION_EMPTY(pScrni->pScreen, &pPriv->clip); + return 0; +} + +/*---------------------------------------------------------------------------- + * GXResetVideo + * + * Description : This function resets the video + * + * Parameters. + * pScrni :Screen pointer having screen information. + * + * Returns :None + * + * Comments :none + * + *---------------------------------------------------------------------------- + */ +void +GXResetVideo(ScrnInfoPtr pScrni) +{ + GeodeRec *pGeode = GEODEPTR(pScrni); + + if (!pGeode->NoAccel) { + GeodePortPrivRec *pPriv = pGeode->adaptor->pPortPrivates[0].ptr; + + GXAccelSync(pScrni); + GXSetColorkey(pScrni, pPriv); + GFX(set_video_filter(pPriv->filter, pPriv->filter)); + } +} + +/*---------------------------------------------------------------------------- + * GXSetupImageVideo + * + * Description : This function allocates space for a Videoadaptor and + * initializes the XF86VideoAdaptorPtr record. + * + * Parameters. + * pScrn :Screen handler pointer having screen information. + * + * Returns :pointer to the initialized video adaptor record. + * + * Comments :none + *---------------------------------------------------------------------------- + */ +static XF86VideoAdaptorPtr +GXSetupImageVideo(ScreenPtr pScrn) +{ + ScrnInfoPtr pScrni = xf86Screens[pScrn->myNum]; + GeodeRec *pGeode = GEODEPTR(pScrni); + XF86VideoAdaptorPtr adapt; + GeodePortPrivRec *pPriv; + + if (!(adapt = xcalloc(1, sizeof(XF86VideoAdaptorRec) + + sizeof(GeodePortPrivRec) + sizeof(DevUnion)))) + return NULL; + + adapt->type = XvWindowMask | XvInputMask | XvImageMask; + adapt->flags = VIDEO_OVERLAID_IMAGES | VIDEO_CLIP_TO_VIEWPORT; + adapt->name = "Advanced Micro Devices"; + adapt->nEncodings = 1; + adapt->pEncodings = DummyEncoding; + adapt->nFormats = NUM_FORMATS; + adapt->pFormats = Formats; + adapt->nPorts = 1; + adapt->pPortPrivates = (DevUnion *) (&adapt[1]); + pPriv = (GeodePortPrivRec *) (&adapt->pPortPrivates[1]); + adapt->pPortPrivates[0].ptr = (pointer) (pPriv); + adapt->pAttributes = Attributes; + adapt->nImages = NUM_IMAGES; + adapt->nAttributes = NUM_ATTRIBUTES; + adapt->pImages = Images; + adapt->PutVideo = NULL; + adapt->PutStill = NULL; + adapt->GetVideo = NULL; + adapt->GetStill = NULL; + adapt->StopVideo = GXStopVideo; + adapt->SetPortAttribute = GXSetPortAttribute; + adapt->GetPortAttribute = GXGetPortAttribute; + adapt->QueryBestSize = GXQueryBestSize; + adapt->PutImage = GXPutImage; + adapt->QueryImageAttributes = GeodeQueryImageAttributes; + + pPriv->filter = 0; + pPriv->colorKey = pGeode->videoKey; + pPriv->colorKeyMode = 0; + pPriv->videoStatus = 0; +#if DBUF + pPriv->doubleBuffer = TRUE; + pPriv->currentBuffer = 0; /* init to first buffer */ +#endif + + /* gotta uninit this someplace */ +#if defined(REGION_NULL) + REGION_NULL(pScrn, &pPriv->clip); +#else + REGION_INIT(pScrn, &pPriv->clip, NullBox, 0); +#endif + + pGeode->adaptor = adapt; + + pGeode->BlockHandler = pScrn->BlockHandler; + pScrn->BlockHandler = GXBlockHandler; + + xvColorKey = MAKE_ATOM("XV_COLORKEY"); + xvColorKeyMode = MAKE_ATOM("XV_COLORKEYMODE"); + xvFilter = MAKE_ATOM("XV_FILTER"); +#if DBUF + xvDoubleBuffer = MAKE_ATOM("XV_DOUBLE_BUFFER"); +#endif + + GXResetVideo(pScrni); + + return adapt; +} + +/*---------------------------------------------------------------------------- + * GXStopVideo + * + * Description :This function is used to stop input and output video + * + * Parameters. + * pScrni :Screen handler pointer having screen information. + * data :Pointer to the video port's private data + * exit :Flag indicating whether the offscreen areas used for + * video to be deallocated or not. + * + * Returns :none + * + * Comments :none + *---------------------------------------------------------------------------- + */ +static void +GXStopVideo(ScrnInfoPtr pScrni, pointer data, Bool exit) +{ + GeodePortPrivRec *pPriv = (GeodePortPrivRec *) data; + GeodeRec *pGeode = GEODEPTR(pScrni); + + REGION_EMPTY(pScrni->pScreen, &pPriv->clip); + + GXAccelSync(pScrni); + if (exit) { + if (pPriv->videoStatus & CLIENT_VIDEO_ON) { + GFX(set_video_enable(0)); + + /* If we have saved graphics LUT data - restore it */ + /* Otherwise, turn bypass on */ + + if (lutflag) + GFX(set_graphics_palette(graphics_lut)); + else + GFX(set_video_palette_bypass(1)); + + lutflag = 0; + } + + if (pPriv->area) { +#ifdef XF86EXA + if (pGeode->useEXA) + exaOffscreenFree(pScrni->pScreen, pPriv->area); +#endif + + if (!pGeode->useEXA) + xf86FreeOffscreenArea(pPriv->area); + + pPriv->area = NULL; + } + + pPriv->videoStatus = 0; + pGeode->OverlayON = FALSE; + } else { + if (pPriv->videoStatus & CLIENT_VIDEO_ON) { + pPriv->videoStatus |= OFF_TIMER; + pPriv->offTime = currentTime.milliseconds + OFF_DELAY; + } + } +} + +/*---------------------------------------------------------------------------- + * GXSetPortAttribute + * + * Description :This function is used to set the attributes of a port + * like colorkeymode, double buffer support and filter. + * + * Parameters. + * pScrni :Screen handler pointer having screen information. + * data :Pointer to the video port's private data + * attribute :The port attribute to be set + * value :Value of the attribute to be set. + * + * Returns :Sucess if the attribute is supported, else BadMatch + * + * Comments :none + *---------------------------------------------------------------------------- + */ +static int +GXSetPortAttribute(ScrnInfoPtr pScrni, + Atom attribute, INT32 value, pointer data) +{ + GeodePortPrivRec *pPriv = (GeodePortPrivRec *) data; + + GXAccelSync(pScrni); + if (attribute == xvColorKey) { + pPriv->colorKey = value; + GXSetColorkey(pScrni, pPriv); + } +#if DBUF + else if (attribute == xvDoubleBuffer) { + if ((value < 0) || (value > 1)) + return BadValue; + pPriv->doubleBuffer = value; + } +#endif + else if (attribute == xvColorKeyMode) { + pPriv->colorKeyMode = value; + GXSetColorkey(pScrni, pPriv); + } else if (attribute == xvFilter) { + if ((value < 0) || (value > 1)) + return BadValue; + pPriv->filter = value; + } else + return BadMatch; + + return Success; +} + +/*---------------------------------------------------------------------------- + * GXGetPortAttribute + * + * Description :This function is used to get the attributes of a port + * like hue, saturation,brightness or contrast. + * + * Parameters. + * pScrni :Screen handler pointer having screen information. + * data :Pointer to the video port's private data + * attribute :The port attribute to be read + * value :Pointer to the value of the attribute to be read. + * + * Returns :Sucess if the attribute is supported, else BadMatch + * + * Comments :none + *---------------------------------------------------------------------------- + */ +static int +GXGetPortAttribute(ScrnInfoPtr pScrni, + Atom attribute, INT32 * value, pointer data) +{ + GeodePortPrivRec *pPriv = (GeodePortPrivRec *) data; + + if (attribute == xvColorKey) { + *value = pPriv->colorKey; + } +#if DBUF + else if (attribute == xvDoubleBuffer) { + *value = (pPriv->doubleBuffer) ? 1 : 0; + } +#endif + else if (attribute == xvColorKeyMode) { + *value = pPriv->colorKeyMode; + } else if (attribute == xvFilter) { + *value = pPriv->filter; + } else + return BadMatch; + + return Success; +} + +/*---------------------------------------------------------------------------- + * GXQueryBestSize + * + * Description :This function provides a way to query what the + * destination dimensions would end up being if they were to + * request that an area vid_w by vid_h from the video stream + * be scaled to rectangle of drw_w by drw_h on the screen. + * + * Parameters. + * pScrni :Screen handler pointer having screen information. + * data :Pointer to the video port's private data + * vid_w,vid_h :Width and height of the video data. + * drw_w,drw_h :Width and height of the scaled rectangle. + * p_w,p_h :Width and height of the destination rectangle. + * + * Returns :None + * + * Comments :None + *---------------------------------------------------------------------------- + */ +static void +GXQueryBestSize(ScrnInfoPtr pScrni, + Bool motion, + short vid_w, short vid_h, + short drw_w, short drw_h, + unsigned int *p_w, unsigned int *p_h, pointer data) +{ + *p_w = drw_w; + *p_h = drw_h; + + if (*p_w > 16384) + *p_w = 16384; +} + +/*---------------------------------------------------------------------------- + * GXCopyData420 + * + * Description : Copies data from src to destination + * + * Parameters. + * src : pointer to the source data + * dst : pointer to destination data + * srcPitch : pitch of the srcdata + * dstPitch : pitch of the destination data + * h & w : height and width of source data + * + * Returns :None + * + * Comments :None + *---------------------------------------------------------------------------- + */ +static void +GXCopyData420(unsigned char *src, unsigned char *dst, + int srcPitch, int dstPitch, int h, int w) +{ + while (h--) { + memcpy(dst, src, w); + src += srcPitch; + dst += dstPitch; + } +} + +/*---------------------------------------------------------------------------- + * GXCopyData422 + * + * Description : Copies data from src to destination + * + * Parameters. + * src : pointer to the source data + * dst : pointer to destination data + * srcPitch : pitch of the srcdata + * dstPitch : pitch of the destination data + * h & w : height and width of source data + * + * Returns :None + * + * Comments :None + *---------------------------------------------------------------------------- + */ +static void +GXCopyData422(unsigned char *src, unsigned char *dst, + int srcPitch, int dstPitch, int h, int w) +{ + w <<= 1; + while (h--) { + memcpy(dst, src, w); + src += srcPitch; + dst += dstPitch; + } +} + +#ifdef XF86EXA +static void +GXVideoSave(ScreenPtr pScreen, ExaOffscreenArea * area) +{ + ScrnInfoPtr pScrni = xf86Screens[pScreen->myNum]; + GeodePortPrivRec *pPriv = GET_PORT_PRIVATE(pScrni); + + if (area == pPriv->area) + pPriv->area = NULL; +} +#endif + +static int +GXAllocateMemory(ScrnInfoPtr pScrni, void **memp, int numlines) +{ + ScreenPtr pScrn = screenInfo.screens[pScrni->scrnIndex]; + GeodeRec *pGeode = GEODEPTR(pScrni); + + //long displayWidth = pGeode->Pitch / ((pScrni->bitsPerPixel + 7) / 8); + int size = numlines * pGeode->displayWidth; + +#if XF86EXA + if (pGeode->useEXA) { + ExaOffscreenArea *area = *memp; + + if (area != NULL) { + if (area->size >= size) + return area->offset; + + exaOffscreenFree(pScrni->pScreen, area); + } + + area = exaOffscreenAlloc(pScrni->pScreen, size, 16, + TRUE, GXVideoSave, NULL); + *memp = area; + + return area == NULL ? 0 : area->offset; + } +#endif + + if (!pGeode->useEXA) { + FBAreaPtr area = *memp; + FBAreaPtr new_area; + + if (area) { + if ((area->box.y2 - area->box.y1) >= numlines) + return (area->box.y1 * pGeode->Pitch); + + if (xf86ResizeOffscreenArea(area, pGeode->displayWidth, numlines)) + return (area->box.y1 * pGeode->Pitch); + + xf86FreeOffscreenArea(area); + } + + new_area = xf86AllocateOffscreenArea(pScrn, pGeode->displayWidth, + numlines, 0, NULL, NULL, NULL); + + if (!new_area) { + int max_w, max_h; + + xf86QueryLargestOffscreenArea(pScrn, &max_w, &max_h, 0, + FAVOR_WIDTH_THEN_AREA, PRIORITY_EXTREME); + + if ((max_w < pGeode->displayWidth) || (max_h < numlines)) { + xf86DrvMsg(pScrni->scrnIndex, X_ERROR, + "No room - how sad %x, %x, %x, %x\n", max_w, + pGeode->displayWidth, max_h, numlines); + return 0; + } + + xf86PurgeUnlockedOffscreenAreas(pScrn); + new_area = xf86AllocateOffscreenArea(pScrn, pGeode->displayWidth, + numlines, 0, NULL, NULL, NULL); + } + + return (new_area->box.y1 * pGeode->Pitch); + } + + return 0; +} + +static BoxRec dstBox; +static int srcPitch = 0, srcPitch2 = 0, dstPitch = 0, dstPitch2 = 0; +static INT32 Bx1, Bx2, By1, By2; +static int top, left, npixels, nlines; +static int offset, s1offset = 0, s2offset = 0, s3offset = 0; +static unsigned char *dst_start; +static int d2offset = 0, d3offset = 0; + +#if 0 +static Bool +RegionsIntersect(BoxPtr pRcl1, BoxPtr pRcl2, BoxPtr pRclResult) +{ + pRclResult->x1 = max(pRcl1->x1, pRcl2->x1); + pRclResult->x2 = min(pRcl1->x2, pRcl2->x2); + + if (pRclResult->x1 <= pRclResult->x2) { + pRclResult->y1 = max(pRcl1->y1, pRcl2->y1); + pRclResult->y2 = min(pRcl1->y2, pRcl2->y2); + + if (pRclResult->y1 <= pRclResult->y2) { + return (TRUE); + } + } + + return (FALSE); +} +#endif + +void +GXSetVideoPosition(int x, int y, int width, int height, + short src_w, short src_h, short drw_w, short drw_h, + int id, int offset, ScrnInfoPtr pScrni) +{ + GeodeRec *pGeode = GEODEPTR(pScrni); + long ystart, xend, yend; + unsigned long lines = 0; + unsigned long y_extra, uv_extra = 0; + unsigned long startAddress; + +#if 0 + BoxRec ovly, display, result; +#endif + + xend = x + drw_w; + yend = y + drw_h; + + /* Take care of panning when panel is present */ + + startAddress = gfx_get_display_offset() - pGeode->FBOffset; + DeltaY = startAddress / pGeode->Pitch; + DeltaX = startAddress & (pGeode->Pitch - 1); + DeltaX /= (pScrni->bitsPerPixel >> 3); + +#if 0 + /* Thhis code is pretty dang broken - comment it out for now */ + + if (pGeode->Panel) { + ovly.x1 = x; + ovly.x2 = x + pGeode->video_dstw; + ovly.y1 = y; + ovly.y2 = y + pGeode->video_dsth; + + display.x1 = DeltaX; + display.x2 = DeltaX + pGeode->FPBX; + display.y1 = DeltaY; + display.y2 = DeltaY + pGeode->FPBY; + x = xend = 0; + if (RegionsIntersect(&display, &ovly, &result)) { + x = ovly.x1 - DeltaX; + xend = ovly.x2 - DeltaX; + y = ovly.y1 - DeltaY; + yend = ovly.y2 - DeltaY; + } + } +#endif + + /* TOP CLIPPING */ + + if (y < 0) { + if (src_h < drw_h) + lines = (-y) * src_h / drw_h; + else + lines = (-y); + ystart = 0; + drw_h += y; + y_extra = lines * dstPitch; + uv_extra = (lines >> 1) * (dstPitch2); + } else { + ystart = y; + lines = 0; + y_extra = 0; + } + + GFX(set_video_window(x, ystart, xend - x, yend - ystart)); + + if ((id == FOURCC_Y800) || (id == FOURCC_I420) || (id == FOURCC_YV12)) { + GFX(set_video_yuv_offsets(offset + y_extra, + offset + d3offset + uv_extra, offset + d2offset + uv_extra)); + } else { + GFX(set_video_offset(offset + y_extra)); + } +} + +/*---------------------------------------------------------------------------- + * GXDisplayVideo + * + * Description :This function sets up the video registers for playing video + * It sets up the video format,width, height & position of the + * video window ,video offsets( y,u,v) and video pitches(y,u,v) + * + * Parameters + * + * Returns :None + * + * Comments :None + *---------------------------------------------------------------------------- + */ + +static void +GXDisplayVideo(ScrnInfoPtr pScrni, + int id, + int offset, + short width, short height, + int pitch, + int x1, int y1, int x2, int y2, + BoxPtr dstBox, short src_w, short src_h, short drw_w, short drw_h) +{ + GeodeRec *pGeode = GEODEPTR(pScrni); + unsigned long dcfg, misc; + + GXAccelSync(pScrni); + + /* If the gamma LUT is already loaded with graphics data, then save it + * off + */ + + if (id != FOURCC_RGB565) { + dcfg = gfx_read_vid32(DISPLAY_CONFIG); + misc = gfx_read_vid32(MISC); + + lutflag = (!(misc & 1) && (dcfg & (1 << 21))); + + if (lutflag) + get_gamma_ram(graphics_lut); + + /* Set the video gamma ram */ + GFX(set_video_palette(NULL)); + } + + GFX(set_video_enable(1)); + + switch (id) { + case FOURCC_UYVY: /* UYVY */ + GFX(set_video_format(VIDEO_FORMAT_UYVY)); + GFX(set_video_size(width, height)); + break; + case FOURCC_Y800: /* Y800 - greyscale - we munge it! */ + case FOURCC_YV12: /* YV12 */ + case FOURCC_I420: /* I420 */ + GFX(set_video_format(VIDEO_FORMAT_Y0Y1Y2Y3)); + GFX(set_video_size(width, height)); + GFX(set_video_yuv_pitch(dstPitch, dstPitch2)); + break; + case FOURCC_YUY2: /* YUY2 */ + GFX(set_video_format(VIDEO_FORMAT_YUYV)); + GFX(set_video_size(width, height)); + break; + case FOURCC_Y2YU: /* Y2YU */ + GFX(set_video_format(VIDEO_FORMAT_Y2YU)); + GFX(set_video_size(width, height)); + break; + case FOURCC_YVYU: /* YVYU */ + GFX(set_video_format(VIDEO_FORMAT_YVYU)); + GFX(set_video_size(width, height)); + break; + case FOURCC_RGB565: + GFX(set_video_format(VIDEO_FORMAT_RGB)); + GFX(set_video_size(width, height)); + break; + + } + + if (pGeode->Panel) { + pGeode->video_x = dstBox->x1; + pGeode->video_y = dstBox->y1; + pGeode->video_w = width; + pGeode->video_h = height; + pGeode->video_srcw = src_w; + pGeode->video_srch = src_h; + pGeode->video_dstw = drw_w; + pGeode->video_dsth = drw_h; + pGeode->video_offset = offset; + pGeode->video_id = id; + pGeode->video_scrnptr = pScrni; + } + + if ((drw_w >= src_w) && (drw_h >= src_h)) + GFX(set_video_scale(width, height, drw_w, drw_h)); + else if (drw_w < src_w) + GFX(set_video_scale(drw_w, height, drw_w, drw_h)); + else if (drw_h < src_h) + GFX(set_video_scale(width, drw_h, drw_w, drw_h)); + + GXSetVideoPosition(dstBox->x1, dstBox->y1, width, height, src_w, + src_h, drw_w, drw_h, id, offset, pScrni); +} + +/* Used by LX as well */ + +Bool +RegionsEqual(RegionPtr A, RegionPtr B) +{ + int *dataA, *dataB; + int num; + + num = REGION_NUM_RECTS(A); + if (num != REGION_NUM_RECTS(B)) { + return FALSE; + } + + if ((A->extents.x1 != B->extents.x1) || + (A->extents.x2 != B->extents.x2) || + (A->extents.y1 != B->extents.y1) || (A->extents.y2 != B->extents.y2)) + return FALSE; + + dataA = (int *)REGION_RECTS(A); + dataB = (int *)REGION_RECTS(B); + + while (num--) { + if ((dataA[0] != dataB[0]) || (dataA[1] != dataB[1])) + return FALSE; + + dataA += 2; + dataB += 2; + } + + return TRUE; +} + +/*---------------------------------------------------------------------------- + * GXPutImage :This function writes a single frame of video into a + * drawable. The position and size of the source rectangle is + * specified by src_x,src_y, src_w and src_h. This data is + * stored in a system memory buffer at buf. The position and + * size of the destination rectangle is specified by drw_x, + * drw_y,drw_w,drw_h.The data is in the format indicated by the + * image descriptor and represents a source of size width by + * height. If sync is TRUE the driver should not return from + * this function until it is through reading the data from buf. + * Returning when sync is TRUE indicates that it is safe for the + * data at buf to be replaced,freed, or modified. + * + * Parameters. + * + * Returns :None + * + * Comments :None + *---------------------------------------------------------------------------- + */ + +static int +GXPutImage(ScrnInfoPtr pScrni, + 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, + DrawablePtr pDraw) +{ + GeodePortPrivRec *pPriv = (GeodePortPrivRec *) data; + GeodeRec *pGeode = GEODEPTR(pScrni); + int new_h; + +#if REINIT + BOOL ReInitVideo = FALSE; + static BOOL DoReinitAgain = 0; +#endif + +#if XV_PROFILE + long oldtime, newtime; + + UpdateCurrentTime(); + oldtime = currentTime.milliseconds; +#endif + +#if REINIT +/* update cliplist */ + if (!RegionsEqual(&pPriv->clip, clipBoxes)) { + ReInitVideo = TRUE; + } + + if (DoReinitAgain) + ReInitVideo = TRUE; + + if (ReInitVideo) { + DEBUGMSG(1, (0, X_NONE, "Regional Not Equal - Init\n")); +#endif + DoReinitAgain = ~DoReinitAgain; + if (drw_w > 16384) + drw_w = 16384; + + /* Clip */ + Bx1 = src_x; + Bx2 = src_x + src_w; + By1 = src_y; + By2 = src_y + src_h; + + if ((Bx1 >= Bx2) || (By1 >= By2)) + return Success; + + dstBox.x1 = drw_x; + dstBox.x2 = drw_x + drw_w; + dstBox.y1 = drw_y; + dstBox.y2 = drw_y + drw_h; + + dstBox.x1 -= pScrni->frameX0; + dstBox.x2 -= pScrni->frameX0; + dstBox.y1 -= pScrni->frameY0; + dstBox.y2 -= pScrni->frameY0; + + switch (id) { + case FOURCC_YV12: + case FOURCC_I420: + srcPitch = (width + 3) & ~3; /* of luma */ + dstPitch = (width + 31) & ~31; + + s2offset = srcPitch * height; + d2offset = dstPitch * height; + + srcPitch2 = ((width >> 1) + 3) & ~3; + dstPitch2 = ((width >> 1) + 15) & ~15; + + s3offset = (srcPitch2 * (height >> 1)) + s2offset; + d3offset = (dstPitch2 * (height >> 1)) + d2offset; + + new_h = dstPitch * height; /* Y */ + new_h += (dstPitch2 * height); /* U+V */ + new_h += pGeode->Pitch - 1; + new_h /= pGeode->Pitch; + break; + case FOURCC_UYVY: + case FOURCC_YUY2: + case FOURCC_Y800: + case FOURCC_RGB565: + default: + dstPitch = ((width << 1) + 3) & ~3; + srcPitch = (width << 1); + new_h = ((dstPitch * height) + pGeode->Pitch - 1) / pGeode->Pitch; + break; + } +#if DBUF + if (pPriv->doubleBuffer) + new_h <<= 1; +#endif + + if (!(pPriv->offset = GXAllocateMemory(pScrni, &pPriv->area, new_h))) { + xf86DrvMsg(pScrni->scrnIndex, X_ERROR, + "Could not allocate area of size %d\n", new_h); + return BadAlloc; + } + + /* copy data */ + top = By1; + left = Bx1 & ~1; + npixels = ((Bx2 + 1) & ~1) - left; + + switch (id) { + case FOURCC_YV12: + case FOURCC_I420: + { + int tmp; + + top &= ~1; + + offset = pPriv->offset + (top * dstPitch); + +#if DBUF + if (pPriv->doubleBuffer && pPriv->currentBuffer) + offset += (new_h >> 1) * pGeode->Pitch; +#endif + dst_start = pGeode->FBBase + offset + left; + tmp = ((top >> 1) * srcPitch2) + (left >> 1); + s2offset += tmp; + s3offset += tmp; + if (id == FOURCC_I420) { + tmp = s2offset; + s2offset = s3offset; + s3offset = tmp; + } + nlines = ((By2 + 1) & ~1) - top; + } + break; + case FOURCC_UYVY: + case FOURCC_YUY2: + case FOURCC_Y800: + case FOURCC_RGB565: + default: + left <<= 1; + buf += (top * srcPitch) + left; + nlines = By2 - top; + offset = (pPriv->offset) + (top * dstPitch); + +#if DBUF + if (pPriv->doubleBuffer && pPriv->currentBuffer) + offset += (new_h >> 1) * pGeode->Pitch; +#endif + dst_start = pGeode->FBBase + offset + left; + break; + } + s1offset = (top * srcPitch) + left; +#if REINIT + /* update cliplist */ + REGION_COPY(pScrni->pScreen, &pPriv->clip, clipBoxes); + + if (pPriv->colorKeyMode == 0) { + xf86XVFillKeyHelper(pScrni->pScreen, pPriv->colorKey, clipBoxes); + } + + GXDisplayVideo(pScrni, id, offset, width, height, dstPitch, + Bx1, By1, Bx2, By2, &dstBox, src_w, src_h, drw_w, drw_h); + } +#endif + switch (id) { + case FOURCC_Y800: + /* This is shared between LX and GX, so it lives in amd_common.c */ + GeodeCopyGreyscale(buf, dst_start, srcPitch, dstPitch, nlines, + npixels); + break; + case FOURCC_YV12: + case FOURCC_I420: + GXCopyData420(buf + s1offset, dst_start, srcPitch, dstPitch, nlines, + npixels); + GXCopyData420(buf + s2offset, dst_start + d2offset, srcPitch2, + dstPitch2, nlines >> 1, npixels >> 1); + GXCopyData420(buf + s3offset, dst_start + d3offset, srcPitch2, + dstPitch2, nlines >> 1, npixels >> 1); + break; + case FOURCC_UYVY: + case FOURCC_YUY2: + case FOURCC_RGB565: + default: + GXCopyData422(buf, dst_start, srcPitch, dstPitch, nlines, npixels); + break; + } +#if !REINIT + /* update cliplist */ + REGION_COPY(pScrni->pScreen, &pPriv->clip, clipBoxes); + if (pPriv->colorKeyMode == 0) { + /* draw these */ + XAAFillSolidRects(pScrni, pPriv->colorKey, GXcopy, ~0, + REGION_NUM_RECTS(clipBoxes), REGION_RECTS(clipBoxes)); + } + + GXDisplayVideo(pScrni, id, offset, width, height, dstPitch, + Bx1, By1, Bx2, By2, &dstBox, src_w, src_h, drw_w, drw_h); +#endif + +#if XV_PROFILE + UpdateCurrentTime(); + newtime = currentTime.milliseconds; + DEBUGMSG(1, (0, X_NONE, "PI %d\n", newtime - oldtime)); +#endif + +#if DBUF + pPriv->currentBuffer ^= 1; +#endif + + pPriv->videoStatus = CLIENT_VIDEO_ON; + pGeode->OverlayON = TRUE; + return Success; +} + +/*---------------------------------------------------------------------------- + * GXQueryImageAttributes + * + * Description :This function is called to let the driver specify how data + * for a particular image of size width by height should be + * stored. + * + * Parameters. + * pScrni :Screen handler pointer having screen information. + * id :Id for the video format + * width :width of the image (can be modified by the driver) + * height :height of the image (can be modified by the driver) + * Returns : Size of the memory required for storing this image + * + * Comments :None + * + *---------------------------------------------------------------------------- + */ + +int +GeodeQueryImageAttributes(ScrnInfoPtr pScrni, + int id, unsigned short *w, unsigned short *h, int *pitches, int *offsets) +{ + int size; + int tmp; + + DEBUGMSG(0, (0, X_NONE, "QueryImageAttributes %X\n", id)); + + if (*w > 1024) + *w = 1024; + if (*h > 1024) + *h = 1024; + + *w = (*w + 1) & ~1; + if (offsets) + offsets[0] = 0; + + switch (id) { + case FOURCC_YV12: + case FOURCC_I420: + *h = (*h + 1) & ~1; + size = (*w + 3) & ~3; + if (pitches) + pitches[0] = size; + + size *= *h; + if (offsets) + offsets[1] = size; + + tmp = ((*w >> 1) + 3) & ~3; + if (pitches) + pitches[1] = pitches[2] = tmp; + + tmp *= (*h >> 1); + size += tmp; + if (offsets) + offsets[2] = size; + + size += tmp; + break; + case FOURCC_UYVY: + case FOURCC_YUY2: + case FOURCC_Y800: + default: + size = *w << 1; + if (pitches) + pitches[0] = size; + + size *= *h; + break; + } + return size; +} + +static void +GXBlockHandler(int i, pointer blockData, pointer pTimeout, pointer pReadmask) +{ + ScreenPtr pScrn = screenInfo.screens[i]; + ScrnInfoPtr pScrni = xf86Screens[i]; + GeodeRec *pGeode = GEODEPTR(pScrni); + GeodePortPrivRec *pPriv = GET_PORT_PRIVATE(pScrni); + + pScrn->BlockHandler = pGeode->BlockHandler; + (*pScrn->BlockHandler) (i, blockData, pTimeout, pReadmask); + pScrn->BlockHandler = GXBlockHandler; + + if (pPriv->videoStatus & TIMER_MASK) { + GXAccelSync(pScrni); + UpdateCurrentTime(); + if (pPriv->videoStatus & OFF_TIMER) { + if (pPriv->offTime < currentTime.milliseconds) { + GFX(set_video_enable(0)); + + /* If we have saved graphics LUT data - restore it */ + /* Otherwise, turn bypass on */ + + if (lutflag) + GFX(set_graphics_palette(graphics_lut)); + else + GFX(set_video_palette_bypass(1)); + + lutflag = 0; + + pPriv->videoStatus = FREE_TIMER; + pPriv->freeTime = currentTime.milliseconds + FREE_DELAY; + } + } else { /* FREE_TIMER */ + if (pPriv->freeTime < currentTime.milliseconds) { + + if (pPriv->area) { +#ifdef XF86EXA + if (pGeode->useEXA) + exaOffscreenFree(pScrn, pPriv->area); +#endif + if (!pGeode->useEXA) + xf86FreeOffscreenArea(pPriv->area); + + pPriv->area = NULL; + } + + pPriv->videoStatus = 0; + } + } + } +} + +/****************** Offscreen stuff ***************/ + +typedef struct +{ + void *area; + int offset; + Bool isOn; +} OffscreenPrivRec, *OffscreenPrivPtr; + +/*---------------------------------------------------------------------------- + * GXAllocateSurface + * + * Description :This function allocates an area of w by h in the offscreen + * + * Parameters. + * pScrni :Screen handler pointer having screen information. + * + * Returns :None + * + * Comments :None + *---------------------------------------------------------------------------- + */ +static int +GXAllocateSurface(ScrnInfoPtr pScrni, + int id, unsigned short w, unsigned short h, XF86SurfacePtr surface) +{ + void *area = NULL; + int pitch, fbpitch, numlines; + OffscreenPrivRec *pPriv; + + if ((w > 1024) || (h > 1024)) + return BadAlloc; + + w = (w + 1) & ~1; + pitch = ((w << 1) + 15) & ~15; + fbpitch = pScrni->bitsPerPixel * pScrni->displayWidth >> 3; + numlines = ((pitch * h) + fbpitch - 1) / fbpitch; + + if (!(offset = GXAllocateMemory(pScrni, &area, numlines))) + return BadAlloc; + + surface->width = w; + surface->height = h; + + if (!(surface->pitches = xalloc(sizeof(int)))) + return BadAlloc; + + if (!(surface->offsets = xalloc(sizeof(int)))) { + xfree(surface->pitches); + return BadAlloc; + } + + if (!(pPriv = xalloc(sizeof(OffscreenPrivRec)))) { + xfree(surface->pitches); + xfree(surface->offsets); + return BadAlloc; + } + + pPriv->area = area; + pPriv->offset = offset; + + pPriv->isOn = FALSE; + + surface->pScrn = pScrni; + surface->id = id; + surface->pitches[0] = pitch; + surface->offsets[0] = offset; + surface->devPrivate.ptr = (pointer) pPriv; + + return Success; +} + +static int +GXStopSurface(XF86SurfacePtr surface) +{ + OffscreenPrivRec *pPriv = (OffscreenPrivRec *) surface->devPrivate.ptr; + + if (pPriv->isOn) { + pPriv->isOn = FALSE; + } + + return Success; +} + +static int +GXFreeSurface(XF86SurfacePtr surface) +{ + OffscreenPrivRec *pPriv = (OffscreenPrivRec *) surface->devPrivate.ptr; + + if (pPriv->isOn) + GXStopSurface(surface); + + xf86FreeOffscreenArea(pPriv->area); + xfree(surface->pitches); + xfree(surface->offsets); + xfree(surface->devPrivate.ptr); + + return Success; +} + +static int +GXGetSurfaceAttribute(ScrnInfoPtr pScrni, Atom attribute, INT32 * value) +{ + return GXGetPortAttribute(pScrni, attribute, value, + (pointer) (GET_PORT_PRIVATE(pScrni))); +} + +static int +GXSetSurfaceAttribute(ScrnInfoPtr pScrni, Atom attribute, INT32 value) +{ + return GXSetPortAttribute(pScrni, attribute, value, + (pointer) (GET_PORT_PRIVATE(pScrni))); +} + +static int +GXDisplaySurface(XF86SurfacePtr surface, + short src_x, short src_y, + short drw_x, short drw_y, + short src_w, short src_h, short drw_w, short drw_h, RegionPtr clipBoxes) +{ + OffscreenPrivRec *pPriv = (OffscreenPrivRec *) surface->devPrivate.ptr; + ScrnInfoPtr pScrni = surface->pScrn; + GeodePortPrivRec *portPriv = GET_PORT_PRIVATE(pScrni); + INT32 x1, y1, x2, y2; + BoxRec dstBox; + + DEBUGMSG(0, (0, X_NONE, "DisplaySuface\n")); + x1 = src_x; + x2 = src_x + src_w; + y1 = src_y; + y2 = src_y + src_h; + + dstBox.x1 = drw_x; + dstBox.x2 = drw_x + drw_w; + dstBox.y1 = drw_y; + dstBox.y2 = drw_y + drw_h; + + if ((x1 >= x2) || (y1 >= y2)) + return Success; + + dstBox.x1 -= pScrni->frameX0; + dstBox.x2 -= pScrni->frameX0; + dstBox.y1 -= pScrni->frameY0; + dstBox.y2 -= pScrni->frameY0; + + xf86XVFillKeyHelper(pScrni->pScreen, portPriv->colorKey, clipBoxes); + + GXDisplayVideo(pScrni, surface->id, surface->offsets[0], + surface->width, surface->height, surface->pitches[0], + x1, y1, x2, y2, &dstBox, src_w, src_h, drw_w, drw_h); + + pPriv->isOn = TRUE; + if (portPriv->videoStatus & CLIENT_VIDEO_ON) { + REGION_EMPTY(pScrni->pScreen, &portPriv->clip); + UpdateCurrentTime(); + portPriv->videoStatus = FREE_TIMER; + portPriv->freeTime = currentTime.milliseconds + FREE_DELAY; + } + + return Success; +} + +/*---------------------------------------------------------------------------- + * GXInitOffscreenImages + * + * Description :This function sets up the offscreen memory management. It + * fills in the XF86OffscreenImagePtr structure with functions to + * handle offscreen memory operations. + * + * Parameters. + * pScrn :Screen handler pointer having screen information. + * + * Returns : None + * + * Comments :None + *---------------------------------------------------------------------------- + */ +static void +GXInitOffscreenImages(ScreenPtr pScrn) +{ + XF86OffscreenImagePtr offscreenImages; + + /* need to free this someplace */ + if (!(offscreenImages = xalloc(sizeof(XF86OffscreenImageRec)))) + return; + + offscreenImages[0].image = &Images[0]; + offscreenImages[0].flags = VIDEO_OVERLAID_IMAGES | VIDEO_CLIP_TO_VIEWPORT; + offscreenImages[0].alloc_surface = GXAllocateSurface; + offscreenImages[0].free_surface = GXFreeSurface; + offscreenImages[0].display = GXDisplaySurface; + offscreenImages[0].stop = GXStopSurface; + offscreenImages[0].setAttribute = GXSetSurfaceAttribute; + offscreenImages[0].getAttribute = GXGetSurfaceAttribute; + offscreenImages[0].max_width = 1024; + offscreenImages[0].max_height = 1024; + offscreenImages[0].num_attributes = NUM_ATTRIBUTES; + offscreenImages[0].attributes = Attributes; + + xf86XVRegisterOffscreenImages(pScrn, offscreenImages, 1); +} + +#endif /* !XvExtension */ diff --git a/driver/xf86-video-geode/src/lx_cursor.c b/driver/xf86-video-geode/src/lx_cursor.c new file mode 100644 index 000000000..f97c2711f --- /dev/null +++ b/driver/xf86-video-geode/src/lx_cursor.c @@ -0,0 +1,220 @@ +/* Copyright (c) 2003-2007 Advanced Micro Devices, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + * + * Neither the name of the Advanced Micro Devices, Inc. nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "xf86.h" +#include "xf86_OSproc.h" +#include "xf86Pci.h" +#include "xf86PciInfo.h" +#include "geode.h" + +/* Forward declarations of the functions */ +static void LXSetCursorColors(ScrnInfoPtr pScrni, int bg, int fg); +static void LXSetCursorPosition(ScrnInfoPtr pScrni, int x, int y); +static Bool LXUseHWCursor(ScreenPtr pScrn, CursorPtr pCurs); +extern void LXSetVideoPosition(int x, int y, int width, int height, + short src_w, short src_h, short drw_w, + short drw_h, int id, int offset, ScrnInfoPtr pScrn); + +Bool +LXHWCursorInit(ScreenPtr pScrn) +{ + ScrnInfoPtr pScrni = xf86Screens[pScrn->myNum]; + GeodeRec *pGeode = GEODEPTR(pScrni); + xf86CursorInfoPtr infoPtr; + + infoPtr = xf86CreateCursorInfoRec(); + if (!infoPtr) + return FALSE; + /* the geode structure is intiallized with the cursor infoRec */ + pGeode->CursorInfo = infoPtr; + infoPtr->MaxWidth = 32; + infoPtr->MaxHeight = 32; + /* seeting up the cursor flags */ + infoPtr->Flags = HARDWARE_CURSOR_BIT_ORDER_MSBFIRST | + HARDWARE_CURSOR_TRUECOLOR_AT_8BPP | + HARDWARE_CURSOR_SOURCE_MASK_NOT_INTERLEAVED; + + infoPtr->SetCursorColors = LXSetCursorColors; + infoPtr->SetCursorPosition = LXSetCursorPosition; + infoPtr->LoadCursorImage = LXLoadCursorImage; + infoPtr->HideCursor = LXHideCursor; + infoPtr->ShowCursor = LXShowCursor; + infoPtr->UseHWCursor = LXUseHWCursor; + + return (xf86InitCursor(pScrn, infoPtr)); +} + +static void +LXSetCursorColors(ScrnInfoPtr pScrni, int bg, int fg) +{ + vg_set_mono_cursor_colors(bg, fg); +} + +static void +LXSetCursorPosition(ScrnInfoPtr pScrni, int x, int y) +{ + GeodeRec *pGeode = GEODEPTR(pScrni); + int savex, savey; + int newX, newY; + int hsx, hsy; + + /* Adjust xf86HWCursor messing about */ + + savex = x + pScrni->frameX0; + savey = y + pScrni->frameY0; + + switch (pGeode->rotation) { + default: + ErrorF("%s:%d invalid rotation %d\n", __func__, __LINE__, + pGeode->rotation); + case RR_Rotate_0: + newX = savex; + newY = savey; + hsx = 31; + hsy = 31; + break; + + case RR_Rotate_270: + newX = savey; + newY = pScrni->pScreen->width - savex; + hsx = 31; + hsy = 0; + break; + + case RR_Rotate_180: + newX = pScrni->pScreen->width - savex; + newY = pScrni->pScreen->height - savey; + hsx = 0; + hsy = 0; + break; + + case RR_Rotate_90: + newX = pScrni->pScreen->height - savey; + newY = savex; + hsx = 0; + hsy = 31; + break; + } + + newX -= pScrni->frameX0; + newY -= pScrni->frameY0; + + { + VG_PANNING_COORDINATES panning; + + vg_set_cursor_position(newX + hsx, newY + hsy, &panning); + } + + vg_set_cursor_enable(1); + + /* FIXME: Adjust for video panning? */ +} + +void +LXLoadCursorImage(ScrnInfoPtr pScrni, unsigned char *src) +{ + int i, n, x, y, newX, newY; + unsigned long andMask[32], xorMask[32]; + GeodeRec *pGeode = GEODEPTR(pScrni); + unsigned long mskb, rowb; + unsigned char *rowp = &src[0]; + unsigned char *mskp = &src[128]; + + if (src != NULL) { + mskb = rowb = 0; + for (y = 32; --y >= 0;) + andMask[y] = xorMask[y] = 0; + for (y = 0; y < 32; ++y) { + for (x = 0; x < 32; ++x) { + if ((i = x & 7) == 0) { + rowb = (*rowp & *mskp); + mskb = ~(*mskp); + ++rowp; + ++mskp; + } + + switch (pGeode->rotation) { + default: + ErrorF("%s:%d invalid rotation %d\n", __func__, __LINE__, + pGeode->rotation); + case RR_Rotate_0: + newX = x; + newY = y; + break; + case RR_Rotate_270: + newX = y; + newY = 31 - x; + break; + case RR_Rotate_180: + newX = 31 - x; + newY = 31 - y; + break; + case RR_Rotate_90: + newX = 31 - y; + newY = x; + break; + } + + i = 7 - i; + n = 31 - newX; + andMask[newY] |= (((mskb >> i) & 1) << n); + xorMask[newY] |= (((rowb >> i) & 1) << n); + } + } + } else { + for (y = 32; --y >= 0;) { + andMask[y] = ~0; + xorMask[y] = 0; + } + } + + vg_set_mono_cursor_shape32(pGeode->CursorStartOffset, &andMask[0], + &xorMask[0], 31, 31); +} + +void +LXHideCursor(ScrnInfoPtr pScrni) +{ + vg_set_cursor_enable(0); +} + +void +LXShowCursor(ScrnInfoPtr pScrni) +{ + vg_set_cursor_enable(1); +} + +static Bool +LXUseHWCursor(ScreenPtr pScrn, CursorPtr pCurs) +{ + ScrnInfoPtr pScrni = XF86SCRNINFO(pScrn); + GeodeRec *pGeode = GEODEPTR(pScrni); + + return pGeode->HWCursor; +} diff --git a/driver/xf86-video-geode/src/lx_driver.c b/driver/xf86-video-geode/src/lx_driver.c new file mode 100644 index 000000000..e8477db1b --- /dev/null +++ b/driver/xf86-video-geode/src/lx_driver.c @@ -0,0 +1,1560 @@ +/* Copyright (c) 2003-2007 Advanced Micro Devices, Inc. + * + * Portioned modeled from xf86-video-intel/src/i830_driver.c + * Copyright 2001 VA Linux Systems Inc., Fremont, California. + * Copyright \ufffd 2002 by David Dawes + + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + * + * Neither the name of the Advanced Micro Devices, Inc. nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + */ + +/* TODO: + TV out support + Detect panels better + Better VGA support + GX: cursor position needs to be correctly set + use CB data wrapper to save a variable + consolidate the saved timings + implement panning +*/ + +/* The effort to make things common: + define CmdBfrSize in the GX + add the output flag to GX +*/ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include +#include + +#include "xf86.h" +#include "xf86_OSproc.h" +#include "xf86Resources.h" +#include "xf86cmap.h" +#include "compiler.h" +#include "mipointer.h" +#include /* setupShadow() */ +#include +#include "fb.h" +#include "miscstruct.h" +#include "micmap.h" +#include "vbe.h" +#include "fb.h" +#include "randrstr.h" +#include "cim_defs.h" +#include "cim_regs.h" +#include "geode.h" + +/* Bring in VGA functions */ +#include "lx_vga.c" + +/* Chipset types */ + +#define LX_MIN_PITCH 1024 +#define LX_MAX_PITCH 8192 +#define LX_MAX_WIDTH 1940 +#define LX_MIN_HEIGHT 400 +#define LX_MAX_HEIGHT 1600 +#define LX_CB_PITCH 544 +#define LX_CB_SIZE 544 + +#define LX_GP_REG_SIZE 0x4000 +#define LX_VG_REG_SIZE 0x4000 +#define LX_VID_REG_SIZE 0x4000 +#define LX_VIP_REG_SIZE 0x4000 + +extern OptionInfoRec LX_GeodeOptions[]; + +extern const char *amdVgahwSymbols[]; +extern const char *amdVbeSymbols[]; +extern const char *amdInt10Symbols[]; +extern const char *amdFbSymbols[]; +extern const char *amdExaSymbols[]; +extern const char *amdRamdacSymbols[]; + +unsigned char *XpressROMPtr; + +/* Reference: Video Graphics Suite Specification: + * VG Config Register (0x00) page 16 + * VG FP Register (0x02) page 18 + */ + +#define LX_READ_VG(reg) \ + (outw(0xAC1C,0xFC53), outw(0xAC1C,0x0200|(reg)), inw(0xAC1E)) + +static inline void +lx_enable_dac_power(ScrnInfoPtr pScrni, int option) +{ + GeodeRec *pGeode = GEODEPTR(pScrni); + + df_set_crt_enable(DF_CRT_ENABLE); + + /* Turn off the DAC if we don't need the CRT */ + + if (option && (!(pGeode->Output & OUTPUT_CRT))) { + unsigned int misc = READ_VID32(DF_VID_MISC); + + misc |= DF_DAC_POWER_DOWN; + WRITE_VID32(DF_VID_MISC, misc); + } + + if (pGeode->Output & OUTPUT_PANEL) + df_set_panel_enable(1); +} + +static inline void +lx_disable_dac_power(ScrnInfoPtr pScrni, int option) +{ + GeodeRec *pGeode = GEODEPTR(pScrni); + + if (pGeode->Output & OUTPUT_PANEL) + df_set_panel_enable(0); + + if (pGeode->Output & OUTPUT_CRT) { + + /* Wait for the panel to finish its procedure */ + + if (pGeode->Output & OUTPUT_PANEL) + while ((READ_VID32(DF_POWER_MANAGEMENT) & 2) == 0) ; + df_set_crt_enable(option); + } +} + +static int +lx_get_panel(int *xres, int *yres) +{ + static struct + { + int xres, yres; + } fpres[] = { + { + 320, 240}, { + 640, 480}, { + 800, 600}, { + 1024, 768}, { + 1152, 864}, { + 1280, 1024}, { + 1600, 1200}}; + + unsigned short reg = LX_READ_VG(0x00); + unsigned char ret = (reg >> 8) & 0x07; + + if ((ret == 1 || ret == 5)) { + + reg = LX_READ_VG(0x02); + ret = (reg >> 3) & 0x07; + + /* 7 is a "reserved" value - if we get it, we can only assume that + * a panel doesn't exist (or it hasn't been configured in the BIOS) + */ + + if (ret < 7) { + *xres = fpres[ret].xres; + *yres = fpres[ret].yres; + + return TRUE; + } + } + + return FALSE; +} + +static int +lx_set_custom_mode(GeodeRec * pGeode, DisplayModePtr pMode, int bpp) +{ + VG_DISPLAY_MODE mode; + int hsync, vsync; + + memset(&mode, 0, sizeof(mode)); + + /* Cimarron purposely swaps the sync when panels are enabled -this is + * presumably to allow for "default" panels which are normally active + * low, so we need to swizzle the flags + */ + + hsync = (pMode->Flags & V_NHSYNC) ? 1 : 0; + vsync = (pMode->Flags & V_NVSYNC) ? 1 : 0; + + if (pGeode->Output & OUTPUT_PANEL) { + hsync = !vsync; + vsync = !vsync; + } + + mode.flags |= (hsync) ? VG_MODEFLAG_NEG_HSYNC : 0; + mode.flags |= (vsync) ? VG_MODEFLAG_NEG_VSYNC : 0; + + mode.flags |= pGeode->Output & OUTPUT_CRT ? VG_MODEFLAG_CRT_AND_FP : 0; + + if (pGeode->Output & OUTPUT_PANEL) { + mode.panel_width = mode.mode_width = pGeode->PanelX; + mode.panel_height = mode.mode_height = pGeode->PanelY; + + mode.flags |= VG_MODEFLAG_PANELOUT; + mode.flags |= + pGeode->Output & OUTPUT_CRT ? VG_MODEFLAG_CRT_AND_FP : 0; + } else { + mode.mode_width = pMode->CrtcHDisplay; + mode.mode_height = pMode->CrtcVDisplay; + } + + mode.src_width = pMode->CrtcHDisplay; + mode.src_height = pMode->CrtcVDisplay; + + mode.hactive = pMode->CrtcHDisplay; + mode.hblankstart = pMode->CrtcHBlankStart; + mode.hsyncstart = pMode->CrtcHSyncStart; + mode.hsyncend = pMode->CrtcHSyncEnd; + mode.hblankend = pMode->CrtcHBlankEnd; + mode.htotal = pMode->CrtcHTotal; + + mode.vactive = pMode->CrtcVDisplay; + mode.vblankstart = pMode->CrtcVBlankStart; + mode.vsyncstart = pMode->CrtcVSyncStart; + mode.vsyncend = pMode->CrtcVSyncEnd; + mode.vblankend = pMode->CrtcVBlankEnd; + mode.vtotal = pMode->CrtcVTotal; + + mode.vactive_even = pMode->CrtcVDisplay; + mode.vblankstart_even = pMode->CrtcVBlankStart; + mode.vsyncstart_even = pMode->CrtcVSyncStart; + mode.vsyncend_even = pMode->CrtcVSyncEnd; + mode.vblankend_even = pMode->CrtcVBlankEnd; + mode.vtotal_even = pMode->CrtcVTotal; + + mode.frequency = (int)((pMode->SynthClock / 1000.0) * 0x10000); + + return vg_set_custom_mode(&mode, bpp); +} + +static Bool +LXAllocateMemory(ScreenPtr pScrn, ScrnInfoPtr pScrni, int rotate) +{ + GeodePtr pGeode = GEODEPTR(pScrni); + + unsigned int fboffset, fbavail; + unsigned int size; + unsigned int bytpp = (pScrni->bitsPerPixel + 7) / 8; + Bool ret = TRUE; + + if (pGeode->tryCompression) + pGeode->displayPitch = + GeodeCalculatePitchBytes(pScrni->virtualX, pScrni->bitsPerPixel); + else + pGeode->displayPitch = + ((pScrni->virtualX + 3) & ~3) * (pScrni->bitsPerPixel >> 3); + + pGeode->displayWidth = pGeode->displayPitch / bytpp; + + /* Sets pGeode->Pitch and pScrni->displayWidth based on the rotate settings */ + LXSetRotatePitch(pScrni); + + fbavail = pGeode->FBAvail - GP3_SCRATCH_BUFFER_SIZE; + + pGeode->displayOffset = fboffset = 0; + pGeode->displaySize = pScrni->virtualY * pGeode->displayPitch; + + fbavail -= pGeode->displaySize; + fboffset += pGeode->displaySize; + + if (pGeode->tryCompression) { + size = pScrni->virtualY * LX_CB_PITCH; + + if (size <= fbavail) { + pGeode->CBData.compression_offset = fboffset; + pGeode->CBData.size = LX_CB_PITCH; + pGeode->CBData.pitch = LX_CB_PITCH; + fboffset += size; + fbavail -= size; + + pGeode->Compression = TRUE; + } else { + xf86DrvMsg(pScrni->scrnIndex, X_ERROR, + "Not enough memory for compression\n"); + pGeode->Compression = FALSE; + } + } + + if (pGeode->tryHWCursor) { + pGeode->CursorSize = 1024; + + if (pGeode->CursorSize <= fbavail) { + pGeode->CursorStartOffset = fboffset; + fboffset += pGeode->CursorSize; + fbavail -= pGeode->CursorSize; + pGeode->HWCursor = TRUE; + } else { + xf86DrvMsg(pScrni->scrnIndex, X_ERROR, + "Not enough memory for the hardware cursor\n"); + pGeode->HWCursor = FALSE; + } + } + + /* Try to set up some EXA scratch memory for blending */ + + pGeode->exaBfrOffset = 0; + + if (!pGeode->NoAccel) { + if (pGeode->exaBfrSz > 0 && pGeode->exaBfrSz <= fbavail) { + pGeode->exaBfrOffset = fboffset; + fboffset += pGeode->exaBfrSz; + fbavail -= pGeode->exaBfrSz; + } + } + + /* Adjust the available EXA offscreen space to account for the buffer */ + + if (!pGeode->NoAccel && pGeode->pExa) { + pGeode->pExa->offScreenBase = fboffset; + pGeode->pExa->memorySize = fboffset + fbavail; + } + + return ret; +} + +static Bool +LXSaveScreen(ScreenPtr pScrn, int mode) +{ + ScrnInfoPtr pScrni = xf86Screens[pScrn->myNum]; + GeodePtr pGeode = GEODEPTR(pScrni); + + if (pGeode->useVGA && !pScrni->vtSema) + return vgaHWSaveScreen(pScrn, mode); + + return TRUE; +} + +/* This is an overly complex MSR read mechanism */ + +/* From Cimarron - the VSAII read/write methods - we use these as fallback */ + +#define LX_MSR_READ(adr,lo,hi) \ + __asm__ __volatile__( \ + " mov $0x0AC1C, %%edx\n" \ + " mov $0xFC530007, %%eax\n" \ + " out %%eax,%%dx\n" \ + " add $2,%%dl\n" \ + " in %%dx, %%ax" \ + : "=a" (lo), "=d" (hi) \ + : "c" (adr)) + +#define LX_MSR_WRITE(adr,low,high) \ + { int d0, d1, d2, d3, d4; \ + __asm__ __volatile__( \ + " push %%ebx\n" \ + " mov $0x0AC1C, %%edx\n" \ + " mov $0xFC530007, %%eax\n" \ + " out %%eax,%%dx\n" \ + " add $2,%%dl\n" \ + " mov %6, %%ebx\n" \ + " mov %7, %0\n" \ + " mov %5, %3\n" \ + " xor %2, %2\n" \ + " xor %1, %1\n" \ + " out %%ax, %%dx\n" \ + " pop %%ebx\n" \ + : "=a"(d0),"=&D"(d1),"=&S"(d2), \ + "=c"(d3),"=d"(d4) \ + : "1"(adr),"2"(high),"3"(low)); \ + } + +static void +LXReadMSR(unsigned long addr, unsigned long *lo, unsigned long *hi) +{ + if (GeodeReadMSR(addr, lo, hi) == -1) { + unsigned int l, h; + + LX_MSR_READ(addr, l, h); + *lo = l; + *hi = h; + } +} + +static void +LXWriteMSR(unsigned long addr, unsigned long lo, unsigned long hi) +{ + if (GeodeWriteMSR(addr, lo, hi) == -1) + LX_MSR_WRITE(addr, lo, hi); +} + +#ifdef XSERVER_LIBPCIACCESS +static inline void * +map_pci_mem(ScrnInfoPtr pScrni, int vram, + struct pci_device *dev, int bar, int size) +{ + void *ptr; + void **result = (void **)&ptr; + int map_size = size ? size : dev->regions[bar].size; + + int err = pci_device_map_range(dev, + dev->regions[bar].base_addr, + map_size, + PCI_DEV_MAP_FLAG_WRITABLE | + (vram ? PCI_DEV_MAP_FLAG_WRITE_COMBINE : 0), + result); + + if (err) + return NULL; + return ptr; +} + +static inline int +unmap_pci_mem(ScrnInfoPtr pScrni, struct pci_device *dev, void *ptr, int size) +{ + return pci_device_unmap_range(dev, ptr, size); +} + +#endif + +static Bool +LXMapMem(ScrnInfoPtr pScrni) +{ + GeodeRec *pGeode = GEODEPTR(pScrni); + int index = pScrni->scrnIndex; + unsigned long cmd_bfr_phys; + + pciVideoPtr pci = xf86GetPciInfoForEntity(pGeode->pEnt->index); + +#ifndef XSERVER_LIBPCIACCESS + PCITAG tag; + + tag = pciTag(pci->bus, pci->device, pci->func); + + cim_gp_ptr = (unsigned char *)xf86MapPciMem(index, VIDMEM_MMIO, + tag, pci->memBase[1], LX_GP_REG_SIZE); + + cim_vg_ptr = (unsigned char *)xf86MapPciMem(index, VIDMEM_MMIO, + tag, pci->memBase[2], LX_VG_REG_SIZE); + + cim_vid_ptr = (unsigned char *)xf86MapPciMem(index, VIDMEM_MMIO, + tag, pci->memBase[3], LX_VID_REG_SIZE); + + cim_vip_ptr = (unsigned char *)xf86MapPciMem(index, VIDMEM_MMIO, + tag, pci->memBase[4], LX_VIP_REG_SIZE); + + cim_fb_ptr = (unsigned char *)xf86MapPciMem(index, VIDMEM_FRAMEBUFFER, + tag, pci->memBase[0], pGeode->FBAvail + CIM_CMD_BFR_SZ); +#else + cim_gp_ptr = map_pci_mem(pScrni, 0, pci, 1, LX_GP_REG_SIZE); + cim_vg_ptr = map_pci_mem(pScrni, 0, pci, 2, LX_VG_REG_SIZE); + cim_vid_ptr = map_pci_mem(pScrni, 0, pci, 3, LX_VID_REG_SIZE); + cim_vip_ptr = map_pci_mem(pScrni, 0, pci, 4, LX_VIP_REG_SIZE); + cim_fb_ptr = + map_pci_mem(pScrni, 1, pci, 0, pGeode->FBAvail + CIM_CMD_BFR_SZ); +#endif + + if (pScrni->memPhysBase == 0) + pScrni->memPhysBase = PCI_REGION_BASE(pci, 0, REGION_MEM); + + cmd_bfr_phys = PCI_REGION_BASE(pci, 0, REGION_MEM) + pGeode->CmdBfrOffset; + cim_cmd_base_ptr = cim_fb_ptr + pGeode->CmdBfrOffset; + + if (!cim_gp_ptr || !cim_vg_ptr || !cim_vid_ptr || !cim_fb_ptr || + !cim_vip_ptr) + return FALSE; + + gp_set_frame_buffer_base(PCI_REGION_BASE(pci, 0, REGION_MEM), + pGeode->FBAvail); + gp_set_command_buffer_base(cmd_bfr_phys, 0, pGeode->CmdBfrSize); + + XpressROMPtr = xf86MapVidMem(index, VIDMEM_FRAMEBUFFER, 0xF0000, 0x10000); + + pGeode->FBBase = cim_fb_ptr; + + if (!pGeode->NoAccel) + pGeode->pExa->memoryBase = pGeode->FBBase; + + xf86DrvMsg(index, X_INFO, "Geode LX video memory %x bytes at %p\n", + pGeode->FBAvail, pGeode->FBBase); + + return TRUE; +} + +/* Check to see if VGA exists - we map the space and look for a + signature - if it doesn't match exactly, then we assume no VGA. +*/ + +static Bool +LXCheckVGA(ScrnInfoPtr pScrni) +{ + + unsigned char *ptr; + const char *vgasig = "IBM VGA Compatible"; + int ret; + + ptr = + xf86MapVidMem(pScrni->scrnIndex, VIDMEM_FRAMEBUFFER, 0xC001E, + strlen(vgasig)); + + if (ptr == NULL) + return FALSE; + + ret = memcmp(ptr, vgasig, strlen(vgasig)); + xf86UnMapVidMem(pScrni->scrnIndex, (pointer) ptr, strlen(vgasig)); + + return ret ? FALSE : TRUE; +} + +static Bool +LXPreInit(ScrnInfoPtr pScrni, int flags) +{ + GeodePtr pGeode; + ClockRangePtr GeodeClockRange; + EntityInfoPtr pEnt; + OptionInfoRec *GeodeOptions = &LX_GeodeOptions[0]; + rgb defaultWeight = { 0, 0, 0 }; + int modecnt; + char *s; + + if (pScrni->numEntities != 1) + return FALSE; + + pEnt = xf86GetEntityInfo(pScrni->entityList[0]); + + if (pEnt->resources) + return FALSE; + + if (flags & PROBE_DETECT) { + GeodeProbeDDC(pScrni, pEnt->index); + return TRUE; + } + + pGeode = pScrni->driverPrivate = xnfcalloc(sizeof(GeodeRec), 1); + + if (pGeode == NULL) + return FALSE; + + pGeode->useVGA = LXCheckVGA(pScrni); + pGeode->VGAActive = FALSE; + pGeode->pEnt = pEnt; + + if (pGeode->useVGA) { + if (!xf86LoadSubModule(pScrni, "vgahw") || !vgaHWGetHWRec(pScrni)) + pGeode->useVGA = FALSE; + + pGeode->vesa = xcalloc(sizeof(VESARec), 1); + } + + cim_rdmsr = LXReadMSR; + cim_wrmsr = LXWriteMSR; + + /* Set up the Cimarron MSR tables */ + msr_init_table(); + + /* By default, we support panel and CRT - the config file should + * disable the ones we don't want + */ + + pGeode->Output = OUTPUT_PANEL | OUTPUT_CRT; + + /* Fill in the monitor information */ + pScrni->monitor = pScrni->confScreen->monitor; + + if (!xf86SetDepthBpp(pScrni, 16, 16, 16, Support24bppFb | Support32bppFb)) + return FALSE; + + switch (pScrni->depth) { + case 8: + pScrni->rgbBits = 8; + case 16: + case 24: + case 32: + break; + default: + xf86DrvMsg(pScrni->scrnIndex, X_ERROR, + "The driver does not support %d as a depth.\n", pScrni->depth); + return FALSE; + } + + xf86PrintDepthBpp(pScrni); + + if (!xf86SetWeight(pScrni, defaultWeight, defaultWeight)) + return FALSE; + + if (!xf86SetDefaultVisual(pScrni, -1)) + return FALSE; + + /* + * If the driver can do gamma correction, it should call xf86SetGamma() + * here. + */ + { + Gamma zeros = { 0.0, 0.0, 0.0 }; + + if (!xf86SetGamma(pScrni, zeros)) { + return FALSE; + } + } + + pScrni->progClock = TRUE; + xf86CollectOptions(pScrni, NULL); + xf86ProcessOptions(pScrni->scrnIndex, pScrni->options, GeodeOptions); + + /* Set up our various options that may get reversed as we go on */ + + pGeode->tryHWCursor = TRUE; + pGeode->tryCompression = TRUE; + + /* Protect against old versions of EXA */ + +#if (EXA_VERSION_MAJOR < 2) + pGeode->NoAccel = TRUE; + xf86DrvMsg(pScrni->scrnIndex, X_ERROR, + "*** This driver was compiled with EXA version %d\n"); + xf86DrvMsg(pScrni->scrnIndex, X_ERROR, + "*** we need version 2 or greater\n"); + xf86DrvMsg(pScrni->scrnIndex, X_ERROR, + "*** All accelerations are being turned off.\n"); +#else + pGeode->NoAccel = FALSE; +#endif + + pGeode->exaBfrSz = DEFAULT_EXA_SCRATCH_BFRSZ; + + xf86GetOptValBool(GeodeOptions, LX_OPTION_HW_CURSOR, + &pGeode->tryHWCursor); + + if (!xf86GetOptValInteger(GeodeOptions, LX_OPTION_FBSIZE, + (int *)&(pGeode->FBAvail))) + pGeode->FBAvail = 0; + + /* For compatability - allow SWCursor too */ + + if (xf86ReturnOptValBool(GeodeOptions, LX_OPTION_SW_CURSOR, FALSE)) + pGeode->tryHWCursor = FALSE; + + if (xf86ReturnOptValBool(GeodeOptions, LX_OPTION_NOCOMPRESSION, FALSE)) + pGeode->tryCompression = FALSE; + + if (xf86ReturnOptValBool(GeodeOptions, LX_OPTION_NOACCEL, FALSE)) + pGeode->NoAccel = TRUE; + + pGeode->rotation = RR_Rotate_0; + + if ((s = xf86GetOptValString(GeodeOptions, LX_OPTION_ROTATE))) { + + if (!xf86NameCmp(s, "LEFT")) + pGeode->rotation = RR_Rotate_90; + else if (!xf86NameCmp(s, "INVERT")) + pGeode->rotation = RR_Rotate_180; + else if (!xf86NameCmp(s, "CCW")) + pGeode->rotation = RR_Rotate_270; + else + xf86DrvMsg(pScrni->scrnIndex, X_ERROR, + "Invalid rotation %s.\n", s); + } + + xf86GetOptValInteger(GeodeOptions, LX_OPTION_EXA_SCRATCH_BFRSZ, + (int *)&(pGeode->exaBfrSz)); + + if (pGeode->exaBfrSz <= 0) + pGeode->exaBfrSz = 0; + + if (pGeode->Output & OUTPUT_PANEL) { + if (xf86ReturnOptValBool(GeodeOptions, LX_OPTION_NOPANEL, FALSE)) + pGeode->Output &= ~OUTPUT_PANEL; + } + + /* Panel detection code - + * 1. See if an OLPC DCON is attached - we can make some assumptions + * about the panel if so. + * 2. Use override options specified in the config + * 3. "Autodetect" the panel through VSA + */ + + if (dcon_init(pScrni)) { + pGeode->Output = OUTPUT_PANEL | OUTPUT_DCON; + } else if (pGeode->Output & OUTPUT_PANEL) { + char *panelgeo = + xf86GetOptValString(GeodeOptions, LX_OPTION_PANEL_GEOMETRY); + + if (panelgeo != NULL) + GeodeGetFPGeometry(panelgeo, &pGeode->PanelX, &pGeode->PanelY); + else { + if (!lx_get_panel(&pGeode->PanelX, &pGeode->PanelY)) + pGeode->Output &= ~OUTPUT_PANEL; + } + } + + xf86DrvMsg(pScrni->scrnIndex, X_INFO, "LX output options:\n"); + xf86DrvMsg(pScrni->scrnIndex, X_INFO, " CRT: %s\n", + pGeode->Output & OUTPUT_CRT ? "YES" : "NO"); + + xf86DrvMsg(pScrni->scrnIndex, X_INFO, " PANEL: %s\n", + pGeode->Output & OUTPUT_PANEL ? "YES" : "NO"); + + xf86DrvMsg(pScrni->scrnIndex, X_INFO, " DCON: %s\n", + pGeode->Output & OUTPUT_DCON ? "YES" : "NO"); + + xf86DrvMsg(pScrni->scrnIndex, X_INFO, " VGA: %s\n", + pGeode->useVGA ? "YES" : "NO"); + + /* Set up VGA */ + if (pGeode->useVGA) { + xf86LoaderReqSymLists(amdVgahwSymbols, NULL); + + VESARec *pVesa; + + if (!xf86LoadSubModule(pScrni, "int10")) + return FALSE; + + xf86LoaderReqSymLists(amdInt10Symbols, NULL); + + pVesa = pGeode->vesa; + + if ((pVesa->pInt = xf86InitInt10(pGeode->pEnt->index)) == NULL) { + xf86DrvMsg(pScrni->scrnIndex, X_ERROR, + "Unable to initialize 1NT10 support\n"); + pGeode->useVGA = FALSE; + } + } + + /* Read the amount of framebuffer memory */ + /* First try to read it from the framebuffer, and if that fails, + * do it the legacy way + */ + + if (pGeode->FBAvail == 0) { + if (GeodeGetSizeFromFB(&pGeode->FBAvail)) { + unsigned long value; + + cim_outw(0xAC1C, 0xFC53); + cim_outw(0xAC1C, 0x0200); + + value = (unsigned long)(cim_inw(0xAC1E)) & 0xFE; + pGeode->FBAvail = value << 20; + } + } + + pScrni->fbOffset = 0; + + if (pGeode->pEnt->device->videoRam == 0) + pScrni->videoRam = pGeode->FBAvail / 1024; + else { + pScrni->videoRam = pGeode->pEnt->device->videoRam; + pGeode->FBAvail = pScrni->videoRam << 10; + } + + /* Carve out some memory for the command buffer */ + + pGeode->CmdBfrSize = CIM_CMD_BFR_SZ; + pGeode->FBAvail -= CIM_CMD_BFR_SZ; + + pGeode->CmdBfrOffset = pGeode->FBAvail; + + pGeode->maxWidth = LX_MAX_WIDTH; + pGeode->maxHeight = LX_MAX_HEIGHT; + + GeodeClockRange = (ClockRangePtr) xnfcalloc(sizeof(ClockRange), 1); + GeodeClockRange->next = NULL; + GeodeClockRange->minClock = 25175; + GeodeClockRange->maxClock = 229500; + GeodeClockRange->clockIndex = -1; + GeodeClockRange->interlaceAllowed = TRUE; + GeodeClockRange->doubleScanAllowed = FALSE; + + if (pGeode->Output & OUTPUT_CRT) + pScrni->monitor->DDC = GeodeDoDDC(pScrni, pGeode->pEnt->index); + else + pScrni->monitor->DDC = NULL; + + /* I'm still not 100% sure this uses the right values */ + + modecnt = xf86ValidateModes(pScrni, + pScrni->monitor->Modes, + pScrni->display->modes, + GeodeClockRange, + NULL, LX_MIN_PITCH, LX_MAX_PITCH, + 32, LX_MIN_HEIGHT, LX_MAX_HEIGHT, + pScrni->display->virtualX, + pScrni->display->virtualY, pGeode->FBAvail, LOOKUP_BEST_REFRESH); + + if (modecnt <= 0) { + xf86DrvMsg(pScrni->scrnIndex, X_ERROR, "No valid modes were found\n"); + return FALSE; + } + + xf86PruneDriverModes(pScrni); + + if (pScrni->modes == NULL) { + xf86DrvMsg(pScrni->scrnIndex, X_ERROR, "No valid modes were found\n"); + return FALSE; + } + + xf86SetCrtcForModes(pScrni, 0); + pScrni->currentMode = pScrni->modes; + + xf86PrintModes(pScrni); + xf86SetDpi(pScrni, 0, 0); + + /* Load the modules we'll need */ + + if (xf86LoadSubModule(pScrni, "fb") == NULL) { + return FALSE; + } + + xf86LoaderReqSymLists(amdFbSymbols, NULL); + + if (!pGeode->NoAccel) { + if (!xf86LoadSubModule(pScrni, "exa")) + return FALSE; + + xf86LoaderReqSymLists(&amdExaSymbols[0], NULL); + } + + if (pGeode->tryHWCursor == TRUE) { + if (!xf86LoadSubModule(pScrni, "ramdac")) { + return FALSE; + } + + xf86LoaderReqSymLists(amdRamdacSymbols, NULL); + } + + if (xf86RegisterResources(pGeode->pEnt->index, NULL, ResExclusive)) { + xf86DrvMsg(pScrni->scrnIndex, X_ERROR, + "Couldn't register the resources.\n"); + return FALSE; + } + + return TRUE; +} + +static void +LXRestore(ScrnInfoPtr pScrni) +{ + GeodeRec *pGeode = GEODEPTR(pScrni); + + if (pGeode->useVGA) { + vgaHWPtr pvgaHW = VGAHWPTR(pScrni); + + vgaHWProtect(pScrni, TRUE); + vgaHWRestore(pScrni, &pvgaHW->SavedReg, VGA_SR_ALL); + vgaHWProtect(pScrni, FALSE); + } +} + +static Bool +LXUnmapMem(ScrnInfoPtr pScrni) +{ + GeodeRec *pGeode = GEODEPTR(pScrni); + pciVideoPtr pci = xf86GetPciInfoForEntity(pGeode->pEnt->index); + +#ifndef XSERVER_LIBPCIACCESS + xf86UnMapVidMem(pScrni->scrnIndex, (pointer) cim_gp_ptr, LX_GP_REG_SIZE); + xf86UnMapVidMem(pScrni->scrnIndex, (pointer) cim_vg_ptr, LX_VG_REG_SIZE); + xf86UnMapVidMem(pScrni->scrnIndex, (pointer) cim_vid_ptr, + LX_VID_REG_SIZE); + xf86UnMapVidMem(pScrni->scrnIndex, (pointer) cim_vip_ptr, + LX_VIP_REG_SIZE); +#else + unmap_pci_mem(pScrni, pci, cim_gp_ptr, LX_GP_REG_SIZE); + unmap_pci_mem(pScrni, pci, cim_vg_ptr, LX_VG_REG_SIZE); + unmap_pci_mem(pScrni, pci, cim_vid_ptr, LX_VID_REG_SIZE); + unmap_pci_mem(pScrni, pci, cim_vip_ptr, LX_VIP_REG_SIZE); + unmap_pci_mem(pScrni, pci, cim_fb_ptr, pGeode->FBAvail + CIM_CMD_BFR_SZ); +#endif + + xf86UnMapVidMem(pScrni->scrnIndex, XpressROMPtr, 0x10000); + + return TRUE; +} + +/* These should be correctly accounted for rotation */ + +static void +LXAdjustFrame(int scrnIndex, int x, int y, int flags) +{ + ScrnInfoPtr pScrni = xf86Screens[scrnIndex]; + GeodeRec *pGeode = GEODEPTR(pScrni); + + unsigned long offset; + + /* XXX: Is pitch correct here? */ + + offset = pGeode->FBOffset + (y * pGeode->Pitch); + offset += x * (pScrni->bitsPerPixel >> 3); + + vg_set_display_offset(offset); +} + +static Bool +LXSetVideoMode(ScrnInfoPtr pScrni, DisplayModePtr pMode) +{ + GeodeRec *pGeode = GEODEPTR(pScrni); + DF_VIDEO_SOURCE_PARAMS vs_odd, vs_even; + int flags = 0; + int video_enable; + unsigned long video_flags; + + df_get_video_enable(&video_enable, &video_flags); + + if (video_enable != 0) + df_set_video_enable(0, 0); + + df_get_video_source_configuration(&vs_odd, &vs_even); + lx_disable_dac_power(pScrni, DF_CRT_DISABLE); + vg_set_compression_enable(0); + + /* If the mode is a default one, then set the mode with the Cimarron + * tables */ + + if ((pMode->type & M_T_BUILTIN) || (pMode->type & M_T_DEFAULT)) { + if (pMode->Flags & V_NHSYNC) + flags |= VG_MODEFLAG_NEG_HSYNC; + if (pMode->Flags & V_NVSYNC) + flags |= VG_MODEFLAG_NEG_VSYNC; + + if (pGeode->Output & OUTPUT_PANEL) { + int activex = pGeode->PanelX; + int activey = pGeode->PanelY; + + flags = pGeode->Output & OUTPUT_CRT ? VG_MODEFLAG_CRT_AND_FP : 0; + + if (pMode->CrtcHDisplay > 1024 && + pMode->CrtcHDisplay != pGeode->PanelX) { + ErrorF + ("The source is greater then 1024 - scaling is disabled.\n"); + activex = pMode->CrtcHDisplay; + activey = pMode->CrtcVDisplay; + + vg_set_border_color(0); + } + + vg_set_panel_mode(pMode->CrtcHDisplay, pMode->CrtcVDisplay, + activex, activey, activex, activey, + pScrni->bitsPerPixel, flags); + } else { + vg_set_display_mode(pMode->CrtcHDisplay, pMode->CrtcVDisplay, + pMode->CrtcHDisplay, pMode->CrtcVDisplay, + pScrni->bitsPerPixel, GeodeGetRefreshRate(pMode), 0); + } + } else { + /* For anything other then a default mode - use the passed in + * timings */ + + lx_set_custom_mode(pGeode, pMode, pScrni->bitsPerPixel); + } + + if (pGeode->Output & OUTPUT_PANEL) + df_set_output_path((pGeode-> + Output & OUTPUT_CRT) ? DF_DISPLAY_CRT_FP : DF_DISPLAY_FP); + else + df_set_output_path(DF_DISPLAY_CRT); + + vg_set_display_pitch(pGeode->Pitch); + gp_set_bpp(pScrni->bitsPerPixel); + + vg_set_display_offset(0); + vg_wait_vertical_blank(); + + if (pGeode->Compression) { + vg_configure_compression(&(pGeode->CBData)); + vg_set_compression_enable(1); + } + + if (pGeode->HWCursor && !(pMode->Flags & V_DBLSCAN)) { + VG_PANNING_COORDINATES panning; + + LXLoadCursorImage(pScrni, NULL); + vg_set_cursor_position(0, 0, &panning); + LXShowCursor(pScrni); + } else { + vg_set_cursor_enable(0); + pGeode->HWCursor = FALSE; + } + + LXAdjustFrame(pScrni->scrnIndex, pScrni->frameX0, pScrni->frameY0, 0); + + df_configure_video_source(&vs_odd, &vs_even); + + if (video_enable != 0) + df_set_video_enable(video_enable, video_flags); + + lx_enable_dac_power(pScrni, 1); + + return TRUE; +} + +static Bool +LXSwitchMode(int index, DisplayModePtr pMode, int flags) +{ + ScrnInfoPtr pScrni = xf86Screens[index]; + GeodeRec *pGeode = GEODEPTR(pScrni); + int ret = TRUE; + int rotate; + + /* Syn the engine and shutdown the DAC momentarily */ + gp_wait_until_idle(); + + /* Set up the memory for the new mode */ + rotate = LXGetRotation(pScrni->pScreen); + ret = LXAllocateMemory(pScrni->pScreen, pScrni, rotate); + + if (ret) { + if (pGeode->curMode != pMode) + ret = LXSetVideoMode(pScrni, pMode); + } + + if (ret) + ret = LXRotate(pScrni, pMode); + + /* Go back the way it was */ + + if (ret == FALSE) { + if (!LXSetVideoMode(pScrni, pGeode->curMode)) + xf86DrvMsg(pScrni->scrnIndex, X_ERROR, + "Could not restore the previous mode\n"); + } else + pGeode->curMode = pMode; + + return ret; +} + +static void +LXLeaveGraphics(ScrnInfoPtr pScrni) +{ + GeodeRec *pGeode = GEODEPTR(pScrni); + VG_PANNING_COORDINATES panning; + + gp_wait_until_idle(); + + lx_disable_dac_power(pScrni, DF_CRT_DISABLE); + + vg_set_custom_mode(&(pGeode->FBcimdisplaytiming.vgDisplayMode), + pGeode->FBcimdisplaytiming.wBpp); + + vg_set_compression_enable(0); + + /* Restore the previous Compression state */ + if (pGeode->FBCompressionEnable) { + vg_configure_compression(&(pGeode->FBCBData)); + vg_set_compression_enable(1); + } + + vg_set_display_pitch(pGeode->FBcimdisplaytiming.wPitch); + vg_set_display_offset(pGeode->FBDisplayOffset); + + /* Restore Cursor */ + vg_set_cursor_position(pGeode->FBCursor.cursor_x, + pGeode->FBCursor.cursor_y, &panning); + + LXRestore(pScrni); + + if (pGeode->useVGA && pGeode->VGAActive) { + pGeode->vesa->pInt->num = 0x10; + pGeode->vesa->pInt->ax = 0x0 | pGeode->FBBIOSMode; + pGeode->vesa->pInt->bx = 0; + xf86ExecX86int10(pGeode->vesa->pInt); + vg_delay_milliseconds(3); + } + + lx_enable_dac_power(pScrni, 1); + pScrni->vtSema = FALSE; +} + +static Bool +LXCloseScreen(int scrnIndex, ScreenPtr pScrn) +{ + ScrnInfoPtr pScrni = xf86Screens[scrnIndex]; + GeodeRec *pGeode = GEODEPTR(pScrni); + + if (pScrni->vtSema) + LXLeaveGraphics(pScrni); + + if (pGeode->pExa) { + exaDriverFini(pScrn); + xfree(pGeode->pExa); + pGeode->pExa = NULL; + } + + LXUnmapMem(pScrni); + + if (pGeode->useVGA) + vgaHWUnmapMem(pScrni); + + pScrni->PointerMoved = pGeode->PointerMoved; + pScrn->CloseScreen = pGeode->CloseScreen; + + if (pScrn->CloseScreen) + return (*pScrn->CloseScreen) (scrnIndex, pScrn); + + return TRUE; +} + +static Bool +LXEnterGraphics(ScreenPtr pScrn, ScrnInfoPtr pScrni) +{ + int bpp; + GeodeRec *pGeode = GEODEPTR(pScrni); + + pGeode->curMode = NULL; + + pGeode->VGAActive = gu3_get_vga_active(); + + gp_wait_until_idle(); + + //lx_disable_dac_power(pScrni, DF_CRT_DISABLE); + + vg_get_current_display_mode(&pGeode->FBcimdisplaytiming.vgDisplayMode, + &bpp); + + //dump_previous(&pGeode->FBcimdisplaytiming.vgDisplayMode); + + pGeode->FBcimdisplaytiming.wBpp = bpp; + pGeode->FBcimdisplaytiming.wPitch = vg_get_display_pitch(); + + pGeode->FBDisplayOffset = vg_get_display_offset(); + + if (pGeode->useVGA && pGeode->VGAActive) { + vgaHWPtr pvgaHW = VGAHWPTR(pScrni); + + pGeode->FBBIOSMode = pvgaHW->readCrtc(pvgaHW, 0x040); + } + + pGeode->FBCompressionEnable = vg_get_compression_enable(); + vg_get_compression_info(&(pGeode->FBCBData)); + + /* Save Cursor offset */ + vg_get_cursor_info(&pGeode->FBCursor); + + /* Turn off the VGA */ + + if (pGeode->useVGA) { + unsigned short sequencer; + vgaHWPtr pvgaHW = VGAHWPTR(pScrni); + + /* Unlock VGA registers */ + vgaHWUnlock(pvgaHW); + + /* Save the current state and setup the current mode */ + vgaHWSave(pScrni, &VGAHWPTR(pScrni)->SavedReg, VGA_SR_ALL); + + /* DISABLE VGA SEQUENCER */ + /* This allows the VGA state machine to terminate. We must delay */ + /* such that there are no pending MBUS requests. */ + + cim_outb(DC3_SEQUENCER_INDEX, DC3_SEQUENCER_CLK_MODE); + sequencer = cim_inb(DC3_SEQUENCER_DATA); + sequencer |= DC3_CLK_MODE_SCREEN_OFF; + cim_outb(DC3_SEQUENCER_DATA, sequencer); + + vg_delay_milliseconds(1); + + /* BLANK THE VGA DISPLAY */ + cim_outw(DC3_SEQUENCER_INDEX, DC3_SEQUENCER_RESET); + sequencer = cim_inb(DC3_SEQUENCER_DATA); + sequencer &= ~DC3_RESET_VGA_DISP_ENABLE; + cim_outb(DC3_SEQUENCER_DATA, sequencer); + + vg_delay_milliseconds(1); + } + + /* Set up the memory */ + /* XXX - FIXME - when we alow inital rotation, it should be here */ + LXAllocateMemory(pScrn, pScrni, pGeode->rotation); + + /* Clear the framebuffer */ + memset(pGeode->FBBase + pGeode->displayOffset, 0, pGeode->displaySize); + + /* Set the video mode */ + LXSetVideoMode(pScrni, pScrni->currentMode); + + pGeode->curMode = pScrni->currentMode; + pScrni->vtSema = TRUE; + + return TRUE; +} + +static void +LXLoadPalette(ScrnInfoPtr pScrni, + int numColors, int *indizes, LOCO * colors, VisualPtr pVisual) +{ + int i, index, color; + + for (i = 0; i < numColors; i++) { + index = indizes[i] & 0xFF; + color = (((unsigned long)(colors[index].red & 0xFF)) << 16) | + (((unsigned long)(colors[index].green & 0xFF)) << 8) | + ((unsigned long)(colors[index].blue & 0xFF)); + + vg_set_display_palette_entry(index, color); + } +} + +#ifdef DPMSExtension + +static void +LXDPMSSet(ScrnInfoPtr pScrni, int mode, int flags) +{ + GeodeRec *pGeode = GEODEPTR(pScrni); + + if (!pScrni->vtSema) + return; + + if (pGeode->Output & OUTPUT_DCON) { + if (DCONDPMSSet(pScrni, mode, flags)) + return; + } + + switch (mode) { + case DPMSModeOn: + lx_enable_dac_power(pScrni, 1); + break; + + case DPMSModeStandby: + lx_disable_dac_power(pScrni, DF_CRT_STANDBY); + break; + + case DPMSModeSuspend: + lx_disable_dac_power(pScrni, DF_CRT_SUSPEND); + break; + + case DPMSModeOff: + lx_disable_dac_power(pScrni, DF_CRT_DISABLE); + break; + } +} + +#endif + +static Bool +LXCreateScreenResources(ScreenPtr pScreen) +{ + ScrnInfoPtr pScrni = xf86Screens[pScreen->myNum]; + GeodeRec *pGeode = GEODEPTR(pScrni); + + pScreen->CreateScreenResources = pGeode->CreateScreenResources; + if (!(*pScreen->CreateScreenResources) (pScreen)) + return FALSE; + + if (xf86LoaderCheckSymbol("LXRandRSetConfig") + && pGeode->rotation != RR_Rotate_0) { + Rotation(*LXRandRSetConfig) (ScreenPtr pScreen, Rotation rr, int rate, + RRScreenSizePtr pSize) = NULL; + RRScreenSize p; + Rotation requestedRotation = pGeode->rotation; + + pGeode->rotation = RR_Rotate_0; + + /* Just setup enough for an initial rotate */ + + p.width = pScreen->width; + p.height = pScreen->height; + p.mmWidth = pScreen->mmWidth; + p.mmHeight = pScreen->mmHeight; + + LXRandRSetConfig = LoaderSymbol("LXRandRSetConfig"); + if (LXRandRSetConfig) { + pGeode->starting = TRUE; + (*LXRandRSetConfig) (pScreen, requestedRotation, 0, &p); + pGeode->starting = FALSE; + } + } + + return TRUE; +} + +static Bool +LXScreenInit(int scrnIndex, ScreenPtr pScrn, int argc, char **argv) +{ + ScrnInfoPtr pScrni = xf86Screens[scrnIndex]; + GeodeRec *pGeode = GEODEPTR(pScrni); + XF86ModReqInfo shadowReq; + int maj, min, ret, rotate; + + pGeode->starting = TRUE; + + /* If we are using VGA then go ahead and map the memory */ + + if (pGeode->useVGA) { + + if (!vgaHWMapMem(pScrni)) + return FALSE; + + vgaHWGetIOBase(VGAHWPTR(pScrni)); + } + + if (!pGeode->NoAccel) { + + pGeode->pExa = xnfcalloc(sizeof(ExaDriverRec), 1); + + if (pGeode->pExa) { + + /* THis is set in LXAllocMem */ + pGeode->pExa->memoryBase = 0; + + /* This is set in LXAllocateMemory */ + pGeode->pExa->memorySize = 0; + + pGeode->pExa->pixmapOffsetAlign = 32; + pGeode->pExa->pixmapPitchAlign = 32; + pGeode->pExa->flags = EXA_OFFSCREEN_PIXMAPS; + pGeode->pExa->maxX = pGeode->maxWidth - 1; + pGeode->pExa->maxY = pGeode->maxHeight - 1; + } else { + xf86DrvMsg(scrnIndex, X_ERROR, + "Couldn't allocate the EXA structure.\n"); + pGeode->NoAccel = TRUE; + } + } + + /* Map the memory here before doing anything else */ + + if (!LXMapMem(pScrni)) + return FALSE; + + /* XXX FIXME - Take down any of the structures on failure? */ + if (!LXEnterGraphics(pScrn, pScrni)) + return FALSE; + + miClearVisualTypes(); + + /* XXX Again - take down anything? */ + + if (pScrni->bitsPerPixel > 8) { + if (!miSetVisualTypes(pScrni->depth, + TrueColorMask, pScrni->rgbBits, pScrni->defaultVisual)) { + return FALSE; + } + } else { + if (!miSetVisualTypes(pScrni->depth, + miGetDefaultVisualMask(pScrni->depth), + pScrni->rgbBits, pScrni->defaultVisual)) { + return FALSE; + } + } + + miSetPixmapDepths(); + + /* Point at the visible area to start */ + + ret = fbScreenInit(pScrn, pGeode->FBBase + pGeode->displayOffset, + pScrni->virtualX, pScrni->virtualY, + pScrni->xDpi, pScrni->yDpi, pGeode->displayWidth, + pScrni->bitsPerPixel); + + if (!ret) + return FALSE; + + xf86SetBlackWhitePixels(pScrn); + + /* Set up the color ordering */ + if (pScrni->bitsPerPixel > 8) { + VisualPtr visual = pScrn->visuals + pScrn->numVisuals; + + while (--visual >= pScrn->visuals) { + if ((visual->class | DynamicClass) == DirectColor) { + visual->offsetRed = pScrni->offset.red; + visual->offsetGreen = pScrni->offset.green; + visual->offsetBlue = pScrni->offset.blue; + visual->redMask = pScrni->mask.red; + visual->greenMask = pScrni->mask.green; + visual->blueMask = pScrni->mask.blue; + } + } + } + + /* Must follow the color ordering */ + fbPictureInit(pScrn, 0, 0); + + if (!pGeode->NoAccel) + pGeode->NoAccel = LXExaInit(pScrn) ? FALSE : TRUE; + + miInitializeBackingStore(pScrn); + xf86SetBackingStore(pScrn); + + /* Set up the soft cursor */ + miDCInitialize(pScrn, xf86GetPointerScreenFuncs()); + + /* Set up the HW cursor - must follow the soft cursor init */ + + if (pGeode->tryHWCursor) { + if (!LXHWCursorInit(pScrn)) + xf86DrvMsg(scrnIndex, X_ERROR, + "Hardware cursor initialization failed.\n"); + } + + /* Set up the color map */ + + if (!miCreateDefColormap(pScrn)) + return FALSE; + + if (pScrni->bitsPerPixel == 8) { + /* Must follow initialization of the default colormap */ + + if (!xf86HandleColormaps(pScrn, 256, 8, + LXLoadPalette, NULL, + CMAP_PALETTED_TRUECOLOR | CMAP_RELOAD_ON_MODE_SWITCH)) { + return FALSE; + } + } +#ifdef DPMSExtension + xf86DPMSInit(pScrn, LXDPMSSet, 0); +#endif + + LXInitVideo(pScrn); + + /* Set up RandR */ + /* We provide our own RandR goodness - disable the default */ + xf86DisableRandR(); + + memset(&shadowReq, 0, sizeof(shadowReq)); + shadowReq.majorversion = 1; + shadowReq.minorversion = 1; + + if (LoadSubModule(pScrni->module, "shadow", + NULL, NULL, NULL, &shadowReq, &maj, &min)) { + + rotate = RR_Rotate_0 | RR_Rotate_90 | RR_Rotate_180 | RR_Rotate_270; + shadowSetup(pScrn); + } else { + LoaderErrorMsg(NULL, "shadow", maj, min); + xf86DrvMsg(pScrni->scrnIndex, X_ERROR, + "Error loading shadow - rotation not available.\n"); + + if (pGeode->rotation != RR_Rotate_0) + xf86DrvMsg(pScrni->scrnIndex, X_ERROR, + "Reverting back to normal rotation.\n"); + + rotate = pGeode->rotation = RR_Rotate_0; + } + + LXRandRInit(pScrn, rotate); + + pGeode->PointerMoved = pScrni->PointerMoved; + pScrni->PointerMoved = GeodePointerMoved; + pGeode->CreateScreenResources = pScrn->CreateScreenResources; + pScrn->CreateScreenResources = LXCreateScreenResources; + + pGeode->CloseScreen = pScrn->CloseScreen; + pScrn->CloseScreen = LXCloseScreen; + pScrn->SaveScreen = LXSaveScreen; + + if (serverGeneration == 1) + xf86ShowUnusedOptions(pScrni->scrnIndex, pScrni->options); + + pGeode->starting = FALSE; + + return TRUE; +} + +static int +LXValidMode(int scrnIndex, DisplayModePtr pMode, Bool Verbose, int flags) +{ + ScrnInfoPtr pScrni = xf86Screens[scrnIndex]; + GeodeRec *pGeode = GEODEPTR(pScrni); + int p, ret; + VG_QUERY_MODE vgQueryMode; + + memset(&vgQueryMode, 0, sizeof(vgQueryMode)); + + /* For builtin and default modes, try to look up the mode in Cimarron */ + + if ((pMode->type & M_T_BUILTIN) || (pMode->type & M_T_DEFAULT)) { + + if (pGeode->Output & OUTPUT_PANEL) { + + /* Can't scale this mode */ + + if ((pGeode->PanelY != pMode->CrtcHDisplay) && + pMode->CrtcHDisplay > 1024) + return MODE_NOMODE; + + vgQueryMode.panel_width = pGeode->PanelX; + vgQueryMode.panel_height = pGeode->PanelY; + + vgQueryMode.query_flags |= + VG_QUERYFLAG_PANELWIDTH | VG_QUERYFLAG_PANELHEIGHT; + } + + vgQueryMode.active_width = pMode->CrtcHDisplay; + vgQueryMode.active_height = pMode->CrtcVDisplay; + vgQueryMode.bpp = pScrni->bitsPerPixel; + vgQueryMode.hz = GeodeGetRefreshRate(pMode); + vgQueryMode.query_flags |= VG_QUERYFLAG_REFRESH | VG_QUERYFLAG_BPP | + VG_QUERYFLAG_ACTIVEWIDTH | VG_QUERYFLAG_ACTIVEHEIGHT; + + ret = vg_get_display_mode_index(&vgQueryMode); + + if (ret < 0) + return MODE_BAD; + } + + if (pGeode->tryCompression) + p = GeodeCalculatePitchBytes(pMode->CrtcHDisplay, + pScrni->bitsPerPixel); + else + p = ((pMode->CrtcHDisplay + 3) & ~3) * (pScrni->bitsPerPixel >> 3); + + if (p * pMode->CrtcVDisplay > pGeode->FBAvail) + return MODE_MEM; + + return MODE_OK; +} + +/* XXX - Way more to do here */ + +static Bool +LXEnterVT(int scrnIndex, int flags) +{ + ScrnInfoPtr pScrni = xf86Screens[scrnIndex]; + Bool ret = LXEnterGraphics(NULL, pScrni); + + /* Reallocate a shadow area, if we need it */ + + if (ret == TRUE) + ret = LXAllocShadow(pScrni); + + return ret; +} + +static void +LXLeaveVT(int scrnIndex, int flags) +{ + ScrnInfoPtr pScrni = xf86Screens[scrnIndex]; + GeodeRec *pGeode = GEODEPTR(pScrni); + + pGeode->PrevDisplayOffset = vg_get_display_offset(); + LXLeaveGraphics(xf86Screens[scrnIndex]); + + /* Destroy any shadow area, if we have it */ + + if (pGeode->shadowArea != NULL) { + exaOffscreenFree(pScrni->pScreen, pGeode->shadowArea); + pGeode->shadowArea = NULL; + } +} + +void +LXSetupChipsetFPtr(ScrnInfoPtr pScrn) +{ + pScrn->PreInit = LXPreInit; + pScrn->ScreenInit = LXScreenInit; + pScrn->SwitchMode = LXSwitchMode; + pScrn->AdjustFrame = LXAdjustFrame; + pScrn->EnterVT = LXEnterVT; + pScrn->LeaveVT = LXLeaveVT; + pScrn->FreeScreen = GeodeFreeScreen; + pScrn->ValidMode = LXValidMode; +} diff --git a/driver/xf86-video-geode/src/lx_exa.c b/driver/xf86-video-geode/src/lx_exa.c new file mode 100644 index 000000000..f6978d8ce --- /dev/null +++ b/driver/xf86-video-geode/src/lx_exa.c @@ -0,0 +1,1018 @@ +/* + * Copyright (c) 2007 Advanced Micro Devices, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + * Neither the name of the Advanced Micro Devices, Inc. nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + */ + +/* TODO: + Support a8 as a source or destination? + convert !a8 or !a4 masks? + support multiple pass operations? +*/ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "xf86.h" +#include "exa.h" + +#include "geode.h" +#include "cim_defs.h" +#include "cim_regs.h" + +#include "geode_blend.h" + +static const struct exa_format_t +{ + int exa; + int bpp; + int fmt; + int alphabits; +} lx_exa_formats[] = { + { + PICT_a8r8g8b8, 32, CIMGP_SOURCE_FMT_8_8_8_8, 8}, { + PICT_x8r8g8b8, 32, CIMGP_SOURCE_FMT_8_8_8_8, 0}, { + PICT_x8b8g8r8, 32, CIMGP_SOURCE_FMT_32BPP_BGR, 0}, { + PICT_a4r4g4b4, 16, CIMGP_SOURCE_FMT_4_4_4_4, 4}, { + PICT_a1r5g5b5, 16, CIMGP_SOURCE_FMT_1_5_5_5, 1}, { + PICT_r5g6b5, 16, CIMGP_SOURCE_FMT_0_5_6_5, 0}, { + PICT_b5g6r5, 16, CIMGP_SOURCE_FMT_16BPP_BGR, 0}, { + PICT_x1r5g5b5, 16, CIMGP_SOURCE_FMT_1_5_5_5, 0}, { + PICT_x1b5g5r5, 16, CIMGP_SOURCE_FMT_15BPP_BGR, 0}, { + PICT_r3g3b2, 8, CIMGP_SOURCE_FMT_3_3_2, 0} +}; + +/* This is a chunk of memory we use for scratch space */ + +#define COMP_TYPE_MASK 0 +#define COMP_TYPE_ONEPASS 1 +#define COMP_TYPE_TWOPASS 3 + +static struct +{ + int type; + + unsigned int srcOffset; + unsigned int srcPitch; + unsigned int srcBpp; + unsigned int srcWidth, srcHeight; + PixmapPtr srcPixmap; + + unsigned int srcColor; + int op; + int repeat; + unsigned int fourBpp; + unsigned int bufferOffset; + struct exa_format_t *srcFormat; + struct exa_format_t *dstFormat; +} exaScratch; + +static const int SDfn[16] = { + 0x00, 0x88, 0x44, 0xCC, 0x22, 0xAA, 0x66, 0xEE, + 0x11, 0x99, 0x55, 0xDD, 0x33, 0xBB, 0x77, 0xFF +}; + +static const int SDfn_PM[16] = { + 0x0A, 0x8A, 0x4A, 0xCA, 0x2A, 0xAA, 0x6A, 0xEA, + 0x1A, 0x9A, 0x5A, 0xDA, 0x3A, 0xBA, 0x7A, 0xFA +}; + +/* These functions check to see if we can safely prefetch the memory + * for the blt, or if we have to wait the previous blt to complete. + * One function is for the fill, and the other is for the copy because + * they have different requirements based on ROP + */ + +static int lx0 = -1, ly0 = -1, lx1 = -1, ly1 = -1; + +static int +lx_fill_flags(int x0, int y0, int w, int h, int rop) +{ + int x1 = x0 + w, y1 = y0 + h; + int n = ((rop ^ (rop >> 1)) & 0x55) == 0 || /* no dst */ + x0 >= lx1 || y0 >= ly1 || /* rght/below */ + x1 <= lx0 || y1 <= ly0 ? /* left/above */ + 0 : CIMGP_BLTFLAGS_HAZARD; + + lx0 = x0; + ly0 = y0; + lx1 = x1; + ly1 = y1; + + return n; +} + +static int +lx_copy_flags(int x0, int y0, int x1, int y1, int w, int h, int rop) +{ + int x2 = x1 + w, y2 = y1 + h; + + /* dst not hazzard and src not hazzard */ + int n = (((rop ^ (rop >> 1)) & 0x55) == 0 || + x1 >= lx1 || y1 >= ly1 || + x2 <= lx0 || y2 <= ly0) && + (((rop ^ (rop >> 2)) & 0x33) == 0 || + x0 >= lx1 || y0 >= ly1 || + x0 + w <= lx0 || y0 + h <= ly0) ? 0 : CIMGP_BLTFLAGS_HAZARD; + + lx0 = x1; + ly0 = y1; + lx1 = x2; + ly1 = y2; + + return n; +} + +/* These are borrowed from the exa engine - they should be made global + and available to drivers, but until then.... +*/ + +/* exaGetPixelFromRGBA (exa_render.c) */ + +static Bool +_GetPixelFromRGBA(CARD32 * pixel, + CARD16 red, CARD16 green, CARD16 blue, CARD16 alpha, CARD32 format) +{ + int rbits, bbits, gbits, abits; + int rshift, bshift, gshift, ashift; + + *pixel = 0; + + if (!PICT_FORMAT_COLOR(format)) + return FALSE; + + rbits = PICT_FORMAT_R(format); + gbits = PICT_FORMAT_G(format); + bbits = PICT_FORMAT_B(format); + abits = PICT_FORMAT_A(format); + + if (PICT_FORMAT_TYPE(format) == PICT_TYPE_ARGB) { + bshift = 0; + gshift = bbits; + rshift = gshift + gbits; + ashift = rshift + rbits; + } else { /* PICT_TYPE_ABGR */ + rshift = 0; + gshift = rbits; + bshift = gshift + gbits; + ashift = bshift + bbits; + } + + *pixel |= (blue >> (16 - bbits)) << bshift; + *pixel |= (red >> (16 - rbits)) << rshift; + *pixel |= (green >> (16 - gbits)) << gshift; + *pixel |= (alpha >> (16 - abits)) << ashift; + + return TRUE; +} + +/* exaGetRGBAFromPixel (exa_render.c) */ + +static Bool +_GetRGBAFromPixel(CARD32 pixel, + CARD16 * red, + CARD16 * green, CARD16 * blue, CARD16 * alpha, CARD32 format) +{ + int rbits, bbits, gbits, abits; + int rshift, bshift, gshift, ashift; + + if (!PICT_FORMAT_COLOR(format)) + return FALSE; + + rbits = PICT_FORMAT_R(format); + gbits = PICT_FORMAT_G(format); + bbits = PICT_FORMAT_B(format); + abits = PICT_FORMAT_A(format); + + if (PICT_FORMAT_TYPE(format) == PICT_TYPE_ARGB) { + bshift = 0; + gshift = bbits; + rshift = gshift + gbits; + ashift = rshift + rbits; + } else { /* PICT_TYPE_ABGR */ + rshift = 0; + gshift = rbits; + bshift = gshift + gbits; + ashift = bshift + bbits; + } + + *red = ((pixel >> rshift) & ((1 << rbits) - 1)) << (16 - rbits); + while (rbits < 16) { + *red |= *red >> rbits; + rbits <<= 1; + } + + *green = ((pixel >> gshift) & ((1 << gbits) - 1)) << (16 - gbits); + while (gbits < 16) { + *green |= *green >> gbits; + gbits <<= 1; + } + + *blue = ((pixel >> bshift) & ((1 << bbits) - 1)) << (16 - bbits); + while (bbits < 16) { + *blue |= *blue >> bbits; + bbits <<= 1; + } + + if (abits) { + *alpha = ((pixel >> ashift) & ((1 << abits) - 1)) << (16 - abits); + while (abits < 16) { + *alpha |= *alpha >> abits; + abits <<= 1; + } + } else + *alpha = 0xffff; + + return TRUE; +} + +static unsigned int +lx_get_source_color(PixmapPtr pSrc, int srcFormat, int dstFormat) +{ + CARD32 in, out; + CARD16 red = 0, green = 0, blue = 0, alpha = 0; + + /* Stall to avoid a race with the upload function */ + /* for 1.4 and newer, the problem will be resolved within + * exaGetPixmapFirstPixel, so this should be adjusted so + * the stall isn't run needlessly + */ + + gp_wait_until_idle(); + in = exaGetPixmapFirstPixel(pSrc); + + _GetRGBAFromPixel(in, &red, &blue, &green, &alpha, srcFormat); + _GetPixelFromRGBA(&out, red, blue, green, alpha, dstFormat); + + return out; +} + +static Bool +lx_prepare_solid(PixmapPtr pxMap, int alu, Pixel planemask, Pixel fg) +{ + int pitch = exaGetPixmapPitch(pxMap); + int op = (planemask == ~0U) ? SDfn[alu] : SDfn_PM[alu]; + + gp_declare_blt(0); + gp_set_bpp(pxMap->drawable.bitsPerPixel); + + gp_set_raster_operation(op); + + if (planemask != ~0U) + gp_set_solid_pattern(planemask); + + exaScratch.op = op; + + gp_set_solid_source(fg); + gp_set_strides(pitch, pitch); + gp_write_parameters(); + return TRUE; +} + +static void +lx_do_solid(PixmapPtr pxMap, int x1, int y1, int x2, int y2) +{ + int bpp = (pxMap->drawable.bitsPerPixel + 7) / 8; + int pitch = exaGetPixmapPitch(pxMap); + unsigned int offset = + exaGetPixmapOffset(pxMap) + (pitch * y1) + (bpp * x1); + + gp_declare_blt(lx_fill_flags(x1, y1, x2 - x1, y2 - y1, exaScratch.op)); + gp_pattern_fill(offset, x2 - x1, y2 - y1); +} + +static Bool +lx_prepare_copy(PixmapPtr pxSrc, PixmapPtr pxDst, int dx, int dy, + int alu, Pixel planemask) +{ + int dpitch = exaGetPixmapPitch(pxDst); + int op = (planemask == ~0U) ? SDfn[alu] : SDfn_PM[alu]; + + gp_declare_blt(0); + gp_set_bpp(pxDst->drawable.bitsPerPixel); + + gp_set_raster_operation(op); + + if (planemask != ~0U) + gp_set_solid_pattern(planemask); + + exaScratch.srcOffset = exaGetPixmapOffset(pxSrc); + exaScratch.srcPitch = exaGetPixmapPitch(pxSrc); + exaScratch.srcBpp = (pxSrc->drawable.bitsPerPixel + 7) / 8; + + exaScratch.op = op; + + gp_set_strides(dpitch, exaScratch.srcPitch); + gp_write_parameters(); + return TRUE; +} + +static void +lx_do_copy(PixmapPtr pxDst, int srcX, int srcY, + int dstX, int dstY, int w, int h) +{ + int dstBpp = (pxDst->drawable.bitsPerPixel + 7) / 8; + int dstPitch = exaGetPixmapPitch(pxDst); + unsigned int srcOffset, dstOffset; + int flags = 0; + + gp_declare_blt(lx_copy_flags(srcX, srcY, dstX, dstY, w, h, + exaScratch.op)); + + //gp_declare_blt(0); + + srcOffset = exaScratch.srcOffset + (exaScratch.srcPitch * srcY) + + (exaScratch.srcBpp) * srcX; + + dstOffset = exaGetPixmapOffset(pxDst) + (dstPitch * dstY) + + (dstBpp * dstX); + + flags = 0; + + if (dstX > srcX) + flags |= CIMGP_NEGXDIR; + + if (dstY > srcY) + flags |= CIMGP_NEGYDIR; + + gp_screen_to_screen_blt(dstOffset, srcOffset, w, h, flags); +} + +/* Composite operations + +These are the simplest - one pass operations - if there is no format or +mask, the we can make these happen pretty fast + + Operation Type Channel Alpha +PictOpClear 0 2 0 3 +PictOpSrc 0 3 0 3 +PictOpDst 0 3 1 3 +PictOpOver 2 0 0 3 +PictOpOverReverse 2 0 1 3 +PictOpIn 0 1 0 3 +PictOpInReverse 0 1 1 3 +PictOpOut 1 0 0 3 +PictOpOutReverse 1 0 1 3 +PictOpAdd 2 2 0 3 + +The following require multiple passes +PictOpAtop +PictOpXor +*/ + +struct blend_ops_t +{ + int operation; + int type; + int channel; +} lx_alpha_ops[] = { + /* PictOpClear */ + { + CIMGP_ALPHA_TIMES_A, CIMGP_CONSTANT_ALPHA, CIMGP_CHANNEL_A_SOURCE}, { + }, + /* PictOpSrc */ + { + CIMGP_ALPHA_TIMES_A, CIMGP_ALPHA_EQUALS_ONE, CIMGP_CHANNEL_A_SOURCE}, { + }, + /* PictOpDst */ + { + CIMGP_ALPHA_TIMES_A, CIMGP_ALPHA_EQUALS_ONE, CIMGP_CHANNEL_A_DEST}, { + }, + /* PictOpOver */ + { + CIMGP_ALPHA_A_PLUS_BETA_B, CIMGP_CHANNEL_A_ALPHA, CIMGP_CHANNEL_A_SOURCE}, + { + }, + /* PictOpOverReverse */ + { + CIMGP_ALPHA_A_PLUS_BETA_B, CIMGP_CHANNEL_A_ALPHA, CIMGP_CHANNEL_A_DEST}, { + }, + /* PictOpIn */ + { + CIMGP_ALPHA_TIMES_A, CIMGP_CHANNEL_B_ALPHA, CIMGP_CHANNEL_A_SOURCE}, { + }, + /* PictOpInReverse */ + { + CIMGP_ALPHA_TIMES_A, CIMGP_CHANNEL_B_ALPHA, CIMGP_CHANNEL_A_DEST}, { + }, + /* PictOpOut */ + { + CIMGP_BETA_TIMES_B, CIMGP_CHANNEL_A_ALPHA, CIMGP_CHANNEL_A_SOURCE}, { + }, + /* PictOpOutReverse */ + { + CIMGP_BETA_TIMES_B, CIMGP_CHANNEL_A_ALPHA, CIMGP_CHANNEL_A_DEST}, { + }, + /* SrcAtop */ + { + CIMGP_ALPHA_TIMES_A, CIMGP_CHANNEL_B_ALPHA, CIMGP_CHANNEL_A_DEST}, { + CIMGP_BETA_TIMES_B, CIMGP_CHANNEL_A_ALPHA, CIMGP_CHANNEL_A_SOURCE}, + /* SrcAtopReverse */ + { + CIMGP_ALPHA_TIMES_A, CIMGP_CHANNEL_B_ALPHA, CIMGP_CHANNEL_A_SOURCE}, { + CIMGP_BETA_TIMES_B, CIMGP_CHANNEL_A_ALPHA, CIMGP_CHANNEL_A_DEST}, + /* Xor */ + { + CIMGP_BETA_TIMES_B, CIMGP_CHANNEL_A_ALPHA, CIMGP_CHANNEL_A_SOURCE}, { + CIMGP_BETA_TIMES_B, CIMGP_CHANNEL_A_ALPHA, CIMGP_CHANNEL_A_SOURCE}, + /* PictOpAdd */ + { + CIMGP_A_PLUS_BETA_B, CIMGP_CONSTANT_ALPHA, CIMGP_CHANNEL_A_SOURCE}, { + } +}; + +#define ARRAY_SIZE(a) (sizeof((a)) / (sizeof(*(a)))) + +static const struct exa_format_t * +lx_get_format(PicturePtr p) +{ + int i; + unsigned int format = p->format; + + for (i = 0; i < ARRAY_SIZE(lx_exa_formats); i++) { + + if (lx_exa_formats[i].bpp < PICT_FORMAT_BPP(format)) + break; + else if (lx_exa_formats[i].bpp != PICT_FORMAT_BPP(format)) + continue; + + if (lx_exa_formats[i].exa == format) + return (&lx_exa_formats[i]); + } + +#if 0 + ErrorF("Couldn't match on format %x\n", format); + ErrorF("BPP = %d, type = %d, ARGB(%d,%d,%d,%d)n", + PICT_FORMAT_BPP(format), + PICT_FORMAT_TYPE(format), + PICT_FORMAT_A(format), + PICT_FORMAT_R(format), PICT_FORMAT_G(format), PICT_FORMAT_B(format)); +#endif + + return NULL; +} + +static Bool +lx_check_composite(int op, PicturePtr pSrc, PicturePtr pMsk, PicturePtr pDst) +{ + GeodeRec *pGeode = GEODEPTR_FROM_PICTURE(pDst); + + /* Check that the operation is supported */ + + if (op > PictOpAdd) + return FALSE; + + if (usesPasses(op)) { + if (pGeode->exaBfrOffset == 0 || !pMsk) + return FALSE; + } + + /* Check that the filter matches what we support */ + + switch (pSrc->filter) { + case PictFilterNearest: + case PictFilterFast: + case PictFilterGood: + case PictFilterBest: + break; + + default: + ErrorF("invalid filter %d\n", pSrc->filter); + return FALSE; + } + + /* We don't handle transforms */ + + if (pSrc->transform) + return FALSE; + + /* XXX - I don't understand PICT_a8 enough - so I'm punting */ + + if (pSrc->format == PICT_a8 || pDst->format == PICT_a8) + return FALSE; + + return TRUE; +} + +static Bool +lx_prepare_composite(int op, PicturePtr pSrc, PicturePtr pMsk, + PicturePtr pDst, PixmapPtr pxSrc, PixmapPtr pxMsk, PixmapPtr pxDst) +{ + GeodeRec *pGeode = GEODEPTR_FROM_PIXMAP(pxDst); + const struct exa_format_t *srcFmt, *dstFmt; + + /* Get the formats for the source and destination */ + + if ((srcFmt = lx_get_format(pSrc)) == NULL) { + ErrorF("EXA: Invalid source format %x\n", pSrc->format); + return FALSE; + } + + if ((dstFmt = lx_get_format(pDst)) == NULL) { + ErrorF("EXA: Invalid destination format %x\n", pDst->format); + return FALSE; + } + + /* Make sure operations that need alpha bits have them */ + /* If a mask is enabled, the alpha will come from there */ + + if (!pMsk && (!srcFmt->alphabits && usesSrcAlpha(op))) { + ErrorF("EXA: Source needs alpha bits\n"); + return FALSE; + } + + if (!pMsk && (!dstFmt->alphabits && usesDstAlpha(op))) { + ErrorF("EXA: Dest needs alpha bits\n"); + return FALSE; + } + + /* FIXME: See a way around this! */ + + if (srcFmt->alphabits == 0 && dstFmt->alphabits != 0) + return FALSE; + + /* Set up the scratch buffer with the information we need */ + + exaScratch.srcFormat = (struct exa_format_t *)srcFmt; + exaScratch.dstFormat = (struct exa_format_t *)dstFmt; + exaScratch.op = op; + exaScratch.repeat = pSrc->repeat; + exaScratch.bufferOffset = pGeode->exaBfrOffset; + + if (pMsk && op != PictOpClear) { + struct blend_ops_t *opPtr = &lx_alpha_ops[op * 2]; + int direction = (opPtr->channel == CIMGP_CHANNEL_A_SOURCE) ? 0 : 1; + + /* We can only do masks with a 8bpp or a 4bpp mask */ + + if (pMsk->format != PICT_a8 && pMsk->format != PICT_a4) + return FALSE; + + /* Direction 0 indicates src->dst, 1 indiates dst->src */ + + if (((direction == 0) && (pxSrc->drawable.bitsPerPixel < 16)) || + ((direction == 1) && (pxDst->drawable.bitsPerPixel < 16))) { + ErrorF("Can't do mask blending with less then 16bpp\n"); + return FALSE; + } + + /* Get the source color */ + + if (direction == 0) + exaScratch.srcColor = lx_get_source_color(pxSrc, pSrc->format, + pDst->format); + else + exaScratch.srcColor = lx_get_source_color(pxDst, pDst->format, + pSrc->format); + + /* FIXME: What to do here? */ + + if (pSrc->pDrawable->width != 1 || pSrc->pDrawable->height != 1) + return FALSE; + + /* Save off the info we need (reuse the source values to save space) */ + + exaScratch.type = COMP_TYPE_MASK; + + exaScratch.srcOffset = exaGetPixmapOffset(pxMsk); + exaScratch.srcPitch = exaGetPixmapPitch(pxMsk); + exaScratch.srcBpp = (pxMsk->drawable.bitsPerPixel + 7) / 8; + + exaScratch.srcWidth = pMsk->pDrawable->width; + exaScratch.srcHeight = pMsk->pDrawable->height; + + /* Flag to indicate if this a 8BPP or a 4BPP mask */ + exaScratch.fourBpp = (pxMsk->drawable.bitsPerPixel == 4) ? 1 : 0; + + /* If the direction is reversed, then remember the source */ + + if (direction == 1) + exaScratch.srcPixmap = pxSrc; + } else { + if (usesPasses(op)) + exaScratch.type = COMP_TYPE_TWOPASS; + else + exaScratch.type = COMP_TYPE_ONEPASS; + + exaScratch.srcOffset = exaGetPixmapOffset(pxSrc); + exaScratch.srcPitch = exaGetPixmapPitch(pxSrc); + exaScratch.srcBpp = (pxSrc->drawable.bitsPerPixel + 7) / 8; + + exaScratch.srcWidth = pSrc->pDrawable->width; + exaScratch.srcHeight = pSrc->pDrawable->height; + } + + return TRUE; +} + +static int +lx_get_bpp_from_format(int format) +{ + + switch (format) { + case CIMGP_SOURCE_FMT_8_8_8_8: + case CIMGP_SOURCE_FMT_32BPP_BGR: + return 32; + + case CIMGP_SOURCE_FMT_4_4_4_4: + return 12; + + case CIMGP_SOURCE_FMT_0_5_6_5: + case CIMGP_SOURCE_FMT_16BPP_BGR: + return 16; + + case CIMGP_SOURCE_FMT_1_5_5_5: + case CIMGP_SOURCE_FMT_15BPP_BGR: + return 15; + + case CIMGP_SOURCE_FMT_3_3_2: + return 8; + } + + return 0; +} + +/* BGR needs to be set in the source for it to take - so adjust the source + * to enable BGR if the two formats are different, and disable it if they + * are the same + */ + +static void +lx_set_source_format(int srcFormat, int dstFormat) +{ + if (!(srcFormat & 0x10) && (dstFormat & 0x10)) + gp_set_source_format(srcFormat | 0x10); + else if ((srcFormat & 0x10) && (dstFormat & 0x10)) + gp_set_source_format(srcFormat & ~0x10); + else + gp_set_source_format(srcFormat); +} + +/* If we are converting colors and we need the channel A alpha, + * then use a special alpha type that preserves the alpha before + * converting the format + */ + +static inline int +get_op_type(struct exa_format_t *src, struct exa_format_t *dst, int type) +{ + return (type == CIMGP_CHANNEL_A_ALPHA && + src->alphabits != dst->alphabits) ? CIMGP_CONVERTED_ALPHA : type; +} + +/* Note - this is the preferred onepass method. The other will remain + * ifdefed out until such time that we are sure its not needed + */ + +#if 1 + +static void +lx_composite_onepass(PixmapPtr pxDst, unsigned long dstOffset, + unsigned long srcOffset, int width, int height) +{ + struct blend_ops_t *opPtr; + int apply, type; + + opPtr = &lx_alpha_ops[exaScratch.op * 2]; + + apply = (exaScratch.dstFormat->alphabits != 0 && + exaScratch.srcFormat->alphabits != 0) ? + CIMGP_APPLY_BLEND_TO_ALL : CIMGP_APPLY_BLEND_TO_RGB; + + gp_declare_blt(0); + gp_set_bpp(lx_get_bpp_from_format(exaScratch.dstFormat->fmt)); + gp_set_strides(exaGetPixmapPitch(pxDst), exaScratch.srcPitch); + + lx_set_source_format(exaScratch.srcFormat->fmt, + exaScratch.dstFormat->fmt); + + type = + get_op_type(exaScratch.srcFormat, exaScratch.dstFormat, opPtr->type); + + gp_set_alpha_operation(opPtr->operation, type, opPtr->channel, apply, 0); + + gp_screen_to_screen_convert(dstOffset, srcOffset, width, height, 0); +} + +#else + +/* XXX - For now, we assume that the conversion will fit */ + +static void +lx_composite_onepass(PixmapPtr pxDst, unsigned long dstOffset, + unsigned long srcOffset, int width, int height) +{ + struct blend_ops_t *opPtr; + int apply, type; + int sbpp = lx_get_bpp_from_format(exaScratch.srcFormat->fmt); + + /* Copy the destination into the scratch buffer */ + + gp_declare_blt(0); + + gp_set_bpp(sbpp); + + gp_set_source_format(exaScratch.dstFormat->fmt); + + gp_set_raster_operation(0xCC); + gp_set_strides(exaScratch.srcPitch, exaGetPixmapPitch(pxDst)); + gp_screen_to_screen_convert(exaScratch.bufferOffset, dstOffset, width, + height, 0); + + /* Do the blend */ + + opPtr = &lx_alpha_ops[exaScratch.op * 2]; + apply = (exaScratch.srcFormat->alphabits == 0) ? + CIMGP_APPLY_BLEND_TO_RGB : CIMGP_APPLY_BLEND_TO_ALL; + + gp_declare_blt(0); + gp_set_bpp(sbpp); + + type = + get_op_type(exaScratch.srcFormat, exaScrach.dstFormat, opPtr->type); + + gp_set_alpha_operation(opPtr->operation, type, opPtr->channel, apply, 0); + + gp_set_strides(exaScratch.srcPitch, exaScratch.srcPitch); + gp_screen_to_screen_blt(exaScratch.bufferOffset, srcOffset, + width, height, 0); + + /* And copy back */ + + gp_declare_blt(0); + gp_set_bpp(pxDst->drawable.bitsPerPixel); + gp_set_source_format(exaScratch.srcFormat->fmt); + gp_set_raster_operation(0xCC); + gp_set_strides(exaGetPixmapPitch(pxDst), exaScratch.srcPitch); + gp_screen_to_screen_convert(dstOffset, exaScratch.bufferOffset, + width, height, 0); +} + +#endif + +#if 0 + +lx_composite_convert(PixmapPtr pxDst, unsigned long dstOffset, + unsigned long srcOffset, int width, int height) +{ + /* Step 1 - copy the destination into the scratch buffer */ + + gp_declare_blt(0); + gp_set_bpp(lx_get_bpp_from_format(exaScratch.dstFormat->fmt)); + + gp_set_raster_operation(0xCC); + gp_set_strides(exaGetPixmapPitch(pxDst), exaGetPixmapPitch(pxDst)); + + gp_screen_to_screen_blt(exaScratch.bufferOffset, dstOffset, width, height, + 0); + + /* Step 2 - Do the original blend */ + + lx_composite_onepass(pxDst, exaScratch.bufferOffset, srcOffset, width, + height); + + /* Step 3 - copy back and fixup the alpha */ + gp_declare_blt(0); + gp_set_bpp(lx_get_bpp_from_format(exaScratch.dstFormat->fmt)); + gp_set_strides(exaGetPixmapPitch(pxDst), exaGetPixmapPitch(pxDst)); + + /* FIXME: Does this alpha value need to be changed for the mode? */ + + gp_set_alpha_operation(CIMGP_ALPHA_TIMES_A, CIMGP_CONSTANT_ALPHA, + CIMGP_CHANNEL_A_SOURCE, CIMGP_APPLY_BLEND_TO_ALPHA, 1); + + gp_screen_to_screen_blt(dstOffset, exaScratch.bufferOffset, width, height, + 0); +} + +#endif + +/* This function handles the multipass blend functions */ + +static void +lx_composite_multipass(PixmapPtr pxDst, unsigned long dstOffset, + unsigned long srcOffset, int width, int height) +{ + struct blend_ops_t *opPtr; + int sbpp = lx_get_bpp_from_format(exaScratch.srcFormat->fmt); + int apply, type; + + /* Wait until the GP is idle - this will ensure that the scratch buffer + * isn't occupied */ + + gp_wait_until_idle(); + + /* Copy the destination to the scratch buffer, and convert it to the + * source format */ + + gp_declare_blt(0); + + gp_set_bpp(sbpp); + gp_set_source_format(exaScratch.dstFormat->fmt); + gp_set_raster_operation(0xCC); + gp_set_strides(exaScratch.srcPitch, exaGetPixmapPitch(pxDst)); + gp_screen_to_screen_convert(exaScratch.bufferOffset, dstOffset, + width, height, 0); + + /* Do the first blend from the source to the scratch buffer */ + + gp_declare_blt(CIMGP_BLTFLAGS_HAZARD); + gp_set_bpp(sbpp); + gp_set_source_format(exaScratch.srcFormat->fmt); + gp_set_strides(exaScratch.srcPitch, exaScratch.srcPitch); + + opPtr = &lx_alpha_ops[exaScratch.op * 2]; + + apply = (exaScratch.srcFormat->alphabits == 0) ? + CIMGP_APPLY_BLEND_TO_RGB : CIMGP_APPLY_BLEND_TO_ALL; + + /* If we're destroying the source alpha bits, then make sure we + * use the alpha before the color conversion + */ + + gp_screen_to_screen_blt(exaScratch.bufferOffset, srcOffset, width, height, + 0); + + /* Finally, do the second blend back to the destination */ + + opPtr = &lx_alpha_ops[(exaScratch.op * 2) + 1]; + + apply = (exaScratch.dstFormat->alphabits == 0) ? + CIMGP_APPLY_BLEND_TO_RGB : CIMGP_APPLY_BLEND_TO_ALL; + + gp_declare_blt(CIMGP_BLTFLAGS_HAZARD); + gp_set_bpp(lx_get_bpp_from_format(exaScratch.dstFormat->fmt)); + + lx_set_source_format(exaScratch.srcFormat->fmt, + exaScratch.dstFormat->fmt); + + type = + get_op_type(exaScratch.srcFormat, exaScratch.dstFormat, opPtr->type); + + gp_set_alpha_operation(opPtr->operation, type, opPtr->channel, apply, 0); + + gp_screen_to_screen_convert(dstOffset, exaScratch.bufferOffset, + width, height, 0); +} + +static void +lx_do_composite_mask(PixmapPtr pxDst, unsigned long dstOffset, + unsigned int maskOffset, int width, int height) +{ + struct blend_ops_t *opPtr = &lx_alpha_ops[exaScratch.op * 2]; + + gp_declare_blt(0); + + gp_set_source_format(exaScratch.srcFormat->fmt); + gp_set_strides(exaGetPixmapPitch(pxDst), exaScratch.srcPitch); + gp_set_bpp(lx_get_bpp_from_format(exaScratch.dstFormat->fmt)); + gp_set_solid_source(exaScratch.srcColor); + + gp_blend_mask_blt(dstOffset, 0, width, height, maskOffset, + exaScratch.srcPitch, opPtr->operation, exaScratch.fourBpp); +} + +#define GetPixmapOffset(px, x, y) ( exaGetPixmapOffset((px)) + \ + (exaGetPixmapPitch((px)) * (y)) + \ + ((((px)->drawable.bitsPerPixel + 7) / 8) * (x)) ) + +static void +lx_do_composite(PixmapPtr pxDst, int srcX, int srcY, int maskX, + int maskY, int dstX, int dstY, int width, int height) +{ + + struct blend_ops_t *opPtr = &lx_alpha_ops[exaScratch.op * 2]; + + unsigned int dstOffset, srcOffset; + + unsigned int opX = dstX; + unsigned int opY = dstY; + unsigned int opWidth = width; + unsigned int opHeight = height; + + if (exaScratch.type == COMP_TYPE_MASK) + srcOffset = exaScratch.srcOffset + (maskY * exaScratch.srcPitch) + + (maskX * exaScratch.srcBpp); + else + srcOffset = exaScratch.srcOffset + (srcY * exaScratch.srcPitch) + + (srcX * exaScratch.srcBpp); + + /* Adjust the width / height of the operation the size of the source */ + + if (exaScratch.srcWidth < width) + opWidth = exaScratch.srcWidth; + + if (exaScratch.srcHeight < height) + opHeight = exaScratch.srcHeight; + + while (1) { + dstOffset = GetPixmapOffset(pxDst, opX, opY); + + switch (exaScratch.type) { + case COMP_TYPE_MASK:{ + int direction = + (opPtr->channel == CIMGP_CHANNEL_A_SOURCE) ? 0 : 1; + + if (direction == 1) { + dstOffset = + GetPixmapOffset(exaScratch.srcPixmap, dstX, dstY); + lx_do_composite_mask(exaScratch.srcPixmap, dstOffset, + srcOffset, opWidth, opHeight); + } else { + lx_do_composite_mask(pxDst, dstOffset, srcOffset, opWidth, + opHeight); + } + } + break; + + case COMP_TYPE_ONEPASS: + lx_composite_onepass(pxDst, dstOffset, srcOffset, opWidth, + opHeight); + break; + + case COMP_TYPE_TWOPASS: + lx_composite_multipass(pxDst, dstOffset, srcOffset, opWidth, + opHeight); + break; + } + + if (!exaScratch.repeat) + break; + + opX += opWidth; + + if (opX >= dstX + width) { + opX = dstX; + opY += opHeight; + + if (opY >= dstY + height) + break; + } + + opWidth = ((dstX + width) - opX) > exaScratch.srcWidth ? + exaScratch.srcWidth : (dstX + width) - opX; + opHeight = ((dstY + height) - opY) > exaScratch.srcHeight ? + exaScratch.srcHeight : (dstY + height) - opY; + } +} + +static void +lx_wait_marker(ScreenPtr PScreen, int marker) +{ + gp_wait_until_idle(); +} + +static void +lx_done(PixmapPtr ptr) +{ +} + +Bool +LXExaInit(ScreenPtr pScreen) +{ + ScrnInfoPtr pScrni = xf86Screens[pScreen->myNum]; + GeodeRec *pGeode = GEODEPTR(pScrni); + ExaDriverPtr pExa = pGeode->pExa; + + pExa->exa_major = EXA_VERSION_MAJOR; + pExa->exa_minor = EXA_VERSION_MINOR; + + pExa->WaitMarker = lx_wait_marker; + + pExa->PrepareSolid = lx_prepare_solid; + pExa->Solid = lx_do_solid; + pExa->DoneSolid = lx_done; + + pExa->PrepareCopy = lx_prepare_copy; + pExa->Copy = lx_do_copy; + pExa->DoneCopy = lx_done; + + /* Composite */ + pExa->CheckComposite = lx_check_composite; + pExa->PrepareComposite = lx_prepare_composite; + pExa->Composite = lx_do_composite; + pExa->DoneComposite = lx_done; + + return exaDriverInit(pScreen, pGeode->pExa); +} diff --git a/driver/xf86-video-geode/src/lx_randr.c b/driver/xf86-video-geode/src/lx_randr.c new file mode 100644 index 000000000..e22466c47 --- /dev/null +++ b/driver/xf86-video-geode/src/lx_randr.c @@ -0,0 +1,370 @@ +/* Originally derived from the Intel example + * Copyright (C) 2002 Keith Packard, member of The XFree86 Project, Inc. + + * Copyright (c) 2006 Advanced Micro Devices, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + * + * Neither the name of the Advanced Micro Devices, Inc. nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + */ + +#include "xf86.h" +#include "os.h" +#include "mibank.h" +#include "globals.h" +#include "xf86.h" +#include "xf86Priv.h" +#include "xf86DDC.h" +#include "mipointer.h" +#include "windowstr.h" +#include +#include + +#include "geode.h" + +static int LXRandRGeneration; + +typedef struct _LXRandRInfo +{ + int virtualX; + int virtualY; + int mmWidth; + int mmHeight; + int maxX; + int maxY; + Rotation rotation; /* current mode */ + Rotation supported_rotations; /* driver supported */ +} XF86RandRInfoRec, *XF86RandRInfoPtr; + +#define AMD_OLDPRIV (GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) < 4) +#if AMD_OLDPRIV + +static int LXRandRIndex; + +#define XF86RANDRINFO(p) ((XF86RandRInfoPtr) (p)->devPrivates[LXRandRIndex].ptr) + +#else + +static DevPrivateKey LXRandRKey; + +#define XF86RANDRINFO(p) ((XF86RandRInfoPtr) \ + dixLookupPrivate(&(p)->devPrivates, LXRandRKey)); + +#endif + +static int +LXRandRModeRefresh(DisplayModePtr mode) +{ + if (mode->VRefresh) + return (int)(mode->VRefresh + 0.5); + else + return (int)(mode->Clock * 1000.0 / mode->HTotal / mode->VTotal + + 0.5); +} + +static Bool +LXRandRGetInfo(ScreenPtr pScreen, Rotation * rotations) +{ + RRScreenSizePtr pSize; + ScrnInfoPtr pScrni = XF86SCRNINFO(pScreen); + XF86RandRInfoPtr pRandr = XF86RANDRINFO(pScreen); + DisplayModePtr mode; + int refresh0 = 60; + int maxX = 0, maxY = 0; + + *rotations = pRandr->supported_rotations; + + if (pRandr->virtualX == -1 || pRandr->virtualY == -1) { + pRandr->virtualX = pScrni->virtualX; + pRandr->virtualY = pScrni->virtualY; + } + + for (mode = pScrni->modes;; mode = mode->next) { + int refresh = LXRandRModeRefresh(mode); + + if (pRandr->maxX == 0 || pRandr->maxY == 0) { + if (maxX < mode->HDisplay) + maxX = mode->HDisplay; + if (maxY < mode->VDisplay) + maxY = mode->VDisplay; + } + + if (mode == pScrni->modes) + refresh0 = refresh; + + pSize = RRRegisterSize(pScreen, + mode->HDisplay, mode->VDisplay, + pRandr->mmWidth, pRandr->mmHeight); + if (!pSize) + return FALSE; + + RRRegisterRate(pScreen, pSize, refresh); + + if (mode == pScrni->currentMode && + mode->HDisplay == pScrni->virtualX + && mode->VDisplay == pScrni->virtualY) + RRSetCurrentConfig(pScreen, pRandr->rotation, refresh, pSize); + if (mode->next == pScrni->modes) + break; + } + + if (pRandr->maxX == 0 || pRandr->maxY == 0) { + pRandr->maxX = maxX; + pRandr->maxY = maxY; + } + + if (pScrni->currentMode->HDisplay != pScrni->virtualX || + pScrni->currentMode->VDisplay != pScrni->virtualY) { + + mode = pScrni->modes; + pSize = RRRegisterSize(pScreen, + pRandr->virtualX, pRandr->virtualY, + pRandr->mmWidth, pRandr->mmHeight); + if (!pSize) + return FALSE; + + RRRegisterRate(pScreen, pSize, refresh0); + if (pScrni->virtualX == pRandr->virtualX && + pScrni->virtualY == pRandr->virtualY) { + RRSetCurrentConfig(pScreen, pRandr->rotation, refresh0, pSize); + } + } + + return TRUE; +} + +static Bool +LXRandRSetMode(ScreenPtr pScreen, + DisplayModePtr mode, Bool useVirtual, int mmWidth, int mmHeight) +{ + ScrnInfoPtr pScrni = XF86SCRNINFO(pScreen); + XF86RandRInfoPtr pRandr = XF86RANDRINFO(pScreen); + + int oldWidth = pScreen->width; + int oldHeight = pScreen->height; + int oldmmWidth = pScreen->mmWidth; + int oldmmHeight = pScreen->mmHeight; + WindowPtr pRoot = WindowTable[pScreen->myNum]; + DisplayModePtr currentMode = NULL; + Bool ret = TRUE; + PixmapPtr pspix = NULL; + + if (pRoot) + (*pScrni->EnableDisableFBAccess) (pScreen->myNum, FALSE); + + if (useVirtual) { + pScrni->virtualX = pRandr->virtualX; + pScrni->virtualY = pRandr->virtualY; + } else { + pScrni->virtualX = mode->HDisplay; + pScrni->virtualY = mode->VDisplay; + } + + if (pRandr->rotation & (RR_Rotate_90 | RR_Rotate_270)) { + pScreen->width = pScrni->virtualY; + pScreen->height = pScrni->virtualX; + pScreen->mmWidth = mmHeight; + pScreen->mmHeight = mmWidth; + } else { + pScreen->width = pScrni->virtualX; + pScreen->height = pScrni->virtualY; + pScreen->mmWidth = mmWidth; + pScreen->mmHeight = mmHeight; + } + + if (pScrni->currentMode == mode) { + currentMode = pScrni->currentMode; + pScrni->currentMode = NULL; + } + + if (!xf86SwitchMode(pScreen, mode)) { + ret = FALSE; + pScrni->virtualX = pScreen->width = oldWidth; + pScrni->virtualY = pScreen->height = oldHeight; + pScreen->mmWidth = oldmmWidth; + pScreen->mmHeight = oldmmHeight; + pScrni->currentMode = currentMode; + } + + /* + * Get the new Screen pixmap ptr as SwitchMode might have called + * ModifyPixmapHeader and xf86EnableDisableFBAccess will put it back... + * Unfortunately. + + */ + + pspix = (*pScreen->GetScreenPixmap) (pScreen); + if (pspix->devPrivate.ptr) + pScrni->pixmapPrivate = pspix->devPrivate; + + xf86ReconfigureLayout(); + + xf86SetViewport(pScreen, pScreen->width, pScreen->height); + xf86SetViewport(pScreen, 0, 0); + + if (pRoot) + (*pScrni->EnableDisableFBAccess) (pScreen->myNum, TRUE); + + return ret; +} + +Bool +LXRandRSetConfig(ScreenPtr pScreen, Rotation rotation, + int rate, RRScreenSizePtr pSize) +{ + ScrnInfoPtr pScrni = XF86SCRNINFO(pScreen); + XF86RandRInfoPtr pRandr = XF86RANDRINFO(pScreen); + + DisplayModePtr mode; + int px, py; + Bool useVirtual = FALSE; + int maxX = 0, maxY = 0; + Rotation oldRotation = pRandr->rotation; + + pRandr->rotation = rotation; + + if (pRandr->virtualX == -1 || pRandr->virtualY == -1) { + pRandr->virtualX = pScrni->virtualX; + pRandr->virtualY = pScrni->virtualY; + } + +/* FIXME: we don't have a new video ABI yet */ +#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) == 3 + miPointerGetPosition(inputInfo.pointer, &px, &py); +#else + miPointerPosition(&px, &py); +#endif + + for (mode = pScrni->modes;; mode = mode->next) { + if (pRandr->maxX == 0 || pRandr->maxY == 0) { + if (maxX < mode->HDisplay) + maxX = mode->HDisplay; + if (maxY < mode->VDisplay) + maxY = mode->VDisplay; + } + if (mode->HDisplay == pSize->width && + mode->VDisplay == pSize->height && + (rate == 0 || LXRandRModeRefresh(mode) == rate)) + break; + if (mode->next == pScrni->modes) { + if (pSize->width == pRandr->virtualX && + pSize->height == pRandr->virtualY) { + mode = pScrni->modes; + useVirtual = TRUE; + break; + } + if (pRandr->maxX == 0 || pRandr->maxY == 0) { + pRandr->maxX = maxX; + pRandr->maxY = maxY; + } + return FALSE; + } + } + + if (pRandr->maxX == 0 || pRandr->maxY == 0) { + pRandr->maxX = maxX; + pRandr->maxY = maxY; + } + + if (!LXRandRSetMode(pScreen, mode, useVirtual, pSize->mmWidth, + pSize->mmHeight)) { + pRandr->rotation = oldRotation; + return FALSE; + } + +/* FIXME: we don't have a new video ABI yet */ +#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) == 3 + if (pScreen == miPointerGetScreen(inputInfo.pointer)) +#else + if (pScreen == miPointerCurrentScreen()) +#endif + { + px = (px >= pScreen->width ? (pScreen->width - 1) : px); + py = (py >= pScreen->height ? (pScreen->height - 1) : py); + + xf86SetViewport(pScreen, px, py); + + (*pScreen->SetCursorPosition) ( +/* FIXME: we don't have a new video ABI yet */ +#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) == 3 + inputInfo.pointer, +#endif + pScreen, + px, py, + FALSE); + } + + return TRUE; +} + +Rotation +LXGetRotation(ScreenPtr pScreen) +{ + XF86RandRInfoPtr pRandr = XF86RANDRINFO(pScreen); + + return pRandr ? pRandr->rotation : RR_Rotate_0; +} + +Bool +LXRandRInit(ScreenPtr pScreen, int rotation) +{ + XF86RandRInfoPtr pRandr; + rrScrPrivPtr rp; + + if (LXRandRGeneration != serverGeneration) { + LXRandRGeneration = serverGeneration; + } +#if AMD_OLDPRIV + LXRandRIndex = AllocateScreenPrivateIndex(); +#else + LXRandRKey = &LXRandRKey; +#endif + + pRandr = xcalloc(sizeof(XF86RandRInfoRec), 1); + if (pRandr == NULL) + return FALSE; + + if (!RRScreenInit(pScreen)) { + xfree(pRandr); + return FALSE; + } + + rp = rrGetScrPriv(pScreen); + rp->rrGetInfo = LXRandRGetInfo; + rp->rrSetConfig = LXRandRSetConfig; + + pRandr->virtualX = -1; + pRandr->virtualY = -1; + + pRandr->mmWidth = pScreen->mmWidth; + pRandr->mmHeight = pScreen->mmHeight; + + pRandr->rotation = RR_Rotate_0; + pRandr->supported_rotations = rotation; + pRandr->maxX = pRandr->maxY = 0; + +#if AMD_OLDPRIV + pScreen->devPrivates[LXRandRIndex].ptr = pRandr; +#else + dixSetPrivate(&pScreen->devPrivates, LXRandRKey, pRandr); +#endif + return TRUE; +} diff --git a/driver/xf86-video-geode/src/lx_regacc.c b/driver/xf86-video-geode/src/lx_regacc.c new file mode 100644 index 000000000..4a5a89b0c --- /dev/null +++ b/driver/xf86-video-geode/src/lx_regacc.c @@ -0,0 +1,65 @@ +/* + * Copyright (c) 2006 Advanced Micro Devices, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + * Neither the name of the Advanced Micro Devices, Inc. nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + */ + +/* + * This is the main file used to add Cimarron graphics support to a software + * project. The main reason to have a single file include the other files + * is that it centralizes the location of the compiler options. This file + * should be tuned for a specific implementation, and then modified as needed + * for new Cimarron releases. The releases.txt file indicates any updates to + * this main file, such as a new definition for a new hardware platform. + * + * In other words, this file should be copied from the Cimarron source files + * once when a software project starts, and then maintained as necessary. + * It should not be recopied with new versions of Cimarron unless the + * developer is willing to tune the file again for the specific project. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "cim_defs.h" + +extern unsigned char *cim_vid_ptr; + +void cim_write_vid32(unsigned long offset, unsigned long value); +unsigned long cim_read_vid32(unsigned long offset); + +void +cim_write_vid32(unsigned long offset, unsigned long value) +{ + WRITE_VID32(offset, value); +} + +unsigned long +cim_read_vid32(unsigned long offset) +{ + unsigned long value; + + value = READ_VID32(offset); + return value; +} diff --git a/driver/xf86-video-geode/src/lx_rotate.c b/driver/xf86-video-geode/src/lx_rotate.c new file mode 100644 index 000000000..eee58c7a3 --- /dev/null +++ b/driver/xf86-video-geode/src/lx_rotate.c @@ -0,0 +1,277 @@ +/* Copyrightg (c) 2007 Advanced Micro Devices, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + * + * Neither the name of the Advanced Micro Devices, Inc. nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "xf86.h" +#include "shadow.h" +#include "geode.h" + +static void +LXShadowSave(ScreenPtr pScreen, ExaOffscreenArea * area) +{ + ScrnInfoPtr pScrni = xf86Screens[pScreen->myNum]; + GeodeRec *pGeode = GEODEPTR(pScrni); + + if (area == pGeode->shadowArea) + pGeode->shadowArea = NULL; +} + +static void * +LXWindowLinear(ScreenPtr pScreen, CARD32 row, CARD32 offset, int mode, + CARD32 * size, void *closure) +{ + ScrnInfoPtr pScrni = xf86Screens[pScreen->myNum]; + GeodeRec *pGeode = GEODEPTR(pScrni); + + *size = pGeode->displayPitch; + + return (pGeode->FBBase + pGeode->displayOffset) + + row * pGeode->displayPitch + offset; +} + +static void +LXUpdateFunc(ScreenPtr pScreen, shadowBufPtr pBuf) +{ + RegionPtr damage = shadowDamage(pBuf); + + int nbox = REGION_NUM_RECTS(damage); + BoxPtr pbox = REGION_RECTS(damage); + int x, y, w, h, degrees = 0; + FbStride shaStride; + FbBits *shaBits; + int shaBpp, dx = 0, dy = 0, dw, dh; + int shaXoff, shaYoff; + unsigned int srcOffset, dstOffset; + PixmapPtr pShadow = pBuf->pPixmap; + ScrnInfoPtr pScrni = xf86Screens[pScreen->myNum]; + GeodeRec *pGeode = GEODEPTR(pScrni); + + fbGetDrawable(&pShadow->drawable, shaBits, shaStride, shaBpp, shaXoff, + shaYoff); + + /* Set up the blt */ + + gp_wait_until_idle(); + gp_declare_blt(0); + + gp_set_bpp(pScrni->bitsPerPixel); + + switch (shaBpp) { + case 8: + gp_set_source_format(CIMGP_SOURCE_FMT_3_3_2); + break; + + case 16: + gp_set_source_format(CIMGP_SOURCE_FMT_0_5_6_5); + break; + + case 24: + case 32: + gp_set_source_format(CIMGP_SOURCE_FMT_8_8_8_8); + break; + } + + gp_set_raster_operation(0xCC); + gp_write_parameters(); + + while (nbox--) { + x = pbox->x1; + y = pbox->y1; + w = (pbox->x2 - pbox->x1); + h = pbox->y2 - pbox->y1; + + srcOffset = + ((unsigned long)shaBits) - ((unsigned long)pGeode->FBBase); + srcOffset += (y * pGeode->Pitch) + (x * (shaBpp >> 3)); + + switch (pGeode->rotation) { + case RR_Rotate_0: + dx = x; + dy = y; + dw = w; + dh = h; + degrees = 0; + break; + + case RR_Rotate_90: + dx = (pScrni->pScreen->height - 1) - (y + (h - 1)); + dy = x; + dw = h; + dh = w; + degrees = 90; + break; + + case RR_Rotate_180: + dx = (pScrni->pScreen->width - 1) - (x + (w - 1)); + dy = (pScrni->pScreen->height - 1) - (y + (h - 1)); + dw = w; + dh = h; + + degrees = 180; + break; + + case RR_Rotate_270: + dy = (pScrni->pScreen->width - 1) - (x + (w - 1)); + dx = y; + dw = h; + dh = w; + + degrees = 270; + break; + } + + dstOffset = pGeode->displayOffset + + (dy * pGeode->displayPitch) + (dx * (pScrni->bitsPerPixel >> 3)); + + gp_declare_blt(CIMGP_BLTFLAGS_HAZARD); + gp_set_strides(pGeode->displayPitch, pGeode->Pitch); + gp_rotate_blt(dstOffset, srcOffset, w, h, degrees); + pbox++; + } +} + +Bool +LXSetRotatePitch(ScrnInfoPtr pScrni) +{ + GeodeRec *pGeode = GEODEPTR(pScrni); + + pScrni->displayWidth = pGeode->displayWidth; + + if (pGeode->Compression) + pGeode->Pitch = GeodeCalculatePitchBytes(pScrni->displayWidth, + pScrni->bitsPerPixel); + else + pGeode->Pitch = (pScrni->displayWidth * (pScrni->bitsPerPixel >> 3)); + return TRUE; +} + +Bool +LXAllocShadow(ScrnInfoPtr pScrni) +{ + GeodeRec *pGeode = GEODEPTR(pScrni); + PixmapPtr pPixmap; + + int size; + + if (pGeode->rotation == RR_Rotate_0) { + + if (pGeode->shadowArea) { + exaOffscreenFree(pScrni->pScreen, pGeode->shadowArea); + pGeode->shadowArea = NULL; + } + + pScrni->fbOffset = pGeode->displayOffset; + } else { + if (pGeode->rotation == RR_Rotate_90 + || pGeode->rotation == RR_Rotate_270) + size = pGeode->displayPitch * pScrni->virtualX; + else + size = pGeode->displayPitch * pScrni->virtualY; + + if (pGeode->shadowArea) { + + if (pGeode->shadowArea->size < size) { + exaOffscreenFree(pScrni->pScreen, pGeode->shadowArea); + pGeode->shadowArea = NULL; + } + } + + if (pGeode->shadowArea == NULL) { + pGeode->shadowArea = + exaOffscreenAlloc(pScrni->pScreen, size, 32, TRUE, + LXShadowSave, pGeode); + + if (pGeode->shadowArea == NULL) + return FALSE; + } + + pScrni->fbOffset = pGeode->shadowArea->offset; + } + + pPixmap = pScrni->pScreen->GetScreenPixmap(pScrni->pScreen); + + pScrni->pScreen->ModifyPixmapHeader(pPixmap, + pScrni->pScreen->width, + pScrni->pScreen->height, + pScrni->pScreen->rootDepth, + pScrni->bitsPerPixel, + PixmapBytePad(pScrni->displayWidth, pScrni->pScreen->rootDepth), + (pointer) (pGeode->FBBase + pScrni->fbOffset)); + + return TRUE; +} + +Bool +LXRotate(ScrnInfoPtr pScrni, DisplayModePtr mode) +{ + GeodeRec *pGeode = GEODEPTR(pScrni); + Rotation curr = pGeode->rotation; + unsigned int curdw = pScrni->displayWidth; + PixmapPtr pPixmap; + BOOL ret; + + pPixmap = pScrni->pScreen->GetScreenPixmap(pScrni->pScreen); + pGeode->rotation = LXGetRotation(pScrni->pScreen); + + /* Leave if we have nothing to do */ + + if (pGeode->rotation == curr && pGeode->curMode == mode) { + return TRUE; + } + + shadowRemove(pScrni->pScreen, NULL); + + LXSetRotatePitch(pScrni); + + if (pGeode->rotation != RR_Rotate_0) { + + ret = shadowAdd(pScrni->pScreen, pPixmap, LXUpdateFunc, + LXWindowLinear, pGeode->rotation, NULL); + + if (!ret) + goto error; + } + + if (LXAllocShadow(pScrni)) + return TRUE; + + error: + /* Restore the old rotation */ + pScrni->displayWidth = curdw; + + if (curr & (RR_Rotate_0 | RR_Rotate_180)) { + pScrni->pScreen->width = pScrni->virtualX; + pScrni->pScreen->height = pScrni->virtualY; + } else { + pScrni->pScreen->width = pScrni->virtualY; + pScrni->pScreen->height = pScrni->virtualX; + } + + pGeode->rotation = curr; + return FALSE; +} diff --git a/driver/xf86-video-geode/src/lx_vga.c b/driver/xf86-video-geode/src/lx_vga.c new file mode 100644 index 000000000..78317e5d4 --- /dev/null +++ b/driver/xf86-video-geode/src/lx_vga.c @@ -0,0 +1,43 @@ +/* + * Copyright (c) 2006 Advanced Micro Devices, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + * Neither the name of the Advanced Micro Devices, Inc. nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + */ + +/* + * This file contains routines to set modes using the VGA registers. + * Since this file is for the first generation graphics unit, it interfaces + * to SoftVGA registers. It works for both VSA1 and VSA2. + */ + +/* VGA STRUCTURE */ + +int gu3_get_vga_active(void); + +int +gu3_get_vga_active(void) +{ + int data = READ_REG32(DC3_GENERAL_CFG); + + return (data & DC3_GCFG_VGAE) ? 1 : 0; +} diff --git a/driver/xf86-video-geode/src/lx_video.c b/driver/xf86-video-geode/src/lx_video.c new file mode 100644 index 000000000..dbda9f96c --- /dev/null +++ b/driver/xf86-video-geode/src/lx_video.c @@ -0,0 +1,1004 @@ +/* Copyright (c) 2007 Advanced Micro Devices, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + * + * Neither the name of the Advanced Micro Devices, Inc. nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + */ + +/* TODO: + Add rotation + Add back in double buffering? + +*/ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include +#include + +#include "xf86.h" +#include "xf86_OSproc.h" +#include "xf86Resources.h" +#include "compiler.h" +#include "xf86PciInfo.h" +#include "xf86Pci.h" +#include "xf86fbman.h" +#include "regionstr.h" +#include "dixstruct.h" + +#include "geode.h" +#include "xf86xv.h" +#include +#include "fourcc.h" +#include "geode_fourcc.h" +#include "cim/cim_defs.h" +#include "cim/cim_regs.h" + +#define OFF_DELAY 200 +#define FREE_DELAY 60000 +#define OFF_TIMER 0x01 +#define FREE_TIMER 0x02 +#define CLIENT_VIDEO_ON 0x04 +#define TIMER_MASK (OFF_TIMER | FREE_TIMER) + +#define MAKE_ATOM(a) MakeAtom(a, sizeof(a) - 1, TRUE) +#define ARRAY_SIZE(a) (sizeof((a)) / (sizeof(*(a)))) + +/* Local function prototypes */ +static void LXStopVideo(ScrnInfoPtr pScrni, pointer data, Bool exit); + +static void +LXDisplayVideo(ScrnInfoPtr pScrni, int id, short width, short height, + BoxPtr dstBox, short srcW, short srcH, short drawW, short drawH); + +static void LXResetVideo(ScrnInfoPtr pScrni); + +static XF86VideoEncodingRec DummyEncoding[1] = { + {0, "XV_IMAGE", 1024, 1024, {1, 1}} +}; + +static XF86VideoFormatRec Formats[] = { + {8, PseudoColor}, {15, TrueColor}, {16, TrueColor}, {24, TrueColor} +}; + +static XF86AttributeRec Attributes[] = { + {XvSettable | XvGettable, 0, (1 << 24) - 1, "XV_COLORKEY"}, + {XvSettable | XvGettable, 0, 1, "XV_FILTER"}, + {XvSettable | XvGettable, 0, 1, "XV_COLORKEYMODE"} +}; + +static XF86ImageRec Images[] = { + XVIMAGE_UYVY, + XVIMAGE_YUY2, + XVIMAGE_Y2YU, + XVIMAGE_YVYU, + XVIMAGE_Y800, + XVIMAGE_I420, + XVIMAGE_YV12, + XVIMAGE_RGB565 +}; + +typedef struct +{ + void *area; + int offset; + RegionRec clip; + CARD32 filter; + CARD32 colorKey; + CARD32 colorKeyMode; + CARD32 videoStatus; + Time offTime; + Time freeTime; + short pwidth, pheight; +} GeodePortPrivRec, *GeodePortPrivPtr; + +#define GET_PORT_PRIVATE(pScrni) \ + (GeodePortPrivRec *)((GEODEPTR(pScrni))->adaptor->pPortPrivates[0].ptr) + +static void +LXCopyFromSys(GeodeRec * pGeode, unsigned char *src, unsigned int dst, + int dstPitch, int srcPitch, int h, int w) +{ + + gp_declare_blt(0); + gp_set_bpp(16); + + gp_set_raster_operation(0xCC); + gp_set_strides(dstPitch, srcPitch); + gp_set_solid_pattern(0); + + gp_color_bitmap_to_screen_blt(dst, 0, w, h, src, srcPitch); +} + +static void +LXVideoSave(ScreenPtr pScreen, ExaOffscreenArea * area) +{ + ScrnInfoPtr pScrni = xf86Screens[pScreen->myNum]; + + GeodePortPrivRec *pPriv = GET_PORT_PRIVATE(pScrni); + + if (area == pPriv->area) + pPriv->area = NULL; + + LXStopVideo(pScrni, (void *)pPriv, TRUE); +} + +static unsigned int +LXAllocateVidMem(ScrnInfoPtr pScrni, void **memp, int size) +{ + ExaOffscreenArea *area = *memp; + + if (area != NULL) { + if (area->size >= size) + return area->offset; + + exaOffscreenFree(pScrni->pScreen, area); + } + + area = exaOffscreenAlloc(pScrni->pScreen, size, 16, TRUE, + LXVideoSave, NULL); + + *memp = area; + return (area == NULL) ? 0 : area->offset; +} + +static void +LXSetColorkey(ScrnInfoPtr pScrni, GeodePortPrivRec * pPriv) +{ + int red, green, blue; + unsigned long key; + + switch (pScrni->depth) { + case 8: + vg_get_display_palette_entry(pPriv->colorKey & 0xFF, &key); + red = ((key >> 16) & 0xFF); + green = ((key >> 8) & 0xFF); + blue = (key & 0xFF); + break; + case 16: + red = (pPriv->colorKey & pScrni->mask.red) >> + pScrni->offset.red << (8 - pScrni->weight.red); + green = (pPriv->colorKey & pScrni->mask.green) >> + pScrni->offset.green << (8 - pScrni->weight.green); + blue = (pPriv->colorKey & pScrni->mask.blue) >> + pScrni->offset.blue << (8 - pScrni->weight.blue); + break; + default: + /* for > 16 bpp we send in the mask in xf86SetWeight. This + * function is providing the offset by 1 more. So we take + * this as a special case and subtract 1 for > 16 + */ + + red = (pPriv->colorKey & pScrni->mask.red) >> + (pScrni->offset.red - 1) << (8 - pScrni->weight.red); + green = (pPriv->colorKey & pScrni->mask.green) >> + (pScrni->offset.green - 1) << (8 - pScrni->weight.green); + blue = (pPriv->colorKey & pScrni->mask.blue) >> + (pScrni->offset.blue - 1) << (8 - pScrni->weight.blue); + break; + } + + df_set_video_color_key((blue | (green << 8) | (red << 16)), + 0xFFFFFF, (pPriv->colorKeyMode == 0)); + + REGION_EMPTY(pScrni->pScreen, &pPriv->clip); +} + +/* A structure full of the scratch information that originates in the copy routines, + but is needed for the video display - maybe we should figure out a way to attach + this to structures? I hate to put it in pGeode since it will increase the size of + the structure, and possibly cause us cache issues. +*/ + +struct +{ + unsigned int dstOffset; + unsigned int dstPitch; + unsigned int UVPitch; + unsigned int UDstOffset; + unsigned int VDstOffset; +} videoScratch; + +/* Copy planar YUV data */ + +static Bool +LXCopyPlanar(ScrnInfoPtr pScrni, int id, unsigned char *buf, + short x1, short y1, short x2, short y2, + int width, int height, pointer data) +{ + GeodeRec *pGeode = GEODEPTR(pScrni); + GeodePortPrivRec *pPriv = (GeodePortPrivRec *) data; + + unsigned int YSrcPitch, YDstPitch; + unsigned int UVSrcPitch, UVDstPitch; + unsigned int YSrcOffset, YDstOffset; + unsigned int USrcOffset, UDstOffset; + unsigned int VSrcOffset, VDstOffset; + + unsigned int size, lines, top, left, pixels; + + YSrcPitch = (width + 3) & ~3; + YDstPitch = (width + 31) & ~31; + + UVSrcPitch = ((width >> 1) + 3) & ~3; + UVDstPitch = ((width >> 1) + 15) & ~15; + + USrcOffset = YSrcPitch * height; + VSrcOffset = USrcOffset + (UVSrcPitch * (height >> 1)); + + UDstOffset = YDstPitch * height; + VDstOffset = UDstOffset + (UVDstPitch * (height >> 1)); + + size = YDstPitch * height; + size += UVDstPitch * height; + + pPriv->offset = LXAllocateVidMem(pScrni, &pPriv->area, size); + + if (pPriv->offset == 0) { + ErrorF("Error allocating an offscreen region.\n"); + return FALSE; + } + + /* The top of the source region we want to copy */ + top = y1 & ~1; + + /* The left hand side of the source region, aligned on a word */ + left = x1 & ~1; + + /* Number of bytes to copy, also word aligned */ + pixels = ((x2 + 1) & ~1) - left; + + /* Calculate the source offset */ + YSrcOffset = (top * YSrcPitch) + left; + USrcOffset += ((top >> 1) * UVSrcPitch) + (left >> 1); + VSrcOffset += ((top >> 1) * UVSrcPitch) + (left >> 1); + + /* Calculate the destination offset */ + YDstOffset = (top * YDstPitch) + left; + UDstOffset += ((top >> 1) * UVDstPitch) + (left >> 1); + VDstOffset += ((top >> 1) * UVDstPitch) + (left >> 1); + + lines = ((y2 + 1) & ~1) - top; + + /* Copy Y */ + + LXCopyFromSys(pGeode, buf + YSrcOffset, pPriv->offset + YDstOffset, + YDstPitch, YSrcPitch, lines, pixels); + + /* Copy U + V at the same time */ + + LXCopyFromSys(pGeode, buf + USrcOffset, pPriv->offset + UDstOffset, + UVDstPitch, UVSrcPitch, lines, pixels >> 1); + + videoScratch.dstOffset = pPriv->offset + YDstOffset; + videoScratch.dstPitch = YDstPitch; + videoScratch.UVPitch = UVDstPitch; + videoScratch.UDstOffset = pPriv->offset + UDstOffset; + videoScratch.VDstOffset = pPriv->offset + VDstOffset; + + return TRUE; +} + +static Bool +LXCopyPacked(ScrnInfoPtr pScrni, int id, unsigned char *buf, + short x1, short y1, short x2, short y2, + int width, int height, pointer data) +{ + GeodePortPrivRec *pPriv = (GeodePortPrivRec *) data; + GeodeRec *pGeode = GEODEPTR(pScrni); + unsigned int dstPitch, srcPitch; + unsigned int srcOffset, dstOffset; + unsigned int lines, top, left, pixels; + + dstPitch = ((width << 1) + 3) & ~3; + srcPitch = (width << 1); + + lines = ((dstPitch * height) + pGeode->Pitch - 1) / pGeode->Pitch; + + pPriv->offset = LXAllocateVidMem(pScrni, &pPriv->area, height * dstPitch); + + if (pPriv->offset == 0) { + ErrorF("Error while allocating an offscreen region.\n"); + return FALSE; + } + + /* The top of the source region we want to copy */ + top = y1; + + /* The left hand side of the source region, aligned on a word */ + left = x1 & ~1; + + /* Number of bytes to copy, also word aligned */ + pixels = ((x2 + 1) & ~1) - left; + + /* Adjust the incoming buffer */ + srcOffset = (top * srcPitch) + left; + + /* Calculate the destination offset */ + dstOffset = pPriv->offset + (top * dstPitch) + left; + + /* Make the copy happen */ + + if (id == FOURCC_Y800) { + + /* Use the shared (unaccelerated) greyscale copy - you could probably + * accelerate it using a 2 pass blit and patterns, but it doesn't really + * seem worth it + */ + + GeodeCopyGreyscale(buf + srcOffset, pGeode->FBBase + dstOffset, + srcPitch, dstPitch, height, pixels >> 1); + } else + LXCopyFromSys(pGeode, buf + srcOffset, dstOffset, dstPitch, srcPitch, + height, pixels); + + videoScratch.dstOffset = dstOffset; + videoScratch.dstPitch = dstPitch; + + return TRUE; +} + +static void +LXDisplayVideo(ScrnInfoPtr pScrni, int id, short width, short height, + BoxPtr dstBox, short srcW, short srcH, short drawW, short drawH) +{ + long ystart, xend, yend; + unsigned long lines = 0; + unsigned long yExtra, uvExtra = 0; + DF_VIDEO_POSITION vidPos; + DF_VIDEO_SOURCE_PARAMS vSrcParams; + int err; + + memset(&vSrcParams, 0, sizeof(vSrcParams)); + + gp_wait_until_idle(); + + switch (id) { + case FOURCC_UYVY: + vSrcParams.video_format = DF_VIDFMT_UYVY; + break; + + case FOURCC_Y800: + case FOURCC_YV12: + case FOURCC_I420: + vSrcParams.video_format = DF_VIDFMT_Y0Y1Y2Y3; + break; + case FOURCC_YUY2: + vSrcParams.video_format = DF_VIDFMT_YUYV; + break; + case FOURCC_Y2YU: + vSrcParams.video_format = DF_VIDFMT_Y2YU; + break; + case FOURCC_YVYU: + vSrcParams.video_format = DF_VIDFMT_YVYU; + break; + case FOURCC_RGB565: + vSrcParams.video_format = DF_VIDFMT_RGB; + break; + } + + vSrcParams.width = width; + vSrcParams.height = height; + vSrcParams.y_pitch = videoScratch.dstPitch; + vSrcParams.uv_pitch = videoScratch.UVPitch; + + /* Set up scaling */ + df_set_video_filter_coefficients(NULL, 1); + + err = df_set_video_scale(width, height, drawW, drawH, + DF_SCALEFLAG_CHANGEX | DF_SCALEFLAG_CHANGEY); + if (err != CIM_STATUS_OK) { + /* Note the problem, but do nothing for now. */ + ErrorF("Video scale factor too large: %dx%d -> %dx%d\n", + width, height, drawW, drawH); + } + + /* Figure out clipping */ + + xend = dstBox->x2; + yend = dstBox->y2; + + if (dstBox->y1 < 0) { + if (srcH < drawH) + lines = ((-dstBox->y1) * srcH) / drawH; + else + lines = (-dstBox->y1); + + ystart = 0; + drawH += dstBox->y1; + } else { + ystart = dstBox->y1; + lines = 0; + } + + yExtra = lines * videoScratch.dstPitch; + uvExtra = (lines >> 1) * videoScratch.UVPitch; + + memset(&vidPos, 0, sizeof(vidPos)); + + vidPos.x = dstBox->x1; + vidPos.y = ystart; + vidPos.width = xend - dstBox->x1; + vidPos.height = yend - ystart; + + df_set_video_position(&vidPos); + + vSrcParams.y_offset = videoScratch.dstOffset + yExtra; + + switch (id) { + case FOURCC_Y800: + case FOURCC_I420: + vSrcParams.u_offset = videoScratch.UDstOffset + uvExtra; + vSrcParams.v_offset = videoScratch.VDstOffset + uvExtra; + break; + case FOURCC_YV12: + vSrcParams.v_offset = videoScratch.UDstOffset + uvExtra; + vSrcParams.u_offset = videoScratch.VDstOffset + uvExtra; + break; + + default: + vSrcParams.u_offset = vSrcParams.v_offset = 0; + break; + } + + vSrcParams.flags = DF_SOURCEFLAG_IMPLICITSCALING; + df_configure_video_source(&vSrcParams, &vSrcParams); + + /* Turn on the video palette */ + df_set_video_palette(NULL); + df_set_video_enable(1, 0); +} + +static int +LXPutImage(ScrnInfoPtr pScrni, + short srcX, short srcY, short drawX, short drawY, + short srcW, short srcH, short drawW, short drawH, + int id, unsigned char *buf, + short width, short height, Bool sync, RegionPtr clipBoxes, + pointer data, DrawablePtr pDraw) +{ + GeodeRec *pGeode = GEODEPTR(pScrni); + GeodePortPrivRec *pPriv = (GeodePortPrivRec *) data; + INT32 x1, x2, y1, y2; + BoxRec dstBox; + + if (pGeode->rotation != RR_Rotate_0) + return Success; + + if (srcW <= 0 || srcH <= 0) { + return Success; + } + + if (drawW <= 0 || drawH <= 0) { + return Success; + } + + if (drawW > 16384) + drawW = 16384; + + memset(&videoScratch, 0, sizeof(videoScratch)); + + x1 = srcX; + x2 = srcX + srcW; + y1 = srcY; + y2 = srcY + srcH; + + dstBox.x1 = drawX; + dstBox.x2 = drawX + drawW; + dstBox.y1 = drawY; + dstBox.y2 = drawY + drawH; + + dstBox.x1 -= pScrni->frameX0; + dstBox.x2 -= pScrni->frameX0; + dstBox.y1 -= pScrni->frameY0; + dstBox.y2 -= pScrni->frameY0; + + switch (id) { + case FOURCC_YV12: + case FOURCC_I420: + LXCopyPlanar(pScrni, id, buf, x1, y1, x2, y2, width, height, data); + break; + + case FOURCC_UYVY: + case FOURCC_YUY2: + case FOURCC_Y800: + case FOURCC_RGB565: + LXCopyPacked(pScrni, id, buf, x1, y1, x2, y2, width, height, data); + break; + } + + if (!RegionsEqual(&pPriv->clip, clipBoxes) || + (drawW != pPriv->pwidth || drawH != pPriv->pheight)) { + REGION_COPY(pScrni->pScreen, &pPriv->clip, clipBoxes); + + if (pPriv->colorKeyMode == 0) { + xf86XVFillKeyHelper(pScrni->pScreen, pPriv->colorKey, clipBoxes); + } + + LXDisplayVideo(pScrni, id, width, height, &dstBox, + srcW, srcH, drawW, drawH); + pPriv->pwidth = drawW; + pPriv->pheight = drawH; + } + + pPriv->videoStatus = CLIENT_VIDEO_ON; + pGeode->OverlayON = TRUE; + + return Success; +} + +static void +LXQueryBestSize(ScrnInfoPtr pScrni, Bool motion, + short vidW, short vidH, short drawW, short drawH, + unsigned int *retW, unsigned int *retH, pointer data) +{ + *retW = drawW > 16384 ? 16384 : drawW; + *retH = drawH; +} + +static Atom xvColorKey, xvColorKeyMode, xvFilter; + +static int +LXGetPortAttribute(ScrnInfoPtr pScrni, + Atom attribute, INT32 * value, pointer data) +{ + GeodePortPrivRec *pPriv = (GeodePortPrivRec *) data; + + if (attribute == xvColorKey) + *value = pPriv->colorKey; + else if (attribute == xvColorKeyMode) + *value = pPriv->colorKeyMode; + else if (attribute == xvFilter) + *value = pPriv->filter; + else + return BadMatch; + + return Success; +} + +static int +LXSetPortAttribute(ScrnInfoPtr pScrni, + Atom attribute, INT32 value, pointer data) +{ + GeodePortPrivRec *pPriv = (GeodePortPrivRec *) data; + + gp_wait_until_idle(); + + if (attribute == xvColorKey) { + pPriv->colorKey = value; + LXSetColorkey(pScrni, pPriv); + } else if (attribute == xvColorKeyMode) { + pPriv->colorKeyMode = value; + LXSetColorkey(pScrni, pPriv); + } else if (attribute == xvFilter) { + if ((value < 0) || (value > 1)) + return BadValue; + pPriv->filter = value; + } else + return BadMatch; + + return Success; +} + +static void +LXStopVideo(ScrnInfoPtr pScrni, pointer data, Bool exit) +{ + GeodePortPrivRec *pPriv = (GeodePortPrivRec *) data; + GeodeRec *pGeode = GEODEPTR(pScrni); + + if (pPriv->videoStatus == 0) + return; + + REGION_EMPTY(pScrni->pScreen, &pPriv->clip); + gp_wait_until_idle(); + + if (exit) { + if (pPriv->videoStatus & CLIENT_VIDEO_ON) { + unsigned int val; + + df_set_video_enable(0, 0); + /* Put the LUT back in bypass */ + val = READ_VID32(DF_VID_MISC); + WRITE_VID32(DF_VID_MISC, val | DF_GAMMA_BYPASS_BOTH); + } + + if (pPriv->area) { + exaOffscreenFree(pScrni->pScreen, pPriv->area); + pPriv->area = NULL; + } + + pPriv->videoStatus = 0; + + /* Eh? */ + pGeode->OverlayON = FALSE; + } else if (pPriv->videoStatus & CLIENT_VIDEO_ON) { + pPriv->videoStatus |= OFF_TIMER; + pPriv->offTime = currentTime.milliseconds + OFF_DELAY; + } +} + +static void +LXResetVideo(ScrnInfoPtr pScrni) +{ + GeodeRec *pGeode = GEODEPTR(pScrni); + + if (!pGeode->NoAccel) { + GeodePortPrivRec *pPriv = pGeode->adaptor->pPortPrivates[0].ptr; + + gp_wait_until_idle(); + df_set_video_palette(NULL); + + LXSetColorkey(pScrni, pPriv); + } +} + +static void +LXVidBlockHandler(int i, pointer blockData, pointer pTimeout, + pointer pReadmask) +{ + ScreenPtr pScrn = screenInfo.screens[i]; + ScrnInfoPtr pScrni = xf86Screens[i]; + GeodeRec *pGeode = GEODEPTR(pScrni); + GeodePortPrivRec *pPriv = GET_PORT_PRIVATE(pScrni); + + pScrn->BlockHandler = pGeode->BlockHandler; + (*pScrn->BlockHandler) (i, blockData, pTimeout, pReadmask); + pScrn->BlockHandler = LXVidBlockHandler; + + if (pPriv->videoStatus & TIMER_MASK) { + Time now = currentTime.milliseconds; + + if (pPriv->videoStatus & OFF_TIMER) { + gp_wait_until_idle(); + + if (pPriv->offTime < now) { + unsigned int val; + + df_set_video_enable(0, 0); + pPriv->videoStatus = FREE_TIMER; + pPriv->freeTime = now + FREE_DELAY; + + /* Turn off the video palette */ + val = READ_VID32(DF_VID_MISC); + WRITE_VID32(DF_VID_MISC, val | DF_GAMMA_BYPASS_BOTH); + } + } else { + if (pPriv->freeTime < now) { + if (pPriv->area) { + exaOffscreenFree(pScrni->pScreen, pPriv->area); + pPriv->area = NULL; + } + + pPriv->videoStatus = 0; + } + } + } +} + +static XF86VideoAdaptorPtr +LXSetupImageVideo(ScreenPtr pScrn) +{ + ScrnInfoPtr pScrni = xf86Screens[pScrn->myNum]; + GeodeRec *pGeode = GEODEPTR(pScrni); + XF86VideoAdaptorPtr adapt; + GeodePortPrivRec *pPriv; + + adapt = xcalloc(1, sizeof(XF86VideoAdaptorRec) + + sizeof(GeodePortPrivRec) + sizeof(DevUnion)); + + if (adapt == NULL) { + ErrorF("Couldn't create the rec\n"); + return NULL; + } + + adapt->type = XvWindowMask | XvInputMask | XvImageMask; + adapt->flags = VIDEO_OVERLAID_IMAGES | VIDEO_CLIP_TO_VIEWPORT; + + adapt->name = "AMD Geode LX"; + adapt->nEncodings = 1; + adapt->pEncodings = DummyEncoding; + adapt->nFormats = ARRAY_SIZE(Formats); + adapt->pFormats = Formats; + adapt->nPorts = 1; + adapt->pPortPrivates = (DevUnion *) (&adapt[1]); + pPriv = (GeodePortPrivRec *) (&adapt->pPortPrivates[1]); + adapt->pPortPrivates[0].ptr = (pointer) (pPriv); + adapt->pAttributes = Attributes; + adapt->nImages = ARRAY_SIZE(Images); + adapt->nAttributes = ARRAY_SIZE(Attributes); + adapt->pImages = Images; + adapt->PutVideo = NULL; + adapt->PutStill = NULL; + adapt->GetVideo = NULL; + adapt->GetStill = NULL; + adapt->StopVideo = LXStopVideo; + adapt->SetPortAttribute = LXSetPortAttribute; + adapt->GetPortAttribute = LXGetPortAttribute; + adapt->QueryBestSize = LXQueryBestSize; + adapt->PutImage = LXPutImage; + + /* Use the common function */ + adapt->QueryImageAttributes = GeodeQueryImageAttributes; + + pPriv->filter = 0; + pPriv->colorKey = pGeode->videoKey; + pPriv->colorKeyMode = 0; + pPriv->videoStatus = 0; + pPriv->pwidth = 0; + pPriv->pheight = 0; + + REGION_NULL(pScrn, &pPriv->clip); + + pGeode->adaptor = adapt; + + pGeode->BlockHandler = pScrn->BlockHandler; + pScrn->BlockHandler = LXVidBlockHandler; + + xvColorKey = MAKE_ATOM("XV_COLORKEY"); + xvColorKeyMode = MAKE_ATOM("XV_COLORKEYMODE"); + xvFilter = MAKE_ATOM("XV_FILTER"); + + LXResetVideo(pScrni); + + return adapt; +} + +/* Offscreen surface allocation */ + +struct OffscreenPrivRec +{ + void *area; + int offset; + Bool isOn; +}; + +static int +LXDisplaySurface(XF86SurfacePtr surface, + short srcX, short srcY, short drawX, short drawY, + short srcW, short srcH, short drawW, short drawH, RegionPtr clipBoxes) +{ + struct OffscreenPrivRec *pPriv = + (struct OffscreenPrivRec *)surface->devPrivate.ptr; + + ScrnInfoPtr pScrni = surface->pScrn; + GeodePortPrivRec *portPriv = GET_PORT_PRIVATE(pScrni); + + BoxRec dstBox; + + dstBox.x1 = drawX; + dstBox.x2 = drawX + drawW; + dstBox.y1 = drawY; + dstBox.y2 = drawY + drawH; + + if ((drawW <= 0) | (drawH <= 0)) + return Success; + + /* Is this still valid? */ + + dstBox.x1 -= pScrni->frameX0; + dstBox.x2 -= pScrni->frameX0; + dstBox.y1 -= pScrni->frameY0; + dstBox.y2 -= pScrni->frameY0; + + xf86XVFillKeyHelper(pScrni->pScreen, portPriv->colorKey, clipBoxes); + + videoScratch.dstOffset = surface->offsets[0]; + videoScratch.dstPitch = surface->pitches[0]; + + LXDisplayVideo(pScrni, surface->id, surface->width, surface->height, + &dstBox, srcW, srcH, drawW, drawH); + + pPriv->isOn = TRUE; + + if (portPriv->videoStatus & CLIENT_VIDEO_ON) { + REGION_EMPTY(pScrni->pScreen, &portPriv->clip); + UpdateCurrentTime(); + portPriv->videoStatus = FREE_TIMER; + portPriv->freeTime = currentTime.milliseconds + FREE_DELAY; + } + + return Success; +} + +static int +LXAllocateSurface(ScrnInfoPtr pScrni, int id, unsigned short w, + unsigned short h, XF86SurfacePtr surface) +{ + GeodeRec *pGeode = GEODEPTR(pScrni); + void *area = NULL; + int pitch, lines; + unsigned offset; + struct OffscreenPrivRec *pPriv; + + if (w > 1024 || h > 1024) + return BadAlloc; + + /* The width needs to be word aligned */ + w = (w + 1) & ~1; + + pitch = ((w << 1) + 15) & ~15; + lines = ((pitch * h) + (pGeode->Pitch - 1)) / pGeode->Pitch; + + offset = LXAllocateVidMem(pScrni, &area, lines); + + if (offset == 0) { + ErrorF("Error while allocating an offscreen region.\n"); + return BadAlloc; + } + + surface->width = w; + surface->height = h; + + surface->pitches = xalloc(sizeof(int)); + + surface->offsets = xalloc(sizeof(int)); + + pPriv = xalloc(sizeof(struct OffscreenPrivRec)); + + if (pPriv && surface->pitches && surface->offsets) { + + pPriv->area = area; + pPriv->offset = offset; + + pPriv->isOn = FALSE; + + surface->pScrn = pScrni; + surface->id = id; + surface->pitches[0] = pitch; + surface->offsets[0] = offset; + surface->devPrivate.ptr = (pointer) pPriv; + + return Success; + } + + if (surface->offsets) + xfree(surface->offsets); + + if (surface->pitches) + xfree(surface->pitches); + + if (area) + exaOffscreenFree(pScrni->pScreen, area); + + return BadAlloc; +} + +static int +LXStopSurface(XF86SurfacePtr surface) +{ + struct OffscreenPrivRec *pPriv = (struct OffscreenPrivRec *) + surface->devPrivate.ptr; + + pPriv->isOn = FALSE; + return Success; +} + +static int +LXFreeSurface(XF86SurfacePtr surface) +{ + struct OffscreenPrivRec *pPriv = (struct OffscreenPrivRec *) + surface->devPrivate.ptr; + ScrnInfoPtr pScrni = surface->pScrn; + + if (pPriv->isOn) + LXStopSurface(surface); + + if (pPriv->area) { + exaOffscreenFree(pScrni->pScreen, pPriv->area); + pPriv->area = NULL; + } + + xfree(surface->pitches); + xfree(surface->offsets); + xfree(surface->devPrivate.ptr); + + return Success; +} + +static int +LXGetSurfaceAttribute(ScrnInfoPtr pScrni, Atom attribute, INT32 * value) +{ + return LXGetPortAttribute(pScrni, attribute, value, + (pointer) (GET_PORT_PRIVATE(pScrni))); +} + +static int +LXSetSurfaceAttribute(ScrnInfoPtr pScrni, Atom attribute, INT32 value) +{ + return LXSetPortAttribute(pScrni, attribute, value, + (pointer) (GET_PORT_PRIVATE(pScrni))); +} + +static void +LXInitOffscreenImages(ScreenPtr pScrn) +{ + XF86OffscreenImagePtr offscreenImages; + + /* need to free this someplace */ + if (!(offscreenImages = xalloc(sizeof(XF86OffscreenImageRec)))) + return; + + offscreenImages[0].image = &Images[0]; + offscreenImages[0].flags = VIDEO_OVERLAID_IMAGES | VIDEO_CLIP_TO_VIEWPORT; + offscreenImages[0].alloc_surface = LXAllocateSurface; + offscreenImages[0].free_surface = LXFreeSurface; + offscreenImages[0].display = LXDisplaySurface; + offscreenImages[0].stop = LXStopSurface; + offscreenImages[0].setAttribute = LXSetSurfaceAttribute; + offscreenImages[0].getAttribute = LXGetSurfaceAttribute; + offscreenImages[0].max_width = 1024; + offscreenImages[0].max_height = 1024; + offscreenImages[0].num_attributes = ARRAY_SIZE(Attributes); + offscreenImages[0].attributes = Attributes; + + xf86XVRegisterOffscreenImages(pScrn, offscreenImages, 1); +} + +void +LXInitVideo(ScreenPtr pScrn) +{ + GeodeRec *pGeode; + ScrnInfoPtr pScrni = xf86Screens[pScrn->myNum]; + XF86VideoAdaptorPtr *adaptors, *newAdaptors = NULL; + XF86VideoAdaptorPtr newAdaptor = NULL; + int num_adaptors; + + pGeode = GEODEPTR(pScrni); + + if (pGeode->NoAccel) { + ErrorF("Cannot run Xv without accelerations!\n"); + return; + } + + if (!(newAdaptor = LXSetupImageVideo(pScrn))) { + ErrorF("Error while setting up the adaptor.\n"); + return; + } + + LXInitOffscreenImages(pScrn); + + num_adaptors = xf86XVListGenericAdaptors(pScrni, &adaptors); + + if (!num_adaptors) { + num_adaptors = 1; + adaptors = &newAdaptor; + } else { + newAdaptors = + xalloc((num_adaptors + 1) * sizeof(XF86VideoAdaptorPtr *)); + + if (newAdaptors) { + memcpy(newAdaptors, adaptors, num_adaptors * + sizeof(XF86VideoAdaptorPtr)); + newAdaptors[num_adaptors] = newAdaptor; + adaptors = newAdaptors; + num_adaptors++; + } else + ErrorF("Memory error while setting up the adaptor\n"); + } + + if (num_adaptors) + xf86XVScreenInit(pScrn, adaptors, num_adaptors); + + if (newAdaptors) + xfree(newAdaptors); +} diff --git a/driver/xf86-video-geode/src/panel.c b/driver/xf86-video-geode/src/panel.c new file mode 100644 index 000000000..b7eb88faa --- /dev/null +++ b/driver/xf86-video-geode/src/panel.c @@ -0,0 +1,57 @@ +/* Copyright (c) 2003-2005 Advanced Micro Devices, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + * + * Neither the name of the Advanced Micro Devices, Inc. nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * */ + +/* + * File Contents: This file contailns the panel include files and + * external pointer to the hardware. + * + * Project: Geode Xfree Frame buffer device driver. + * */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#ifdef __KERNEL__ + +#include +#include + +#endif + +#include "panel.h" +#include "gfx_defs.h" +#include "geode.h" + +#define PLATFORM_DYNAMIC 1 /* runtime selection */ +#define PLATFORM_DRACO 0 /* Draco + 9210 */ +#define PLATFORM_CENTAURUS 1 /* Centaurus + 9211 RevA */ +#define PLATFORM_DORADO 1 /* Dorado + 9211 RevC */ +#define PLATFORM_GX2BASED 1 /* Redcloud */ + +unsigned char *XpressROMPtr; + +#include "pnl_init.c" +#include "pnl_bios.c" diff --git a/driver/xf86-video-geode/src/panel/92xx.h b/driver/xf86-video-geode/src/panel/92xx.h new file mode 100644 index 000000000..f10fa096b --- /dev/null +++ b/driver/xf86-video-geode/src/panel/92xx.h @@ -0,0 +1,370 @@ +/* Copyright (c) 2005 Advanced Micro Devices, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + * + * Neither the name of the Advanced Micro Devices, Inc. nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * */ + +/* + * File Contents: This header file defines the Durango routines and + * variables used to access the memory mapped regions. + * + * SubModule: Geode FlatPanel library + * */ + +#ifndef _92XX_h +#define _92XX_h + +typedef unsigned long ULONG; +typedef unsigned char UCHAR; + +#define FALSE 0 +#define TRUE 1 +#define NUM_92XX_MODES 13 +#define ONE_BYTE 1 +#define TWO_BYTES 2 +#define FOUR_BYTES 4 + +/* LCD Registers + * The LCD memory area is shared by both TV and LCD. + * This offset is for LCD access. + */ + +#define CS92xx_LCD_OFFSET 0x00000400 + +/* LCD CONTROL REGISTERS */ + +#define CS92xx_LCD_PAN_TIMING1 CS92xx_LCD_OFFSET + 0x00 + +/* flat panel(FP) timings */ +#define CS92xx_LCD_PAN_TIMING2 CS92xx_LCD_OFFSET + 0x04 + +/* FP panel timings */ +#define CS92xx_LCD_PWR_MAN CS92xx_LCD_OFFSET + 0x08 + +/* FP power management */ +#define CS92xx_LCD_DITH_FR_CNTRL CS92xx_LCD_OFFSET + 0x0C + +/* FP dither and frame rate + * these defines are in revisions prior to C + */ +#define CS92xx_LCD_BLOCK_SEL1 CS92xx_LCD_OFFSET + 0x10 + +/* FRM register */ +#define CS92xx_LCD_BLOCK_SEL2 CS92xx_LCD_OFFSET + 0x14 + +/* FRM register */ +#define CS92xx_LCD_DISPER1 CS92xx_LCD_OFFSET + 0x18 + +/* FRM register */ +#define CS92xx_LCD_DISPER2 CS92xx_LCD_OFFSET + 0x1C + +/* FRM register + * these defines are revision C + */ +#define CS92xx_BLUE_LSFR_SEED CS92xx_LCD_OFFSET + 0x10 + +/* FRM register */ +#define CS92xx_RED_GREEN_LSFR_SEED CS92xx_LCD_OFFSET + 0x14 + +/* FRM register */ +#define CS92xx_FRM_MEMORY_INDEX CS92xx_LCD_OFFSET + 0x18 + +/* FRM register */ +#define CS92xx_FRM_MEMORY_DATA CS92xx_LCD_OFFSET + 0x1C + +/* FRM register */ +#define CS92xx_LCD_MEM_CNTRL CS92xx_LCD_OFFSET + 0x20 + +/* memory PLL register */ +#define CS92xx_LCD_RAM_CNTRL CS92xx_LCD_OFFSET + 0x24 + +/* ram control */ + +#define CS92xx_LCD_RAM_DATA CS92xx_LCD_OFFSET + 0x28 /* ram data */ + +#define CS92xx_LCD_PAN_CRC_SIG CS92xx_LCD_OFFSET + 0x2C + +/* FP CRC signature */ +#define CS92xx_DEV_REV_ID CS92xx_LCD_OFFSET + 0x30 + +/* Device and revision id */ +#define CS92xx_LCD_GPIO_DATA CS92xx_LCD_OFFSET + 0x34 /* GPIO Data */ + +#define CS92xx_LCD_GPIO_CNTRL CS92xx_LCD_OFFSET + 0x38 + +/* GPIO Control */ +int Pnl_Rev_ID; + +typedef struct +{ + /* DISPLAY MODE PARAMETERS */ + int xres; + int yres; + int bpp; + int panel_type; + int color_type; + /* VALUES USED TO SET THE FLAT PANEL DISPLAY CONTROLLER */ + unsigned long panel_timing1; + unsigned long panel_timing2; + unsigned long power_management; + /* the following 5 registers are prior to revision C */ + unsigned long pre_C_dither_frc; + unsigned long block_select1; + unsigned long block_select2; + unsigned long dispersion1; + unsigned long dispersion2; + /* the following 4 registers are revision C only */ + unsigned long rev_C_dither_frc; + unsigned long blue_lsfr_seed; + unsigned long red_green_lsfr_seed; + unsigned long frm_memory_index; + unsigned long frm_memory_data; + unsigned long memory_control; + +} +CS92xx_MODE; + +/* VALUES USED TO SAVE AND RESTORE 9211 REGISTERS. */ +typedef struct +{ + unsigned long panel_state; + /* VALUES USED TO SET THE FLAT PANEL DISPLAY CONTROLLER */ + unsigned long panel_timing1; + unsigned long panel_timing2; + unsigned long power_management; + unsigned long dither_frc_ctrl; + unsigned long blue_lsfr_seed; + unsigned long red_green_lsfr_seed; + unsigned long frm_memory_index; + unsigned long frm_memory_data; + unsigned long memory_control; +} +CS92xx_REGS; + +CS92xx_REGS cs9211_regs; + +/* + *------------------------------------------------------------------------ + * PANEL MODE TABLES: + * GLOBAL ARRAY OF FLAT PANEL MODE STRUCTURES + *------------------------------------------------------------------------ + */ +CS92xx_MODE FPModeParams[] = { + + {640, 480, 8, PNL_SSTN, PNL_COLOR_PANEL, /* display parameters */ + 0x01e00000, 0x00034000, /* panel timing reg 1, panel timing */ + /* reg 2 */ + 0x01000000, /* power management */ + /* The next 5 values are prior to revision C */ + 0x00000050, /* dither and frame rate control */ + 0x25cf3096, 0xad47b81e, /* block select 1, block select 2 */ + 0x21446450, 0x21446450, /* dispersion 1, dispersion 2 */ + /* The next 5 values are for revision C */ + 0x00000050, /* dither and frame rate control */ + 0x00000000, 0x00000000, /* blue LSFR, red and green LSFR */ + 0x00000000, 0x00000000, /* FRM memory index, FRM memory data */ + 0x00000000, /* memory control */ + }, + + {640, 480, 12, PNL_TFT, PNL_COLOR_PANEL, /* display parameters */ + 0x01e00000, 0x0f100000, /* panel timing reg 1, panel timing */ + /* reg 2 */ + 0x01000000, /* power management */ + /* The next 5 values are prior to revision C */ + 0x00000050, /* dither and frame rate control */ + 0x00000000, 0x00000000, /* block select 1, block select 2 */ + 0x00000000, 0x00000000, /* dispersion 1, dispersion 2 */ + /* The next 5 values are for revision C */ + 0x00000050, /* dither and frame rate control */ + 0x00000000, 0x00000000, /* blue LSFR, red and green LSFR */ + 0x00000000, 0x00000000, /* FRM memory index, FRM memory data */ + 0x00000000, /* memory control */ + }, + + {640, 480, 18, PNL_TFT, PNL_COLOR_PANEL, /* display parameters */ + 0x01e00000, 0x0f100000, /* panel timing reg 1, panel timing */ + /* reg 2 */ + 0x01000000, /* power management */ + /* The next 5 values are prior to revision C */ + 0x00000050, /* dither and frame rate control */ + 0x00000000, 0x00000000, /* block select 1, block select 2 */ + 0x00000000, 0x00000000, /* dispersion 1, dispersion 2 */ + /* The next 5 values are for revision C */ + 0x00000050, /* dither and frame rate control */ + 0x00000000, 0x00000000, /* blue LSFR, red and green LSFR */ + 0x00000000, 0x00000000, /* FRM memory index, FRM memory data */ + 0x00000000, /* memory control */ + }, + + {640, 480, 16, PNL_DSTN, PNL_COLOR_PANEL, /* display parameters */ + 0x01e00000, 0x00014000, /* panel timing reg 1, panel timing */ + /* reg 2 */ + 0x01000000, /* power management */ + /* The next 5 values are prior to revision C */ + 0x00000050, /* dither and frame rate control */ + 0x048c26ae, 0x048c26ae, /* block select 1, block select 2 */ + 0x02468ace, 0x13579bdf, /* dispersion 1, dispersion 2 */ + /* The next 5 values are for revision C */ + 0x0000004b, /* dither and frame rate control */ + 0x00000000, 0x00000000, /* blue LSFR, red and green LSFR */ + 0x00000000, 0x00000000, /* FRM memory index, FRM memory data */ + 0x00000007, /* memory control */ + }, + + {640, 480, 8, PNL_DSTN, PNL_MONO_PANEL, /* display parameters */ + 0x01e00000, 0x00084000, /* panel timing reg 1, panel timing */ + /* reg 2 */ + 0x01000000, /* power management */ + /* The next 5 values are prior to revision C */ + 0x0000004b, /* dither and frame rate control */ + 0x25cf3096, 0xad47b81e, /* block select 1, block select 2 */ + 0x21446450, 0x21446450, /* dispersion 1, dispersion 2 */ + /* The next 5 values are for revision C */ + 0x00000050, /* dither and frame rate control */ + 0x00000000, 0x00000000, /* blue LSFR, red and green LSFR */ + 0x00000000, 0x00000000, /* FRM memory index, FRM memory data */ + 0x00000007, /* memory control */ + }, + + {640, 480, 16, PNL_DSTN, PNL_MONO_PANEL, /* display parameters */ + 0x01e00000, 0x00094000, /* panel timing reg 1, panel timing */ + /* reg 2 */ + 0x01000000, /* power management */ + /* The next 5 values are prior to revision C */ + 0x00000050, /* dither and frame rate control */ + 0x25cf3096, 0xad47b81e, /* block select 1, block select 2 */ + 0x81a5d470, 0x29cfb63e, /* dispersion 1, dispersion 2 */ + /* The next 5 values are for revision C */ + 0x00000050, /* dither and frame rate control */ + 0x00000000, 0x00000000, /* blue LSFR, red and green LSFR */ + 0x00000000, 0x00000000, /* FRM memory index, FRM memory data */ + 0x00000007, /* memory control */ + }, + + {800, 600, 12, PNL_TFT, PNL_COLOR_PANEL, /* display parameters */ + 0x02580000, 0x0f100000, /* panel timing reg 1, panel timing */ + /* reg 2 */ + 0x01000000, /* power management */ + /* The next 5 values are prior to revision C */ + 0x00000050, /* dither and frame rate control */ + 0x00000000, 0x00000000, /* block select 1, block select 2 */ + 0x00000000, 0x00000000, /* dispersion 1, dispersion 2 */ + /* The next 5 values are for revision C */ + 0x00000050, /* dither and frame rate control */ + 0x00000000, 0x00000000, /* blue LSFR, red and green LSFR */ + 0x00000000, 0x00000000, /* FRM memory index, FRM memory data */ + 0x00000000, /* memory control */ + }, + + {800, 600, 18, PNL_TFT, PNL_COLOR_PANEL, /* display parameters */ + 0x02580000, 0x0f100000, /* panel timing reg 1, panel timing */ + /* reg 2 */ + 0x01000000, /* power management */ + /* The next 5 values are prior to revision C */ + 0x00000050, /* dither and frame rate control */ + 0x00000000, 0x00000000, /* block select 1, block select 2 */ + 0x00000000, 0x00000000, /* dispersion 1, dispersion 2 */ + /* The next 5 values are for revision C */ + 0x00000050, /* dither and frame rate control */ + 0x00000000, 0x00000000, /* blue LSFR, red and green LSFR */ + 0x00000000, 0x00000000, /* FRM memory index, FRM memory data */ + 0x00000000, /* memory control */ + }, + + {800, 600, 16, PNL_DSTN, PNL_COLOR_PANEL, /* display parameters */ + 0x02580000, 0x00014000, /* panel timing reg 1, panel timing */ + /* reg 2 */ + 0x01000000, /* power management */ + /* The next 5 values are prior to revision C */ + 0x00000050, /* dither and frame rate control */ + 0x048c26ae, 0x048c26ae, /* block select 1, block select 2 */ + 0x02468ace, 0x13579bdf, /* dispersion 1, dispersion 2 */ + /* The next 5 values are for revision C */ + 0x0000004b, /* dither and frame rate control */ + 0x00000000, 0x00000000, /* blue LSFR, red and green LSFR */ + 0x00000000, 0x00000000, /* FRM memory index, FRM memory data */ + 0x00000007, /* memory control */ + }, + + {800, 600, 8, PNL_DSTN, PNL_MONO_PANEL, /* display parameters */ + 0x02580000, 0x00084000, /* panel timing reg 1, panel timing */ + /* reg 2 */ + 0x01000000, /* power management */ + /* The next 5 values are prior to revision C */ + 0x00000050, /* dither and frame rate control */ + 0x25cf3096, 0xad47b81e, /* block select 1, block select 2 */ + 0x21446450, 0x21446450, /* dispersion 1, dispersion 2 */ + /* The next 5 values are for revision C */ + 0x0000004b, /* dither and frame rate control */ + 0x00000000, 0x00000000, /* blue LSFR, red and green LSFR */ + 0x00000000, 0x00000000, /* FRM memory index, FRM memory data */ + 0x00000007, /* memory control */ + }, + + {800, 600, 16, PNL_DSTN, PNL_MONO_PANEL, /* display parameters */ + 0x02580000, 0x00094000, /* panel timing reg 1, panel timing */ + /* reg 2 */ + 0x01000000, /* power management */ + /* The next 5 values are prior to revision C */ + 0x00000050, /* dither and frame rate control */ + 0x25cf3096, 0xad47b81e, /* block select 1, block select 2 */ + 0x81a5d470, 0x29cfb63e, /* dispersion 1, dispersion 2 */ + /* The next 5 values are for revision C */ + 0x00000050, /* dither and frame rate control */ + 0x00000000, 0x00000000, /* blue LSFR, red and green LSFR */ + 0x00000000, 0x00000000, /* FRM memory index, FRM memory data */ + 0x00000007, /* memory control */ + }, + + {1024, 768, 18, PNL_TFT, PNL_COLOR_PANEL, /* display parameters */ + 0x03000000, 0x0f100000, /* panel timing reg 1, panel timing */ + /* reg 2 */ + 0x01000000, /* power management */ + /*The next 5 values are prior to revision C */ + 0x00000050, /* dither and frame rate control */ + 0x00000000, 0x00000000, /* block select 1, block select 2 */ + 0x00000000, 0x00000000, /* dispersion 1, dispersion 2 */ + /*The next 5 values are for revision C */ + 0x00000050, /* dither and frame rate control */ + 0x00000000, 0x00000000, /* blue LSFR, red and green LSFR */ + 0x00000000, 0x00000000, /* FRM memory index, FRM memory data */ + 0x00000000, /* memory control */ + }, + + {1024, 768, 24, PNL_DSTN, PNL_COLOR_PANEL, /* display parameters */ + 0x03000000, 0x80024000, /* panel timing reg 1, panel timing reg 2 */ + 0x01000000, /* power management */ + /*The next 5 values are prior to revision C */ + 0x00000050, /* dither and frame rate control */ + 0x048c26ae, 0x048c26ae, /* block select 1, block select 2 */ + 0x02468ace, 0x13579bdf, /* dispersion 1, dispersion 2 */ + /*The next 5 values are for revision C */ + 0x0000004b, /* dither and frame rate control */ + 0x00000000, 0x00000000, /* blue LSFR, red and green LSFR */ + 0x00000000, 0x00000000, /* FRM memory index, FRM memory data */ + 0x00000005, /* memory control */ + } +}; + +#endif /* !_92XX_h */ + +/* END OF FILE */ diff --git a/driver/xf86-video-geode/src/panel/cen9211.c b/driver/xf86-video-geode/src/panel/cen9211.c new file mode 100644 index 000000000..3abc7d5b2 --- /dev/null +++ b/driver/xf86-video-geode/src/panel/cen9211.c @@ -0,0 +1,866 @@ +/* Copyright (c) 2005 Advanced Micro Devices, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + * + * Neither the name of the Advanced Micro Devices, Inc. nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * */ + +/* + * File Contents: This file contains panel functions to interface with + * the centaraus platform. + * + * SubModule: Geode FlatPanel library + * */ + +#include "cen9211.h" + +static unsigned char sioc2_orig_val; +static unsigned char must_restore_97317 = FALSE; + +/******************************************************************** + * + * PASS_FAIL init_GPIO(void); + * Initializes the GPIO pins in the Cx5530 or the National PC97317 + * for use with a 9211 on a Marmot or Centaurus board. Uses + * the global variables RdPCIVal and sioc2_orig_val. + * + *********************************************************************/ + +unsigned char +init_Centaurus_GPIO(void) +{ + unsigned char reg_val; + static unsigned char first_time = TRUE; + + /* The Centaurus board uses ports 1 and 2 of the 97317 for GPIO. + * These ports require bank 0 to be active. The first thing we will + * do is verify that bank 0 is active and set it if it is not. + */ + + /* set the index for access to the configuration register */ + gfx_outb(CENT_CONFIG_INDEX, CENT_SIOC2); + reg_val = gfx_inb(CENT_CONFIG_DATA); + + /* set to bank 0 */ + if (reg_val & CENT_GPIO_BANK_SELECT) { + gfx_outb(CENT_CONFIG_DATA, + (unsigned char)(reg_val & ~CENT_GPIO_BANK_SELECT)); + } + + /* If this is the first time we have modified sioc2, we must + * save the current value (set by the BIOS) for restoration by + * the calling program, set the global flag must_restore_97317, and set + * first_time to FALSE. + */ + + if (first_time == TRUE) { + sioc2_orig_val = reg_val; + must_restore_97317 = TRUE; + first_time = FALSE; + } + + /* set port 1 direction */ + reg_val = gfx_inb(CENT_PORT1_DIRECTION); + + /* make GPIO 14 and 17 outputs */ + reg_val |= CENT_97317_CLOCK_MASK | CENT_97317_DATA_OUT_MASK; + gfx_outb(CENT_PORT1_DIRECTION, reg_val); + + /* set port 2 direction */ + reg_val = gfx_inb(CENT_PORT2_DIRECTION); + + /* make GPIO 20 an output */ + + reg_val |= CENT_97317_CHIP_SEL_MASK; + + /* make GPIO 21 an input */ + + reg_val &= ~CENT_97317_DATA_IN_MASK; + gfx_outb(CENT_PORT2_DIRECTION, reg_val); + + /* make GPIO 14 and 17 push-pull */ + + reg_val = gfx_inb(CENT_PORT1_OUTPUT_TYPE); + reg_val |= CENT_97317_CLOCK_MASK | CENT_97317_DATA_OUT_MASK; + gfx_outb(CENT_PORT1_OUTPUT_TYPE, reg_val); + + /* make GPIO 20 and 21 push-pull */ + reg_val = gfx_inb(CENT_PORT2_OUTPUT_TYPE); + reg_val |= CENT_97317_CHIP_SEL_MASK | CENT_97317_DATA_IN_MASK; + gfx_outb(CENT_PORT2_OUTPUT_TYPE, reg_val); + return CENT_PASS; + +} /* end init_GPIO() */ + +/********************************************************************* + * + * PASS_FAIL init_9211(void); + * Initializes (sets to 0) the clock, chip select, and data pins + * of the Cx9211 on a Marmot or Centaurus board. + * + **********************************************************************/ + +unsigned char +init_Centaurus_9211(void) +{ + unsigned char ReadData; + + /* Uses the 97317 for GPIO. + * we will use the clock port define for port 1 + */ + ReadData = gfx_inb(CENT_97317_CLOCK_PORT); + ReadData &= ~CENT_97317_CLOCK_MASK & ~CENT_97317_DATA_OUT_MASK; + gfx_outb(CENT_97317_CLOCK_PORT, ReadData); + /* we will use the chip select port define for port 2 */ + ReadData = gfx_inb(CENT_97317_CHIP_SELECT); + ReadData &= ~CENT_97317_CHIP_SEL_MASK & ~CENT_97317_DATA_IN_MASK; + gfx_outb(CENT_97317_CHIP_SELECT, ReadData); + return (CENT_PASS); + +} /*end init_9211() */ + +/****************************************************************** + * + * PASS_FAIL restore_97317_SIOC2(void); + * Restores the original value to the 97317 SIOC2 register using + * the global variable sioc2_orig_val. Returns PASS if the value + * was written, FAIL if not. + * + *******************************************************************/ + +unsigned char +restore_Centaurus_97317_SIOC2(void) +{ + /* set the global flag */ + if (must_restore_97317 == TRUE) { + unsigned char cfg; + + /* set the index for access to the configuration register */ + gfx_outb(CENT_CONFIG_INDEX, CENT_SIOC2); + + /* restore the value */ + gfx_outb(CENT_CONFIG_DATA, sioc2_orig_val); + + /* now read and verify */ + cfg = gfx_inb(CENT_CONFIG_DATA); + if (cfg == sioc2_orig_val) + return (CENT_PASS); + else + return (CENT_FAIL); + + } /* end if() */ + return (CENT_FAIL); + +} /* end restore_97317_SIOC2bank() */ + +/* ----------------------------------------------------------------------- + * + * SET_FLAT_PANEL_MODE + * + * This routine sets the specified flat panel moden parameters in + * the 9211. + * Returns PASS if successful, FAIL if the mode parameters could + * not be set. + * + *------------------------------------------------------------------------*/ + +unsigned char +set_Centaurus_92xx_mode(Pnl_PanelStat * pstat) +{ + int mode; + + /* LOOP THROUGH THE AVAILABLE MODES TO FIND A MATCH */ + + for (mode = 0; mode < NUM_92XX_MODES; mode++) { + if ((FPModeParams[mode].xres == pstat->XRes) && + (FPModeParams[mode].yres == pstat->YRes) && + (FPModeParams[mode].bpp == pstat->Depth) && + (FPModeParams[mode].panel_type == pstat->Type) && + (FPModeParams[mode].color_type == pstat->MonoColor)) { + + /* SET THE 92xx FOR THE SELECTED MODE */ + set_Centaurus_92xx_mode_params(mode); + return (CENT_PASS); + } /* end if() */ + } /* end for() */ + return (CENT_FAIL); + +} /* end set_Centaurus_92xx_mode() */ + +/*------------------------------------------------------------------- + * + * SET_92XX_MODE_PARAMS + * This routine sets the 9211 mode parameters. + * + *-------------------------------------------------------------------*/ + +void +set_Centaurus_92xx_mode_params(int mode) +{ + CS92xx_MODE *pMode = &FPModeParams[mode]; + unsigned long off_data = 0; + + /* Turn the 92xx power off before setting any new parameters. + * Since we are going to reset all the power bit positions, we will + * force the power register to 0. + */ + + Centaurus_write_gpio(FOUR_BYTES, CS92xx_LCD_PWR_MAN, off_data); + + /* set 9211 registers using the desired panel settings */ + + Centaurus_write_gpio(FOUR_BYTES, + CS92xx_LCD_PAN_TIMING1, pMode->panel_timing1); + + Centaurus_write_gpio(FOUR_BYTES, + CS92xx_LCD_PAN_TIMING2, pMode->panel_timing2); + + if (Pnl_Rev_ID == PNL_9211_C) { + + /* load the LSFR seeds */ + Centaurus_write_gpio(FOUR_BYTES, + CS92xx_LCD_DITH_FR_CNTRL, pMode->rev_C_dither_frc); + + Centaurus_write_gpio(FOUR_BYTES, + CS92xx_BLUE_LSFR_SEED, pMode->blue_lsfr_seed); + + Centaurus_write_gpio(FOUR_BYTES, + CS92xx_RED_GREEN_LSFR_SEED, pMode->red_green_lsfr_seed); + } else { + + Centaurus_write_gpio(FOUR_BYTES, + CS92xx_LCD_DITH_FR_CNTRL, pMode->pre_C_dither_frc); + + Centaurus_write_gpio(FOUR_BYTES, + CS92xx_LCD_BLOCK_SEL1, pMode->block_select1); + + Centaurus_write_gpio(FOUR_BYTES, + CS92xx_LCD_BLOCK_SEL2, pMode->block_select2); + + Centaurus_write_gpio(FOUR_BYTES, + CS92xx_LCD_DISPER1, pMode->dispersion1); + + Centaurus_write_gpio(FOUR_BYTES, + CS92xx_LCD_DISPER2, pMode->dispersion2); + + CentaurusProgramFRMload(); + } + + Centaurus_write_gpio(FOUR_BYTES, CS92xx_LCD_MEM_CNTRL, + pMode->memory_control); + + /* Set the power register last. This will turn the panel on at the 9211. */ + + Centaurus_write_gpio(FOUR_BYTES, + CS92xx_LCD_PWR_MAN, pMode->power_management); + +} /* end set_Centaurus_92xx_mode_params() */ + +void +Centaurus_write_gpio(int width, ULONG address, unsigned long data) +{ + int num_clock_toggles; + int count; + unsigned long Addr = address; + + enable_Centaurus_9211_chip_select(); + + /* Write 1 Clock period of no valid transfer */ + write_Centaurus_CX9211_GPIO(CENT_NO_DATA); + + /* Write 1 control bit (the data book calls this the control bar write) */ + write_Centaurus_CX9211_GPIO(0x1); + + /* Write the 12-bit address */ + for (count = 0; count < 12; count++) { + write_Centaurus_CX9211_GPIO((unsigned char)(Addr & 0x01)); + /*the 9211 expects data LSB->MSB */ + Addr = Addr >> 1; + } + + /* write */ + write_Centaurus_CX9211_DWdata(data); + + /* a write will require four toggles after disabling CS */ + num_clock_toggles = CENT_NUM_WRITE_CLOCK_TOGGLES; + disable_Centaurus_9211_chip_select(); + + /* now toggle the clock */ + for (count = 0; count < num_clock_toggles; count++) { + toggle_Centaurus_9211_clock(); + } + return; + +} /* end Centaurus_write_gpio() */ + +unsigned long +Centaurus_read_gpio(int width, unsigned long address) +{ + int num_clock_toggles; + int count; + unsigned long Addr = address; + unsigned long data; + + enable_Centaurus_9211_chip_select(); + + /* Write 1 Clock period of no valid transfer */ + write_Centaurus_CX9211_GPIO(CENT_NO_DATA); + + /* Write 1 control bit (the data book calls this the control bar write) */ + write_Centaurus_CX9211_GPIO(0x1); + + /* Write the 12-bit address */ + for (count = 0; count < 12; count++) { + write_Centaurus_CX9211_GPIO((unsigned char)(Addr & 0x01)); + + /*the 9211 expects data LSB->MSB */ + Addr = Addr >> 1; + } + + data = read_Centaurus_CX9211_DWdata(); + + /* a read will require one toggle after disabling CS */ + num_clock_toggles = CENT_NUM_READ_CLOCK_TOGGLES; + disable_Centaurus_9211_chip_select(); + + /* now toggle the clock */ + for (count = 0; count < num_clock_toggles; count++) { + toggle_Centaurus_9211_clock(); + } + return data; + +} /* end Centaurus_read_gpio() */ + +/******************************************************************* + * + * void enable_Centaurus_9211_chip_select(void); + * Enables the chip select of the CX9211 using the National 97317 + * on a Centaurus board. + * + *******************************************************************/ + +void +enable_Centaurus_9211_chip_select(void) +{ + unsigned char cs_port_val; + + /* Set the chip select (GPIO20) high */ + cs_port_val = gfx_inb(CENT_97317_CHIP_SELECT); + gfx_outb(CENT_97317_CHIP_SELECT, + (unsigned char)(cs_port_val | CENT_97317_CHIP_SEL_MASK)); + return; +} /* end enable_Centaurus_9211_chip_select() */ + +/******************************************************************** + * + * void disable_Centaurus_9211_chip_select(void); + * Disables the chip select of the CX9211 using the National 97317 + * on a Centaurus board. + * + *******************************************************************/ + +void +disable_Centaurus_9211_chip_select(void) +{ + unsigned char cs_port_val; + + /* Set the chip select (GPIO20) low */ + cs_port_val = gfx_inb(CENT_97317_CHIP_SELECT); + gfx_outb(CENT_97317_CHIP_SELECT, + (unsigned char)(cs_port_val & ~CENT_97317_CHIP_SEL_MASK)); + return; + +} /* end disable_Centaurus_9211_chip_select() */ + +/********************************************************************** + * + * void toggle_Centaurus_9211_clock(void); + * Toggles the clock bit of the CX9211 using the National 97317 on a + * Centaurus board. Assumes the 9211 clock bit has previously been + * initialized to 0 (this way we do not have to waste GPIO cycles + * windowing the clock pulse). + * + **********************************************************************/ + +void +toggle_Centaurus_9211_clock(void) +{ + unsigned char port_val; + + /* get the 97317 GPIO port contents for the 9211 clock */ + + port_val = gfx_inb(CENT_97317_CLOCK_PORT); + /* set the clock bit high */ + gfx_outb(CENT_97317_CLOCK_PORT, + (unsigned char)(port_val | CENT_97317_CLOCK_MASK)); + + /* set the clock bit low */ + gfx_outb(CENT_97317_CLOCK_PORT, + (unsigned char)(port_val & ~CENT_97317_CLOCK_MASK)); + +} /* end toggle_Centaurus_9211_clock() */ + +/******************************************************************** + * + * void write_Centaurus_CX9211_GPIO(unsigned char databit); + * Writes the value in bit 0 of the value passed in databit to + * the 9211 through the GPIO interface of the National 97317 on a + * Centaurus board. + * NOTE: This function does not set or reset the chip select line! + * + *******************************************************************/ + +void +write_Centaurus_CX9211_GPIO(unsigned char databit) +{ + unsigned char data_port_val; + + /* Set the data bit for (GPIO17) */ + databit <<= 7; + + /* read the value of the other bits in the 97317 data port */ + data_port_val = gfx_inb(CENT_97317_DATA_OUTPORT); + + /* set the bit accordingly */ + data_port_val &= ~CENT_97317_DATA_OUT_MASK; + data_port_val |= databit; + gfx_outb(CENT_97317_DATA_OUTPORT, data_port_val); + + /* clock the data */ + toggle_Centaurus_9211_clock(); + return; + +} /* end write_Centaurus_CX9211_GPIO() */ + +/***************************************************************** + * + * void write_Centaurus_CX9211_DWdata(unsigned long data); + * Writes the doubleword value passed in data to the CX9211 + * using GPIO Pins of the National 97317 on a Centaurus board. + * This function assumes the Direction register of the 97317 + * and the address register of the CX9211 have been previously set. + * Uses the global variable count. + * NOTE: This function does not set or reset the chip select line! + * + ******************************************************************/ + +void +write_Centaurus_CX9211_DWdata(unsigned long data) +{ + int count; + + /* Send the read/write command to the 9211 first. */ + + write_Centaurus_CX9211_GPIO(CENT_WRITE); + + /* Now write the 32-bit Data */ + for (count = 0; count < 32; count++) { + write_Centaurus_CX9211_GPIO((unsigned char)(data & 0x01)); + + /* the 9211 expects the data LSB->MSB */ + data >>= 1; + } + return; + +} /* end write_Centaurus_CX9211_DWdata() */ + +/********************************************************************* + * + * unsigned char read_Centaurus_CX9211_GPIO(void); + * Returns the current value of the databit of the 9211 in bit 0 + * using the GPIO interface of the National 97317 on a Centaurus board. + * NOTE: This function does not set or reset the chip select line! + * + *********************************************************************/ + +unsigned char +read_Centaurus_CX9211_GPIO(void) +{ + unsigned char data_port_val; + + toggle_Centaurus_9211_clock(); + + /* read the data */ + data_port_val = gfx_inb(CENT_97317_DATA_INPORT); + + /* Save the data from (GPIO21) as bit 0 */ + data_port_val >>= 1; + return (data_port_val & 0x1); + +} /* end read_Centaurus_CX9211_GPIO() */ + +/********************************************************************** + * + * void read_Centaurus_CX9211_DWdata(unsigned long *data); + * Reads a doubleword value from the CX9211 using GPIO Pins of + * the National 97317 on a Centaurus board. + * This function assumes the Direction register of the 97317 and + * the address register of the CX9211 have been previously set. + * NOTE: This function does not set or reset the chip select line! + * + ***********************************************************************/ + +unsigned long +read_Centaurus_CX9211_DWdata(void) +{ + unsigned char ReadData; + int count; + unsigned long Data; + + /* Send read/write command word to the 9211 first. */ + write_Centaurus_CX9211_GPIO(CENT_READ); + + /* The data book (revision 0.1) states 8 clock periods of no valid data. + * However, the data becomes valid on the eighth clock, making the eighth + * clock valid. Since read_Centaurus_GPIO() toggles the clock before + * reading, we will only toggle the clock 7 times here. + */ + for (count = 0; count < 7; count++) /* works */ + toggle_Centaurus_9211_clock(); + + /* Now read the 32-bit Data, bit by bit in a single loop. */ + Data = 0; + for (count = 0; count < 32; count++) { + ReadData = read_Centaurus_CX9211_GPIO(); + /* 9211 sends data LSB->MSB */ + Data = Data | (((unsigned long)ReadData) << count); + } /* end for() */ + + return Data; + +} /* end read_Centaurus_CX9211_DWdata() */ + +void +Centaurus_Get_9211_Details(unsigned long flags, Pnl_PanelParams * pParam) +{ + unsigned long PanelType; + int i; + + for (i = 0; i < 0x7fff; i++) { + } + + init_Centaurus_GPIO(); + + for (i = 0; i < 5; i++) + toggle_Centaurus_9211_clock(); + + if (flags & PNL_PANELCHIP) { + + PanelType = Centaurus_read_gpio(FOUR_BYTES, 0x430); + PanelType = Centaurus_read_gpio(FOUR_BYTES, 0x430); + if ((PanelType & 0xFFFF0000) == 0x92110000) { + + /* found 9211 */ + /* check the values for revision ID */ + if (PanelType >= 0x92110301) + pParam->PanelChip = PNL_9211_C; + else if ((PanelType >= 0x92110101) && (PanelType < 0x92110301)) + pParam->PanelChip = PNL_9211_A; + else + pParam->PanelChip = PNL_UNKNOWN_CHIP; + } else { /* no 9211 present */ + pParam->PanelChip = PNL_UNKNOWN_CHIP; + } + Pnl_Rev_ID = pParam->PanelChip; + } + /* if end */ + if ((pParam->PanelChip != PNL_UNKNOWN_CHIP) && (flags & PNL_PANELSTAT)) { + PanelType = Centaurus_read_gpio(FOUR_BYTES, 0x438); + PanelType &= 0x00f8f8f8; + PanelType |= 0x00070000; + Centaurus_write_gpio(FOUR_BYTES, 0x438, PanelType); + PanelType = 0; + PanelType = Centaurus_read_gpio(FOUR_BYTES, 0x434); + PanelType = (PanelType >> 8); + PanelType &= 0x7; + + switch (PanelType) { + case 0: + pParam->PanelStat.XRes = 800; + pParam->PanelStat.YRes = 600; + pParam->PanelStat.Depth = 18; + pParam->PanelStat.MonoColor = PNL_COLOR_PANEL; + pParam->PanelStat.Type = PNL_TFT; + break; + case 1: + pParam->PanelStat.XRes = 640; + pParam->PanelStat.YRes = 480; + pParam->PanelStat.Depth = 8; + pParam->PanelStat.MonoColor = PNL_COLOR_PANEL; + pParam->PanelStat.Type = PNL_SSTN; + break; + case 2: + pParam->PanelStat.XRes = 1024; + pParam->PanelStat.YRes = 768; + pParam->PanelStat.Depth = 18; + pParam->PanelStat.MonoColor = PNL_COLOR_PANEL; + pParam->PanelStat.Type = PNL_TFT; + break; + case 3: + pParam->PanelStat.XRes = 640; + pParam->PanelStat.YRes = 480; + pParam->PanelStat.Depth = 16; + pParam->PanelStat.MonoColor = PNL_COLOR_PANEL; + pParam->PanelStat.Type = PNL_DSTN; + break; + case 4: + pParam->PanelStat.XRes = 640; + pParam->PanelStat.YRes = 480; + pParam->PanelStat.Depth = 18; + pParam->PanelStat.MonoColor = PNL_COLOR_PANEL; + pParam->PanelStat.Type = PNL_TFT; + break; + case 5: + pParam->PanelStat.XRes = 1024; + pParam->PanelStat.YRes = 768; + pParam->PanelStat.Depth = 24; + pParam->PanelStat.MonoColor = PNL_COLOR_PANEL; + pParam->PanelStat.Type = PNL_DSTN; + break; + case 6: + pParam->PanelStat.XRes = 640; + pParam->PanelStat.YRes = 480; + pParam->PanelStat.Depth = 8; + pParam->PanelStat.MonoColor = PNL_MONO_PANEL; + pParam->PanelStat.Type = PNL_DSTN; + break; + case 7: + pParam->PanelStat.XRes = 800; + pParam->PanelStat.YRes = 600; + pParam->PanelStat.Depth = 16; + pParam->PanelStat.MonoColor = PNL_COLOR_PANEL; + pParam->PanelStat.Type = PNL_DSTN; + break; + default: + break; + } + } + +} + +void +CentaurusProgramFRMload(void) +{ + unsigned long CentaurusFRMtable[] = { + 0x00000000, + 0x00000000, + 0x01000100, + 0x01000100, + 0x01010101, + 0x01010101, + 0x02081041, + 0x02081041, + 0x10111111, + 0x11111101, + 0x49249241, + 0x12412492, + 0x92244891, + 0x92244891, + 0x22252525, + 0x22252525, + 0x528294a5, + 0x2528494a, + 0x294a5295, + 0x294a5295, + 0x54a54a95, + 0x2952a52a, + 0x2a552a55, + 0x2a552a55, + 0x554aa955, + 0x2a9552aa, + 0x2aaa5555, + 0x2aaa5555, + 0x55555555, + 0x2aaaaaaa, + 0x55555555, + 0x55555555, + 0xaaaaaaab, + 0x55555555, + 0x5555aaab, + 0x5555aaab, + 0xaab556ab, + 0x556aad55, + 0x55ab55ab, + 0x55ab55ab, + 0xab5ab56b, + 0x56ad5ad5, + 0x56b5ad6b, + 0x56b5ad6b, + 0xad6d6b5b, + 0x5ad6b6b6, + 0x5b5b5b5b, + 0x5b5b5b5b, + 0x5F6db6db, + 0x5F6db6db, + 0xF776F776, + 0xF776F776, + 0xFBDEFBDE, + 0xFBDEFBDE, + 0x7eFFBFF7, + 0x7eFFBFF7, + 0xFF7FF7F7, + 0xFF7FF7F7, + 0xFF7FFF7F, + 0xFF7FFF7F, + 0xFFF7FFFF, + 0xFFF7FFFF, + 0xFFFFFFFF, + 0xFFFFFFFF, + }; + + unsigned char i; + unsigned short index; + unsigned long data; + + Centaurus_write_gpio(FOUR_BYTES, CS92xx_FRM_MEMORY_INDEX, 0); + index = CS92xx_FRM_MEMORY_DATA; + for (i = 0; i < 64; i += 2) { + data = CentaurusFRMtable[i]; + Centaurus_write_gpio(FOUR_BYTES, CS92xx_FRM_MEMORY_DATA, data); + data = CentaurusFRMtable[i + 1]; + Centaurus_write_gpio(FOUR_BYTES, CS92xx_FRM_MEMORY_DATA, data); + } + + /* + * The first FRM location (64 bits) does not program correctly. + * This location always reads back with the last value programmed. + * ie. If 32 64-bit values are programmed, location 0 reads + * back as the 32nd If 30 locations are programmed, location 0 + * reads back as the 30th, etc. + * Fix this by re-writing location 0 after programming all 64 in + * the writeFRM loop in RevCFrmload() in CS9211. + */ + + Centaurus_write_gpio(FOUR_BYTES, CS92xx_FRM_MEMORY_INDEX, 0); + Centaurus_write_gpio(FOUR_BYTES, CS92xx_FRM_MEMORY_DATA, 0); + Centaurus_write_gpio(FOUR_BYTES, CS92xx_FRM_MEMORY_DATA, 0); +} + +/******************************************************************** + * + * void Centaurus_Enable_Power((void); + * Enables the power of the CX9211 using the National 97317 on + * a Centaurus board. + * + ********************************************************************/ + +void +Centaurus_Power_Up(void) +{ + unsigned long off_data = 0x01000000; + + Centaurus_write_gpio(FOUR_BYTES, CS92xx_LCD_PWR_MAN, off_data); + return; + +} /* Centaurus_Disable_Power */ + +/*********************************************************************** + * + * void Centaurus_Disable_Power((void); + * Disables the power of the CX9211 using the National 97317 + * on a Centaurus board. + * + **********************************************************************/ + +void +Centaurus_Power_Down(void) +{ + unsigned long off_data = 0; + + Centaurus_write_gpio(FOUR_BYTES, CS92xx_LCD_PWR_MAN, off_data); + return; + +} /* Centaurus_Disable_Power */ + +void +Centaurus_9211init(Pnl_PanelStat * pstat) +{ + init_Centaurus_GPIO(); + init_Centaurus_9211(); + set_Centaurus_92xx_mode(pstat); + restore_Centaurus_97317_SIOC2(); +} + +void +Centaurus_Save_Panel_State(void) +{ + /* set 9211 registers using the desired panel settings */ + + cs9211_regs.panel_timing1 = + Centaurus_read_gpio(FOUR_BYTES, CS92xx_LCD_PAN_TIMING1); + cs9211_regs.panel_timing2 = + Centaurus_read_gpio(FOUR_BYTES, CS92xx_LCD_PAN_TIMING2); + cs9211_regs.dither_frc_ctrl = + Centaurus_read_gpio(FOUR_BYTES, CS92xx_LCD_DITH_FR_CNTRL); + cs9211_regs.blue_lsfr_seed = + Centaurus_read_gpio(FOUR_BYTES, CS92xx_BLUE_LSFR_SEED); + + cs9211_regs.red_green_lsfr_seed = + Centaurus_read_gpio(FOUR_BYTES, CS92xx_RED_GREEN_LSFR_SEED); + /* CentaurusProgramFRMload(); */ + + cs9211_regs.memory_control = + Centaurus_read_gpio(FOUR_BYTES, CS92xx_LCD_MEM_CNTRL); + + /* Set the power register last. + * This will turn the panel on at the 9211. + */ + cs9211_regs.power_management = + Centaurus_read_gpio(FOUR_BYTES, CS92xx_LCD_PWR_MAN); +} + +void +Centaurus_Restore_Panel_State(void) +{ + + unsigned long off_data = 0; + + /* Before restoring the 9211 registers, power off the 9211. */ + Centaurus_write_gpio(FOUR_BYTES, CS92xx_LCD_PWR_MAN, off_data); + + /* set 9211 registers using the desired panel settings */ + + Centaurus_write_gpio(FOUR_BYTES, CS92xx_LCD_PAN_TIMING1, + cs9211_regs.panel_timing1); + + Centaurus_write_gpio(FOUR_BYTES, CS92xx_LCD_PAN_TIMING2, + cs9211_regs.panel_timing2); + + /* load the LSFR seeds */ + + Centaurus_write_gpio(FOUR_BYTES, CS92xx_LCD_DITH_FR_CNTRL, + cs9211_regs.dither_frc_ctrl); + + Centaurus_write_gpio(FOUR_BYTES, CS92xx_BLUE_LSFR_SEED, + cs9211_regs.blue_lsfr_seed); + + Centaurus_write_gpio(FOUR_BYTES, CS92xx_RED_GREEN_LSFR_SEED, + cs9211_regs.red_green_lsfr_seed); + + Centaurus_write_gpio(FOUR_BYTES, CS92xx_LCD_MEM_CNTRL, + cs9211_regs.memory_control); + + /* Set the power register last. This will turn the panel on at the 9211 */ + + Centaurus_write_gpio(FOUR_BYTES, CS92xx_LCD_PWR_MAN, + cs9211_regs.power_management); + +} diff --git a/driver/xf86-video-geode/src/panel/cen9211.h b/driver/xf86-video-geode/src/panel/cen9211.h new file mode 100644 index 000000000..1ab21e8c9 --- /dev/null +++ b/driver/xf86-video-geode/src/panel/cen9211.h @@ -0,0 +1,101 @@ +/* Copyright (c) 2005 Advanced Micro Devices, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + * + * Neither the name of the Advanced Micro Devices, Inc. nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * */ + +/* + * File Contents: This header file defines the Durango routines and + * variables used to access the memory mapped regions. + * + * SubModule: Geode FlatPanel library + * */ + +#include "92xx.h" +#include "panel.h" + +#ifndef _CEN9211_h +#define _CEN9211_h + +/* Centaurus/97317 GPIO PORT defines */ + +#define CENT_97317_CLOCK_PORT 0xE0 +#define CENT_97317_DATA_OUTPORT 0xE0 +#define CENT_97317_CHIP_SELECT 0xE4 +#define CENT_97317_DATA_INPORT 0xE4 +#define CENT_PORT1_DIRECTION 0xE1 +#define CENT_PORT2_DIRECTION 0xE5 +#define CENT_PORT1_OUTPUT_TYPE 0xE2 +#define CENT_PORT2_OUTPUT_TYPE 0xE6 + +/* + * Centaurus/97317 GPIO bit masks. + * In and out are with respect to the 97317. + */ + +#define CENT_97317_CLOCK_MASK 0x10 +#define CENT_97317_CHIP_SEL_MASK 0x01 +#define CENT_97317_DATA_IN_MASK 0x02 +#define CENT_97317_DATA_OUT_MASK 0x80 + +#define CENT_PASS 1 +#define CENT_FAIL 0 +#define CENT_READ 0x0000 +#define CENT_WRITE 0x0001 +#define CENT_NO_DATA 0 + +#define CENT_CONFIG_INDEX 0x2E +#define CENT_SIOC2 0x22 +#define CENT_CONFIG_DATA 0x2F +#define CENT_GPIO_BANK_SELECT 0x80 + +#define CENT_NUM_READ_CLOCK_TOGGLES 1 +#define CENT_NUM_WRITE_CLOCK_TOGGLES 4 + +/* local functions */ +void set_Centaurus_92xx_mode_params(int mode); +void enable_Centaurus_9211_chip_select(void); +void disable_Centaurus_9211_chip_select(void); +void toggle_Centaurus_9211_clock(void); +void write_Centaurus_CX9211_GPIO(unsigned char databit); +void write_Centaurus_CX9211_DWdata(unsigned long data); +void Centaurus_write_gpio(int width, unsigned long address, + unsigned long data); +void Centaurus_Power_Up(void); +void Centaurus_Power_Down(void); +unsigned long Centaurus_read_gpio(int width, unsigned long address); +unsigned char read_Centaurus_CX9211_GPIO(void); +unsigned long read_Centaurus_CX9211_DWdata(void); +unsigned char restore_Centaurus_97317_SIOC2(void); +unsigned char init_Centaurus_GPIO(void); +unsigned char init_Centaurus_9211(void); +unsigned char set_Centaurus_92xx_mode(Pnl_PanelStat * pstat); +void CentaurusProgramFRMload(void); +void Centaurus_Get_9211_Details(unsigned long flags, + Pnl_PanelParams * pParam); +void Centaurus_Save_Panel_State(void); +void Centaurus_Restore_Panel_State(void); +void Centaurus_9211init(Pnl_PanelStat * pstat); + +#endif /* !_CEN9211_h */ + +/* END OF FILE */ diff --git a/driver/xf86-video-geode/src/panel/dora9211.c b/driver/xf86-video-geode/src/panel/dora9211.c new file mode 100644 index 000000000..ea52e95b1 --- /dev/null +++ b/driver/xf86-video-geode/src/panel/dora9211.c @@ -0,0 +1,607 @@ +/* Copyright (c) 2005 Advanced Micro Devices, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + * + * Neither the name of the Advanced Micro Devices, Inc. nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * */ + +/* + * File Contents: This file contains the panel functions to interface + * the dorado platform. + * + * SubModule: Geode FlatPanel library + * */ + +#include "dora9211.h" + +void +Dorado_Get_9211_Details(unsigned long flags, Pnl_PanelParams * pParam) +{ + unsigned long DPanelType; + int i; + + for (i = 0; i < 0x7fff; i++) { + } + + Dorado9211GpioInit(); + + for (i = 0; i < 5; i++) + toggle_Centaurus_9211_clock(); + + if (flags & PNL_PANELCHIP) { + DPanelType = Dorado9211ReadReg(0x430); + + if ((DPanelType & 0xFFFF0000) == 0x92110000) { /* found 9211 */ + /* check the values for revision ID */ + if (DPanelType >= 0x92110301) + pParam->PanelChip = PNL_9211_C; + else if ((DPanelType >= 0x92110101) && (DPanelType < 0x92110301)) + pParam->PanelChip = PNL_9211_A; + else + pParam->PanelChip = PNL_UNKNOWN_CHIP; + } else { /* no 9211 present */ + pParam->PanelChip = PNL_UNKNOWN_CHIP; + } + } + + if ((pParam->PanelChip != PNL_UNKNOWN_CHIP) && (flags & PNL_PANELSTAT)) { + unsigned long PanelTypeOrg; + unsigned char Panel_2Byte; + + DPanelType = Dorado9211ReadReg(0x438); + DPanelType &= 0x00e8e8e8; + DPanelType |= 0x00170000; + Dorado9211WriteReg(0x438, DPanelType); + DPanelType = 0; + + DPanelType = Dorado9211ReadReg(0x434); + DPanelType = (DPanelType >> (DRD_LCDRESGPIO1 + 1)); + PanelTypeOrg = DPanelType >> 8; + Panel_2Byte = (unsigned char)PanelTypeOrg; + Panel_2Byte = + (Panel_2Byte >> (DRD_LCDRESGPIO2 - DRD_LCDRESGPIO1 - 1)); + DPanelType = (DPanelType | ((unsigned int)Panel_2Byte << 8)); + DPanelType = DPanelType >> 1; + PanelTypeOrg = DPanelType >> 8; + Panel_2Byte = (unsigned char)PanelTypeOrg; + Panel_2Byte = + (Panel_2Byte >> (DRD_LCDRESGPIO3 - DRD_LCDRESGPIO2 - 1)); + DPanelType = (DPanelType | ((unsigned int)Panel_2Byte << 8)); + DPanelType = DPanelType >> 1; + PanelTypeOrg = DPanelType >> 8; + Panel_2Byte = (unsigned char)PanelTypeOrg; + Panel_2Byte = + (Panel_2Byte >> (DRD_LCDRESGPIO4 - DRD_LCDRESGPIO3 - 1)); + DPanelType = (DPanelType | ((unsigned int)Panel_2Byte << 8)); + DPanelType = DPanelType >> 5; + DPanelType &= 0xf; + + switch (DPanelType) { + case 8: + pParam->PanelStat.XRes = 800; + pParam->PanelStat.YRes = 600; + pParam->PanelStat.Depth = 18; + pParam->PanelStat.MonoColor = PNL_COLOR_PANEL; + pParam->PanelStat.Type = PNL_TFT; + break; + + case 9: + pParam->PanelStat.XRes = 640; + pParam->PanelStat.YRes = 480; + pParam->PanelStat.Depth = 8; + pParam->PanelStat.MonoColor = PNL_COLOR_PANEL; + pParam->PanelStat.Type = PNL_SSTN; + break; + + case 10: + pParam->PanelStat.XRes = 1024; + pParam->PanelStat.YRes = 768; + pParam->PanelStat.Depth = 18; + pParam->PanelStat.MonoColor = PNL_COLOR_PANEL; + pParam->PanelStat.Type = PNL_TFT; + break; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + case 11: + pParam->PanelStat.XRes = 640; + pParam->PanelStat.YRes = 480; + pParam->PanelStat.Depth = 16; + pParam->PanelStat.MonoColor = PNL_COLOR_PANEL; + pParam->PanelStat.Type = PNL_DSTN; + break; + case 12: + pParam->PanelStat.XRes = 640; + pParam->PanelStat.YRes = 480; + pParam->PanelStat.Depth = 18; + pParam->PanelStat.MonoColor = PNL_COLOR_PANEL; + pParam->PanelStat.Type = PNL_TFT; + break; + case 13: + pParam->PanelStat.XRes = 1024; + pParam->PanelStat.YRes = 768; + pParam->PanelStat.Depth = 24; + pParam->PanelStat.MonoColor = PNL_COLOR_PANEL; + pParam->PanelStat.Type = PNL_DSTN; + break; + case 14: + pParam->PanelStat.XRes = 640; + pParam->PanelStat.YRes = 480; + pParam->PanelStat.Depth = 8; + pParam->PanelStat.MonoColor = PNL_MONO_PANEL; + pParam->PanelStat.Type = PNL_DSTN; + break; + case 15: + pParam->PanelStat.XRes = 800; + pParam->PanelStat.YRes = 600; + pParam->PanelStat.Depth = 16; + pParam->PanelStat.MonoColor = PNL_COLOR_PANEL; + pParam->PanelStat.Type = PNL_DSTN; + break; + default: + break; + } + } + /* if block end */ +} + +void +Dorado9211Init(Pnl_PanelStat * pstat) +{ + int mode; + unsigned long orig_value, pm_value; + + gfx_delay_milliseconds(100); + Dorado9211GpioInit(); + + Dorado9211ToggleClock(); + Dorado9211ToggleClock(); + Dorado9211ToggleClock(); + Dorado9211ToggleClock(); + Dorado9211ToggleClock(); + + gfx_delay_milliseconds(100); + + Dorado9211ToggleClock(); + Dorado9211ToggleClock(); + Dorado9211ToggleClock(); + Dorado9211ToggleClock(); + Dorado9211ToggleClock(); + + Dorado9211WriteReg(CS92xx_LCD_PWR_MAN, 0x0); + + gfx_delay_milliseconds(100); + gfx_delay_milliseconds(100); + + /* LOOP THROUGH THE AVAILABLE MODES TO FIND A MATCH */ + for (mode = 0; mode < NUM_92XX_MODES; mode++) { + if ((FPModeParams[mode].xres == pstat->XRes) && + (FPModeParams[mode].yres == pstat->YRes) && + (FPModeParams[mode].bpp == pstat->Depth) && + (FPModeParams[mode].panel_type == pstat->Type) && + (FPModeParams[mode].color_type == pstat->MonoColor)) { + + /* SET THE 92xx FOR THE SELECTED MODE */ + CS92xx_MODE *pMode = &FPModeParams[mode]; + + Dorado9211WriteReg(CS92xx_LCD_PAN_TIMING1, pMode->panel_timing1); + Dorado9211WriteReg(CS92xx_LCD_PAN_TIMING2, pMode->panel_timing2); + Dorado9211WriteReg(CS92xx_LCD_DITH_FR_CNTRL, + pMode->rev_C_dither_frc); + Dorado9211WriteReg(CS92xx_BLUE_LSFR_SEED, pMode->blue_lsfr_seed); + Dorado9211WriteReg(CS92xx_RED_GREEN_LSFR_SEED, + pMode->red_green_lsfr_seed); + DoradoProgramFRMload(); + Dorado9211WriteReg(CS92xx_LCD_MEM_CNTRL, pMode->memory_control); + Dorado9211WriteReg(CS92xx_LCD_PWR_MAN, pMode->power_management); + gfx_delay_milliseconds(100); + gfx_delay_milliseconds(100); + Dorado9211ClearCS(); + + /* This code is added to take care of Panel initialization. + * Irrespective of Xpressrom is enabling the panel or not. + */ + orig_value = READ_VID32(0X04); + WRITE_VID32(0x04, 0x00200141); + gfx_delay_milliseconds(21); + pm_value = gfx_ind(0x9030); + + pm_value |= 0x400; + gfx_outd(0x9030, pm_value); + gfx_delay_milliseconds(4); + orig_value &= 0xfff1ffff; + WRITE_VID32(0X4, orig_value); + return; + } /*end if() */ + } /*end for() */ + +} + +void +Dorado9211SetCS(void) +{ + unsigned long value; + + value = gfx_ind(DRD_CSP9211IN); + gfx_outd(DRD_CSP9211OUT, value | DRD_CS9211); +} + +void +Dorado9211ClearCS(void) +{ + unsigned long value; + + value = gfx_ind(DRD_CSP9211IN); + gfx_outd(DRD_CSP9211OUT, value & (~DRD_CS9211)); +} + +void +Dorado9211SetDataOut(void) +{ + unsigned long value; + + value = gfx_ind(DRD_DATAOUTP9211IN); + gfx_outd(DRD_DATAOUTP9211OUT, value | DRD_DATAIN9211); +} + +void +Dorado9211ClearDataOut(void) +{ + unsigned long value; + + value = gfx_ind(DRD_DATAOUTP9211IN); + gfx_outd(DRD_DATAOUTP9211OUT, value & (~DRD_DATAIN9211)); +} + +unsigned char +Dorado9211ReadDataIn(void) +{ + unsigned char readdata = 0; + unsigned long value; + + /* why to read 4 times ??? */ + value = gfx_ind(DRD_DATAINP9211IN); + value = gfx_ind(DRD_DATAINP9211IN); + value = gfx_ind(DRD_DATAINP9211IN); + value = gfx_ind(DRD_DATAINP9211IN); + if (value & DRD_DATAOUT9211) + readdata = 1; + return (readdata); +} + +void +Dorado9211ToggleClock(void) +{ + Dorado9211SetClock(); + Dorado9211ClearClock(); +} + +void +Dorado9211SetClock(void) +{ + unsigned long value; + + value = gfx_ind(DRD_CLOCKP9211IN); + gfx_outd(DRD_CLOCKP9211OUT, value | DRD_CLOCK9211); +} + +void +Dorado9211ClearClock(void) +{ + unsigned long value; + + value = gfx_ind(DRD_CLOCKP9211IN); + gfx_outd(DRD_CLOCKP9211OUT, value & (~DRD_CLOCK9211)); +} + +void +Dorado9211GpioInit(void) +{ + unsigned long value; + + /* set output enable on gpio 7, 9, 11 */ + gfx_outd((DRD_GEODE_GPIO_BASE + DRD_GEODE_GPPIN_SEL), DRD_CLOCK9211CFG); + gfx_outd((DRD_GEODE_GPIO_BASE + DRD_GEODE_GPPIN_CFG), 3); + /* set output enable on gpio 7, 9, 11 */ + gfx_outd((DRD_GEODE_GPIO_BASE + DRD_GEODE_GPPIN_SEL), DRD_CS9211CFG); + gfx_outd((DRD_GEODE_GPIO_BASE + DRD_GEODE_GPPIN_CFG), 3); + /* set output enable on gpio 7, 9, 18 */ + gfx_outd((DRD_GEODE_GPIO_BASE + DRD_GEODE_GPPIN_SEL), DRD_DATAIN9211CFG); + gfx_outd((DRD_GEODE_GPIO_BASE + DRD_GEODE_GPPIN_CFG), 3); + /* disable on gpio 11 - This is the output from the 9211 */ + gfx_outd((DRD_GEODE_GPIO_BASE + DRD_GEODE_GPPIN_SEL), DRD_DATAOUT9211CFG); + gfx_outd((DRD_GEODE_GPIO_BASE + DRD_GEODE_GPPIN_CFG), 0); + /* Set all PINS low */ + value = gfx_ind(DRD_GEODE_GPIO_BASE + DRD_GEODE_GPDI0); + value &= ~(DRD_CS9211 | DRD_CLOCK9211 | DRD_DATAIN9211); + gfx_outd((DRD_GEODE_GPIO_BASE + DRD_GEODE_GPDO0), value); +} + +unsigned long +Dorado9211ReadReg(unsigned short index) +{ + + unsigned char i, readbit; + unsigned long data; + + Dorado9211ClearDataOut(); + + Dorado9211SetCS(); + Dorado9211ToggleClock(); + + Dorado9211SetDataOut(); + Dorado9211ToggleClock(); + + for (i = 0; i < 12; i++) { + if (index & 0x1) { + Dorado9211SetDataOut(); + } else { + Dorado9211ClearDataOut(); + } + Dorado9211ToggleClock(); + index >>= 1; + } + + Dorado9211ClearDataOut(); + Dorado9211ToggleClock(); + + /* Idle clock, 7 clocks, no data set */ + + Dorado9211ToggleClock(); + Dorado9211ToggleClock(); + Dorado9211ToggleClock(); + Dorado9211ToggleClock(); + Dorado9211ToggleClock(); + Dorado9211ToggleClock(); + Dorado9211ToggleClock(); + + data = 0; + for (i = 0; i < 32; i++) { + Dorado9211ToggleClock(); + readbit = Dorado9211ReadDataIn(); + data |= (((unsigned long)readbit) << i); + } + + Dorado9211ClearCS(); + Dorado9211ToggleClock(); + return (data); + +} + +void +Dorado9211WriteReg(unsigned short index, unsigned long data) +{ + + unsigned char i; + + Dorado9211ClearDataOut(); + Dorado9211SetDataOut(); + Dorado9211SetCS(); + Dorado9211ToggleClock(); + Dorado9211SetDataOut(); + Dorado9211ToggleClock(); + + for (i = 0; i < 12; i++) { + if (index & 0x1) { + Dorado9211SetDataOut(); + } else { + Dorado9211ClearDataOut(); + } + Dorado9211ToggleClock(); + index >>= 1; + } + + Dorado9211SetDataOut(); + Dorado9211ToggleClock(); + + for (i = 0; i < 32; i++) { + if (data & 0x1) { + Dorado9211SetDataOut(); + } else { + Dorado9211ClearDataOut(); + } + Dorado9211ToggleClock(); + data >>= 1; + } + + Dorado9211ClearCS(); + + Dorado9211ToggleClock(); + Dorado9211ToggleClock(); + Dorado9211ToggleClock(); + Dorado9211ToggleClock(); +} + +void +DoradoProgramFRMload(void) +{ + unsigned long DoradoFRMtable[] = { + + 0x00000000, + 0x00000000, + 0x01000100, + 0x01000100, + 0x01010101, + 0x01010101, + 0x02081041, + 0x02081041, + 0x10111111, + 0x11111101, + 0x49249241, + 0x12412492, + 0x92244891, + 0x92244891, + 0x22252525, + 0x22252525, + 0x528294a5, + 0x2528494a, + 0x294a5295, + 0x294a5295, + 0x54a54a95, + 0x2952a52a, + 0x2a552a55, + 0x2a552a55, + 0x554aa955, + 0x2a9552aa, + 0x2aaa5555, + 0x2aaa5555, + 0x55555555, + 0x2aaaaaaa, + 0x55555555, + 0x55555555, + 0xaaaaaaab, + 0x55555555, + 0x5555aaab, + 0x5555aaab, + 0xaab556ab, + 0x556aad55, + 0x55ab55ab, + 0x55ab55ab, + 0xab5ab56b, + 0x56ad5ad5, + 0x56b5ad6b, + 0x56b5ad6b, + 0xad6d6b5b, + 0x5ad6b6b6, + 0x5b5b5b5b, + 0x5b5b5b5b, + 0x5F6db6db, + 0x5F6db6db, + 0xF776F776, + 0xF776F776, + 0xFBDEFBDE, + 0xFBDEFBDE, + 0x7eFFBFF7, + 0x7eFFBFF7, + 0xFF7FF7F7, + 0xFF7FF7F7, + 0xFF7FFF7F, + 0xFF7FFF7F, + 0xFFF7FFFF, + 0xFFF7FFFF, + 0xFFFFFFFF, + 0xFFFFFFFF, + }; + + unsigned char i; + unsigned short index; + unsigned long data; + + Dorado9211WriteReg(CS92xx_FRM_MEMORY_INDEX, 0); + index = CS92xx_FRM_MEMORY_DATA; + for (i = 0; i < 64; i += 2) { + data = DoradoFRMtable[i]; + Dorado9211WriteReg(index, data); + data = DoradoFRMtable[i + 1]; + Dorado9211WriteReg(index, data); + } + +/* + * The first FRM location (64 bits) does not program correctly. + * This location always reads back with the last value programmed. + * ie. If 32 64-bit values are programmed, location 0 reads back as the 32nd + * If 30 locations are programmed, location 0 reads back as the 30th, etc. + * Fix this by re-writing location 0 after programming all 64 in the writeFRM + * loop in RevCFrmload() in CS9211. + */ + + Dorado9211WriteReg(CS92xx_FRM_MEMORY_INDEX, 0); + Dorado9211WriteReg(CS92xx_FRM_MEMORY_DATA, 0); + Dorado9211WriteReg(CS92xx_FRM_MEMORY_DATA, 0); + +} + +/***************************************************************************** + * void Dorado_Enable_Power((void); + * Enables the power of the CX9211 on Dorado board. + ***************************************************************************** + */ + +void +Dorado_Power_Up(void) +{ + Dorado9211WriteReg(CS92xx_LCD_PWR_MAN, 0x01000000); + return; + +} /* disable_Centaurus_Power */ + +/***************************************************************************** + * void Dorado_Disable_Power((void); + * Disables the power of the CX9211 on Dorado board. + ***************************************************************************** + */ + +void +Dorado_Power_Down(void) +{ + Dorado9211WriteReg(CS92xx_LCD_PWR_MAN, 0x0); + return; + +} /* disable_Centaurus_Power */ + +void +Dorado_Save_Panel_State(void) +{ + + /* set 9211 registers using the desired panel settings */ + cs9211_regs.panel_timing1 = Dorado9211ReadReg(CS92xx_LCD_PAN_TIMING1); + cs9211_regs.panel_timing2 = Dorado9211ReadReg(CS92xx_LCD_PAN_TIMING2); + + cs9211_regs.dither_frc_ctrl = Dorado9211ReadReg(CS92xx_LCD_DITH_FR_CNTRL); + cs9211_regs.blue_lsfr_seed = Dorado9211ReadReg(CS92xx_BLUE_LSFR_SEED); + cs9211_regs.red_green_lsfr_seed = + Dorado9211ReadReg(CS92xx_RED_GREEN_LSFR_SEED); + + /* CentaurusProgramFRMload(); */ + cs9211_regs.memory_control = Dorado9211ReadReg(CS92xx_LCD_MEM_CNTRL); + + /* Set the power register last. This will turn the panel on at the 9211 */ + cs9211_regs.power_management = Dorado9211ReadReg(CS92xx_LCD_PWR_MAN); + cs9211_regs.panel_state = cs9211_regs.power_management; +} + +void +Dorado_Restore_Panel_State(void) +{ + unsigned long off_data = 0; + + /* Before restoring the 9211 registers, power off the 9211. */ + + Dorado9211WriteReg(CS92xx_LCD_PWR_MAN, off_data); + + /* set 9211 registers using the desired panel settings */ + Dorado9211WriteReg(CS92xx_LCD_PAN_TIMING1, cs9211_regs.panel_timing1); + Dorado9211WriteReg(CS92xx_LCD_PAN_TIMING2, cs9211_regs.panel_timing2); + /* load the LSFR seeds */ + Dorado9211WriteReg(CS92xx_LCD_DITH_FR_CNTRL, cs9211_regs.dither_frc_ctrl); + Dorado9211WriteReg(CS92xx_BLUE_LSFR_SEED, cs9211_regs.blue_lsfr_seed); + Dorado9211WriteReg(CS92xx_RED_GREEN_LSFR_SEED, + cs9211_regs.red_green_lsfr_seed); + + Dorado9211WriteReg(CS92xx_LCD_MEM_CNTRL, cs9211_regs.memory_control); + /* Set the power register last. This will turn the panel on at the 9211 */ + Dorado9211WriteReg(CS92xx_LCD_PWR_MAN, cs9211_regs.power_management); +} diff --git a/driver/xf86-video-geode/src/panel/dora9211.h b/driver/xf86-video-geode/src/panel/dora9211.h new file mode 100644 index 000000000..d38b50320 --- /dev/null +++ b/driver/xf86-video-geode/src/panel/dora9211.h @@ -0,0 +1,100 @@ +/* Copyright (c) 2005 Advanced Micro Devices, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + * + * Neither the name of the Advanced Micro Devices, Inc. nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * */ + +/* + * File Contents: This header file defines the Durango routines and + * variables used to access the memory mapped regions. + * + * SubModule: Geode FlatPanel library + * */ + +#include "panel.h" +#include "92xx.h" + +#ifndef _DORA9211_h +#define _DORA9211_h + +/* 9211 Rev.C3 Dorado */ + +/* GPIO Pin Configuration Registers */ + +#define DRD_GEODE_GPPIN_SEL 0x20 /* GPIO Pin Configuration Select */ +#define DRD_GEODE_GPPIN_CFG 0x24 /* GPIO Pin Configuration Access */ +#define DRD_GEODE_GPPIN_RESET 0x28 /* GPIO Pin Reset */ + +#define DRD_GEODE_GPIO_BASE 0x6400 /* F0 GPIO, IO mapped */ +#define DRD_GEODE_GPDI0 0x04 /* GPIO Data In 0 */ +#define DRD_GEODE_GPDO0 0x00 /* GPIO Data Out 0 */ + +/* Data Ports in */ +#define DRD_CLOCKP9211IN DRD_GEODE_GPIO_BASE + DRD_GEODE_GPDI0 +#define DRD_DATAINP9211IN DRD_GEODE_GPIO_BASE + DRD_GEODE_GPDI0 +#define DRD_DATAOUTP9211IN DRD_GEODE_GPIO_BASE + DRD_GEODE_GPDI0 +#define DRD_CSP9211IN DRD_GEODE_GPIO_BASE + DRD_GEODE_GPDI0 + +/* Data Ports out */ +#define DRD_CLOCKP9211OUT DRD_GEODE_GPIO_BASE + DRD_GEODE_GPDO0 +#define DRD_DATAINP9211OUT DRD_GEODE_GPIO_BASE + DRD_GEODE_GPDO0 +#define DRD_DATAOUTP9211OUT DRD_GEODE_GPIO_BASE + DRD_GEODE_GPDO0 +#define DRD_CSP9211OUT DRD_GEODE_GPIO_BASE + DRD_GEODE_GPDO0 + +/* Pin MASKS */ +#define DRD_CLOCK9211 0x00000080 /* gpio 7, clock output to 9211 */ +#define DRD_DATAIN9211 0x00040000 /* gpio 18, data output to 9211 */ +#define DRD_DATAOUT9211 0x00000800 /* gpio 11, data input from 9211 */ +#define DRD_CS9211 0x00000200 /* gpio 9, chip select output to 9211 + * */ + +/* Gpio CFG values to select in */ +#define DRD_CLOCK9211CFG 0x00000007 /* gpio 7 */ +#define DRD_DATAIN9211CFG 0x00000012 /* gpio 18 */ +#define DRD_DATAOUT9211CFG 0x0000000B /* gpio 11 */ +#define DRD_CS9211CFG 0x00000009 /* gpio 9 */ + +#define DRD_LCDRESGPIO1 0x00 +#define DRD_LCDRESGPIO2 0x01 +#define DRD_LCDRESGPIO3 0x02 +#define DRD_LCDRESGPIO4 0x04 + +void Dorado9211SetCS(void); +void Dorado9211ClearCS(void); +void Dorado9211SetDataOut(void); +void Dorado9211ClearDataOut(void); +unsigned char Dorado9211ReadDataIn(void); +void Dorado9211ToggleClock(void); +void Dorado9211SetClock(void); +void Dorado9211ClearClock(void); +void Dorado9211GpioInit(void); +unsigned long Dorado9211ReadReg(unsigned short index); +void Dorado9211WriteReg(unsigned short index, unsigned long data); +void DoradoProgramFRMload(void); +void Dorado_Get_9211_Details(unsigned long flags, Pnl_PanelParams * pParam); +void Dorado_Power_Up(void); +void Dorado_Power_Down(void); +void Dorado_Save_Panel_State(void); +void Dorado_Restore_Panel_State(void); +void Dorado9211Init(Pnl_PanelStat * pstat); + +#endif /* !_DORA9211_h */ diff --git a/driver/xf86-video-geode/src/panel/drac9210.c b/driver/xf86-video-geode/src/panel/drac9210.c new file mode 100644 index 000000000..ce8b4a0dd --- /dev/null +++ b/driver/xf86-video-geode/src/panel/drac9210.c @@ -0,0 +1,652 @@ +/* Copyright (c) 2005 Advanced Micro Devices, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + * + * Neither the name of the Advanced Micro Devices, Inc. nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * */ + +/* + * File Contents: This file contains the panel library files to the + * platforms with 9210, and 9211 support. + * + * SubModule: Geode FlatPanel library + * */ + +#include "drac9210.h" + +#define CS9210 0x40 /* Chip select pin */ + +/* 9210 on Draco */ +#define CLOCK9210 0x04 /* Clock pin */ +#define DATAIN9210 0x20 /* Data from 9210 */ +#define DATAOUT9210 0x80 /* Data to 9210 */ + +static void DracoWriteData(unsigned char data); +static void DracoReadData(unsigned char *data); +static void Draco9210GpioInit(); +static void Draco9210SetCS(void); +static unsigned char Draco9210ReadReg(unsigned char index); +static void Draco9210WriteReg(unsigned char index, unsigned char data); +static void Draco9210ClearCS(void); +static void Draco9210SetDataOut(void); +static void Draco9210ClearDataOut(void); +static unsigned char Draco9210ReadDataIn(void); +static void Draco9210ToggleClock(void); + +void +Draco9210Init(Pnl_PanelStat * pstat) +{ + unsigned char panelvalues[] = { + 0x2, 0x80, + 0x2, 0x24, + 0x03, 0x00, + 0xc0, 0x00, + 0xc1, 0x00, + 0xc2, 0x00, + 0xc3, 0x00, + 0xc4, 0x00, + 0xc5, 0x01, + 0xc6, 0xff, + 0xc7, 0xff, + 0xc8, 0x3, + 0xc9, 0xfe, + 0xca, 0x0, + 0xcb, 0x3f, + 0xcc, 0xc, + 0xcd, 0x1, + 0xce, 0xff, + 0xcf, 0xc1, + 0xd0, 0x0, + 0xd1, 0x7e, + 0xd2, 0x3, + 0xd3, 0xfe, + 0xd4, 0x3, + 0xd5, 0x81, + 0xd6, 0xfc, + 0xd7, 0x3f, + 0xd8, 0x14, + 0xd9, 0x1e, + 0xda, 0x0f, + 0xdb, 0xc7, + 0xdc, 0x29, + 0xdd, 0xe1, + 0xde, 0xf1, + 0xdf, 0xf9, + 0xe0, 0x2, + 0xe1, 0xe, + 0xe2, 0x1e, + 0xe3, 0x3e, + 0xe4, 0x04, + 0xe5, 0x71, + 0xe6, 0xe3, + 0xe7, 0xcf, + 0xe8, 0x1, + 0xe9, 0x86, + 0xea, 0x3c, + 0xeb, 0xf3, + 0xec, 0xa, + 0xed, 0x39, + 0xee, 0xc7, + 0xef, 0x3d, + + 0xf0, 0x14, + 0xf1, 0xc6, + 0xf2, 0x39, + 0xf3, 0xce, + 0xf4, 0x3, + 0xf5, 0x19, + 0xf6, 0xce, + 0xf7, 0x77, + 0xf8, 0x0, + 0xf9, 0x66, + 0xfa, 0x33, + 0xfb, 0xbb, + 0xfc, 0x2d, + 0xfd, 0x99, + 0xfe, 0xdd, + 0xff, 0xdd, + + 0x3, 0x1, + 0xc0, 0x2, + 0xc1, 0x22, + 0xc2, 0x66, + 0xc3, 0x66, + 0xc4, 0x0, + 0xc5, 0xcd, + 0xc6, 0x99, + 0xc7, 0xbb, + 0xc8, 0x5, + 0xc9, 0x32, + 0xca, 0x66, + 0xcb, 0xdd, + 0xcc, 0x1a, + 0xcd, 0x4d, + 0xce, 0x9b, + 0xcf, 0x6f, + 0xd0, 0x0, + 0xd1, 0x92, + 0xd2, 0x6d, + 0xd3, 0xb6, + 0xd4, 0x5, + 0xd5, 0x25, + 0xd6, 0xb6, + 0xd7, 0xdb, + 0xd8, 0x2, + 0xd9, 0x5a, + 0xda, 0x4b, + 0xdb, 0x6d, + 0xdc, 0x29, + 0xdd, 0xa5, + 0xde, 0xb5, + 0xdf, 0xb7, + 0xe0, 0x4, + 0xe1, 0x4a, + 0xe2, 0x5a, + 0xe3, 0xda, + 0xe4, 0x12, + 0xe5, 0x95, + 0xe6, 0xad, + 0xe7, 0x6f, + 0xe8, 0x1, + 0xe9, 0x2a, + 0xea, 0x56, + 0xeb, 0xb5, + 0xec, 0xe, + 0xed, 0x55, + 0xee, 0xab, + 0xef, 0x5f, + 0xf0, 0x0, + 0xf1, 0xaa, + 0xf2, 0x55, + 0xf3, 0xea, + 0xf4, 0x1, + 0xf5, 0x55, + 0xf6, 0xaa, + 0xf7, 0xbf, + 0xf8, 0x6, + 0xf9, 0xaa, + 0xfa, 0x55, + 0xfb, 0x55, + 0xfc, 0x39, + 0xfd, 0x55, + 0xfe, 0xff, + 0xff, 0xff, + + 0x3, 0x2, + 0xc0, 0x0, + 0xc1, 0x0, + 0xc2, 0xaa, + 0xc3, 0xaa, + 0xc4, 0x6, + 0xc5, 0xab, + 0xc6, 0x55, + 0xc7, 0x55, + 0xc8, 0x01, + 0xc9, 0x54, + 0xca, 0xaa, + 0xcb, 0xbf, + 0xcc, 0x8, + 0xcd, 0xab, + 0xce, 0x55, + 0xcf, 0xeb, + 0xd0, 0x6, + 0xd1, 0x54, + 0xd2, 0xab, + 0xd3, 0x5e, + 0xd4, 0x1, + 0xd5, 0x2b, + 0xd6, 0x56, + 0xd7, 0xb5, + 0xd8, 0x12, + 0xd9, 0x94, + 0xda, 0xad, + 0xdb, 0x6f, + 0xdc, 0x2d, + 0xdd, 0x4b, + 0xde, 0x5b, + 0xdf, 0xdb, + 0xe0, 0x0, + 0xe1, 0xa4, + 0xe2, 0xb4, + 0xe3, 0xb6, + 0xe4, 0x2, + 0xe5, 0x5b, + 0xe6, 0x4b, + 0xe7, 0x6d, + 0xe8, 0x5, + 0xe9, 0x24, + 0xea, 0xb6, + 0xeb, 0xdb, + 0xec, 0x8, + 0xed, 0x93, + 0xee, 0x6d, + 0xef, 0xb7, + 0xf0, 0x12, + 0xf1, 0x4c, + 0xf2, 0x9b, + 0xf3, 0x6e, + 0xf4, 0x5, + 0xf5, 0x33, + 0xf6, 0x66, + 0xf7, 0xdd, + 0xf8, 0x0, + 0xf9, 0xcc, + 0xfa, 0x99, + 0xfb, 0xbb, + 0xfc, 0x2b, + 0xfd, 0x33, + 0xfe, 0x77, + 0xff, 0x77, + + 0x3, 0x3, + 0xc0, 0x4, + 0xc1, 0x88, + 0xc2, 0xcc, + 0xc3, 0xcc, + 0xc4, 0x0, + 0xc5, 0x67, + 0xc6, 0x33, + 0xc7, 0xbb, + 0xc8, 0x3, + 0xc9, 0x18, + 0xca, 0xce, + 0xcb, 0x77, + 0xcc, 0x1c, + 0xcd, 0xc7, + 0xce, 0x39, + 0xcf, 0xcf, + + 0xd0, 0x2, + 0xd1, 0x38, + 0xd2, 0xc7, + 0xd3, 0x3c, + 0xd4, 0x1, + 0xd5, 0x87, + 0xd6, 0x3c, + 0xd7, 0xf3, + 0xd8, 0x4, + 0xd9, 0x70, + 0xda, 0xe3, + 0xdb, 0xcf, + 0xdc, 0x2b, + 0xdd, 0xf, + 0xde, 0x1f, + 0xdf, 0x3f, + 0xe0, 0x00, + 0xe1, 0xe0, + 0xe2, 0xf0, + 0xe3, 0xf8, + 0xe4, 0x14, + 0xe5, 0x1f, + 0xe6, 0xf, + 0xe7, 0xc7, + 0xe8, 0x3, + 0xe9, 0x80, + 0xea, 0xfc, + 0xeb, 0x3f, + 0xec, 0x8, + 0xed, 0x7f, + 0xee, 0x3, + 0xef, 0xff, + 0xf0, 0x4, + 0xf1, 0x0, + 0xf2, 0xff, + 0xf3, 0xc0, + 0xf4, 0x3, + 0xf5, 0xff, + 0xf6, 0x0, + 0xf7, 0x3f, + 0xf8, 0x0, + 0xf9, 0x0, + 0xfa, 0xff, + 0xfb, 0xff, + 0xfc, 0x3f, + 0xfd, 0xff, + 0xfe, 0xff, + 0xff, 0xff, + 0x3, 0x4, + + /* Setup the Diter to Pattern33 */ + 0x80, 0xdd, + 0x81, 0xdd, + 0x82, 0x33, + 0x83, 0x33, + 0x84, 0xdd, + 0x85, 0xdd, + 0x86, 0x33, + 0x87, 0x33, + 0x88, 0x33, + 0x89, 0x33, + 0x8a, 0x77, + 0x8b, 0x77, + 0x8c, 0x33, + 0x8d, 0x33, + 0x8e, 0x77, + 0x8f, 0x77, + 0x90, 0xdd, + 0x91, 0xdd, + 0x92, 0x33, + 0x93, 0x33, + 0x94, 0xdd, + 0x95, 0xdd, + 0x96, 0x33, + 0x97, 0x33, + 0x98, 0x33, + 0x99, 0x33, + 0x9a, 0x77, + 0x9b, 0x77, + 0x9c, 0x33, + 0x9d, 0x33, + 0x9e, 0x77, + 0x9f, 0x77, + + 0x4, 0x20, + 0x5, 0x3, + 0x6, 0x56, + 0x7, 0x2, + 0x8, 0x1c, + 0x9, 0x0, + 0xa, 0x26, + 0xb, 0x0, + 0xc, 0x15, + 0xd, 0x4, + 0xe, 0x50, + 0xf, 0x4, + 0x10, 0xfa, + 0x11, 0x0, + 0x12, 0xc8, + 0x13, 0x0, + 0x14, 0x31, + 0x15, 0x23, + 0x16, 0x0, + + /* Enable DSTN panel */ + 0x2, 0x64 + }; + unsigned char index, data; + int i; + + gfx_delay_milliseconds(100); + Draco9210GpioInit(); + Draco9210SetCS(); + Draco9210ToggleClock(); + Draco9210ToggleClock(); + Draco9210ToggleClock(); + Draco9210ToggleClock(); + Draco9210ClearCS(); + +#if defined(_WIN32) /* For Windows */ + for (i = 0; i < 10; i++) { + _asm { + out 0ED h, al} + } + +#elif defined(linux) /* Linux */ + +#endif + + for (i = 0; i < 630; i += 2) { + index = panelvalues[i]; + data = panelvalues[i + 1]; + Draco9210WriteReg(index, data); + } + +} + +static void +DracoWriteData(unsigned char data) +{ + int i; + unsigned char mask = 0x80, databit; + + for (i = 0; i < 8; i++) { + + databit = data & mask; + if (data & mask) { + Draco9210SetDataOut(); + } else { + Draco9210ClearDataOut(); + } + mask >>= 1; + Draco9210ToggleClock(); + } +} + +static void +DracoReadData(unsigned char *data) +{ + int i; + unsigned char tmp = 0, readbit; + + Draco9210ClearDataOut(); + Draco9210ToggleClock(); + for (i = 0; i < 7; i++) { + readbit = Draco9210ReadDataIn(); + tmp |= (readbit & 0x1); + tmp <<= 1; + Draco9210ToggleClock(); + } + readbit = Draco9210ReadDataIn(); + tmp |= (readbit & 0x1); + *data = tmp; +} + +#if defined(_WIN32) /* For Windows */ + +void +Draco9210GpioInit() +{ + _asm { + pushf + cli + mov dx, 0 CF8h + mov eax, CX55x0_ID + 090 h + out dx, eax + mov dx, 0 CFCh mov al, 0 CFh mov ah, 00 h out dx, ax popf} +} + +void +Draco9210SetCS() +{ + _asm { + pushf; + Point to PCI address register mov dx, 0 CF8h; + 55 XX GPIO data register mov eax, CX55x0_ID + 090 h out dx, eax; + Point to PCI data register (CFCh) + mov dx, 0 CFCh + in ax, dx + and ah, 30 h + mov ah, c92DataReg + or ah, CS9210 mov c92DataReg, ah out dx, ax popf} +} + +void +Draco9210ClearCS() +{ + _asm { + pushf; + Point to PCI address register mov dx, 0 CF8h; + 55 XX GPIO data register mov eax, CX55x0_ID + 090 h out dx, eax; + Point to PCI data register (CFCh) + mov dx, 0 CFCh; + Set CS LOW + in ax, dx + mov ah, c92DataReg + and ah, NOT CS9210 mov c92DataReg, ah out dx, ax popf} +} + +void +Draco9210SetDataOut() +{ + _asm { + pushf; + Point to PCI address register mov dx, 0 CF8h; + 55 XX GPIO data register mov eax, CX55x0_ID + 090 h out dx, eax; + Point to PCI data register (CFCh) + mov dx, 0 CFCh; + Set DATA HIGH + in ax, dx + mov ah, c92DataReg + or ah, DATAOUT9210 mov c92DataReg, ah out dx, ax popf} +} + +void +Draco9210ClearDataOut() +{ + _asm { + pushf; + Point to PCI address register + mov dx, 0 CF8h mov eax, CX55x0_ID + 090 h; + ; + 55 XX GPIO data register out dx, eax; + Point to PCI data register (CFCh) + mov dx, 0 CFCh; + Set Data LOW + in ax, dx + mov ah, c92DataReg + and ah, NOT DATAOUT9210 mov c92DataReg, ah out dx, ax popf} +} + +unsigned char +Draco9210ReadDataIn() +{ + unsigned char readdata; + + _asm { + pushf; + Point to PCI address register mov dx, 0 CF8h; + 55 XX GPIO data register mov eax, CX55x0_ID + 090 h out dx, eax; + Point to PCI data register (CFCh) + mov dx, 0F Ch in ax, dx; + Preserve just Data IN bit and ah, DATAIN9210 mov al, ah cmp al, 0; + Is it LOW ? je readDataLow; + must be HIGH mov al, 1 readDataLow:mov readdata, al popf} + return (readdata); +} + +void +Draco9210ToggleClock() +{ + _asm { + pushf; + Point to PCI address register mov dx, 0 CF8h; + 55 XX GPIO data register mov eax, CX55x0_ID + 090 h; + Point to PCI data register (CFCh) + out dx, eax mov dx, 0 CFCh; + SET CLOCK in ax, dx mov ah, c92DataReg or ah, CLOCK9210 mov c92DataReg, ah out dx, ax out 0ED h, al /* IOPAUSE */ + ; + Point to PCI address register mov dx, 0 CF8h; + 55 XX GPIO data register mov eax, CX55x0_ID + 090 h out dx, eax; + Point to PCI data register (CFCh) + mov dx, 0 CFCh; + + ; + CLEAR CLOCK + in ax, dx + mov ah, c92DataReg + and ah, NOT CLOCK9210 mov c92DataReg, ah out dx, ax popf} +} + +#elif defined(linux) /* Linux */ + +void +Draco9210GpioInit() +{ +} +void +Draco9210SetCS() +{ +} +void +Draco9210ClearCS() +{ +} +void +Draco9210SetDataOut() +{ +} +void +Draco9210ClearDataOut() +{ +} +unsigned char +Draco9210ReadDataIn() +{ +} +void +Draco9210ToggleClock() +{ +} + +#endif + +unsigned char +Draco9210ReadReg(unsigned char index) +{ + unsigned char data; + + Draco9210SetCS(); + Draco9210ToggleClock(); + Draco9210SetDataOut(); + Draco9210ToggleClock(); + Draco9210ClearDataOut(); + Draco9210ToggleClock(); + Draco9210ClearDataOut(); + Draco9210ToggleClock(); + Draco9210ClearDataOut(); + Draco9210ToggleClock(); + + DracoWriteData(index); + DracoReadData(&data); + + return (data); +} + +void +Draco9210WriteReg(unsigned char index, unsigned char data) +{ + + Draco9210SetCS(); + Draco9210ToggleClock(); + + Draco9210SetDataOut(); + Draco9210ToggleClock(); + + Draco9210ClearDataOut(); + Draco9210ToggleClock(); + + Draco9210ClearDataOut(); + Draco9210ToggleClock(); + + Draco9210SetDataOut(); + Draco9210ToggleClock(); + + DracoWriteData(index); + DracoWriteData(data); + + Draco9210ClearDataOut(); + Draco9210ToggleClock(); + + Draco9210ClearCS(); + Draco9210ToggleClock(); + Draco9210ToggleClock(); + +} diff --git a/driver/xf86-video-geode/src/panel/drac9210.h b/driver/xf86-video-geode/src/panel/drac9210.h new file mode 100644 index 000000000..1939fd601 --- /dev/null +++ b/driver/xf86-video-geode/src/panel/drac9210.h @@ -0,0 +1,41 @@ +/* Copyright (c) 2005 Advanced Micro Devices, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + * + * Neither the name of the Advanced Micro Devices, Inc. nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * */ + +/* + * File Contents: This file contains the panel header file and definition + * for the platform with 9210 support. + * + * SubModule: Geode FlatPanel library + * */ + +#include "panel.h" + +#ifndef _DRAC9210_h +#define _DRAC9210_h +#define CX55x0_ID 0x80009000 +static unsigned char c92DataReg = 0; +#endif /* !_DRAC9210_h */ + +/* END OF FILE */ diff --git a/driver/xf86-video-geode/src/panel/gx2_9211.c b/driver/xf86-video-geode/src/panel/gx2_9211.c new file mode 100644 index 000000000..a60264ddd --- /dev/null +++ b/driver/xf86-video-geode/src/panel/gx2_9211.c @@ -0,0 +1,292 @@ +/* Copyright (c) 2005 Advanced Micro Devices, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + * + * Neither the name of the Advanced Micro Devices, Inc. nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * */ + +/* + * File Contents: This file contains the panel library files to the + * GX2 platforms with 9211 support. + * + * SubModule: Geode FlatPanel library + * */ + +#include "92xx.h" +#include "gx2_9211.h" +#include "pnl_defs.h" + +#if defined(_WIN32) /* windows */ +#include "gfx_defs.h" + +extern DEV_STATUS gfx_msr_read(unsigned int device, unsigned int msrRegister, + Q_WORD * msrValue); +extern DEV_STATUS gfx_msr_write(unsigned int device, unsigned int msrRegister, + Q_WORD * msrValue); +#endif + +static unsigned long FPBaseAddr; + +void +SetFPBaseAddr(unsigned long addr) +{ + + FPBaseAddr = addr; +} + +/**************************************************************************** + * protected_mode_access( unsigned long mode, unsigned long width, + * unsigned long addr, unsigned char* pdata ) + * This function provides access to physical memory at the requested address. + * + * mode is: + * GX2_READ or GX2_WRITE (accesses a single byte, word or double word + * depending on the value of "width". Only 1, 2 or 4 supported). + * READ_BYTES, WRITE_BYTES accesses "width" number of bytes (8 bits) + * READ_WORDS, WRITE_WORDS accesses "width" number of words (16 bits) + * READ_DWORDS, WRITE_DWORDS accesses "width" number of dwords (32 + * bits) + * + * width is: + * The size of the access. For READ or WRITE, only 1, 2 and 4 are + * supported. For other modes, width is not limited but will cause + * paging if the block traverses page boundaries. + * + * addr is: + * The physical address being accessed + * + * pdata is: + * A pointer to the data to be read or written into. + * + * NOTE! WORD or DWORD accesses can only be made on WORD or DWORD boundaries! + ****************************************************************************/ +void +protected_mode_access(unsigned long mode, + unsigned long width, unsigned long addr, char *pdata) +{ + void *ptr = (void *)(FPBaseAddr + addr); + + /* type specific buffer pointers */ + char *byte_data = (char *)pdata; + unsigned long *word_data = (unsigned long *)pdata; + unsigned long *dword_data = (unsigned long *)pdata; + + if (mode == GX2_READ) { + switch (width) { + case FOUR_BYTES: + *(dword_data) = (unsigned long)(*(unsigned long *)ptr); + break; + case TWO_BYTES: + *(word_data) = (unsigned long)(*(unsigned long *)ptr); + break; + default: + *(byte_data) = (char)(*(char *)ptr); + break; + } + } /* end GX2_READ */ + else if (mode == GX2_WRITE) { + switch (width) { + case FOUR_BYTES: + *(unsigned long *)ptr = *dword_data; + break; + case TWO_BYTES: + *(unsigned long *)ptr = *word_data; + break; + default: + *(char *)ptr = *byte_data; + break; + } /* end switch(mode) */ + } + /* end case GX2_WRITE */ + return; + +} /* End of protected_mode_access. */ + +/************************************************************************* + * void write_video_reg64_low( unsigned long offset, unsigned long value ) + * + * Writes value to the low 32 bits of the 64 bit memory mapped video + * register indicated by offset. + * This function uses Sys_info.video_reg_base as the base address, so + * the value of offset should be with respect to this base. + *************************************************************************/ +void +write_video_reg64_low(unsigned long offset, unsigned long value) +{ + protected_mode_access(GX2_WRITE, FOUR_BYTES, + FPBaseAddr + offset, (char *)&value); +} /*end write_video_reg64_low() */ + +/************************************************************************* + * unsigned long read_video_reg64_low( unsigned long offset ) + * + * Returns the contents of the low 32 bits of the 64 bit memory mapped + * video register indicated by offset. + * This function uses Sys_info.video_reg_base as the base address, so + * the value of offset should be with respect to this base. + *************************************************************************/ +unsigned long +read_video_reg64_low(unsigned long offset) +{ + unsigned long data; + + protected_mode_access(GX2_READ, FOUR_BYTES, + FPBaseAddr + offset, (char *)&data); + return (data); +} /*end read_video_reg64_low() */ + +/***************************************************************************** + * void Redcloud_fp_reg(int mode, unsigned long address, unsigned long *data) + * + * Writes and reads dwords to the Redcloud flat panel registers in the + * Redcloud Display Filter. There's no clock control, chip select or timing + * to deal with. + * This routine expects the actual GX2 macro definitions for the address. + * + * Parameters: + * mode: An integer value for a GX2_READ or GX2_WRITE operation + * 0 = GX2_Read and 1 = GX2_Write + * address: A dword value representing the offset of the register. + * data: A pointer to a dword value that is to be written in to + * the required register. In case of a Read operation + * this will point to the result of the Read operation. + ****************************************************************************/ +void +Redcloud_fp_reg(int mode, unsigned long address, unsigned long *data) +{ + if (mode == GX2_READ) { + *data = read_video_reg64_low(address); + } else { + write_video_reg64_low(address, *data); + } + +} /* End of Redcloud_fp_reg() */ + +/*------------------------------------------------------------------- + * + * SET_92XX_MODE_PARAMS + * This routine sets the 9211 mode parameters. + * + *-------------------------------------------------------------------*/ + +void +set_Redcloud_92xx_mode_params(int mode) +{ + CS92xx_MODE *pMode = &FPModeParams[mode]; + unsigned long temp_data = 0; + unsigned long base_data; + Q_WORD msrValue; + + /* on a Redcloud, we need to set up the DF pad select MSR */ + if (gfx_msr_read(RC_ID_DF, GX2_VP_MSR_PAD_SELECT, &msrValue) == FOUND) { + msrValue.low &= ~GX2_VP_PAD_SELECT_MASK; + if (pMode->panel_type == PNL_TFT || pMode->panel_type == PNL_TWOP) { + msrValue.low = GX2_VP_PAD_SELECT_TFT; + } else { + msrValue.low = GX2_VP_PAD_SELECT_DSTN; + } + gfx_msr_write(RC_ID_DF, GX2_VP_MSR_PAD_SELECT, &msrValue); + } + + /* Turn the 92xx power off before setting any new parameters. */ + temp_data = pMode->power_management & ~GX2_FP_PM_PWR_ON; + Redcloud_fp_reg(GX2_WRITE, GX2_FP_PWR_MAN, (unsigned long *)&temp_data); + + /* Set 9211 registers using the desired panel settings */ + + Redcloud_fp_reg(GX2_WRITE, GX2_FP_PAN_TIMING1, + (unsigned long *)&pMode->panel_timing1); + + /* On Redcloud, bit 31 is now reserved. */ + temp_data = pMode->panel_timing2 & 0x7FFFFFFF; + Redcloud_fp_reg(GX2_WRITE, GX2_FP_PAN_TIMING2, + (unsigned long *)&temp_data); + + /* On Redcloud TFT parts, set this to 0x70 so all 8 bits per color run + * thru fp crc but only non-TFT parts. Otherwise, set it to be 0x50. + * (source: Larry G.). + */ + if (pMode->panel_type == PNL_TFT || pMode->panel_type == PNL_TWOP) { + temp_data = GX2_FP_CRC_PASS_THRU_MASK; + } else { + temp_data = pMode->rev_C_dither_frc; + } + Redcloud_fp_reg(GX2_WRITE, GX2_FP_DITH_FR_CNTRL, + (unsigned long *)&temp_data); + Redcloud_fp_reg(GX2_WRITE, GX2_FP_BLFSR, + (unsigned long *)&pMode->blue_lsfr_seed); + Redcloud_fp_reg(GX2_WRITE, GX2_FP_RLFSR, + (unsigned long *)&pMode->red_green_lsfr_seed); + + /* Set the memory information, then the power register last. + * This will turn the panel on at the 9211. + */ + + Redcloud_fp_reg(GX2_READ, GX2_FP_FBB, (unsigned long *)&base_data); + if (base_data != 0x41780000) { + base_data = 0x41780000; + Redcloud_fp_reg(GX2_WRITE, GX2_FP_FBB, (unsigned long *)&base_data); + } + + Redcloud_fp_reg(GX2_WRITE, GX2_FP_PWR_MAN, + (unsigned long *)&pMode->power_management); + +} /*end set_92xx_mode_params() */ + +/* ----------------------------------------------------------------------- + * SET_FLAT_PANEL_MODE + * + * This routine sets the specified flat panel moden parameters in + * the 9211. + * Returns PASS if successful, FAIL if the mode parameters could + * not be set. + *------------------------------------------------------------------------*/ + +unsigned char +set_Redcloud_92xx_mode(Pnl_PanelStat * pstat) +{ + int mode; + + /* LOOP THROUGH THE AVAILABLE MODES TO FIND A MATCH */ + + for (mode = 0; mode < NUM_92XX_MODES; mode++) { + if ((FPModeParams[mode].xres == pstat->XRes) && + (FPModeParams[mode].yres == pstat->YRes) && + (FPModeParams[mode].bpp == pstat->Depth) && + (FPModeParams[mode].panel_type == pstat->Type) && + (FPModeParams[mode].color_type == pstat->MonoColor)) { + + /* SET THE 92xx FOR THE SELECTED MODE */ + set_Redcloud_92xx_mode_params(mode); + return TRUE; + } /* end if() */ + } /* end for() */ + return FALSE; + +} /* end set_Centaurus_92xx_mode() */ + +void +Redcloud_9211init(Pnl_PanelStat * pstat) +{ + + set_Redcloud_92xx_mode(pstat); + +} diff --git a/driver/xf86-video-geode/src/panel/gx2_9211.h b/driver/xf86-video-geode/src/panel/gx2_9211.h new file mode 100644 index 000000000..071b3fb17 --- /dev/null +++ b/driver/xf86-video-geode/src/panel/gx2_9211.h @@ -0,0 +1,115 @@ +/* Copyright (c) 2005 Advanced Micro Devices, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + * + * Neither the name of the Advanced Micro Devices, Inc. nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * */ + +/* + * File Contents: This file contains the panel library files to the + * GX2 platforms with 9211 support. + * + * SubModule: Geode FlatPanel library + * */ + +/* ----------------------------------------------------------- + * GX2 FLAT PANEL CONTROLLER REGISTER DEFINITIONS + *----------------------------------------------------------- + */ + +#define GX2_VP_MSR_PAD_SELECT 0x2011 +#define GX2_VP_PAD_SELECT_MASK 0x3FFFFFFF +#define GX2_VP_PAD_SELECT_TFT 0x1FFFFFFF +#define GX2_VP_PAD_SELECT_DSTN 0x00000000 + +/* This is useful for generating addresses incrementally + * (ie, vidtest register display code). + */ + +#define GX2_FP_LCD_OFFSET 0x00000400 +#define CS9211_REDCLOUD 0x0400 /* Moved 9211 Rev C3 up to next major + * no. */ +#define GX2_FP_PAN_TIMING1 0x0400 /* FP timings 1 */ +#define GX2_FP_PAN_TIMING2 0x0408 /* FP timings 2 */ +#define GX2_FP_PWR_MAN 0x0410 /* FP power management */ +#define GX2_FP_DITH_FR_CNTRL 0x0418 /* FP dither and frame rate */ +#define GX2_FP_BLFSR 0x0420 /* Blue LFSR seed */ +#define GX2_FP_RLFSR 0x0428 /* Red and Green LFSR seed */ +#define GX2_FP_FMI 0x0430 /* FRM Memory Index */ +#define GX2_FP_FMD 0x0438 /* FRM Memory Data */ +#define GX2_FP_DCA 0x0448 /* Dither ram control and address */ +#define GX2_FP_DMD 0x0450 /* Dither memory data */ +#define GX2_FP_PAN_CRC_SIG 0x0458 /* FP CRC signature */ +#define GX2_FP_FBB 0x0460 /* Frame Buffer Base Address */ + +/* GX2_FP_PAN_TIMING2 bits */ + +#define GX2_FP_TFT_PASS_THRU 0x40000000 /* TFT pass through enable */ +#define GX2_FP_PT2_PIX_OUT_MASK 0xFFF8FFFF /* panel output bit formats */ +#define GX2_FP_PT2_PIX_OUT_TFT 0x00000000 /* 8 BIT DSTN or TFT panel */ +#define GX2_FP_PT2_COLOR_MONO 0x00080000 /* color or monochrome */ +#define GX2_FP_PT2_DSTN_TFT_MASK 0xFFCFFFFF /* panel type bits */ +#define GX2_FP_PT2_DSTN_TFT_TFT 0x00100000 /* TFT panel */ +#define GX2_FP_PT2_PSH_CLK_CTL 0x08000000 /* shift clock retrace + * activity control */ + +/* GX2_FP_PWR_MAN bits */ + +#define GX2_FP_PM_SHFCLK_INVERT 0x00002000 /* Invert shfclk to panel */ +#define GX2_FP_PM_VSYNC_DELAY 0x0000C000 /* Vert Sync delay */ +#define GX2_FP_PM_HSYNC_DELAY 0x00030000 /* Horiz Sync delay */ +#define GX2_FP_PM_PWRDN_PHASE_BIT0 0x00040000 /* panel power down phase bit + * 0 */ +#define GX2_FP_PM_PWRDN_PHASE_BIT1 0x00080000 /* panel power down phase bit + * 1 */ +#define GX2_FP_PM_PWRDN_PHASE_BIT2 0x00100000 /* panel power down phase bit + * 2 */ +#define GX2_FP_PM_PWRUP_PHASE_BIT0 0x00200000 /* panel power up phase bit + * 0 */ +#define GX2_FP_PM_PWRUP_PHASE_BIT1 0x00400000 /* panel power up phase bit + * 1 */ +#define GX2_FP_PM_PWRUP_PHASE_BIT2 0x00800000 /* panel power up phase bit + * 2 */ +#define GX2_FP_PM_PWR_ON 0x01000000 /* panel power ON */ +#define GX2_FP_PM_DIS_OFF_CTL 0x02000000 /* disable the panel back + * light */ +#define GX2_FP_PM_EXT_PWR_SEQ 0x08000000 /* external power sequence */ + +/* GX2_FP_PAN_CRC_SIG bits */ + +#define GX2_FP_PAN_CRC_SIGE 0x00000001 /* CRC Sig Enable */ +#define GX2_FP_PAN_CRC_SFR 0x00000002 /* CRC Sig Free Run */ + +/* This define is used by the hardware CRC mechanism */ +#define GX2_FP_CRC_PASS_THRU_MASK 0x00000070 + +#define GX2_READ 0 +#define GX2_WRITE 1 + +void SetFPBaseAddr(unsigned long); +void Redcloud_9211init(Pnl_PanelStat *); +void protected_mode_access(unsigned long mode, + unsigned long width, unsigned long addr, char *pdata); +void write_video_reg64_low(unsigned long offset, unsigned long value); +unsigned long read_video_reg64_low(unsigned long offset); +void Redcloud_fp_reg(int mode, unsigned long address, unsigned long *data); +void set_Redcloud_92xx_mode_params(int mode); +unsigned char set_Redcloud_92xx_mode(Pnl_PanelStat * pstat); diff --git a/driver/xf86-video-geode/src/panel/panel.c b/driver/xf86-video-geode/src/panel/panel.c new file mode 100644 index 000000000..ffd54c911 --- /dev/null +++ b/driver/xf86-video-geode/src/panel/panel.c @@ -0,0 +1,71 @@ +/* Copyright (c) 2005 Advanced Micro Devices, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + * + * Neither the name of the Advanced Micro Devices, Inc. nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * */ + +/* + * File Contents: This file contains the file inclusions, macro definitions + * for the panel. + * + * SubModule: Geode FlatPanel library + * */ + +#if defined(linux) /* Linux */ + +#ifdef __KERNEL__ + +#include +#include + +#elif !defined(XFree86Server) +#error blah + +#include +#include + +#endif /* __KERNEL__ */ +#elif defined(_WIN32) /* windows */ + +#include + +#endif + +#include "panel.h" +#include "gfx_defs.h" + +extern unsigned char *gfx_virt_regptr; +extern unsigned char *gfx_virt_fbptr; +extern unsigned char *gfx_virt_vidptr; +extern unsigned char *gfx_virt_vipptr; +extern unsigned long gfx_detect_video(void); + +#define PLATFORM_DYNAMIC 1 /* runtime selection */ +#define PLATFORM_DRACO 1 /* Draco + 9210 */ +#define PLATFORM_CENTAURUS 1 /* Centaurus + 9211 RevA */ +#define PLATFORM_DORADO 1 /* Dorado + 9211 RevC */ +#define PLATFORM_REDCLOUD 1 /* GX2 */ + +unsigned char *XpressROMPtr; + +#include "pnl_init.c" +#include "pnl_bios.c" diff --git a/driver/xf86-video-geode/src/panel/panel.h b/driver/xf86-video-geode/src/panel/panel.h new file mode 100644 index 000000000..bc708dfb3 --- /dev/null +++ b/driver/xf86-video-geode/src/panel/panel.h @@ -0,0 +1,80 @@ +/* Copyright (c) 2005 Advanced Micro Devices, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + * + * Neither the name of the Advanced Micro Devices, Inc. nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * */ + +/* + * File Contents: This file contains the Geode frame buffer panel functions + * prototypes and it includes panel definitions header file. + * + * SubModule: Geode FlatPanel library + * */ + +/* COMPILER OPTION FOR C++ PROGRAMS */ + +#ifndef _panel_h +#define _panel_h + +#include "pnl_defs.h" + +#ifdef __cplusplus +extern "C" +{ +#endif + +/* CLOSE BRACKET FOR C++ COMPLILATION */ + + void Pnl_SetPlatform(int platform); + int Pnl_GetPlatform(void); + int Pnl_IsPanelPresent(void); + void Pnl_SetPanelPresent(int present); + void Pnl_SetPanelChip(int panelChip); + int Pnl_GetPanelChip(void); + void Pnl_SetPanelParam(Pnl_PanelParams * pParam); + void Pnl_GetPanelParam(Pnl_PanelParams * pParam); + int Pnl_InitPanel(Pnl_PanelParams * pParam); + int Detect_Platform(void); + void Pnl_SavePanelState(void); + void Pnl_RestorePanelState(void); + void Pnl_PowerUp(void); + void Pnl_PowerDown(void); + + int Pnl_IsPanelEnabledInBIOS(void); + void Pnl_GetPanelInfoFromBIOS(int *xres, int *yres, int *bpp, int *hz); +/* from durango */ + +#if defined(_WIN32) /* windows */ + extern void gfx_delay_milliseconds(unsigned long milliseconds); + extern unsigned long gfx_ind(unsigned short port); + extern void gfx_outd(unsigned short port, unsigned long data); + extern unsigned char gfx_inb(unsigned short port); + extern void gfx_outb(unsigned short port, unsigned char data); +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* !_panel_h */ + +/* END OF FILE */ diff --git a/driver/xf86-video-geode/src/panel/platform.c b/driver/xf86-video-geode/src/panel/platform.c new file mode 100644 index 000000000..46bb71b50 --- /dev/null +++ b/driver/xf86-video-geode/src/panel/platform.c @@ -0,0 +1,227 @@ +/* Copyright (c) 2005 Advanced Micro Devices, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + * + * Neither the name of the Advanced Micro Devices, Inc. nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * */ + +/* + * File Contents: This file contains platform dependent functions + * which provide interface to that platform. + * + * SubModule: Geode FlatPanel library + * */ + + +#define LINUX_ROM_SEGMENT 0x000F +#define SEGMENT_LENGTH 0xFFFF +#define PAGE_LENGTH 0x1000 +#define SYS_BOARD_NAME_LEN 24 + +#define PLT_UNKNOWN 0xFFFF + +typedef struct +{ + char sys_board_name[SYS_BOARD_NAME_LEN]; + SYS_BOARD sys_board; +} +SYS_BOARD_INFO; + +static SYS_BOARD_INFO Sys_info; + +/* + * The names in the sys_board_name string must exactly match the names in the + * BIOS header. These names are used by FindStringInSeg() to find the names + * in the BIOS header space. The BIOS does not use OTHER; it is a dummy value + * for program useonly. + */ + +SYS_BOARD_INFO Sys_board_info_array[] = { + {"Marmot", MARMOT_PLATFORM}, + {"Unicorn", UNICORN_PLATFORM}, + {"Centaurus", CENTAURUS_PLATFORM}, + {"Aries", ARIES_PLATFORM}, + {"Carmel", CARMEL_PLATFORM}, + {"Hyrda", HYDRA_PLATFORM}, + {"Dorado", DORADO_PLATFORM}, + {"Redcloud", REDCLOUD_PLATFORM}, + {"Other", OTHER_PLATFORM} +}; + +#define NUM_SYS_BOARD_TYPES \ + sizeof(Sys_board_info_array)/sizeof(SYS_BOARD_INFO) + +static int Num_sys_board_type = NUM_SYS_BOARD_TYPES; +SYS_BOARD_INFO *Sys_board_array_base = Sys_board_info_array; +int FindStringInSeg(unsigned int, char *); +static unsigned char get_sys_board_type(SYS_BOARD_INFO *, SYS_BOARD_INFO *); + +/* Detect the Platform */ +int +Detect_Platform(void) +{ + /* See if we can find the board name using Xpressrom */ + get_sys_board_type(&Sys_info, Sys_board_array_base); + return (Sys_info.sys_board); +} + +static int +Strncmp(char *str1, char *str2, int len) +{ + int i; + + if ((str1 == 0x0) || (str2 == 0x0) || (len == 0)) + return (1); + for (i = 0; i < len; i++) { + if (*(str1 + i) > *(str2 + i)) { + return 1; + } else if (*(str1 + i) < *(str2 + i)) { + return -1; + } + } + return 0; +} + +static char * +Strcpy(char *dst, char *src) +{ + int i; + + if ((dst == 0x0) || (src == 0x0)) + return (0); + for (i = 0; src[i] != 0x0; i++) { + dst[i] = src[i]; + } + dst[i] = 0x0; /* NULL termination */ + return dst; +} + +static int +Strlen(char *str) +{ + int i; + + if (str == 0x0) + return 0; + for (i = 0; str[i] != 0x0; i++) ; + return i; +} + +/* Platform Detection Code */ + +/************************************************************************ + * int FindStringInSeg( unsigned int segment_address, char *string_ptr ) + * + * Returns the offset where the NULL terminated string pointed to by + * string_ptr is located in the segment passed in segment_address. + * Segment_address must be of the form 0xXXXX (i.e 0xf000 for segment f). + * Returns NULL if the string is not found. + ************************************************************************ + */ +int +FindStringInSeg(unsigned int segment_address, char *string_ptr) +{ + int string_length = Strlen(string_ptr); + char *psegment_buf; + unsigned long mem_ptr = (unsigned long)segment_address << 16; + unsigned int i; + + /* silence compiler */ + (void)mem_ptr; + + psegment_buf = (char *)XpressROMPtr; + + /* Now search for the first character of the string_ptr */ + for (i = 0; i < SEGMENT_LENGTH + 1; i++) { + if (*(psegment_buf + i) == *string_ptr) { + + /* If we match the first character, do a + * string compare. + */ + + if (!Strncmp(string_ptr, (psegment_buf + i), string_length)) { + /* They match! */ + return (1); + } + } + } + /* if we got this far we didn't find anything. Return NULL. */ + return (0); + +} /* end FindStringInSeg() */ + +/********************************************************************** + + * TRUE_FALSE get_sys_board_type( SYS_BOARD_INFO *sys_info, + * SYS_BOARD_INFO *sys_board_array_base) + * + * Checks the system BIOS area for Xpressrom information. If found, searches + * the BIOS area for one of names in the array pointed to by + * sys_board_array_ptr. + * If a match is found, sets the SYS_INFO system_board_name string + * and the system_board variable to the board name and returns TRUE. + * If Xpressrom or a board is not found, sets the variables to + * their default values and returns FALSE. + * Uses the global string pointer *xpress_rom_string_ptr. + *********************************************************************** + */ +static unsigned char +get_sys_board_type(SYS_BOARD_INFO * sys_info, + SYS_BOARD_INFO * sys_board_array_base) +{ + int index; + char *xpress_rom_string_ptr = "XpressStart"; + unsigned int segment = LINUX_ROM_SEGMENT; + + /* See if XpressStart is present in the BIOS area. + * If it is, search for a board string. If not, Xpressrom is + * not present, set system_board information to UNKNOWN and + * return FALSE. + */ + + if (!FindStringInSeg(segment, xpress_rom_string_ptr)) { + sys_info->sys_board = PLT_UNKNOWN; + Strcpy(sys_info->sys_board_name, "Unknown"); + return (FALSE); + } else { + + /* we have Xpressrom, so look for a board */ + for (index = 0; index < Num_sys_board_type; index++) { + if (!FindStringInSeg(segment, (sys_board_array_base + + index)->sys_board_name)) { + continue; + } else { + + /* a match!! */ + sys_info->sys_board = + (sys_board_array_base + index)->sys_board; + Strcpy(sys_info->sys_board_name, + (sys_board_array_base + index)->sys_board_name); + return (TRUE); + } + } /* end for() */ + } /* end else */ + + /* if we are here we have failed */ + sys_info->sys_board = PLT_UNKNOWN; + Strcpy(sys_info->sys_board_name, "Unknown"); + return (FALSE); +} /* end get_sys_board_type() */ diff --git a/driver/xf86-video-geode/src/panel/pnl_bios.c b/driver/xf86-video-geode/src/panel/pnl_bios.c new file mode 100644 index 000000000..9e3c1fe5f --- /dev/null +++ b/driver/xf86-video-geode/src/panel/pnl_bios.c @@ -0,0 +1,282 @@ +/* Copyright (c) 2005 Advanced Micro Devices, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + * + * Neither the name of the Advanced Micro Devices, Inc. nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * */ + +/* + * File Contents: This file panel functions which query for the BIOS for + * current FP Paramters. + * + * SubModule: Geode FlatPanel library + * */ + +#include "panel.h" + +#if defined(_WIN32) /* windows */ +extern unsigned long gfx_cpu_version; +extern void gfx_outw(unsigned short port, unsigned short data); +extern unsigned short gfx_inw(unsigned short port); +#endif + +#define SOFTVGA_DISPLAY_ENABLE 0x50 +#define SOFTVGA_FPRESOLUTION 0x52 +#define SOFTVGA_FPCLOCKFREQUENCY 0x54 + +/* SOFTVG VIRTUAL REGISTER DEFINITIONS */ + +#define VR_INDEX 0xAC1C +#define VR_DATA 0xAC1E +#define VR_UNLOCK 0xFC53 +#define VRC_VG 0x0002 /* SoftVG Virtual Register Class */ +#define VG_MEM_SIZE 0x0000 /* MemSize Virtual Register */ +#define FP_DETECT_MASK 0x8000 + +#define VG_FP_TYPE 0x0002 /* Flat Panel Info Virtual Register */ + +#define FP_DEV_MASK 0x0003 /* Flat Panel type */ +#define FP_TYPE_SSTN 0x0000 /* SSTN panel type value */ +#define FP_TYPE_DSTN 0x0001 /* DSTN panel type value */ +#define FP_TYPE_TFT 0x0002 /* TFT panel type value */ +#define FP_TYPE_LVDS 0x0003 /* LVDS panel type value */ + +#define FP_RESOLUTION_MASK 0x0038 +#define FP_RES_6X4 0x0000 /* 640x480 resolution value */ +#define FP_RES_8X6 0x0008 /* 800x600 resolution value */ +#define FP_RES_10X7 0x0010 /* 1024x768 resolution value */ +#define FP_RES_11X8 0x0018 /* 1152x864 resolution value */ +#define FP_RES_12X10 0x0020 /* 1280x1024 resolution value */ +#define FP_RES_16X12 0x0028 /* 1600x1200 resolution value */ + +#define FP_WIDTH_MASK 0x01C0 +#define FP_WIDTH_8 0x0000 /* 8 bit data bus width */ +#define FP_WIDTH_9 0x0040 /* 9 bit data bus width */ +#define FP_WIDTH_12 0x0080 /* 12 bit data bus width */ +#define FP_WIDTH_18 0x00C0 /* 18 bit data bus width */ +#define FP_WIDTH_24 0x0100 /* 24 bit data bus width */ +#define FP_WIDTH_16 0x0140 /* 16 bit data bus width - 16 bit + * Mono DSTN only */ + +#define FP_COLOR_MASK 0x0200 +#define FP_COLOR_COLOR 0x0000 /* Color panel */ +#define FP_COLOR_MONO 0x0200 /* Mono Panel */ + +#define FP_PPC_MASK 0x0400 +#define FP_PPC_1PPC 0x0000 /* One pixel per clock */ +#define FP_PPC_2PPC 0x0400 /* Two pixels per clock */ + +#define FP_HPOL_MASK 0x0800 +#define FP_H_POL_LGH 0x0000 /* HSync at panel, normally low, + * active high */ +#define FP_H_POL_HGL 0x0800 /* HSync at panel, normally high, + * active low */ + +#define FP_VPOL_MASK 0x1000 +#define FP_V_POL_LGH 0x0000 /* VSync at panel, normally low, + * active high */ +#define FP_V_POL_HGL 0x1000 /* VSync at panel, normally high, + * active low */ + +#define FP_REF_MASK 0xE000 +#define FP_REF_60 0x0000 /* 60Hz refresh rate */ +#define FP_REF_70 0x2000 /* 70Hz refresh rate */ +#define FP_REF_72 0x4000 /* 72Hz refresh rate */ +#define FP_REF_75 0x6000 /* 75Hz refresh rate */ +#define FP_REF_85 0x8000 /* 85Hz refresh rate */ +#define FP_REF_90 0xA000 /* 90Hz refresh rate */ +#define FP_REF_100 0xC000 /* 100Hz refresh rate */ + +/*----------------------------------------------------------------- + * Pnl_IsPanelEnabledInBIOS + * + * Description: This function specifies whether the panel is enabled + * by the BIOS or not. + * parameters: none. + * return: 1 - Enabled, 0 - Disabled + *-----------------------------------------------------------------*/ +int +Pnl_IsPanelEnabledInBIOS(void) +{ + unsigned char ret = 0; + + if ((gfx_cpu_version & 0xFF) == GFX_CPU_REDCLOUD) { + unsigned short data; + + gfx_outw(VR_INDEX, VR_UNLOCK); + gfx_outw(VR_INDEX, (VRC_VG << 8) | VG_MEM_SIZE); + data = gfx_inw(VR_DATA); + if (data & FP_DETECT_MASK) + ret = 1; + } else { + unsigned short crtcindex, crtcdata; + + crtcindex = (gfx_inb(0x3CC) & 0x01) ? 0x3D4 : 0x3B4; + crtcdata = crtcindex + 1; + + /* CHECK DisplayEnable Reg in SoftVGA */ + + gfx_outb(crtcindex, (unsigned char)SOFTVGA_DISPLAY_ENABLE); + ret = gfx_inb(crtcdata); + } + + return (ret & 0x1); +} + +/*----------------------------------------------------------------- + * Pnl_GetPanelInfoFromBIOS + * + * Description: This function queries the panel information from + * the BIOS. + * parameters: + * xres: width of the panel configured + * yres: height of the panel configured + * bpp: depth of the panel configured + * hz: vertical frequency of the panel configured + * return: none + *-----------------------------------------------------------------*/ +void +Pnl_GetPanelInfoFromBIOS(int *xres, int *yres, int *bpp, int *hz) +{ + unsigned short crtcindex, crtcdata; + unsigned short ret; + + if ((gfx_cpu_version & 0xFF) == GFX_CPU_REDCLOUD) { + gfx_outw(VR_INDEX, VR_UNLOCK); + gfx_outw(VR_INDEX, (VRC_VG << 8) | VG_FP_TYPE); + ret = gfx_inw(VR_DATA); + switch (ret & FP_RESOLUTION_MASK) { + case FP_RES_6X4: + *xres = 640; + *yres = 480; + break; + case FP_RES_8X6: + *xres = 800; + *yres = 600; + break; + case FP_RES_10X7: + *xres = 1024; + *yres = 768; + break; + case FP_RES_11X8: + *xres = 1152; + *yres = 864; + break; + case FP_RES_12X10: + *xres = 1280; + *yres = 1024; + break; + case FP_RES_16X12: + *xres = 1600; + *yres = 1200; + break; + } + + switch (ret & FP_WIDTH_MASK) { + case FP_WIDTH_8: + *bpp = 8; + break; + case FP_WIDTH_9: + *bpp = 9; + break; + case FP_WIDTH_12: + *bpp = 12; + break; + case FP_WIDTH_18: + *bpp = 18; + break; + case FP_WIDTH_24: + *bpp = 24; + break; + case FP_WIDTH_16: + *bpp = 16; + break; + } + + switch (ret & FP_REF_MASK) { + case FP_REF_60: + *hz = 60; + break; + case FP_REF_70: + *hz = 70; + break; + case FP_REF_72: + *hz = 72; + break; + case FP_REF_75: + *hz = 75; + break; + case FP_REF_85: + *hz = 85; + break; + case FP_REF_90: + *hz = 90; + break; + case FP_REF_100: + *hz = 100; + break; + } + + } else { + crtcindex = (gfx_inb(0x3CC) & 0x01) ? 0x3D4 : 0x3B4; + crtcdata = crtcindex + 1; + + /* CHECK FPResolution Reg in SoftVGA */ + + gfx_outb(crtcindex, (unsigned char)SOFTVGA_FPRESOLUTION); + ret = gfx_inb(crtcdata); + + switch (ret & 0x3) { + case 0: + *xres = 640; + *yres = 480; + break; + case 1: + *xres = 800; + *yres = 600; + break; + case 2: + *xres = 1024; + *yres = 768; + break; + } + + switch ((ret >> 4) & 0x3) { + case 0: + *bpp = 12; + break; + case 1: + *bpp = 18; + break; + case 2: + *bpp = 16; + break; + case 3: + *bpp = 8; + break; + } + + /* CHECK FPClockFrequency Reg in SoftVGA */ + + gfx_outb(crtcindex, (unsigned char)SOFTVGA_FPCLOCKFREQUENCY); + *hz = gfx_inb(crtcdata); + } +} diff --git a/driver/xf86-video-geode/src/panel/pnl_defs.h b/driver/xf86-video-geode/src/panel/pnl_defs.h new file mode 100644 index 000000000..447a944b2 --- /dev/null +++ b/driver/xf86-video-geode/src/panel/pnl_defs.h @@ -0,0 +1,95 @@ +/* Copyright (c) 2005 Advanced Micro Devices, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + * + * Neither the name of the Advanced Micro Devices, Inc. nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * */ + +/* + * File Contents: This file contains definitions of the Geode frame buffer + * panel data structures. + * + * SubModule: Geode FlatPanel library + * */ + +#ifndef _pnl_defs_h +#define _pnl_defs_h + +typedef enum +{ + MARMOT_PLATFORM = 0, + UNICORN_PLATFORM, + CENTAURUS_PLATFORM, + ARIES_PLATFORM, + CARMEL_PLATFORM, + HYDRA_PLATFORM, + DORADO_PLATFORM, + DRACO_PLATFORM, + REDCLOUD_PLATFORM, + OTHER_PLATFORM +} +SYS_BOARD; + +#define PNL_9210 0x01 +#define PNL_9211_A 0x02 +#define PNL_9211_C 0x04 +#define PNL_UNKNOWN_CHIP 0x08 + +#define PNL_TFT 0x01 +#define PNL_SSTN 0x02 +#define PNL_DSTN 0x04 +#define PNL_TWOP 0x08 +#define PNL_UNKNOWN_PANEL 0x10 + +#define PNL_MONO_PANEL 0x01 +#define PNL_COLOR_PANEL 0x02 +#define PNL_UNKNOWN_COLOR 0x08 + +#define PNL_PANELPRESENT 0x01 +#define PNL_PLATFORM 0x02 +#define PNL_PANELCHIP 0x04 +#define PNL_PANELSTAT 0x08 +#define PNL_OVERRIDE_STAT 0x10 +#define PNL_OVERRIDE_ALL 0x1F + +typedef struct _Pnl_PanelStat_ +{ + int Type; + int XRes; + int YRes; + int Depth; + int MonoColor; +} +Pnl_PanelStat; + +typedef struct _Pnl_Params_ +{ + unsigned long Flags; + int PanelPresent; + int Platform; + int PanelChip; + Pnl_PanelStat PanelStat; +} +Pnl_PanelParams, *PPnl_PanelParams; + +#endif /* _pnl_defs_h */ + +/* END OF FILE */ diff --git a/driver/xf86-video-geode/src/panel/pnl_init.c b/driver/xf86-video-geode/src/panel/pnl_init.c new file mode 100644 index 000000000..39b932ebd --- /dev/null +++ b/driver/xf86-video-geode/src/panel/pnl_init.c @@ -0,0 +1,531 @@ +/* Copyright (c) 2005 Advanced Micro Devices, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + * + * Neither the name of the Advanced Micro Devices, Inc. nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * */ + +/* + * File Contents: This file contains the Geode frame buffer panel + * intialization functions. + * + * SubModule: Geode FlatPanel library + * */ + +#include "panel.h" +#include "gfx_regs.h" +#include "gfx_type.h" + +/* defaults + * Panel: Enabled + * Platform: Centaurus + * 92xx Chip: 9211 Rev. A + * PanelType: DSTN + * XResxYRes: 800x600 + * Depth: 16 + * Mono_Color: Color + */ +static Pnl_PanelParams sPanelParam = { + 0, 1, CENTAURUS_PLATFORM, PNL_9211_A, + {PNL_DSTN, 800, 600, 16, PNL_COLOR_PANEL} +}; + +#if PLATFORM_DRACO +#include "drac9210.c" +#endif + +#if PLATFORM_CENTAURUS +#include "cen9211.c" +#endif + +#if PLATFORM_DORADO +#include "dora9211.c" +#endif + +#if PLATFORM_GX2BASED +#include "gx2_9211.c" +#endif +#include "platform.c" + +/* + * return -1 - UnKnown + * 0 - Draco has 9210 + * 1 - Centaurus has 9211 Rev. A + * 2 - Dorado has 9211 Rev. C + */ + +/*----------------------------------------------------------------- + * Pnl_SetPlatform + * + * Description: This function sets the panel with hardware platform. + * + * parameters: + * platform: It specify the platform. + * + * return: none. + *-----------------------------------------------------------------*/ +void +Pnl_SetPlatform(int platform) +{ + /* To Be Implemented */ + sPanelParam.Platform = platform; + +} + +/*----------------------------------------------------------------- + * Pnl_GetPlatform + * + * Description: This function returns the panel platform. + * + * parameters: none. + * + * return: On success it returns the panel platform. + *-----------------------------------------------------------------*/ +int +Pnl_GetPlatform(void) +{ + sPanelParam.Platform = Detect_Platform(); + + return sPanelParam.Platform; + +} + +/*----------------------------------------------------------------- + * Pnl_IsPanelPresent + * + * Description: This function specifies whether the panel is prsent + * or not. + * + * parameters: none. + * + * return: On success it returns an integer panel present value. + *-----------------------------------------------------------------*/ +int +Pnl_IsPanelPresent(void) +{ + /* To Be Implemented */ + return sPanelParam.PanelPresent; +} + +/*----------------------------------------------------------------- + * Pnl_SetPanelPresent + * + * Description: This function sets the panel_present parameter. + * + * parameters: + * present: It specifies the panel present value. + * + * return: none. + *-----------------------------------------------------------------*/ +void +Pnl_SetPanelPresent(int present) +{ + /* To Be Implemented */ + sPanelParam.PanelPresent = present; +} + +/*----------------------------------------------------------------- + * Pnl_SetPanelParam + * + * Description: This function sets the panel parameters + * + * parameters: + * pParam: It specifies the elements of the panel parameter + * structure. + * + * return: none. + *-----------------------------------------------------------------*/ +void +Pnl_SetPanelParam(Pnl_PanelParams * pParam) +{ + if (pParam->Flags & PNL_PANELPRESENT) { + Pnl_SetPanelPresent(pParam->PanelPresent); + } + if (pParam->Flags & PNL_PLATFORM) { + Pnl_SetPlatform(pParam->Platform); + } + if (pParam->Flags & PNL_PANELCHIP) { + Pnl_SetPanelChip(pParam->PanelChip); + } + if (pParam->Flags & PNL_PANELSTAT) { + sPanelParam.PanelStat.XRes = pParam->PanelStat.XRes; + sPanelParam.PanelStat.YRes = pParam->PanelStat.YRes; + sPanelParam.PanelStat.Depth = pParam->PanelStat.Depth; + sPanelParam.PanelStat.MonoColor = pParam->PanelStat.MonoColor; + sPanelParam.PanelStat.Type = pParam->PanelStat.Type; + } +} + +/*----------------------------------------------------------------- + * Pnl_PowerUp + * + * Description: This function sets the power based on the + * hardware platforms dorado or centaraus. + * + * parameters: none. + * + * return: none. + *-----------------------------------------------------------------*/ +void +Pnl_PowerUp(void) +{ + int Platform; + unsigned long dcfg, hw_video; + + Platform = Pnl_GetPlatform(); + +#if PLATFORM_CENTAURUS + if (Platform == CENTAURUS_PLATFORM) { + Centaurus_Power_Up(); + return; + } +#endif + +#if PLATFORM_DORADO + if (Platform == DORADO_PLATFORM) { + Dorado_Power_Up(); + return; + } +#endif + +#if PLATFORM_GX2BASED + if (Platform == REDCLOUD_PLATFORM) { + } +#endif + + hw_video = gfx_detect_video(); + + if (hw_video == GFX_VID_CS5530) { + /* READ DISPLAY CONFIG FROM CX5530 */ + dcfg = READ_VID32(CS5530_DISPLAY_CONFIG); + + /* SET RELEVANT FIELDS */ + dcfg |= (CS5530_DCFG_FP_PWR_EN | CS5530_DCFG_FP_DATA_EN); + /* Enable the flatpanel power and data */ + WRITE_VID32(CS5530_DISPLAY_CONFIG, dcfg); + } else if (hw_video == GFX_VID_SC1200) { + /* READ DISPLAY CONFIG FROM SC1200 */ + dcfg = READ_VID32(SC1200_DISPLAY_CONFIG); + + /* SET RELEVANT FIELDS */ + dcfg |= (SC1200_DCFG_FP_PWR_EN | SC1200_DCFG_FP_DATA_EN); + /* Enable the flatpanel power and data */ + WRITE_VID32(SC1200_DISPLAY_CONFIG, dcfg); + } else if (hw_video == GFX_VID_REDCLOUD) { + /* READ DISPLAY CONFIG FROM REDCLOUD */ + dcfg = READ_VID32(RCDF_DISPLAY_CONFIG); + + /* SET RELEVANT FIELDS */ + dcfg |= (RCDF_DCFG_FP_PWR_EN | RCDF_DCFG_FP_DATA_EN); + /* Enable the flatpanel power and data */ + WRITE_VID32(RCDF_DISPLAY_CONFIG, dcfg); + } + +} + +/*----------------------------------------------------------------- + * Pnl_PowerDown + * + * Description: This function make power down based on the + * hardware platforms dorado or centaraus. + * + * parameters: none. + * + * return: none. + *-----------------------------------------------------------------*/ +void +Pnl_PowerDown(void) +{ + int Platform; + unsigned long dcfg, hw_video; + + Platform = Pnl_GetPlatform(); + +#if PLATFORM_CENTAURUS + if (Platform == CENTAURUS_PLATFORM) { + Centaurus_Power_Down(); + return; + } +#endif +#if PLATFORM_DORADO + if (Platform == DORADO_PLATFORM) { + Dorado_Power_Down(); + return; + } +#endif + +#if PLATFORM_GX2BASED + if (Platform == REDCLOUD_PLATFORM) { + } +#endif + + hw_video = gfx_detect_video(); + + if (hw_video == GFX_VID_CS5530) { + /* READ DISPLAY CONFIG FROM CX5530 */ + dcfg = READ_VID32(CS5530_DISPLAY_CONFIG); + + /* CLEAR RELEVANT FIELDS */ + dcfg &= ~(CS5530_DCFG_FP_PWR_EN | CS5530_DCFG_FP_DATA_EN); + /* Disable the flatpanel power and data */ + WRITE_VID32(CS5530_DISPLAY_CONFIG, dcfg); + } else if (hw_video == GFX_VID_SC1200) { + /* READ DISPLAY CONFIG FROM SC1200 */ + dcfg = READ_VID32(SC1200_DISPLAY_CONFIG); + + /* CLEAR RELEVANT FIELDS */ + dcfg &= ~(SC1200_DCFG_FP_PWR_EN | SC1200_DCFG_FP_DATA_EN); + /* Disable the flatpanel power and data */ + WRITE_VID32(SC1200_DISPLAY_CONFIG, dcfg); + } else if (hw_video == GFX_VID_REDCLOUD) { + /* READ DISPLAY CONFIG FROM REDCLOUD */ + dcfg = READ_VID32(RCDF_DISPLAY_CONFIG); + + /* CLEAR RELEVANT FIELDS */ + dcfg &= ~(RCDF_DCFG_FP_PWR_EN | RCDF_DCFG_FP_DATA_EN); + /* Disable the flatpanel power and data */ + WRITE_VID32(RCDF_DISPLAY_CONFIG, dcfg); + } +} + +/*----------------------------------------------------------------- + * Pnl_SavePanelState + * + * Description: This function saves the panel state based on the + * hardware platforms dorado or centaraus. + * + * parameters: none. + * + * return: none. + *-----------------------------------------------------------------*/ +void +Pnl_SavePanelState(void) +{ + int Platform; + + Platform = Pnl_GetPlatform(); + +#if PLATFORM_CENTAURUS + if (Platform == CENTAURUS_PLATFORM) { + Centaurus_Save_Panel_State(); + return; + } +#endif + +#if PLATFORM_DORADO + if (Platform == DORADO_PLATFORM) { + Dorado_Save_Panel_State(); + return; + } +#endif + +#if PLATFORM_GX2BASED + if (Platform == REDCLOUD_PLATFORM) { + } +#endif +} + +/*----------------------------------------------------------------- + * Pnl_RestorePanelState + * + * Description: This function restore the panel state based on the + * hardware platforms dorado or centaraus. + * + * parameters: none. + * + * return: none. + *-----------------------------------------------------------------*/ +void +Pnl_RestorePanelState(void) +{ + int Platform; + + Platform = Pnl_GetPlatform(); +#if PLATFORM_CENTAURUS + if (Platform == CENTAURUS_PLATFORM) { + Centaurus_Restore_Panel_State(); + return; + } +#endif + +#if PLATFORM_DORADO + if (Platform == DORADO_PLATFORM) { + Dorado_Restore_Panel_State(); + return; + } +#endif + +#if PLATFORM_GX2BASED + if (Platform == REDCLOUD_PLATFORM) { + } +#endif +} + +/*----------------------------------------------------------------- + * Pnl_GetPanelParam + * + * Description: This function gets the panel parameters from the + * hardware platforms dorado or centaraus. + * + * parameters: + * pParam: It specifies the elements of the panel parameter + * structure. + * + * return: none. + *-----------------------------------------------------------------*/ +void +Pnl_GetPanelParam(Pnl_PanelParams * pParam) +{ + if (pParam->Flags & PNL_PANELPRESENT) { + pParam->PanelPresent = Pnl_IsPanelPresent(); + } + if (pParam->Flags & PNL_PLATFORM) { + pParam->Platform = Pnl_GetPlatform(); + } + if ((pParam->Flags & PNL_PANELCHIP) || (pParam->Flags & PNL_PANELSTAT)) { +#if PLATFORM_CENTAURUS + if (pParam->Platform == CENTAURUS_PLATFORM) { + Centaurus_Get_9211_Details(pParam->Flags, pParam); + return; + } +#endif + +#if PLATFORM_DORADO + if (pParam->Platform == DORADO_PLATFORM) { + Dorado_Get_9211_Details(pParam->Flags, pParam); + return; + } +#endif + +#if PLATFORM_GX2BASED + if (pParam->Platform == REDCLOUD_PLATFORM) { + } +#endif + + /* if unknown platform put unknown */ + if (pParam->Flags & PNL_PANELCHIP) + pParam->PanelChip = PNL_UNKNOWN_CHIP; + + if (pParam->Flags & PNL_PANELSTAT) { + pParam->PanelStat.XRes = 0; + pParam->PanelStat.YRes = 0; + pParam->PanelStat.Depth = 0; + pParam->PanelStat.MonoColor = PNL_UNKNOWN_COLOR; + pParam->PanelStat.Type = PNL_UNKNOWN_PANEL; + } + } +} + +/*----------------------------------------------------------------- + * Pnl_SetPanelChip + * + * Description: This function sets the panelchip parameter of panel + * structure. + * + * parameters: + * panelChip: It specifies the panelChip value. + * + * return: none. + *-----------------------------------------------------------------*/ + +void +Pnl_SetPanelChip(int panelChip) +{ + /* To Be Implemented */ + sPanelParam.PanelChip = panelChip; + +} + +/*----------------------------------------------------------------- + * Pnl_GetPanelChip + * + * Description: This function gets the panelchip parameter of panel + * structure. + * + * parameters: none + * + * return: On success it returns the panelchip. + *-----------------------------------------------------------------*/ +int +Pnl_GetPanelChip(void) +{ + /* To Be Implemented */ + return sPanelParam.PanelChip; +} + +/*----------------------------------------------------------------- + * Pnl_InitPanel + * + * Description: This function initializes the panel with + * hardware platforms dorado or centaraus. + * + * parameters: + * pParam: It specifies the elements of the panel parameter + * structure. + * + * return: none. + *-----------------------------------------------------------------*/ +int +Pnl_InitPanel(Pnl_PanelParams * pParam) +{ + Pnl_PanelParams *pPtr; + + if (pParam == 0x0) /* NULL use the static table */ + pPtr = &sPanelParam; + else + pPtr = pParam; + + if (!pPtr->PanelPresent) { + return -1; /* error */ + } else { + if ((pPtr->PanelChip < 0) || (pPtr->Platform < 0)) + return -1; /* error */ + +#if PLATFORM_DRACO + /* check we are init. the right one */ + if ((pPtr->Platform == DRACO_PLATFORM) + && (pPtr->PanelChip == PNL_9210)) { + Draco9210Init(&(pPtr->PanelStat)); + } +#endif + +#if PLATFORM_CENTAURUS + /* check we are init. the right one */ + if (pPtr->Platform == CENTAURUS_PLATFORM) { + Centaurus_9211init(&(pPtr->PanelStat)); + } +#endif + +#if PLATFORM_DORADO + /* check we are init. the right one */ + if ((pPtr->Platform == DORADO_PLATFORM) && + (pPtr->PanelChip == PNL_9211_C)) { + Dorado9211Init(&(pPtr->PanelStat)); + } +#endif +#if PLATFORM_GX2BASED + if (pPtr->Platform == REDCLOUD_PLATFORM) { + Redcloud_9211init(&(pPtr->PanelStat)); + } +#endif + } /* else end */ + return 1; +} diff --git a/driver/xf86-video-geode/src/panel/readme.txt b/driver/xf86-video-geode/src/panel/readme.txt new file mode 100644 index 000000000..c8ca98619 --- /dev/null +++ b/driver/xf86-video-geode/src/panel/readme.txt @@ -0,0 +1,448 @@ +Panel Library +Release 1.3.6 +OS - Can be used in all OS's. +May 19, 2003 +Developer - Sarma Kolluru + +----------------------------------------------------------------------------- +PRODUCT INFORMATION +----------------------------------------------------------------------------- +Panel library is set of functions enabling the driver to give panel support. +The panel library is supported on Centaurus and Dorado. +The panel library can detect the panel support by the jumper settings +selected on the board. The platform can be detected too. + + \readme.txt This file + +----------------------------------------------------------------------------- +BUILD INSTRUCTIONS +----------------------------------------------------------------------------- +Panel library is a set of files which has support for flatpanel. The panel +subdirectory needs to be copied in the driver directory. +----------------------------------------------------------------------------- +INSTALLATION INSTRUCTIONS +----------------------------------------------------------------------------- +These is no instalation and to be treaded as a driver source code extension. +----------------------------------------------------------------------------- +UNIT TEST +Panel library when compiled is a part of the driver and cannot be unit tested. +----------------------------------------------------------------------------- + +----------------------------------------------------------------------------- +REVISION HISTORY +----------------------------------------------------------------------------- +Version changes v1.3.6 05/19/03 +----------------------------------------------------------------------------- +Dependencies: + - None +----------------------------------------------------------------------------- +FUNCTIONAL CHANGES +----------------------------------------------------------------------------- +- None. +----------------------------------------------------------------------------- +DEFECTS CORRECTED +----------------------------------------------------------------------------- +Removed the code which is not being used in linux env. The allocation of +segment buffer in stack was the cause of instability. +----------------------------------------------------------------------------- +FILE CHANGES + platform.c +----------------------------------------------------------------------------- +Version changes v1.3.5 02/28/03 +----------------------------------------------------------------------------- +Dependencies: + - crlf v1.0.1o +----------------------------------------------------------------------------- +FUNCTIONAL CHANGES +----------------------------------------------------------------------------- +Added National Copyright header which replaced the GPL and BSD.. +----------------------------------------------------------------------------- +DEFECTS CORRECTED +----------------------------------------------------------------------------- +- None. +----------------------------------------------------------------------------- +FILE CHANGES + 92xx.h + cen9211.c + cen9211.h + dora9211.c + dora9211.h + drac9210.c + drac9210.h + gx2_9211.c + gx2_9211.h + panel.h + panel.c + platform.c + pnl_bios.c + pnl_defs.h + pnl_init.c +----------------------------------------------------------------------------- +Version changes v1.3.4 12/30/02 +----------------------------------------------------------------------------- +Dependencies: + - crlf v1.0.1o +----------------------------------------------------------------------------- +FUNCTIONAL CHANGES +----------------------------------------------------------------------------- +- Added special GX2_READ and GX2_WRITE instead of READ/WRITE supplied by + system. +----------------------------------------------------------------------------- +DEFECTS CORRECTED +----------------------------------------------------------------------------- +- None. +----------------------------------------------------------------------------- +FILE CHANGES + gx2_9211.c + gx2_9211.h + panel.c + panel.h + platform.c + pnl_bios.c +----------------------------------------------------------------------------- +Version changes v1.3.3 12/17/02 +----------------------------------------------------------------------------- +Dependencies: + - crlf v1.0.1o +----------------------------------------------------------------------------- +FUNCTIONAL CHANGES +----------------------------------------------------------------------------- +- None +----------------------------------------------------------------------------- +DEFECTS CORRECTED +----------------------------------------------------------------------------- +- 125.10 Panel code no longer compiles under WinCE with latest change. +----------------------------------------------------------------------------- +FILE CHANGES + drac9210.c +----------------------------------------------------------------------------- +Version changes v1.3.2 12/10/02 +----------------------------------------------------------------------------- +Dependencies: + - crlf v1.0.1o +----------------------------------------------------------------------------- +FUNCTIONAL CHANGES +----------------------------------------------------------------------------- +- Did code indentation for XFree release. +----------------------------------------------------------------------------- +DEFECTS CORRECTED +----------------------------------------------------------------------------- +- None. +----------------------------------------------------------------------------- +FILE CHANGES + 92xx.h + cen9211.c + cen9211.h + dora9211.c + dora9211.h + drac9210.c + drac9210.h + gx2_9211.c + gx2_9211.h + panel.h + panel.c + platform.c + pnl_bios.c + pnl_defs.h + pnl_init.c +----------------------------------------------------------------------------- +Version changes v1.3.1 12/06/02 +----------------------------------------------------------------------------- +Dependencies: + - crlf v1.0.1o +----------------------------------------------------------------------------- +FUNCTIONAL CHANGES +----------------------------------------------------------------------------- +- Added function protoype. +----------------------------------------------------------------------------- +DEFECTS CORRECTED +----------------------------------------------------------------------------- +- None. +----------------------------------------------------------------------------- +FILE CHANGES + cen9211.h + dora9211.h + gx2_9211.h +----------------------------------------------------------------------------- +Version changes v1.3.0 11/29/02 +----------------------------------------------------------------------------- +Dependencies: + - crlf v1.0.1o +----------------------------------------------------------------------------- +FUNCTIONAL CHANGES +----------------------------------------------------------------------------- +- None. +----------------------------------------------------------------------------- +DEFECTS CORRECTED +----------------------------------------------------------------------------- +- cursor variable not defined for XFree when not as a module. +----------------------------------------------------------------------------- +FILE CHANGES + platform.c +----------------------------------------------------------------------------- +Version changes v1.2.9 7/31/02 +----------------------------------------------------------------------------- +Dependencies: + - crlf v1.0.1o +----------------------------------------------------------------------------- +FUNCTIONAL CHANGES +----------------------------------------------------------------------------- +Added FP setup from user input. +Added Redcloud Panel initialization. +----------------------------------------------------------------------------- +DEFECTS CORRECTED +----------------------------------------------------------------------------- +- None listed +----------------------------------------------------------------------------- +FILE CHANGES + pnl_init.c + panel.c + platform.c + gx2_9211.c + gx2_9211.h +----------------------------------------------------------------------------- +Version changes v1.2.8 5/16/02 +----------------------------------------------------------------------------- +Dependencies: + - crlf v1.0.1o +----------------------------------------------------------------------------- +FUNCTIONAL CHANGES +----------------------------------------------------------------------------- +Added FP detection with BIOS for GX2. +----------------------------------------------------------------------------- +DEFECTS CORRECTED +----------------------------------------------------------------------------- +- None listed +----------------------------------------------------------------------------- +FILE CHANGES + pnl_bios.c +----------------------------------------------------------------------------- +Version changes v1.2.7 1/20/02 +----------------------------------------------------------------------------- +Dependencies: + - crlf v1.0.1o +----------------------------------------------------------------------------- +FUNCTIONAL CHANGES +----------------------------------------------------------------------------- +Added the protoype for gfx_detect_video. +Durango dependency removed. +----------------------------------------------------------------------------- +DEFECTS CORRECTED +----------------------------------------------------------------------------- +- None listed +----------------------------------------------------------------------------- +FILE CHANGES + panel.c +----------------------------------------------------------------------------- +Version changes v1.2.6 12/1/01 +----------------------------------------------------------------------------- +Dependencies: + - crlf v1.0.1o + - Durango 2.35.01 + +----------------------------------------------------------------------------- +FUNCTIONAL CHANGES +----------------------------------------------------------------------------- +Toggle 5530/scx200/RC FlatPanel Power and Data accordingly during +power up/down. + +----------------------------------------------------------------------------- +DEFECTS CORRECTED +----------------------------------------------------------------------------- +- None listed +----------------------------------------------------------------------------- +FILE CHANGES + pnl_init.c +----------------------------------------------------------------------------- +Version changes v1.2.5 11/1/01 +----------------------------------------------------------------------------- +Dependencies: + - crlf v1.0.1o + - Durango 2.35.01 + +----------------------------------------------------------------------------- +FUNCTIONAL CHANGES +----------------------------------------------------------------------------- +Re-Enabled the Draco platform support. + +----------------------------------------------------------------------------- +DEFECTS CORRECTED +----------------------------------------------------------------------------- +- None listed +----------------------------------------------------------------------------- +FILE CHANGES + panel_defs.h + pnl_init.c +----------------------------------------------------------------------------- +Version changes v1.2.4 08/12/01 +----------------------------------------------------------------------------- +Dependencies: + - crlf v1.0.1 + - Durango 2.33.01 + +----------------------------------------------------------------------------- +FUNCTIONAL CHANGES +----------------------------------------------------------------------------- +Added 2 functions to get the FP setting details from BIOS. + +int Pnl_IsPanelEnabledInBIOS(void); +void Pnl_GetPanelInfoFromBIOS(int *xres, int *yres, int *bpp, int *hz); + +----------------------------------------------------------------------------- +DEFECTS CORRECTED +----------------------------------------------------------------------------- +- None listed +----------------------------------------------------------------------------- +FILE CHANGES + panel.h + pnl_bios.c +----------------------------------------------------------------------------- +Version changes v1.2.3 06/05/01 +----------------------------------------------------------------------------- +Dependencies: + - crlf v1.0.1 + - Durango 2.31.00 + +----------------------------------------------------------------------------- +FUNCTIONAL CHANGES +----------------------------------------------------------------------------- +Code cleanup and documentation. + +----------------------------------------------------------------------------- +DEFECTS CORRECTED +----------------------------------------------------------------------------- +- None listed +----------------------------------------------------------------------------- +FILE CHANGES + panel.h + cen9211.c + cen9211.h + dora9211.c + dora9211.h + panel.h + pnl_init.c +----------------------------------------------------------------------------- +Version changes v1.2.2 04/11/01 +----------------------------------------------------------------------------- +Dependencies: + - Durango 2.27.00 + +----------------------------------------------------------------------------- +FUNCTIONAL CHANGES +----------------------------------------------------------------------------- +Added Pnl_PowerUp and Pnl_PowerDown Functions. + +----------------------------------------------------------------------------- +DEFECTS CORRECTED +----------------------------------------------------------------------------- +- None listed +----------------------------------------------------------------------------- +FILE CHANGES + panel.h + cen9211.c + cen9211.h + dora9211.c + dora9211.h + panel.h + pnl_init.c +----------------------------------------------------------------------------- +Version changes v1.2.1 03/29/01 +----------------------------------------------------------------------------- +Dependencies: + - Durango 2.25 + +----------------------------------------------------------------------------- +FUNCTIONAL CHANGES +----------------------------------------------------------------------------- +Added Pnl_SavePanelState and Pnl_RestorePanelState Functions. + +----------------------------------------------------------------------------- +DEFECTS CORRECTED +----------------------------------------------------------------------------- +- None listed +----------------------------------------------------------------------------- +FILE CHANGES + panel.h + 92xx.h + cen9211.c + cen9211.h + dora9211.c + dora9211.h + platform.c + pnl_init.c +----------------------------------------------------------------------------- +Version changes v1.2.0 03/04/01 +----------------------------------------------------------------------------- +Dependencies: + - Durango 2.23 + +----------------------------------------------------------------------------- +FUNCTIONAL CHANGES +----------------------------------------------------------------------------- +Use inb/out routines from durango directly. +----------------------------------------------------------------------------- +DEFECTS CORRECTED +----------------------------------------------------------------------------- +- None listed +----------------------------------------------------------------------------- +FILE CHANGES + panel.h -inb/outb deleted. +============================================================================= +Version changes v1.0.1 02/02/01 +----------------------------------------------------------------------------- +Dependencies: + - Durango 2.19 + +----------------------------------------------------------------------------- +FUNCTIONAL CHANGES +----------------------------------------------------------------------------- +Added 9211 Rev. C on Centaurus platform. + +----------------------------------------------------------------------------- +DEFECTS CORRECTED +----------------------------------------------------------------------------- +- None listed +----------------------------------------------------------------------------- +FILE CHANGES + 92xx.h -9211 Rev.C. + cen9211.c - centaurus 9211_C support file. + cen9211.h - centaurus 9211_C support file. + platform.c - Support for detection of platform in which driver runs. +============================================================================= +Version changes v1.0.0 01/21/01 +----------------------------------------------------------------------------- +Dependencies: + - Durango 2.16 + +----------------------------------------------------------------------------- +FUNCTIONAL CHANGES +----------------------------------------------------------------------------- +Detection of platform +Detection of 92x chip with version and the panel sected by jumper settings. +initialization of the h/w. +----------------------------------------------------------------------------- +DEFECTS CORRECTED +----------------------------------------------------------------------------- +- None listed +----------------------------------------------------------------------------- +FILE CHANGES + 92xx.h -common file with all 9211/9210 definitions. + cen9211.c - centaurus 9211_A support file. + cen9211.h - centaurus 9211_A support file. + dora9211.c - dorado 9211_A support file. + dora9211.h - dorado 9211_C support file. + drac9210.c - draco 9210 support file. + drac9210.h - draco 9210 support file. + panel.c - This is the confiuration file to enable support for platforms. + panel.h - centaurus 9211_A support file. + platform.c - Support for detection of platform in which driver runs. + pnl_defs.h - common definitions for panel. + pnl_init.c - configurationto call appropriate platform calls. + readme.txt - this file. +----------------------------------------------------------------------------- +----------------------------------------------------------------------------- +KNOWN ERRATA +----------------------------------------------------------------------------- +- None listed +----------------------------------------------------------------------------- + diff --git a/driver/xf86-video-geode/src/z4l.c b/driver/xf86-video-geode/src/z4l.c new file mode 100644 index 000000000..e5a819e2c --- /dev/null +++ b/driver/xf86-video-geode/src/z4l.c @@ -0,0 +1,1763 @@ +/* + * Copyright (c) 2006 Advanced Micro Devices, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + * Neither the name of the Advanced Micro Devices, Inc. nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + */ + +/* prototype Xv interface for lxv4l2 driver */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "xf86.h" +#include +#include "xf86_OSproc.h" +#include "xf86Resources.h" +#include "compiler.h" +#include "xf86xv.h" +#include "fourcc.h" + +#include + +#define __s64 __s_64 +typedef long long __s64; + +#define __u64 __u_64 +typedef unsigned long long __u64; + +#include "linux/videodev.h" +#define __user +#include "linux/videodev2.h" + +typedef signed long long s64; +typedef unsigned long long u64; + +int debuglvl = 0; + +#define NONBLK_IO +#undef HAVE_SELECT + +#define DEBUG 1 +#ifdef DEBUG +#define DBLOG(n,s...) do { \ + if ( debuglvl >= (n) ) \ + xf86Msg(X_INFO, "z4l: " s); \ + } while(0) +#else +#define DBLOG(n,s...) do {} while(0) +#endif + +#define DEFAULT_COLORKEY 0x010203 +#define DEFAULT_KEYMODE 0 + +#define MAX_BUFFERS 4 +#define MAX_OVLY_WIDTH 2048 +#define MAX_OVLY_HEIGHT 2048 + +static char *z4l_dev_paths[] = { + "/dev/videox", NULL +}; + +#define ATTR_ENCODING "encoding" +#define ATTR_ENCODING_ID -1 +#define ATTR_KEYMODE "keymode" +#define ATTR_KEYMODE_ID -2 +#define ATTR_COLORKEY "colorkey" +#define ATTR_COLORKEY_ID -3 +#define ATTR_MAX_ID 3 + +#ifdef XvExtension + +static XF86VideoFormatRec Formats[] = { + {8, PseudoColor}, + {15, TrueColor}, + {16, TrueColor}, + {24, TrueColor} +}; + +#define NUM_FORMATS (sizeof(Formats)/sizeof(Formats[0])) + +#define FOURCC_Y800 0x30303859 +#define XVIMAGE_Y800 \ + { \ + FOURCC_Y800, \ + XvYUV, \ + LSBFirst, \ + {'Y','8','0','0', \ + 0x00,0x00,0x00,0x10,0x80,0x00,0x00,0xAA,0x00,0x38,0x9B,0x71}, \ + 8, \ + XvPacked, \ + 1, \ + 0, 0, 0, 0, \ + 8, 0, 0, \ + 1, 0, 0, \ + 1, 0, 0, \ + {'Y','8','0','0', \ + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, \ + XvTopToBottom \ + } + +static XF86ImageRec pixfmts[] = { + XVIMAGE_UYVY, XVIMAGE_YUY2, + XVIMAGE_I420, XVIMAGE_YV12, + XVIMAGE_Y800, +}; + +#define NUM_PIXFMTS (sizeof(pixfmts)/sizeof(pixfmts[0])) + +typedef struct s_std_data +{ + int inp; + v4l2_std_id std; + unsigned int fmt; +} t_std_data; + +typedef struct s_ovly_bfrs +{ + void *start; + unsigned long offset; + size_t length; +} t_ovly_bfrs; + +typedef struct +{ + int fd; + int run; + int dir; + int nbfrs; + int bufno; + int bufsz; + int last; + int width, height; + int keymode, colorkey; + int src_is_set, src_x, src_y, src_w, src_h; + int drw_is_set, drw_x, drw_y, drw_w, drw_h; + unsigned int pixfmt; + char dev_path[32]; + t_ovly_bfrs bfrs[MAX_BUFFERS]; + XF86VideoAdaptorPtr adpt; + XF86VideoEncodingPtr enc; + RegionRec clips; + int attrIds[1]; +} Z4lPortPrivRec; + +static int z4l_x_offset = 0; +static int z4l_y_offset = 0; +static int Z4l_nAdaptors = 0; +static XF86VideoAdaptorPtr *Z4l_pAdaptors = NULL; + +static int +IoCtl(int fd, unsigned int fn, void *arg, int flag) +{ + int ret; + + errno = 0; + ret = ioctl(fd, fn, arg); + if (ret != 0 && flag != 0) + DBLOG(0, "ioctl(%08x)=%d\n", fn, ret); + return ret; +} + +static void +z4l_ovly_unmap(Z4lPortPrivRec * pPriv) +{ +#ifdef LINUX_2_6 + int i, nbfrs; + + nbfrs = pPriv->nbfrs; + for (i = 0; i < nbfrs; ++i) { + if (pPriv->bfrs[i].start != NULL) { + munmap(pPriv->bfrs[i].start, pPriv->bfrs[i].length); + pPriv->bfrs[i].start = NULL; + } + } +#else + if (pPriv->bfrs[0].start != NULL) { + munmap((void *)pPriv->bfrs[0].start, pPriv->bufsz); + pPriv->bfrs[0].start = NULL; + } +#endif + pPriv->nbfrs = -1; + pPriv->bufsz = -1; + pPriv->last = -1; +} + +static void +z4l_ovly_map(Z4lPortPrivRec * pPriv, int dir) +{ + long offset, bsz; + int i, fd; + struct v4l2_buffer bfr; + struct v4l2_requestbuffers req; + int type = dir >= 0 ? + V4L2_BUF_TYPE_VIDEO_CAPTURE : V4L2_BUF_TYPE_VIDEO_OVERLAY; + if (pPriv->run > 0) { + DBLOG(1, "busy\n"); + return; + } + fd = pPriv->fd; + memset(&req, 0, sizeof(req)); + req.type = type; + req.memory = V4L2_MEMORY_MMAP; + req.count = MAX_BUFFERS; + if (ioctl(fd, VIDIOC_REQBUFS, &req) < 0) + goto xit; + pPriv->nbfrs = req.count; + if (pPriv->nbfrs <= 0) { + DBLOG(1, "no vidmem\n"); + return; + } + memset(&pPriv->bfrs, 0, sizeof(pPriv->bfrs)); + + for (i = 0; i < pPriv->nbfrs; ++i) { + memset(&bfr, 0, sizeof(bfr)); + bfr.type = type; + bfr.index = i; + if (ioctl(fd, VIDIOC_QUERYBUF, &bfr) < 0) + goto xit; + offset = bfr.m.offset; + pPriv->bfrs[i].offset = offset; + pPriv->bfrs[i].length = bfr.length; + bsz = offset + bfr.length; + if (pPriv->bufsz < bsz) + pPriv->bufsz = bsz; + } + +#ifdef LINUX_2_6 + for (i = 0; i < pPriv->nbfrs; ++i) { + pPriv->bfrs[i].start = mmap(NULL, bfr.length, PROT_READ | PROT_WRITE, + MAP_SHARED, fd, pPriv->bfrs[i].offset); + if (pPriv->bfrs[i].start == MAP_FAILED) + goto xit; + } +#else + pPriv->bfrs[0].offset = 0; + pPriv->bfrs[0].start = + mmap(NULL, pPriv->bufsz, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0); + + if (pPriv->bfrs[0].start == MAP_FAILED) { + pPriv->bfrs[0].start = NULL; + goto xit; + } + + offset = (unsigned long)pPriv->bfrs[0].start; + for (i = 1; i < pPriv->nbfrs; ++i) + pPriv->bfrs[i].start = (void *)(offset + pPriv->bfrs[i].offset); +#endif + + for (i = 0; i < pPriv->nbfrs; ++i) { + DBLOG(3, "bfr %d ofs %#lx adr %p sz %lu\n", i, pPriv->bfrs[i].offset, + pPriv->bfrs[i].start, (unsigned long)pPriv->bfrs[i].length); + memset(pPriv->bfrs[i].start, 0x80, pPriv->bfrs[i].length); + } + + pPriv->last = 0; + while (pPriv->last < pPriv->nbfrs - 1) { + bfr.index = pPriv->last++; + bfr.type = type; + if (ioctl(fd, VIDIOC_QBUF, &bfr) < 0) + goto xit; + } + return; + + xit: + z4l_ovly_unmap(pPriv); +} + +static int +z4l_ovly_dqbuf(Z4lPortPrivRec * pPriv) +{ + int stat; + struct v4l2_buffer bfr; + int fd = pPriv->fd; + +#ifdef HAVE_SELECT + struct timeval tmo; + fd_set dqset; + + FD_ZERO(&dqset); + FD_SET(pPriv->fd, &dqset); + tmo.tv_sec = 0; + tmo.tv_usec = 0; + if (select(fd + 1, &dqset, NULL, NULL, &tmo) <= 0) + return -1; +#endif + memset(&bfr, 0, sizeof(bfr)); + bfr.type = V4L2_BUF_TYPE_VIDEO_OVERLAY; + stat = ioctl(fd, VIDIOC_DQBUF, &bfr); + DBLOG(3, "dqbuf %d,%d,%d,%d\n", stat, bfr.index, pPriv->last, errno); + + return stat == 0 ? bfr.index : -1; +} + +static int +z4l_open_device(Z4lPortPrivRec * pPriv) +{ + int enable; + + if (pPriv->fd < 0) { + pPriv->fd = open(&pPriv->dev_path[0], O_RDWR, 0); + DBLOG(1, "open(%s)=%d\n", &pPriv->dev_path[0], pPriv->fd); + enable = 1; +#ifdef NONBLK_IO + if (IoCtl(pPriv->fd, FIONBIO, &enable, 1) != 0) { + DBLOG(1, "open cant enable nonblocking\n"); + close(pPriv->fd); + pPriv->fd = -1; + } +#endif + } + return pPriv->fd; +} + +static int +z4l_close_device(Z4lPortPrivRec * pPriv) +{ + int ret = 0; + + if (pPriv->fd >= 0) { + ret = close(pPriv->fd); + pPriv->fd = -1; + DBLOG(1, "close()=%d\n", ret); + } + if (pPriv->run > 0) { + z4l_ovly_unmap(pPriv); + pPriv->run = -1; + } + + return ret; +} + +static int +z4l_ovly_reset(Z4lPortPrivRec * pPriv) +{ + int ret = 0; + + if (pPriv->run > 0) { + z4l_close_device(pPriv); + ret = z4l_open_device(pPriv); + } + + return ret; +} + +static unsigned int +z4l_fourcc_pixfmt(int fourcc) +{ + unsigned int pixfmt = -1; + + switch (fourcc) { + case FOURCC_UYVY: + pixfmt = V4L2_PIX_FMT_UYVY; + break; + case FOURCC_YV12: + pixfmt = V4L2_PIX_FMT_YVU420; + break; + case FOURCC_Y800: + case FOURCC_I420: + pixfmt = V4L2_PIX_FMT_YUV420; + break; + case FOURCC_YUY2: + pixfmt = V4L2_PIX_FMT_YUYV; + break; + } + + return pixfmt; +} +static void +z4l_ovly_pixfmt(Z4lPortPrivRec * pPriv, unsigned int pixfmt) +{ + struct v4l2_framebuffer fbuf; + + DBLOG(1, "pixfmt %4.4s %4.4s\n", (char *)&pPriv->pixfmt, (char *)&pixfmt); + memset(&fbuf, 0, sizeof(fbuf)); + IoCtl(pPriv->fd, VIDIOC_G_FBUF, &fbuf, 1); + fbuf.fmt.pixelformat = pixfmt; + fbuf.base = NULL; + IoCtl(pPriv->fd, VIDIOC_S_FBUF, &fbuf, 1); + pPriv->pixfmt = pixfmt; +} + +static void +z4l_ovly_bfr(Z4lPortPrivRec * pPriv, int width, int height) +{ + struct v4l2_format fmt; + + DBLOG(1, "sfmt ovly %dx%d\n", width, height); + memset(&fmt, 0, sizeof(fmt)); + fmt.type = 0x102; + IoCtl(pPriv->fd, VIDIOC_G_FMT, &fmt, 1); + fmt.fmt.win.field = V4L2_FIELD_NONE; + fmt.fmt.win.w.width = pPriv->width = width; + fmt.fmt.win.w.height = pPriv->height = height; + IoCtl(pPriv->fd, VIDIOC_S_FMT, &fmt, 1); +} + +static void +z4l_ovly_rect(Z4lPortPrivRec * pPriv, + int src_x, int src_y, int src_w, int src_h, + int drw_x, int drw_y, int drw_w, int drw_h) +{ + int x, dx, w, y, dy, h; + struct v4l2_format fmt; + + pPriv->src_x = src_x; + pPriv->src_y = src_y; + pPriv->src_w = src_w; + pPriv->src_h = src_h; + pPriv->drw_x = drw_x; + pPriv->drw_y = drw_y; + pPriv->drw_w = drw_w; + pPriv->drw_h = drw_h; + + if ((drw_x -= z4l_x_offset) < 0) { + if ((w = pPriv->drw_w) <= 0) + w = 1; + x = -drw_x; + dx = x * pPriv->src_w / w; + src_x = pPriv->src_x + dx; + src_w = pPriv->src_w - dx; + drw_w = pPriv->drw_w - x; + drw_x = 0; + } + + if ((drw_y -= z4l_y_offset) < 0) { + if ((h = pPriv->drw_h) <= 0) + h = 1; + y = -drw_y; + dy = y * pPriv->src_h / h; + src_y = pPriv->src_y + dy; + src_h = pPriv->src_h - dy; + drw_h = pPriv->drw_h - y; + drw_y = 0; + } + + memset(&fmt, 0, sizeof(fmt)); + fmt.type = 0x100; + IoCtl(pPriv->fd, VIDIOC_G_FMT, &fmt, 1); + if (pPriv->src_is_set != 0) { + if (src_x != fmt.fmt.win.w.left || src_y != fmt.fmt.win.w.top || + src_w != fmt.fmt.win.w.width || src_h != fmt.fmt.win.w.height) + pPriv->src_is_set = 0; + } + if (pPriv->src_is_set == 0) { + pPriv->src_is_set = 1; + fmt.fmt.win.w.left = src_x; + fmt.fmt.win.w.top = src_y; + fmt.fmt.win.w.width = src_w; + fmt.fmt.win.w.height = src_h; + IoCtl(pPriv->fd, VIDIOC_S_FMT, &fmt, 1); + DBLOG(3, " set src %d,%d %dx%d\n", src_x, src_y, src_w, src_h); + } + memset(&fmt, 0, sizeof(fmt)); + fmt.type = 0x101; + IoCtl(pPriv->fd, VIDIOC_G_FMT, &fmt, 1); + if (pPriv->drw_is_set != 0) { + if (drw_x != fmt.fmt.win.w.left || drw_y != fmt.fmt.win.w.top || + drw_w != fmt.fmt.win.w.width || drw_h != fmt.fmt.win.w.height) + pPriv->drw_is_set = 0; + } + if (pPriv->drw_is_set == 0) { + pPriv->drw_is_set = 1; + fmt.fmt.win.w.left = drw_x; + fmt.fmt.win.w.top = drw_y; + fmt.fmt.win.w.width = drw_w; + fmt.fmt.win.w.height = drw_h; + IoCtl(pPriv->fd, VIDIOC_S_FMT, &fmt, 1); + DBLOG(3, " set drw %d,%d %dx%d\n", drw_x, drw_y, drw_w, drw_h); + } +} + +static void +z4l_ovly_pitch(unsigned int pixfmt, int w, int h, int *py_pitch, + int *puv_pitch, int *poffset1, int *poffset2, int *psize) +{ + int y_pitch, uv_pitch; + int offset1, offset2; + int size, is_420; + + switch (pixfmt) { + case V4L2_PIX_FMT_YVU420: + case V4L2_PIX_FMT_YUV420: + is_420 = 1; + y_pitch = ((w + 1) / 2) * 2; + uv_pitch = (w + 1) / 2; + break; + default: + is_420 = 0; + y_pitch = ((w + 1) / 2) * 4; + uv_pitch = 0; + break; + } + + offset1 = y_pitch * h; + offset2 = uv_pitch * h; + + if (is_420 != 0) + offset2 /= 2; + + size = offset1 + 2 * offset2; + *py_pitch = y_pitch; + *puv_pitch = uv_pitch; + *poffset1 = offset1; + *poffset2 = offset2; + *psize = size; +} + +static int +z4l_ovly_set_colorkey(Z4lPortPrivRec * pPriv, int key) +{ + struct v4l2_format fmt; + + memset(&fmt, 0, sizeof(fmt)); + fmt.type = V4L2_BUF_TYPE_VIDEO_OVERLAY; + if (IoCtl(pPriv->fd, VIDIOC_G_FMT, &fmt, 1) < 0) + return 0; + fmt.fmt.win.chromakey = key; + if (IoCtl(pPriv->fd, VIDIOC_S_FMT, &fmt, 1) < 0) + return 0; + pPriv->colorkey = key; + + return 1; +} + +static int +z4l_ovly_get_colorkey(Z4lPortPrivRec * pPriv, int *key) +{ + struct v4l2_format fmt; + + memset(&fmt, 0, sizeof(fmt)); + fmt.type = V4L2_BUF_TYPE_VIDEO_OVERLAY; + if (IoCtl(pPriv->fd, VIDIOC_G_FMT, &fmt, 1) < 0) + return 0; + *key = fmt.fmt.win.chromakey; + + return 1; +} + +static int +z4l_ovly_set_keymode(Z4lPortPrivRec * pPriv, int enable) +{ + struct v4l2_framebuffer fbuf; + + memset(&fbuf, 0, sizeof(fbuf)); + if (IoCtl(pPriv->fd, VIDIOC_G_FBUF, &fbuf, 1) < 0) + return 0; + + if (enable != 0) + fbuf.flags |= V4L2_FBUF_FLAG_CHROMAKEY; + else + fbuf.flags &= ~V4L2_FBUF_FLAG_CHROMAKEY; + + fbuf.base = NULL; + if (IoCtl(pPriv->fd, VIDIOC_S_FBUF, &fbuf, 1) < 0) + return 0; + pPriv->keymode = enable; + + return 1; +} + +static int +z4l_ovly_get_keymode(Z4lPortPrivRec * pPriv, int *enable) +{ + struct v4l2_framebuffer fbuf; + + memset(&fbuf, 0, sizeof(fbuf)); + if (IoCtl(pPriv->fd, VIDIOC_G_FBUF, &fbuf, 1) < 0) + return 0; + *enable = (fbuf.flags & V4L2_FBUF_FLAG_CHROMAKEY) != 0 ? 1 : 0; + + return 1; +} + +static int +z4l_ovly_set_encoding(Z4lPortPrivRec * pPriv, int id) +{ + int l, n, inp; + char *cp; + t_std_data *sp; + XF86VideoEncodingPtr enc; + XF86VideoAdaptorPtr adpt; + v4l2_std_id std; + struct v4l2_format fmt; + struct v4l2_framebuffer fbuf; + + adpt = pPriv->adpt; + DBLOG(1, "z4l_ovly_set_encoding(%d)\n", id); + if (id < 0 || id >= adpt->nEncodings) + return 0; + enc = &adpt->pEncodings[id]; + cp = &enc->name[0]; + n = sizeof(int) - 1; + l = strlen(cp) + 1; + l = (l + n) & ~n; + sp = (t_std_data *) (cp + l); + inp = sp->inp; + + DBLOG(1, " nm %s fmt %4.4s inp %d std %llx\n", + cp, (char *)&sp->fmt, sp->inp, sp->std); + + if (IoCtl(pPriv->fd, VIDIOC_S_INPUT, &inp, 1) < 0) + return 0; + + std = sp->std; + if (IoCtl(pPriv->fd, VIDIOC_S_STD, &std, 1) < 0) + return 0; + + memset(&fmt, 0, sizeof(fmt)); + fmt.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; + if (IoCtl(pPriv->fd, VIDIOC_G_FMT, &fmt, 1) < 0) + return 0; + + fmt.fmt.pix.pixelformat = sp->fmt; + if (IoCtl(pPriv->fd, VIDIOC_S_FMT, &fmt, 1) < 0) + return 0; + memset(&fbuf, 0, sizeof(fbuf)); + + if (IoCtl(pPriv->fd, VIDIOC_G_FBUF, &fbuf, 1) < 0) + return 0; + + fbuf.fmt.pixelformat = sp->fmt; + fbuf.base = NULL; + if (IoCtl(pPriv->fd, VIDIOC_S_FBUF, &fbuf, 1) < 0) + return 0; + pPriv->pixfmt = sp->fmt; + pPriv->enc = enc; + pPriv->src_is_set = pPriv->drw_is_set = 0; + + return 1; +} + +static int +z4l_ovly_get_encoding(Z4lPortPrivRec * pPriv, int *id) +{ + XF86VideoEncodingPtr enc = pPriv->enc; + + *id = enc->id; + return 1; +} + +static void +z4l_ovly_stop(Z4lPortPrivRec * pPriv) +{ + int type, enable, fd; + + if (pPriv->run < 0) + return; + + fd = pPriv->fd; + if (pPriv->dir > 0) { + type = V4L2_BUF_TYPE_VIDEO_CAPTURE; + ioctl(fd, VIDIOC_STREAMOFF, &type); + } + + if (pPriv->dir <= 0) { + enable = 0; + ioctl(fd, VIDIOC_OVERLAY, &enable); + } + + if (pPriv->dir != 0) + z4l_ovly_unmap(pPriv); + + pPriv->run = -1; + z4l_close_device(pPriv); +} + +static void +z4l_ovly_start(Z4lPortPrivRec * pPriv, int dir) +{ + int enable; + + if (pPriv->run >= 0) + return; + + if ((pPriv->dir = dir) != 0) + z4l_ovly_map(pPriv, dir); + + enable = 1; + + if (IoCtl(pPriv->fd, VIDIOC_OVERLAY, &enable, 1) != 0) { + z4l_ovly_stop(pPriv); + return; + } + + pPriv->run = 1; +} + +static int +z4l_region_equal(RegionPtr ap, RegionPtr bp) +{ + int nboxes; + BoxPtr abox, bbox; + + if (ap == NULL && bp == NULL) + return 1; + if (ap == NULL || bp == NULL) + return 0; + + if ((nboxes = REGION_NUM_RECTS(ap)) != REGION_NUM_RECTS(bp) || + ap->extents.x1 != bp->extents.x1 || + ap->extents.x2 != bp->extents.x2 + || ap->extents.y1 != bp->extents.y1 + || ap->extents.y2 != bp->extents.y2) + return 0; + + abox = REGION_RECTS(ap); + bbox = REGION_RECTS(bp); + + while (--nboxes >= 0) { + if (abox->x1 != bbox->x1 || abox->y1 != bbox->y1 || + abox->x2 != bbox->x2 || abox->y2 != bbox->y2) + return 0; + ++abox; + ++bbox; + } + + return 1; +} + +static void +z4l_setup_colorkey(Z4lPortPrivRec * pPriv, ScreenPtr pScrn, + RegionPtr clipBoxes) +{ + if (pPriv->run > 0 && pPriv->dir <= 0 && pPriv->keymode != 0 && + z4l_region_equal(&pPriv->clips, clipBoxes) == 0) { + xf86XVFillKeyHelper(pScrn, pPriv->colorkey, clipBoxes); + REGION_COPY(pScrn, &pPriv->clips, clipBoxes); + } +} + +static void +Z4lStopVideo(ScrnInfoPtr pScrni, pointer data, Bool exit) +{ + Z4lPortPrivRec *pPriv = (Z4lPortPrivRec *) data; + + DBLOG(1, "Z4lStopVideo()\n"); + + if (exit != 0) + z4l_ovly_stop(pPriv); + else + pPriv->src_is_set = pPriv->drw_is_set = 0; + + REGION_EMPTY(pScrni->pScreen, &pPriv->clips); +} + +static void +Z4lQueryBestSize(ScrnInfoPtr pScrni, Bool motion, + short vid_w, short vid_h, short drw_w, short drw_h, + unsigned int *p_w, unsigned int *p_h, pointer data) +{ + if (drw_w > MAX_OVLY_WIDTH) + drw_w = MAX_OVLY_WIDTH; + if (drw_h > MAX_OVLY_HEIGHT) + drw_h = MAX_OVLY_HEIGHT; + + *p_w = drw_w; + *p_h = drw_h; + DBLOG(1, "Z4lQueryBestSize(%d, src %dx%d dst %dx%d)\n", motion, vid_w, + vid_h, drw_w, drw_h); +} + +static int +Z4lPutImage(ScrnInfoPtr pScrni, 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, DrawablePtr pDraw) +{ + int fd, size; + int y_pitch, uv_pitch, offset1, offset2; + unsigned char *src, *dst; + unsigned int pixfmt; + struct v4l2_buffer bfr; + Z4lPortPrivRec *pPriv = (Z4lPortPrivRec *) data; + + if (pPriv->run > 0 && pPriv->dir >= 0) + return BadMatch; + if (pPriv->fd < 0) { + z4l_open_device(pPriv); + if (pPriv->fd < 0) + return BadValue; + } + + fd = pPriv->fd; + if (pPriv->run < 0) { + DBLOG(2, "PutImg id %#x src %d,%d %dx%d drw %d,%d %dx%d bfr %p " + "%dx%d data %p\n", id, src_x, src_y, src_w, src_h, drw_x, + drw_y, drw_w, drw_h, buf, width, height, data); + pPriv->pixfmt = pPriv->height = -1; + pPriv->src_is_set = pPriv->drw_is_set = 0; + } + + pixfmt = z4l_fourcc_pixfmt(id); + if (pixfmt != pPriv->pixfmt) { + z4l_ovly_reset(pPriv); + z4l_ovly_pixfmt(pPriv, pixfmt); + } + if (pPriv->width != width || pPriv->height != height) { + z4l_ovly_reset(pPriv); + z4l_ovly_bfr(pPriv, width, height); + } + + if (pPriv->src_is_set == 0 || pPriv->drw_is_set == 0 || + pPriv->src_x != src_x || pPriv->src_y != src_y || + pPriv->src_w != src_w || pPriv->src_h != src_h || + pPriv->drw_x != drw_x || pPriv->drw_y != drw_y || + pPriv->drw_w != drw_w || pPriv->drw_h != drw_h) + z4l_ovly_rect(pPriv, src_x, src_y, src_w, src_h, drw_x, drw_y, drw_w, + drw_h); + + if (pPriv->run < 0) { + z4l_ovly_start(pPriv, -1); + if (pPriv->run < 0) + return BadValue; + } + + if (pPriv->last < 0 && (pPriv->last = z4l_ovly_dqbuf(pPriv)) < 0) + return BadAlloc; + + z4l_ovly_pitch(pixfmt, width, height, &y_pitch, &uv_pitch, + &offset1, &offset2, &size); + src = buf; + dst = (unsigned char *)pPriv->bfrs[pPriv->last].start; + DBLOG(3, "cpy %4.4s src %p dst %p yp %d uvp %d o1 %d o2 %d sz %d\n", + (char *)&id, src, dst, y_pitch, uv_pitch, offset1, offset2, size); + + if (id == FOURCC_Y800) { + memcpy(dst, src, offset1); + src += offset1; + dst += offset1; + memset(dst, 0x80, 2 * offset2); + } else + memcpy(dst, src, size); + + memset(&bfr, 0, sizeof(bfr)); + bfr.type = V4L2_BUF_TYPE_VIDEO_OVERLAY; + bfr.index = pPriv->last; + bfr.timestamp.tv_sec = 0; + bfr.timestamp.tv_usec = 0; + bfr.flags |= V4L2_BUF_FLAG_TIMECODE; + if (IoCtl(fd, VIDIOC_QBUF, &bfr, 1) != 0) + return BadAccess; + + pPriv->last = z4l_ovly_dqbuf(pPriv); + z4l_setup_colorkey(pPriv, pScrni->pScreen, clipBoxes); + + return Success; +} + +static int +Z4lQueryImageAttributes(ScrnInfoPtr pScrni, int id, unsigned short *width, + unsigned short *height, int *pitches, int *offsets) +{ + int w, h, size; + int y_pitch, uv_pitch, offset1, offset2; + unsigned int pixfmt = z4l_fourcc_pixfmt(id); + + w = *width; + h = *height; + if (w > MAX_OVLY_WIDTH) + w = MAX_OVLY_WIDTH; + if (h > MAX_OVLY_HEIGHT) + h = MAX_OVLY_HEIGHT; + + z4l_ovly_pitch(pixfmt, w, h, &y_pitch, &uv_pitch, + &offset1, &offset2, &size); + + if (offsets != NULL) + offsets[0] = 0; + if (pitches != NULL) + pitches[0] = y_pitch; + + switch (pixfmt) { + case V4L2_PIX_FMT_YVU420: + case V4L2_PIX_FMT_YUV420: + if (offsets != NULL) { + offsets[1] = offset1; + offsets[2] = offset1 + offset2; + } + if (pitches != NULL) + pitches[1] = pitches[2] = uv_pitch; + h = (h + 1) & ~1; + break; + } + + w = (w + 1) & ~1; + *width = w; + *height = h; + DBLOG(1, "Z4lQueryImageAttributes(%4.4s) = %d, %dx%d %d/%d %d/%d\n", + (char *)&id, size, w, h, y_pitch, uv_pitch, offset1, offset2); + + return size; +} + +static int +Z4lPutVideo(ScrnInfoPtr pScrni, short src_x, short src_y, short drw_x, + short drw_y, short src_w, short src_h, short drw_w, short drw_h, + RegionPtr clipBoxes, pointer data, DrawablePtr pDraw) +{ + int id; + Z4lPortPrivRec *pPriv = (Z4lPortPrivRec *) data; + + DBLOG(2, "PutVid src %d,%d %dx%d drw %d,%d %dx%d data %p\n", + src_x, src_y, src_w, src_h, drw_x, drw_y, drw_w, drw_h, data); + + if (z4l_open_device(pPriv) >= 0) { + if (pPriv->run < 0) { + DBLOG(2, "PutVid start\n"); + z4l_ovly_get_encoding(pPriv, &id); + z4l_ovly_set_encoding(pPriv, id); + } + DBLOG(2, "PutVid priv %d,%d %dx%d drw %d,%d %dx%d\n", + pPriv->src_x, pPriv->src_y, pPriv->src_w, pPriv->src_h, + pPriv->drw_x, pPriv->drw_y, pPriv->drw_w, pPriv->drw_h); + if (pPriv->src_is_set == 0 || pPriv->drw_is_set == 0 || + pPriv->src_w != src_w || pPriv->src_h != src_h || + pPriv->drw_x != drw_x || pPriv->drw_y != drw_y || + pPriv->drw_w != drw_w || pPriv->drw_h != drw_h) + z4l_ovly_rect(pPriv, src_x, src_y, src_w, src_h, drw_x, drw_y, + drw_w, drw_h); + if (pPriv->run < 0) + z4l_ovly_start(pPriv, 0); + + z4l_setup_colorkey(pPriv, pScrni->pScreen, clipBoxes); + } + + return Success; +} + +static XF86VideoEncodingPtr +Z4lNewEncoding(XF86VideoEncodingPtr * encs, int *nencs) +{ + XF86VideoEncodingPtr enc; + XF86VideoEncodingPtr tencs = + (XF86VideoEncodingPtr) xrealloc(*encs, sizeof(*tencs) * (*nencs + 1)); + + if (tencs == NULL) + return NULL; + + *encs = tencs; + enc = &tencs[*nencs]; + ++*nencs; + memset(enc, 0, sizeof(*enc)); + + return enc; +} + +static void +Z4lEncodingName(char *ename, int l, char *inp_name, char *std_name, char *fmt) +{ + int i, ch; + + while ((ch = *inp_name++) != 0) { + if (isalnum(ch) == 0) + continue; + if (--l <= 0) + goto xit; + *ename++ = ch; + } + + if (--l <= 0) + goto xit; + + *ename++ = '-'; + + while ((ch = *std_name++) != 0) { + if (isalnum(ch) == 0) + continue; + if (--l <= 0) + goto xit; + *ename++ = ch; + } + + if (--l <= 0) + goto xit; + + *ename++ = '-'; + i = 4; + + while (--i >= 0 && (ch = *fmt++) != 0) { + if (isalnum(ch) == 0) + continue; + if (--l <= 0) + goto xit; + *ename++ = ch; + } + + xit: + *ename = 0; +} + +static int +Z4lAddEncoding(XF86VideoEncodingPtr enc, char *name, int id, int width, + int height, int numer, int denom, int inp, v4l2_std_id std, + unsigned int fmt) +{ + int l, n; + t_std_data *sp; + char *cp; + n = sizeof(int) - 1; + l = strlen(&name[0]) + 1; + l = (l + n) & ~n; + n = l + sizeof(*sp); + cp = (char *)xalloc(n); + + if (cp == NULL) + return 0; + + sp = (t_std_data *) (cp + l); + enc->id = id; + strcpy(cp, &name[0]); + enc->name = cp; + enc->width = width; + enc->height = height; + enc->rate.numerator = numer; + enc->rate.denominator = denom; + sp->inp = inp; + sp->std = std; + sp->fmt = fmt; + DBLOG(1, "enc %s\n", &name[0]); + + return 1; +} + +static XF86ImagePtr +Z4lNewImage(XF86ImagePtr * imgs, int *nimgs) +{ + XF86ImagePtr img; + XF86ImagePtr timgs = + (XF86ImagePtr) xrealloc(*imgs, sizeof(*timgs) * (*nimgs + 1)); + + if (timgs == NULL) + return NULL; + + *imgs = timgs; + img = &timgs[*nimgs]; + ++*nimgs; + memset(img, 0, sizeof(*img)); + + return img; +} + +static int +Z4lAddImage(XF86ImagePtr img, XF86ImagePtr ip) +{ + *img = *ip; + DBLOG(1, "img %4.4s\n", (char *)&img->id); + return 1; +} + +static XF86AttributePtr +Z4lNewAttribute(XF86AttributePtr * attrs, int *nattrs) +{ + XF86AttributePtr attr; + XF86AttributePtr tattrs = + (XF86AttributePtr) xrealloc(*attrs, sizeof(*tattrs) * (*nattrs + 1)); + + if (tattrs == NULL) + return NULL; + + *attrs = tattrs; + attr = &tattrs[*nattrs]; + ++*nattrs; + memset(attr, 0, sizeof(*attr)); + + return attr; +} + +static void +Z4lAttributeName(char *bp, int l, char *cp) +{ + int ch; + char *atomNm = bp; + + if (l > 0) { + *bp++ = 'X'; + --l; + } + if (l > 0) { + *bp++ = 'V'; + --l; + } + if (l > 0) { + *bp++ = '_'; + --l; + } + + while (l > 0 && (ch = *cp++) != 0) { + if (isalnum(ch) == 0) + continue; + *bp++ = toupper(ch); + } + + *bp = 0; + MakeAtom(&atomNm[0], strlen(&atomNm[0]), TRUE); +} + +static int +Z4lAddAttribute(XF86AttributePtr attr, char *name, + int min, int max, int flags) +{ + char *cp = (char *)xalloc(strlen((char *)&name[0]) + 1); + + if (cp == NULL) + return 0; + + attr->name = cp; + strcpy(&attr->name[0], name); + attr->min_value = min; + attr->max_value = max; + attr->flags = flags; + DBLOG(1, "attr %s\n", attr->name); + + return 1; +} + +static XF86VideoAdaptorPtr +Z4lNewAdaptor(XF86VideoAdaptorPtr ** adpts, int *nadpts, int nattrs) +{ + int n; + Z4lPortPrivRec *pPriv; + XF86VideoAdaptorPtr adpt, *tadpts; + + tadpts = (XF86VideoAdaptorPtr *) xrealloc(*adpts, + sizeof(*tadpts) * (*nadpts + 1)); + + if (tadpts == NULL) + return NULL; + + *adpts = tadpts; + n = sizeof(*adpt) + sizeof(*pPriv) + 1 * sizeof(*adpt->pPortPrivates); + n += (nattrs - 1) * sizeof(pPriv->attrIds[0]); + adpt = (XF86VideoAdaptorPtr) xalloc(n); + + if (adpt == NULL) + return NULL; + + memset(adpt, 0, n); + tadpts[*nadpts] = adpt; + ++*nadpts; + adpt->pPortPrivates = (DevUnion *) & adpt[1]; + pPriv = (Z4lPortPrivRec *) & adpt->pPortPrivates[1]; + adpt->pPortPrivates[0].ptr = (pointer) pPriv; + pPriv->adpt = adpt; + adpt->nPorts = 1; + + return adpt; +} + +static int +Z4lSetPortAttribute(ScrnInfoPtr pScrni, Atom attribute, INT32 value, + pointer data) +{ + Z4lPortPrivRec *pPriv = (Z4lPortPrivRec *) data; + XF86VideoAdaptorPtr adpt; + XF86AttributePtr attr; + struct v4l2_control ctrl; + int i, nattrs, attrId, val; + char *name = NameForAtom(attribute); + int old_fd = pPriv->fd; + + DBLOG(1, "Z4lSetPortAttribute(%#lx,%d) '%s'\n", (unsigned long)attribute, + (int)value, name != NULL ? name : "_null_"); + + if (name == NULL) + return BadImplementation; + if (old_fd < 0 && z4l_open_device(pPriv) < 0) + return BadAccess; + + adpt = pPriv->adpt; + attr = adpt->pAttributes; + nattrs = adpt->nAttributes; + + for (i = 0; i < nattrs; ++i, ++attr) + if (strcmp(attr->name, name) == 0) + break; + + if (i >= nattrs) + return BadMatch; + + attrId = pPriv->attrIds[i]; + val = value; + + switch (attrId) { + case ATTR_ENCODING_ID: + z4l_ovly_set_encoding(pPriv, val); + break; + case ATTR_KEYMODE_ID: + z4l_ovly_set_keymode(pPriv, val); + REGION_EMPTY(pScrni->pScreen, &pPriv->clips); + z4l_setup_colorkey(pPriv, pScrni->pScreen, &pPriv->clips); + break; + case ATTR_COLORKEY_ID: + z4l_ovly_set_colorkey(pPriv, val); + break; + default: + memset(&ctrl, 0, sizeof(ctrl)); + ctrl.id = attrId + V4L2_CID_BASE; + ctrl.value = val; + if (IoCtl(pPriv->fd, VIDIOC_S_CTRL, &ctrl, 1) != 0) + return BadMatch; + break; + } + + if (old_fd < 0) + z4l_close_device(pPriv); + + return Success; +} + +static int +Z4lGetPortAttribute(ScrnInfoPtr pScrni, Atom attribute, INT32 * value, + pointer data) +{ + Z4lPortPrivRec *pPriv = (Z4lPortPrivRec *) data; + XF86VideoAdaptorPtr adpt; + XF86AttributePtr attr; + struct v4l2_control ctrl; + int i, nattrs, attrId, val; + char *name = NameForAtom(attribute); + int old_fd = pPriv->fd; + + DBLOG(1, "Z4lGetPortAttribute(%#lx) '%s'\n", + (unsigned long)attribute, name != NULL ? name : "_null_"); + + if (name == NULL) + return BadImplementation; + if (old_fd < 0 && z4l_open_device(pPriv) < 0) + return BadAccess; + + adpt = pPriv->adpt; + attr = adpt->pAttributes; + nattrs = adpt->nAttributes; + + for (i = 0; i < nattrs; ++i, ++attr) + if (strcmp(attr->name, name) == 0) + break; + + if (i >= nattrs) + return BadMatch; + + attrId = pPriv->attrIds[i]; + val = 0; + + switch (attrId) { + case ATTR_ENCODING_ID: + z4l_ovly_get_encoding(pPriv, &val); + *value = val; + break; + case ATTR_KEYMODE_ID: + z4l_ovly_get_keymode(pPriv, &val); + *value = val; + break; + case ATTR_COLORKEY_ID: + z4l_ovly_get_colorkey(pPriv, &val); + break; + default: + memset(&ctrl, 0, sizeof(ctrl)); + ctrl.id = attrId + V4L2_CID_BASE; + if (IoCtl(pPriv->fd, VIDIOC_G_CTRL, &ctrl, 1) != 0) + return BadMatch; + val = ctrl.value; + break; + } + + if (old_fd < 0) + z4l_close_device(pPriv); + + *value = val; + + return Success; +} + +static void (*oldAdjustFrame) (int scrnIndex, int x, int y, int flags) = NULL; + +static void +Z4lAdjustFrame(int scrnIndex, int x, int y, int flags) +{ + int i; + XF86VideoAdaptorPtr adpt; + Z4lPortPrivRec *pPriv; + + DBLOG(3, "Z4lAdjustFrame(%d,%d,%d)\n", x, y, flags); + z4l_x_offset = x; + z4l_y_offset = y; + oldAdjustFrame(scrnIndex, x, y, flags); + + /* xv adjust does not handle putvideo case */ + for (i = 0; i < Z4l_nAdaptors; ++i) { + adpt = Z4l_pAdaptors[i]; + pPriv = (Z4lPortPrivRec *) adpt->pPortPrivates[0].ptr; + if (pPriv->run > 0) { + pPriv->drw_is_set = 0; + z4l_ovly_rect(pPriv, + pPriv->src_x, pPriv->src_y, pPriv->src_w, pPriv->src_h, + pPriv->drw_x, pPriv->drw_y, pPriv->drw_w, pPriv->drw_h); + } + } +} + +static int +Z4lInit(ScrnInfoPtr pScrni, XF86VideoAdaptorPtr ** adaptors) +{ + int i, id, fd, dev, enable, has_video, has_colorkey; + int ctl, cinp, inp, std, fmt, has_image; + int nadpts, nattrs, nencs, cenc, nimgs; + int numer, denom, width, height; + unsigned int pixfmt, cpixfmt, opixfmt; + XF86VideoAdaptorPtr *adpts, adpt; + XF86AttributePtr attrs, attr; + XF86VideoEncodingPtr encs, enc; + XF86ImagePtr ip, img, imgs; + Z4lPortPrivRec *pPriv; + char *dp, *msg; + char enc_name[256], attr_name[256]; + int attrIds[V4L2_CID_LASTP1 - V4L2_CID_BASE + ATTR_MAX_ID]; + struct v4l2_capability capability; + v4l2_std_id cstd_id, std_id; + struct v4l2_standard standard; + struct v4l2_format format, cfmt; + struct v4l2_input input; + struct v4l2_fmtdesc fmtdesc; + struct v4l2_queryctrl queryctrl; + struct v4l2_framebuffer fbuf; + + DBLOG(1, "Init\n"); + if (oldAdjustFrame == NULL) { + oldAdjustFrame = pScrni->AdjustFrame; + pScrni->AdjustFrame = Z4lAdjustFrame; + } + + fd = -1; + enc = NULL; + encs = NULL; + nencs = 0; + img = NULL; + imgs = NULL; + nimgs = 0; + attr = NULL; + attrs = NULL; + nattrs = 0; + adpt = NULL; + adpts = NULL; + nadpts = 0; + has_video = has_image = has_colorkey = 0; + + for (dev = 0; z4l_dev_paths[dev] != NULL; ++dev) { + fd = open(z4l_dev_paths[dev], O_RDWR, 0); + if (fd < 0) + continue; + DBLOG(1, "%s open ok\n", z4l_dev_paths[dev]); + msg = NULL; + enable = 1; + if (IoCtl(fd, VIDIOC_QUERYCAP, &capability, 1) < 0) + msg = "bad querycap"; + else if ((capability.capabilities & V4L2_CAP_VIDEO_OVERLAY) == 0) + msg = "no overlay"; + else if ((capability.capabilities & V4L2_CAP_STREAMING) == 0) + msg = "no streaming"; +#ifdef NONBLK_IO + else if (IoCtl(fd, FIONBIO, &enable, 1) != 0) + msg = "cant enable non-blocking io"; +#endif + if (msg == NULL) { + memset(&format, 0, sizeof(format)); + format.type = 0x100; + if (IoCtl(fd, VIDIOC_G_FMT, &format, 1) != 0) + msg = "no src/dst ovly fmt"; + } + if (msg != NULL) { + DBLOG(0, "%s %s\n", z4l_dev_paths[dev], msg); + close(fd); + continue; + } + + memset(&cfmt, 0, sizeof(cfmt)); + cfmt.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; + if (IoCtl(fd, VIDIOC_G_FMT, &cfmt, 1) < 0) + goto fail; + if (IoCtl(fd, VIDIOC_G_STD, &cstd_id, 1) < 0) + goto fail; + if (IoCtl(fd, VIDIOC_G_INPUT, &cinp, 1) < 0) + goto fail; + cpixfmt = cfmt.fmt.pix.pixelformat; + cenc = 0; + for (inp = 0;; ++inp) { + memset(&input, 0, sizeof(input)); + input.index = inp; + if (IoCtl(fd, VIDIOC_ENUMINPUT, &input, 0) < 0) + break; + id = inp; + if (IoCtl(fd, VIDIOC_S_INPUT, &id, 1) < 0) + goto fail; + for (std = 0;; ++std) { + memset(&standard, 0, sizeof(standard)); + standard.index = std; + if (IoCtl(fd, VIDIOC_ENUMSTD, &standard, 0) < 0) + break; + std_id = standard.id; + denom = standard.frameperiod.denominator; + numer = standard.frameperiod.numerator; + if (IoCtl(fd, VIDIOC_S_STD, &std_id, 1) < 0) + continue; + memset(&format, 0, sizeof(format)); + format.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; + if (IoCtl(fd, VIDIOC_G_FMT, &format, 1) < 0) + continue; + width = format.fmt.pix.width; + height = format.fmt.pix.height; + for (fmt = 0;; ++fmt) { + memset(&fmtdesc, 0, sizeof(fmtdesc)); + fmtdesc.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; + fmtdesc.index = fmt; + if (IoCtl(fd, VIDIOC_ENUM_FMT, &fmtdesc, 0) < 0) + break; + pixfmt = fmtdesc.pixelformat; + ip = &pixfmts[0]; + for (i = sizeof(pixfmts) / sizeof(pixfmts[0]); --i >= 0; + ++ip) + if (z4l_fourcc_pixfmt(ip->id) == pixfmt) + break; + + if (i >= 0) { + id = nencs; + has_video = 1; + if ((enc = Z4lNewEncoding(&encs, &nencs)) == NULL) + goto fail; + Z4lEncodingName(&enc_name[0], sizeof(enc_name), + (char *)&input.name[0], + (char *)&standard.name[0], (char *)&pixfmt); + if (Z4lAddEncoding(enc, &enc_name[0], id, width, + height, denom, numer, inp, std_id, + pixfmt) == 0) + goto fail; + if (std_id == cstd_id && inp == cinp + && pixfmt == cpixfmt) + cenc = id; + } + } + } + } + + if (IoCtl(fd, VIDIOC_S_INPUT, &cinp, 1) < 0) + goto fail; + if (IoCtl(fd, VIDIOC_S_STD, &cstd_id, 1) < 0) + goto fail; + if (IoCtl(fd, VIDIOC_S_FMT, &cfmt, 1) < 0) + goto fail; + + if (encs == NULL) { + DBLOG(0, "no encodings\n"); + goto fail; + } + + for (fmt = 0;; ++fmt) { + memset(&fmtdesc, 0, sizeof(fmtdesc)); + fmtdesc.type = V4L2_BUF_TYPE_VIDEO_OVERLAY; + fmtdesc.index = fmt; + if (IoCtl(fd, VIDIOC_ENUM_FMT, &fmtdesc, 0) < 0) + break; + pixfmt = fmtdesc.pixelformat; + ip = &pixfmts[0]; + for (i = sizeof(pixfmts) / sizeof(pixfmts[0]); --i >= 0; ++ip) + if (z4l_fourcc_pixfmt(ip->id) == pixfmt) + break; + + if (i >= 0) { + has_image = 1; + if ((img = Z4lNewImage(&imgs, &nimgs)) == NULL) + goto fail; + if (Z4lAddImage(img, ip) == 0) + goto fail; + } + } + + if (nimgs > 0) { + id = nencs; + if ((enc = Z4lNewEncoding(&encs, &nencs)) == NULL) + goto fail; + if (Z4lAddEncoding(enc, "XV_IMAGE", id, MAX_OVLY_WIDTH, + MAX_OVLY_HEIGHT, 0, 0, 0, 0, pixfmt) == 0) + goto fail; + } + + ctl = 0; + for (ctl = 0; ctl < (V4L2_CID_LASTP1 - V4L2_CID_BASE); ++ctl) { + memset(&queryctrl, 0, sizeof(queryctrl)); + queryctrl.id = V4L2_CID_BASE + ctl; + if (IoCtl(fd, VIDIOC_QUERYCTRL, &queryctrl, 0) < 0) + continue; + if (queryctrl.type != V4L2_CTRL_TYPE_INTEGER && + queryctrl.type != V4L2_CTRL_TYPE_BOOLEAN) + continue; + attrIds[nattrs] = ctl; + if ((attr = Z4lNewAttribute(&attrs, &nattrs)) == NULL) + goto fail; + Z4lAttributeName(&attr_name[0], sizeof(attr_name), + (char *)&queryctrl.name[0]); + if (Z4lAddAttribute(attr, &attr_name[0], + queryctrl.minimum, queryctrl.maximum, + XvSettable | XvGettable) == 0) + goto fail; + } + attrIds[nattrs] = ATTR_ENCODING_ID; + if ((attr = Z4lNewAttribute(&attrs, &nattrs)) == NULL) + goto fail; + Z4lAttributeName(&attr_name[0], sizeof(attr_name), ATTR_ENCODING); + if (Z4lAddAttribute(attr, &attr_name[0], 0, nencs - 1, + XvSettable | XvGettable) == 0) + goto fail; + memset(&fbuf, 0, sizeof(fbuf)); + if (IoCtl(fd, VIDIOC_G_FBUF, &fbuf, 1) < 0) + goto fail; + opixfmt = fbuf.fmt.pixelformat; + + if ((fbuf.capability & V4L2_FBUF_CAP_CHROMAKEY) != 0) { + attrIds[nattrs] = ATTR_KEYMODE_ID; + if ((attr = Z4lNewAttribute(&attrs, &nattrs)) == NULL) + goto fail; + Z4lAttributeName(&attr_name[0], sizeof(attr_name), ATTR_KEYMODE); + if (Z4lAddAttribute(attr, &attr_name[0], 0, 1, + XvSettable | XvGettable) == 0) + goto fail; + attrIds[nattrs] = ATTR_COLORKEY_ID; + if ((attr = Z4lNewAttribute(&attrs, &nattrs)) == NULL) + goto fail; + Z4lAttributeName(&attr_name[0], sizeof(attr_name), ATTR_COLORKEY); + if (Z4lAddAttribute(attr, &attr_name[0], 0, 0xffffff, + XvSettable | XvGettable) == 0) + goto fail; + has_colorkey = 1; + } + + dp = xalloc(strlen((char *)&capability.card[0]) + 1); + if (dp == NULL) + goto fail; + strcpy(dp, (char *)&capability.card[0]); + if ((adpt = Z4lNewAdaptor(&adpts, &nadpts, nattrs)) == NULL) + goto fail; + adpt->type = XvWindowMask | XvInputMask; + if (has_video != 0) + adpt->type |= XvVideoMask; + if (has_image != 0) + adpt->type |= XvImageMask; + adpt->flags = VIDEO_OVERLAID_IMAGES | VIDEO_CLIP_TO_VIEWPORT; + adpt->name = dp; + adpt->type = XvInputMask | XvWindowMask | XvVideoMask | XvImageMask; + adpt->pEncodings = encs; + adpt->nEncodings = nencs; + adpt->pFormats = &Formats[0]; + adpt->nFormats = sizeof(Formats) / sizeof(Formats[0]); + adpt->pAttributes = attrs; + adpt->nAttributes = nattrs; + attrs = NULL; + nattrs = 0; + adpt->pImages = imgs; + adpt->nImages = nimgs; + imgs = NULL; + nimgs = 0; + adpt->PutVideo = Z4lPutVideo; + adpt->StopVideo = Z4lStopVideo; + adpt->SetPortAttribute = Z4lSetPortAttribute; + adpt->GetPortAttribute = Z4lGetPortAttribute; + adpt->QueryBestSize = Z4lQueryBestSize; + adpt->PutImage = Z4lPutImage; + adpt->QueryImageAttributes = Z4lQueryImageAttributes; + pPriv = (Z4lPortPrivRec *) adpt->pPortPrivates[0].ptr; + pPriv->fd = fd; + pPriv->run = -1; + pPriv->dir = 0; + pPriv->nbfrs = -1; + pPriv->bufsz = -1; + pPriv->last = -1; + pPriv->pixfmt = opixfmt; +#if defined(REGION_NULL) + REGION_NULL(pScrni->pScreen, &pPriv->clips); +#else + REGION_INIT(pScrni->pScreen, &pPriv->clips, NullBox, 0); +#endif + strncpy(&pPriv->dev_path[0], z4l_dev_paths[dev], + sizeof(pPriv->dev_path)); + pPriv->enc = &encs[cenc]; + for (i = 0; i < adpt->nAttributes; ++i) + pPriv->attrIds[i] = attrIds[i]; + DBLOG(1, "adpt %s\n", dp); + if (has_colorkey != 0) { + z4l_ovly_set_colorkey(pPriv, DEFAULT_COLORKEY); + z4l_ovly_set_keymode(pPriv, DEFAULT_KEYMODE); + } + close(fd); + pPriv->fd = -1; + adpt = NULL; + cenc = 0; + encs = NULL; + nencs = 0; + } + + DBLOG(0, "init done, %d device(s) found\n", nadpts); + Z4l_nAdaptors = nadpts; + Z4l_pAdaptors = adpts; + *adaptors = adpts; + + return nadpts; + + fail: + if (attrs != NULL) { + for (i = 0; i < nattrs; ++i) + if (attrs[i].name != NULL) + free(attrs[i].name); + free(attrs); + } + + if (encs != NULL) { + for (i = 0; i < nencs; ++i) { + if (encs[i].name != NULL) + free(encs[i].name); + } + free(encs); + } + + if (imgs != NULL) + free(imgs); + + if (adpts != NULL) { + for (i = 0; i < nadpts; ++i) { + if ((adpt = adpts[i]) != NULL) { + if (adpt->name != NULL) + free(adpt->name); + if ((attrs = adpt->pAttributes) != NULL) { + for (i = 0; i < adpt->nAttributes; ++i) + if (attrs[i].name != NULL) + free(attrs[i].name); + free(attrs); + } + if ((encs = adpt->pEncodings) != NULL) { + for (i = 0; i < adpt->nEncodings; ++i, ++enc) + if (encs[i].name != NULL) + free(encs[i].name); + free(encs); + } + if ((imgs = adpt->pImages) != NULL) + free(imgs); + xfree(adpt); + } + } + free(adpts); + } + + if (fd >= 0) + close(fd); + + return 0; +} + +static Bool +Z4lProbe(DriverPtr drv, int flags) +{ + DBLOG(1, "Probe\n"); + if (flags & PROBE_DETECT) + return TRUE; + + xf86XVRegisterGenericAdaptorDriver(Z4lInit); + drv->refCount++; + + return TRUE; +} + +static const OptionInfoRec * +Z4lAvailableOptions(int chipid, int busid) +{ + return NULL; +} + +static void +Z4lIdentify(int flags) +{ + xf86Msg(X_INFO, "z4l driver for Video4Linux\n"); +} + +_X_EXPORT DriverRec Z4l = { + 40001, + "z4l", + Z4lIdentify, + Z4lProbe, + Z4lAvailableOptions, + NULL, + 0 +}; + +#ifdef XFree86LOADER + +static MODULESETUPPROTO(z4lSetup); + +static XF86ModuleVersionInfo z4lVersionRec = { + "ztv", + MODULEVENDORSTRING, MODINFOSTRING1, MODINFOSTRING2, + XF86_VERSION_CURRENT, 0, 0, 1, + ABI_CLASS_VIDEODRV, ABI_VIDEODRV_VERSION, MOD_CLASS_NONE, + {0, 0, 0, 0} +}; + +_X_EXPORT XF86ModuleData ztvModuleData = { &z4lVersionRec, z4lSetup, NULL }; + +static pointer +z4lSetup(pointer module, pointer opts, int *errmaj, int *errmin) +{ + const char *osname; + static Bool setupDone = FALSE; + + if (setupDone != FALSE) { + if (errmaj != NULL) + *errmaj = LDR_ONCEONLY; + return NULL; + } + + setupDone = TRUE; + LoaderGetOS(&osname, NULL, NULL, NULL); + + if (osname == NULL || strcmp(osname, "linux") != 0) { + if (errmaj) + *errmaj = LDR_BADOS; + if (errmin) + *errmin = 0; + + return NULL; + } + + xf86AddDriver(&Z4l, module, 0); + + return (pointer) 1; +} + +#endif +#endif /* !XvExtension */