diff options
author | Kaleb Keithley <kaleb@freedesktop.org> | 2003-11-25 19:29:01 +0000 |
---|---|---|
committer | Kaleb Keithley <kaleb@freedesktop.org> | 2003-11-25 19:29:01 +0000 |
commit | adc7f9a4ebdfe11d4cd6de9388b63dfe36450b39 (patch) | |
tree | 23eb7becc5360b2cbe16aa8d45529880067f3989 /hw/xfree86/common | |
parent | 90f1536dd315cd265bfc7ef35058761a65a01734 (diff) |
XFree86 4.3.99.16 Bring the tree up to date for the Cygwin folksxf86-4_3_99_16
Diffstat (limited to 'hw/xfree86/common')
60 files changed, 3762 insertions, 1323 deletions
diff --git a/hw/xfree86/common/atKeynames.h b/hw/xfree86/common/atKeynames.h index 23760db5e..17bb21f4d 100644 --- a/hw/xfree86/common/atKeynames.h +++ b/hw/xfree86/common/atKeynames.h @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/atKeynames.h,v 3.18 2001/09/29 20:40:30 herrb Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/atKeynames.h,v 3.21 2003/10/09 11:43:59 pascal Exp $ */ /* * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany. * @@ -21,6 +21,33 @@ * PERFORMANCE OF THIS SOFTWARE. * */ +/* + * Copyright (c) 1994-2003 by The XFree86 Project, 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 COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + * + * Except as contained in this notice, the name of the copyright holder(s) + * and author(s) shall not be used in advertising or otherwise to promote + * the sale, use or other dealings in this Software without prior written + * authorization from the copyright holder(s) and author(s). + */ + /* $XConsortium: atKeynames.h /main/11 1996/03/09 11:17:41 kaleb $ */ #ifndef _ATKEYNAMES_H @@ -199,6 +226,71 @@ #define KEY_NFER /* No Kanji Transfer 0x7b */ 123 #define KEY_Yen /* Yen 0x7d */ 125 +#define KEY_Power /* Power Key 0x84 */ 132 +#define KEY_Mute /* Audio Mute 0x85 */ 133 +#define KEY_AudioLower /* Audio Lower 0x86 */ 134 +#define KEY_AudioRaise /* Audio Raise 0x87 */ 135 +#define KEY_Help /* Help 0x88 */ 136 +#define KEY_L1 /* Stop 0x89 */ 137 +#define KEY_L2 /* Again 0x8a */ 138 +#define KEY_L3 /* Props 0x8b */ 139 +#define KEY_L4 /* Undo 0x8c */ 140 +#define KEY_L5 /* Front 0x8d */ 141 +#define KEY_L6 /* Copy 0x8e */ 142 +#define KEY_L7 /* Open 0x8f */ 143 +#define KEY_L8 /* Paste 0x90 */ 144 +#define KEY_L9 /* Find 0x91 */ 145 +#define KEY_L10 /* Cut 0x92 */ 146 + +/* + * Fake 'scancodes' in the following ranges are generated for 2-byte + * codes not handled elsewhere. These correspond to most extended keys + * on so-called "Internet" keyboards: + * + * 0x79-0x93 + * 0x96-0xa1 + * 0xa3-0xac + * 0xb1-0xb4 + * 0xba-0xbd + * 0xc2 + * 0xcc-0xd2 + * 0xd6-0xf7 + */ + +/* + * Remapped 'scancodes' are generated for single-byte codes in the range + * 0x59-0x5f,0x62-0x76. These are used for some extra keys on some keyboards. + */ + +#define KEY_0x59 0x95 +#define KEY_0x5A 0xA2 +#define KEY_0x5B 0xAD +#define KEY_0x5C KEY_KP_EQUAL +#define KEY_0x5D 0xAE +#define KEY_0x5E 0xAF +#define KEY_0x5F 0xB0 +#define KEY_0x62 0xB5 +#define KEY_0x63 0xB6 +#define KEY_0x64 0xB7 +#define KEY_0x65 0xB8 +#define KEY_0x66 0xB9 +#define KEY_0x67 0xBE +#define KEY_0x68 0xBF +#define KEY_0x69 0xC0 +#define KEY_0x6A 0xC1 +#define KEY_0x6B 0xC3 +#define KEY_0x6C 0xC4 +#define KEY_0x6D 0xC5 +#define KEY_0x6E 0xC6 +#define KEY_0x6F 0xC7 +#define KEY_0x70 0xC8 +#define KEY_0x71 0xC9 +#define KEY_0x72 0xCA +#define KEY_0x73 0xCB +#define KEY_0x74 0xD3 +#define KEY_0x75 0xD4 +#define KEY_0x76 0xD5 + /* These are for "notused" and "unknown" entries in translation maps. */ #define KEY_NOTUSED 0 #define KEY_UNKNOWN 255 diff --git a/hw/xfree86/common/compiler.h b/hw/xfree86/common/compiler.h index 4dda2f6c6..bf9fbeee2 100644 --- a/hw/xfree86/common/compiler.h +++ b/hw/xfree86/common/compiler.h @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/compiler.h,v 3.99 2003/01/29 15:23:20 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/compiler.h,v 3.104 2003/11/03 05:11:01 tsi Exp $ */ /* * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany. * @@ -21,6 +21,33 @@ * PERFORMANCE OF THIS SOFTWARE. * */ +/* + * Copyright (c) 1994-2003 by The XFree86 Project, 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 COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + * + * Except as contained in this notice, the name of the copyright holder(s) + * and author(s) shall not be used in advertising or otherwise to promote + * the sale, use or other dealings in this Software without prior written + * authorization from the copyright holder(s) and author(s). + */ + /* $XConsortium: compiler.h /main/16 1996/10/25 15:38:34 kaleb $ */ #ifndef _COMPILER_H @@ -423,23 +450,37 @@ __ustw (unsigned long r5, unsigned short * r11) # define stq_u(v,p) __ustq(v,p) # define stl_u(v,p) __ustl(v,p) # define stw_u(v,p) __ustw(v,p) - -# define mem_barrier() __asm__ __volatile__ ("mf" ::: "memory") -# define write_mem_barrier() __asm__ __volatile__ ("mf" ::: "memory") + +# ifndef __INTEL_COMPILER +# define mem_barrier() __asm__ __volatile__ ("mf" ::: "memory") +# define write_mem_barrier() __asm__ __volatile__ ("mf" ::: "memory") +# else +# include "ia64intrin.h" +# define mem_barrier() __mf() +# define write_mem_barrier() __mf() +# endif /* * This is overkill, but for different reasons depending on where it is used. * This is thus general enough to be used everywhere cache flushes are needed. * It doesn't handle memory access serialisation by other processors, though. */ -# define ia64_flush_cache(Addr) \ +# ifndef __INTEL_COMPILER +# define ia64_flush_cache(Addr) \ __asm__ __volatile__ ( \ "fc %0;;;" \ "sync.i;;;" \ "mf;;;" \ "srlz.i;;;" \ :: "r"(Addr) : "memory") - +# else +# define ia64_flush_cache(Addr) { \ + __fc(Addr);\ + __synci();\ + __mf();\ + __isrlz();\ + } +# endif # undef outb # undef outw # undef outl @@ -448,7 +489,7 @@ __ustw (unsigned long r5, unsigned short * r11) # define outw(a,b) _outw(b,a) # define outl(a,b) _outl(b,a) -# elif defined(linux) && defined(__x86_64__) +# elif defined(linux) && defined(__AMD64__) # include <inttypes.h> @@ -514,7 +555,7 @@ inl(unsigned short port) return ret; } -# elif (defined(linux) || defined(Lynx) || defined(sun) || defined(__OpenBSD__)) && defined(__sparc__) +# elif (defined(linux) || defined(Lynx) || defined(sun) || defined(__OpenBSD__) || defined(__FreeBSD__)) && defined(__sparc__) # if !defined(Lynx) # ifndef ASI_PL @@ -1515,11 +1556,13 @@ extern void outl(unsigned int a, unsigned int l); # include <sys/types.h> # endif /* IN_MODULE */ # endif /* USL */ +# ifndef sgi # include <sys/inline.h> +# endif # else # include "scoasm.h" # endif -# if !defined(__HIGHC__) && !defined(SCO325) +# if !defined(__HIGHC__) && !defined(SCO325) && !defined(sgi) # pragma asm partial_optimization outl # pragma asm partial_optimization outw # pragma asm partial_optimization outb diff --git a/hw/xfree86/common/fourcc.h b/hw/xfree86/common/fourcc.h index 61f403679..e60aa4e83 100644 --- a/hw/xfree86/common/fourcc.h +++ b/hw/xfree86/common/fourcc.h @@ -1,4 +1,31 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/fourcc.h,v 1.3 2001/12/03 22:13:24 mvojkovi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/fourcc.h,v 1.5 2003/08/24 17:36:48 dawes Exp $ */ + +/* + * Copyright (c) 2000-2003 by The XFree86 Project, 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 COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + * + * Except as contained in this notice, the name of the copyright holder(s) + * and author(s) shall not be used in advertising or otherwise to promote + * the sale, use or other dealings in this Software without prior written + * authorization from the copyright holder(s) and author(s). + */ /* This header file contains listings of STANDARD guids for video formats. @@ -7,6 +34,9 @@ For an explanation of fourcc <-> guid mappings see RFC2361. */ +#ifndef _XF86_FOURCC_H_ +#define _XF86_FOURCC_H_ 1 + #define FOURCC_YUY2 0x32595559 #define XVIMAGE_YUY2 \ { \ @@ -128,3 +158,4 @@ XvTopToBottom \ } +#endif /* _XF86_FOURCC_H_ */ diff --git a/hw/xfree86/common/modeline2c.pl b/hw/xfree86/common/modeline2c.pl index fb76789d6..e31fe28e1 100644 --- a/hw/xfree86/common/modeline2c.pl +++ b/hw/xfree86/common/modeline2c.pl @@ -8,9 +8,33 @@ # perl /modeline2c.pl < [modesfile] > xf86DefModes.c # # hackish perl - author Dirk Hohndel -# Copyright 1999-2001 by The XFree86 Project, Inc. # -# $XFree86: xc/programs/Xserver/hw/xfree86/common/modeline2c.pl,v 1.8 2001/10/28 03:33:17 tsi Exp $ +# Copyright 1999-2003 by The XFree86 Project, 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 COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR +# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +# OTHER DEALINGS IN THE SOFTWARE. +# +# Except as contained in this notice, the name of the copyright holder(s) +# and author(s) shall not be used in advertising or otherwise to promote +# the sale, use or other dealings in this Software without prior written +# authorization from the copyright holder(s) and author(s). +# +# $XFree86: xc/programs/Xserver/hw/xfree86/common/modeline2c.pl,v 1.11 2003/11/03 05:11:01 tsi Exp $ #my %flagshash; $flagshash{""} = "0"; @@ -32,17 +56,20 @@ $flagshash{"-hsync -vsync interlace"} = "V_NHSYNC | V_NVSYNC | V_INTERLACE"; # stop CVS from expanding the XFree86 Id here... $proj = "XFree86"; -printf("/* \$$proj: \$ */ +printf("/* \$$proj\$ */ /* THIS FILE IS AUTOMATICALLY GENERATED -- DO NOT EDIT -- LOOK at * modeline2c.pl */ /* - * Copyright 1999 by The XFree86 Project, Inc. + * Copyright 1999-2003 by The XFree86 Project, Inc. * * Author: Dirk Hohndel <hohndel\@XFree86.Org> */ +#ifdef __UNIXOS2__ +#define I_NEED_OS2_H +#endif #include \"xf86.h\" #include \"xf86Config.h\" #include \"xf86Priv.h\" @@ -50,7 +77,7 @@ printf("/* \$$proj: \$ */ #include \"globals.h\" -#define MODEPREFIX(name) NULL, NULL, name, 0,M_T_DEFAULT +#define MODEPREFIX(name) NULL, NULL, name, MODE_OK, M_T_DEFAULT #define MODESUFFIX 0,0, 0,0,0,0,0,0,0, 0,0,0,0,0,0,FALSE,FALSE,0,NULL,0,0.0,0.0 DisplayModeRec xf86DefaultModes [] = { diff --git a/hw/xfree86/common/scoasm.h b/hw/xfree86/common/scoasm.h index 12fe46693..dbf8c8f86 100644 --- a/hw/xfree86/common/scoasm.h +++ b/hw/xfree86/common/scoasm.h @@ -1,4 +1,31 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/scoasm.h,v 3.0 1996/10/03 08:34:06 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/scoasm.h,v 3.1 2003/08/24 17:36:49 dawes Exp $ */ + +/* + * Copyright (c) 1996 by The XFree86 Project, 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 COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + * + * Except as contained in this notice, the name of the copyright holder(s) + * and author(s) shall not be used in advertising or otherwise to promote + * the sale, use or other dealings in this Software without prior written + * authorization from the copyright holder(s) and author(s). + */ /* * scoasm.h - used to define inline versions of certain functions which diff --git a/hw/xfree86/common/xf86.h b/hw/xfree86/common/xf86.h index 119adc5a6..e189e81d2 100644 --- a/hw/xfree86/common/xf86.h +++ b/hw/xfree86/common/xf86.h @@ -1,7 +1,30 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86.h,v 3.169 2003/02/13 10:49:38 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86.h,v 3.172 2003/09/24 02:43:16 dawes Exp $ */ /* - * Copyright (c) 1997 by The XFree86 Project, Inc. + * Copyright (c) 1997-2003 by The XFree86 Project, 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 COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + * + * Except as contained in this notice, the name of the copyright holder(s) + * and author(s) shall not be used in advertising or otherwise to promote + * the sale, use or other dealings in this Software without prior written + * authorization from the copyright holder(s) and author(s). */ /* @@ -203,6 +226,11 @@ void xf86ProcessActionEvent(ActionEvent action, void *arg); /* xf86Helper.c */ +#ifdef printf +#define printf_defined +#undef printf +#endif + void xf86AddDriver(DriverPtr driver, pointer module, int flags); void xf86DeleteDriver(int drvIndex); ScrnInfoPtr xf86AllocateScreen(DriverPtr drv, int flags); @@ -221,12 +249,14 @@ void xf86EnableDisableFBAccess(int scrnIndex, Bool enable); void xf86VDrvMsgVerb(int scrnIndex, MessageType type, int verb, const char *format, va_list args); void xf86DrvMsgVerb(int scrnIndex, MessageType type, int verb, - const char *format, ...); -void xf86DrvMsg(int scrnIndex, MessageType type, const char *format, ...); -void xf86MsgVerb(MessageType type, int verb, const char *format, ...); -void xf86Msg(MessageType type, const char *format, ...); -void xf86ErrorFVerb(int verb, const char *format, ...); -void xf86ErrorF(const char *format, ...); + const char *format, ...) _printf_attribute(4,5); +void xf86DrvMsg(int scrnIndex, MessageType type, const char *format, ...) + _printf_attribute(3,4); +void xf86MsgVerb(MessageType type, int verb, const char *format, ...) + _printf_attribute(3,4); +void xf86Msg(MessageType type, const char *format, ...) _printf_attribute(2,3); +void xf86ErrorFVerb(int verb, const char *format, ...) _printf_attribute(2,3); +void xf86ErrorF(const char *format, ...) _printf_attribute(1,2); const char *xf86TokenToString(SymTabPtr table, int token); int xf86StringToToken(SymTabPtr table, const char *string); void xf86ShowClocks(ScrnInfoPtr scrp, MessageType from); @@ -334,6 +364,11 @@ void xf86AddModuleInfo(ModuleInfoPtr info, pointer module); void xf86DeleteModuleInfo(int idx); #endif +#ifdef printf_defined +#define printf xf86printf +#undef printf_defined +#endif + /* xf86Debug.c */ #ifdef BUILDDEBUG void xf86Break1(void); @@ -402,6 +437,12 @@ void xf86RandRSetInitialMode (ScreenPtr pScreen); Bool VidModeExtensionInit(ScreenPtr pScreen); +/* xf86Versions.c */ +CARD32 xf86GetBuiltinInterfaceVersion(BuiltinInterface iface, int flag); +Bool xf86RegisterBuiltinInterfaceVersion(BuiltinInterface iface, + CARD32 version, int flags); + + #endif /* _NO_XF86_PROTOTYPES */ #endif /* _XF86_H */ diff --git a/hw/xfree86/common/xf86Bus.c b/hw/xfree86/common/xf86Bus.c index fd9e3c3d1..2ffbfa964 100644 --- a/hw/xfree86/common/xf86Bus.c +++ b/hw/xfree86/common/xf86Bus.c @@ -1,7 +1,31 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Bus.c,v 1.76 2003/02/21 17:19:34 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Bus.c,v 1.79 2003/11/03 05:11:01 tsi Exp $ */ /* - * Copyright (c) 1997-1999 by The XFree86 Project, Inc. + * Copyright (c) 1997-2003 by The XFree86 Project, 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 COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + * + * Except as contained in this notice, the name of the copyright holder(s) + * and author(s) shall not be used in advertising or otherwise to promote + * the sale, use or other dealings in this Software without prior written + * authorization from the copyright holder(s) and author(s). */ + #define REDUCER /* * This file contains the interfaces to the bus-specific code @@ -1280,14 +1304,14 @@ xf86PrintResList(int verb, resPtr list) switch (list->res_type & ResExtMask) { case ResBlock: xf86ErrorFVerb(verb, - "\t[%d] %d\t%d\t0x%08lx - 0x%08lx (0x%lx)", + "\t[%d] %d\t%ld\t0x%08lx - 0x%08lx (0x%lx)", i, list->entityIndex, (list->res_type & ResDomain) >> 24, list->block_begin, list->block_end, list->block_end - list->block_begin + 1); break; case ResSparse: - xf86ErrorFVerb(verb, "\t[%d] %d\t%d\t0x%08lx - 0x%08lx ", + xf86ErrorFVerb(verb, "\t[%d] %d\t%ld\t0x%08lx - 0x%08lx ", i, list->entityIndex, (list->res_type & ResDomain) >> 24, list->sparse_base,list->sparse_mask); @@ -1581,7 +1605,6 @@ xf86GetSparse(unsigned long type, memType fixed_bits, memType new_mask; memType mask1; memType base; - memType bits; memType counter = 0; memType counter1; memType max_counter = ~(memType)0; @@ -1653,7 +1676,6 @@ xf86GetSparse(unsigned long type, memType fixed_bits, counter = 0; while (1) { - bits = make_base(counter,new_mask) | fixed_bits; counter1 = 0; while (1) { base = make_base(counter1,mask1); @@ -2134,7 +2156,7 @@ static void resError(resList list) { FatalError("A driver tried to allocate the %s %sresource at \n" - "0x%x:0x%x which conflicted with another resource. Send the\n" + "0x%lx:0x%lx which conflicted with another resource. Send the\n" "output of the server to %s. Please \n" "specify your computer hardware as closely as possible.\n", ResIsBlock(list)?"Block":"Sparse", diff --git a/hw/xfree86/common/xf86Bus.h b/hw/xfree86/common/xf86Bus.h index 6a129ad56..fbeca7f9c 100644 --- a/hw/xfree86/common/xf86Bus.h +++ b/hw/xfree86/common/xf86Bus.h @@ -1,6 +1,30 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Bus.h,v 1.21 2002/11/25 14:04:56 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Bus.h,v 1.23 2003/08/24 17:36:50 dawes Exp $ */ + /* - * Copyright (c) 1997 by The XFree86 Project, Inc. + * Copyright (c) 1997-2003 by The XFree86 Project, 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 COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + * + * Except as contained in this notice, the name of the copyright holder(s) + * and author(s) shall not be used in advertising or otherwise to promote + * the sale, use or other dealings in this Software without prior written + * authorization from the copyright holder(s) and author(s). */ /* @@ -98,7 +122,6 @@ typedef struct x_BusAccRec { int primary_bus; PCITAG acc; pciBridgesSave save; - void (*func)(PCITAG,int,CARD32,CARD32); } pci; } busdep; } BusAccRec, *BusAccPtr; diff --git a/hw/xfree86/common/xf86Config.c b/hw/xfree86/common/xf86Config.c index 1738222f5..8f6dd2803 100644 --- a/hw/xfree86/common/xf86Config.c +++ b/hw/xfree86/common/xf86Config.c @@ -1,17 +1,48 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Config.c,v 3.269 2003/02/20 04:36:07 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Config.c,v 3.277 2003/10/15 22:51:48 dawes Exp $ */ /* - * Copyright 1991-2002 by The XFree86 Project, Inc. - * Copyright 1997 by Metro Link, Inc. - * * Loosely based on code bearing the following copyright: * * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany. + */ + +/* + * Copyright 1992-2003 by The XFree86 Project, Inc. + * Copyright 1997 by Metro Link, 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: * - * <Put copyright message here> + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. * - * Author: Dirk Hohndel <hohndel@XFree86.Org> and others. + * 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 COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + * + * Except as contained in this notice, the name of the copyright holder(s) + * and author(s) shall not be used in advertising or otherwise to promote + * the sale, use or other dealings in this Software without prior written + * authorization from the copyright holder(s) and author(s). + */ + +/* + * + * Authors: + * Dirk Hohndel <hohndel@XFree86.Org> + * David Dawes <dawes@XFree86.Org> + * Marc La France <tsi@XFree86.Org> + * Egbert Eich <eich@XFree86.Org> + * ... and others */ #ifdef XF86DRI @@ -19,6 +50,10 @@ #include <grp.h> #endif +#ifdef __UNIXOS2__ +#define I_NEED_OS2_H +#endif + #include "xf86.h" #include "xf86Parser.h" #include "xf86tokens.h" @@ -905,9 +940,11 @@ configServerFlags(XF86ConfFlagsPtr flagsconf, XF86OptionPtr layoutopts) if (!xf86NameCmp(s,"flush")) { xf86Msg(X_CONFIG, "Flushing logfile enabled\n"); xf86Info.log = LogFlush; + LogSetParameter(XLOG_FLUSH, TRUE); } else if (!xf86NameCmp(s,"sync")) { xf86Msg(X_CONFIG, "Syncing logfile enabled\n"); xf86Info.log = LogSync; + LogSetParameter(XLOG_SYNC, TRUE); } else { xf86Msg(X_WARNING,"Unknown Log option\n"); } @@ -1143,6 +1180,11 @@ configInputKbd(IDevPtr inputp) xf86Msg(X_PROBED, "Keyboard type: Sun\n"); break; #endif +#ifdef WSKBD_TYPE_SUN5 + case WSKBD_TYPE_SUN5: + xf86Msg(X_PROBED, "Keyboard type: Sun5\n"); + break; +#endif default: xf86ConfigError("Unsupported wskbd type \"%d\"", xf86Info.wsKbdType); @@ -1314,105 +1356,297 @@ configInputKbd(IDevPtr inputp) return TRUE; } +/* + * Locate the core input devices. These can be specified/located in + * the following ways, in order of priority: + * + * 1. The InputDevices named by the -pointer and -keyboard command line + * options. + * 2. The "CorePointer" and "CoreKeyboard" InputDevices referred to by + * the active ServerLayout. + * 3. The first InputDevices marked as "CorePointer" and "CoreKeyboard". + * 4. The first InputDevices that use the 'mouse' and 'keyboard' or 'kbd' + * drivers. + * 5. Default devices with an empty (default) configuration. These defaults + * will reference the 'mouse' and 'keyboard' drivers. + */ + static Bool checkCoreInputDevices(serverLayoutPtr servlayoutp, Bool implicitLayout) { - Bool havePointer = FALSE, haveKeyboard = FALSE; + IDevPtr corePointer = NULL, coreKeyboard = NULL; Bool foundPointer = FALSE, foundKeyboard = FALSE; + const char *pointerMsg = NULL, *keyboardMsg = NULL; IDevPtr indp; IDevRec Pointer, Keyboard; XF86ConfInputPtr confInput; + XF86ConfInputRec defPtr, defKbd; int count = 0; MessageType from = X_DEFAULT; - /* Check if a core pointer or core keyboard is needed. */ + /* + * First check if a core pointer or core keyboard have been specified + * in the active ServerLayout. If more than one is specified for either, + * remove the core attribute from the later ones. + */ for (indp = servlayoutp->inputs; indp->identifier; indp++) { - if ((indp->commonOptions && - xf86FindOption(indp->commonOptions, "CorePointer")) || - (indp->extraOptions && - xf86FindOption(indp->extraOptions, "CorePointer"))) { - havePointer = TRUE; + pointer opt1 = NULL, opt2 = NULL; + if (indp->commonOptions && + xf86CheckBoolOption(indp->commonOptions, "CorePointer", FALSE)) { + opt1 = indp->commonOptions; + } + if (indp->extraOptions && + xf86CheckBoolOption(indp->extraOptions, "CorePointer", FALSE)) { + opt2 = indp->extraOptions; + } + if (opt1 || opt2) { + if (!corePointer) { + corePointer = indp; + } else { + if (opt1) + xf86ReplaceBoolOption(opt1, "CorePointer", FALSE); + if (opt2) + xf86ReplaceBoolOption(opt2, "CorePointer", FALSE); + xf86Msg(X_WARNING, "Duplicate core pointer devices. " + "Removing core pointer attribute from \"%s\"\n", + indp->identifier); + } + } + opt1 = opt2 = NULL; + if (indp->commonOptions && + xf86CheckBoolOption(indp->commonOptions, "CoreKeyboard", FALSE)) { + opt1 = indp->commonOptions; } - if ((indp->commonOptions && - xf86FindOption(indp->commonOptions, "CoreKeyboard")) || - (indp->extraOptions && - xf86FindOption(indp->extraOptions, "CoreKeyboard"))) { - haveKeyboard = TRUE; + if (indp->extraOptions && + xf86CheckBoolOption(indp->extraOptions, "CoreKeyboard", FALSE)) { + opt2 = indp->extraOptions; + } + if (opt1 || opt2) { + if (!coreKeyboard) { + coreKeyboard = indp; + } else { + if (opt1) + xf86ReplaceBoolOption(opt1, "CoreKeyboard", FALSE); + if (opt2) + xf86ReplaceBoolOption(opt2, "CoreKeyboard", FALSE); + xf86Msg(X_WARNING, "Duplicate core keyboard devices. " + "Removing core keyboard attribute from \"%s\"\n", + indp->identifier); + } } count++; } - if (!havePointer) { - if (xf86PointerName) { - confInput = xf86findInput(xf86PointerName, - xf86configptr->conf_input_lst); - if (!confInput) { - xf86Msg(X_ERROR, "No InputDevice section called \"%s\"\n", - xf86PointerName); - return FALSE; + + confInput = NULL; + + /* 1. Check for the -pointer command line option. */ + if (xf86PointerName) { + confInput = xf86findInput(xf86PointerName, + xf86configptr->conf_input_lst); + if (!confInput) { + xf86Msg(X_ERROR, "No InputDevice section called \"%s\"\n", + xf86PointerName); + return FALSE; + } + from = X_CMDLINE; + /* + * If one was already specified in the ServerLayout, it needs to be + * removed. + */ + if (corePointer) { + for (indp = servlayoutp->inputs; indp->identifier; indp++) + if (indp == corePointer) + break; + for (; indp->identifier; indp++) + indp[0] = indp[1]; + count--; + } + corePointer = NULL; + foundPointer = TRUE; + } + + /* 2. ServerLayout-specified core pointer. */ + if (corePointer) { + foundPointer = TRUE; + from = X_CONFIG; + } + + /* 3. First core pointer device. */ + if (!foundPointer) { + XF86ConfInputPtr p; + + for (p = xf86configptr->conf_input_lst; p; p = p->list.next) { + if (p->inp_option_lst && + xf86CheckBoolOption(p->inp_option_lst, "CorePointer", FALSE)) { + confInput = p; + foundPointer = TRUE; + from = X_DEFAULT; + pointerMsg = "first core pointer device"; + break; } - from = X_CMDLINE; - } else { + } + } + + /* 4. First pointer with 'mouse' as the driver. */ + if (!foundPointer) { + confInput = xf86findInput(CONF_IMPLICIT_POINTER, + xf86configptr->conf_input_lst); + if (!confInput) { + confInput = xf86findInputByDriver("mouse", + xf86configptr->conf_input_lst); + } + if (confInput) { + foundPointer = TRUE; from = X_DEFAULT; - confInput = xf86findInput(CONF_IMPLICIT_POINTER, - xf86configptr->conf_input_lst); - if (!confInput && implicitLayout) { - confInput = xf86findInputByDriver("mouse", - xf86configptr->conf_input_lst); - } + pointerMsg = "first mouse device"; + } + } + + /* 5. Built-in default. */ + if (!foundPointer) { + bzero(&defPtr, sizeof(defPtr)); + defPtr.inp_identifier = "<default pointer>"; + defPtr.inp_driver = "mouse"; + confInput = &defPtr; + foundPointer = TRUE; + from = X_DEFAULT; + pointerMsg = "default mouse configuration"; + } + + /* Add the core pointer device to the layout, and set it to Core. */ + if (foundPointer && confInput) { + foundPointer = configInput(&Pointer, confInput, from); + if (foundPointer) { + count++; + indp = xnfrealloc(servlayoutp->inputs, + (count + 1) * sizeof(IDevRec)); + indp[count - 1] = Pointer; + indp[count - 1].extraOptions = + xf86addNewOption(NULL, "CorePointer", NULL); + indp[count].identifier = NULL; + servlayoutp->inputs = indp; } - if (confInput) - foundPointer = configInput(&Pointer, confInput, from); - } - if (!haveKeyboard) { - if (xf86KeyboardName) { - confInput = xf86findInput(xf86KeyboardName, - xf86configptr->conf_input_lst); - if (!confInput) { - xf86Msg(X_ERROR, "No InputDevice section called \"%s\"\n", - xf86KeyboardName); - return FALSE; + } + + if (!foundPointer) { + /* This shouldn't happen. */ + xf86Msg(X_ERROR, "Cannot locate a core pointer device.\n"); + return FALSE; + } + + confInput = NULL; + + /* 1. Check for the -keyboard command line option. */ + if (xf86KeyboardName) { + confInput = xf86findInput(xf86KeyboardName, + xf86configptr->conf_input_lst); + if (!confInput) { + xf86Msg(X_ERROR, "No InputDevice section called \"%s\"\n", + xf86KeyboardName); + return FALSE; + } + from = X_CMDLINE; + /* + * If one was already specified in the ServerLayout, it needs to be + * removed. + */ + if (coreKeyboard) { + for (indp = servlayoutp->inputs; indp->identifier; indp++) + if (indp == coreKeyboard) + break; + for (; indp->identifier; indp++) + indp[0] = indp[1]; + count--; + } + coreKeyboard = NULL; + foundKeyboard = TRUE; + } + + /* 2. ServerLayout-specified core keyboard. */ + if (coreKeyboard) { + foundKeyboard = TRUE; + from = X_CONFIG; + } + + /* 3. First core keyboard device. */ + if (!foundKeyboard) { + XF86ConfInputPtr p; + + for (p = xf86configptr->conf_input_lst; p; p = p->list.next) { + if (p->inp_option_lst && + xf86CheckBoolOption(p->inp_option_lst, "CoreKeyboard", FALSE)) { + confInput = p; + foundKeyboard = TRUE; + from = X_DEFAULT; + keyboardMsg = "first core keyboard device"; + break; } - from = X_CMDLINE; - } else { + } + } + + /* 4. First keyboard with 'keyboard' or 'kbd' as the driver. */ + if (!foundKeyboard) { + confInput = xf86findInput(CONF_IMPLICIT_KEYBOARD, + xf86configptr->conf_input_lst); + if (!confInput) { + confInput = xf86findInputByDriver("keyboard", + xf86configptr->conf_input_lst); + } + if (!confInput) { + confInput = xf86findInputByDriver("kbd", + xf86configptr->conf_input_lst); + } + if (confInput) { + foundKeyboard = TRUE; from = X_DEFAULT; - confInput = xf86findInput(CONF_IMPLICIT_KEYBOARD, - xf86configptr->conf_input_lst); - if (!confInput && implicitLayout) { - confInput = xf86findInputByDriver("keyboard", - xf86configptr->conf_input_lst); - } + pointerMsg = "first keyboard device"; } - if (confInput) - foundKeyboard = configInput(&Keyboard, confInput, from); } - if (foundPointer) { - count++; - indp = xnfrealloc(servlayoutp->inputs, (count + 1) * sizeof(IDevRec)); - indp[count - 1] = Pointer; - indp[count - 1].extraOptions = xf86addNewOption(NULL, "CorePointer", NULL); - indp[count].identifier = NULL; - servlayoutp->inputs = indp; - } else if (!havePointer) { - if (implicitLayout) - xf86Msg(X_ERROR, "Unable to find a core pointer device\n"); - else - xf86Msg(X_ERROR, "No core pointer device specified\n"); - return FALSE; + + /* 5. Built-in default. */ + if (!foundKeyboard) { + bzero(&defKbd, sizeof(defKbd)); + defKbd.inp_identifier = "<default keyboard>"; + defKbd.inp_driver = "keyboard"; + confInput = &defKbd; + foundKeyboard = TRUE; + keyboardMsg = "default keyboard configuration"; + from = X_DEFAULT; } - if (foundKeyboard) { - count++; - indp = xnfrealloc(servlayoutp->inputs, (count + 1) * sizeof(IDevRec)); - indp[count - 1] = Keyboard; - indp[count - 1].extraOptions = xf86addNewOption(NULL, "CoreKeyboard", NULL); - indp[count].identifier = NULL; - servlayoutp->inputs = indp; - } else if (!haveKeyboard) { - if (implicitLayout) - xf86Msg(X_ERROR, "Unable to find a core keyboard device\n"); - else - xf86Msg(X_ERROR, "No core keyboard device specified\n"); + + /* Add the core keyboard device to the layout, and set it to Core. */ + if (foundKeyboard && confInput) { + foundKeyboard = configInput(&Keyboard, confInput, from); + if (foundKeyboard) { + count++; + indp = xnfrealloc(servlayoutp->inputs, + (count + 1) * sizeof(IDevRec)); + indp[count - 1] = Keyboard; + indp[count - 1].extraOptions = + xf86addNewOption(NULL, "CoreKeyboard", NULL); + indp[count].identifier = NULL; + servlayoutp->inputs = indp; + } + } + + if (!foundKeyboard) { + /* This shouldn't happen. */ + xf86Msg(X_ERROR, "Cannot locate a core keyboard device.\n"); return FALSE; } + + if (pointerMsg) { + xf86Msg(X_WARNING, "The core pointer device wasn't specified " + "explicitly in the layout.\n" + "\tUsing the %s.\n", pointerMsg); + } + + if (keyboardMsg) { + xf86Msg(X_WARNING, "The core keyboard device wasn't specified " + "explicitly in the layout.\n" + "\tUsing the %s.\n", keyboardMsg); + } + return TRUE; } @@ -1767,6 +2001,7 @@ configScreen(confScreenPtr screenp, XF86ConfScreenPtr conf_screen, int scrnum, int count = 0; XF86ConfDisplayPtr dispptr; XF86ConfAdaptorLinkPtr conf_adaptor; + Bool defaultMonitor = FALSE; xf86Msg(from, "|-->Screen \"%s\" (%d)\n", conf_screen->scrn_identifier, scrnum); @@ -1779,8 +2014,29 @@ configScreen(confScreenPtr screenp, XF86ConfScreenPtr conf_screen, int scrnum, screenp->defaultbpp = conf_screen->scrn_defaultbpp; screenp->defaultfbbpp = conf_screen->scrn_defaultfbbpp; screenp->monitor = xnfcalloc(1, sizeof(MonRec)); - if (!configMonitor(screenp->monitor,conf_screen->scrn_monitor)) - return FALSE; + /* If no monitor is specified, create a default one. */ + if (!conf_screen->scrn_monitor) { + XF86ConfMonitorRec defMon; + + bzero(&defMon, sizeof(defMon)); + defMon.mon_identifier = "<default monitor>"; + /* + * TARGET_REFRESH_RATE may be defined to effectively limit the + * default resolution to the largest that has a "good" refresh + * rate. + */ +#ifdef TARGET_REFRESH_RATE + defMon.mon_option_lst = xf86ReplaceRealOption(defMon.mon_option_lst, + "TargetRefresh", + TARGET_REFRESH_RATE); +#endif + if (!configMonitor(screenp->monitor, &defMon)) + return FALSE; + defaultMonitor = TRUE; + } else { + if (!configMonitor(screenp->monitor,conf_screen->scrn_monitor)) + return FALSE; + } screenp->device = xnfcalloc(1, sizeof(GDevRec)); configDevice(screenp->device,conf_screen->scrn_device, TRUE); screenp->device->myScreenSection = screenp; @@ -1822,6 +2078,10 @@ configScreen(confScreenPtr screenp, XF86ConfScreenPtr conf_screen, int scrnum, conf_adaptor = (XF86ConfAdaptorLinkPtr)conf_adaptor->list.next; } + if (defaultMonitor) { + xf86Msg(X_WARNING, "No monitor specified for screen \"%s\".\n" + "\tUsing a default monitor configuration.\n", screenp->id); + } return TRUE; } @@ -2149,7 +2409,7 @@ configInput(IDevPtr inputp, XF86ConfInputPtr conf_input, MessageType from) return TRUE; } - + static Bool modeIsPresent(char * modename,MonPtr monitorp) { @@ -2207,35 +2467,38 @@ addDefaultModes(MonPtr monitorp) /* * load the config file and fill the global data structure */ -Bool -xf86HandleConfigFile(void) +ConfigStatus +xf86HandleConfigFile(Bool autoconfig) { const char *filename; char *searchpath; MessageType from = X_DEFAULT; - if (getuid() == 0) - searchpath = ROOT_CONFIGPATH; - else - searchpath = USER_CONFIGPATH; - - if (xf86ConfigFile) - from = X_CMDLINE; + if (!autoconfig) { + if (getuid() == 0) + searchpath = ROOT_CONFIGPATH; + else + searchpath = USER_CONFIGPATH; - filename = xf86openConfigFile(searchpath, xf86ConfigFile, PROJECTROOT); - if (filename) { - xf86MsgVerb(from, 0, "Using config file: \"%s\"\n", filename); - xf86ConfigFile = xnfstrdup(filename); - } else { - xf86Msg(X_ERROR, "Unable to locate/open config file"); if (xf86ConfigFile) - xf86ErrorFVerb(0, ": \"%s\"", xf86ConfigFile); - xf86ErrorFVerb(0, "\n"); - return FALSE; + from = X_CMDLINE; + + filename = xf86openConfigFile(searchpath, xf86ConfigFile, PROJECTROOT); + if (filename) { + xf86MsgVerb(from, 0, "Using config file: \"%s\"\n", filename); + xf86ConfigFile = xnfstrdup(filename); + } else { + xf86Msg(X_ERROR, "Unable to locate/open config file"); + if (xf86ConfigFile) + xf86ErrorFVerb(0, ": \"%s\"", xf86ConfigFile); + xf86ErrorFVerb(0, "\n"); + return CONFIG_NOFILE; + } } + if ((xf86configptr = xf86readConfigFile ()) == NULL) { xf86Msg(X_ERROR, "Problem parsing the config file\n"); - return FALSE; + return CONFIG_PARSE_ERROR; } xf86closeConfigFile (); @@ -2260,7 +2523,7 @@ xf86HandleConfigFile(void) if (!configImpliedLayout(&xf86ConfigLayout, xf86configptr->conf_screen_lst)) { xf86Msg(X_ERROR, "Unable to determine the screen layout\n"); - return FALSE; + return CONFIG_PARSE_ERROR; } } else { if (xf86configptr->conf_flags != NULL) { @@ -2272,13 +2535,13 @@ xf86HandleConfigFile(void) if (!configLayout(&xf86ConfigLayout, xf86configptr->conf_layout_lst, dfltlayout)) { xf86Msg(X_ERROR, "Unable to determine the screen layout\n"); - return FALSE; + return CONFIG_PARSE_ERROR; } } else { if (!configLayout(&xf86ConfigLayout, xf86configptr->conf_layout_lst, NULL)) { xf86Msg(X_ERROR, "Unable to determine the screen layout\n"); - return FALSE; + return CONFIG_PARSE_ERROR; } } } @@ -2293,7 +2556,7 @@ xf86HandleConfigFile(void) #endif ) { ErrorF ("Problem when converting the config data structures\n"); - return FALSE; + return CONFIG_PARSE_ERROR; } /* @@ -2317,7 +2580,7 @@ xf86HandleConfigFile(void) if (xf86AllowMouseOpenFail) xf86Info.allowMouseOpenFail = TRUE; - return TRUE; + return CONFIG_OK; } diff --git a/hw/xfree86/common/xf86Config.h b/hw/xfree86/common/xf86Config.h index 6a24df0e0..e54da3d09 100644 --- a/hw/xfree86/common/xf86Config.h +++ b/hw/xfree86/common/xf86Config.h @@ -1,6 +1,30 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Config.h,v 1.5 2000/02/24 05:36:50 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Config.h,v 1.7 2003/10/08 14:58:27 dawes Exp $ */ + /* - * Copyright 1997 by The XFree86 Project, Inc + * Copyright (c) 1997-2000 by The XFree86 Project, 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 COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + * + * Except as contained in this notice, the name of the copyright holder(s) + * and author(s) shall not be used in advertising or otherwise to promote + * the sale, use or other dealings in this Software without prior written + * authorization from the copyright holder(s) and author(s). */ #ifndef _xf86_config_h @@ -13,6 +37,12 @@ extern XF86ConfigPtr xf86configptr; #endif +typedef enum _ConfigStatus { + CONFIG_OK = 0, + CONFIG_PARSE_ERROR, + CONFIG_NOFILE +} ConfigStatus; + /* * prototypes */ @@ -22,6 +52,8 @@ char ** xf86DriverlistFromCompile(void); char ** xf86InputDriverlistFromConfig(void); char ** xf86InputDriverlistFromCompile(void); Bool xf86BuiltinInputDriver(const char *); -Bool xf86HandleConfigFile(void); +ConfigStatus xf86HandleConfigFile(Bool); + +Bool xf86AutoConfig(void); #endif /* _xf86_config_h */ diff --git a/hw/xfree86/common/xf86Configure.c b/hw/xfree86/common/xf86Configure.c index 687730ea5..3dde4ba7d 100644 --- a/hw/xfree86/common/xf86Configure.c +++ b/hw/xfree86/common/xf86Configure.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Configure.c,v 3.78 2003/01/18 07:27:13 paulo Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Configure.c,v 3.81 2003/10/29 04:17:21 dawes Exp $ */ /* * Copyright 2000-2002 by Alan Hourihane, Flint Mountain, North Wales. * @@ -46,7 +46,7 @@ #include "Configint.h" #include "vbe.h" #include "xf86DDC.h" -#ifdef __sparc__ +#if defined(__sparc__) && !defined(__OpenBSD__) #include "xf86Bus.h" #include "xf86Sbus.h" #endif @@ -55,7 +55,7 @@ typedef struct _DevToConfig { GDevRec GDev; pciVideoPtr pVideo; -#ifdef __sparc__ +#if defined(__sparc__) && !defined(__OpenBSD__) sbusDevicePtr sVideo; #endif int iDriver; @@ -280,6 +280,8 @@ configureInputSection (void) DFLT_MOUSE_DEV = "/dev/wsmouse"; DFLT_MOUSE_PROTO = "wsmouse"; close(fd); + } else { + ErrorF("cannot open /dev/wsmouse\n"); } #endif @@ -868,7 +870,7 @@ DoConfigure() xf86DoConfigurePass1 = FALSE; /* Try to get DDC information filled in */ xf86ConfigFile = filename; - if (!xf86HandleConfigFile()) { + if (xf86HandleConfigFile(FALSE) != CONFIG_OK) { goto bail; } @@ -990,7 +992,7 @@ DoConfigure() ErrorF("To test the server, run 'XFree86 -xf86config %s'\n\n", filename); bail: - OsCleanup(); + OsCleanup(TRUE); AbortDDX(); fflush(stderr); exit(0); diff --git a/hw/xfree86/common/xf86Cursor.c b/hw/xfree86/common/xf86Cursor.c index 1a214c4ad..22b7b00e6 100644 --- a/hw/xfree86/common/xf86Cursor.c +++ b/hw/xfree86/common/xf86Cursor.c @@ -1,4 +1,31 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Cursor.c,v 3.35 2003/02/13 10:49:38 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Cursor.c,v 3.37 2003/11/07 22:20:17 dawes Exp $ */ +/* + * Copyright (c) 1994-2003 by The XFree86 Project, 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 COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + * + * Except as contained in this notice, the name of the copyright holder(s) + * and author(s) shall not be used in advertising or otherwise to promote + * the sale, use or other dealings in this Software without prior written + * authorization from the copyright holder(s) and author(s). + */ + /* $XConsortium: xf86Cursor.c /main/10 1996/10/19 17:58:23 kaleb $ */ #define NEED_EVENTS @@ -77,11 +104,16 @@ xf86InitViewport(ScrnInfoPtr pScr) /* * Compute the initial Viewport if necessary */ - if (pScr->frameX0 < 0) - { + if (pScr->display) { + if (pScr->display->frameX0 < 0) { pScr->frameX0 = (pScr->virtualX - pScr->modes->HDisplay) / 2; pScr->frameY0 = (pScr->virtualY - pScr->modes->VDisplay) / 2; + } else { + pScr->frameX0 = pScr->display->frameX0; + pScr->frameY0 = pScr->display->frameY0; } + } + pScr->frameX1 = pScr->frameX0 + pScr->modes->HDisplay - 1; pScr->frameY1 = pScr->frameY0 + pScr->modes->VDisplay - 1; diff --git a/hw/xfree86/common/xf86DGA.c b/hw/xfree86/common/xf86DGA.c index 1ad8b42ff..5e4bc29b6 100644 --- a/hw/xfree86/common/xf86DGA.c +++ b/hw/xfree86/common/xf86DGA.c @@ -1,9 +1,32 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86DGA.c,v 1.47 2003/08/24 17:36:51 dawes Exp $ */ /* - Copyright (c) 1999 - The XFree86 Project, Inc. - - Written by Mark Vojkovich -*/ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86DGA.c,v 1.46 2002/12/03 18:17:40 tsi Exp $ */ + * Copyright (c) 1998-2002 by The XFree86 Project, 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 COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + * + * Except as contained in this notice, the name of the copyright holder(s) + * and author(s) shall not be used in advertising or otherwise to promote + * the sale, use or other dealings in this Software without prior written + * authorization from the copyright holder(s) and author(s). + * + * Written by Mark Vojkovich + */ #include "xf86.h" #include "xf86str.h" diff --git a/hw/xfree86/common/xf86DPMS.c b/hw/xfree86/common/xf86DPMS.c index 0de054ff3..df968797c 100644 --- a/hw/xfree86/common/xf86DPMS.c +++ b/hw/xfree86/common/xf86DPMS.c @@ -1,7 +1,30 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86DPMS.c,v 1.8 2003/02/13 02:41:09 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86DPMS.c,v 1.11 2003/11/11 21:02:28 dawes Exp $ */ /* - * Copyright (c) 1997-1998 by The XFree86 Project, Inc. + * Copyright (c) 1997-2003 by The XFree86 Project, 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 COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + * + * Except as contained in this notice, the name of the copyright holder(s) + * and author(s) shall not be used in advertising or otherwise to promote + * the sale, use or other dealings in this Software without prior written + * authorization from the copyright holder(s) and author(s). */ /* @@ -14,6 +37,8 @@ #include "xf86.h" #include "xf86Priv.h" #ifdef DPMSExtension +#define DPMS_SERVER +#include "extensions/dpms.h" #include "dpmsproc.h" #endif @@ -30,6 +55,7 @@ Bool xf86DPMSInit(ScreenPtr pScreen, DPMSSetProcPtr set, int flags) { #ifdef DPMSExtension + ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; DPMSPtr pDPMS; pointer DPMSOpt; @@ -45,13 +71,12 @@ xf86DPMSInit(ScreenPtr pScreen, DPMSSetProcPtr set, int flags) return FALSE; pDPMS = (DPMSPtr)pScreen->devPrivates[DPMSIndex].ptr; - pDPMS->Set = set; + pScrn->DPMSSet = set; pDPMS->Flags = flags; - DPMSOpt = xf86FindOption(xf86Screens[pScreen->myNum]->options, "dpms"); + DPMSOpt = xf86FindOption(pScrn->options, "dpms"); if (DPMSOpt) { if ((pDPMS->Enabled - = xf86SetBoolOption(xf86Screens[pScreen->myNum]->options, - "dpms",FALSE)) + = xf86SetBoolOption(pScrn->options, "dpms", FALSE)) && !DPMSDisabledSwitch) DPMSEnabled = TRUE; xf86MarkOptionUsed(DPMSOpt); @@ -111,18 +136,23 @@ DPMSSet(int level) { int i; DPMSPtr pDPMS; + ScrnInfoPtr pScrn; DPMSPowerLevel = level; if (DPMSIndex < 0) return; + if (level != DPMSModeOn) + SaveScreens(SCREEN_SAVER_FORCER, ScreenSaverActive); + /* For each screen, set the DPMS level */ for (i = 0; i < xf86NumScreens; i++) { + pScrn = xf86Screens[i]; pDPMS = (DPMSPtr)screenInfo.screens[i]->devPrivates[DPMSIndex].ptr; - if (pDPMS && pDPMS->Set && pDPMS->Enabled && xf86Screens[i]->vtSema) { - xf86EnableAccess(xf86Screens[i]); - pDPMS->Set(xf86Screens[i], level, 0); + if (pDPMS && pScrn->DPMSSet && pDPMS->Enabled && pScrn->vtSema) { + xf86EnableAccess(pScrn); + pScrn->DPMSSet(pScrn, level, 0); } } } @@ -137,6 +167,7 @@ DPMSSupported(void) { int i; DPMSPtr pDPMS; + ScrnInfoPtr pScrn; if (DPMSIndex < 0) { return FALSE; @@ -144,8 +175,9 @@ DPMSSupported(void) /* For each screen, check if DPMS is supported */ for (i = 0; i < xf86NumScreens; i++) { + pScrn = xf86Screens[i]; pDPMS = (DPMSPtr)screenInfo.screens[i]->devPrivates[DPMSIndex].ptr; - if (pDPMS && pDPMS->Set) + if (pDPMS && pScrn->DPMSSet) return TRUE; } return FALSE; diff --git a/hw/xfree86/common/xf86Date.h b/hw/xfree86/common/xf86Date.h index 506e05370..754e20d18 100644 --- a/hw/xfree86/common/xf86Date.h +++ b/hw/xfree86/common/xf86Date.h @@ -1,7 +1,33 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/xf86Date.h,v 1.3.2.3 2003/05/10 01:10:10 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/xf86Date.h,v 1.52 2003/11/21 06:01:44 dawes Exp $ */ +/* + * Copyright (c) 2003 by The XFree86 Project, 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 COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + * + * Except as contained in this notice, the name of the copyright holder(s) + * and author(s) shall not be used in advertising or otherwise to promote + * the sale, use or other dealings in this Software without prior written + * authorization from the copyright holder(s) and author(s). + */ #ifndef XF86_DATE -#define XF86_DATE "9 May 2003" +#define XF86_DATE "20 November 2003" #endif diff --git a/hw/xfree86/common/xf86Debug.c b/hw/xfree86/common/xf86Debug.c index b069743a1..3bf21689f 100644 --- a/hw/xfree86/common/xf86Debug.c +++ b/hw/xfree86/common/xf86Debug.c @@ -1,4 +1,35 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Debug.c,v 1.4 2001/12/13 18:01:50 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Debug.c,v 1.7 2003/09/24 02:43:17 dawes Exp $ */ + +/* + * Copyright (c) 2000-2003 by The XFree86 Project, 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 COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + * + * Except as contained in this notice, the name of the copyright holder(s) + * and author(s) shall not be used in advertising or otherwise to promote + * the sale, use or other dealings in this Software without prior written + * authorization from the copyright holder(s) and author(s). + */ + +#ifdef __UNIXOS2__ +#define I_NEED_OS2_H +#endif #include <sys/time.h> #include <unistd.h> @@ -154,7 +185,7 @@ xf86SPTimestamp(xf86TsPtr* timestamp, char *str) else diff = ((*timestamp)->sec - ts.tv_sec) * 1000 +(- ts.tv_usec + (*timestamp)->usec) / 1000; - ErrorF("%s Elapsed: %i\n",str,diff); + ErrorF("%s Elapsed: %li\n",str,diff); } else { *timestamp = xnfalloc(sizeof(xf86TsRec)); gettimeofday((struct timeval*)*timestamp,NULL); diff --git a/hw/xfree86/common/xf86DefModes.c b/hw/xfree86/common/xf86DefModes.c index abef13110..7257b204b 100644 --- a/hw/xfree86/common/xf86DefModes.c +++ b/hw/xfree86/common/xf86DefModes.c @@ -1,14 +1,17 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86DefModes.c,v 1.9 2002/11/11 04:24:40 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86DefModes.c,v 1.10 2003/11/03 05:11:02 tsi Exp $ */ /* THIS FILE IS AUTOMATICALLY GENERATED -- DO NOT EDIT -- LOOK at * modeline2c.pl */ /* - * Copyright 1999 by The XFree86 Project, Inc. + * Copyright 1999-2003 by The XFree86 Project, Inc. * * Author: Dirk Hohndel <hohndel@XFree86.Org> */ +#ifdef __UNIXOS2__ +#define I_NEED_OS2_H +#endif #include "xf86.h" #include "xf86Config.h" #include "xf86Priv.h" @@ -16,7 +19,7 @@ #include "globals.h" -#define MODEPREFIX(name) NULL, NULL, name, 0,M_T_DEFAULT +#define MODEPREFIX(name) NULL, NULL, name, MODE_OK, M_T_DEFAULT #define MODESUFFIX 0,0, 0,0,0,0,0,0,0, 0,0,0,0,0,0,FALSE,FALSE,0,NULL,0,0.0,0.0 DisplayModeRec xf86DefaultModes [] = { diff --git a/hw/xfree86/common/xf86DoProbe.c b/hw/xfree86/common/xf86DoProbe.c index 518f67214..eece97719 100644 --- a/hw/xfree86/common/xf86DoProbe.c +++ b/hw/xfree86/common/xf86DoProbe.c @@ -1,10 +1,34 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86DoProbe.c,v 1.11 2002/07/02 02:00:03 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86DoProbe.c,v 1.14 2003/10/29 04:17:21 dawes Exp $ */ /* - * finish setting up the server - * Load the driver modules and call their probe functions. + * Copyright (c) 1999-2002 by The XFree86 Project, 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: * - * Copyright 1999 by The XFree86 Project, Inc. + * 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 COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + * + * Except as contained in this notice, the name of the copyright holder(s) + * and author(s) shall not be used in advertising or otherwise to promote + * the sale, use or other dealings in this Software without prior written + * authorization from the copyright holder(s) and author(s). + */ + +/* + * finish setting up the server + * Load the driver modules and call their probe functions. */ #include <ctype.h> @@ -67,16 +91,14 @@ DoProbe() /* If we have a result, then call driver's Identify function */ if (xf86DriverList[i]->Identify != NULL) { - int verbose = xf86Verbose; - - xf86Verbose = 1; + int verbose = xf86SetVerbosity(1); (*xf86DriverList[i]->Identify)(0); - xf86Verbose = verbose; + xf86SetVerbosity(verbose); } } } - OsCleanup(); + OsCleanup(TRUE); AbortDDX(); fflush(stderr); exit(0); diff --git a/hw/xfree86/common/xf86DoScanPci.c b/hw/xfree86/common/xf86DoScanPci.c index 2328d2b05..8938c1d96 100644 --- a/hw/xfree86/common/xf86DoScanPci.c +++ b/hw/xfree86/common/xf86DoScanPci.c @@ -1,11 +1,34 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86DoScanPci.c,v 1.15 2003/09/23 06:43:46 dawes Exp $ */ +/* + * Copyright (c) 1999-2002 by The XFree86 Project, 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 COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + * + * Except as contained in this notice, the name of the copyright holder(s) + * and author(s) shall not be used in advertising or otherwise to promote + * the sale, use or other dealings in this Software without prior written + * authorization from the copyright holder(s) and author(s). + */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86DoScanPci.c,v 1.12 2002/07/15 20:46:01 dawes Exp $ */ /* * Finish setting up the server. * Call the functions from the scanpci module. - * - * Copyright 1999-2002 by The XFree86 Project, Inc. - * */ #include <ctype.h> @@ -38,11 +61,12 @@ void DoScanPci(int argc, char **argv, int i) OsInit(); /* - * now we decrease verbosity and remember the value, in case a later - * -verbose on the command line increases it, because that is a - * verbose flag for scanpci... + * The old verbosity processing that was here isn't useful anymore, but + * for compatibility purposes, ignore verbosity changes after the -scanpci + * flag. */ - globalVerbose = --xf86Verbose; + globalVerbose = xf86Verbose; + /* * next we process the arguments that are remaining on the command line, * so that things like the module path can be set there @@ -51,14 +75,19 @@ void DoScanPci(int argc, char **argv, int i) if ((skip = ddxProcessArgument(argc, argv, j))) j += (skip - 1); } + /* - * was the verbosity level increased? + * Was the verbosity level increased? If so, set it back. */ - if( (globalVerbose == 0) && (xf86Verbose > 0) ) - scanpciVerbose = xf86Verbose - globalVerbose -1; - else - scanpciVerbose = xf86Verbose - globalVerbose; - xf86Verbose = globalVerbose; + if (xf86Verbose > globalVerbose) + xf86SetVerbosity(globalVerbose); + + /* + * Setting scanpciVerbose to 0 will ensure that the output will go to + * stderr for all reasonable default stderr verbosity levels. + */ + scanpciVerbose = 0; + /* * now get the loader set up and load the scanpci module */ diff --git a/hw/xfree86/common/xf86Events.c b/hw/xfree86/common/xf86Events.c index 4d0efbcb9..1c3f3a34f 100644 --- a/hw/xfree86/common/xf86Events.c +++ b/hw/xfree86/common/xf86Events.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Events.c,v 3.146 2003/02/20 04:20:52 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Events.c,v 3.158 2003/11/03 05:11:02 tsi Exp $ */ /* * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany. * @@ -21,10 +21,41 @@ * PERFORMANCE OF THIS SOFTWARE. * */ +/* + * Copyright (c) 1994-2003 by The XFree86 Project, 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 COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + * + * Except as contained in this notice, the name of the copyright holder(s) + * and author(s) shall not be used in advertising or otherwise to promote + * the sale, use or other dealings in this Software without prior written + * authorization from the copyright holder(s) and author(s). + */ + /* $XConsortium: xf86Events.c /main/46 1996/10/25 11:36:30 kaleb $ */ /* [JCH-96/01/21] Extended std reverse map to four buttons. */ +#ifdef __UNIXOS2__ +#define I_NEED_OS2_H +#endif + #include "X.h" #include "Xpoll.h" #include "Xproto.h" @@ -315,10 +346,14 @@ xf86ProcessActionEvent(ActionEvent action, void *arg) CloseDownClient(server); } break; -#if !defined(__SOL8__) && (!defined(sun) || defined(i386)) +#if !defined(__SOL8__) && !defined(__UNIXOS2__) && !defined(sgi) && \ + (!defined(sun) || defined(i386)) case ACTION_SWITCHSCREEN: if (VTSwitchEnabled && !xf86Info.dontVTSwitch && arg) { int vtno = *((int *) arg); +#ifdef SCO + vtno--; +#endif #if defined(QNX4) xf86Info.vtRequestsPending = vtno; #else @@ -329,8 +364,12 @@ xf86ProcessActionEvent(ActionEvent action, void *arg) break; case ACTION_SWITCHSCREEN_NEXT: if (VTSwitchEnabled && !xf86Info.dontVTSwitch) { +#if defined(SCO) /* Shouldn't this be true for (sun) && (i386) && (SVR4) ? */ + if (ioctl(xf86Info.consoleFd, VT_ACTIVATE, xf86Info.vtno) < 0) +#else if (ioctl(xf86Info.consoleFd, VT_ACTIVATE, xf86Info.vtno + 1) < 0) -#if defined(SCO) || (defined(sun) && defined (i386) && defined (SVR4)) +#endif +#if defined (SCO) || (defined(sun) && defined (i386) && defined (SVR4)) if (ioctl(xf86Info.consoleFd, VT_ACTIVATE, 0) < 0) #else if (ioctl(xf86Info.consoleFd, VT_ACTIVATE, 1) < 0) @@ -339,12 +378,36 @@ xf86ProcessActionEvent(ActionEvent action, void *arg) } break; case ACTION_SWITCHSCREEN_PREV: - if (VTSwitchEnabled && !xf86Info.dontVTSwitch) { + if (VTSwitchEnabled && !xf86Info.dontVTSwitch && xf86Info.vtno > 0) { if (ioctl(xf86Info.consoleFd, VT_ACTIVATE, xf86Info.vtno - 1) < 0) ErrorF("Failed to switch consoles (%s)\n", strerror(errno)); } break; #endif + case ACTION_MESSAGE: + { + char *retstr, *message = (char *) arg; + ScrnInfoPtr pScr = XF86SCRNINFO(xf86Info.currentScreen); + +#ifdef DEBUG + ErrorF("ActionMessage: '%s'\n", message); +#endif + /* Okay the message made it to the ddx. The common layer */ + /* can check for relevant messages here and react to any */ + /* that have a global effect. For example: */ + /* */ + /* if (!strcmp(message, "foo") { */ + /* do_foo(); break */ + /* } */ + /* */ + /* otherwise fallback to sending a key event message to */ + /* the current screen's driver: */ + if (*pScr->HandleMessage) { + (void) (*pScr->HandleMessage)(pScr->scrnIndex, + "KeyEventMessage", message, &retstr); + } + } + break; default: break; } @@ -384,7 +447,7 @@ xf86PostKbdEvent(unsigned key) #if defined(SYSCONS_SUPPORT) || defined(PCVT_SUPPORT) || defined(WSCONS_SUPPORT) static Bool first_time = TRUE; #endif -#if defined(__sparc__) +#if defined(__sparc__) && defined(__linux__) static int kbdSun = -1; #endif /* Disable any keyboard processing while in suspend */ @@ -400,7 +463,7 @@ xf86PostKbdEvent(unsigned key) } #endif -#if defined (__sparc__) +#if defined (__sparc__) && defined(__linux__) if (kbdSun == -1) { if ((xf86Info.xkbmodel && !strcmp(xf86Info.xkbmodel, "sun")) || (xf86Info.xkbrules && !strcmp(xf86Info.xkbrules, "sun"))) @@ -410,26 +473,7 @@ xf86PostKbdEvent(unsigned key) } if (kbdSun) goto special; -#endif /* __sparc__ */ - -#if defined (i386) && defined (SVR4) - /* - * PANIX returns DICOP standards based keycodes in using 106jp - * keyboard. We need to remap some keys. - */ - if(xf86Info.panix106 == TRUE){ - switch (scanCode) { - case 0x56: scanCode = KEY_BSlash2; break; /* Backslash */ - case 0x5A: scanCode = KEY_NFER; break; /* No Kanji Transfer*/ - case 0x5B: scanCode = KEY_XFER; break; /* Kanji Tranfer */ - case 0x5C: scanCode = KEY_Yen; break; /* Yen curs pgup */ - case 0x6B: scanCode = KEY_Left; break; /* Cur Left */ - case 0x6F: scanCode = KEY_PgUp; break; /* Cur PageUp */ - case 0x72: scanCode = KEY_AltLang; break; /* AltLang(right) */ - case 0x73: scanCode = KEY_RCtrl; break; /* not needed */ - } - } -#endif /* i386 && SVR4 */ +#endif /* __sparc__ && __linux__ */ #ifdef __linux__ if (xf86Info.kbdCustomKeycodes) { @@ -461,6 +505,56 @@ xf86PostKbdEvent(unsigned key) break; #endif } +#if defined (i386) && defined (SVR4) + /* + * PANIX returns DICOP standards based keycodes in using 106jp + * keyboard. We need to remap some keys. + */ + if(xf86Info.panix106 == TRUE){ + switch (scanCode) { + case 0x56: scanCode = KEY_BSlash2; break; /* Backslash */ + case 0x5A: scanCode = KEY_NFER; break; /* No Kanji Transfer*/ + case 0x5B: scanCode = KEY_XFER; break; /* Kanji Tranfer */ + case 0x5C: scanCode = KEY_Yen; break; /* Yen curs pgup */ + case 0x6B: scanCode = KEY_Left; break; /* Cur Left */ + case 0x6F: scanCode = KEY_PgUp; break; /* Cur PageUp */ + case 0x72: scanCode = KEY_AltLang; break; /* AltLang(right) */ + case 0x73: scanCode = KEY_RCtrl; break; /* not needed */ + } + } else +#endif /* i386 && SVR4 */ + { + switch (scanCode) { + case 0x59: scanCode = KEY_0x59; break; + case 0x5a: scanCode = KEY_0x5A; break; + case 0x5b: scanCode = KEY_0x5B; break; + case 0x5c: scanCode = KEY_KP_Equal; break; /* Keypad Equal */ + case 0x5d: scanCode = KEY_0x5D; break; + case 0x5e: scanCode = KEY_0x5E; break; + case 0x5f: scanCode = KEY_0x5F; break; + case 0x62: scanCode = KEY_0x62; break; + case 0x63: scanCode = KEY_0x63; break; + case 0x64: scanCode = KEY_0x64; break; + case 0x65: scanCode = KEY_0x65; break; + case 0x66: scanCode = KEY_0x66; break; + case 0x67: scanCode = KEY_0x67; break; + case 0x68: scanCode = KEY_0x68; break; + case 0x69: scanCode = KEY_0x69; break; + case 0x6a: scanCode = KEY_0x6A; break; + case 0x6b: scanCode = KEY_0x6B; break; + case 0x6c: scanCode = KEY_0x6C; break; + case 0x6d: scanCode = KEY_0x6D; break; + case 0x6e: scanCode = KEY_0x6E; break; + case 0x6f: scanCode = KEY_0x6F; break; + case 0x70: scanCode = KEY_0x70; break; + case 0x71: scanCode = KEY_0x71; break; + case 0x72: scanCode = KEY_0x72; break; + case 0x73: scanCode = KEY_0x73; break; + case 0x74: scanCode = KEY_0x74; break; + case 0x75: scanCode = KEY_0x75; break; + case 0x76: scanCode = KEY_0x76; break; + } + } } else if ( @@ -534,6 +628,19 @@ xf86PostKbdEvent(unsigned key) scanCode = KEY_Pause; /* pause */ } +#ifndef __sparc64__ + /* + * PC keyboards generate separate key codes for + * Alt+Print and Control+Pause but in the X keyboard model + * they need to get the same key code as the base key on the same + * physical keyboard key. + */ + if (scanCode == KEY_SysReqest) + scanCode = KEY_Print; + else if (scanCode == KEY_Break) + scanCode = KEY_Pause; +#endif + /* * and now get some special keysequences */ @@ -568,7 +675,7 @@ customkeycodes: } } #endif -#if defined (__sparc__) +#if defined (__sparc__) && defined(__linux__) special: if (kbdSun) { switch (scanCode) { @@ -602,7 +709,7 @@ special: */ scanCode--; } -#endif /* defined (__sparc__) */ +#endif /* defined (__sparc__) && defined(__linux__) */ #ifdef XKB if ((xf86Info.ddxSpecialKeys == SKWhenNeeded && @@ -692,9 +799,6 @@ special: int vtno = specialkey - KEY_F1 + 1; if (specialkey == KEY_F11 || specialkey == KEY_F12) vtno = specialkey - KEY_F11 + 11; -#ifdef SCO325 - vtno--; -#endif if (down) xf86ProcessActionEvent(ACTION_SWITCHSCREEN, (void *) &vtno); return; @@ -829,17 +933,6 @@ special: #endif /* - * PC keyboards generate separate key codes for - * Alt+Print and Control+Pause but in the X keyboard model - * they need to get the same key code as the base key on the same - * physical keyboard key. - */ - if (scanCode == KEY_SysReqest) - scanCode = KEY_Print; - else if (scanCode == KEY_Break) - scanCode = KEY_Pause; - - /* * Now map the scancodes to real X-keycodes ... */ keycode = scanCode + MIN_KEYCODE; @@ -1060,16 +1153,16 @@ xf86Wakeup(pointer blockData, int err, pointer pReadmask) pInfo = xf86InputDevs; while (pInfo) { if (pInfo->read_input && pInfo->fd >= 0 && - (FD_ISSET(pInfo->fd, ((fd_set *)pReadmask)) != 0)) { + (FD_ISSET(pInfo->fd, &devicesWithInput) != 0)) { int sigstate = xf86BlockSIGIO(); pInfo->read_input(pInfo); xf86UnblockSIGIO(sigstate); /* - * Must break here because more than one device may share - * the same file descriptor. + * Remove the descriptior from the set because more than one + * device may share the same file descriptor. */ - break; + FD_CLR(pInfo->fd, &devicesWithInput); } pInfo = pInfo->next; } diff --git a/hw/xfree86/common/xf86Globals.c b/hw/xfree86/common/xf86Globals.c index 99c53fb0b..c6dee3731 100644 --- a/hw/xfree86/common/xf86Globals.c +++ b/hw/xfree86/common/xf86Globals.c @@ -1,7 +1,30 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Globals.c,v 1.40 2003/02/20 04:05:14 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Globals.c,v 1.41 2003/08/24 17:36:52 dawes Exp $ */ /* - * Copyright (c) 1997 by The XFree86 Project, Inc. + * Copyright (c) 1997-2003 by The XFree86 Project, 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 COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + * + * Except as contained in this notice, the name of the copyright holder(s) + * and author(s) shall not be used in advertising or otherwise to promote + * the sale, use or other dealings in this Software without prior written + * authorization from the copyright holder(s) and author(s). */ /* diff --git a/hw/xfree86/common/xf86Helper.c b/hw/xfree86/common/xf86Helper.c index 73050eab7..713e7861a 100644 --- a/hw/xfree86/common/xf86Helper.c +++ b/hw/xfree86/common/xf86Helper.c @@ -1,10 +1,36 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Helper.c,v 1.128 2003/02/26 23:45:24 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Helper.c,v 1.135 2003/10/08 14:58:27 dawes Exp $ */ /* - * Copyright (c) 1997-1998 by The XFree86 Project, Inc. + * Copyright (c) 1997-2003 by The XFree86 Project, 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 COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + * + * Except as contained in this notice, the name of the copyright holder(s) + * and author(s) shall not be used in advertising or otherwise to promote + * the sale, use or other dealings in this Software without prior written + * authorization from the copyright holder(s) and author(s). + */ + +/* * Authors: Dirk Hohndel <hohndel@XFree86.Org> * David Dawes <dawes@XFree86.Org> + * ... and others * * This file includes the helper functions that the server provides for * different drivers. @@ -38,7 +64,6 @@ #endif static int xf86ScrnInfoPrivateCount = 0; -static FILE *logfile = NULL; #ifdef XFree86LOADER @@ -405,6 +430,14 @@ xf86AddPixFormat(ScrnInfoPtr pScrn, int depth, int bpp, int pad) /* Can the screen handle 24bpp pixmaps for 32bpp fb */ #define DO_PIX24FOR32(f) ((f & Support32bppFb) && (f & SupportConvert24to32)) +#ifndef GLOBAL_DEFAULT_DEPTH +#define GLOBAL_DEFAULT_DEPTH 16 +#endif + +#ifndef GLOBAL_DEFAULT_FBBPP +#define GLOBAL_DEFAULT_FBBPP 16 +#endif + Bool xf86SetDepthBpp(ScrnInfoPtr scrp, int depth, int dummy, int fbbpp, int depth24flags) @@ -449,6 +482,39 @@ xf86SetDepthBpp(ScrnInfoPtr scrp, int depth, int dummy, int fbbpp, scrp->depth = scrp->confScreen->defaultdepth; scrp->depthFrom = X_CONFIG; } + + if (scrp->confScreen->defaultfbbpp <= 0 && + scrp->confScreen->defaultdepth <= 0) { + /* + * Check for DefaultDepth and DefaultFbBpp options in the + * Device sections. + */ + int i; + GDevPtr device; + Bool found = FALSE; + + for (i = 0; i < scrp->numEntities; i++) { + device = xf86GetDevFromEntity(scrp->entityList[i], + scrp->entityInstanceList[i]); + if (device && device->options) { + if (xf86FindOption(device->options, "DefaultDepth")) { + scrp->depth = xf86SetIntOption(device->options, + "DefaultDepth", -1); + scrp->depthFrom = X_CONFIG; + found = TRUE; + } + if (xf86FindOption(device->options, "DefaultFbBpp")) { + scrp->bitsPerPixel = xf86SetIntOption(device->options, + "DefaultFbBpp", + -1); + scrp->bitsPerPixelFrom = X_CONFIG; + found = TRUE; + } + } + if (found) + break; + } + } } /* If none of these is set, pick a default */ @@ -459,8 +525,8 @@ xf86SetDepthBpp(ScrnInfoPtr scrp, int depth, int dummy, int fbbpp, if (depth > 0) scrp->depth = depth; } else { - scrp->bitsPerPixel = 8; - scrp->depth = 8; + scrp->bitsPerPixel = GLOBAL_DEFAULT_FBBPP; + scrp->depth = GLOBAL_DEFAULT_DEPTH; } } @@ -610,11 +676,46 @@ xf86SetDepthBpp(ScrnInfoPtr scrp, int depth, int dummy, int fbbpp, break; } } + + /* + * If an exact match can't be found, see if there is one with no + * depth or fbbpp specified. + */ + if (i == scrp->confScreen->numdisplays) { + for (i = 0, disp = scrp->confScreen->displays; + i < scrp->confScreen->numdisplays; i++, disp++) { + if (disp->depth <= 0 && disp->fbbpp <= 0) { + scrp->display = disp; + break; + } + } + } + + /* + * If all else fails, create a default one. + */ if (i == scrp->confScreen->numdisplays) { - xf86DrvMsg(scrp->scrnIndex, X_ERROR, "No Display subsection " - "in Screen section \"%s\" for depth/fbbpp %d/%d\n", + scrp->confScreen->numdisplays++; + scrp->confScreen->displays = + xnfrealloc(scrp->confScreen->displays, + scrp->confScreen->numdisplays * sizeof(DispRec)); + xf86DrvMsg(scrp->scrnIndex, X_INFO, + "Creating default Display subsection in Screen section\n" + "\t\"%s\" for depth/fbbpp %d/%d\n", scrp->confScreen->id, scrp->depth, scrp->bitsPerPixel); - return FALSE; + memset(&scrp->confScreen->displays[i], 0, sizeof(DispRec)); + scrp->confScreen->displays[i].blackColour.red = -1; + scrp->confScreen->displays[i].blackColour.green = -1; + scrp->confScreen->displays[i].blackColour.blue = -1; + scrp->confScreen->displays[i].whiteColour.red = -1; + scrp->confScreen->displays[i].whiteColour.green = -1; + scrp->confScreen->displays[i].whiteColour.blue = -1; + scrp->confScreen->displays[i].defaultVisual = -1; + scrp->confScreen->displays[i].modes = xnfalloc(sizeof(char *)); + scrp->confScreen->displays[i].modes[0] = NULL; + scrp->confScreen->displays[i].depth = depth; + scrp->confScreen->displays[i].fbbpp = fbbpp; + scrp->display = &scrp->confScreen->displays[i]; } /* @@ -720,15 +821,17 @@ xf86SetWeight(ScrnInfoPtr scrp, rgb weight, rgb mask) if (scrp->weight.red) xf86DrvMsg(scrp->scrnIndex, weightFrom, "RGB weight %d%d%d\n", - scrp->weight.red, scrp->weight.green, scrp->weight.blue); + (int)scrp->weight.red, (int)scrp->weight.green, + (int)scrp->weight.blue); if (scrp->depth > MAX_PSEUDO_DEPTH && (scrp->depth != scrp->weight.red + scrp->weight.green + scrp->weight.blue)) { xf86DrvMsg(scrp->scrnIndex, X_ERROR, "Weight given (%d%d%d) is inconsistent with the " - "depth (%d)\n", scrp->weight.red, scrp->weight.green, - scrp->weight.blue, scrp->depth); + "depth (%d)\n", + (int)scrp->weight.red, (int)scrp->weight.green, + (int)scrp->weight.blue, scrp->depth); return FALSE; } if (scrp->depth > MAX_PSEUDO_DEPTH && scrp->weight.red) { @@ -1194,123 +1297,36 @@ xf86EnableDisableFBAccess(int scrnIndex, Bool enable) } } -/* Buffer to hold log data written before the log file is opened */ -static char *saveBuffer = NULL; -static int size = 0, unused = 0, pos = 0; - -/* These functions do the actual writes. */ -static void -VWrite(int verb, const char *f, va_list args) -{ - static char buffer[1024]; - int len = 0; - - /* - * Since a va_list can only be processed once, write the string to a - * buffer, and then write the buffer out to the appropriate output - * stream(s). - */ - if (verb < 0 || xf86LogVerbose >= verb || xf86Verbose >= verb) { - vsnprintf(buffer, sizeof(buffer), f, args); - len = strlen(buffer); - } - if ((verb < 0 || xf86Verbose >= verb) && len > 0) - fwrite(buffer, len, 1, stderr); - if ((verb < 0 || xf86LogVerbose >= verb) && len > 0) { - if (logfile) { - fwrite(buffer, len, 1, logfile); - if (xf86Info.log) { - fflush(logfile); - if (xf86Info.log == LogSync) - fsync(fileno(logfile)); - } - } else { - /* - * Note, this code is used before OsInit() has been called, so - * xalloc and friends can't be used. - */ - if (len > unused) { - size += 1024; - unused += 1024; - saveBuffer = realloc(saveBuffer, size); - if (!saveBuffer) - FatalError("realloc() failed while saving log messages\n"); - } - unused -= len; - memcpy(saveBuffer + pos, buffer, len); - pos += len; - } - } -} - -static void -Write(int verb, const char *f, ...) -{ - va_list args; - - va_start(args, f); - VWrite(verb, f, args); - va_end(args); -} - /* Print driver messages in the standard format */ +#undef PREFIX_SIZE +#define PREFIX_SIZE 14 + void xf86VDrvMsgVerb(int scrnIndex, MessageType type, int verb, const char *format, va_list args) { - char *s = X_UNKNOWN_STRING; - - /* Ignore verbosity for X_ERROR */ - if (xf86Verbose >= verb || xf86LogVerbose >= verb || type == X_ERROR) { - switch (type) { - case X_PROBED: - s = X_PROBE_STRING; - break; - case X_CONFIG: - s = X_CONFIG_STRING; - break; - case X_DEFAULT: - s = X_DEFAULT_STRING; - break; - case X_CMDLINE: - s = X_CMDLINE_STRING; - break; - case X_NOTICE: - s = X_NOTICE_STRING; - break; - case X_ERROR: - s = X_ERROR_STRING; - if (verb > 0) - verb = 0; - break; - case X_WARNING: - s = X_WARNING_STRING; - break; - case X_INFO: - s = X_INFO_STRING; - break; - case X_NOT_IMPLEMENTED: - s = X_NOT_IMPLEMENTED_STRING; - break; - case X_NONE: - s = NULL; - break; - } + char *tmpFormat; - if (s != NULL) - Write(verb, "%s ", s); - if (scrnIndex >= 0 && scrnIndex < xf86NumScreens) - Write(verb, "%s(%d): ", xf86Screens[scrnIndex]->name, scrnIndex); - VWrite(verb, format, args); -#if 0 - if (type == X_ERROR && xf86Verbose < xf86LogVerbose) { - fprintf(stderr, X_ERROR_STRING " Please check the log file \"%s\"" - " >before<\n\treporting a problem.\n", xf86LogFile); - } -#endif - } + /* Prefix the scrnIndex name to the format string. */ + if (scrnIndex >= 0 && scrnIndex < xf86NumScreens && + xf86Screens[scrnIndex]->name) { + tmpFormat = xalloc(strlen(format) + + strlen(xf86Screens[scrnIndex]->name) + + PREFIX_SIZE + 1); + if (!tmpFormat) + return; + + snprintf(tmpFormat, PREFIX_SIZE + 1, "%s(%d): ", + xf86Screens[scrnIndex]->name, scrnIndex); + + strcat(tmpFormat, format); + LogVMessageVerb(type, verb, tmpFormat, args); + xfree(tmpFormat); + } else + LogVMessageVerb(type, verb, format, args); } +#undef PREFIX_SIZE /* Print driver messages, with verbose level specified directly */ void @@ -1365,7 +1381,7 @@ xf86ErrorFVerb(int verb, const char *format, ...) va_start(ap, format); if (xf86Verbose >= verb || xf86LogVerbose >= verb) - VWrite(verb, format, ap); + LogVWrite(verb, format, ap); va_end(ap); } @@ -1377,15 +1393,10 @@ xf86ErrorF(const char *format, ...) va_start(ap, format); if (xf86Verbose >= 1 || xf86LogVerbose >= 1) - VWrite(1, format, ap); + LogVWrite(1, format, ap); va_end(ap); } -void -OsVendorVErrorF(const char *f, va_list args) -{ - VWrite(-1, f, args); -} void xf86LogInit() @@ -1398,59 +1409,28 @@ xf86LogInit() /* Get the log file name */ if (xf86LogFileFrom == X_DEFAULT) { /* Append the display number and ".log" */ - lf = malloc(strlen(xf86LogFile) + strlen(display) + + lf = malloc(strlen(xf86LogFile) + strlen("%s") + strlen(LOGSUFFIX) + 1); if (!lf) FatalError("Cannot allocate space for the log file name\n"); - sprintf(lf, "%s%s" LOGSUFFIX, xf86LogFile, display); + sprintf(lf, "%s%%s" LOGSUFFIX, xf86LogFile); xf86LogFile = lf; } - { - struct stat buf; - if (!stat(xf86LogFile,&buf) && S_ISREG(buf.st_mode)) { - char *oldlog = (char *)malloc(strlen(xf86LogFile) - + strlen(LOGOLDSUFFIX)); - if (!oldlog) - FatalError("Cannot allocate space for the log file name\n"); - sprintf(oldlog, "%s" LOGOLDSUFFIX, xf86LogFile); - if (rename(xf86LogFile,oldlog) == -1) - FatalError("Cannot move old logfile \"%s\"\n",oldlog); - free(oldlog); - } - } - - if ((logfile = fopen(xf86LogFile, "w")) == NULL) - FatalError("Cannot open log file \"%s\"\n", xf86LogFile); + + xf86LogFile = LogInit(xf86LogFile, LOGOLDSUFFIX); xf86LogFileWasOpened = TRUE; - setvbuf(logfile, NULL, _IONBF, 0); -#ifdef DDXOSVERRORF - if (!OsVendorVErrorFProc) - OsVendorVErrorFProc = OsVendorVErrorF; -#endif - /* Flush saved log information */ - if (saveBuffer && size > 0) { - fwrite(saveBuffer, pos, 1, logfile); - if (xf86Info.log) { - fflush(logfile); - if (xf86Info.log == LogFlush) - fsync(fileno(logfile)); - } - free(saveBuffer); /* Note, must be free(), not xfree() */ - saveBuffer = 0; - size = 0; - } + xf86SetVerbosity(xf86Verbose); + xf86SetLogVerbosity(xf86LogVerbose); #undef LOGSUFFIX +#undef LOGOLDSUFFIX } void xf86CloseLog() { - if (logfile) { - fclose(logfile); - logfile = NULL; - } + LogClose(); } @@ -1826,7 +1806,7 @@ xf86MatchPciInstances(const char *driverName, int vendorID, if (dev || devBus) xf86MsgVerb(X_WARNING, 0, "%s: More than one matching Device section " - "found: %s\n", devList[j]->identifier); + "found: %s\n", driverName, devList[j]->identifier); else dev = devList[j]; } @@ -2233,7 +2213,6 @@ xf86GetVerbosity() return max(xf86Verbose, xf86LogVerbose); } - Pix24Flags xf86GetPix24() { diff --git a/hw/xfree86/common/xf86InPriv.h b/hw/xfree86/common/xf86InPriv.h index 5cd66d882..32e3c8e1d 100644 --- a/hw/xfree86/common/xf86InPriv.h +++ b/hw/xfree86/common/xf86InPriv.h @@ -1,4 +1,31 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86InPriv.h,v 1.4 1999/05/17 13:17:14 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86InPriv.h,v 1.5 2003/08/24 17:36:52 dawes Exp $ */ + +/* + * Copyright (c) 1999 by The XFree86 Project, 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 COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + * + * Except as contained in this notice, the name of the copyright holder(s) + * and author(s) shall not be used in advertising or otherwise to promote + * the sale, use or other dealings in this Software without prior written + * authorization from the copyright holder(s) and author(s). + */ #ifndef _xf86InPriv_h #define _xf86InPriv_h diff --git a/hw/xfree86/common/xf86Init.c b/hw/xfree86/common/xf86Init.c index 7c65ce888..ce8817096 100644 --- a/hw/xfree86/common/xf86Init.c +++ b/hw/xfree86/common/xf86Init.c @@ -1,16 +1,49 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Init.c,v 3.198 2003/02/26 09:21:38 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Init.c,v 3.211 2003/11/01 00:47:01 dawes Exp $ */ /* - * Copyright 1991-1999 by The XFree86 Project, Inc. - * * Loosely based on code bearing the following copyright: * * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany. */ +/* + * Copyright (c) 1992-2003 by The XFree86 Project, 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 COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + * + * Except as contained in this notice, the name of the copyright holder(s) + * and author(s) shall not be used in advertising or otherwise to promote + * the sale, use or other dealings in this Software without prior written + * authorization from the copyright holder(s) and author(s). + */ #include <stdlib.h> +#undef HAS_UTSNAME +#if !defined(WIN32) && !defined(__UNIXOS2__) +#define HAS_UTSNAME 1 +#include <sys/utsname.h> +#endif + #define NEED_EVENTS +#ifdef __UNIXOS2__ +#define I_NEED_OS2_H +#endif #include "X.h" #include "Xmd.h" #include "Xproto.h" @@ -134,7 +167,8 @@ xf86CreateRootWindow(WindowPtr pWin) /* Can't find hook we are hung on */ xf86DrvMsg(pScreen->myNum, X_WARNING /* X_ERROR */, "xf86CreateRootWindow %p called when not in pScreen->CreateWindow %p n", - xf86CreateRootWindow, pScreen->CreateWindow ); + (void *)xf86CreateRootWindow, + (void *)pScreen->CreateWindow ); } /* Unhook this function ... */ @@ -183,7 +217,8 @@ xf86CreateRootWindow(WindowPtr pWin) xf86RegisteredPropertiesTable[pScreen->myNum] = NULL; } else { xf86Msg(X_ERROR, "xf86CreateRootWindow unexpectedly called with " - "non-root window %p (parent %p)\n", pWin, pWin->parent); + "non-root window %p (parent %p)\n", + (void *)pWin, (void *)pWin->parent); ret = FALSE; } } @@ -202,6 +237,46 @@ xf86CreateRootWindow(WindowPtr pWin) * collecting the pixmap formats. */ +static void +PostConfigInit(void) +{ + /* + * Install signal handler for unexpected signals + */ + xf86Info.caughtSignal=FALSE; + if (!xf86Info.notrapSignals) { + signal(SIGSEGV,xf86SigHandler); + signal(SIGILL,xf86SigHandler); +#ifdef SIGEMT + signal(SIGEMT,xf86SigHandler); +#endif + signal(SIGFPE,xf86SigHandler); +#ifdef SIGBUS + signal(SIGBUS,xf86SigHandler); +#endif +#ifdef SIGSYS + signal(SIGSYS,xf86SigHandler); +#endif +#ifdef SIGXCPU + signal(SIGXCPU,xf86SigHandler); +#endif +#ifdef SIGXFSZ + signal(SIGXFSZ,xf86SigHandler); +#endif +#ifdef MEMDEBUG + signal(SIGUSR2,xf86SigMemDebug); +#endif + } + + xf86OSPMClose = xf86OSPMOpen(); + + /* Run an external VT Init program if specified in the config file */ + xf86RunVtInit(); + + /* Do this after XF86Config is read (it's normally in OsInit()) */ + OsInitColors(); +} + void InitOutput(ScreenInfo *pScreenInfo, int argc, char **argv) { @@ -215,6 +290,7 @@ InitOutput(ScreenInfo *pScreenInfo, int argc, char **argv) Pix24Flags screenpix24, pix24; MessageType pix24From = X_DEFAULT; Bool pix24Fail = FALSE; + Bool autoconfig = FALSE; #ifdef __UNIXOS2__ os2ServerVideoAccess(); /* See if we have access to the screen before doing anything */ @@ -257,51 +333,20 @@ InitOutput(ScreenInfo *pScreenInfo, int argc, char **argv) /* Read and parse the config file */ if (!xf86DoProbe && !xf86DoConfigure) { - if (!xf86HandleConfigFile()) { - xf86Msg(X_ERROR, "Error from xf86HandleConfigFile()\n"); + switch (xf86HandleConfigFile(FALSE)) { + case CONFIG_OK: + break; + case CONFIG_PARSE_ERROR: + xf86Msg(X_ERROR, "Error parsing the config file\n"); return; + case CONFIG_NOFILE: + autoconfig = TRUE; + break; } } - /* - * Install signal handler for unexpected signals - */ - xf86Info.caughtSignal=FALSE; - if (!xf86Info.notrapSignals) { - signal(SIGSEGV,xf86SigHandler); - signal(SIGILL,xf86SigHandler); -#ifdef SIGEMT - signal(SIGEMT,xf86SigHandler); -#endif - signal(SIGFPE,xf86SigHandler); -#ifdef SIGBUS - signal(SIGBUS,xf86SigHandler); -#endif -#ifdef SIGSYS - signal(SIGSYS,xf86SigHandler); -#endif -#ifdef SIGXCPU - signal(SIGXCPU,xf86SigHandler); -#endif -#ifdef SIGXFSZ - signal(SIGXFSZ,xf86SigHandler); -#endif -#ifdef MEMDEBUG - signal(SIGUSR2,xf86SigMemDebug); -#endif - } - - xf86OpenConsole(); - xf86OSPMClose = xf86OSPMOpen(); - - /* Run an external VT Init program if specified in the config file */ - xf86RunVtInit(); - - /* Do this after XF86Config is read (it's normally in OsInit()) */ - OsInitColors(); - - /* Enable full I/O access */ - xf86EnableIO(); + if (!autoconfig) + PostConfigInit(); #ifdef XFree86LOADER /* Initialise the loader */ @@ -349,6 +394,11 @@ InitOutput(ScreenInfo *pScreenInfo, int argc, char **argv) #endif + xf86OpenConsole(); + + /* Enable full I/O access */ + xf86EnableIO(); + /* Do a general bus probe. This will be a PCI probe for x86 platforms */ xf86BusProbe(); @@ -358,6 +408,14 @@ InitOutput(ScreenInfo *pScreenInfo, int argc, char **argv) if (xf86DoConfigure) DoConfigure(); + if (autoconfig) { + if (!xf86AutoConfig()) { + xf86Msg(X_ERROR, "Auto configuration failed\n"); + return; + } + PostConfigInit(); + } + /* Initialise the resource broker */ xf86ResourceBrokerInit(); @@ -597,7 +655,7 @@ InitOutput(ScreenInfo *pScreenInfo, int argc, char **argv) /* XXX Should this be before or after loading dependent modules? */ if (xf86ProbeOnly) { - OsCleanup(); + OsCleanup(TRUE); AbortDDX(); fflush(stderr); exit(0); @@ -743,7 +801,7 @@ InitOutput(ScreenInfo *pScreenInfo, int argc, char **argv) if (xf86OSPMClose) xf86OSPMClose(); if ((xf86OSPMClose = xf86OSPMOpen()) != NULL) - xf86MsgVerb(3,X_INFO,"APM registered successfully\n"); + xf86MsgVerb(X_INFO, 3, "APM registered successfully\n"); /* Make sure full I/O access is enabled */ xf86EnableIO(); @@ -825,6 +883,9 @@ InitOutput(ScreenInfo *pScreenInfo, int argc, char **argv) */ xf86Screens[i]->EnableDisableFBAccess = xf86EnableDisableFBAccess; xf86Screens[i]->SetDGAMode = xf86SetDGAMode; + xf86Screens[i]->DPMSSet = NULL; + xf86Screens[i]->LoadPalette = NULL; + xf86Screens[i]->SetOverscan = NULL; scr_index = AddScreen(xf86Screens[i]->ScreenInit, argc, argv); if (scr_index == i) { /* @@ -1198,6 +1259,26 @@ OsVendorFatalError() ErrorF("\n"); } +int +xf86SetVerbosity(int verb) +{ + int save = xf86Verbose; + + xf86Verbose = verb; + LogSetParameter(XLOG_VERBOSITY, verb); + return save; +} + +int +xf86SetLogVerbosity(int verb) +{ + int save = xf86LogVerbose; + + xf86LogVerbose = verb; + LogSetParameter(XLOG_FILE_VERBOSITY, verb); + return save; +} + /* * ddxProcessArgument -- * Process device-dependent command line args. Returns 0 if argument is @@ -1217,19 +1298,6 @@ ddxProcessArgument(int argc, char **argv, int i) * yet. Use malloc/free instead. */ -#ifdef DDXOSVERRORF - static Bool beenHere = FALSE; - - if (!beenHere) { - /* - * This initialises our hook into VErrorF() for catching log messages - * that are generated before OsInit() is called. - */ - OsVendorVErrorFProc = OsVendorVErrorF; - beenHere = TRUE; - } -#endif - /* First the options that are only allowed for root */ if (getuid() == 0) { @@ -1346,11 +1414,11 @@ ddxProcessArgument(int argc, char **argv, int i) val = strtol(argv[i], &end, 0); if (*end == '\0') { - xf86Verbose = val; + xf86SetVerbosity(val); return 2; } } - xf86Verbose++; + xf86SetVerbosity(++xf86Verbose); return 1; } if (!strcmp(argv[i],"-logverbose")) @@ -1362,16 +1430,16 @@ ddxProcessArgument(int argc, char **argv, int i) val = strtol(argv[i], &end, 0); if (*end == '\0') { - xf86LogVerbose = val; + xf86SetLogVerbosity(val); return 2; } } - xf86LogVerbose++; + xf86SetLogVerbosity(++xf86LogVerbose); return 1; } if (!strcmp(argv[i],"-quiet")) { - xf86Verbose = 0; + xf86SetVerbosity(0); return 1; } if (!strcmp(argv[i],"-showconfig") || !strcmp(argv[i],"-version")) @@ -1659,7 +1727,17 @@ xf86PrintBanner() ErrorF("X Protocol Version %d, Revision %d, %s\n", X_PROTOCOL, X_PROTOCOL_REVISION, XORG_RELEASE ); ErrorF("Build Operating System:%s%s\n", OSNAME, OSVENDOR); -#ifdef BUILD_DATE +#ifdef HAS_UTSNAME + { + struct utsname name; + + if (uname(&name) == 0) { + ErrorF("Current Operating System: %s %s %s %s %s\n", + name.sysname, name.nodename, name.release, name.version, name.machine); + } + } +#endif +#if defined(BUILD_DATE) && (BUILD_DATE > 19000000) { struct tm t; char buf[100]; @@ -1673,6 +1751,20 @@ xf86PrintBanner() ErrorF("Build Date: %s\n", buf); } #endif +#if defined(CLOG_DATE) && (CLOG_DATE > 19000000) + { + struct tm t; + char buf[100]; + + bzero(&t, sizeof(t)); + bzero(buf, sizeof(buf)); + t.tm_mday = CLOG_DATE % 100; + t.tm_mon = (CLOG_DATE / 100) % 100 - 1; + t.tm_year = CLOG_DATE / 10000 - 1900; + if (strftime(buf, sizeof(buf), "%d %B %Y", &t)) + ErrorF("Changelog Date: %s\n", buf); + } +#endif #if defined(BUILDERSTRING) ErrorF("%s \n",BUILDERSTRING); #endif @@ -1686,17 +1778,7 @@ xf86PrintBanner() static void xf86PrintMarkers() { - /* Show what the marker symbols mean */ - ErrorF("Markers: " X_PROBE_STRING " probed, " - X_CONFIG_STRING " from config file, " - X_DEFAULT_STRING " default setting,\n" - " " X_CMDLINE_STRING " from command line, " - X_NOTICE_STRING " notice, " - X_INFO_STRING " informational,\n" - " " X_WARNING_STRING " warning, " - X_ERROR_STRING " error, " - X_NOT_IMPLEMENTED_STRING " not implemented, " - X_UNKNOWN_STRING " unknown.\n"); + LogPrintMarkers(); } static void diff --git a/hw/xfree86/common/xf86Io.c b/hw/xfree86/common/xf86Io.c index 06819bccf..bd44bdeb5 100644 --- a/hw/xfree86/common/xf86Io.c +++ b/hw/xfree86/common/xf86Io.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Io.c,v 3.53 2003/01/15 03:29:05 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Io.c,v 3.56 2003/11/03 05:11:02 tsi Exp $ */ /* * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany. * @@ -21,6 +21,33 @@ * PERFORMANCE OF THIS SOFTWARE. * */ +/* + * Copyright (c) 1992-2003 by The XFree86 Project, 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 COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + * + * Except as contained in this notice, the name of the copyright holder(s) + * and author(s) shall not be used in advertising or otherwise to promote + * the sale, use or other dealings in this Software without prior written + * authorization from the copyright holder(s) and author(s). + */ + /* $XConsortium: xf86Io.c /main/27 1996/10/19 17:58:55 kaleb $ */ #define NEED_EVENTS @@ -88,7 +115,7 @@ xf86KbdLeds () { int leds, real_leds = 0; -#if defined (__sparc__) +#if defined (__sparc__) && defined(__linux__) static int kbdSun = -1; if (kbdSun == -1) { if ((xf86Info.xkbmodel && !strcmp(xf86Info.xkbmodel, "sun")) || @@ -122,7 +149,7 @@ xf86KbdLeds () #endif #endif xf86SetKbdLeds(real_leds); - return; + (void)leds; } /* @@ -264,6 +291,7 @@ Bool init; #endif /* INHERIT_LOCK_STATE */ xf86SetKbdLeds(leds); #endif /* LED_CAP */ + (void)leds; if (xf86Info.kbdDelay <= 375) rad = 0x00; else if (xf86Info.kbdDelay <= 625) rad = 0x20; diff --git a/hw/xfree86/common/xf86Kbd.c b/hw/xfree86/common/xf86Kbd.c index c1ad79778..3c7ed7a69 100644 --- a/hw/xfree86/common/xf86Kbd.c +++ b/hw/xfree86/common/xf86Kbd.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Kbd.c,v 3.24 2002/05/31 18:45:58 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Kbd.c,v 3.26 2003/08/24 17:36:53 dawes Exp $ */ /* * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany. * @@ -21,8 +21,39 @@ * PERFORMANCE OF THIS SOFTWARE. * */ +/* + * Copyright (c) 1992-2003 by The XFree86 Project, 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 COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + * + * Except as contained in this notice, the name of the copyright holder(s) + * and author(s) shall not be used in advertising or otherwise to promote + * the sale, use or other dealings in this Software without prior written + * authorization from the copyright holder(s) and author(s). + */ + /* $XConsortium: xf86Kbd.c /main/10 1996/02/21 17:38:32 kaleb $ */ +#ifdef __UNIXOS2__ +#define I_NEED_OS2_H +#endif + #include "X.h" #include "Xmd.h" #include "input.h" diff --git a/hw/xfree86/common/xf86KbdBSD.c b/hw/xfree86/common/xf86KbdBSD.c index a606b14fb..2621e2a81 100644 --- a/hw/xfree86/common/xf86KbdBSD.c +++ b/hw/xfree86/common/xf86KbdBSD.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86KbdBSD.c,v 3.20 2002/05/22 21:38:27 herrb Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86KbdBSD.c,v 3.22 2003/10/07 22:00:52 herrb Exp $ */ /* * Derived from xf86Kbd.c by S_ren Schmidt (sos@login.dkuug.dk) * which is Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany. @@ -22,6 +22,33 @@ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR * PERFORMANCE OF THIS SOFTWARE. */ +/* + * Copyright (c) 1994-2002 by The XFree86 Project, 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 COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + * + * Except as contained in this notice, the name of the copyright holder(s) + * and author(s) shall not be used in advertising or otherwise to promote + * the sale, use or other dealings in this Software without prior written + * authorization from the copyright holder(s) and author(s). + */ + /* $XConsortium: xf86KbdBSD.c /main/6 1996/10/23 13:12:27 kaleb $ */ #include "X.h" @@ -1057,6 +1084,8 @@ static CARD8 wsAdbMap[] = { /* 223 */ KEY_NOTUSED, }; +#define WS_ADB_MAP_SIZE (sizeof(wsAdbMap)/sizeof(unsigned char)) + static CARD8 wsSunMap[] = { /* 0x00 */ KEY_NOTUSED, /* 0x01 */ KEY_NOTUSED, /* stop */ @@ -1190,9 +1219,6 @@ static CARD8 wsSunMap[] = { #define WS_SUN_MAP_SIZE (sizeof(wsSunMap)/sizeof(unsigned char)) - -#define WS_ADB_MAP_SIZE (sizeof(wsAdbMap)/sizeof(unsigned char)) - /* * Translate raw wskbd keyboard event values to XFree86 standard keycodes * (based on the AT keyboard scan codes using the tables above @@ -1210,7 +1236,7 @@ WSKbdToKeycode(int keycode) return KEY_UNKNOWN; else return wsUsbMap[keycode]; -#ifdef WSKBD_TYPE_ADB +#ifdef WSKBD_TYPE_ADB case WSKBD_TYPE_ADB: if (keycode < 0 || keycode >= WS_ADB_MAP_SIZE) return KEY_UNKNOWN; @@ -1219,6 +1245,9 @@ WSKbdToKeycode(int keycode) #endif #ifdef WSKBD_TYPE_SUN case WSKBD_TYPE_SUN: +#ifdef WSKBD_TYPE_SUN5 + case WSKBD_TYPE_SUN5: +#endif if (keycode < 0 || keycode >= WS_SUN_MAP_SIZE) return KEY_UNKNOWN; else diff --git a/hw/xfree86/common/xf86KbdLnx.c b/hw/xfree86/common/xf86KbdLnx.c index 1f97c0b15..b023acfbd 100644 --- a/hw/xfree86/common/xf86KbdLnx.c +++ b/hw/xfree86/common/xf86KbdLnx.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86KbdLnx.c,v 3.16 2001/03/05 20:18:20 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86KbdLnx.c,v 3.17 2003/08/24 17:36:53 dawes Exp $ */ /* * Linux version of keymapping setup. The kernel (since 0.99.14) has support * for fully remapping the keyboard, but there are some differences between @@ -28,6 +28,33 @@ * PERFORMANCE OF THIS SOFTWARE. * */ +/* + * Copyright (c) 1994-2001 by The XFree86 Project, 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 COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + * + * Except as contained in this notice, the name of the copyright holder(s) + * and author(s) shall not be used in advertising or otherwise to promote + * the sale, use or other dealings in this Software without prior written + * authorization from the copyright holder(s) and author(s). + */ + /* $XConsortium: xf86KbdLnx.c /main/7 1996/10/19 17:59:00 kaleb $ */ #include "X.h" diff --git a/hw/xfree86/common/xf86Keymap.h b/hw/xfree86/common/xf86Keymap.h index 45f4dd104..82ea52eef 100644 --- a/hw/xfree86/common/xf86Keymap.h +++ b/hw/xfree86/common/xf86Keymap.h @@ -1,4 +1,32 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Keymap.h,v 3.19 2002/05/31 18:45:58 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Keymap.h,v 3.20 2003/08/24 17:36:53 dawes Exp $ */ + +/* + * Copyright (c) 1994-2002 by The XFree86 Project, 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 COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + * + * Except as contained in this notice, the name of the copyright holder(s) + * and author(s) shall not be used in advertising or otherwise to promote + * the sale, use or other dealings in this Software without prior written + * authorization from the copyright holder(s) and author(s). + */ + /* * * For Scancodes see notes in atKeynames.h !!!! diff --git a/hw/xfree86/common/xf86MiscExt.c b/hw/xfree86/common/xf86MiscExt.c index f04a0b8d8..a36ca52f2 100644 --- a/hw/xfree86/common/xf86MiscExt.c +++ b/hw/xfree86/common/xf86MiscExt.c @@ -1,13 +1,40 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86MiscExt.c,v 1.16 2003/11/03 05:11:02 tsi Exp $ */ /* - * Copyright (c) 1999 by The XFree86 Project, Inc. + * Copyright (c) 1999-2003 by The XFree86 Project, 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 COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + * + * Except as contained in this notice, the name of the copyright holder(s) + * and author(s) shall not be used in advertising or otherwise to promote + * the sale, use or other dealings in this Software without prior written + * authorization from the copyright holder(s) and author(s). */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86MiscExt.c,v 1.11 2002/11/20 04:04:57 dawes Exp $ */ /* * This file contains the Pointer/Keyboard functions needed by the * XFree86-Misc extension. */ +#ifdef __UNIXOS2__ +#define I_NEED_OS2_H +#endif + #include "X.h" #include "os.h" #include "xf86.h" @@ -62,31 +89,17 @@ typedef struct { int serverNumLock; /* obsolete */ } kbdParamsRec, *kbdParamsPtr; -typedef enum { - TO_MISC, - FROM_MISC -} MseProtoMapDirection; - -static void MiscExtClientStateCallback(pointer, pointer, pointer); - /* Sigh... The extension should probably be changed to use protocol names instead of ID numbers */ -struct mouse_map { +static struct mouse_map { int mtype; MouseProtocolID proto; -}; - -static int -MapMseProto(int proto, MseProtoMapDirection mapping) +} m_map[] = { - int i; - - static struct mouse_map m_map[] = - { { MTYPE_MICROSOFT, PROT_MS }, { MTYPE_MOUSESYS, PROT_MSC }, { MTYPE_MMSERIES, PROT_MM }, @@ -109,17 +122,30 @@ MapMseProto(int proto, MseProtoMapDirection mapping) { MTYPE_AUTOMOUSE, PROT_AUTO }, { MTYPE_SYSMOUSE, PROT_SYSMOUSE }, { MTYPE_UNKNOWN, PROT_UNKNOWN } - }; +}; + +static int +MapMseProtoToMisc(MouseProtocolID proto) +{ + int i; - if (mapping == TO_MISC) { for (i = 0; m_map[i].proto != PROT_UNKNOWN; i++) - if (proto == m_map[i].proto) return m_map[i].mtype; + if (proto == m_map[i].proto) + return m_map[i].mtype; + return MTYPE_UNKNOWN; - } else { +} + +static MouseProtocolID +MapMseMiscToProto(int proto) +{ + int i; + for (i = 0; m_map[i].mtype != MTYPE_UNKNOWN; i++) - if (proto == m_map[i].mtype) return m_map[i].proto; + if (proto == m_map[i].mtype) + return m_map[i].proto; + return PROT_UNKNOWN; - } } Bool @@ -140,7 +166,7 @@ MiscExtGetMouseSettings(pointer *mouse, char **devname) *devname = xf86FindOptionValue(pInfo->options, "Device"); pMse = pInfo->private; - mseptr->type = MapMseProto(pMse->protocolID, TO_MISC); + mseptr->type = MapMseProtoToMisc(pMse->protocolID); mseptr->baudrate = pMse->baudRate; mseptr->samplerate = pMse->sampleRate; mseptr->resolution = pMse->resolution; @@ -279,7 +305,8 @@ MiscExtSetKbdValue(pointer keyboard, MiscExtKbdValType valtype, int value) } static void -MiscExtClientStateCallback(pointer callbacks, pointer data, pointer args) +MiscExtClientStateCallback(CallbackListPtr *callbacks, + pointer data, pointer args) { NewClientInfoRec *clientinfo = (NewClientInfoRec*)args; @@ -287,8 +314,7 @@ MiscExtClientStateCallback(pointer callbacks, pointer data, pointer args) clientinfo->client->clientState == ClientStateGone) { xf86Info.grabInfo.override = NULL; xf86Info.grabInfo.disabled = 0; - DeleteCallback(&ClientStateCallback, - (CallbackProcPtr)MiscExtClientStateCallback, NULL); + DeleteCallback(&ClientStateCallback, MiscExtClientStateCallback, NULL); } } @@ -307,13 +333,13 @@ MiscExtSetGrabKeysState(ClientPtr client, int state) if (state == 0 && xf86Info.grabInfo.disabled == 0) { xf86Info.grabInfo.disabled = 1; AddCallback(&ClientStateCallback, - (CallbackProcPtr)MiscExtClientStateCallback, NULL); + MiscExtClientStateCallback, NULL); xf86Info.grabInfo.override = client; } else if (state == 1 && xf86Info.grabInfo.disabled == 1) { xf86Info.grabInfo.disabled = 0; DeleteCallback(&ClientStateCallback, - (CallbackProcPtr)MiscExtClientStateCallback, NULL); + MiscExtClientStateCallback, NULL); xf86Info.grabInfo.override = NULL; } else @@ -426,6 +452,7 @@ MiscExtApply(pointer structure, MiscExtStructType mse_or_kbd) Bool protoChanged = FALSE; int oldflags; Bool reopen = FALSE; + MouseProtocolID newProtocol; mseParamsPtr mse = structure; InputInfoPtr pInfo; MouseDevPtr pMse; @@ -508,7 +535,8 @@ MiscExtApply(pointer structure, MiscExtStructType mse_or_kbd) pMse = pInfo->private; oldflags = pMse->mouseFlags; - protoChanged = pMse->protocolID != MapMseProto(mse->type, FROM_MISC); + newProtocol = MapMseMiscToProto(mse->type); + protoChanged = pMse->protocolID != newProtocol; if (protoChanged || pMse->baudRate != mse->baudrate || pMse->sampleRate != mse->samplerate @@ -522,7 +550,7 @@ MiscExtApply(pointer structure, MiscExtStructType mse_or_kbd) if (reopen) (pMse->device->deviceProc)(pMse->device, DEVICE_CLOSE); - pMse->protocolID = MapMseProto(mse->type, FROM_MISC); + pMse->protocolID = newProtocol; pMse->baudRate = mse->baudrate; pMse->sampleRate = mse->samplerate; pMse->resolution = mse->resolution; @@ -608,5 +636,18 @@ MiscExtGetFilePaths(const char **configfile, const char **modulepath, return TRUE; } +int +MiscExtPassMessage(int scrnIndex, const char *msgtype, const char *msgval, + char **retstr) +{ + ScrnInfoPtr pScr = xf86Screens[scrnIndex]; + + DEBUG_P("MiscExtPassMessage"); + + if (*pScr->HandleMessage == NULL) + return BadImplementation; + return (*pScr->HandleMessage)(scrnIndex, msgtype, msgval, retstr); +} + #endif /* XF86MISC */ diff --git a/hw/xfree86/common/xf86Mode.c b/hw/xfree86/common/xf86Mode.c index ba73921e4..fd2ff4a22 100644 --- a/hw/xfree86/common/xf86Mode.c +++ b/hw/xfree86/common/xf86Mode.c @@ -1,10 +1,36 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Mode.c,v 1.63.2.1 2003/04/08 20:51:27 tsi Exp $ */ - +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Mode.c,v 1.69 2003/10/08 14:58:28 dawes Exp $ */ /* - * Copyright (c) 1997,1998 by The XFree86 Project, Inc. + * Copyright (c) 1997-2003 by The XFree86 Project, 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 COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + * + * Except as contained in this notice, the name of the copyright holder(s) + * and author(s) shall not be used in advertising or otherwise to promote + * the sale, use or other dealings in this Software without prior written + * authorization from the copyright holder(s) and author(s). + */ + +/* * Authors: Dirk Hohndel <hohndel@XFree86.Org> * David Dawes <dawes@XFree86.Org> + * Marc La France <tsi@XFree86.Org> + * ... and others * * This file includes helper functions for mode related things. */ @@ -13,6 +39,7 @@ #include "os.h" #include "servermd.h" #include "mibank.h" +#include "globals.h" #include "xf86.h" #include "xf86Priv.h" #include "xf86DDC.h" @@ -318,6 +345,25 @@ xf86HandleBuiltinMode(ScrnInfoPtr scrp, return MODE_OK; } +static double +ModeVRefresh(DisplayModePtr mode) +{ + double refresh = 0.0; + + if (mode->VRefresh > 0.0) + refresh = mode->VRefresh; + else if (mode->HTotal > 0 && mode->VTotal > 0) { + refresh = mode->Clock * 1000.0 / mode->HTotal / mode->VTotal; + if (mode->Flags & V_INTERLACE) + refresh *= 2.0; + if (mode->Flags & V_DBLSCAN) + refresh /= 2.0; + if (mode->VScan > 1) + refresh /= mode->VScan; + } + return refresh; +} + /* * xf86LookupMode * @@ -442,17 +488,7 @@ xf86LookupMode(ScrnInfoPtr scrp, DisplayModePtr modep, ModePrivFlags = cp->PrivFlags; break; } - if (p->VRefresh > 0.0) - refresh = p->VRefresh; - else { - refresh = p->Clock * 1000.0 / p->HTotal / p->VTotal; - if (p->Flags & V_INTERLACE) - refresh *= 2.0; - if (p->Flags & V_DBLSCAN) - refresh /= 2.0; - if (p->VScan > 1) - refresh /= p->VScan; - } + refresh = ModeVRefresh(p); if (p->Flags & V_INTERLACE) refresh /= INTERLACE_REFRESH_WEIGHT; if (refresh > bestRefresh) { @@ -491,17 +527,7 @@ xf86LookupMode(ScrnInfoPtr scrp, DisplayModePtr modep, found = TRUE; if (strategy == LOOKUP_BEST_REFRESH) { - if (p->VRefresh > 0.0) - refresh = p->VRefresh; - else { - refresh = p->Clock * 1000.0 / p->HTotal / p->VTotal; - if (p->Flags & V_INTERLACE) - refresh *= 2.0; - if (p->Flags & V_DBLSCAN) - refresh /= 2.0; - if (p->VScan > 1) - refresh /= p->VScan; - } + refresh = ModeVRefresh(p); if (p->Flags & V_INTERLACE) refresh /= INTERLACE_REFRESH_WEIGHT; if (refresh > bestRefresh) { @@ -847,7 +873,7 @@ xf86InitialCheckModeForDriver(ScrnInfoPtr scrp, DisplayModePtr mode, int i, needDiv2; /* Sanity checks */ - if (!scrp || !mode /*|| !clockRanges*/) { + if (!scrp || !mode || !clockRanges) { ErrorF("xf86InitialCheckModeForDriver: " "called with invalid parameters\n"); return MODE_ERROR; @@ -1186,13 +1212,17 @@ xf86ValidateModes(ScrnInfoPtr scrp, DisplayModePtr availModes, int linePitch = -1, virtX = 0, virtY = 0; int newLinePitch, newVirtX, newVirtY; int modeSize; /* in pixels */ - Bool validateAllDefaultModes; + Bool validateAllDefaultModes = FALSE; Bool userModes = FALSE; int saveType; PixmapFormatRec *BankFormat; ClockRangePtr cp; ClockRangesPtr storeClockRanges; struct monitor_ranges *mon_range = NULL; + double targetRefresh = 0.0; + int numTimings = 0; + range hsync[MAX_HSYNC]; + range vrefresh[MAX_VREFRESH]; #ifdef DEBUG ErrorF("xf86ValidateModes(%p, %p, %p, %p,\n\t\t %p, %d, %d, %d, %d, %d, %d, %d, %d, 0x%x)\n", @@ -1222,58 +1252,164 @@ xf86ValidateModes(ScrnInfoPtr scrp, DisplayModePtr availModes, return -1; } - /* Probe monitor so that we can enforce/warn about its limits */ + /* + * Probe monitor so that we can enforce/warn about its limits. + * If one or more DS_RANGES descriptions are present, use the parameters + * that they provide. Otherwise, deduce limits based on the modes that + * are shown as supported via standard and detailed timings. + * + * XXX The full potential of the DDC/EDID data still isn't being tapped. + */ if (scrp->monitor->DDC) { MonPtr monitor = scrp->monitor; xf86MonPtr DDC = (xf86MonPtr)(scrp->monitor->DDC); - struct detailed_monitor_section* detMon; - int i; + int i, j; + float hmin = 1e6, hmax = 0.0, vmin = 1e6, vmax = 0.0; + float h; + struct std_timings *t; + struct detailed_timings *dt; + + numTimings = 0; + for (i = 0; i < DET_TIMINGS; i++) { + switch (DDC->det_mon[i].type) { + case DS_RANGES: + mon_range = &DDC->det_mon[i].section.ranges; + hsync[numTimings].lo = mon_range->min_h; + hsync[numTimings].hi = mon_range->max_h; + vrefresh[numTimings].lo = mon_range->min_v; + vrefresh[numTimings].hi = mon_range->max_v; + numTimings++; + break; - for (i = 0; i < 4; i++) { - detMon = &DDC->det_mon[i]; - if(detMon->type == DS_RANGES) { - mon_range = &detMon->section.ranges; + case DS_STD_TIMINGS: + t = DDC->det_mon[i].section.std_t; + for (j = 0; j < 5; j++) { + if (t[j].hsize > 256) { /* sanity check */ + if (t[j].refresh < vmin) + vmin = t[i].refresh; + if (t[j].refresh > vmax) + vmax = t[i].refresh; + /* + * For typical modes this is a reasonable estimate + * of the horizontal sync rate. + */ + h = t[j].refresh * 1.07 * t[j].vsize / 1000.0; + if (h < hmin) + hmin = h; + if (h > hmax) + hmax = h; + } + } + break; + + case DT: + dt = &DDC->det_mon[i].section.d_timings; + if (dt->clock > 15000000) { /* sanity check */ + float v; + h = (float)dt->clock / (dt->h_active + dt->h_blanking); + v = h / (dt->v_active + dt->v_blanking); + h /= 1000.0; + if (dt->interlaced) + v /= 2.0; + + if (v < vmin) + vmin = v; + if (v > vmax) + vmax = v; + if (h < hmin) + hmin = h; + if (h > hmax) + hmax = h; + } + break; } + + if (numTimings > MAX_HSYNC) + break; } - if (mon_range) { + + if (numTimings == 0) { + t = DDC->timings2; + for (i = 0; i < STD_TIMINGS; i++) { + if (t[i].hsize > 256) { /* sanity check */ + if (t[i].refresh < vmin) + vmin = t[i].refresh; + if (t[i].refresh > vmax) + vmax = t[i].refresh; + /* + * For typical modes this is a reasonable estimate + * of the horizontal sync rate. + */ + h = t[i].refresh * 1.07 * t[i].vsize / 1000.0; + if (h < hmin) + hmin = h; + if (h > hmax) + hmax = h; + } + } + + if (hmax > 0.0) { + hsync[numTimings].lo = hmin; + hsync[numTimings].hi = hmax; + vrefresh[numTimings].lo = vmin; + vrefresh[numTimings].hi = vmax; + numTimings++; + } + } + + if (numTimings > 0) { #ifdef DEBUG - ErrorF("DDC - Max clock %d, Hsync %d-%d kHz - Vrefresh %d-%d Hz\n", - mon_range->max_clock, mon_range->min_h, mon_range->max_h, - mon_range->min_v, mon_range->max_v ); + for (i = 0; i < numTimings; i++) { + ErrorF("DDC - Hsync %.1f-%.1f kHz - Vrefresh %.1f-%.1f Hz\n", + hsync[i].lo, hsync[i].hi, + vrefresh[i].lo, vrefresh[i].hi); + } #endif #define DDC_SYNC_TOLERANCE SYNC_TOLERANCE if (monitor->nHsync > 0) { for (i = 0; i < monitor->nHsync; i++) { - if ((1.0 - DDC_SYNC_TOLERANCE) * mon_range->min_h > - monitor->hsync[i].lo || - (1.0 + DDC_SYNC_TOLERANCE) * mon_range->max_h < + Bool good = FALSE; + for (j = 0; j < numTimings; j++) { + if ((1.0 - DDC_SYNC_TOLERANCE) * hsync[j].lo <= + monitor->hsync[i].lo && + (1.0 + DDC_SYNC_TOLERANCE) * hsync[j].hi >= monitor->hsync[i].hi) { + good = TRUE; + break; + } + } + if (!good) { xf86DrvMsg(scrp->scrnIndex, X_WARNING, "config file hsync range %g-%gkHz not within DDC " - "hsync range %d-%dkHz\n", - monitor->hsync[i].lo, monitor->hsync[i].hi, - mon_range->min_h, mon_range->max_h); + "hsync ranges.\n", + monitor->hsync[i].lo, monitor->hsync[i].hi); } } } if (monitor->nVrefresh > 0) { - for (i=0; i<monitor->nVrefresh; i++) { - if ((1.0 - DDC_SYNC_TOLERANCE) * mon_range->min_v > - monitor->vrefresh[0].lo || - (1.0 + DDC_SYNC_TOLERANCE) * mon_range->max_v < + for (i = 0; i < monitor->nVrefresh; i++) { + Bool good = FALSE; + for (j = 0; j < numTimings; j++) { + if ((1.0 - DDC_SYNC_TOLERANCE) * vrefresh[j].lo <= + monitor->vrefresh[0].lo && + (1.0 + DDC_SYNC_TOLERANCE) * vrefresh[j].hi >= monitor->vrefresh[0].hi) { + good = TRUE; + break; + } + } + if (!good) { xf86DrvMsg(scrp->scrnIndex, X_WARNING, "config file vrefresh range %g-%gHz not within DDC " - "vrefresh range %d-%dHz\n", - monitor->vrefresh[i].lo, monitor->vrefresh[i].hi, - mon_range->min_v, mon_range->max_v); + "vrefresh ranges.\n", + monitor->vrefresh[i].lo, monitor->vrefresh[i].hi); } } } - } /* if (mon_range) */ + } } /* @@ -1283,58 +1419,61 @@ xf86ValidateModes(ScrnInfoPtr scrp, DisplayModePtr availModes, if (strategy & LOOKUP_OPTIONAL_TOLERANCES) { strategy &= ~LOOKUP_OPTIONAL_TOLERANCES; } else { + const char *type = ""; + if (scrp->monitor->nHsync <= 0) { - if (mon_range) { - scrp->monitor->hsync[0].lo = mon_range->min_h; - scrp->monitor->hsync[0].hi = mon_range->max_h; + if (numTimings > 0) { + scrp->monitor->nHsync = numTimings; + for (i = 0; i < numTimings; i++) { + scrp->monitor->hsync[i].lo = hsync[i].lo; + scrp->monitor->hsync[i].hi = hsync[i].hi; + } } else { scrp->monitor->hsync[0].lo = 28; scrp->monitor->hsync[0].hi = 33; + scrp->monitor->nHsync = 1; } - xf86DrvMsg(scrp->scrnIndex, X_WARNING, - "%s: Using default hsync range of %.2f-%.2fkHz\n", - scrp->monitor->id, - scrp->monitor->hsync[0].lo, scrp->monitor->hsync[0].hi); - scrp->monitor->nHsync = 1; - } else { - for (i = 0; i < scrp->monitor->nHsync; i++) + type = "default "; + } + for (i = 0; i < scrp->monitor->nHsync; i++) { if (scrp->monitor->hsync[i].lo == scrp->monitor->hsync[i].hi) xf86DrvMsg(scrp->scrnIndex, X_INFO, - "%s: Using hsync value of %.2f kHz\n", - scrp->monitor->id, + "%s: Using %shsync value of %.2f kHz\n", + scrp->monitor->id, type, scrp->monitor->hsync[i].lo); else xf86DrvMsg(scrp->scrnIndex, X_INFO, - "%s: Using hsync range of %.2f-%.2f kHz\n", - scrp->monitor->id, + "%s: Using %shsync range of %.2f-%.2f kHz\n", + scrp->monitor->id, type, scrp->monitor->hsync[i].lo, scrp->monitor->hsync[i].hi); } + + type = ""; if (scrp->monitor->nVrefresh <= 0) { - if (mon_range) { - scrp->monitor->vrefresh[0].lo = mon_range->min_v; - scrp->monitor->vrefresh[0].hi = mon_range->max_v; + if (numTimings > 0) { + scrp->monitor->nVrefresh = numTimings; + for (i = 0; i < numTimings; i++) { + scrp->monitor->vrefresh[i].lo = vrefresh[i].lo; + scrp->monitor->vrefresh[i].hi = vrefresh[i].hi; + } } else { scrp->monitor->vrefresh[0].lo = 43; scrp->monitor->vrefresh[0].hi = 72; + scrp->monitor->nVrefresh = 1; } - xf86DrvMsg(scrp->scrnIndex, X_WARNING, - "%s: using default vrefresh range of %.2f-%.2fHz\n", - scrp->monitor->id, - scrp->monitor->vrefresh[0].lo, - scrp->monitor->vrefresh[0].hi); - scrp->monitor->nVrefresh = 1; - } else { - for (i = 0; i < scrp->monitor->nVrefresh; i++) + type = "default "; + } + for (i = 0; i < scrp->monitor->nVrefresh; i++) { if (scrp->monitor->vrefresh[i].lo == scrp->monitor->vrefresh[i].hi) xf86DrvMsg(scrp->scrnIndex, X_INFO, - "%s: Using vrefresh value of %.2f Hz\n", - scrp->monitor->id, + "%s: Using %svrefresh value of %.2f Hz\n", + scrp->monitor->id, type, scrp->monitor->vrefresh[i].lo); else xf86DrvMsg(scrp->scrnIndex, X_INFO, - "%s: Using vrefresh range of %.2f-%.2f Hz\n", - scrp->monitor->id, + "%s: Using %svrefresh range of %.2f-%.2f Hz\n", + scrp->monitor->id, type, scrp->monitor->vrefresh[i].lo, scrp->monitor->vrefresh[i].hi); } @@ -1498,6 +1637,26 @@ xf86ValidateModes(ScrnInfoPtr scrp, DisplayModePtr availModes, } /* + * Go through the mode pool and see if any modes match the target + * refresh rate, (if specified). If no modes match, abandon the target. + */ + targetRefresh = xf86SetRealOption(scrp->options, + "TargetRefresh", 0.0); + if (targetRefresh > 0.0) { + for (p = scrp->modePool; p != NULL; p = p->next) { + if (ModeVRefresh(p) > targetRefresh * (1.0 - SYNC_TOLERANCE)) + break; + } + if (!p) + targetRefresh = 0.0; + } + + if (targetRefresh > 0.0) { + xf86DrvMsg(scrp->scrnIndex, X_CONFIG, + "Target refresh rate is %.1f Hz\n", targetRefresh); + } + + /* * Allocate one entry in scrp->modes for each named mode. */ while (scrp->modes) @@ -1520,7 +1679,15 @@ xf86ValidateModes(ScrnInfoPtr scrp, DisplayModePtr availModes, } /* Lookup each mode */ - validateAllDefaultModes = TRUE; +#ifdef RANDR + if (!xf86Info.disableRandR +#ifdef PANORAMIX + && noPanoramiXExtension +#endif + ) + validateAllDefaultModes = TRUE; +#endif + for (p = scrp->modes; ; p = p->next) { Bool repeat; @@ -1561,6 +1728,14 @@ xf86ValidateModes(ScrnInfoPtr scrp, DisplayModePtr availModes, ((double)q->HTotal / (double)q->HDisplay) < 1.15) continue; + /* + * If there is a target refresh rate, skip modes that + * don't match up. + */ + if (ModeVRefresh(q) < + (1.0 - SYNC_TOLERANCE) * targetRefresh) + continue; + if (modeSize < (q->HDisplay * q->VDisplay)) { r = q; modeSize = q->HDisplay * q->VDisplay; @@ -1833,8 +2008,16 @@ xf86PruneDriverModes(ScrnInfoPtr scrp) } while (p != NULL && p != first); /* modePool is no longer needed, turf it */ - while (scrp->modePool) + while (scrp->modePool) { + /* + * A modePool mode's prev field is used to hold a pointer to the + * member of the scrp->modes list for which a match was considered. + * Clear that pointer first, otherwise xf86DeleteMode might get + * confused + */ + scrp->modePool->prev = NULL; xf86DeleteMode(&scrp->modePool, scrp->modePool); + } } @@ -1946,22 +2129,16 @@ xf86PrintModes(ScrnInfoPtr scrp) hsync = (float)p->Clock / (float)p->HTotal; else hsync = 0.0; - if (p->VTotal > 0) - refresh = hsync * 1000.0 / p->VTotal; + refresh = ModeVRefresh(p); if (p->Flags & V_INTERLACE) { - refresh *= 2.0; desc = " (I)"; } if (p->Flags & V_DBLSCAN) { - refresh /= 2.0; desc = " (D)"; } if (p->VScan > 1) { - refresh /= p->VScan; desc2 = " (VScan)"; } - if (p->VRefresh > 0.0) - refresh = p->VRefresh; if (p->type & M_T_BUILTIN) prefix = "Built-in mode"; else if (p->type & M_T_DEFAULT) diff --git a/hw/xfree86/common/xf86Module.h b/hw/xfree86/common/xf86Module.h index 21b9aa590..bd18e895f 100644 --- a/hw/xfree86/common/xf86Module.h +++ b/hw/xfree86/common/xf86Module.h @@ -1,7 +1,30 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Module.h,v 1.35 2002/12/22 02:03:25 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Module.h,v 1.37 2003/08/24 17:36:54 dawes Exp $ */ /* - * Copyright (c) 1997-2001 by The XFree86 Project, Inc. + * Copyright (c) 1997-2003 by The XFree86 Project, 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 COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + * + * Except as contained in this notice, the name of the copyright holder(s) + * and author(s) shall not be used in advertising or otherwise to promote + * the sale, use or other dealings in this Software without prior written + * authorization from the copyright holder(s) and author(s). */ /* @@ -62,7 +85,7 @@ typedef enum { * mask is 0xFFFF0000. */ #define ABI_ANSIC_VERSION SET_ABI_VERSION(0, 2) -#define ABI_VIDEODRV_VERSION SET_ABI_VERSION(0, 6) +#define ABI_VIDEODRV_VERSION SET_ABI_VERSION(0, 7) #define ABI_XINPUT_VERSION SET_ABI_VERSION(0, 4) #define ABI_EXTENSION_VERSION SET_ABI_VERSION(0, 2) #define ABI_FONT_VERSION SET_ABI_VERSION(0, 4) diff --git a/hw/xfree86/common/xf86Opt.h b/hw/xfree86/common/xf86Opt.h index dc5c2ca67..718732353 100644 --- a/hw/xfree86/common/xf86Opt.h +++ b/hw/xfree86/common/xf86Opt.h @@ -1,4 +1,31 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Opt.h,v 1.12 2001/05/04 19:05:30 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Opt.h,v 1.15 2003/10/08 14:30:38 dawes Exp $ */ + +/* + * Copyright (c) 1998-2003 by The XFree86 Project, 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 COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + * + * Except as contained in this notice, the name of the copyright holder(s) + * and author(s) shall not be used in advertising or otherwise to promote + * the sale, use or other dealings in this Software without prior written + * authorization from the copyright holder(s) and author(s). + */ /* Option handling things that ModuleSetup procs can use */ @@ -46,7 +73,11 @@ int xf86SetIntOption(pointer optlist, const char *name, int deflt); double xf86SetRealOption(pointer optlist, const char *name, double deflt); char *xf86SetStrOption(pointer optlist, const char *name, char *deflt); int xf86SetBoolOption(pointer list, const char *name, int deflt ); -pointer xf86AddNewOption(pointer head, char *name, char *val ); +int xf86CheckIntOption(pointer optlist, const char *name, int deflt); +double xf86CheckRealOption(pointer optlist, const char *name, double deflt); +char *xf86CheckStrOption(pointer optlist, const char *name, char *deflt); +int xf86CheckBoolOption(pointer list, const char *name, int deflt ); +pointer xf86AddNewOption(pointer head, const char *name, const char *val ); pointer xf86NewOption(char *name, char *value ); pointer xf86NextOption(pointer list ); pointer xf86OptionListCreate(const char **options, int count, int used); @@ -76,7 +107,8 @@ Bool xf86GetOptValBool(const OptionInfoRec *table, int token, Bool *value); Bool xf86ReturnOptValBool(const OptionInfoRec *table, int token, Bool def); int xf86NameCmp(const char *s1, const char *s2); char *xf86NormalizeName(const char *s); -pointer xf86ReplaceIntOption(pointer optlist, char *name, int val); -pointer xf86ReplaceBoolOption(pointer optlist, char *name, Bool val); -pointer xf86ReplaceStrOption(pointer optlist, char *name, char* val); +pointer xf86ReplaceIntOption(pointer optlist, const char *name, const int val); +pointer xf86ReplaceRealOption(pointer optlist, const char *name, const double val); +pointer xf86ReplaceBoolOption(pointer optlist, const char *name, const Bool val); +pointer xf86ReplaceStrOption(pointer optlist, const char *name, const char* val); #endif diff --git a/hw/xfree86/common/xf86Option.c b/hw/xfree86/common/xf86Option.c index 6ca1590e4..0ba09b507 100644 --- a/hw/xfree86/common/xf86Option.c +++ b/hw/xfree86/common/xf86Option.c @@ -1,10 +1,33 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Option.c,v 1.25 2002/09/10 17:39:28 dawes Exp $ */ - +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Option.c,v 1.29 2003/10/18 12:34:19 dawes Exp $ */ /* - * Copyright (c) 1998 by The XFree86 Project, Inc. + * Copyright (c) 1998-2003 by The XFree86 Project, Inc. * - * Author: David Dawes <dawes@xfree86.org> + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + * + * Except as contained in this notice, the name of the copyright holder(s) + * and author(s) shall not be used in advertising or otherwise to promote + * the sale, use or other dealings in this Software without prior written + * authorization from the copyright holder(s) and author(s). + */ + +/* + * Author: David Dawes <dawes@xfree86.org> * * This file includes public option handling functions. */ @@ -17,7 +40,8 @@ #include "xf86Xinput.h" #include "xf86Optrec.h" -static Bool ParseOptionValue(int scrnIndex, pointer options, OptionInfoPtr p); +static Bool ParseOptionValue(int scrnIndex, pointer options, OptionInfoPtr p, + Bool markUsed); /* * xf86CollectOptions collects the options from each of the config file @@ -140,42 +164,41 @@ xf86CollectInputOptions(InputInfoPtr pInfo, const char **defaultOpts, /* Created for new XInput stuff -- essentially extensions to the parser */ -/* These xf86Set* functions are intended for use by non-screen specific code */ - -int -xf86SetIntOption(pointer optlist, const char *name, int deflt) +static int +LookupIntOption(pointer optlist, const char *name, int deflt, Bool markUsed) { OptionInfoRec o; o.name = name; o.type = OPTV_INTEGER; - if (ParseOptionValue(-1, optlist, &o)) + if (ParseOptionValue(-1, optlist, &o, markUsed)) deflt = o.value.num; return deflt; } -double -xf86SetRealOption(pointer optlist, const char *name, double deflt) +static double +LookupRealOption(pointer optlist, const char *name, double deflt, + Bool markUsed) { OptionInfoRec o; o.name = name; o.type = OPTV_REAL; - if (ParseOptionValue(-1, optlist, &o)) + if (ParseOptionValue(-1, optlist, &o, markUsed)) deflt = o.value.realnum; return deflt; } -char * -xf86SetStrOption(pointer optlist, const char *name, char *deflt) +static char * +LookupStrOption(pointer optlist, const char *name, char *deflt, Bool markUsed) { OptionInfoRec o; o.name = name; o.type = OPTV_STRING; - if (ParseOptionValue(-1, optlist, &o)) + if (ParseOptionValue(-1, optlist, &o, markUsed)) deflt = o.value.str; if (deflt) return xstrdup(deflt); @@ -184,24 +207,84 @@ xf86SetStrOption(pointer optlist, const char *name, char *deflt) } -int -xf86SetBoolOption(pointer optlist, const char *name, int deflt) +static int +LookupBoolOption(pointer optlist, const char *name, int deflt, Bool markUsed) { OptionInfoRec o; o.name = name; o.type = OPTV_BOOLEAN; - if (ParseOptionValue(-1, optlist, &o)) + if (ParseOptionValue(-1, optlist, &o, markUsed)) deflt = o.value.bool; return deflt; } +/* These xf86Set* functions are intended for use by non-screen specific code */ + +int +xf86SetIntOption(pointer optlist, const char *name, int deflt) +{ + return LookupIntOption(optlist, name, deflt, TRUE); +} + + +double +xf86SetRealOption(pointer optlist, const char *name, double deflt) +{ + return LookupRealOption(optlist, name, deflt, TRUE); +} + + +char * +xf86SetStrOption(pointer optlist, const char *name, char *deflt) +{ + return LookupStrOption(optlist, name, deflt, TRUE); +} + + +int +xf86SetBoolOption(pointer optlist, const char *name, int deflt) +{ + return LookupBoolOption(optlist, name, deflt, TRUE); +} + +/* + * These are like the Set*Option functions, but they don't mark the options + * as used. + */ +int +xf86CheckIntOption(pointer optlist, const char *name, int deflt) +{ + return LookupIntOption(optlist, name, deflt, FALSE); +} + + +double +xf86CheckRealOption(pointer optlist, const char *name, double deflt) +{ + return LookupRealOption(optlist, name, deflt, FALSE); +} + + +char * +xf86CheckStrOption(pointer optlist, const char *name, char *deflt) +{ + return LookupStrOption(optlist, name, deflt, FALSE); +} + + +int +xf86CheckBoolOption(pointer optlist, const char *name, int deflt) +{ + return LookupBoolOption(optlist, name, deflt, FALSE); +} + /* * addNewOption() has the required property of replacing the option value - * it the option is alread present. + * if the option is already present. */ pointer -xf86ReplaceIntOption(pointer optlist, char *name, int val) +xf86ReplaceIntOption(pointer optlist, const char *name, const int val) { char *tmp = xnfalloc(16); sprintf(tmp,"%i",val); @@ -209,20 +292,29 @@ xf86ReplaceIntOption(pointer optlist, char *name, int val) } pointer -xf86ReplaceBoolOption(pointer optlist, char *name, Bool val) +xf86ReplaceRealOption(pointer optlist, const char *name, const double val) +{ + char *tmp = xnfalloc(32); + snprintf(tmp,32,"%f",val); + return xf86AddNewOption(optlist,name,tmp); +} + +pointer +xf86ReplaceBoolOption(pointer optlist, const char *name, const Bool val) { - return xf86AddNewOption(optlist,name,(Bool)val?"True":"False"); + return xf86AddNewOption(optlist,name,val?"True":"False"); } pointer -xf86ReplaceStrOption(pointer optlist, char *name, char* val) +xf86ReplaceStrOption(pointer optlist, const char *name, const char* val) { return xf86AddNewOption(optlist,name,val); } pointer -xf86AddNewOption(pointer head, char *name, char *val) +xf86AddNewOption(pointer head, const char *name, const char *val) { + /* XXX These should actually be allocated in the parser library. */ char *tmp = strdup(val); char *tmp_name = strdup(name); @@ -387,14 +479,17 @@ GetBoolValue(OptionInfoPtr p, const char *s) } static Bool -ParseOptionValue(int scrnIndex, pointer options, OptionInfoPtr p) +ParseOptionValue(int scrnIndex, pointer options, OptionInfoPtr p, + Bool markUsed) { char *s, *end; - Bool wasUsed; + Bool wasUsed = FALSE; if ((s = xf86findOptionValue(options, p->name)) != NULL) { - wasUsed = xf86CheckIfOptionUsedByName(options, p->name); - xf86MarkOptionUsedByName(options, p->name); + if (markUsed) { + wasUsed = xf86CheckIfOptionUsedByName(options, p->name); + xf86MarkOptionUsedByName(options, p->name); + } switch (p->type) { case OPTV_INTEGER: if (*s == '\0') { @@ -501,7 +596,7 @@ ParseOptionValue(int scrnIndex, pointer options, OptionInfoPtr p) p->found = FALSE; break; } - if (p->found) { + if (p->found && markUsed) { int verb = 2; if (wasUsed) verb = 4; @@ -535,7 +630,8 @@ ParseOptionValue(int scrnIndex, pointer options, OptionInfoPtr p) newn = n; } if ((s = xf86findOptionValue(options, newn)) != NULL) { - xf86MarkOptionUsedByName(options, newn); + if (markUsed) + xf86MarkOptionUsedByName(options, newn); if (GetBoolValue(&opt, s)) { p->value.bool = !opt.value.bool; p->found = TRUE; @@ -547,7 +643,7 @@ ParseOptionValue(int scrnIndex, pointer options, OptionInfoPtr p) } else { p->found = FALSE; } - if (p->found) { + if (p->found && markUsed) { xf86DrvMsgVerb(scrnIndex, X_CONFIG, 2, "Option \"%s\"", newn); if (*s != 0) { xf86ErrorFVerb(2, " \"%s\"", s); @@ -568,7 +664,7 @@ xf86ProcessOptions(int scrnIndex, pointer options, OptionInfoPtr optinfo) OptionInfoPtr p; for (p = optinfo; p->name != NULL; p++) { - ParseOptionValue(scrnIndex, options, p); + ParseOptionValue(scrnIndex, options, p, TRUE); } } @@ -576,20 +672,27 @@ xf86ProcessOptions(int scrnIndex, pointer options, OptionInfoPtr optinfo) OptionInfoPtr xf86TokenToOptinfo(const OptionInfoRec *table, int token) { - const OptionInfoRec *p; + const OptionInfoRec *p, *match = NULL, *set = NULL; if (!table) { ErrorF("xf86TokenToOptinfo: table is NULL\n"); return NULL; } - for (p = table; p->token >= 0 && p->token != token; p++) - ; + for (p = table; p->token >= 0; p++) { + if (p->token == token) { + match = p; + if (p->found) + set = p; + } + } - if (p->token < 0) - return NULL; + if (set) + return (OptionInfoPtr)set; + else if (match) + return (OptionInfoPtr)match; else - return (OptionInfoPtr)p; + return NULL; } diff --git a/hw/xfree86/common/xf86PM.c b/hw/xfree86/common/xf86PM.c index 03f5bdec1..eb56fb614 100644 --- a/hw/xfree86/common/xf86PM.c +++ b/hw/xfree86/common/xf86PM.c @@ -1,5 +1,30 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86PM.c,v 3.8 2002/09/29 23:54:34 keithp Exp $ */ - +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86PM.c,v 3.9 2003/08/24 17:36:54 dawes Exp $ */ +/* + * Copyright (c) 2000-2002 by The XFree86 Project, 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 COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + * + * Except as contained in this notice, the name of the copyright holder(s) + * and author(s) shall not be used in advertising or otherwise to promote + * the sale, use or other dealings in this Software without prior written + * authorization from the copyright holder(s) and author(s). + */ #include "X.h" #include "xf86.h" diff --git a/hw/xfree86/common/xf86PciInfo.h b/hw/xfree86/common/xf86PciInfo.h index 14f86cf89..19cc009dd 100644 --- a/hw/xfree86/common/xf86PciInfo.h +++ b/hw/xfree86/common/xf86PciInfo.h @@ -1,7 +1,33 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86PciInfo.h,v 1.144 2003/02/07 20:41:11 martin Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86PciInfo.h,v 1.156 2003/10/30 15:26:33 tsi Exp $ */ + /* - * Copyright 1995-2002 by The XFree86 Project, Inc. + * Copyright (c) 1995-2003 by The XFree86 Project, 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 COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + * + * Except as contained in this notice, the name of the copyright holder(s) + * and author(s) shall not be used in advertising or otherwise to promote + * the sale, use or other dealings in this Software without prior written + * authorization from the copyright holder(s) and author(s). + */ + +/* * This file contains macros for the PCI Vendor and Device IDs for video * cards plus a few other things that are needed in drivers or elsewhere. * This information is used in several ways: @@ -57,12 +83,10 @@ #define PCI_VENDOR_SUN 0x108E #define PCI_VENDOR_DIAMOND 0x1092 #define PCI_VENDOR_BROOKTREE 0x109E -#define PCI_VENDOR_ALI_2 0x10B9 #define PCI_VENDOR_NEOMAGIC 0x10C8 #define PCI_VENDOR_NVIDIA 0x10DE #define PCI_VENDOR_IMS 0x10E0 #define PCI_VENDOR_INTEGRAPHICS 0x10EA -#define PCI_VENDOR_VIA 0x1106 #define PCI_VENDOR_ALLIANCE 0x1142 #define PCI_VENDOR_RENDITION 0x1163 #define PCI_VENDOR_3DFX 0x121A @@ -89,14 +113,31 @@ #define PCI_CHIP_QV1280 0x3033 /* ATI */ +#define PCI_CHIP_RS100_4136 0x4136 +#define PCI_CHIP_RS200_4137 0x4137 #define PCI_CHIP_R300_AD 0x4144 #define PCI_CHIP_R300_AE 0x4145 #define PCI_CHIP_R300_AF 0x4146 #define PCI_CHIP_R300_AG 0x4147 +#define PCI_CHIP_R350_AH 0x4148 +#define PCI_CHIP_R350_AI 0x4149 +#define PCI_CHIP_R350_AJ 0x414A +#define PCI_CHIP_R350_AK 0x414B +#define PCI_CHIP_RV350_AP 0x4150 +#define PCI_CHIP_RV350_AQ 0x4151 +#define PCI_CHIP_RV360_AR 0x4152 +#define PCI_CHIP_RV350_AS 0x4153 +#define PCI_CHIP_RV350_AT 0x4154 +#define PCI_CHIP_RV350_AV 0x4156 #define PCI_CHIP_MACH32 0x4158 +#define PCI_CHIP_RS250_4237 0x4237 #define PCI_CHIP_R200_BB 0x4242 +#define PCI_CHIP_R200_BC 0x4243 +#define PCI_CHIP_RS100_4336 0x4336 +#define PCI_CHIP_RS200_4337 0x4337 #define PCI_CHIP_MACH64CT 0x4354 #define PCI_CHIP_MACH64CX 0x4358 +#define PCI_CHIP_RS250_4437 0x4437 #define PCI_CHIP_MACH64ET 0x4554 #define PCI_CHIP_MACH64GB 0x4742 #define PCI_CHIP_MACH64GD 0x4744 @@ -140,12 +181,23 @@ #define PCI_CHIP_RV250_Le 0x4C65 #define PCI_CHIP_RV250_Lf 0x4C66 #define PCI_CHIP_RV250_Lg 0x4C67 +#define PCI_CHIP_RV250_Ln 0x4C6E #define PCI_CHIP_RAGE128MF 0x4D46 #define PCI_CHIP_RAGE128ML 0x4D4C #define PCI_CHIP_R300_ND 0x4E44 #define PCI_CHIP_R300_NE 0x4E45 #define PCI_CHIP_R300_NF 0x4E46 #define PCI_CHIP_R300_NG 0x4E47 +#define PCI_CHIP_R350_NH 0x4E48 +#define PCI_CHIP_R350_NI 0x4E49 +#define PCI_CHIP_R360_NJ 0x4E4A +#define PCI_CHIP_R350_NK 0x4E4B +#define PCI_CHIP_RV350_NP 0x4E50 +#define PCI_CHIP_RV350_NQ 0x4E51 +#define PCI_CHIP_RV350_NR 0x4E52 +#define PCI_CHIP_RV350_NS 0x4E53 +#define PCI_CHIP_RV350_NT 0x4E54 +#define PCI_CHIP_RV350_NV 0x4E56 #define PCI_CHIP_RAGE128PA 0x5041 #define PCI_CHIP_RAGE128PB 0x5042 #define PCI_CHIP_RAGE128PC 0x5043 @@ -186,11 +238,6 @@ #define PCI_CHIP_RV200_QX 0x5158 #define PCI_CHIP_RV100_QY 0x5159 #define PCI_CHIP_RV100_QZ 0x515A -#define PCI_CHIP_R200_Qh 0x5168 -#define PCI_CHIP_R200_Qi 0x5169 -#define PCI_CHIP_R200_Qj 0x516A -#define PCI_CHIP_R200_Qk 0x516B -#define PCI_CHIP_R200_Ql 0x516C /* Undocumented in all ATI manuals */ #define PCI_CHIP_RAGE128RE 0x5245 #define PCI_CHIP_RAGE128RF 0x5246 #define PCI_CHIP_RAGE128RG 0x5247 @@ -213,6 +260,16 @@ #define PCI_CHIP_MACH64VT 0x5654 #define PCI_CHIP_MACH64VU 0x5655 #define PCI_CHIP_MACH64VV 0x5656 +#define PCI_CHIP_RS300_5834 0x5834 +#define PCI_CHIP_RS300_5835 0x5835 +#define PCI_CHIP_RS300_5836 0x5836 +#define PCI_CHIP_RS300_5837 0x5837 +#define PCI_CHIP_RV280_5960 0x5960 +#define PCI_CHIP_RV280_5961 0x5961 +#define PCI_CHIP_RV280_5962 0x5962 +#define PCI_CHIP_RV280_5964 0x5964 +#define PCI_CHIP_RV280_5C61 0x5C61 +#define PCI_CHIP_RV280_5C63 0x5C63 /* Avance Logic */ #define PCI_CHIP_ALG2064 0x2064 @@ -259,6 +316,7 @@ #define PCI_CHIP_AMD761 0x700E /* Trident */ +#define PCI_CHIP_2100 0x2100 #define PCI_CHIP_8400 0x8400 #define PCI_CHIP_8420 0x8420 #define PCI_CHIP_8500 0x8500 @@ -343,20 +401,21 @@ #define PCI_CHIP_SIS6326 0x6326 #define PCI_CHIP_SIS7001 0x7001 #define PCI_CHIP_SIS300 0x0300 -#define PCI_CHIP_SIS315H 0x0310 -#define PCI_CHIP_SIS315PRO 0x0325 -#define PCI_CHIP_SIS330 0x0330 +#define PCI_CHIP_SIS315H 0x0310 +#define PCI_CHIP_SIS315PRO 0x0325 +#define PCI_CHIP_SIS330 0x0330 #define PCI_CHIP_SIS630 0x6300 #define PCI_CHIP_SIS540 0x5300 -#define PCI_CHIP_SIS550 0x5315 -#define PCI_CHIP_SIS650 0x6325 -#define PCI_CHIP_SIS730 0x7300 +#define PCI_CHIP_SIS550 0x5315 +#define PCI_CHIP_SIS650 0x6325 +#define PCI_CHIP_SIS730 0x7300 /* Hewlett-Packard */ #define PCI_CHIP_ELROY 0x1054 #define PCI_CHIP_ZX1_SBA 0x1229 #define PCI_CHIP_ZX1_IOC 0x122A #define PCI_CHIP_ZX1_LBA 0x122E /* a.k.a. Mercury */ +#define PCI_CHIP_ZX1_AGP8 0x12B4 /* a.k.a. QuickSilver */ /* SGS */ #define PCI_CHIP_STG2000 0x0008 @@ -389,9 +448,6 @@ #define PCI_CHIP_BT848 0x0350 #define PCI_CHIP_BT849 0x0351 -/* Acer Laboratories Inc (ALI_2) */ -#define PCI_CHIP_M1541 0x1541 - /* NVIDIA */ #define PCI_CHIP_NV1 0x0008 #define PCI_CHIP_DAC64 0x0009 @@ -442,10 +498,6 @@ #define PCI_CHIP_IMSTT128 0x9128 #define PCI_CHIP_IMSTT3D 0x9135 -/* VIA Technologies */ -#define PCI_CHIP_APOLLOVP1 0x0585 -#define PCI_CHIP_APOLLOPRO133X 0x0691 - /* Alliance Semiconductor */ #define PCI_CHIP_AP6410 0x3210 #define PCI_CHIP_AP6422 0x6422 @@ -538,7 +590,6 @@ /* Intel */ #define PCI_CHIP_I815_BRIDGE 0x1130 #define PCI_CHIP_I815 0x1132 -#define PCI_CHIP_430HX_BRIDGE 0x1250 #define PCI_CHIP_82801_P2P 0x244E #define PCI_CHIP_845_G_BRIDGE 0x2560 #define PCI_CHIP_845_G 0x2562 @@ -550,7 +601,6 @@ #define PCI_CHIP_I810_DC100 0x7123 #define PCI_CHIP_I810_E_BRIDGE 0x7124 #define PCI_CHIP_I810_E 0x7125 -#define PCI_CHIP_440BX_BRIDGE 0x7190 #define PCI_CHIP_I740_AGP 0x7800 #define PCI_CHIP_460GX_PXB 0x84CB #define PCI_CHIP_460GX_SAC 0x84E0 @@ -565,6 +615,7 @@ #define PCI_CHIP_SMI710 0x0710 #define PCI_CHIP_SMI712 0x0712 #define PCI_CHIP_SMI720 0x0720 +#define PCI_CHIP_SMI731 0x0730 /* VMware */ #define PCI_CHIP_VMWARE0405 0x0405 diff --git a/hw/xfree86/common/xf86Priv.h b/hw/xfree86/common/xf86Priv.h index 308e7a72c..a46bfc39b 100644 --- a/hw/xfree86/common/xf86Priv.h +++ b/hw/xfree86/common/xf86Priv.h @@ -1,7 +1,30 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Priv.h,v 3.80 2002/12/12 18:29:10 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Priv.h,v 3.82 2003/09/09 03:20:36 dawes Exp $ */ /* - * Copyright (c) 1997 by The XFree86 Project, Inc. + * Copyright (c) 1997-2002 by The XFree86 Project, 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 COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + * + * Except as contained in this notice, the name of the copyright holder(s) + * and author(s) shall not be used in advertising or otherwise to promote + * the sale, use or other dealings in this Software without prior written + * authorization from the copyright holder(s) and author(s). */ /* @@ -167,10 +190,11 @@ void xf86GrabServerCallback(CallbackListPtr *, pointer, pointer); /* xf86Helper.c */ void xf86LogInit(void); void xf86CloseLog(void); -void OsVendorVErrorF(const char *f, va_list args); /* xf86Init.c */ Bool xf86LoadModules(char **list, pointer *optlist); +int xf86SetVerbosity(int verb); +int xf86SetLogVerbosity(int verb); /* xf86Io.c */ diff --git a/hw/xfree86/common/xf86Privstr.h b/hw/xfree86/common/xf86Privstr.h index ff704b912..8b0a0f4ce 100644 --- a/hw/xfree86/common/xf86Privstr.h +++ b/hw/xfree86/common/xf86Privstr.h @@ -1,7 +1,30 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Privstr.h,v 1.37 2003/02/20 04:05:14 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Privstr.h,v 1.40 2003/10/17 20:02:12 alanh Exp $ */ /* - * Copyright (c) 1997,1998 by The XFree86 Project, Inc. + * Copyright (c) 1997-2003 by The XFree86 Project, 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 COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + * + * Except as contained in this notice, the name of the copyright holder(s) + * and author(s) shall not be used in advertising or otherwise to promote + * the sale, use or other dealings in this Software without prior written + * authorization from the copyright holder(s) and author(s). */ /* @@ -159,7 +182,6 @@ typedef struct { #ifdef DPMSExtension /* Private info for DPMS */ typedef struct { - DPMSSetProcPtr Set; CloseScreenProcPtr CloseScreen; Bool Enabled; int Flags; @@ -199,36 +221,4 @@ typedef struct { #define WSCONS 32 #endif -/* Prefix strings for driver messages */ -#ifndef X_UNKNOWN_STRING -#define X_UNKNOWN_STRING "(\?\?)" -#endif -#ifndef X_PROBE_STRING -#define X_PROBE_STRING "(--)" -#endif -#ifndef X_CONFIG_STRING -#define X_CONFIG_STRING "(**)" -#endif -#ifndef X_DEFAULT_STRING -#define X_DEFAULT_STRING "(==)" -#endif -#ifndef X_CMDLINE_STRING -#define X_CMDLINE_STRING "(++)" -#endif -#ifndef X_NOTICE_STRING -#define X_NOTICE_STRING "(!!)" -#endif -#ifndef X_ERROR_STRING -#define X_ERROR_STRING "(EE)" -#endif -#ifndef X_WARNING_STRING -#define X_WARNING_STRING "(WW)" -#endif -#ifndef X_INFO_STRING -#define X_INFO_STRING "(II)" -#endif -#ifndef X_NOT_IMPLEMENTED_STRING -#define X_NOT_IMPLEMENTED_STRING "(NI)" -#endif - #endif /* _XF86PRIVSTR_H */ diff --git a/hw/xfree86/common/xf86RandR.c b/hw/xfree86/common/xf86RandR.c index c2dbcc170..546c909ff 100644 --- a/hw/xfree86/common/xf86RandR.c +++ b/hw/xfree86/common/xf86RandR.c @@ -1,5 +1,5 @@ /* - * $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86RandR.c,v 1.4 2003/02/13 10:49:38 eich Exp $ + * $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86RandR.c,v 1.8 2003/11/10 16:42:13 tsi Exp $ * * Copyright © 2002 Keith Packard, member of The XFree86 Project, Inc. * @@ -48,9 +48,9 @@ static int xf86RandRModeRefresh (DisplayModePtr mode) { if (mode->VRefresh) - return (int) mode->VRefresh; + return (int) (mode->VRefresh + 0.5); else - return (int) (mode->Clock * 1000.0 / mode->HTotal / mode->VTotal); + return (int) (mode->Clock * 1000.0 / mode->HTotal / mode->VTotal + 0.5); } static Bool @@ -60,7 +60,6 @@ xf86RandRGetInfo (ScreenPtr pScreen, Rotation *rotations) ScrnInfoPtr scrp = XF86SCRNINFO(pScreen); XF86RandRInfoPtr randrp = XF86RANDRINFO(pScreen); DisplayModePtr mode; - Bool reportVirtual = TRUE; int refresh0 = 60; *rotations = RR_Rotate_0; @@ -75,9 +74,6 @@ xf86RandRGetInfo (ScreenPtr pScreen, Rotation *rotations) pScreen->mmWidth, pScreen->mmHeight); if (!pSize) return FALSE; - if (mode->HDisplay == randrp->virtualX && - mode->VDisplay == randrp->virtualY) - reportVirtual = FALSE; RRRegisterRate (pScreen, pSize, refresh); if (mode == scrp->currentMode && mode->HDisplay == pScreen->width && mode->VDisplay == pScreen->height) @@ -85,13 +81,14 @@ xf86RandRGetInfo (ScreenPtr pScreen, Rotation *rotations) if (mode->next == scrp->modes) break; } - if (reportVirtual) + if (scrp->currentMode->HDisplay != randrp->virtualX || + scrp->currentMode->VDisplay != randrp->virtualY) { mode = scrp->modes; pSize = RRRegisterSize (pScreen, randrp->virtualX, randrp->virtualY, - pScreen->mmWidth * randrp->virtualX / mode->HDisplay, - pScreen->mmHeight * randrp->virtualY / mode->VDisplay); + pScreen->mmWidth * randrp->virtualX / scrp->currentMode->HDisplay, + pScreen->mmHeight * randrp->virtualY / scrp->currentMode->VDisplay); if (!pSize) return FALSE; RRRegisterRate (pScreen, pSize, refresh0); @@ -202,17 +199,21 @@ xf86RandRSetConfig (ScreenPtr pScreen, static Bool xf86RandRCreateScreenResources (ScreenPtr pScreen) { - ScrnInfoPtr scrp = XF86SCRNINFO(pScreen); XF86RandRInfoPtr randrp = XF86RANDRINFO(pScreen); +#if 0 + ScrnInfoPtr scrp = XF86SCRNINFO(pScreen); DisplayModePtr mode; +#endif pScreen->CreateScreenResources = randrp->CreateScreenResources; if (!(*pScreen->CreateScreenResources) (pScreen)) return FALSE; +#if 0 mode = scrp->currentMode; if (mode) xf86RandRSetMode (pScreen, mode, TRUE); +#endif return TRUE; } diff --git a/hw/xfree86/common/xf86Resources.h b/hw/xfree86/common/xf86Resources.h index 6ed3015ec..ce2c62bb3 100644 --- a/hw/xfree86/common/xf86Resources.h +++ b/hw/xfree86/common/xf86Resources.h @@ -1,4 +1,31 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Resources.h,v 1.14 2002/07/24 01:47:24 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Resources.h,v 1.15 2003/08/24 17:36:55 dawes Exp $ */ + +/* + * Copyright (c) 1999-2002 by The XFree86 Project, 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 COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + * + * Except as contained in this notice, the name of the copyright holder(s) + * and author(s) shall not be used in advertising or otherwise to promote + * the sale, use or other dealings in this Software without prior written + * authorization from the copyright holder(s) and author(s). + */ #ifndef _XF86_RESOURCES_H diff --git a/hw/xfree86/common/xf86Version.h b/hw/xfree86/common/xf86Version.h index e548b0437..07253bace 100644 --- a/hw/xfree86/common/xf86Version.h +++ b/hw/xfree86/common/xf86Version.h @@ -1,11 +1,38 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/xf86Version.h,v 3.543.2.1 2003/05/10 01:10:10 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/xf86Version.h,v 3.563 2003/11/21 06:01:44 dawes Exp $ */ + +/* + * Copyright (c) 1994-2003 by The XFree86 Project, 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 COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + * + * Except as contained in this notice, the name of the copyright holder(s) + * and author(s) shall not be used in advertising or otherwise to promote + * the sale, use or other dealings in this Software without prior written + * authorization from the copyright holder(s) and author(s). + */ #ifndef XF86_VERSION_CURRENT #define XF86_VERSION_MAJOR 4 #define XF86_VERSION_MINOR 3 -#define XF86_VERSION_PATCH 0 -#define XF86_VERSION_SNAP 1 +#define XF86_VERSION_PATCH 99 +#define XF86_VERSION_SNAP 16 /* This has five arguments for compatibilty reasons */ #define XF86_VERSION_NUMERIC(major,minor,patch,snap,dummy) \ diff --git a/hw/xfree86/common/xf86VidMode.c b/hw/xfree86/common/xf86VidMode.c index f766f899e..467270e10 100644 --- a/hw/xfree86/common/xf86VidMode.c +++ b/hw/xfree86/common/xf86VidMode.c @@ -1,7 +1,30 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86VidMode.c,v 1.17 2003/08/24 17:36:55 dawes Exp $ */ /* - * Copyright (c) 1999 by The XFree86 Project, Inc. + * Copyright (c) 1999-2003 by The XFree86 Project, 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 COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + * + * Except as contained in this notice, the name of the copyright holder(s) + * and author(s) shall not be used in advertising or otherwise to promote + * the sale, use or other dealings in this Software without prior written + * authorization from the copyright holder(s) and author(s). */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86VidMode.c,v 1.14 2003/01/28 20:52:28 tsi Exp $ */ /* * This file contains the VidMode functions required by the extension. @@ -330,6 +353,8 @@ Bool VidModeSwitchMode(int scrnIndex, pointer mode) { ScrnInfoPtr pScrn; + DisplayModePtr pTmpMode; + Bool retval; DEBUG_P("VidModeSwitchMode"); @@ -337,9 +362,15 @@ VidModeSwitchMode(int scrnIndex, pointer mode) return FALSE; pScrn = xf86Screens[scrnIndex]; + /* save in case we fail */ + pTmpMode = pScrn->currentMode; /* Force a mode switch */ pScrn->currentMode = NULL; - return xf86SwitchMode(pScrn->pScreen, mode); + retval = xf86SwitchMode(pScrn->pScreen, mode); + /* we failed: restore it */ + if (retval == FALSE) + pScrn->currentMode = pTmpMode; + return retval; } Bool @@ -440,10 +471,13 @@ VidModeAddModeline(int scrnIndex, pointer mode) pScrn = xf86Screens[scrnIndex]; + ((DisplayModePtr)mode)->name = strdup(""); /* freed by deletemode */ + ((DisplayModePtr)mode)->status = MODE_OK; ((DisplayModePtr)mode)->next = pScrn->modes->next; ((DisplayModePtr)mode)->prev = pScrn->modes; pScrn->modes->next = (DisplayModePtr)mode; - ((DisplayModePtr)mode)->next->prev = (DisplayModePtr)mode; + if( ((DisplayModePtr)mode)->next != NULL ) + ((DisplayModePtr)mode)->next->prev = (DisplayModePtr)mode; return TRUE; } @@ -547,6 +581,7 @@ VidModeCreateMode(void) mode = xalloc(sizeof(DisplayModeRec)); if (mode != NULL) { mode->name = ""; + mode->VScan = 1; /* divides refresh rate. default = 1 */ mode->Private = NULL; mode->next = mode; mode->prev = mode; diff --git a/hw/xfree86/common/xf86XKB.c b/hw/xfree86/common/xf86XKB.c index ddd3055ab..e1755de1e 100644 --- a/hw/xfree86/common/xf86XKB.c +++ b/hw/xfree86/common/xf86XKB.c @@ -24,7 +24,34 @@ OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86XKB.c,v 3.11 2002/10/11 01:40:31 dawes Exp $ */ +/* + * Copyright (c) 1994-2002 by The XFree86 Project, 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 COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + * + * Except as contained in this notice, the name of the copyright holder(s) + * and author(s) shall not be used in advertising or otherwise to promote + * the sale, use or other dealings in this Software without prior written + * authorization from the copyright holder(s) and author(s). + */ + +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86XKB.c,v 3.12 2003/08/24 17:36:55 dawes Exp $ */ #include <stdio.h> #define NEED_EVENTS 1 diff --git a/hw/xfree86/common/xf86Xinput.c b/hw/xfree86/common/xf86Xinput.c index 53fa1b3ff..eb871a40d 100644 --- a/hw/xfree86/common/xf86Xinput.c +++ b/hw/xfree86/common/xf86Xinput.c @@ -1,4 +1,4 @@ -/* $XConsortium: xf86Xinput.c /main/14 1996/10/27 11:05:25 kaleb $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Xinput.c,v 3.70 2003/11/03 05:11:02 tsi Exp $ */ /* * Copyright 1995-1999 by Frederic Lepied, France. <Lepied@XFree86.org> * @@ -21,8 +21,33 @@ * PERFORMANCE OF THIS SOFTWARE. * */ - -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Xinput.c,v 3.68 2002/10/11 01:40:31 dawes Exp $ */ +/* + * Copyright (c) 2000-2002 by The XFree86 Project, 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 COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + * + * Except as contained in this notice, the name of the copyright holder(s) + * and author(s) shall not be used in advertising or otherwise to promote + * the sale, use or other dealings in this Software without prior written + * authorization from the copyright holder(s) and author(s). + */ +/* $XConsortium: xf86Xinput.c /main/14 1996/10/27 11:05:25 kaleb $ */ #include "Xfuncproto.h" #include "Xmd.h" @@ -854,7 +879,6 @@ xf86PostMotionEvent(DeviceIntPtr device, int valuator[6]; int oldaxis[6]; int *axisvals; - AxisInfoPtr axes; int dx = 0, dy = 0; float mult; int x, y; @@ -883,7 +907,6 @@ xf86PostMotionEvent(DeviceIntPtr device, } axisvals = val->axisVal; - axes = val->axes; va_start(var, num_valuators); diff --git a/hw/xfree86/common/xf86Xinput.h b/hw/xfree86/common/xf86Xinput.h index 1e9694402..9a0393447 100644 --- a/hw/xfree86/common/xf86Xinput.h +++ b/hw/xfree86/common/xf86Xinput.h @@ -22,7 +22,34 @@ * */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Xinput.h,v 3.35 2002/10/11 01:40:31 dawes Exp $ */ +/* + * Copyright (c) 2000-2002 by The XFree86 Project, 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 COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + * + * Except as contained in this notice, the name of the copyright holder(s) + * and author(s) shall not be used in advertising or otherwise to promote + * the sale, use or other dealings in this Software without prior written + * authorization from the copyright holder(s) and author(s). + */ + +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Xinput.h,v 3.36 2003/08/24 17:36:55 dawes Exp $ */ #ifndef _xf86Xinput_h #define _xf86Xinput_h diff --git a/hw/xfree86/common/xf86cmap.c b/hw/xfree86/common/xf86cmap.c index 531a83c08..f7cb065a4 100644 --- a/hw/xfree86/common/xf86cmap.c +++ b/hw/xfree86/common/xf86cmap.c @@ -1,4 +1,30 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86cmap.c,v 1.23 2001/11/16 16:47:55 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86cmap.c,v 1.25 2003/10/17 20:02:12 alanh Exp $ */ +/* + * Copyright (c) 1998-2001 by The XFree86 Project, 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 COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + * + * Except as contained in this notice, the name of the copyright holder(s) + * and author(s) shall not be used in advertising or otherwise to promote + * the sale, use or other dealings in this Software without prior written + * authorization from the copyright holder(s) and author(s). + */ #if defined(_XOPEN_SOURCE) || defined(__QNXNTO__) #include <math.h> @@ -52,8 +78,6 @@ typedef struct { DestroyColormapProcPtr DestroyColormap; InstallColormapProcPtr InstallColormap; StoreColorsProcPtr StoreColors; - LoadPaletteFuncPtr LoadPalette; - SetOverscanFuncPtr SetOverscan; Bool (*EnterVT)(int, int); Bool (*SwitchMode)(int, DisplayModePtr, int); int (*SetDGAMode)(int, int, DGADevicePtr); @@ -103,8 +127,8 @@ Bool xf86HandleColormaps( ScreenPtr pScreen, int maxColors, int sigRGBbits, - LoadPaletteFuncPtr loadPalette, - SetOverscanFuncPtr setOverscan, + xf86LoadPaletteProc *loadPalette, + xf86SetOverscanProc *setOverscan, unsigned int flags ){ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; @@ -155,8 +179,8 @@ Bool xf86HandleColormaps( pScreen->StoreColors = CMapStoreColors; pScreenPriv->pScrn = pScrn; - pScreenPriv->LoadPalette = loadPalette; - pScreenPriv->SetOverscan = setOverscan; + pScrn->LoadPalette = loadPalette; + pScrn->SetOverscan = setOverscan; pScreenPriv->maxColors = maxColors; pScreenPriv->sigRGBbits = sigRGBbits; pScreenPriv->gammaElements = elements; @@ -483,6 +507,7 @@ CMapReinstallMap(ColormapPtr pmap) (CMapScreenPtr) pmap->pScreen->devPrivates[CMapScreenIndex].ptr; CMapColormapPtr cmapPriv = (CMapColormapPtr) pmap->devPrivates[CMapColormapIndex].ptr; + ScrnInfoPtr pScrn = xf86Screens[pmap->pScreen->myNum]; int i = cmapPriv->numColors; int *indices = pScreenPriv->PreAllocIndices; @@ -492,13 +517,13 @@ CMapReinstallMap(ColormapPtr pmap) if(cmapPriv->recalculate) CMapRefreshColors(pmap, cmapPriv->numColors, indices); else { - (*pScreenPriv->LoadPalette)(pScreenPriv->pScrn, cmapPriv->numColors, + (*pScrn->LoadPalette)(pScrn, cmapPriv->numColors, indices, cmapPriv->colors, pmap->pVisual); - if (pScreenPriv->SetOverscan) { + if (pScrn->SetOverscan) { #ifdef DEBUGOVERSCAN ErrorF("SetOverscan() called from CMapReinstallMap\n"); #endif - pScreenPriv->SetOverscan(pScreenPriv->pScrn, cmapPriv->overscan); + pScrn->SetOverscan(pScrn, cmapPriv->overscan); } } @@ -514,6 +539,7 @@ CMapRefreshColors(ColormapPtr pmap, int defs, int* indices) CMapColormapPtr pColPriv = (CMapColormapPtr) pmap->devPrivates[CMapColormapIndex].ptr; VisualPtr pVisual = pmap->pVisual; + ScrnInfoPtr pScrn = xf86Screens[pmap->pScreen->myNum]; int numColors, i; LOCO *gamma, *colors; EntryPtr entry; @@ -616,10 +642,10 @@ CMapRefreshColors(ColormapPtr pmap, int defs, int* indices) if(LOAD_PALETTE(pmap, pmap->pScreen->myNum)) - (*pScreenPriv->LoadPalette)(pScreenPriv->pScrn, defs, indices, + (*pScrn->LoadPalette)(pScreenPriv->pScrn, defs, indices, colors, pmap->pVisual); - if (pScreenPriv->SetOverscan) + if (pScrn->SetOverscan) CMapSetOverscan(pmap, defs, indices); } @@ -646,6 +672,7 @@ CMapSetOverscan(ColormapPtr pmap, int defs, int *indices) (CMapScreenPtr) pmap->pScreen->devPrivates[CMapScreenIndex].ptr; CMapColormapPtr pColPriv = (CMapColormapPtr) pmap->devPrivates[CMapColormapIndex].ptr; + ScrnInfoPtr pScrn = xf86Screens[pmap->pScreen->myNum]; VisualPtr pVisual = pmap->pVisual; int i; LOCO *colors; @@ -771,7 +798,7 @@ CMapSetOverscan(ColormapPtr pmap, int defs, int *indices) #ifdef DEBUGOVERSCAN ErrorF("SetOverscan() called from CmapSetOverscan\n"); #endif - pScreenPriv->SetOverscan(pScreenPriv->pScrn, overscan); + pScrn->SetOverscan(pScreenPriv->pScrn, overscan); } } } diff --git a/hw/xfree86/common/xf86cmap.h b/hw/xfree86/common/xf86cmap.h index b871d6762..4291b971a 100644 --- a/hw/xfree86/common/xf86cmap.h +++ b/hw/xfree86/common/xf86cmap.h @@ -1,4 +1,31 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86cmap.h,v 1.7 2001/05/06 00:49:12 mvojkovi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86cmap.h,v 1.9 2003/10/17 20:02:12 alanh Exp $ */ + +/* + * Copyright (c) 1998-2001 by The XFree86 Project, 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 COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + * + * Except as contained in this notice, the name of the copyright holder(s) + * and author(s) shall not be used in advertising or otherwise to promote + * the sale, use or other dealings in this Software without prior written + * authorization from the copyright holder(s) and author(s). + */ #ifndef _XF86CMAP_H #define _XF86CMAP_H @@ -10,25 +37,12 @@ #define CMAP_RELOAD_ON_MODE_SWITCH 0x0000002 #define CMAP_LOAD_EVEN_IF_OFFSCREEN 0x0000004 -typedef void (*LoadPaletteFuncPtr)( - ScrnInfoPtr pScrn, - int numColors, - int *indicies, - LOCO *colors, - VisualPtr pVisual -); - -typedef void (*SetOverscanFuncPtr)( - ScrnInfoPtr pScrn, - int Index -); - Bool xf86HandleColormaps( ScreenPtr pScreen, int maxCol, int sigRGBbits, - LoadPaletteFuncPtr loadPalette, - SetOverscanFuncPtr setOverscan, + xf86LoadPaletteProc *loadPalette, + xf86SetOverscanProc *setOverscan, unsigned int flags ); diff --git a/hw/xfree86/common/xf86fbBus.c b/hw/xfree86/common/xf86fbBus.c index 8fcf9b817..8a807624f 100644 --- a/hw/xfree86/common/xf86fbBus.c +++ b/hw/xfree86/common/xf86fbBus.c @@ -1,7 +1,30 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86fbBus.c,v 1.2 2001/10/28 03:33:19 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86fbBus.c,v 1.3 2003/08/24 17:36:55 dawes Exp $ */ /* - * Copyright (c) 2000 by The XFree86 Project, Inc. + * Copyright (c) 2000-2001 by The XFree86 Project, 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 COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + * + * Except as contained in this notice, the name of the copyright holder(s) + * and author(s) shall not be used in advertising or otherwise to promote + * the sale, use or other dealings in this Software without prior written + * authorization from the copyright holder(s) and author(s). */ /* diff --git a/hw/xfree86/common/xf86fbman.c b/hw/xfree86/common/xf86fbman.c index 7f4cffaae..b7c4afa1c 100644 --- a/hw/xfree86/common/xf86fbman.c +++ b/hw/xfree86/common/xf86fbman.c @@ -1,4 +1,31 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86fbman.c,v 1.24 2001/12/05 19:23:52 mvojkovi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86fbman.c,v 1.28 2003/11/03 05:11:03 tsi Exp $ */ + +/* + * Copyright (c) 1998-2001 by The XFree86 Project, 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 COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + * + * Except as contained in this notice, the name of the copyright holder(s) + * and author(s) shall not be used in advertising or otherwise to promote + * the sale, use or other dealings in this Software without prior written + * authorization from the copyright holder(s) and author(s). + */ #include "misc.h" #include "xf86.h" @@ -8,6 +35,10 @@ #include "regionstr.h" #include "xf86fbman.h" +/* +#define DEBUG +*/ + static int xf86FBMangerIndex = -1; static unsigned long xf86ManagerGeneration = 0; @@ -118,19 +149,19 @@ xf86FreeOffscreenArea(FBAreaPtr area) void -xf86FreeOffscreenLinear(FBLinearPtr area) +xf86FreeOffscreenLinear(FBLinearPtr linear) { FBManagerFuncsPtr funcs; - if(!area) return; + if(!linear) return; if(xf86FBMangerIndex < 0) return; if(!(funcs = - (FBManagerFuncsPtr)area->pScreen->devPrivates[xf86FBMangerIndex].ptr)) + (FBManagerFuncsPtr)linear->pScreen->devPrivates[xf86FBMangerIndex].ptr)) return; - (*funcs->FreeOffscreenLinear)(area); + (*funcs->FreeOffscreenLinear)(linear); return; } @@ -244,18 +275,19 @@ typedef struct _FBLink { } FBLink, *FBLinkPtr; typedef struct _FBLinearLink { - FBLinear linear; - FBAreaPtr area; + FBLinear linear; + int free; /* need to add free here as FBLinear is publicly accessible */ + FBAreaPtr area; /* only used if allocation came from XY area */ struct _FBLinearLink *next; } FBLinearLink, *FBLinearLinkPtr; typedef struct { - ScreenPtr pScreen; - RegionPtr InitialBoxes; - RegionPtr FreeBoxes; - FBLinkPtr UsedAreas; - int NumUsedAreas; + ScreenPtr pScreen; + RegionPtr InitialBoxes; + RegionPtr FreeBoxes; + FBLinkPtr UsedAreas; + int NumUsedAreas; FBLinearLinkPtr LinearAreas; CloseScreenProcPtr CloseScreen; int NumCallbacks; @@ -772,6 +804,97 @@ LinearRemoveCBWrapper(FBAreaPtr area) xfree(pLink); } +#ifdef DEBUG +static void +Dump(FBLinearLinkPtr pLink) +{ + if (!pLink) ErrorF("MMmm, PLINK IS NULL!\n"); + + while (pLink) { + ErrorF(" Offset:%08x, Size:%08x, %s,%s\n", + pLink->linear.offset, + pLink->linear.size, + pLink->free ? "Free" : "Used", + pLink->area ? "Area" : "Linear"); + + pLink = pLink->next; + } +} +#endif + +static FBLinearPtr +AllocateLinear( + FBManagerPtr offman, + int size, + int granularity, + pointer privData +){ + ScreenPtr pScreen = offman->pScreen; + FBLinearLinkPtr linear = NULL; + FBLinearLinkPtr newlink = NULL; + int offset, end; + + if(size <= 0) return NULL; + + if (!offman->LinearAreas) return NULL; + + linear = offman->LinearAreas; + while (linear) { + /* Make sure we get a free area that's not an XY fallback case */ + if (!linear->area && linear->free) { + offset = (linear->linear.offset + granularity) & ~granularity; + end = offset+size; + if (end <= (linear->linear.offset + linear->linear.size)) + break; + } + linear = linear->next; + } + if (!linear) + return NULL; + + /* break left */ + if (offset > linear->linear.offset) { + newlink = xalloc(sizeof(FBLinearLink)); + if (!newlink) + return NULL; + newlink->area = NULL; + newlink->linear.offset = offset; + newlink->linear.size = linear->linear.size - (offset - linear->linear.offset); + newlink->free = 1; + newlink->next = linear->next; + linear->linear.size -= newlink->linear.size; + linear->next = newlink; + linear = newlink; + } + + /* break right */ + if (size < linear->linear.size) { + newlink = xalloc(sizeof(FBLinearLink)); + if (!newlink) + return NULL; + newlink->area = NULL; + newlink->linear.offset = offset + size; + newlink->linear.size = linear->linear.size - size; + newlink->free = 1; + newlink->next = linear->next; + linear->linear.size = size; + linear->next = newlink; + } + + /* p = middle block */ + linear->linear.granularity = granularity; + linear->free = 0; + linear->linear.pScreen = pScreen; + linear->linear.MoveLinearCallback = NULL; + linear->linear.RemoveLinearCallback = NULL; + linear->linear.devPrivate.ptr = NULL; + +#ifdef DEBUG + Dump(offman->LinearAreas); +#endif + + return &(linear->linear); +} static FBLinearPtr localAllocateOffscreenLinear( @@ -791,28 +914,21 @@ localAllocateOffscreenLinear( offman = pScreen->devPrivates[xf86FBScreenIndex].ptr; - if(!(link = xalloc(sizeof(FBLinearLink)))) - return NULL; + /* Try to allocate from linear memory first...... */ +#ifdef DEBUG + ErrorF("ALLOCATING LINEAR\n"); +#endif + if ((linear = AllocateLinear(offman, length, gran, privData))) + return linear; -#if 0 - if(we have linear heap space) { - if(able to allocate some) { - link->area = NULL; - link->next = offman->LinearAreas; - offman->LinearAreas = link; - linear = link->linear; - linear->pScreen = pScreen; - linear->size = length; - linear->offset = ????; - linear->granularity = gran; - linear->MoveLinearAreaCallback = moveCB; - linear->RemoveLinearAreaCallback = removeCB; - linear->devPrivate.ptr = privData; - return linear; - } /* else fallthrough */ - } +#ifdef DEBUG + ErrorF("NOPE, ALLOCATING AREA\n"); #endif + if(!(link = xalloc(sizeof(FBLinearLink)))) + return NULL; + + /* No linear available, so try and pinch some from the XY areas */ extents = REGION_EXTENTS(pScreen, offman->InitialBoxes); pitch = extents->x2 - extents->x1; @@ -836,6 +952,7 @@ localAllocateOffscreenLinear( privData))) { link->area = area; + link->free = 0; link->next = offman->LinearAreas; offman->LinearAreas = link; linear = &(link->linear); @@ -849,6 +966,10 @@ localAllocateOffscreenLinear( } else xfree(link); +#ifdef DEBUG + Dump(offman->LinearAreas); +#endif + return linear; } @@ -861,7 +982,7 @@ localFreeOffscreenLinear(FBLinearPtr linear) ScreenPtr pScreen = linear->pScreen; offman = pScreen->devPrivates[xf86FBScreenIndex].ptr; - + pLink = offman->LinearAreas; if(!pLink) return; @@ -872,16 +993,42 @@ localFreeOffscreenLinear(FBLinearPtr linear) } if(pLink->area) { /* really an XY area */ - localFreeOffscreenArea(pLink->area); - } else { - /* free the linear area */ +#ifdef DEBUG + ErrorF("FREEING AREA\n"); +#endif + localFreeOffscreenArea(pLink->area); + if(pLinkPrev) + pLinkPrev->next = pLink->next; + else offman->LinearAreas = pLink->next; + xfree(pLink); +#ifdef DEBUG + Dump(offman->LinearAreas); +#endif + return; } - if(pLinkPrev) - pLinkPrev->next = pLink->next; - else offman->LinearAreas = pLink->next; + pLink->free = 1; - xfree(pLink); + if (pLink->next && pLink->next->free) { + FBLinearLinkPtr p = pLink->next; + pLink->linear.size += p->linear.size; + pLink->next = p->next; + free(p); + } + + if(pLinkPrev) { + if (pLinkPrev->next && pLinkPrev->next->free && !pLinkPrev->area) { + FBLinearLinkPtr p = pLinkPrev->next; + pLinkPrev->linear.size += p->linear.size; + pLinkPrev->next = p->next; + free(p); + } + } + +#ifdef DEBUG + ErrorF("FREEING LINEAR\n"); + Dump(offman->LinearAreas); +#endif } @@ -889,7 +1036,7 @@ static Bool localResizeOffscreenLinear(FBLinearPtr resize, int length) { FBManagerPtr offman; - FBLinearLinkPtr pLink, pLinkPrev = NULL; + FBLinearLinkPtr pLink; ScreenPtr pScreen = resize->pScreen; offman = pScreen->devPrivates[xf86FBScreenIndex].ptr; @@ -898,7 +1045,6 @@ localResizeOffscreenLinear(FBLinearPtr resize, int length) if(!pLink) return FALSE; while(&(pLink->linear) != resize) { - pLinkPrev = pLink; pLink = pLink->next; if(!pLink) return FALSE; } @@ -928,7 +1074,7 @@ localResizeOffscreenLinear(FBLinearPtr resize, int length) return TRUE; } } else { - /* resize the linear area */ + /* TODO!!!! resize the linear area */ } return FALSE; @@ -943,22 +1089,45 @@ localQueryLargestOffscreenLinear( int priority ) { - int w, h; + FBManagerPtr offman = pScreen->devPrivates[xf86FBScreenIndex].ptr; + FBLinearLinkPtr pLink; + FBLinearLinkPtr pLinkRet; *size = 0; + + if (!offman->LinearAreas) return FALSE; - /* for now, we only look at XY space */ - if(localQueryLargestOffscreenArea(pScreen, &w, &h, gran, - FAVOR_WIDTH_THEN_AREA, priority)) - { - FBManagerPtr offman; - BoxPtr extents; + pLink = offman->LinearAreas; + pLinkRet = pLink; - offman = pScreen->devPrivates[xf86FBScreenIndex].ptr; - extents = REGION_EXTENTS(pScreen, offman->InitialBoxes); - if((extents->x2 - extents->x1) == w) - *size = w * h; - return TRUE; + if (!pLink->area) { + while (pLink) { + if (pLink->free) { + if (pLink->linear.size > pLinkRet->linear.size) + pLinkRet = pLink; + } + pLink = pLink->next; + } + + if (pLinkRet->free) { + *size = pLinkRet->linear.size; + return TRUE; + } + } else { + int w, h; + + if(localQueryLargestOffscreenArea(pScreen, &w, &h, gran, + FAVOR_WIDTH_THEN_AREA, priority)) + { + FBManagerPtr offman; + BoxPtr extents; + + offman = pScreen->devPrivates[xf86FBScreenIndex].ptr; + extents = REGION_EXTENTS(pScreen, offman->InitialBoxes); + if((extents->x2 - extents->x1) == w) + *size = w * h; + return TRUE; + } } return FALSE; @@ -1189,6 +1358,44 @@ xf86InitFBManagerRegion( return TRUE; } +Bool +xf86InitFBManagerLinear( + ScreenPtr pScreen, + int offset, + int size +){ + FBManagerPtr offman; + FBLinearLinkPtr link; + FBLinearPtr linear; + + if (size <= 0) + return FALSE; + + /* we expect people to have called the Area setup first for pixmap cache */ + if (!pScreen->devPrivates[xf86FBScreenIndex].ptr) + return FALSE; + + offman = pScreen->devPrivates[xf86FBScreenIndex].ptr; + + offman->LinearAreas = xalloc(sizeof(FBLinearLink)); + if (!offman->LinearAreas) + return FALSE; + + link = offman->LinearAreas; + link->area = NULL; + link->next = NULL; + link->free = 1; + linear = &(link->linear); + linear->pScreen = pScreen; + linear->size = size; + linear->offset = offset; + linear->granularity = 0; + linear->MoveLinearCallback = NULL; + linear->RemoveLinearCallback = NULL; + linear->devPrivate.ptr = NULL; + + return TRUE; +} /* This is an implementation specific function and should diff --git a/hw/xfree86/common/xf86fbman.h b/hw/xfree86/common/xf86fbman.h index 673c7bc33..adb26a1f1 100644 --- a/hw/xfree86/common/xf86fbman.h +++ b/hw/xfree86/common/xf86fbman.h @@ -1,4 +1,31 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86fbman.h,v 1.12 2001/08/28 16:55:09 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86fbman.h,v 1.14 2003/10/09 12:40:54 alanh Exp $ */ + +/* + * Copyright (c) 1998-2001 by The XFree86 Project, 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 COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + * + * Except as contained in this notice, the name of the copyright holder(s) + * and author(s) shall not be used in advertising or otherwise to promote + * the sale, use or other dealings in this Software without prior written + * authorization from the copyright holder(s) and author(s). + */ #ifndef _XF86FBMAN_H #define _XF86FBMAN_H @@ -108,6 +135,13 @@ xf86InitFBManager( BoxPtr FullBox ); +Bool +xf86InitFBManagerLinear( + ScreenPtr pScreen, + int offset, + int size +); + Bool xf86FBManagerRunning( ScreenPtr pScreen diff --git a/hw/xfree86/common/xf86isaBus.c b/hw/xfree86/common/xf86isaBus.c index cfe6ed000..1b9890d5e 100644 --- a/hw/xfree86/common/xf86isaBus.c +++ b/hw/xfree86/common/xf86isaBus.c @@ -1,9 +1,32 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86isaBus.c,v 3.5 2000/12/06 15:35:11 eich Exp $ */ - +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86isaBus.c,v 3.6 2003/08/24 17:36:55 dawes Exp $ */ /* - * Copyright (c) 1997-1999 by The XFree86 Project, Inc. + * Copyright (c) 1997-2000 by The XFree86 Project, 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 COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + * + * Except as contained in this notice, the name of the copyright holder(s) + * and author(s) shall not be used in advertising or otherwise to promote + * the sale, use or other dealings in this Software without prior written + * authorization from the copyright holder(s) and author(s). */ + /* * This file contains the interfaces to the bus-specific code */ diff --git a/hw/xfree86/common/xf86noBus.c b/hw/xfree86/common/xf86noBus.c index a9efcdbc4..2d79ab476 100644 --- a/hw/xfree86/common/xf86noBus.c +++ b/hw/xfree86/common/xf86noBus.c @@ -1,7 +1,30 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86noBus.c,v 1.1 2002/09/18 08:54:55 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86noBus.c,v 1.2 2003/08/24 17:36:55 dawes Exp $ */ /* - * Copyright (c) 2000 by The XFree86 Project, Inc. + * Copyright (c) 2000-2002 by The XFree86 Project, 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 COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + * + * Except as contained in this notice, the name of the copyright holder(s) + * and author(s) shall not be used in advertising or otherwise to promote + * the sale, use or other dealings in this Software without prior written + * authorization from the copyright holder(s) and author(s). */ /* diff --git a/hw/xfree86/common/xf86pciBus.c b/hw/xfree86/common/xf86pciBus.c index c40fc1016..641d1c919 100644 --- a/hw/xfree86/common/xf86pciBus.c +++ b/hw/xfree86/common/xf86pciBus.c @@ -1,6 +1,29 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86pciBus.c,v 3.68.2.1 2003/05/06 17:00:43 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86pciBus.c,v 3.77 2003/11/03 05:11:03 tsi Exp $ */ /* - * Copyright (c) 1997-2002 by The XFree86 Project, Inc. + * Copyright (c) 1997-2003 by The XFree86 Project, 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 COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + * + * Except as contained in this notice, the name of the copyright holder(s) + * and author(s) shall not be used in advertising or otherwise to promote + * the sale, use or other dealings in this Software without prior written + * authorization from the copyright holder(s) and author(s). */ /* @@ -270,8 +293,8 @@ FindPCIVideoInfo(void) } /* - * 64-bit base addresses are checked for and avoided. - * XXX Should deal with them on platforms that support them. + * 64-bit base addresses are checked for and avoided on 32-bit + * platforms. */ if (pcrp->pci_base0) { if (pcrp->pci_base0 & PCI_MAP_IO) { @@ -454,7 +477,7 @@ FindPCIVideoInfo(void) memdone = TRUE; } else xf86ErrorF(", "); - xf86ErrorF("0x%08x/%d", info->memBase[i], info->size[i]); + xf86ErrorF("0x%08lx/%d", info->memBase[i], info->size[i]); } } for (i = 0; i < 6; i++) { @@ -465,12 +488,12 @@ FindPCIVideoInfo(void) iodone = TRUE; } else xf86ErrorF(", "); - xf86ErrorF("0x%04x/%d", info->ioBase[i], info->size[i]); + xf86ErrorF("0x%04lx/%d", info->ioBase[i], info->size[i]); } } if (info->biosBase && (info->biosBase < (memType)(-1 << info->biosSize))) - xf86ErrorF(", BIOS @ 0x%08x/%d", info->biosBase, info->biosSize); + xf86ErrorF(", BIOS @ 0x%08lx/%d", info->biosBase, info->biosSize); xf86ErrorF("\n"); } } @@ -567,7 +590,7 @@ pciIoAccessEnable(void* arg) ErrorF("pciIoAccessEnable: 0x%05lx\n", *(PCITAG *)arg); #endif pArg->ctrl |= SETBITS | PCI_CMD_MASTER_ENABLE; - (*pArg->func)(pArg->tag, PCI_CMD_STAT_REG, pArg->ctrl); + pciWriteLong(pArg->tag, PCI_CMD_STAT_REG, pArg->ctrl); } static void @@ -577,7 +600,7 @@ pciIoAccessDisable(void* arg) ErrorF("pciIoAccessDisable: 0x%05lx\n", *(PCITAG *)arg); #endif pArg->ctrl &= ~SETBITS; - (*pArg->func)(pArg->tag, PCI_CMD_STAT_REG, pArg->ctrl); + pciWriteLong(pArg->tag, PCI_CMD_STAT_REG, pArg->ctrl); } #undef SETBITS @@ -589,7 +612,7 @@ pciIo_MemAccessEnable(void* arg) ErrorF("pciIo_MemAccessEnable: 0x%05lx\n", *(PCITAG *)arg); #endif pArg->ctrl |= SETBITS | PCI_CMD_MASTER_ENABLE; - (*pArg->func)(pArg->tag, PCI_CMD_STAT_REG, pArg->ctrl); + pciWriteLong(pArg->tag, PCI_CMD_STAT_REG, pArg->ctrl); } static void @@ -599,7 +622,7 @@ pciIo_MemAccessDisable(void* arg) ErrorF("pciIo_MemAccessDisable: 0x%05lx\n", *(PCITAG *)arg); #endif pArg->ctrl &= ~SETBITS; - (*pArg->func)(pArg->tag, PCI_CMD_STAT_REG, pArg->ctrl); + pciWriteLong(pArg->tag, PCI_CMD_STAT_REG, pArg->ctrl); } #undef SETBITS @@ -611,7 +634,7 @@ pciMemAccessEnable(void* arg) ErrorF("pciMemAccessEnable: 0x%05lx\n", *(PCITAG *)arg); #endif pArg->ctrl |= SETBITS | PCI_CMD_MASTER_ENABLE; - (*pArg->func)(pArg->tag, PCI_CMD_STAT_REG, pArg->ctrl); + pciWriteLong(pArg->tag, PCI_CMD_STAT_REG, pArg->ctrl); } static void @@ -621,38 +644,48 @@ pciMemAccessDisable(void* arg) ErrorF("pciMemAccessDisable: 0x%05lx\n", *(PCITAG *)arg); #endif pArg->ctrl &= ~SETBITS; - (*pArg->func)(pArg->tag, PCI_CMD_STAT_REG, pArg->ctrl); + pciWriteLong(pArg->tag, PCI_CMD_STAT_REG, pArg->ctrl); } #undef SETBITS #undef pArg /* move to OS layer */ -#define PCI_PCI_BRDG_CTRL_BASE (PCI_PCI_BRIDGE_CONTROL_REG & 0xFC) -#define SHIFT_BITS ((PCI_PCI_BRIDGE_CONTROL_REG & 0x3) << 3) -#define SETBITS (CARD32)((PCI_PCI_BRIDGE_VGA_EN) << SHIFT_BITS) +#define MASKBITS (PCI_PCI_BRIDGE_VGA_EN | PCI_PCI_BRIDGE_MASTER_ABORT_EN) static void pciBusAccessEnable(BusAccPtr ptr) { + PCITAG tag = ptr->busdep.pci.acc; + CARD16 ctrl; + #ifdef DEBUG ErrorF("pciBusAccessEnable: bus=%d\n", ptr->busdep.pci.bus); #endif - (*ptr->busdep.pci.func)(ptr->busdep.pci.acc, PCI_PCI_BRDG_CTRL_BASE, - SETBITS, SETBITS); + ctrl = pciReadWord(tag, PCI_PCI_BRIDGE_CONTROL_REG); + if ((ctrl & MASKBITS) != PCI_PCI_BRIDGE_VGA_EN) { + ctrl = (ctrl | PCI_PCI_BRIDGE_VGA_EN) & + ~(PCI_PCI_BRIDGE_MASTER_ABORT_EN | PCI_PCI_BRIDGE_SECONDARY_RESET); + pciWriteWord(tag, PCI_PCI_BRIDGE_CONTROL_REG, ctrl); + } } /* move to OS layer */ static void pciBusAccessDisable(BusAccPtr ptr) { + PCITAG tag = ptr->busdep.pci.acc; + CARD16 ctrl; + #ifdef DEBUG ErrorF("pciBusAccessDisable: bus=%d\n", ptr->busdep.pci.bus); #endif - (*ptr->busdep.pci.func)(ptr->busdep.pci.acc, PCI_PCI_BRDG_CTRL_BASE, - SETBITS, 0); + ctrl = pciReadWord(tag, PCI_PCI_BRIDGE_CONTROL_REG); + if (ctrl & MASKBITS) { + ctrl &= ~(MASKBITS | PCI_PCI_BRIDGE_SECONDARY_RESET); + pciWriteWord(tag, PCI_PCI_BRIDGE_CONTROL_REG, ctrl); + } } -#undef SETBITS -#undef SHIFT_BITS +#undef MASKBITS /* move to OS layer */ static void @@ -740,23 +773,34 @@ restorePciState(PCITAG tag, pciSavePtr ptr) static void savePciBusState(BusAccPtr ptr) { + PCITAG tag = ptr->busdep.pci.acc; + ptr->busdep.pci.save.control = - pciReadWord(ptr->busdep.pci.acc, PCI_PCI_BRIDGE_CONTROL_REG) & + pciReadWord(tag, PCI_PCI_BRIDGE_CONTROL_REG) & ~PCI_PCI_BRIDGE_SECONDARY_RESET; /* Allow master aborts to complete normally on non-root buses */ if (ptr->busdep.pci.save.control & PCI_PCI_BRIDGE_MASTER_ABORT_EN) - pciWriteWord(ptr->busdep.pci.acc, PCI_PCI_BRIDGE_CONTROL_REG, - ptr->busdep.pci.save.control - & ~PCI_PCI_BRIDGE_MASTER_ABORT_EN); + pciWriteWord(tag, PCI_PCI_BRIDGE_CONTROL_REG, + ptr->busdep.pci.save.control & ~PCI_PCI_BRIDGE_MASTER_ABORT_EN); } /* move to OS layer */ +#define MASKBITS (PCI_PCI_BRIDGE_VGA_EN | PCI_PCI_BRIDGE_MASTER_ABORT_EN) static void restorePciBusState(BusAccPtr ptr) { - pciWriteWord(ptr->busdep.pci.acc, PCI_PCI_BRIDGE_CONTROL_REG, - ptr->busdep.pci.save.control); + PCITAG tag = ptr->busdep.pci.acc; + CARD16 ctrl; + + /* Only restore the bits we've changed (and don't cause resets) */ + ctrl = pciReadWord(tag, PCI_PCI_BRIDGE_CONTROL_REG); + if ((ctrl ^ ptr->busdep.pci.save.control) & MASKBITS) { + ctrl &= ~(MASKBITS | PCI_PCI_BRIDGE_SECONDARY_RESET); + ctrl |= ptr->busdep.pci.save.control & MASKBITS; + pciWriteWord(tag, PCI_PCI_BRIDGE_CONTROL_REG, ctrl); + } } +#undef MASKBITS /* move to OS layer */ static void @@ -828,12 +872,17 @@ correctPciSize(memType base, memType oldsize, memType newsize, #if defined(LONG64) || defined(WORD64) || (B2M(pcrp->tag,PCIGETMEMORY64(basep[i])) == base) +#else + || + (!basep[i+1] + && (B2M(pcrp->tag,PCIGETMEMORY(basep[i])) == base)) #endif ))) { pcrp->basesize[i] = new_bits; break; /* to next device */ } } + if (PCI_MAP_IS64BITMEM(basep[i])) i++; } } @@ -883,7 +932,7 @@ removeOverlapsWithBridges(int busIndex, resPtr target) target->block_end - target->block_begin, target->res_type); xf86MsgVerb(X_INFO, 3, - "PCI %s resource overlap reduced 0x%08x from 0x%08x to 0x%08x\n", + "PCI %s resource overlap reduced 0x%08lx from 0x%08lx to 0x%08lx\n", ((target->res_type & ResPhysMask) == ResMem) ? "Memory" : "I/O", range.rBegin, range.rEnd, target->block_end); } @@ -988,28 +1037,38 @@ xf86GetPciRes(resPtr *activeRes, resPtr *inactiveRes) (subclass == PCI_SUBCLASS_BRIDGE_HOST)) resMisc |= ResOverlap; - if ((pcrp->pci_command & (PCI_CMD_IO_ENABLE | PCI_CMD_MEM_ENABLE))) - res = activeRes; - else - res = inactiveRes; - basep = &pcrp->pci_base0; for (i = 0; i < 6; i++) { if (basep[i]) { - if (PCI_MAP_IS_IO(basep[i])) - P_I_RANGE(range,pcrp->tag,PCIGETIO(basep[i]), + if (PCI_MAP_IS_IO(basep[i])) { + if (pcrp->pci_command & PCI_CMD_IO_ENABLE) + res = activeRes; + else + res = inactiveRes; + P_I_RANGE(range, pcrp->tag, PCIGETIO(basep[i]), pcrp->basesize[i], ResExcIoBlock | resMisc) - else if (!PCI_MAP_IS64BITMEM(basep[i])) - P_M_RANGE(range,pcrp->tag,PCIGETMEMORY(basep[i]), - pcrp->basesize[i], ResExcMemBlock | resMisc) - else { + } else if (!PCI_MAP_IS64BITMEM(basep[i])) { + if (pcrp->pci_command & PCI_CMD_MEM_ENABLE) + res = activeRes; + else + res = inactiveRes; + P_M_RANGE(range, pcrp->tag, PCIGETMEMORY(basep[i]), + pcrp->basesize[i], ResExcMemBlock | resMisc) + } else { i++; #if defined(LONG64) || defined(WORD64) - P_M_RANGE(range,pcrp->tag,PCIGETMEMORY64(basep[i-1]), - pcrp->basesize[i-1], ResExcMemBlock | resMisc) + P_M_RANGE(range,pcrp->tag,PCIGETMEMORY64(basep[i - 1]), + pcrp->basesize[i - 1], ResExcMemBlock | resMisc) #else + if (basep[i]) continue; + P_M_RANGE(range, pcrp->tag, PCIGETMEMORY(basep[i - 1]), + pcrp->basesize[i - 1], ResExcMemBlock | resMisc) #endif + if (pcrp->pci_command & PCI_CMD_MEM_ENABLE) + res = activeRes; + else + res = inactiveRes; } if (range.rBegin) { /* catch cases where PCI base is unset */ tmp = xf86AddResToList(NULL, &range, -1); @@ -1018,15 +1077,16 @@ xf86GetPciRes(resPtr *activeRes, resPtr *inactiveRes) } } } + /* Ignore disabled non-video ROMs */ - if ((res == activeRes) && + if ((pcrp->pci_command & PCI_CMD_MEM_ENABLE) && (pcrp->pci_baserom & PCI_MAP_ROM_DECODE_ENABLE)) { P_M_RANGE(range,pcrp->tag,PCIGETROM(pcrp->pci_baserom), pcrp->basesize[6], ResExcMemBlock | resMisc); if (range.rBegin) { tmp = xf86AddResToList(NULL, &range, -1); - removeOverlapsWithBridges(pcrp->busnum,tmp); - *res = xf86JoinResLists(tmp,*res); + removeOverlapsWithBridges(pcrp->busnum, tmp); + *activeRes = xf86JoinResLists(tmp, *activeRes); } } } @@ -1063,8 +1123,8 @@ xf86GetPciRes(resPtr *activeRes, resPtr *inactiveRes) pRes->block_end - pRes->block_begin, pRes->res_type); xf86MsgVerb(X_INFO, 3, - "PCI %s resource overlap reduced 0x%08x" - " from 0x%08x to 0x%08x\n", + "PCI %s resource overlap reduced 0x%08lx" + " from 0x%08lx to 0x%08lx\n", ((pRes->res_type & ResPhysMask) == ResMem) ? "Memory" : "I/O", range.rBegin, range.rEnd, pRes->block_end); @@ -1092,8 +1152,8 @@ xf86GetPciRes(resPtr *activeRes, resPtr *inactiveRes) pRes->block_end - pRes->block_begin, pRes->res_type); xf86MsgVerb(X_INFO, 3, - "PCI %s resource overlap reduced 0x%08x" - " from 0x%08x to 0x%08x\n", + "PCI %s resource overlap reduced 0x%08lx" + " from 0x%08lx to 0x%08lx\n", ((pRes->res_type & ResPhysMask) == ResMem) ? "Memory" : "I/O", range.rBegin, range.rEnd, pRes->block_end); @@ -1760,8 +1820,8 @@ xf86GetPciBridgeInfo(void) break; } - if (pBusInfo && pBusInfo->funcs->pciGetBridgeBusses) - (*pBusInfo->funcs->pciGetBridgeBusses)(secondary, + if (pBusInfo && pBusInfo->funcs->pciGetBridgeBuses) + (*pBusInfo->funcs->pciGetBridgeBuses)(secondary, &primary, &secondary, &subordinate); @@ -1899,8 +1959,8 @@ xf86GetPciBridgeInfo(void) break; } - if (pBusInfo && pBusInfo->funcs->pciGetBridgeBusses) - (*pBusInfo->funcs->pciGetBridgeBusses)(secondary, + if (pBusInfo && pBusInfo->funcs->pciGetBridgeBuses) + (*pBusInfo->funcs->pciGetBridgeBuses)(secondary, &primary, &secondary, &subordinate); @@ -2087,8 +2147,8 @@ xf86GetPciBridgeInfo(void) if (pBusInfo) { PciBus->primary = PciBus->secondary = secondary; - if (pBusInfo->funcs->pciGetBridgeBusses) - (*pBusInfo->funcs->pciGetBridgeBusses) + if (pBusInfo->funcs->pciGetBridgeBuses) + (*pBusInfo->funcs->pciGetBridgeBuses) (secondary, &PciBus->primary, &PciBus->secondary, @@ -2275,7 +2335,6 @@ ValidatePci(void) pciConfigPtr pcrp, *pcrpp; CARD32 *basep; resPtr Sys; - resPtr Fix; resRange range; int n = 0, m, i; @@ -2286,6 +2345,7 @@ ValidatePci(void) * the ones which have been assigned to a screen. */ Sys = xf86DupResList(osRes); + /* Only validate graphics devices in use */ for (i=0; i<xf86NumScreens; i++) { for (m = 0; m < xf86Screens[i]->numEntities; m++) if ((pvp = xf86GetPciInfoForEntity(xf86Screens[i]->entityList[m]))) @@ -2328,6 +2388,7 @@ ValidatePci(void) } for (pcrpp = xf86PciInfo, pcrp = *pcrpp; pcrp; pcrp = *++(pcrpp)) { + /* These were handled above */ if (PCIINFOCLASSES(pcrp->pci_base_class, pcrp->pci_sub_class)) continue; @@ -2350,13 +2411,16 @@ ValidatePci(void) pcrp->basesize[i], ResExcMemBlock) } else { i++; -#if defined(LONG64) || defined(WORD64) if (!(pcrp->pci_command & PCI_CMD_MEM_ENABLE)) continue; +#if defined(LONG64) || defined(WORD64) P_M_RANGE(range, pcrp->tag, PCIGETMEMORY64(basep[i-1]), pcrp->basesize[i-1], ResExcMemBlock) #else - continue; + if (basep[i]) + continue; + P_M_RANGE(range, pcrp->tag, PCIGETMEMORY(basep[i-1]), + pcrp->basesize[i-1], ResExcMemBlock) #endif } Sys = xf86AddResToList(Sys, &range, -1); @@ -2458,7 +2522,6 @@ ValidatePci(void) xf86MsgVerb(X_INFO, 3,"MEM/IO:\n"); xf86PrintResList(3,res_m_io); #endif - Fix = NULL; for (i = 0; i < 6; i++) { int j; resPtr own = NULL; @@ -2596,8 +2659,6 @@ initPciState(void) pcaccp->devnum = pvp->device; pcaccp->funcnum = pvp->func; pcaccp->arg.tag = pciTag(pvp->bus, pvp->device, pvp->func); - pcaccp->arg.func = - (WriteProcPtr)pciLongFunc(pcaccp->arg.tag,WRITE); pcaccp->ioAccess.AccessDisable = pciIoAccessDisable; pcaccp->ioAccess.AccessEnable = pciIoAccessEnable; pcaccp->ioAccess.arg = &pcaccp->arg; @@ -2674,8 +2735,6 @@ initPciBusState(void) pbap->enable_f = pciBusAccessEnable; pbap->disable_f = pciBusAccessDisable; pbap->busdep.pci.acc = pciTag(pbp->brbus,pbp->brdev,pbp->brfunc); - pbap->busdep.pci.func = - (SetBitsProcPtr)pciLongFunc(pbap->busdep.pci.acc,SET_BITS); savePciBusState(pbap); break; case PCI_SUBCLASS_BRIDGE_ISA: diff --git a/hw/xfree86/common/xf86pciBus.h b/hw/xfree86/common/xf86pciBus.h index fbe3fbe62..fbb733ae7 100644 --- a/hw/xfree86/common/xf86pciBus.h +++ b/hw/xfree86/common/xf86pciBus.h @@ -1,4 +1,31 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86pciBus.h,v 3.8 2002/09/16 16:55:33 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86pciBus.h,v 3.10 2003/08/24 17:36:56 dawes Exp $ */ + +/* + * Copyright (c) 1999-2003 by The XFree86 Project, 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 COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + * + * Except as contained in this notice, the name of the copyright holder(s) + * and author(s) shall not be used in advertising or otherwise to promote + * the sale, use or other dealings in this Software without prior written + * authorization from the copyright holder(s) and author(s). + */ #ifndef _XF86_PCI_BUS_H #define _XF86_PCI_BUS_H @@ -11,12 +38,8 @@ typedef struct { CARD32 biosBase; } pciSave, *pciSavePtr; -typedef void (*SetBitsProcPtr)(PCITAG, int, CARD32, CARD32); -typedef void (*WriteProcPtr)(PCITAG, int, CARD32); - typedef struct { PCITAG tag; - WriteProcPtr func; CARD32 ctrl; } pciArg; diff --git a/hw/xfree86/common/xf86str.h b/hw/xfree86/common/xf86str.h index 2b6deed33..367cb19a9 100644 --- a/hw/xfree86/common/xf86str.h +++ b/hw/xfree86/common/xf86str.h @@ -1,7 +1,30 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86str.h,v 1.90 2002/11/25 14:04:56 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86str.h,v 1.97 2003/10/30 17:36:56 tsi Exp $ */ /* - * Copyright (c) 1997-2000 by The XFree86 Project, Inc. + * Copyright (c) 1997-2003 by The XFree86 Project, 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 COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + * + * Except as contained in this notice, the name of the copyright holder(s) + * and author(s) shall not be used in advertising or otherwise to promote + * the sale, use or other dealings in this Software without prior written + * authorization from the copyright holder(s) and author(s). */ /* @@ -16,6 +39,7 @@ #include "input.h" #include "scrnintstr.h" #include "pixmapstr.h" +#include "colormapst.h" #include "xf86Module.h" #include "xf86Opt.h" #include "xf86Pci.h" @@ -452,24 +476,10 @@ typedef struct _confdrirec { /* These values should be adjusted when new fields are added to ScrnInfoRec */ #define NUM_RESERVED_INTS 16 #define NUM_RESERVED_POINTERS 15 -#define NUM_RESERVED_FUNCS 16 +#define NUM_RESERVED_FUNCS 12 typedef pointer (*funcPointer)(void); -/* Flags for driver messages */ -typedef enum { - X_PROBED, /* Value was probed */ - X_CONFIG, /* Value was given in the config file */ - X_DEFAULT, /* Value is a default */ - X_CMDLINE, /* Value was given on the command line */ - X_NOTICE, /* Notice */ - X_ERROR, /* Error message */ - X_WARNING, /* Warning message */ - X_INFO, /* Informational message */ - X_NONE, /* No prefix */ - X_NOT_IMPLEMENTED /* Not implemented */ -} MessageType; - /* flags for depth 24 pixmap options */ typedef enum { Pix24DontCare = 0, @@ -747,12 +757,16 @@ typedef void xf86AdjustFrameProc (int, int, int, int); typedef Bool xf86EnterVTProc (int, int); typedef void xf86LeaveVTProc (int, int); typedef void xf86FreeScreenProc (int, int); -typedef int xf86ValidModeProc (int, DisplayModePtr, Bool, int); +typedef ModeStatus xf86ValidModeProc (int, DisplayModePtr, Bool, int); typedef void xf86EnableDisableFBAccessProc(int, Bool); typedef int xf86SetDGAModeProc (int, int, DGADevicePtr); typedef int xf86ChangeGammaProc (int, Gamma); typedef void xf86PointerMovedProc (int, int, int); typedef Bool xf86PMEventProc (int, pmEvent, Bool); +typedef int xf86HandleMessageProc (int, const char*, const char*, char**); +typedef void xf86DPMSSetProc (ScrnInfoPtr, int, int); +typedef void xf86LoadPaletteProc (ScrnInfoPtr, int, int *, LOCO *, VisualPtr); +typedef void xf86SetOverscanProc (ScrnInfoPtr, int); /* * ScrnInfoRec @@ -903,6 +917,10 @@ typedef struct _ScrnInfoRec { xf86ChangeGammaProc *ChangeGamma; xf86PointerMovedProc *PointerMoved; xf86PMEventProc *PMEvent; + xf86HandleMessageProc *HandleMessage; + xf86DPMSSetProc *DPMSSet; + xf86LoadPaletteProc *LoadPalette; + xf86SetOverscanProc *SetOverscan; /* * This can be used when the minor ABI version is incremented. @@ -1023,7 +1041,32 @@ typedef enum { ACTION_CLOSECLIENT, /* Kill client holding grab */ ACTION_SWITCHSCREEN = 100, /* VT switch */ ACTION_SWITCHSCREEN_NEXT, - ACTION_SWITCHSCREEN_PREV + ACTION_SWITCHSCREEN_PREV, + ACTION_MESSAGE = 9999 /* Generic message passing */ } ActionEvent; +/* xf86Versions.c */ +/* + * Never change existing values, and always assign values explicitly. + * NUM_BUILTIN_IFS must always be the last entry. + */ +typedef enum { + BUILTIN_IF_OSMOUSE = 0, + BUILTIN_IF_OSKBD = 1, + NUM_BUILTIN_IFS +} BuiltinInterface; + +/* + * These are intentionally the same as the module version macros. + * It is possible to register a module as providing a specific interface, + * in which case the module's version is used. This feature isn't + * really ready for use yet though. + */ + +#define BUILTIN_INTERFACE_VERSION_NUMERIC(maj, min, patch) \ + ((((maj) & 0xFF) << 24) | (((min) & 0xFF) << 16) | (patch & 0xFFFF)) +#define GET_BUILTIN_INTERFACE_MAJOR_VERSION(vers) (((vers) >> 24) & 0xFF) +#define GET_BUILTIN_INTERFACE_MINOR_VERSION(vers) (((vers) >> 16) & 0xFF) +#define GET_BUILTIN_INTERFACE_PATCH_VERSION(vers) ((vers) & 0xFFFF) + #endif /* _XF86STR_H */ diff --git a/hw/xfree86/common/xf86xv.c b/hw/xfree86/common/xf86xv.c index c6a09121b..90289057b 100644 --- a/hw/xfree86/common/xf86xv.c +++ b/hw/xfree86/common/xf86xv.c @@ -1,12 +1,34 @@ -/* - - XFree86 Xv DDX written by Mark Vojkovich (markv@valinux.com) - - Copyright (C) 1998, 1999 - The XFree86 Project Inc. - -*/ - -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86xv.c,v 1.33 2002/11/09 01:18:11 keithp Exp $ */ +/* + * XFree86 Xv DDX written by Mark Vojkovich (markv@valinux.com) + */ +/* + * Copyright (c) 1998-2003 by The XFree86 Project, 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 COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + * + * Except as contained in this notice, the name of the copyright holder(s) + * and author(s) shall not be used in advertising or otherwise to promote + * the sale, use or other dealings in this Software without prior written + * authorization from the copyright holder(s) and author(s). + */ + +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86xv.c,v 1.37 2003/11/10 18:22:15 tsi Exp $ */ #include "misc.h" #include "xf86.h" @@ -31,7 +53,7 @@ #include "xvmodproc.h" #endif -#include "xf86xv.h" +#include "xf86xvpriv.h" /* XvScreenRec fields */ @@ -44,29 +66,29 @@ static int xf86XVQueryAdaptors(ScreenPtr, XvAdaptorPtr *, int *); static int xf86XVAllocatePort(unsigned long, XvPortPtr, XvPortPtr*); static int xf86XVFreePort(XvPortPtr); static int xf86XVPutVideo(ClientPtr, DrawablePtr,XvPortPtr, GCPtr, - INT16, INT16, CARD16, CARD16, + INT16, INT16, CARD16, CARD16, INT16, INT16, CARD16, CARD16); static int xf86XVPutStill(ClientPtr, DrawablePtr,XvPortPtr, GCPtr, - INT16, INT16, CARD16, CARD16, + INT16, INT16, CARD16, CARD16, INT16, INT16, CARD16, CARD16); static int xf86XVGetVideo(ClientPtr, DrawablePtr,XvPortPtr, GCPtr, - INT16, INT16, CARD16, CARD16, + INT16, INT16, CARD16, CARD16, INT16, INT16, CARD16, CARD16); static int xf86XVGetStill(ClientPtr, DrawablePtr,XvPortPtr, GCPtr, - INT16, INT16, CARD16, CARD16, + INT16, INT16, CARD16, CARD16, INT16, INT16, CARD16, CARD16); static int xf86XVStopVideo(ClientPtr, XvPortPtr, DrawablePtr); static int xf86XVSetPortAttribute(ClientPtr, XvPortPtr, Atom, INT32); static int xf86XVGetPortAttribute(ClientPtr, XvPortPtr, Atom, INT32*); static int xf86XVQueryBestSize(ClientPtr, XvPortPtr, CARD8, - CARD16, CARD16,CARD16, CARD16, + CARD16, CARD16,CARD16, CARD16, unsigned int*, unsigned int*); static int xf86XVPutImage(ClientPtr, DrawablePtr, XvPortPtr, GCPtr, - INT16, INT16, CARD16, CARD16, + INT16, INT16, CARD16, CARD16, INT16, INT16, CARD16, CARD16, XvImagePtr, unsigned char*, Bool, CARD16, CARD16); -static int xf86XVQueryImageAttributes(ClientPtr, XvPortPtr, XvImagePtr, +static int xf86XVQueryImageAttributes(ClientPtr, XvPortPtr, XvImagePtr, CARD16*, CARD16*, int*, int*); @@ -107,7 +129,7 @@ int (*XvScreenInitProc)(ScreenPtr) = XvScreenInit; ((XvScreenPtr)((pScreen)->devPrivates[XF86XvScreenIndex].ptr)) #define GET_XF86XV_SCREEN(pScreen) \ - ((XF86XVScreenPtr)(GET_XV_SCREEN(pScreen)->devPriv.ptr)) + ((XF86XVScreenPtr)(GET_XV_SCREEN(pScreen)->devPriv.ptr)) #define GET_XF86XV_WINDOW(pWin) \ ((XF86XVWindowPtr)((pWin)->devPrivates[XF86XVWindowIndex].ptr)) @@ -121,12 +143,12 @@ xf86XVRegisterGenericAdaptorDriver( ){ xf86XVInitGenericAdaptorPtr *newdrivers; - newdrivers = xrealloc(GenDrivers, sizeof(xf86XVInitGenericAdaptorPtr) * + newdrivers = xrealloc(GenDrivers, sizeof(xf86XVInitGenericAdaptorPtr) * (1 + NumGenDrivers)); if (!newdrivers) return 0; GenDrivers = newdrivers; - + GenDrivers[NumGenDrivers++] = InitFunc; return 1; @@ -134,7 +156,7 @@ xf86XVRegisterGenericAdaptorDriver( int xf86XVListGenericAdaptors( - ScrnInfoPtr pScrn, + ScrnInfoPtr pScrn, XF86VideoAdaptorPtr **adaptors ){ int i,j,n,num; @@ -142,8 +164,13 @@ xf86XVListGenericAdaptors( num = 0; *adaptors = NULL; - for (i = 0; i < NumGenDrivers; i++) { - n = GenDrivers[i](pScrn,&DrivAdap); + /* + * The v4l driver registers itself first, but can use surfaces registered + * by other drivers. So, call the v4l driver last. + */ + for (i = NumGenDrivers; --i >= 0; ) { + DrivAdap = NULL; + n = (*GenDrivers[i])(pScrn, &DrivAdap); if (0 == n) continue; new = xrealloc(*adaptors, sizeof(XF86VideoAdaptorPtr) * (num+n)); @@ -156,6 +183,38 @@ xf86XVListGenericAdaptors( return num; } + +/**************** Offscreen surface stuff *******************/ + +typedef struct { + XF86OffscreenImagePtr images; + int num; +} OffscreenImageRec; + +static OffscreenImageRec OffscreenImages[MAXSCREENS]; + +Bool +xf86XVRegisterOffscreenImages( + ScreenPtr pScreen, + XF86OffscreenImagePtr images, + int num +){ + OffscreenImages[pScreen->myNum].num = num; + OffscreenImages[pScreen->myNum].images = images; + + return TRUE; +} + +XF86OffscreenImagePtr +xf86XVQueryOffscreenImages( + ScreenPtr pScreen, + int *num +){ + *num = OffscreenImages[pScreen->myNum].num; + return OffscreenImages[pScreen->myNum].images; +} + + XF86VideoAdaptorPtr xf86XVAllocateVideoAdaptorRec(ScrnInfoPtr pScrn) { @@ -171,7 +230,7 @@ xf86XVFreeVideoAdaptorRec(XF86VideoAdaptorPtr ptr) Bool xf86XVScreenInit( - ScreenPtr pScreen, + ScreenPtr pScreen, XF86VideoAdaptorPtr *adaptors, int num ){ @@ -181,7 +240,7 @@ xf86XVScreenInit( if(num <= 0 || !XvGetScreenIndexProc || !XvGetRTPortProc || !XvScreenInitProc) - return FALSE; + return FALSE; if(XF86XVGeneration != serverGeneration) { if((XF86XVWindowIndex = AllocateWindowPrivateIndex()) < 0) @@ -190,7 +249,7 @@ xf86XVScreenInit( } if(!AllocateWindowPrivate(pScreen,XF86XVWindowIndex,0)) - return FALSE; + return FALSE; if(Success != (*XvScreenInitProc)(pScreen)) return FALSE; @@ -245,31 +304,28 @@ xf86XVFreeAdaptor(XvAdaptorPtr pAdaptor) { int i; - if(pAdaptor->name) - xfree(pAdaptor->name); + xfree(pAdaptor->name); if(pAdaptor->pEncodings) { XvEncodingPtr pEncode = pAdaptor->pEncodings; - for(i = 0; i < pAdaptor->nEncodings; i++, pEncode++) { - if(pEncode->name) xfree(pEncode->name); - } + for(i = 0; i < pAdaptor->nEncodings; i++, pEncode++) + xfree(pEncode->name); xfree(pAdaptor->pEncodings); } - if(pAdaptor->pFormats) - xfree(pAdaptor->pFormats); + xfree(pAdaptor->pFormats); if(pAdaptor->pPorts) { XvPortPtr pPort = pAdaptor->pPorts; XvPortRecPrivatePtr pPriv; for(i = 0; i < pAdaptor->nPorts; i++, pPort++) { - pPriv = (XvPortRecPrivatePtr)pPort->devPriv.ptr; + pPriv = (XvPortRecPrivatePtr)pPort->devPriv.ptr; if(pPriv) { - if(pPriv->clientClip) + if(pPriv->clientClip) REGION_DESTROY(pAdaptor->pScreen, pPriv->clientClip); - if(pPriv->pCompositeClip && pPriv->FreeCompositeClip) + if(pPriv->pCompositeClip && pPriv->FreeCompositeClip) REGION_DESTROY(pAdaptor->pScreen, pPriv->pCompositeClip); xfree(pPriv); } @@ -280,23 +336,18 @@ xf86XVFreeAdaptor(XvAdaptorPtr pAdaptor) if(pAdaptor->nAttributes) { XvAttributePtr pAttribute = pAdaptor->pAttributes; - for(i = 0; i < pAdaptor->nAttributes; i++, pAttribute++) { - if(pAttribute->name) xfree(pAttribute->name); - } - + for(i = 0; i < pAdaptor->nAttributes; i++, pAttribute++) + xfree(pAttribute->name); xfree(pAdaptor->pAttributes); } - if(pAdaptor->nImages) - xfree(pAdaptor->pImages); - - if(pAdaptor->devPriv.ptr) - xfree(pAdaptor->devPriv.ptr); + xfree(pAdaptor->pImages); + xfree(pAdaptor->devPriv.ptr); } static Bool xf86XVInitAdaptors( - ScreenPtr pScreen, + ScreenPtr pScreen, XF86VideoAdaptorPtr *infoPtr, int number ) { @@ -325,7 +376,7 @@ xf86XVInitAdaptors( pxvs->nAdaptors = 0; pxvs->pAdaptors = NULL; - if(!(pAdaptor = xcalloc(number, sizeof(XvAdaptorRec)))) + if(!(pAdaptor = xcalloc(number, sizeof(XvAdaptorRec)))) return FALSE; for(pa = pAdaptor, na = 0, numAdaptor = 0; na < number; na++, adaptorPtr++) { @@ -339,7 +390,7 @@ xf86XVInitAdaptors( if(!adaptorPtr->nEncodings || !adaptorPtr->pEncodings) continue; - pa->type = adaptorPtr->type; + pa->type = adaptorPtr->type; if(!adaptorPtr->PutVideo && !adaptorPtr->GetVideo) pa->type &= ~XvVideoMask; @@ -350,19 +401,19 @@ xf86XVInitAdaptors( if(!adaptorPtr->PutImage || !adaptorPtr->QueryImageAttributes) pa->type &= ~XvImageMask; - if(!adaptorPtr->PutVideo && !adaptorPtr->PutImage && + if(!adaptorPtr->PutVideo && !adaptorPtr->PutImage && !adaptorPtr->PutStill) pa->type &= ~XvInputMask; if(!adaptorPtr->GetVideo && !adaptorPtr->GetStill) pa->type &= ~XvOutputMask; - - if(!(adaptorPtr->type & (XvPixmapMask | XvWindowMask))) + + if(!(adaptorPtr->type & (XvPixmapMask | XvWindowMask))) continue; - if(!(adaptorPtr->type & (XvImageMask | XvVideoMask | XvStillMask))) + if(!(adaptorPtr->type & (XvImageMask | XvVideoMask | XvStillMask))) continue; - pa->pScreen = pScreen; + pa->pScreen = pScreen; pa->ddAllocatePort = xf86XVAllocatePort; pa->ddFreePort = xf86XVFreePort; pa->ddPutVideo = xf86XVPutVideo; @@ -376,33 +427,33 @@ xf86XVInitAdaptors( pa->ddQueryBestSize = xf86XVQueryBestSize; pa->ddQueryImageAttributes = xf86XVQueryImageAttributes; if((pa->name = xalloc(strlen(adaptorPtr->name) + 1))) - strcpy(pa->name, adaptorPtr->name); + strcpy(pa->name, adaptorPtr->name); if(adaptorPtr->nEncodings && (pEncode = xcalloc(adaptorPtr->nEncodings, sizeof(XvEncodingRec)))) { - for(pe = pEncode, encodingPtr = adaptorPtr->pEncodings, i = 0; - i < adaptorPtr->nEncodings; pe++, i++, encodingPtr++) - { + for(pe = pEncode, encodingPtr = adaptorPtr->pEncodings, i = 0; + i < adaptorPtr->nEncodings; pe++, i++, encodingPtr++) + { pe->id = encodingPtr->id; pe->pScreen = pScreen; if((pe->name = xalloc(strlen(encodingPtr->name) + 1))) - strcpy(pe->name, encodingPtr->name); + strcpy(pe->name, encodingPtr->name); pe->width = encodingPtr->width; pe->height = encodingPtr->height; pe->rate.numerator = encodingPtr->rate.numerator; pe->rate.denominator = encodingPtr->rate.denominator; } pa->nEncodings = adaptorPtr->nEncodings; - pa->pEncodings = pEncode; - } + pa->pEncodings = pEncode; + } if(adaptorPtr->nImages && - (pImage = xcalloc(adaptorPtr->nImages, sizeof(XvImageRec)))) { + (pImage = xcalloc(adaptorPtr->nImages, sizeof(XvImageRec)))) { - for(i = 0, pi = pImage, imagePtr = adaptorPtr->pImages; - i < adaptorPtr->nImages; i++, pi++, imagePtr++) - { + for(i = 0, pi = pImage, imagePtr = adaptorPtr->pImages; + i < adaptorPtr->nImages; i++, pi++, imagePtr++) + { pi->id = imagePtr->id; pi->type = imagePtr->type; pi->byte_order = imagePtr->byte_order; @@ -425,7 +476,7 @@ xf86XVInitAdaptors( pi->vert_v_period = imagePtr->vert_v_period; memcpy(pi->component_order, imagePtr->component_order, 32); pi->scanline_order = imagePtr->scanline_order; - } + } pa->nImages = adaptorPtr->nImages; pa->pImages = pImage; } @@ -433,65 +484,65 @@ xf86XVInitAdaptors( if(adaptorPtr->nAttributes && (pAttribute = xcalloc(adaptorPtr->nAttributes, sizeof(XvAttributeRec)))) { - for(pat = pAttribute, attributePtr = adaptorPtr->pAttributes, i = 0; - i < adaptorPtr->nAttributes; pat++, i++, attributePtr++) - { + for(pat = pAttribute, attributePtr = adaptorPtr->pAttributes, i = 0; + i < adaptorPtr->nAttributes; pat++, i++, attributePtr++) + { pat->flags = attributePtr->flags; pat->min_value = attributePtr->min_value; pat->max_value = attributePtr->max_value; if((pat->name = xalloc(strlen(attributePtr->name) + 1))) - strcpy(pat->name, attributePtr->name); + strcpy(pat->name, attributePtr->name); } pa->nAttributes = adaptorPtr->nAttributes; - pa->pAttributes = pAttribute; - } + pa->pAttributes = pAttribute; + } totFormat = adaptorPtr->nFormats; if(!(pFormat = xcalloc(totFormat, sizeof(XvFormatRec)))) { - xf86XVFreeAdaptor(pa); - continue; + xf86XVFreeAdaptor(pa); + continue; } - for(pf = pFormat, i = 0, numFormat = 0, formatPtr = adaptorPtr->pFormats; - i < adaptorPtr->nFormats; i++, formatPtr++) + for(pf = pFormat, i = 0, numFormat = 0, formatPtr = adaptorPtr->pFormats; + i < adaptorPtr->nFormats; i++, formatPtr++) { numVisuals = pScreen->numVisuals; - pVisual = pScreen->visuals; + pVisual = pScreen->visuals; - while(numVisuals--) { - if((pVisual->class == formatPtr->class) && - (pVisual->nplanes == formatPtr->depth)) { + while(numVisuals--) { + if((pVisual->class == formatPtr->class) && + (pVisual->nplanes == formatPtr->depth)) { if(numFormat >= totFormat) { - void *moreSpace; + void *moreSpace; totFormat *= 2; - moreSpace = xrealloc(pFormat, + moreSpace = xrealloc(pFormat, totFormat * sizeof(XvFormatRec)); if(!moreSpace) break; pFormat = moreSpace; pf = pFormat + numFormat; } - pf->visual = pVisual->vid; + pf->visual = pVisual->vid; pf->depth = formatPtr->depth; pf++; numFormat++; - } - pVisual++; - } + } + pVisual++; + } } pa->nFormats = numFormat; - pa->pFormats = pFormat; + pa->pFormats = pFormat; if(!numFormat) { - xf86XVFreeAdaptor(pa); - continue; + xf86XVFreeAdaptor(pa); + continue; } if(!(adaptorPriv = xcalloc(1, sizeof(XvAdaptorRecPrivate)))) { - xf86XVFreeAdaptor(pa); - continue; + xf86XVFreeAdaptor(pa); + continue; } adaptorPriv->flags = adaptorPtr->flags; @@ -510,47 +561,47 @@ xf86XVInitAdaptors( pa->devPriv.ptr = (pointer)adaptorPriv; if(!(pPort = xcalloc(adaptorPtr->nPorts, sizeof(XvPortRec)))) { - xf86XVFreeAdaptor(pa); - continue; + xf86XVFreeAdaptor(pa); + continue; } - for(pp = pPort, i = 0, numPort = 0; + for(pp = pPort, i = 0, numPort = 0; i < adaptorPtr->nPorts; i++) { - if(!(pp->id = FakeClientID(0))) + if(!(pp->id = FakeClientID(0))) continue; - if(!(portPriv = xcalloc(1, sizeof(XvPortRecPrivate)))) + if(!(portPriv = xcalloc(1, sizeof(XvPortRecPrivate)))) continue; - + if(!AddResource(pp->id, PortResource, pp)) { xfree(portPriv); continue; } - pp->pAdaptor = pa; - pp->pNotify = (XvPortNotifyPtr)NULL; - pp->pDraw = (DrawablePtr)NULL; - pp->client = (ClientPtr)NULL; - pp->grab.client = (ClientPtr)NULL; - pp->time = currentTime; - pp->devPriv.ptr = portPriv; + pp->pAdaptor = pa; + pp->pNotify = (XvPortNotifyPtr)NULL; + pp->pDraw = (DrawablePtr)NULL; + pp->client = (ClientPtr)NULL; + pp->grab.client = (ClientPtr)NULL; + pp->time = currentTime; + pp->devPriv.ptr = portPriv; portPriv->pScrn = pScrn; portPriv->AdaptorRec = adaptorPriv; - portPriv->DevPriv.ptr = adaptorPtr->pPortPrivates[i].ptr; - - pp++; - numPort++; + portPriv->DevPriv.ptr = adaptorPtr->pPortPrivates[i].ptr; + + pp++; + numPort++; } pa->nPorts = numPort; pa->pPorts = pPort; if(!numPort) { - xf86XVFreeAdaptor(pa); - continue; + xf86XVFreeAdaptor(pa); + continue; } pa->base_id = pPort->id; - + pa++; numAdaptor++; } @@ -576,23 +627,25 @@ xf86XVInitAdaptors( the GC and used it's clip list when they needed to reclip the window, even if the client clip was different from the one the video was initialized with. If the original GC was destroyed, they had to stop - the video. I like the new method better (MArk). + the video. I like the new method better (MArk). This function only works for windows. Will need to rewrite when (if) we support pixmap rendering. */ -static void +static void xf86XVUpdateCompositeClip(XvPortRecPrivatePtr portPriv) { RegionPtr pregWin, pCompositeClip; WindowPtr pWin; - Bool freeCompClip = FALSE; + ScreenPtr pScreen; + Bool freeCompClip = FALSE; if(portPriv->pCompositeClip) return; pWin = (WindowPtr)portPriv->pDraw; + pScreen = pWin->drawable.pScreen; /* get window clip list */ if(portPriv->subWindowMode == IncludeInferiors) { @@ -607,19 +660,19 @@ xf86XVUpdateCompositeClip(XvPortRecPrivatePtr portPriv) return; } - pCompositeClip = REGION_CREATE(pWin->pScreen, NullBox, 1); - REGION_COPY(pWin->pScreen, pCompositeClip, portPriv->clientClip); - REGION_TRANSLATE(pWin->pScreen, pCompositeClip, + pCompositeClip = REGION_CREATE(pScreen, NullBox, 1); + REGION_COPY(pScreen, pCompositeClip, portPriv->clientClip); + REGION_TRANSLATE(pScreen, pCompositeClip, portPriv->pDraw->x + portPriv->clipOrg.x, portPriv->pDraw->y + portPriv->clipOrg.y); - REGION_INTERSECT(pWin->pScreen, pCompositeClip, pregWin, pCompositeClip); + REGION_INTERSECT(pScreen, pCompositeClip, pregWin, pCompositeClip); portPriv->pCompositeClip = pCompositeClip; portPriv->FreeCompositeClip = TRUE; if(freeCompClip) { - REGION_DESTROY(pWin->pScreen, pregWin); - } + REGION_DESTROY(pScreen, pregWin); + } } /* Save the current clientClip and update the CompositeClip whenever @@ -627,23 +680,25 @@ xf86XVUpdateCompositeClip(XvPortRecPrivatePtr portPriv) static void xf86XVCopyClip( - XvPortRecPrivatePtr portPriv, + XvPortRecPrivatePtr portPriv, GCPtr pGC ){ + ScreenPtr pScreen = pGC->pScreen; + /* copy the new clip if it exists */ if((pGC->clientClipType == CT_REGION) && pGC->clientClip) { if(!portPriv->clientClip) - portPriv->clientClip = REGION_CREATE(pGC->pScreen, NullBox, 1); + portPriv->clientClip = REGION_CREATE(pScreen, NullBox, 1); /* Note: this is in window coordinates */ - REGION_COPY(pGC->pScreen, portPriv->clientClip, pGC->clientClip); + REGION_COPY(pScreen, portPriv->clientClip, pGC->clientClip); } else if(portPriv->clientClip) { /* free the old clientClip */ - REGION_DESTROY(pGC->pScreen, portPriv->clientClip); + REGION_DESTROY(pScreen, portPriv->clientClip); portPriv->clientClip = NULL; } /* get rid of the old clip list */ if(portPriv->pCompositeClip && portPriv->FreeCompositeClip) { - REGION_DESTROY(pWin->pScreen, portPriv->pCompositeClip); + REGION_DESTROY(pScreen, portPriv->pCompositeClip); } portPriv->clipOrg = pGC->clipOrg; @@ -670,12 +725,12 @@ xf86XVRegetVideo(XvPortRecPrivatePtr portPriv) WinBox.y1 = portPriv->pDraw->y + portPriv->drw_y; WinBox.x2 = WinBox.x1 + portPriv->drw_w; WinBox.y2 = WinBox.y1 + portPriv->drw_h; - + /* clip to the window composite clip */ REGION_INIT(pScreen, &WinRegion, &WinBox, 1); - REGION_INIT(pScreen, &ClipRegion, NullBox, 1); - REGION_INTERSECT(Screen, &ClipRegion, &WinRegion, portPriv->pCompositeClip); - + REGION_NULL(pScreen, &ClipRegion); + REGION_INTERSECT(pScreen, &ClipRegion, &WinRegion, portPriv->pCompositeClip); + /* that's all if it's totally obscured */ if(!REGION_NOTEMPTY(pScreen, &ClipRegion)) { clippedAway = TRUE; @@ -686,11 +741,11 @@ xf86XVRegetVideo(XvPortRecPrivatePtr portPriv) REGION_SUBTRACT(pScreen, &ClipRegion, &WinRegion, &ClipRegion); } - ret = (*portPriv->AdaptorRec->GetVideo)(portPriv->pScrn, - portPriv->vid_x, portPriv->vid_y, - WinBox.x1, WinBox.y1, - portPriv->vid_w, portPriv->vid_h, - portPriv->drw_w, portPriv->drw_h, + ret = (*portPriv->AdaptorRec->GetVideo)(portPriv->pScrn, + portPriv->vid_x, portPriv->vid_y, + WinBox.x1, WinBox.y1, + portPriv->vid_w, portPriv->vid_h, + portPriv->drw_w, portPriv->drw_h, &ClipRegion, portPriv->DevPriv.ptr); if(ret == Success) @@ -734,27 +789,27 @@ xf86XVReputVideo(XvPortRecPrivatePtr portPriv) WinBox.y1 = portPriv->pDraw->y + portPriv->drw_y; WinBox.x2 = WinBox.x1 + portPriv->drw_w; WinBox.y2 = WinBox.y1 + portPriv->drw_h; - + /* clip to the window composite clip */ REGION_INIT(pScreen, &WinRegion, &WinBox, 1); - REGION_INIT(pScreen, &ClipRegion, NullBox, 1); - REGION_INTERSECT(Screen, &ClipRegion, &WinRegion, portPriv->pCompositeClip); + REGION_NULL(pScreen, &ClipRegion); + REGION_INTERSECT(pScreen, &ClipRegion, &WinRegion, portPriv->pCompositeClip); /* clip and translate to the viewport */ if(portPriv->AdaptorRec->flags & VIDEO_CLIP_TO_VIEWPORT) { RegionRec VPReg; BoxRec VPBox; - VPBox.x1 = portPriv->pScrn->frameX0; + VPBox.x1 = portPriv->pScrn->frameX0; VPBox.y1 = portPriv->pScrn->frameY0; - VPBox.x2 = portPriv->pScrn->frameX1; + VPBox.x2 = portPriv->pScrn->frameX1; VPBox.y2 = portPriv->pScrn->frameY1; REGION_INIT(pScreen, &VPReg, &VPBox, 1); - REGION_INTERSECT(Screen, &ClipRegion, &ClipRegion, &VPReg); + REGION_INTERSECT(pScreen, &ClipRegion, &ClipRegion, &VPReg); REGION_UNINIT(pScreen, &VPReg); } - + /* that's all if it's totally obscured */ if(!REGION_NOTEMPTY(pScreen, &ClipRegion)) { clippedAway = TRUE; @@ -765,8 +820,8 @@ xf86XVReputVideo(XvPortRecPrivatePtr portPriv) if(portPriv->AdaptorRec->flags & VIDEO_NO_CLIPPING) { BoxPtr clipBox = REGION_RECTS(&ClipRegion); if( (REGION_NUM_RECTS(&ClipRegion) != 1) || - (clipBox->x1 != WinBox.x1) || (clipBox->x2 != WinBox.x2) || - (clipBox->y1 != WinBox.y1) || (clipBox->y2 != WinBox.y2)) + (clipBox->x1 != WinBox.x1) || (clipBox->x2 != WinBox.x2) || + (clipBox->y1 != WinBox.y1) || (clipBox->y2 != WinBox.y2)) { clippedAway = TRUE; goto CLIP_VIDEO_BAILOUT; @@ -777,11 +832,11 @@ xf86XVReputVideo(XvPortRecPrivatePtr portPriv) REGION_SUBTRACT(pScreen, &ClipRegion, &WinRegion, &ClipRegion); } - ret = (*portPriv->AdaptorRec->PutVideo)(portPriv->pScrn, - portPriv->vid_x, portPriv->vid_y, + ret = (*portPriv->AdaptorRec->PutVideo)(portPriv->pScrn, + portPriv->vid_x, portPriv->vid_y, WinBox.x1, WinBox.y1, - portPriv->vid_w, portPriv->vid_h, - portPriv->drw_w, portPriv->drw_h, + portPriv->vid_w, portPriv->vid_h, + portPriv->drw_w, portPriv->drw_h, &ClipRegion, portPriv->DevPriv.ptr); if(ret == Success) portPriv->isOn = XV_ON; @@ -823,27 +878,27 @@ xf86XVReputImage(XvPortRecPrivatePtr portPriv) WinBox.y1 = portPriv->pDraw->y + portPriv->drw_y; WinBox.x2 = WinBox.x1 + portPriv->drw_w; WinBox.y2 = WinBox.y1 + portPriv->drw_h; - + /* clip to the window composite clip */ REGION_INIT(pScreen, &WinRegion, &WinBox, 1); - REGION_INIT(pScreen, &ClipRegion, NullBox, 1); - REGION_INTERSECT(Screen, &ClipRegion, &WinRegion, portPriv->pCompositeClip); + REGION_NULL(pScreen, &ClipRegion); + REGION_INTERSECT(pScreen, &ClipRegion, &WinRegion, portPriv->pCompositeClip); /* clip and translate to the viewport */ if(portPriv->AdaptorRec->flags & VIDEO_CLIP_TO_VIEWPORT) { RegionRec VPReg; BoxRec VPBox; - VPBox.x1 = portPriv->pScrn->frameX0; + VPBox.x1 = portPriv->pScrn->frameX0; VPBox.y1 = portPriv->pScrn->frameY0; - VPBox.x2 = portPriv->pScrn->frameX1; + VPBox.x2 = portPriv->pScrn->frameX1; VPBox.y2 = portPriv->pScrn->frameY1; REGION_INIT(pScreen, &VPReg, &VPBox, 1); - REGION_INTERSECT(Screen, &ClipRegion, &ClipRegion, &VPReg); + REGION_INTERSECT(pScreen, &ClipRegion, &ClipRegion, &VPReg); REGION_UNINIT(pScreen, &VPReg); } - + /* that's all if it's totally obscured */ if(!REGION_NOTEMPTY(pScreen, &ClipRegion)) { clippedAway = TRUE; @@ -854,8 +909,8 @@ xf86XVReputImage(XvPortRecPrivatePtr portPriv) if(portPriv->AdaptorRec->flags & VIDEO_NO_CLIPPING) { BoxPtr clipBox = REGION_RECTS(&ClipRegion); if( (REGION_NUM_RECTS(&ClipRegion) != 1) || - (clipBox->x1 != WinBox.x1) || (clipBox->x2 != WinBox.x2) || - (clipBox->y1 != WinBox.y1) || (clipBox->y2 != WinBox.y2)) + (clipBox->x1 != WinBox.x1) || (clipBox->x2 != WinBox.x2) || + (clipBox->y1 != WinBox.y1) || (clipBox->y2 != WinBox.y2)) { clippedAway = TRUE; goto CLIP_VIDEO_BAILOUT; @@ -866,7 +921,7 @@ xf86XVReputImage(XvPortRecPrivatePtr portPriv) REGION_SUBTRACT(pScreen, &ClipRegion, &WinRegion, &ClipRegion); } - ret = (*portPriv->AdaptorRec->ReputImage)(portPriv->pScrn, + ret = (*portPriv->AdaptorRec->ReputImage)(portPriv->pScrn, WinBox.x1, WinBox.y1, &ClipRegion, portPriv->DevPriv.ptr); @@ -910,7 +965,7 @@ xf86XVReputAllVideo(WindowPtr pWin, pointer data) static int xf86XVEnlistPortInWindow(WindowPtr pWin, XvPortRecPrivatePtr portPriv) { - XF86XVWindowPtr winPriv, PrivRoot; + XF86XVWindowPtr winPriv, PrivRoot; winPriv = PrivRoot = GET_XF86XV_WINDOW(pWin); @@ -927,7 +982,7 @@ xf86XVEnlistPortInWindow(WindowPtr pWin, XvPortRecPrivatePtr portPriv) winPriv->PortRec = portPriv; winPriv->next = PrivRoot; pWin->devPrivates[XF86XVWindowIndex].ptr = (pointer)winPriv; - } + } return Success; } @@ -941,15 +996,15 @@ xf86XVRemovePortFromWindow(WindowPtr pWin, XvPortRecPrivatePtr portPriv) while(winPriv) { if(winPriv->PortRec == portPriv) { - if(prevPriv) + if(prevPriv) prevPriv->next = winPriv->next; - else - pWin->devPrivates[XF86XVWindowIndex].ptr = + else + pWin->devPrivates[XF86XVWindowIndex].ptr = (pointer)winPriv->next; xfree(winPriv); break; } - prevPriv = winPriv; + prevPriv = winPriv; winPriv = winPriv->next; } portPriv->pDraw = NULL; @@ -1008,7 +1063,7 @@ xf86XVWindowExposures(WindowPtr pWin, RegionPtr reg1, RegionPtr reg2) /* filter out XClearWindow/Area */ if (!pWin->valdata) return; - + pPrev = NULL; while(WinPriv) { @@ -1019,10 +1074,10 @@ xf86XVWindowExposures(WindowPtr pWin, RegionPtr reg1, RegionPtr reg2) switch(pPriv->type) { case XvInputMask: xf86XVReputVideo(pPriv); - break; + break; case XvOutputMask: - xf86XVRegetVideo(pPriv); - break; + xf86XVRegetVideo(pPriv); + break; default: /* overlaid still/image*/ if (pPriv->AdaptorRec->ReputImage) xf86XVReputImage(pPriv); @@ -1036,8 +1091,8 @@ xf86XVWindowExposures(WindowPtr pWin, RegionPtr reg1, RegionPtr reg2) } pPriv->pDraw = NULL; - if(!pPrev) - pWin->devPrivates[XF86XVWindowIndex].ptr = + if(!pPrev) + pWin->devPrivates[XF86XVWindowIndex].ptr = (pointer)(WinPriv->next); else pPrev->next = WinPriv->next; @@ -1054,7 +1109,7 @@ xf86XVWindowExposures(WindowPtr pWin, RegionPtr reg1, RegionPtr reg2) } -static void +static void xf86XVClipNotify(WindowPtr pWin, int dx, int dy) { ScreenPtr pScreen = pWin->drawable.pScreen; @@ -1073,7 +1128,7 @@ xf86XVClipNotify(WindowPtr pWin, int dx, int dy) pPriv->pCompositeClip = NULL; - /* Stop everything except images, but stop them too if the + /* Stop everything except images, but stop them too if the window isn't visible. But we only remove the images. */ if(pPriv->type || !visible) { @@ -1086,8 +1141,8 @@ xf86XVClipNotify(WindowPtr pWin, int dx, int dy) if(!pPriv->type) { /* overlaid still/image */ pPriv->pDraw = NULL; - if(!pPrev) - pWin->devPrivates[XF86XVWindowIndex].ptr = + if(!pPrev) + pWin->devPrivates[XF86XVWindowIndex].ptr = (pointer)(WinPriv->next); else pPrev->next = WinPriv->next; @@ -1122,6 +1177,9 @@ xf86XVCloseScreen(int i, ScreenPtr pScreen) XvAdaptorPtr pa; int c; + /* Clear offscreen images */ + (void)memset(&OffscreenImages[pScreen->myNum], 0, sizeof(OffscreenImages[0])); + if(!ScreenPriv) return TRUE; if(ScreenPriv->videoGC) { @@ -1133,20 +1191,16 @@ xf86XVCloseScreen(int i, ScreenPtr pScreen) pScreen->WindowExposures = ScreenPriv->WindowExposures; pScreen->ClipNotify = ScreenPriv->ClipNotify; - pScrn->EnterVT = ScreenPriv->EnterVT; - pScrn->LeaveVT = ScreenPriv->LeaveVT; + pScrn->EnterVT = ScreenPriv->EnterVT; + pScrn->LeaveVT = ScreenPriv->LeaveVT; pScrn->AdjustFrame = ScreenPriv->AdjustFrame; - for(c = 0, pa = pxvs->pAdaptors; c < pxvs->nAdaptors; c++, pa++) { + for(c = 0, pa = pxvs->pAdaptors; c < pxvs->nAdaptors; c++, pa++) { xf86XVFreeAdaptor(pa); } - if(pxvs->pAdaptors) - xfree(pxvs->pAdaptors); - + xfree(pxvs->pAdaptors); xfree(ScreenPriv); - - return TRUE; } @@ -1168,7 +1222,7 @@ xf86XVQueryAdaptors( /**** ScrnInfoRec fields ****/ -static Bool +static Bool xf86XVEnterVT(int index, int flags) { ScreenPtr pScreen = screenInfo.screens[index]; @@ -1177,12 +1231,12 @@ xf86XVEnterVT(int index, int flags) ret = (*ScreenPriv->EnterVT)(index, flags); - if(ret) WalkTree(pScreen, xf86XVReputAllVideo, 0); - + if(ret) WalkTree(pScreen, xf86XVReputAllVideo, 0); + return ret; } -static void +static void xf86XVLeaveVT(int index, int flags) { ScreenPtr pScreen = screenInfo.screens[index]; @@ -1229,14 +1283,14 @@ xf86XVAdjustFrame(int index, int x, int y, int flags) WindowPtr pWin; XvAdaptorPtr pa; int c, i; - + if(ScreenPriv->AdjustFrame) { pScrn->AdjustFrame = ScreenPriv->AdjustFrame; (*pScrn->AdjustFrame)(index, x, y, flags); pScrn->AdjustFrame = xf86XVAdjustFrame; } - - for(c = pxvs->nAdaptors, pa = pxvs->pAdaptors; c > 0; c--, pa++) { + + for(c = pxvs->nAdaptors, pa = pxvs->pAdaptors; c > 0; c--, pa++) { XvPortPtr pPort = pa->pPorts; XvPortRecPrivatePtr pPriv; @@ -1254,7 +1308,7 @@ xf86XVAdjustFrame(int index, int x, int y, int flags) if ((pPriv->AdaptorRec->ReputImage) && ((pWin->visibility == VisibilityUnobscured) || - (pWin->visibility == VisibilityPartiallyObscured))) + (pWin->visibility == VisibilityPartiallyObscured))) { xf86XVReputImage(pPriv); } else { @@ -1297,8 +1351,8 @@ xf86XVPutVideo( DrawablePtr pDraw, XvPortPtr pPort, GCPtr pGC, - INT16 vid_x, INT16 vid_y, - CARD16 vid_w, CARD16 vid_h, + INT16 vid_x, INT16 vid_y, + CARD16 vid_w, CARD16 vid_h, INT16 drw_x, INT16 drw_y, CARD16 drw_w, CARD16 drw_h ){ @@ -1310,7 +1364,7 @@ xf86XVPutVideo( pPort->pDraw = (DrawablePtr)NULL; return BadAlloc; } - + /* If we are changing windows, unregister our port in the old window */ if(portPriv->pDraw && (portPriv->pDraw != pDraw)) xf86XVRemovePortFromWindow((WindowPtr)(portPriv->pDraw), portPriv); @@ -1333,7 +1387,7 @@ xf86XVPutVideo( /* To indicate to the DI layer that we were successful */ pPort->pDraw = pDraw; - + if(!portPriv->pScrn->vtSema) return Success; /* Success ? */ return(xf86XVReputVideo(portPriv)); @@ -1345,8 +1399,8 @@ xf86XVPutStill( DrawablePtr pDraw, XvPortPtr pPort, GCPtr pGC, - INT16 vid_x, INT16 vid_y, - CARD16 vid_w, CARD16 vid_h, + INT16 vid_x, INT16 vid_y, + CARD16 vid_w, CARD16 vid_h, INT16 drw_x, INT16 drw_y, CARD16 drw_w, CARD16 drw_h ){ @@ -1369,22 +1423,22 @@ xf86XVPutStill( WinBox.y1 = pDraw->y + drw_y; WinBox.x2 = WinBox.x1 + drw_w; WinBox.y2 = WinBox.y1 + drw_h; - + REGION_INIT(pScreen, &WinRegion, &WinBox, 1); - REGION_INIT(pScreen, &ClipRegion, NullBox, 1); - REGION_INTERSECT(pScreen, &ClipRegion, &WinRegion, pGC->pCompositeClip); + REGION_NULL(pScreen, &ClipRegion); + REGION_INTERSECT(pScreen, &ClipRegion, &WinRegion, pGC->pCompositeClip); if(portPriv->AdaptorRec->flags & VIDEO_CLIP_TO_VIEWPORT) { RegionRec VPReg; BoxRec VPBox; - VPBox.x1 = portPriv->pScrn->frameX0; + VPBox.x1 = portPriv->pScrn->frameX0; VPBox.y1 = portPriv->pScrn->frameY0; - VPBox.x2 = portPriv->pScrn->frameX1; + VPBox.x2 = portPriv->pScrn->frameX1; VPBox.y2 = portPriv->pScrn->frameY1; REGION_INIT(pScreen, &VPReg, &VPBox, 1); - REGION_INTERSECT(Screen, &ClipRegion, &ClipRegion, &VPReg); + REGION_INTERSECT(pScreen, &ClipRegion, &ClipRegion, &VPReg); REGION_UNINIT(pScreen, &VPReg); } @@ -1400,11 +1454,11 @@ xf86XVPutStill( if(portPriv->AdaptorRec->flags & VIDEO_NO_CLIPPING) { BoxPtr clipBox = REGION_RECTS(&ClipRegion); if( (REGION_NUM_RECTS(&ClipRegion) != 1) || - (clipBox->x1 != WinBox.x1) || (clipBox->x2 != WinBox.x2) || + (clipBox->x1 != WinBox.x1) || (clipBox->x2 != WinBox.x2) || (clipBox->y1 != WinBox.y1) || (clipBox->y2 != WinBox.y2)) { clippedAway = TRUE; - goto PUT_STILL_BAILOUT; + goto PUT_STILL_BAILOUT; } } @@ -1412,7 +1466,7 @@ xf86XVPutStill( REGION_SUBTRACT(pScreen, &ClipRegion, &WinRegion, &ClipRegion); } - ret = (*portPriv->AdaptorRec->PutStill)(portPriv->pScrn, + ret = (*portPriv->AdaptorRec->PutStill)(portPriv->pScrn, vid_x, vid_y, WinBox.x1, WinBox.y1, vid_w, vid_h, drw_w, drw_h, &ClipRegion, portPriv->DevPriv.ptr); @@ -1433,9 +1487,9 @@ xf86XVPutStill( PUT_STILL_BAILOUT: if((clippedAway || (ret != Success)) && (portPriv->isOn == XV_ON)) { - (*portPriv->AdaptorRec->StopVideo)( - portPriv->pScrn, portPriv->DevPriv.ptr, FALSE); - portPriv->isOn = XV_PENDING; + (*portPriv->AdaptorRec->StopVideo)( + portPriv->pScrn, portPriv->DevPriv.ptr, FALSE); + portPriv->isOn = XV_PENDING; } REGION_UNINIT(pScreen, &WinRegion); @@ -1450,8 +1504,8 @@ xf86XVGetVideo( DrawablePtr pDraw, XvPortPtr pPort, GCPtr pGC, - INT16 vid_x, INT16 vid_y, - CARD16 vid_w, CARD16 vid_h, + INT16 vid_x, INT16 vid_y, + CARD16 vid_w, CARD16 vid_h, INT16 drw_x, INT16 drw_y, CARD16 drw_w, CARD16 drw_h ){ @@ -1463,7 +1517,7 @@ xf86XVGetVideo( pPort->pDraw = (DrawablePtr)NULL; return BadAlloc; } - + /* If we are changing windows, unregister our port in the old window */ if(portPriv->pDraw && (portPriv->pDraw != pDraw)) xf86XVRemovePortFromWindow((WindowPtr)(portPriv->pDraw), portPriv); @@ -1486,7 +1540,7 @@ xf86XVGetVideo( /* To indicate to the DI layer that we were successful */ pPort->pDraw = pDraw; - + if(!portPriv->pScrn->vtSema) return Success; /* Success ? */ return(xf86XVRegetVideo(portPriv)); @@ -1498,8 +1552,8 @@ xf86XVGetStill( DrawablePtr pDraw, XvPortPtr pPort, GCPtr pGC, - INT16 vid_x, INT16 vid_y, - CARD16 vid_w, CARD16 vid_h, + INT16 vid_x, INT16 vid_y, + CARD16 vid_w, CARD16 vid_h, INT16 drw_x, INT16 drw_y, CARD16 drw_w, CARD16 drw_h ){ @@ -1522,10 +1576,10 @@ xf86XVGetStill( WinBox.y1 = pDraw->y + drw_y; WinBox.x2 = WinBox.x1 + drw_w; WinBox.y2 = WinBox.y1 + drw_h; - + REGION_INIT(pScreen, &WinRegion, &WinBox, 1); - REGION_INIT(pScreen, &ClipRegion, NullBox, 1); - REGION_INTERSECT(pScreen, &ClipRegion, &WinRegion, pGC->pCompositeClip); + REGION_NULL(pScreen, &ClipRegion); + REGION_INTERSECT(pScreen, &ClipRegion, &WinRegion, pGC->pCompositeClip); if(portPriv->pDraw) { xf86XVRemovePortFromWindow((WindowPtr)(portPriv->pDraw), portPriv); @@ -1548,9 +1602,9 @@ xf86XVGetStill( GET_STILL_BAILOUT: if((clippedAway || (ret != Success)) && (portPriv->isOn == XV_ON)) { - (*portPriv->AdaptorRec->StopVideo)( - portPriv->pScrn, portPriv->DevPriv.ptr, FALSE); - portPriv->isOn = XV_PENDING; + (*portPriv->AdaptorRec->StopVideo)( + portPriv->pScrn, portPriv->DevPriv.ptr, FALSE); + portPriv->isOn = XV_PENDING; } REGION_UNINIT(pScreen, &WinRegion); @@ -1559,7 +1613,7 @@ GET_STILL_BAILOUT: return ret; } - + static int xf86XVStopVideo( @@ -1571,7 +1625,7 @@ xf86XVStopVideo( if(pDraw->type != DRAWABLE_WINDOW) return BadAlloc; - + xf86XVRemovePortFromWindow((WindowPtr)pDraw, portPriv); if(!portPriv->pScrn->vtSema) return Success; /* Success ? */ @@ -1595,8 +1649,8 @@ xf86XVSetPortAttribute( INT32 value ){ XvPortRecPrivatePtr portPriv = (XvPortRecPrivatePtr)(pPort->devPriv.ptr); - - return((*portPriv->AdaptorRec->SetPortAttribute)(portPriv->pScrn, + + return((*portPriv->AdaptorRec->SetPortAttribute)(portPriv->pScrn, attribute, value, portPriv->DevPriv.ptr)); } @@ -1609,8 +1663,8 @@ xf86XVGetPortAttribute( INT32 *p_value ){ XvPortRecPrivatePtr portPriv = (XvPortRecPrivatePtr)(pPort->devPriv.ptr); - - return((*portPriv->AdaptorRec->GetPortAttribute)(portPriv->pScrn, + + return((*portPriv->AdaptorRec->GetPortAttribute)(portPriv->pScrn, attribute, p_value, portPriv->DevPriv.ptr)); } @@ -1626,8 +1680,8 @@ xf86XVQueryBestSize( unsigned int *p_w, unsigned int *p_h ){ XvPortRecPrivatePtr portPriv = (XvPortRecPrivatePtr)(pPort->devPriv.ptr); - - (*portPriv->AdaptorRec->QueryBestSize)(portPriv->pScrn, + + (*portPriv->AdaptorRec->QueryBestSize)(portPriv->pScrn, (Bool)motion, vid_w, vid_h, drw_w, drw_h, p_w, p_h, portPriv->DevPriv.ptr); @@ -1635,14 +1689,14 @@ xf86XVQueryBestSize( } -static int +static int xf86XVPutImage( - ClientPtr client, - DrawablePtr pDraw, - XvPortPtr pPort, + ClientPtr client, + DrawablePtr pDraw, + XvPortPtr pPort, GCPtr pGC, - INT16 src_x, INT16 src_y, - CARD16 src_w, CARD16 src_h, + INT16 src_x, INT16 src_y, + CARD16 src_w, CARD16 src_h, INT16 drw_x, INT16 drw_y, CARD16 drw_w, CARD16 drw_h, XvImagePtr format, @@ -1669,22 +1723,22 @@ xf86XVPutImage( WinBox.y1 = pDraw->y + drw_y; WinBox.x2 = WinBox.x1 + drw_w; WinBox.y2 = WinBox.y1 + drw_h; - + REGION_INIT(pScreen, &WinRegion, &WinBox, 1); - REGION_INIT(pScreen, &ClipRegion, NullBox, 1); - REGION_INTERSECT(pScreen, &ClipRegion, &WinRegion, pGC->pCompositeClip); + REGION_NULL(pScreen, &ClipRegion); + REGION_INTERSECT(pScreen, &ClipRegion, &WinRegion, pGC->pCompositeClip); if(portPriv->AdaptorRec->flags & VIDEO_CLIP_TO_VIEWPORT) { RegionRec VPReg; BoxRec VPBox; - VPBox.x1 = portPriv->pScrn->frameX0; + VPBox.x1 = portPriv->pScrn->frameX0; VPBox.y1 = portPriv->pScrn->frameY0; - VPBox.x2 = portPriv->pScrn->frameX1 + 1; + VPBox.x2 = portPriv->pScrn->frameX1 + 1; VPBox.y2 = portPriv->pScrn->frameY1 + 1; REGION_INIT(pScreen, &VPReg, &VPBox, 1); - REGION_INTERSECT(Screen, &ClipRegion, &ClipRegion, &VPReg); + REGION_INTERSECT(pScreen, &ClipRegion, &ClipRegion, &VPReg); REGION_UNINIT(pScreen, &VPReg); } @@ -1700,11 +1754,11 @@ xf86XVPutImage( if(portPriv->AdaptorRec->flags & VIDEO_NO_CLIPPING) { BoxPtr clipBox = REGION_RECTS(&ClipRegion); if( (REGION_NUM_RECTS(&ClipRegion) != 1) || - (clipBox->x1 != WinBox.x1) || (clipBox->x2 != WinBox.x2) || + (clipBox->x1 != WinBox.x1) || (clipBox->x2 != WinBox.x2) || (clipBox->y1 != WinBox.y1) || (clipBox->y2 != WinBox.y2)) { clippedAway = TRUE; - goto PUT_IMAGE_BAILOUT; + goto PUT_IMAGE_BAILOUT; } } @@ -1712,7 +1766,7 @@ xf86XVPutImage( REGION_SUBTRACT(pScreen, &ClipRegion, &WinRegion, &ClipRegion); } - ret = (*portPriv->AdaptorRec->PutImage)(portPriv->pScrn, + ret = (*portPriv->AdaptorRec->PutImage)(portPriv->pScrn, src_x, src_y, WinBox.x1, WinBox.y1, src_w, src_h, drw_w, drw_h, format->id, data, width, height, sync, &ClipRegion, portPriv->DevPriv.ptr); @@ -1733,9 +1787,9 @@ xf86XVPutImage( PUT_IMAGE_BAILOUT: if((clippedAway || (ret != Success)) && (portPriv->isOn == XV_ON)) { - (*portPriv->AdaptorRec->StopVideo)( - portPriv->pScrn, portPriv->DevPriv.ptr, FALSE); - portPriv->isOn = XV_PENDING; + (*portPriv->AdaptorRec->StopVideo)( + portPriv->pScrn, portPriv->DevPriv.ptr, FALSE); + portPriv->isOn = XV_PENDING; } REGION_UNINIT(pScreen, &WinRegion); @@ -1745,19 +1799,19 @@ PUT_IMAGE_BAILOUT: } -static int +static int xf86XVQueryImageAttributes( - ClientPtr client, + ClientPtr client, XvPortPtr pPort, - XvImagePtr format, - CARD16 *width, - CARD16 *height, + XvImagePtr format, + CARD16 *width, + CARD16 *height, int *pitches, int *offsets ){ XvPortRecPrivatePtr portPriv = (XvPortRecPrivatePtr)(pPort->devPriv.ptr); - return (*portPriv->AdaptorRec->QueryImageAttributes)(portPriv->pScrn, + return (*portPriv->AdaptorRec->QueryImageAttributes)(portPriv->pScrn, format->id, width, height, pitches, offsets); } @@ -1778,7 +1832,7 @@ xf86XVFillKeyHelper (ScreenPtr pScreen, CARD32 key, RegionPtr clipboxes) pval[0] = key; pval[1] = IncludeInferiors; ScreenPriv->videoGC = CreateGC(root, GCForeground | GCSubwindowMode, - pval, &status); + pval, &status); if(!ScreenPriv->videoGC) return; ValidateGC(root, ScreenPriv->videoGC); } else if (key != ScreenPriv->videoGC->fgPixel){ @@ -1795,20 +1849,20 @@ xf86XVFillKeyHelper (ScreenPtr pScreen, CARD32 key, RegionPtr clipboxes) rects[i].width = pbox->x2 - pbox->x1; rects[i].height = pbox->y2 - pbox->y1; } - + (*ScreenPriv->videoGC->ops->PolyFillRect)( - root, ScreenPriv->videoGC, nbox, rects); + root, ScreenPriv->videoGC, nbox, rects); DEALLOCATE_LOCAL(rects); } -/* xf86XVClipVideoHelper - +/* xf86XVClipVideoHelper - Takes the dst box in standard X BoxRec form (top and left edges inclusive, bottom and right exclusive). The new dst - box is returned. The source boundaries are given (x1, y1 - inclusive, x2, y2 exclusive) and returned are the new source - boundaries in 16.16 fixed point. + box is returned. The source boundaries are given (x1, y1 + inclusive, x2, y2 exclusive) and returned are the new source + boundaries in 16.16 fixed point. */ #define DummyScreen screenInfo.screens[0] @@ -1824,112 +1878,169 @@ xf86XVClipVideoHelper( INT32 width, INT32 height ){ - INT32 vscale, hscale, delta; + double xsw, xdw, ysw, ydw; + INT32 delta; BoxPtr extents = REGION_EXTENTS(DummyScreen, reg); int diff; - hscale = ((*xb - *xa) << 16) / (dst->x2 - dst->x1); - vscale = ((*yb - *ya) << 16) / (dst->y2 - dst->y1); + xsw = (*xb - *xa) << 16; + xdw = dst->x2 - dst->x1; + ysw = (*yb - *ya) << 16; + ydw = dst->y2 - dst->y1; *xa <<= 16; *xb <<= 16; *ya <<= 16; *yb <<= 16; diff = extents->x1 - dst->x1; - if(diff > 0) { - dst->x1 = extents->x1; - *xa += diff * hscale; + if (diff > 0) { + dst->x1 = extents->x1; + *xa += (diff * xsw) / xdw; } diff = dst->x2 - extents->x2; - if(diff > 0) { - dst->x2 = extents->x2; - *xb -= diff * hscale; + if (diff > 0) { + dst->x2 = extents->x2; + *xb -= (diff * xsw) / xdw; } diff = extents->y1 - dst->y1; - if(diff > 0) { - dst->y1 = extents->y1; - *ya += diff * vscale; + if (diff > 0) { + dst->y1 = extents->y1; + *ya += (diff * ysw) / ydw; } diff = dst->y2 - extents->y2; - if(diff > 0) { - dst->y2 = extents->y2; - *yb -= diff * vscale; + if (diff > 0) { + dst->y2 = extents->y2; + *yb -= (diff * ysw) / ydw; } - if(*xa < 0) { - diff = (- *xa + hscale - 1)/ hscale; - dst->x1 += diff; - *xa += diff * hscale; + if (*xa < 0) { + diff = (((-*xa) * xdw) + xsw - 1) / xsw; + dst->x1 += diff; + *xa += (diff * xsw) / xdw; } delta = *xb - (width << 16); - if(delta > 0) { - diff = (delta + hscale - 1)/ hscale; - dst->x2 -= diff; - *xb -= diff * hscale; + if (delta > 0) { + diff = ((delta * xdw) + xsw - 1) / xsw; + dst->x2 -= diff; + *xb -= (diff * xsw) / xdw; } - if(*xa >= *xb) return FALSE; + if (*xa >= *xb) return FALSE; - if(*ya < 0) { - diff = (- *ya + vscale - 1)/ vscale; - dst->y1 += diff; - *ya += diff * vscale; + if (*ya < 0) { + diff = (((-*ya) * ydw) + ysw - 1) / ysw; + dst->y1 += diff; + *ya += (diff * ysw) / ydw; } delta = *yb - (height << 16); - if(delta > 0) { - diff = (delta + vscale - 1)/ vscale; - dst->y2 -= diff; - *yb -= diff * vscale; + if (delta > 0) { + diff = ((delta * ydw) + ysw - 1) / ysw; + dst->y2 -= diff; + *yb -= (diff * ysw) / ydw; } - if(*ya >= *yb) return FALSE; + if (*ya >= *yb) return FALSE; - if((dst->x1 != extents->x1) || (dst->x2 != extents->x2) || - (dst->y1 != extents->y1) || (dst->y2 != extents->y2)) + if ((dst->x1 > extents->x1) || (dst->x2 < extents->x2) || + (dst->y1 > extents->y1) || (dst->y2 < extents->y2)) { - RegionRec clipReg; - REGION_INIT(DummyScreen, &clipReg, dst, 1); - REGION_INTERSECT(DummyScreen, reg, reg, &clipReg); - REGION_UNINIT(DummyScreen, &clipReg); + RegionRec clipReg; + REGION_INIT(DummyScreen, &clipReg, dst, 1); + REGION_INTERSECT(DummyScreen, reg, reg, &clipReg); + REGION_UNINIT(DummyScreen, &clipReg); } return TRUE; } +void +xf86XVCopyYUV12ToPacked( + const void *srcy, + const void *srcv, + const void *srcu, + void *dst, + int srcPitchy, + int srcPitchuv, + int dstPitch, + int h, + int w +){ + CARD32 *Dst; + const CARD8 *Y, *U, *V; + int i, j; -/**************** Offscreen surface stuff *******************/ - -typedef struct { - XF86OffscreenImagePtr images; - int num; -} OffscreenImageRec; + w >>= 1; + + for (j = 0; j < h; j++) { + Dst = dst; + Y = srcy; V = srcv; U = srcu; + i = w; + while (i >= 4) { +#if X_BYTE_ORDER == X_LITTLE_ENDIAN + Dst[0] = Y[0] | (Y[1] << 16) | (U[0] << 8) | (V[0] << 24); + Dst[1] = Y[2] | (Y[3] << 16) | (U[1] << 8) | (V[1] << 24); + Dst[2] = Y[4] | (Y[5] << 16) | (U[2] << 8) | (V[2] << 24); + Dst[3] = Y[6] | (Y[7] << 16) | (U[3] << 8) | (V[3] << 24); +#else + /* This assumes a little-endian framebuffer */ + Dst[0] = (Y[0] << 24) | (Y[1] << 8) | (U[0] << 16) | Y[0]; + Dst[1] = (Y[2] << 24) | (Y[3] << 8) | (U[1] << 16) | Y[1]; + Dst[2] = (Y[4] << 24) | (Y[5] << 8) | (U[2] << 16) | Y[2]; + Dst[3] = (Y[6] << 24) | (Y[7] << 8) | (U[3] << 16) | Y[3]; +#endif + Dst += 4; Y += 8; V += 4; U += 4; + i -= 4; + } -static OffscreenImageRec OffscreenImages[MAXSCREENS]; -static Bool offscreenInited = FALSE; + while (i--) { +#if X_BYTE_ORDER == X_LITTLE_ENDIAN + Dst[0] = Y[0] | (Y[1] << 16) | (U[0] << 8) | (V[0] << 24); +#else + /* This assumes a little-endian framebuffer */ + Dst[0] = (Y[0] << 24) | (Y[1] << 8) | (U[0] << 16) | Y[0]; +#endif + Dst++; Y += 2; V++; U++; + } -Bool -xf86XVRegisterOffscreenImages( - ScreenPtr pScreen, - XF86OffscreenImagePtr images, - int num -){ - if(!offscreenInited) { - bzero(OffscreenImages, sizeof(OffscreenImages[MAXSCREENS])); - offscreenInited = TRUE; + dst = (CARD8 *)dst + dstPitch; + srcy = (const CARD8 *)srcy + srcPitchy; + if (j & 1) { + srcu = (const CARD8 *)srcu + srcPitchuv; + srcv = (const CARD8 *)srcv + srcPitchuv; + } } - - OffscreenImages[pScreen->myNum].num = num; - OffscreenImages[pScreen->myNum].images = images; - - return TRUE; } -XF86OffscreenImagePtr -xf86XVQueryOffscreenImages( - ScreenPtr pScreen, - int *num +void +xf86XVCopyPacked( + const void *src, + void *dst, + int srcPitch, + int dstPitch, + int h, + int w ){ - if(!offscreenInited) { - *num = 0; - return NULL; - } - - *num = OffscreenImages[pScreen->myNum].num; - return OffscreenImages[pScreen->myNum].images; + const CARD32 *Src; + CARD32 *Dst; + int i; + + w >>= 1; + while (--h >= 0) { + do { + Dst = dst; Src = src; + i = w; + while (i >= 4) { + Dst[0] = Src[0]; + Dst[1] = Src[1]; + Dst[2] = Src[2]; + Dst[3] = Src[3]; + Dst += 4; Src += 4; i -= 4; + } + if (!i) break; + Dst[0] = Src[0]; + if (i == 1) break; + Dst[1] = Src[1]; + if (i == 2) break; + Dst[2] = Src[2]; + } while (0); + + src = (const CARD8 *)src + srcPitch; + dst = (CARD8 *)dst + dstPitch; + } } diff --git a/hw/xfree86/common/xf86xv.h b/hw/xfree86/common/xf86xv.h index 9fd6b4edf..316d6c9e5 100644 --- a/hw/xfree86/common/xf86xv.h +++ b/hw/xfree86/common/xf86xv.h @@ -1,4 +1,31 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86xv.h,v 1.23 2002/11/09 01:18:33 keithp Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86xv.h,v 1.25 2003/08/24 17:36:56 dawes Exp $ */ + +/* + * Copyright (c) 1998-2003 by The XFree86 Project, 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 COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + * + * Except as contained in this notice, the name of the copyright holder(s) + * and author(s) shall not be used in advertising or otherwise to promote + * the sale, use or other dealings in this Software without prior written + * authorization from the copyright holder(s) and author(s). + */ #ifndef _XF86XV_H_ #define _XF86XV_H_ @@ -218,55 +245,27 @@ xf86XVClipVideoHelper( INT32 height ); -/*** These are DDX layer privates ***/ - -extern int XF86XvScreenIndex; - -typedef struct { - DestroyWindowProcPtr DestroyWindow; - ClipNotifyProcPtr ClipNotify; - WindowExposuresProcPtr WindowExposures; - void (*AdjustFrame)(int, int, int, int); - Bool (*EnterVT)(int, int); - void (*LeaveVT)(int, int); - GCPtr videoGC; -} XF86XVScreenRec, *XF86XVScreenPtr; - -typedef struct { - int flags; - PutVideoFuncPtr PutVideo; - PutStillFuncPtr PutStill; - GetVideoFuncPtr GetVideo; - GetStillFuncPtr GetStill; - StopVideoFuncPtr StopVideo; - SetPortAttributeFuncPtr SetPortAttribute; - GetPortAttributeFuncPtr GetPortAttribute; - QueryBestSizeFuncPtr QueryBestSize; - PutImageFuncPtr PutImage; - ReputImageFuncPtr ReputImage; - QueryImageAttributesFuncPtr QueryImageAttributes; -} XvAdaptorRecPrivate, *XvAdaptorRecPrivatePtr; - -typedef struct { - ScrnInfoPtr pScrn; - DrawablePtr pDraw; - unsigned char type; - unsigned int subWindowMode; - DDXPointRec clipOrg; - RegionPtr clientClip; - RegionPtr pCompositeClip; - Bool FreeCompositeClip; - XvAdaptorRecPrivatePtr AdaptorRec; - XvStatus isOn; - Bool moved; - int vid_x, vid_y, vid_w, vid_h; - int drw_x, drw_y, drw_w, drw_h; - DevUnion DevPriv; -} XvPortRecPrivate, *XvPortRecPrivatePtr; +void +xf86XVCopyYUV12ToPacked( + const void *srcy, + const void *srcv, + const void *srcu, + void *dst, + int srcPitchy, + int srcPitchuv, + int dstPitch, + int h, + int w +); -typedef struct _XF86XVWindowRec{ - XvPortRecPrivatePtr PortRec; - struct _XF86XVWindowRec *next; -} XF86XVWindowRec, *XF86XVWindowPtr; +void +xf86XVCopyPacked( + const void *src, + void *dst, + int srcPitch, + int dstPitch, + int h, + int w +); #endif /* _XF86XV_H_ */ diff --git a/hw/xfree86/common/xf86xvmc.c b/hw/xfree86/common/xf86xvmc.c index 4559359ec..832861ea4 100644 --- a/hw/xfree86/common/xf86xvmc.c +++ b/hw/xfree86/common/xf86xvmc.c @@ -1,4 +1,31 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86xvmc.c,v 1.3 2001/04/01 14:00:08 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86xvmc.c,v 1.6 2003/10/08 22:31:59 mvojkovi Exp $ */ + +/* + * Copyright (c) 2001-2003 by The XFree86 Project, 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 COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + * + * Except as contained in this notice, the name of the copyright holder(s) + * and author(s) shall not be used in advertising or otherwise to promote + * the sale, use or other dealings in this Software without prior written + * authorization from the copyright holder(s) and author(s). + */ #include "misc.h" #include "xf86.h" @@ -14,6 +41,7 @@ #include "xvmodproc.h" #endif +#include "xf86xvpriv.h" #include "xf86xvmc.h" #ifdef XFree86LOADER @@ -199,3 +227,13 @@ Bool xf86XvMCScreenInit( return TRUE; } + +XF86MCAdaptorPtr xf86XvMCCreateAdaptorRec (void) +{ + return xcalloc(1, sizeof(XF86MCAdaptorRec)); +} + +void xf86XvMCDestroyAdaptorRec(XF86MCAdaptorPtr adaptor) +{ + xfree(adaptor); +} diff --git a/hw/xfree86/common/xf86xvmc.h b/hw/xfree86/common/xf86xvmc.h index 074edbebe..0b073aac8 100644 --- a/hw/xfree86/common/xf86xvmc.h +++ b/hw/xfree86/common/xf86xvmc.h @@ -1,4 +1,31 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86xvmc.h,v 1.5 2001/11/14 21:54:39 mvojkovi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86xvmc.h,v 1.7 2003/10/08 22:31:59 mvojkovi Exp $ */ + +/* + * Copyright (c) 2001 by The XFree86 Project, 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 COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + * + * Except as contained in this notice, the name of the copyright holder(s) + * and author(s) shall not be used in advertising or otherwise to promote + * the sale, use or other dealings in this Software without prior written + * authorization from the copyright holder(s) and author(s). + */ #ifndef _XF86XVMC_H #define _XF86XVMC_H @@ -131,4 +158,7 @@ Bool xf86XvMCScreenInit( XF86MCAdaptorPtr *adaptors ); +XF86MCAdaptorPtr xf86XvMCCreateAdaptorRec (void); +void xf86XvMCDestroyAdaptorRec(XF86MCAdaptorPtr adaptor); + #endif /* _XF86XVMC_H */ diff --git a/hw/xfree86/common/xisb.c b/hw/xfree86/common/xisb.c index 4132c7abf..facc27842 100644 --- a/hw/xfree86/common/xisb.c +++ b/hw/xfree86/common/xisb.c @@ -24,7 +24,7 @@ * in this Software without prior written authorization from Metro Link. * */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xisb.c,v 1.5 2000/11/06 19:24:07 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xisb.c,v 1.6 2003/03/25 04:18:21 dawes Exp $ */ /* X Input Serial Buffer routines for use in any XInput driver that accesses @@ -36,6 +36,10 @@ * Standard Headers ****************************************************************************/ +#ifdef __UNIXOS2__ +#define I_NEED_OS2_H +#endif + #include <misc.h> #include <xf86.h> #include <xf86Version.h> |