summaryrefslogtreecommitdiff
path: root/include/misc.h
AgeCommit message (Collapse)AuthorFilesLines
2011-11-29include: add BUG_WARN macro for internal bug cases.Peter Hutterer1-0/+7
There are plenty of cases that can only be triggered by a real bug in the server and doing the ErrorF dance manually everywhere is a tad painful and the error message is usually used only to find the spot in the file anyway. Plus, reading BUG_WARN somewhere is a good indicator to the casual reader that this isn't intended behaviour. Note that this is intentionally different to the BUG_ON behaviour on the kernel, we do not FatalError the server. It's just a warning + stacktrace. If the bug is really fatal, call FatalError. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Chase Douglas <chase.douglas@canonical.com> Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2011-11-23Fix Sun compiler check that got turned aroundAlan Coopersmith1-1/+1
Since the check is for !(compilers that support __builtin_constant_p) it needs to be !(gcc or new enough Sun cc), but was written as !(gcc or too old Sun cc). Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
2011-10-03Remove incorrect & in swap_uint32Matt Turner1-1/+1
Caused by commit 893e86a4, and hidden by the (char *) cast. Signed-off-by: Matt Turner <mattst88@gmail.com> Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com> Reviewed-by: Jamey Sharp <jamey@minilop.net> Reviewed-by: Aaron Plattner <aplattner@nvidia.com> Tested-by: Aaron Plattner <aplattner@nvidia.com>
2011-09-28Address regressions from e8ff555b95ba and d206d52f657c to work with other ↵Jeremy Huddleston1-2/+4
compilers 1) The error attribute appeared in gcc-4.3 2) The return type of __builtin_constant_p is int 3) Sun Studio 12.0 and later builtin support for __builtin_constant_p Found by Tinderbox. Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com> Reviewed-by: Matt Turner <mattst88@gmail.com> Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Aaron Plattner <aplattner@nvidia.com>
2011-09-21Use __builtin_constant_p to determine if we can use lswaplMatt Turner1-2/+13
If the address of the swapped memory location is known at compile time, we can check its alignment at no runtime cost and use lswapl instead. text data bss dec hex filename before: 1872820 52136 78040 2002996 1e9034 hw/xfree86/Xorg after: 1864396 52136 78040 1994572 1e6f4c hw/xfree86/Xorg bswap instructions: 131 -> 308 (used in lswapl) rol instructions: 943 -> 1174 (used in lswaps) Reviewed-by: Peter Harris <pharris@opentext.com> Signed-off-by: Matt Turner <mattst88@gmail.com>
2011-09-21Use lswap{l,s} in cpswap{l,s}Matt Turner1-8/+6
Should be safe since cpswap isn't used on pointers. text data bss dec hex filename before: 1875588 52136 78040 2005764 1e9b04 hw/xfree86/Xorg after: 1872820 52136 78040 2002996 1e9034 hw/xfree86/Xorg bswap instructions: 5 -> 131 (used in lswapl) rol instructions: 811 -> 943 (used in lswaps) Reviewed-by: Peter Harris <pharris@opentext.com> Signed-off-by: Matt Turner <mattst88@gmail.com>
2011-09-21Make lswap{l,s} inline functionsMatt Turner1-6/+12
text data bss dec hex filename before: 1875668 52136 78040 2005844 1e9b54 hw/xfree86/Xorg after: 1875588 52136 78040 2005764 1e9b04 hw/xfree86/Xorg Reviewed-by: Peter Harris <pharris@opentext.com> Signed-off-by: Matt Turner <mattst88@gmail.com>
2011-09-21Add type checking to swap macrosMatt Turner1-0/+16
The original macros are retained (instead of replacing them with inline functions) because of implicit type promotion. That is, an int16 passed to an inline function taking int32 would be implicitly promoted to int32 without a warning. Reviewed-by: Peter Harris <pharris@opentext.com> Signed-off-by: Matt Turner <mattst88@gmail.com>
2011-09-21Introduce swap_uint{16,32} functions, used in swap{l,s}Matt Turner1-10/+20
Reviewed-by: Peter Harris <pharris@opentext.com> Signed-off-by: Matt Turner <mattst88@gmail.com>
2011-09-21Use internal temp variable for swap macrosMatt Turner1-6/+8
Also, fix whitespace, mainly around swaps(&rep.sequenceNumber) Reviewed-by: Peter Harris <pharris@opentext.com> Signed-off-by: Matt Turner <mattst88@gmail.com>
2011-09-21Replace Fabs() macro with fabs() functionMatt Turner1-3/+0
gcc generates better code with fabs() anyway. Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com> Tested-by: Jeremy Huddleston <jeremyhu@apple.com> Reviewed-by: Daniel Stone <daniel@fooishbar.org> Signed-off-by: Matt Turner <mattst88@gmail.com>
2011-05-13include: add version_compare helper functionPeter Hutterer1-0/+18
Compare two version numbers in the major.minor form. Switch the few users of manual version switching over to the new function. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Jamey Sharp <jamey@minilop.net>
2011-03-14dix: Fix ATOM typedefAdam Jackson1-1/+2
unsigned long is needlessly large on LP64. Use uint32_t instead. Reviewed-by: Daniel Stone <daniel@fooishbar.org> Signed-off-by: Adam Jackson <ajax@redhat.com>
2011-03-14Consolidate all the PATH_MAX handling into misc.hChristopher James Halse Rogers1-0/+11
Reviewed-by: Adam Jackson <ajax@redhat.com> Signed-off-by: Christopher James Halse Rogers <christopher.halse.rogers@canonical.com>
2011-03-08dix: Remove PIXEL typedefAdam Jackson1-2/+0
Doesn't appear to be used anywhere. Reviewed-by: Soren Sandmann <ssp@redhat.com> Signed-off-by: Adam Jackson <ajax@redhat.com>
2010-05-13Use _X_ATTRIBUTE_PRINTF _X_DEPRECATED _X_NORETURNJeremy Huddleston1-12/+0
Use the values from xproto rather than duplicating the effort Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com> Reviewed-by: Keith Packard <keithp@keithp.com> Signed-off-by: Keith Packard <keithp@keithp.com>
2010-05-13Introduce X_NORETURN macro defined as __attribute__((noreturn)) for gccMikhail Gusarov1-0/+6
Signed-off-by: Mikhail Gusarov <dottedmag@dottedmag.net> Reviewed-by: Matt Turner <mattst88@gmail.com>
2010-04-30Move X_DEPRECATED to misc.h so it can be used outside resource.hKeith Packard1-0/+6
Signed-off-by: Keith Packard <keithp@keithp.com> Reviewed-by: Jamey Sharp <jamey@minilop.net>
2010-02-11Add xstrtokenize to the dix.Peter Hutterer1-0/+3
Move tokenize out of the parser, make it a dix util function instead. Splitting a string into multiple substrings is useful by other places, so let's use it across the line. Future users include config/hal, config/udev and of course the parser. Example usage: char **substrings = xstrtokenize(my_string, "\n"); Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Dan Nicholson <dbn.lists@gmail.com>
2009-07-14include: introduce byte counting functions.Peter Hutterer1-0/+30
This patch adds the following three functions: bits_to_bytes(bits) - the number of bytes needed to hold 'bits' bytes_to_int32(bytes) - the number of 4-byte units to hold 'bytes' pad_to_int32(bytes) - the closest multiple of 4 equal to or larger than 'bytes'. All three operations are common in protocol processing and currently the server has ((foo + 7)/8 + 3)/4 operations all over the place. A common set of functions reduce the error rate of these (albeit simple) calculations and improve readability of the code. The functions do not check for overflow. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-05-04include: up the number of max. input devices to 40.Peter Hutterer1-1/+1
With the Xtest virtual slave devices we have 4 devices for each MD pointer/keyboard pair, plus the AllDevices and AllMasterDevices reserved deviceids. It's quite easy to hit the current limit. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2008-12-03Rework symbol visibility for easier maintenancePaulo Cesar Pereira de Andrade1-7/+7
Save in a few special cases, _X_EXPORT should not be used in C source files. Instead, it should be used in headers, and the proper C source include that header. Some special cases are symbols that need to be shared between modules, but not expected to be used by external drivers, and symbols that are accessible via LoaderSymbol/dlopen. This patch also adds conditionally some new sdk header files, depending on extensions enabled. These files were added to match pattern for other extensions/modules, that is, have the headers "deciding" symbol visibility in the sdk. These headers are: o Xext/panoramiXsrv.h, Xext/panoramiX.h o fbpict.h (unconditionally) o vidmodeproc.h o mioverlay.h (unconditionally, used only by xaa) o xfixes.h (unconditionally, symbols required by dri2) LoaderSymbol and similar functions now don't have different prototypes, in loaderProcs.h and xf86Module.h, so that both headers can be included, without the need of defining IN_LOADER. xf86NewInputDevice() device prototype readded to xf86Xinput.h, but not exported (and with a comment about it).
2008-10-31Move EXTENSION_BASE and EXTENSION_EVENT_BASE to misc.h.Peter Hutterer1-0/+3
2008-10-31Move MAX_DEVICES to misc.h, rename to MAXDEVICES for consistency.Peter Hutterer1-0/+1
2008-03-04Merge branch 'master' into mpxPeter Hutterer1-3/+1
This merge reverts Magnus' device coorindate scaling changes. MPX core event generation is very different, so we can't scale in GetPointerEvents. Conflicts: Xi/opendev.c dix/devices.c dix/dixfonts.c dix/getevents.c dix/resource.c dix/window.c hw/xfree86/common/xf86Xinput.c mi/mipointer.c xkb/ddxBeep.c xkb/ddxCtrls.c xkb/ddxKeyClick.c xkb/ddxList.c xkb/ddxLoad.c xkb/xkb.c xkb/xkbAccessX.c xkb/xkbEvents.c xkb/xkbInit.c xkb/xkbPrKeyEv.c xkb/xkbUtils.c
2008-02-14Remove some MAX* #defines that never get used.Adam Jackson1-3/+0
2007-07-06Use the same struct for generic event masks throughout the code.Peter Hutterer1-1/+0
Renaming those structs too. Previously grabs were using a different struct than windows, which was reasonably stupid.
2007-06-19Merge branch 'master' into mpxPeter Hutterer1-1/+1
Conflicts: dix/devices.c hw/xfree86/common/xf86Xinput.c hw/xfree86/loader/xf86sym.c mi/mieq.c
2007-05-15Turn boxes and regions into typedefs for pixman typesSoren Sandmann Pedersen1-1/+1
2007-05-14Add ExtendedGrabDevice handling.Peter Hutterer1-0/+1
Add XGE handling in DeliverGrabbedEvent. We can now grab something selecting XGE events, but the current code is a bit messy and doesn't work too well yet.
2006-07-21Remove RCS tags. Fix Xprint makefile braindamage.Adam Jackson1-2/+0
2006-07-18get rid of XFree86LOADER, XFree86Server, XFree86Module, and IN_MODULEDaniel Stone1-12/+2
Get rid of almost all uses of these definitions. They're still defined for delinquent out-of-tree drivers, and also for the Mesa build. As well as for miinitext.c. But largely gone.
2005-07-03Change <X11/misc.h> and <X11/os.h> to "misc.h" and "os.h".Daniel Stone1-1/+1
2005-07-01Change all misc.h and os.h references to <X11/foo.h>.Daniel Stone1-1/+1
2004-07-17Revert change to MAXFORMATS to maintain binary compatibilityKevin E Martin1-1/+1
2004-06-30Add Distributed Multihead X (DMX) supportKevin E Martin1-1/+1
2004-04-23Merging XORG-CURRENT into trunkEgbert Eich1-1/+1
2004-03-14Importing vendor version xf86-4_4_99_1 on Sun Mar 14 00:26:39 PST 2004Egbert Eich1-1/+1
2004-03-03Importing vendor version xf86-4_4_0 on Wed Mar 3 04:09:24 PST 2004Egbert Eich1-1/+1
2004-02-26readding XFree86's cvs IDsEgbert Eich1-1/+1
2004-02-26Importing vendor version xf86-4_3_99_903 on Wed Feb 26 01:21:00 PST 2004Egbert Eich1-1/+1
2003-11-25XFree86 4.3.99.16 Bring the tree up to date for the Cygwin folksKaleb Keithley1-18/+5
2003-11-14XFree86 4.3.0.1Kaleb Keithley1-29/+40
2003-11-14R6.6 is the Xorg base-lineKaleb Keithley1-0/+271