Commit Graph

175 Commits

Author SHA1 Message Date
Daniel Stone
9a953e0e9d Move DRI2 from external module to built-in
Instead of keeping a tiny amount of code in an external module, just man
up and build it into the core server.

v2: Fix test/Makefile.am to only link libdri2.la if DRI2 is set

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
Reviewed-by: Jamey Sharp <jamey@minilop.net>
Signed-off-by: Keith Packard <keithp@keithp.com>
2012-07-10 00:31:01 -07:00
Daniel Stone
459c6da0f9 Move DRI1 from external module to built-in
Rather than building the tiny amount of code required for XFree86-DRI as
an external module, build it in if it's enabled at configure time.

v2: Fix test/Makefile.am to only link libdri.la if DRI is set

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Keith Packard <keithp@keithp.com>

fixup for DRI1 move

Signed-off-by: Keith Packard <keithp@keithp.com>
2012-07-10 00:30:40 -07:00
Alan Coopersmith
ad4092cf7d Replace padlength tables with inline functions from misc.h
Adds new function padding_for_int32() and uses existing pad_to_int32()
depending on required results.

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Tested-by: Daniel Stone <daniel@fooishbar.org>
2012-07-09 22:52:30 -07:00
Peter Hutterer
d84f0f823e Merge branch 'sigio-vt-switch-issues' into for-keith
Conflicts:
	test/Makefile.am

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2012-07-04 21:23:48 +10:00
Peter Hutterer
6bf356ef28 os: add OsBlockSIGIO and OsReleaseSIGIO
Let the dix be in charge of changing the sigprocmask so we only have one
entity that changes it.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
2012-07-03 15:56:33 +10:00
Keith Packard
24525d96a3 Merge branch 'sigsafe-logging-varargs'
This merge includes a minor fixup for '%p' arguments; must cast to
uintptr_t instead of uint64_t as we use -Werror=pointer-to-int-cast
which complains when doing a cast (even explicitly) from a pointer
to an integer of different size.
2012-07-02 22:35:39 -07:00
Peter Hutterer
7100118c8d AC_SUBST the GLX_SYS_LIBS
libxservertest needs -lpthread from glxapi.c's pthread_once() call. Usually
this would be pulled in by the XORG_LIBS but not when building without Xorg.

This commit has no visible effect on the current tree, preparation for test
cleanups.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2012-06-22 10:49:06 +10:00
Sergei Trofimovich
e1f86a7c77 test/.gitignore: add hashtabletest
Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2012-06-22 10:49:06 +10:00
Chase Douglas
704b847abf Add FormatUInt64{,Hex}() for formatting numbers in a signal safe manner
Signed-off-by: Chase Douglas <chase.douglas@canonical.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2012-06-21 15:45:22 +10:00
Chase Douglas
12f9aaff38 test/touch: Initialize device name
Without this change, the test will segfault when we switch to signal-
safe logging.

Signed-off-by: Chase Douglas <chase.douglas@canonical.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2012-06-05 16:04:07 +10:00
Peter Hutterer
43754803c1 test: don't shadow parameter 'len'
protocol-xiquerydevice.c:226:25: warning: declaration of ‘len’ shadows a
parameter [-Wshadow]

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2012-05-16 10:59:39 +10:00
Peter Hutterer
1bafc9f26b test: fix redundant declaration of "BadDevice"
In file included from protocol-common.c:36:0:
protocol-common.h:36:12: warning: redundant redeclaration of ‘BadDevice’
[-Wredundant-decls]
In file included from protocol-common.c:30:0:
../../Xi/exglobals.h:41:12: note: previous declaration of ‘BadDevice’ was
here

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2012-05-16 10:59:39 +10:00
Peter Hutterer
47e1d0ea43 test: fix "userdata shadows global declaration" warnings
protocol-xiquerypointer.c:124:72: warning: declaration of
‘userdata’ shadows a global declaration [-Wshadow]

and similar

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2012-05-16 10:59:39 +10:00
Peter Hutterer
e6da635826 test: fix "redundant declaration of devices" warning
In file included from protocol-xiwarppointer.c:41:0:
protocol-common.h:91:23: warning: redundant redeclaration of ‘devices’
[-Wredundant-decls]
protocol-common.h:86:3: note: previous declaration of ‘devices’ was here

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2012-05-16 10:59:39 +10:00
Michal Suchanek
1d82ec9594 xserver: Fix out-of-tree build
Fixes regression caused by ccb3e78124

Signed-off-by: Michal Suchanek <hramrach@gmail.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2012-05-01 11:36:30 +10:00
Peter Hutterer
ea51e9b287 Xi: return BadValue on XIQueryVersion if the version is less than first call
Clients that use plugin systems may require multiple calls to
XIQueryVersion from different plugins. The current error handling requires
client-side synchronisation of version numbers.

The first call to XIQueryVersion defines the server behaviour. Once cached,
always return that version number to any clients. Unless a client requests a
version lower than the first defined one, then a BadValue must be returned
to be protocol-compatible.

Introduced in 2c23ef83b0

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
2012-05-01 11:36:30 +10:00
Jeremy Huddleston
d1ef0d4964 test: Fix make dist
It seems like make dist should be doing te right thing without this commit,
but it's not in some cases.  Don't ask me to explain why.

Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
2012-04-23 20:20:41 -07:00
Erkki Seppälä
ccb3e78124 Xext: add a generic hashtable implementation
The generic hashtable implementation adds a key-value container, that
keeps the key and value inside the hashtable structure and manages
their memory by itself. This data structure is best suited for
fixed-length keys and values.

One creates a new hash table with ht_create and disposes it with
ht_destroy. ht_create accepts the key and value sizes (in bytes) in
addition to the hashing and comparison functions to use. When adding
keys with ht_add, they will be copied into the hash and a pointer to
the value will be returned: data may be put into this structure (or if
the hash table is to be used as a set, one can just not put anything
in).

The hash table comes also with one generic hashing function plus a
comparison function to facilitate ease of use. It also has a custom
hashing and comparison functions for hashing resource IDs with
HashXID.

Reviewed-by: Rami Ylimäki <rami.ylimaki@vincit.fi>
Signed-off-by: Erkki Seppälä <erkki.seppala@vincit.fi>
2012-04-18 12:49:06 +03:00
Peter Hutterer
641a1b9363 test: reset the client before checking the swapped version
As of 2c23ef83b0, the server returns BadValue
for the same client with multiple versions. Avoid this by resetting the
client before we issue the same request as a fake swap client.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
Tested-by: Jeremy Huddleston <jeremyhu@apple.com>
2012-03-29 08:14:54 +10:00
Peter Hutterer
17f33ca0e5 test: init the sync extensions for tests to pass again
Introduced in d645edd11e

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
Tested-by: Jeremy Huddleston <jeremyhu@apple.com>
2012-03-29 08:14:31 +10:00
Jeremy Huddleston
a818b30598 os: Pass the FatalError message to OsVendorFatalError
Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
Reviewed-by: Jon TURNEY <jon.turney@dronecode.org.uk>
2012-03-24 01:07:05 -07:00
Jeremy Huddleston
df327f98f6 test: Fix 'make dist' for configurations that build the Xorg DDX
Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
2012-03-23 19:46:22 -07:00
Keith Packard
9838b7032e Introduce a consistent coding style
This is strictly the application of the script 'x-indent-all.sh'
from util/modular. Compared to the patch that Daniel posted in
January, I've added a few indent flags:

	-bap
	-psl
	-T PrivatePtr
	-T pmWait
	-T _XFUNCPROTOBEGIN
	-T _XFUNCPROTOEND
	-T _X_EXPORT

The typedefs were needed to make the output of sdksyms.sh match the
previous output, otherwise, the code is formatted badly enough that
sdksyms.sh generates incorrect output.

The generated code was compared with the previous version and found to
be essentially identical -- "assert" line numbers and BUILD_TIME were
the only differences found.

The comparison was done with this script:

dir1=$1
dir2=$2

for dir in $dir1 $dir2; do
	(cd $dir && find . -name '*.o' | while read file; do
		dir=`dirname $file`
		base=`basename $file .o`
		dump=$dir/$base.dump
		objdump -d $file > $dump
	done)
done

find $dir1 -name '*.dump' | while read dump; do
	otherdump=`echo $dump | sed "s;$dir1;$dir2;"`
	diff -u $dump $otherdump
done

Signed-off-by: Keith Packard <keithp@keithp.com>
Acked-by: Daniel Stone <daniel@fooishbar.org>
Acked-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2012-03-21 13:54:42 -07:00
Gaetan Nadon
e08ed0b757 test: add new test cases to .gitignore
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Gaetan Nadon <memsize@videotron.ca>
Signed-off-by: Keith Packard <keithp@keithp.com>
2012-03-04 20:01:29 -08:00
Alan Coopersmith
ca64912c02 Namespace list api to reduce conflicts with similar system headers
Rename functions/macros from list_* to xorg_list_*
Rename struct from struct list to struct xorg_list.

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Keith Packard <keithp@keithp.com>
In-sed-I-trust: Peter Hutterer <peter.hutterer@who-t.net>
2012-02-03 14:23:24 -08:00
Jeremy Huddleston
cd89482088 test: Fix linking issues when building unit tests without the Xorg DDX
This allows unit tests to build and run successfully on darwin when
only the Xvfb or XQuartz DDX is built.

Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
Reviewed-by: Jon TURNEY <jon.turney@dronecode.org.uk>
2012-01-15 02:28:07 -08:00
Chase Douglas
a28ff2cf92 test/xi2: Really fix infinite loop in test_convert_XITouchOwnershipEvent
long i;
for (i = 1; ; i <<= 1)
  if (i == (1 << 31))
    break;

(1 << 31) is compiled as an int, and thus is equal to -2147483648. We
are trying to compare it against a long, which on 64-bit machines is
2147483648. This results in an infinite loop.

Signed-off-by: Chase Douglas <chase.douglas@canonical.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
2011-12-23 13:18:10 -08:00
Keith Packard
e7df42ab68 test/xi2: Fix infinite loop in test_convert_XITouchOwnershipEvent
The touchid test was using a loop like:

	for(i = 1; i < 0xffffffff; i <<= 1)

When 'i' is a 32-bit variable, this infinite loops as it goes from
0x80000000 to 0. 'i' is declared as 'long', which is 32-bit in 32-bit mode.

Signed-off-by: Keith Packard <keithp@keithp.com>
2011-12-22 09:35:51 -08:00
Peter Hutterer
f75bdf7fbe test: fix grab mode value tests for new XIGrabModeTouch
This test checks that last-valid-mode + 1 returns a BadValue. With the
addition of XIGrabModeTouch, that value has changed - sync it up again.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2011-12-22 10:16:15 +10:00
Peter Hutterer
4551510f75 test: add a basic test for ownership event values
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2011-12-21 14:16:37 +10:00
Peter Hutterer
0c661dc478 test: drop printfs from protocol-eventconvert.c
The test outputs are noisy enough, no need having these here too.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2011-12-21 14:16:37 +10:00
Peter Hutterer
5c63dc6dbc dix: add DIX API to create touchpoints
The DIX touchpoints are the ones used for event processing.

Co-authored-by: Daniel Stone <daniel@fooishbar.org>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2011-12-20 13:01:03 +10:00
Peter Hutterer
7f8127d203 dix: if we run out of space for new touch events, resize the queue
The SIGIO handler forces us to drop the current touch and schedule the
actual resize for later. Should not happen if the device sets up the
TouchClassRec with the correct number of touchpoints.

Co-authored-by: Daniel Stone <daniel@fooishbar.org>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2011-12-20 13:01:00 +10:00
Peter Hutterer
758bc57ba5 dix: add helper functions to create DDX touch recs
DDX touch points are the ones that keep records of the driver-submitted
touchpoints. They're unaffected by the grab state and terminate on a
TouchEnd submitted by the driver.

The client ID assigned is server-global.

Since drivers usually submit in the SIGIO handler, we cannot allocate in the
these functions.

Co-authored-by: Daniel Stone <daniel@fooishbar.org>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2011-12-19 09:08:36 +10:00
Peter Hutterer
92c6c0c1d2 tests: update for touch support
Touch event mask must be set for all three event types.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2011-12-16 11:18:47 +10:00
Peter Hutterer
218752bdc5 input: replace GRABTYPE_* with the InputLevel enums
They achieve the same thing, re-use the more generic InputLevel so we can
convert to/fro easier.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2011-12-13 13:24:08 +10:00
Peter Hutterer
e5aa00989c Change GetXI2/XI/CoreType to just take a type argument
Avoids the dummy-event dance if we have an event type and need to get the
matching XI2 type.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2011-12-10 17:54:34 +10:00
Keith Packard
522f8bcc03 Merge remote-tracking branch 'whot/for-keith' 2011-12-08 20:57:26 -08:00
Peter Hutterer
b8b90cd161 Add a new XI2Mask struct and a few helper functions.
The current XI2 mask handling is handy for copying (fixed size arrays) but a
pain to deal with otherwise. Add a struct for XI2 masks and the required
accessors.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2011-12-09 14:56:23 +10:00
Peter Hutterer
7af23259d8 dix: switch the syncEvent queue to a struct list
No effective functionality change, just cleanup to make this code slightly
more sane.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2011-12-09 14:56:20 +10:00
Gaetan Nadon
6369b59668 test: update .gitignore with xfree86 and sort alphabetically
Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Signed-off-by: Gaetan Nadon <memsize@videotron.ca>
Signed-off-by: Keith Packard <keithp@keithp.com>
2011-12-07 12:44:21 -08:00
Peter Hutterer
c8e451a8e7 include: add list_last_entry to get the tail of a list
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2011-12-06 18:15:14 +10:00
Peter Hutterer
6acebf9e12 include: add list_append()
The existing list_add() prepends to the list, but in some cases we need the
list ordered in the way we append the elements.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2011-12-06 18:15:14 +10:00
Alan Coopersmith
84207def93 Disable building of tests requiring DDX functions when Xorg is not built
Some test cases require linking with some sort of DDX - ideally we'd
have a stub ddx for testing, but for now, since we link with the Xorg
ddx, disable those tests when configured with --disable-xorg

Fixes https://bugs.freedesktop.org/show_bug.cgi?id=43320

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Dan Nicholson <dbn.lists@gmail.com>
Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
2011-12-02 16:02:56 -08:00
Peter Hutterer
dfcec1d3f9 test: remove unneeded printf statements from misc.c
Leftover from debugging, is not really needeed in a test.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2011-11-29 15:13:37 +10:00
Alan Coopersmith
acde97a39d Add fallback implementation of strndup()
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
Linux test code fixed by: Keith Packard <keithp@keithp.com>
2011-11-23 12:15:05 -08:00
Alan Coopersmith
e47aa94750 Enable memory checking during unit testing
If configure is generated with xorg-macros 1.16.0 or newer, and
an appropriate memory checking library is found for the platform,
use it when running unit tests.   If not, then no harm is done.

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
2011-11-23 12:15:05 -08:00
Alan Coopersmith
36670065bd Don't require ld -wrap for tests that don't need it
If configure is generated with xorg-macros 1.16 or later, this allows
builders to --enable-unit-test and run the tests other than the xi2
tests which require ld -wrap (and are still wrapped in if HAVE_LD_WRAP
in tests/xi2/Makefile).  If an older xorg-macros is used, the existing
behaviour is preserved of requiring ld -wrap for all unit tests, but
no side effects occur, so the minimum xorg-macros version is not raised.

If unit testing is enabled without ld -wrap, then we create a bogus
"xi2-tests" script just to report that we're skipping them.

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
2011-11-23 12:15:05 -08:00
Keith Packard
d91aa0e660 Merge remote-tracking branch 'whot/two-screen-coordinates' 2011-11-02 21:20:07 -07:00
Servaas Vandenberghe
820d9040f5 xfree86: fix potential buffer overflow
The patch below fixes a potential buffer overflow in xf86addComment().
This occurs if  curlen > 0 && eol_seen == 0 && iscomment == 0 , as
follows from the code:

char *xf86addComment(char *cur, char *add)

<...>

        len = strlen(add);
        endnewline = add[len - 1] == '\n';
        len +=  1 + iscomment + (!hasnewline) + (!endnewline) + eol_seen;

        if ((str = realloc(cur, len + curlen)) == NULL)
                return cur;

        cur = str;

        if (eol_seen || (curlen && !hasnewline))
                cur[curlen++] = '\n';
        if (!iscomment)
                cur[curlen++] = '#';
        strcpy(cur + curlen, add);
        if (!endnewline)
                strcat(cur, "\n");

Signed-off-by: Servaas Vandenberghe <vdb@picaros.org>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>

[whot: added buffer overflow test case]

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2011-10-31 09:39:04 +10:00