Re: [PATCH v4 xserver] xkb: fix releasing overlay while keydown

2017-01-04 Thread Mariusz Mazur
I've been using this heavily (at least a few hundred overlay1
keystrokes per day) for the past almost two months and had zero
issues. Any chance this could get merged?

2016-11-15 10:31 GMT+01:00 Mariusz Mazur :
> A week has passed and everything's working fine (and I'm using the
> overlay keycombos very very heavily). Seems the patch does not have
> any unforeseen side effects.
>
> 2016-11-07 22:25 GMT+01:00 Mariusz Mazur :
>> Applied to my work env. If something starts acting funny I'll let you know.
>>
>> 2016-11-06 23:42 GMT+01:00 Mihail Konev :
>>> Testcase:
>>>
>>> In ~/.xbindkeysrc:
>>>
>>>   "xterm &"
>>>XF86LaunchA
>>>
>>> In ~/ov.xkb:
>>>
>>>   xkb_keymap {
>>>   xkb_keycodes { include "evdev" };
>>>   xkb_types{ include "complete" };
>>>
>>>   xkb_compat   { include "complete"
>>>interpret Overlay1_Enable+AnyOfOrNone(all) {
>>>   action= SetControls(controls=Overlay1);
>>>};
>>>   };
>>>
>>>   xkb_symbols  { include "pc+inet(evdev)+us"
>>>   key  { [ Overlay1_Enable ] };
>>>   key  { overlay1 =  }; // Insert+1 => 2
>>>   key  { overlay1 =  }; // Insert+~ => 
>>> XF86LaunchA
>>>   };
>>>
>>>   xkb_geometry { include "pc(pc104)" };
>>>   };
>>>
>>> Apply this layout: 'xkbcomp ~/ov.xkb $DISPLAY'.
>>> Run "xbindkeys -n -v"
>>> In the exact order:
>>> - press Insert
>>> - press Tilde
>>> - release Insert
>>> - wait
>>> - release Tilde
>>> Keyboard input in the new terminal window(s) would be locked
>>> until another Insert+Tilde .
>>>
>>> Reported-by: Mariusz Mazur 
>>> Signed-off-by: Mihail Konev 
>>> ---
>>> v3 was still incorrect and did not done what it was supposed to.
>>> This version is specifically tested to properly enable and disable
>>> overlay, i.e. allow "`"-s to be sent both before and after Insert being
>>> down.
>>> Debugging version attached.
>>>
>>> Without (keywas_overlaid - 1) trickery it does not address the issue
>>> (i.e. input stays locked until Insert+Tilde)
>>> (but does not happen without open-new-window being triggered by xbindkeys,
>>> i.e. when the latter is not running).
>>> Maybe overlay_perkey_state description comment should better reflect this.
>>>
>>> Also commit description missed Reported-by.
>>>
>>> The "where-overlay1,2-is-in-xkb" is resolved in this patch.
>>>
>>> As for "applicability of overlays", they are per-keycode, and 
>>> layout-independent.
>>> This differs from RedirectKey that are per-keysym, and, therefore,
>>> also per-shift-level and per-layout (per-group).
>>>
>>> There should be no need to use overlays instead of RedirectKey,
>>> especially given that overlay is a "behavior", which
>>> could be only one per keycode.
>>>
>>>  xkb/xkbPrKeyEv.c | 36 +++-
>>>  1 file changed, 31 insertions(+), 5 deletions(-)
>>>
>>> diff --git a/xkb/xkbPrKeyEv.c b/xkb/xkbPrKeyEv.c
>>> index f7a6b4b14306..35bb1e9f405a 100644
>>> --- a/xkb/xkbPrKeyEv.c
>>> +++ b/xkb/xkbPrKeyEv.c
>>> @@ -43,6 +43,14 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
>>>
>>>  
>>> /******/
>>>
>>> +/* Keeps track of overlay in effect for a given key,
>>> + * so that if an overlay is released while key is down,
>>> + * the key retains overlaid until its release.
>>> + * Cannot be a bitmask, as needs at least three values
>>> + * (as overlaid keys need to generate two releases).
>>> + * */
>>> +static unsigned char overlay_perkey_state[256];
>>> +
>>>  void
>>>  XkbProcessKeyboardEvent(DeviceEvent *event, DeviceIntPtr keybd)
>>>  {
>>> @@ -121,20 +129,38 @@ XkbProcessKeyboardEvent(DeviceEvent *event, 
>>> DeviceIntPtr keybd)
>>>  case XkbKB_Overlay2:
>>>  {
>>>  unsigned which;
>>> +unsigned overlay_active_now;
>>> +unsigned is_keyrelease = (event->type == ET_KeyRelease) ? 1 : 
>>> 0;
>>> +unsigned key_was_overlaid = 0;
>>>
>>>  if (behavior.type == XkbKB_Overlay1)
>>>  which = XkbOverlay1Mask;
>>>  else
>>>  which = XkbOverlay2Mask;
>>> -if ((xkbi->desc->ctrls->enabled_ctrls & which) == 0)
>>> +overlay_active_now = (xkbi->desc->ctrls->enabled_ctrls & 
>>> which) ? 1 : 0;
>>> +
>>> +if ((unsigned char)key == key) {
>>> +key_was_overlaid = overlay_perkey_state[key];
>>> +if (overlay_active_now && !is_keyrelease)
>>> +overlay_perkey_state[key] = 2;
>>> +else if (is_keyrelease && (overlay_active_now || 
>>> key_was_overlaid))
>>> +overlay_perkey_state[key] = key_was_overlaid - 1;
>>> +else if (key_was_overlaid && !overlay_active_now && 
>>> !is_keyrelease) {
>>> +   

Re: [PATCH fbdev] Fix shadow fb allocation size (v2)

2017-01-04 Thread Alex Deucher
On Wed, Jan 4, 2017 at 10:30 AM, Adam Jackson  wrote:
> ->bitsPerPixel is rather obviously eight times too large.
>
> v2: Use ->displayWidth - the pitch - not ->virtualX (Keith Packard)
>
> Signed-off-by: Adam Jackson 

Reviewed-by: Alex Deucher 

> ---
>  src/fbdev.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/src/fbdev.c b/src/fbdev.c
> index 2c658fe..4309d76 100644
> --- a/src/fbdev.c
> +++ b/src/fbdev.c
> @@ -827,8 +827,8 @@ FBDevScreenInit(SCREEN_INIT_ARGS_DECL)
> fPtr->fbstart = fPtr->fbmem + fPtr->fboff;
>
> if (fPtr->shadowFB) {
> -   fPtr->shadow = calloc(1, pScrn->virtualX * pScrn->virtualY *
> - pScrn->bitsPerPixel);
> +   fPtr->shadow = calloc(1, pScrn->displayWidth * pScrn->virtualY *
> + ((pScrn->bitsPerPixel + 7) / 8));
>
> if (!fPtr->shadow) {
> xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
> --
> 2.9.3
>
> ___
> xorg-devel@lists.x.org: X.Org development
> Archives: http://lists.x.org/archives/xorg-devel
> Info: https://lists.x.org/mailman/listinfo/xorg-devel
___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel

[PATCH v3 xserver 2/6] tests: Convert test/xi1/ to single binary

2017-01-04 Thread Mihail Konev
Part of refactoring the tests into a single binary,
to make partial rebuild slightly faster and less verbose.

Signed-off-by: Mihail Konev 
---
 test/tests-common.c  | 33 
 test/tests-common.h  |  9 
 test/tests.h |  7 ++
 test/xi1/.gitignore  |  2 +-
 test/xi1/Makefile.am | 37 
 test/xi1/protocol-xchangedevicecontrol.c |  2 +-
 test/xi1/tests.c | 11 ++
 test/xi2/Makefile.am |  5 -
 test/xi2/protocol-common.h   |  2 ++
 9 files changed, 91 insertions(+), 17 deletions(-)
 create mode 100644 test/tests-common.c
 create mode 100644 test/tests-common.h
 create mode 100644 test/tests.h
 create mode 100644 test/xi1/tests.c

diff --git a/test/tests-common.c b/test/tests-common.c
new file mode 100644
index ..686852827765
--- /dev/null
+++ b/test/tests-common.c
@@ -0,0 +1,33 @@
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include "tests-common.h"
+
+void
+run_test_in_child(int (*func)(void), const char *funcname)
+{
+int cpid;
+int csts;
+int exit_code = -1;
+
+printf("\n-\n%s...\n", funcname);
+cpid = fork();
+if (cpid) {
+waitpid(cpid, , 0);
+if (!WIFEXITED(csts))
+goto child_failed;
+exit_code = WEXITSTATUS(csts);
+if (exit_code == 0)
+printf(" Pass\n");
+else {
+child_failed:
+printf(" FAIL\n");
+exit(exit_code);
+}
+} else {
+exit(func());
+}
+}
diff --git a/test/tests-common.h b/test/tests-common.h
new file mode 100644
index ..b02f746f6f56
--- /dev/null
+++ b/test/tests-common.h
@@ -0,0 +1,9 @@
+#ifndef TESTS_COMMON_H
+#define TESTS_COMMON_H
+
+#define run_test(func) run_test_in_child(func, #func)
+
+void run_test_in_child(int (*func)(void), const char *funcname);
+
+#endif /* TESTS_COMMON_H */
+
diff --git a/test/tests.h b/test/tests.h
new file mode 100644
index ..8a42aa0da592
--- /dev/null
+++ b/test/tests.h
@@ -0,0 +1,7 @@
+#ifndef TESTS_H
+#define TESTS_H
+
+int protocol_xchangedevicecontrol_test(void);
+
+#endif /* TESTS_H */
+
diff --git a/test/xi1/.gitignore b/test/xi1/.gitignore
index c1b9024ee958..2b29f27645f8 100644
--- a/test/xi1/.gitignore
+++ b/test/xi1/.gitignore
@@ -1 +1 @@
-protocol-xchangedevicecontrol
+tests
diff --git a/test/xi1/Makefile.am b/test/xi1/Makefile.am
index 813241c0aeed..7a054dd80966 100644
--- a/test/xi1/Makefile.am
+++ b/test/xi1/Makefile.am
@@ -1,26 +1,35 @@
 if ENABLE_UNIT_TESTS
 if HAVE_LD_WRAP
-noinst_PROGRAMS =  \
-   protocol-xchangedevicecontrol
+noinst_PROGRAMS = tests
+
+TESTS = tests
 
-TESTS=$(noinst_PROGRAMS)
 TESTS_ENVIRONMENT = $(XORG_MALLOC_DEBUG_ENV)
 
-AM_CFLAGS = $(DIX_CFLAGS) @XORG_CFLAGS@
-AM_CPPFLAGS = @XORG_INCS@ -I$(srcdir)/../xi2
-TEST_LDADD=../libxservertest.la $(XORG_SYS_LIBS) $(XSERVER_SYS_LIBS) 
$(GLX_SYS_LIBS)
-COMMON_SOURCES=$(srcdir)/../xi2/protocol-common.c
-COMMON_LDFLAGS= -Wl,-wrap,dixLookupWindow -Wl,-wrap,dixLookupClient
+tests_CFLAGS = $(DIX_CFLAGS) @XORG_CFLAGS@
+tests_CPPFLAGS = \
+   @XORG_INCS@ \
+   -I$(srcdir)/.. \
+   -I$(srcdir)/../xi2 \
+   $()
 
-if SPECIAL_DTRACE_OBJECTS
-TEST_LDADD += $(OS_LIB) $(DIX_LIB)
-endif
+tests_LDFLAGS = \
+   -Wl,-wrap,dixLookupWindow \
+   -Wl,-wrap,dixLookupClient \
+   -Wl,-wrap,WriteToClient \
+   $()
 
-protocol_xchangedevicecontrol_LDADD=$(TEST_LDADD)
+tests_LDADD =../libxservertest.la $(XORG_SYS_LIBS) $(XSERVER_SYS_LIBS) 
$(GLX_SYS_LIBS)
 
-protocol_xchangedevicecontrol_LDFLAGS=$(COMMON_LDFLAGS) -Wl,-wrap,WriteToClient
+tests_SOURCES = \
+   $(srcdir)/../tests-common.c \
+   $(srcdir)/../xi2/protocol-common.c \
+   protocol-xchangedevicecontrol.c \
+   tests.c
 
-protocol_xchangedevicecontrol_SOURCES=$(COMMON_SOURCES) 
protocol-xchangedevicecontrol.c
+if SPECIAL_DTRACE_OBJECTS
+tests_LDADD += $(OS_LIB) $(DIX_LIB)
+endif
 
 else
 # Print that xi1-tests were skipped (exit code 77 for automake test harness)
diff --git a/test/xi1/protocol-xchangedevicecontrol.c 
b/test/xi1/protocol-xchangedevicecontrol.c
index 64d2ca29bb95..57a15c4076f5 100644
--- a/test/xi1/protocol-xchangedevicecontrol.c
+++ b/test/xi1/protocol-xchangedevicecontrol.c
@@ -113,7 +113,7 @@ test_ChangeDeviceControl(void)
 }
 
 int
-main(int argc, char **argv)
+protocol_xchangedevicecontrol_test(void)
 {
 init_simple();
 
diff --git a/test/xi1/tests.c b/test/xi1/tests.c
new file mode 100644
index ..df4638dc98ab
--- /dev/null
+++ b/test/xi1/tests.c
@@ -0,0 +1,11 @@
+#include 
+#include "tests.h"
+#include "tests-common.h"
+
+int
+main(int argc, char **argv)
+{
+run_test(protocol_xchangedevicecontrol_test);
+
+return 0;
+}
diff --git a/test/xi2/Makefile.am b/test/xi2/Makefile.am
index 

[PATCH v3 xserver 5/6] tests: Move test/{xi1,xi2}/tests to test/

2017-01-04 Thread Mihail Konev
Part of refactoring the tests into a single binary,
to make partial rebuild slightly faster and less verbose.

Prevents 'make -j' from waiting until last job in xi*/ compeletes.

Signed-off-by: Mihail Konev 
---
 configure.ac |  2 --
 test/Makefile.am | 63 +---
 test/tests.c | 16 +
 test/xi1/.gitignore  |  1 -
 test/xi1/Makefile.am | 44 
 test/xi1/tests.c | 11 -
 test/xi2/.gitignore  |  1 -
 test/xi2/Makefile.am | 56 --
 test/xi2/tests.c | 21 --
 9 files changed, 76 insertions(+), 139 deletions(-)
 delete mode 100644 test/xi1/.gitignore
 delete mode 100644 test/xi1/Makefile.am
 delete mode 100644 test/xi1/tests.c
 delete mode 100644 test/xi2/.gitignore
 delete mode 100644 test/xi2/Makefile.am
 delete mode 100644 test/xi2/tests.c

diff --git a/configure.ac b/configure.ac
index 93c81a644052..d265528ea124 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2679,8 +2679,6 @@ hw/kdrive/linux/Makefile
 hw/kdrive/src/Makefile
 hw/xwayland/Makefile
 test/Makefile
-test/xi1/Makefile
-test/xi2/Makefile
 xserver.ent
 xorg-server.pc
 ])
diff --git a/test/Makefile.am b/test/Makefile.am
index 8fdf08c3db96..6178a2fb0166 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -3,10 +3,12 @@ SUBDIRS= .
 AM_CFLAGS = $(DIX_CFLAGS) @XORG_CFLAGS@
 AM_CPPFLAGS = $(XORG_INCS)
 
+tests_CPPFLAGS=
+CLEANFILES=
+
 if XORG
 # Tests that require at least some DDX functions in order to fully link
 # For now, requires xf86 ddx, could be adjusted to use another
-SUBDIRS += xi1 xi2
 if RES
 RES_SRCS = hashtabletest.c
 AM_CPPFLAGS += -DRES_TESTS
@@ -41,12 +43,26 @@ TESTS_ENVIRONMENT = \
$(NULL)
 
 if XORG
-AM_CPPFLAGS += -I$(top_srcdir)/hw/xfree86/parser \
+AM_CPPFLAGS += \
+   -I$(srcdir)/xi1 \
+   -I$(srcdir)/xi2 \
+   -I$(top_srcdir)/hw/xfree86/parser \
-I$(top_srcdir)/hw/xfree86/ddc \
-I$(top_srcdir)/hw/xfree86/i2c -I$(top_srcdir)/hw/xfree86/modes \
-I$(top_srcdir)/hw/xfree86/ramdac -I$(top_srcdir)/hw/xfree86/dri \
-I$(top_srcdir)/hw/xfree86/dri2 -I$(top_srcdir)/dri3
 endif
+
+tests_LDFLAGS = \
+   -Wl,-wrap,dixLookupWindow \
+   -Wl,-wrap,dixLookupClient \
+   -Wl,-wrap,WriteToClient \
+   -Wl,-wrap,dixLookupWindow \
+   -Wl,-wrap,XISetEventMask \
+   -Wl,-wrap,AddResource \
+   -Wl,-wrap,GrabButton \
+   $()
+
 tests_LDADD = libxservertest.la $(XORG_SYS_LIBS) $(XSERVER_SYS_LIBS) 
$(GLX_SYS_LIBS)
 
 if SPECIAL_DTRACE_OBJECTS
@@ -68,6 +84,47 @@ tests_SOURCES = \
 $(RES_SRCS) \
 tests.c
 
+if HAVE_LD_WRAP
+
+tests_CPPFLAGS += -DLDWRAP_TESTS
+
+tests_SOURCES += \
+   xi1/protocol-xchangedevicecontrol.c \
+   xi2/protocol-common.c \
+   xi2/protocol-xiqueryversion.c \
+   xi2/protocol-xiquerydevice.c \
+   xi2/protocol-xiselectevents.c \
+   xi2/protocol-xigetselectedevents.c \
+   xi2/protocol-xisetclientpointer.c \
+   xi2/protocol-xigetclientpointer.c \
+   xi2/protocol-xiquerypointer.c \
+   xi2/protocol-xipassivegrabdevice.c \
+   xi2/protocol-xiwarppointer.c \
+   xi2/protocol-eventconvert.c \
+   xi2/xi2.c
+
+else !HAVE_LD_WRAP
+
+# Print that xi1-tests were skipped (exit code 77 for automake test harness)
+TESTS += xi1-tests
+CLEANFILES += xi1-tests
+
+xi1-tests:
+   @echo 'echo "ld -wrap support required for xi1 unit tests, skipping"' > 
$@
+   @echo 'exit 77' >> $@
+   $(AM_V_GEN)chmod +x $@
+
+# Print that xi2-tests were skipped (exit code 77 for automake test harness)
+TESTS += xi2-tests
+CLEANFILES += xi2-tests
+
+xi2-tests:
+   @echo 'echo "ld -wrap support required for xi2 unit tests, skipping"' > 
$@
+   @echo 'exit 77' >> $@
+   $(AM_V_GEN)chmod +x $@
+
+endif !HAVE_LD_WRAP
+
 libxservertest_la_LIBADD = $(XSERVER_LIBS)
 if XORG
 
@@ -87,7 +144,7 @@ libxservertest_la_LIBADD += \
 @XORG_LIBS@
 
 BUILT_SOURCES = sdksyms.c
-CLEANFILES = sdksyms.c
+CLEANFILES += sdksyms.c
 
 sdksyms.c: $(top_builddir)/hw/xfree86/sdksyms.c
$(AM_V_GEN)$(LN_S) $(top_builddir)/hw/xfree86/sdksyms.c
diff --git a/test/tests.c b/test/tests.c
index cf72acafb65b..add51bd4834d 100644
--- a/test/tests.c
+++ b/test/tests.c
@@ -21,5 +21,21 @@ main(int argc, char **argv)
 run_test(xkb_test);
 run_test(xtest_test);
 
+#ifdef LDWRAP_TESTS
+run_test(protocol_xchangedevicecontrol_test);
+
+run_test(protocol_xiqueryversion_test);
+run_test(protocol_xiquerydevice_test);
+run_test(protocol_xiselectevents_test);
+run_test(protocol_xigetselectedevents_test);
+run_test(protocol_xisetclientpointer_test);
+run_test(protocol_xigetclientpointer_test);
+run_test(protocol_xipassivegrabdevice_test);
+run_test(protocol_xiquerypointer_test);
+run_test(protocol_xiwarppointer_test);
+run_test(protocol_eventconvert_test);
+

[PATCH v3 xserver 6/6] tests: Remove obsolete libxservertest.la

2017-01-04 Thread Mihail Konev
Part of refactoring the tests into a single binary,
to make partial rebuilt slightly faster and less verbose.

Prevents 'make -j' from not linking test/tests until it links
test/libxserver.la

In makefile, remove OS_LIB and DIX_LIB to avoid double-inclusion.
Also move the libxorgos.la to satisfy libcommon.la.

Signed-off-by: Mihail Konev 
---
 test/Makefile.am | 51 +--
 1 file changed, 25 insertions(+), 26 deletions(-)

diff --git a/test/Makefile.am b/test/Makefile.am
index 6178a2fb0166..70e33eaa7bd7 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -14,7 +14,6 @@ RES_SRCS = hashtabletest.c
 AM_CPPFLAGS += -DRES_TESTS
 endif
 endif
-check_LTLIBRARIES = libxservertest.la
 
 noinst_PROGRAMS = simple-xinit tests
 
@@ -63,11 +62,7 @@ tests_LDFLAGS = \
-Wl,-wrap,GrabButton \
$()
 
-tests_LDADD = libxservertest.la $(XORG_SYS_LIBS) $(XSERVER_SYS_LIBS) 
$(GLX_SYS_LIBS)
-
-if SPECIAL_DTRACE_OBJECTS
-tests_LDADD += $(OS_LIB) $(DIX_LIB)
-endif
+tests_LDADD = $(XORG_SYS_LIBS) $(XSERVER_SYS_LIBS) $(GLX_SYS_LIBS)
 
 tests_SOURCES = \
 tests-common.c \
@@ -125,14 +120,16 @@ xi2-tests:
 
 endif !HAVE_LD_WRAP
 
-libxservertest_la_LIBADD = $(XSERVER_LIBS)
+tests_LDADD += $(XSERVER_LIBS)
+
 if XORG
 
-nodist_libxservertest_la_SOURCES = sdksyms.c
-libxservertest_la_LIBADD += \
+nodist_tests_SOURCES = sdksyms.c
+
+tests_LDADD += \
 $(top_builddir)/hw/xfree86/loader/libloader.la \
-$(top_builddir)/hw/xfree86/os-support/libxorgos.la \
 $(top_builddir)/hw/xfree86/common/libcommon.la \
+$(top_builddir)/hw/xfree86/os-support/libxorgos.la \
 $(top_builddir)/hw/xfree86/parser/libxf86config.la \
 $(top_builddir)/hw/xfree86/dixmods/libdixmods.la \
 $(top_builddir)/hw/xfree86/modes/libxf86modes.la \
@@ -150,23 +147,24 @@ sdksyms.c: $(top_builddir)/hw/xfree86/sdksyms.c
$(AM_V_GEN)$(LN_S) $(top_builddir)/hw/xfree86/sdksyms.c
 
 if DRI
-libxservertest_la_LIBADD += $(top_builddir)/hw/xfree86/dri/libdri.la
+tests_LDADD += $(top_builddir)/hw/xfree86/dri/libdri.la
 endif
 
 if DRI2
-libxservertest_la_LIBADD += $(top_builddir)/hw/xfree86/dri2/libdri2.la
+tests_LDADD += $(top_builddir)/hw/xfree86/dri2/libdri2.la
 endif
 
 if DRI3
-libxservertest_la_LIBADD += $(top_builddir)/dri3/libdri3.la
+tests_LDADD += $(top_builddir)/dri3/libdri3.la
 endif
 
-else
-nodist_libxservertest_la_SOURCES = \
+else !XORG
+
+nodist_tests_SOURCES = \
 ddxstubs.c \
 $(top_srcdir)/mi/miinitext.c
 
-libxservertest_la_LIBADD += \
+tests_LDADD += \
 $(top_builddir)/damageext/libdamageext.la \
 $(top_builddir)/fb/libfb.la \
 $(top_builddir)/fb/libwfb.la \
@@ -184,44 +182,45 @@ libxservertest_la_LIBADD += \
 $(top_builddir)/xkb/libxkbstubs.la
 
 if COMPOSITE
-libxservertest_la_LIBADD += \
+tests_LDADD += \
 $(top_builddir)/composite/libcomposite.la
 endif
 
 if DBE
-libxservertest_la_LIBADD += \
+tests_LDADD += \
 $(top_builddir)/dbe/libdbe.la
 endif
 
 if GLX
-libxservertest_la_LIBADD += \
+tests_LDADD += \
 $(top_builddir)/glx/libglx.la
 endif
 
 if RECORD
-libxservertest_la_LIBADD += \
+tests_LDADD += \
 $(top_builddir)/record/librecord.la
 endif
 
 if DRI3
-libxservertest_la_LIBADD += \
+tests_LDADD += \
 $(top_builddir)/dri3/libdri3.la
 endif
 
 if XQUARTZ
-libxservertest_la_LIBADD += \
+tests_LDADD += \
 $(top_builddir)/miext/rootless/librootless.la
 tests_LDADD += -lXplugin
 endif
 
 if XWIN_MULTIWINDOWEXTWM
-libxservertest_la_LIBADD += \
+tests_LDADD += \
 $(top_builddir)/miext/rootless/librootless.la
 endif
-endif
 
-libxservertest_la_DEPENDENCIES = $(libxservertest_la_LIBADD)
-endif
+endif !XORG
+
+tests_DEPENDENCIES = $(tests_LDADD)
+endif ENABLE_UNIT_TESTS
 
 EXTRA_DIST = \
scripts/xvfb-piglit.sh \
-- 
2.9.2

___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel

[PATCH v3 xserver 1/6] tests: Refactor wraps into protocol-common.c

2017-01-04 Thread Mihail Konev
Part of refactoring the tests into a single binary,
to make partial rebuild slightly faster and less verbose.

Prepares for joining test/xi2/protocol-* into a single binary.

Signed-off-by: Mihail Konev 
---
 test/xi1/Makefile.am |  3 ++-
 test/xi1/protocol-xchangedevicecontrol.c |  1 +
 test/xi2/Makefile.am | 22 ++-
 test/xi2/protocol-common.c   | 37 
 test/xi2/protocol-eventconvert.c |  2 ++
 test/xi2/protocol-xigetclientpointer.c   | 17 +--
 test/xi2/protocol-xigetselectedevents.c  | 20 +
 test/xi2/protocol-xipassivegrabdevice.c  | 16 +-
 test/xi2/protocol-xiquerydevice.c|  2 ++
 test/xi2/protocol-xiquerypointer.c   | 21 +-
 test/xi2/protocol-xiqueryversion.c   |  2 ++
 test/xi2/protocol-xiselectevents.c   | 22 ++-
 test/xi2/protocol-xisetclientpointer.c   | 17 +--
 test/xi2/protocol-xiwarppointer.c| 20 +
 test/xi2/xi2.c   |  4 
 15 files changed, 70 insertions(+), 136 deletions(-)

diff --git a/test/xi1/Makefile.am b/test/xi1/Makefile.am
index 907fa7aea5f3..813241c0aeed 100644
--- a/test/xi1/Makefile.am
+++ b/test/xi1/Makefile.am
@@ -10,6 +10,7 @@ AM_CFLAGS = $(DIX_CFLAGS) @XORG_CFLAGS@
 AM_CPPFLAGS = @XORG_INCS@ -I$(srcdir)/../xi2
 TEST_LDADD=../libxservertest.la $(XORG_SYS_LIBS) $(XSERVER_SYS_LIBS) 
$(GLX_SYS_LIBS)
 COMMON_SOURCES=$(srcdir)/../xi2/protocol-common.c
+COMMON_LDFLAGS= -Wl,-wrap,dixLookupWindow -Wl,-wrap,dixLookupClient
 
 if SPECIAL_DTRACE_OBJECTS
 TEST_LDADD += $(OS_LIB) $(DIX_LIB)
@@ -17,7 +18,7 @@ endif
 
 protocol_xchangedevicecontrol_LDADD=$(TEST_LDADD)
 
-protocol_xchangedevicecontrol_LDFLAGS=$(AM_LDFLAGS) -Wl,-wrap,WriteToClient
+protocol_xchangedevicecontrol_LDFLAGS=$(COMMON_LDFLAGS) -Wl,-wrap,WriteToClient
 
 protocol_xchangedevicecontrol_SOURCES=$(COMMON_SOURCES) 
protocol-xchangedevicecontrol.c
 
diff --git a/test/xi1/protocol-xchangedevicecontrol.c 
b/test/xi1/protocol-xchangedevicecontrol.c
index 8e638b218f72..64d2ca29bb95 100644
--- a/test/xi1/protocol-xchangedevicecontrol.c
+++ b/test/xi1/protocol-xchangedevicecontrol.c
@@ -37,6 +37,7 @@
 
 #include "protocol-common.h"
 
+ClientRec client_window;
 static ClientRec client_request;
 
 static void
diff --git a/test/xi2/Makefile.am b/test/xi2/Makefile.am
index bfddfef133fd..6b9679872b48 100644
--- a/test/xi2/Makefile.am
+++ b/test/xi2/Makefile.am
@@ -20,6 +20,7 @@ AM_CFLAGS = $(DIX_CFLAGS) @XORG_CFLAGS@
 AM_CPPFLAGS = @XORG_INCS@
 TEST_LDADD=../libxservertest.la $(XORG_SYS_LIBS) $(XSERVER_SYS_LIBS) 
$(GLX_SYS_LIBS)
 COMMON_SOURCES=protocol-common.h protocol-common.c
+COMMON_LDFLAGS= -Wl,-wrap,dixLookupWindow -Wl,-wrap,dixLookupClient
 
 if SPECIAL_DTRACE_OBJECTS
 TEST_LDADD += $(OS_LIB) $(DIX_LIB)
@@ -37,16 +38,16 @@ protocol_xiwarppointer_LDADD=$(TEST_LDADD)
 protocol_eventconvert_LDADD=$(TEST_LDADD)
 xi2_LDADD=$(TEST_LDADD)
 
-protocol_xiqueryversion_LDFLAGS=$(AM_LDFLAGS) -Wl,-wrap,WriteToClient
-protocol_xiquerydevice_LDFLAGS=$(AM_LDFLAGS) -Wl,-wrap,WriteToClient
-protocol_xiselectevents_LDFLAGS=$(AM_LDFLAGS) -Wl,-wrap,dixLookupWindow 
-Wl,-wrap,XISetEventMask
-protocol_xigetselectedevents_LDFLAGS=$(AM_LDFLAGS) -Wl,-wrap,WriteToClient 
-Wl,-wrap,dixLookupWindow -Wl,-wrap,AddResource
-protocol_xisetclientpointer_LDFLAGS=$(AM_LDFLAGS) -Wl,-wrap,dixLookupClient
-protocol_xigetclientpointer_LDFLAGS=$(AM_LDFLAGS) -Wl,-wrap,WriteToClient 
-Wl,-wrap,dixLookupClient
-protocol_xipassivegrabdevice_LDFLAGS=$(AM_LDFLAGS) -Wl,-wrap,GrabButton 
-Wl,-wrap,dixLookupWindow -Wl,-wrap,WriteToClient
-protocol_xiquerypointer_LDFLAGS=$(AM_LDFLAGS) -Wl,-wrap,WriteToClient 
-Wl,-wrap,dixLookupWindow
-protocol_xiwarppointer_LDFLAGS=$(AM_LDFLAGS) -Wl,-wrap,WriteToClient 
-Wl,-wrap,dixLookupWindow
-xi2_LDFLAGS=$(AM_LDFLAGS)
+protocol_xiqueryversion_LDFLAGS=$(COMMON_LDFLAGS) -Wl,-wrap,WriteToClient
+protocol_xiquerydevice_LDFLAGS=$(COMMON_LDFLAGS) -Wl,-wrap,WriteToClient
+protocol_xiselectevents_LDFLAGS=$(COMMON_LDFLAGS) -Wl,-wrap,XISetEventMask
+protocol_xigetselectedevents_LDFLAGS=$(COMMON_LDFLAGS) -Wl,-wrap,WriteToClient 
-Wl,-wrap,AddResource
+protocol_xisetclientpointer_LDFLAGS=$(COMMON_LDFLAGS) -Wl,-wrap,dixLookupClient
+protocol_xigetclientpointer_LDFLAGS=$(COMMON_LDFLAGS) -Wl,-wrap,WriteToClient 
-Wl,-wrap,dixLookupClient
+protocol_xipassivegrabdevice_LDFLAGS=$(COMMON_LDFLAGS) -Wl,-wrap,WriteToClient 
-Wl,-wrap,GrabButton
+protocol_xiquerypointer_LDFLAGS=$(COMMON_LDFLAGS) -Wl,-wrap,WriteToClient
+protocol_xiwarppointer_LDFLAGS=$(COMMON_LDFLAGS) -Wl,-wrap,WriteToClient
+xi2_LDFLAGS=$(COMMON_LDFLAGS)
 
 protocol_xiqueryversion_SOURCES=$(COMMON_SOURCES) protocol-xiqueryversion.c
 protocol_xiquerydevice_SOURCES=$(COMMON_SOURCES) protocol-xiquerydevice.c
@@ -57,6 +58,7 @@ protocol_xigetclientpointer_SOURCES=$(COMMON_SOURCES) 
protocol-xigetclientpointe
 

[PATCH v3 xserver 3/6] tests: Convert test/xi2/ to single binary

2017-01-04 Thread Mihail Konev
Part of refactoring the tests into a single binary,
to make partial rebuild slightly faster and less verbose.

Signed-off-by: Mihail Konev 
---
 test/tests.h| 19 
 test/xi2/.gitignore | 12 +
 test/xi2/Makefile.am| 83 +
 test/xi2/protocol-common.c  |  4 ++
 test/xi2/protocol-eventconvert.c|  2 +-
 test/xi2/protocol-xigetclientpointer.c  |  2 +-
 test/xi2/protocol-xigetselectedevents.c |  4 +-
 test/xi2/protocol-xipassivegrabdevice.c |  9 +++-
 test/xi2/protocol-xiquerydevice.c   |  2 +-
 test/xi2/protocol-xiquerypointer.c  |  2 +-
 test/xi2/protocol-xiqueryversion.c  |  2 +-
 test/xi2/protocol-xiselectevents.c  |  9 +++-
 test/xi2/protocol-xisetclientpointer.c  |  2 +-
 test/xi2/protocol-xiwarppointer.c   |  2 +-
 test/xi2/tests.c| 21 +
 test/xi2/xi2.c  |  2 +-
 16 files changed, 104 insertions(+), 73 deletions(-)
 create mode 100644 test/xi2/tests.c

diff --git a/test/tests.h b/test/tests.h
index 8a42aa0da592..0b673ee7ae79 100644
--- a/test/tests.h
+++ b/test/tests.h
@@ -3,5 +3,24 @@
 
 int protocol_xchangedevicecontrol_test(void);
 
+int protocol_xiqueryversion_test(void);
+int protocol_xiquerydevice_test(void);
+int protocol_xiselectevents_test(void);
+int protocol_xigetselectedevents_test(void);
+int protocol_xisetclientpointer_test(void);
+int protocol_xigetclientpointer_test(void);
+int protocol_xipassivegrabdevice_test(void);
+int protocol_xiquerypointer_test(void);
+int protocol_xiwarppointer_test(void);
+int protocol_eventconvert_test(void);
+int xi2_test(void);
+
+#ifndef INSIDE_PROTOCOL_COMMON
+
+extern int enable_XISetEventMask_wrap;
+extern int enable_GrabButton_wrap;
+
+#endif /* INSIDE_PROTOCOL_COMMON */
+
 #endif /* TESTS_H */
 
diff --git a/test/xi2/.gitignore b/test/xi2/.gitignore
index 817aa7b6b83b..2b29f27645f8 100644
--- a/test/xi2/.gitignore
+++ b/test/xi2/.gitignore
@@ -1,11 +1 @@
-protocol-eventconvert
-protocol-xigetclientpointer
-protocol-xigetselectedevents
-protocol-xipassivegrabdevice
-protocol-xiquerydevice
-protocol-xiquerypointer
-protocol-xiqueryversion
-protocol-xiselectevents
-protocol-xisetclientpointer
-protocol-xiwarppointer
-xi2
+tests
diff --git a/test/xi2/Makefile.am b/test/xi2/Makefile.am
index 46768fb29ad4..a7f9831a93cd 100644
--- a/test/xi2/Makefile.am
+++ b/test/xi2/Makefile.am
@@ -1,67 +1,48 @@
 if ENABLE_UNIT_TESTS
 if HAVE_LD_WRAP
-noinst_PROGRAMS =  \
-   protocol-xiqueryversion \
-   protocol-xiquerydevice \
-   protocol-xiselectevents \
-   protocol-xigetselectedevents \
-protocol-xisetclientpointer \
-protocol-xigetclientpointer \
-protocol-xipassivegrabdevice \
-protocol-xiquerypointer \
-protocol-xiwarppointer \
-protocol-eventconvert \
-xi2
+noinst_PROGRAMS = tests
+
+TESTS = tests
 
-TESTS=$(noinst_PROGRAMS)
 TESTS_ENVIRONMENT = $(XORG_MALLOC_DEBUG_ENV)
 
-AM_CFLAGS = $(DIX_CFLAGS) @XORG_CFLAGS@
-AM_CPPFLAGS = \
+tests_CFLAGS = $(DIX_CFLAGS) @XORG_CFLAGS@
+
+tests_CPPFLAGS = \
@XORG_INCS@ \
-I$(srcdir)/..
 
-TEST_LDADD=../libxservertest.la $(XORG_SYS_LIBS) $(XSERVER_SYS_LIBS) 
$(GLX_SYS_LIBS)
-COMMON_SOURCES=protocol-common.h protocol-common.c
-COMMON_LDFLAGS= -Wl,-wrap,dixLookupWindow -Wl,-wrap,dixLookupClient
+tests_LDADD = ../libxservertest.la $(XORG_SYS_LIBS) $(XSERVER_SYS_LIBS) 
$(GLX_SYS_LIBS)
 
 if SPECIAL_DTRACE_OBJECTS
-TEST_LDADD += $(OS_LIB) $(DIX_LIB)
+tests_LDADD += $(OS_LIB) $(DIX_LIB)
 endif
 
-protocol_xiqueryversion_LDADD=$(TEST_LDADD)
-protocol_xiquerydevice_LDADD=$(TEST_LDADD)
-protocol_xiselectevents_LDADD=$(TEST_LDADD)
-protocol_xigetselectedevents_LDADD=$(TEST_LDADD)
-protocol_xisetclientpointer_LDADD=$(TEST_LDADD)
-protocol_xigetclientpointer_LDADD=$(TEST_LDADD)
-protocol_xiquerypointer_LDADD=$(TEST_LDADD)
-protocol_xipassivegrabdevice_LDADD=$(TEST_LDADD)
-protocol_xiwarppointer_LDADD=$(TEST_LDADD)
-protocol_eventconvert_LDADD=$(TEST_LDADD)
-xi2_LDADD=$(TEST_LDADD)
-
-protocol_xiqueryversion_LDFLAGS=$(COMMON_LDFLAGS) -Wl,-wrap,WriteToClient
-protocol_xiquerydevice_LDFLAGS=$(COMMON_LDFLAGS) -Wl,-wrap,WriteToClient
-protocol_xiselectevents_LDFLAGS=$(COMMON_LDFLAGS) -Wl,-wrap,XISetEventMask
-protocol_xigetselectedevents_LDFLAGS=$(COMMON_LDFLAGS) -Wl,-wrap,WriteToClient 
-Wl,-wrap,AddResource
-protocol_xisetclientpointer_LDFLAGS=$(COMMON_LDFLAGS) -Wl,-wrap,dixLookupClient
-protocol_xigetclientpointer_LDFLAGS=$(COMMON_LDFLAGS) -Wl,-wrap,WriteToClient 
-Wl,-wrap,dixLookupClient
-protocol_xipassivegrabdevice_LDFLAGS=$(COMMON_LDFLAGS) -Wl,-wrap,WriteToClient 
-Wl,-wrap,GrabButton
-protocol_xiquerypointer_LDFLAGS=$(COMMON_LDFLAGS) -Wl,-wrap,WriteToClient
-protocol_xiwarppointer_LDFLAGS=$(COMMON_LDFLAGS) -Wl,-wrap,WriteToClient
-xi2_LDFLAGS=$(COMMON_LDFLAGS)
+tests_LDFLAGS = \
+-Wl,-wrap,WriteToClient \
+

[PATCH v3 xserver 4/6] tests: Convert test/ to single binary

2017-01-04 Thread Mihail Konev
Part of refactoring the tests into a single binary,
to make partial rebuild slightly faster and less verbose.

Signed-off-by: Mihail Konev 
---
 test/.gitignore   | 12 +---
 test/Makefile.am  | 51 ++-
 test/fixes.c  |  4 +++-
 test/hashtabletest.c  |  4 +++-
 test/input.c  |  4 +++-
 test/list.c   |  4 +++-
 test/misc.c   |  4 +++-
 test/signal-logging.c |  4 +++-
 test/string.c |  3 ++-
 test/tests-common.h   |  2 ++
 test/tests.c  | 25 +
 test/tests.h  | 12 
 test/touch.c  |  6 +-
 test/xfree86.c|  4 +++-
 test/xkb.c|  4 +++-
 test/xtest.c  |  4 +++-
 16 files changed, 100 insertions(+), 47 deletions(-)
 create mode 100644 test/tests.c

diff --git a/test/.gitignore b/test/.gitignore
index 47f766c5f620..5fd66e3f4ec7 100644
--- a/test/.gitignore
+++ b/test/.gitignore
@@ -1,16 +1,6 @@
-fixes
-hashtabletest
-input
-list
-misc
+tests
 os
 sdksyms.c
-string
-touch
-xfree86
-xkb
-xtest
-signal-logging
 piglit-results
 simple-xinit
 *.log
diff --git a/test/Makefile.am b/test/Makefile.am
index 064e1c5b736f..8fdf08c3db96 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -1,21 +1,20 @@
 if ENABLE_UNIT_TESTS
 SUBDIRS= .
-TEST_PROGS = list string
+AM_CFLAGS = $(DIX_CFLAGS) @XORG_CFLAGS@
+AM_CPPFLAGS = $(XORG_INCS)
+
 if XORG
 # Tests that require at least some DDX functions in order to fully link
 # For now, requires xf86 ddx, could be adjusted to use another
 SUBDIRS += xi1 xi2
-TEST_PROGS += xkb input xtest misc fixes xfree86 signal-logging touch
 if RES
-TEST_PROGS += hashtabletest
+RES_SRCS = hashtabletest.c
+AM_CPPFLAGS += -DRES_TESTS
 endif
 endif
 check_LTLIBRARIES = libxservertest.la
 
-noinst_PROGRAMS = \
-   simple-xinit \
-   $(TEST_PROGS) \
-   $(NULL)
+noinst_PROGRAMS = simple-xinit tests
 
 if XVFB
 XVFB_TESTS = scripts/xvfb-piglit.sh
@@ -31,8 +30,7 @@ SCRIPT_TESTS = \
$(XEPHYR_GLAMOR_TESTS) \
$(NULL)
 
-TESTS = \
-   $(TEST_PROGS) \
+TESTS = tests \
$(SCRIPT_TESTS) \
$(NULL)
 
@@ -42,8 +40,6 @@ TESTS_ENVIRONMENT = \
$(XORG_MALLOC_DEBUG_ENV) \
$(NULL)
 
-AM_CFLAGS = $(DIX_CFLAGS) @XORG_CFLAGS@
-AM_CPPFLAGS = $(XORG_INCS)
 if XORG
 AM_CPPFLAGS += -I$(top_srcdir)/hw/xfree86/parser \
-I$(top_srcdir)/hw/xfree86/ddc \
@@ -51,21 +47,26 @@ AM_CPPFLAGS += -I$(top_srcdir)/hw/xfree86/parser \
-I$(top_srcdir)/hw/xfree86/ramdac -I$(top_srcdir)/hw/xfree86/dri \
-I$(top_srcdir)/hw/xfree86/dri2 -I$(top_srcdir)/dri3
 endif
-TEST_LDADD=libxservertest.la $(XORG_SYS_LIBS) $(XSERVER_SYS_LIBS) 
$(GLX_SYS_LIBS)
+tests_LDADD = libxservertest.la $(XORG_SYS_LIBS) $(XSERVER_SYS_LIBS) 
$(GLX_SYS_LIBS)
 
 if SPECIAL_DTRACE_OBJECTS
-TEST_LDADD += $(OS_LIB) $(DIX_LIB)
-endif
-
-xkb_LDADD=$(TEST_LDADD)
-input_LDADD=$(TEST_LDADD)
-xtest_LDADD=$(TEST_LDADD)
-misc_LDADD=$(TEST_LDADD)
-fixes_LDADD=$(TEST_LDADD)
-xfree86_LDADD=$(TEST_LDADD)
-touch_LDADD=$(TEST_LDADD)
-signal_logging_LDADD=$(TEST_LDADD)
-hashtabletest_LDADD=$(TEST_LDADD)
+tests_LDADD += $(OS_LIB) $(DIX_LIB)
+endif
+
+tests_SOURCES = \
+tests-common.c \
+fixes.c \
+input.c \
+list.c \
+misc.c \
+signal-logging.c \
+string.c \
+touch.c \
+xfree86.c \
+xkb.c \
+xtest.c \
+$(RES_SRCS) \
+tests.c
 
 libxservertest_la_LIBADD = $(XSERVER_LIBS)
 if XORG
@@ -153,7 +154,7 @@ endif
 if XQUARTZ
 libxservertest_la_LIBADD += \
 $(top_builddir)/miext/rootless/librootless.la
-TEST_LDADD += -lXplugin
+tests_LDADD += -lXplugin
 endif
 
 if XWIN_MULTIWINDOWEXTWM
diff --git a/test/fixes.c b/test/fixes.c
index 4ac6750e4179..573d948dc0e0 100644
--- a/test/fixes.c
+++ b/test/fixes.c
@@ -31,6 +31,8 @@
 #include 
 #include 
 
+#include "tests-common.h"
+
 static void
 _fixes_test_direction(struct PointerBarrier *barrier, int d[4], int permitted)
 {
@@ -343,7 +345,7 @@ fixes_pointer_barrier_clamp_test(void)
 }
 
 int
-main(int argc, char **argv)
+fixes_test(void)
 {
 
 fixes_pointer_barriers_test();
diff --git a/test/hashtabletest.c b/test/hashtabletest.c
index 86a0c58c6bb0..0387587cb5d1 100644
--- a/test/hashtabletest.c
+++ b/test/hashtabletest.c
@@ -8,6 +8,8 @@
 #include "hashtable.h"
 #include "resource.h"
 
+#include "tests-common.h"
+
 static void
 print_xid(void* ptr, void* v)
 {
@@ -154,7 +156,7 @@ test3(void)
 }
 
 int
-main(void)
+hashtabletest_test(void)
 {
 int ok = test1();
 ok = ok && test2();
diff --git a/test/input.c b/test/input.c
index 91ee43c46ad9..4cd39bb48073 100644
--- a/test/input.c
+++ b/test/input.c
@@ -43,6 +43,8 @@
 #include "mi.h"
 #include "assert.h"
 
+#include "tests-common.h"
+
 /**
  * Init a device with axes.
  * Verify values set on the device.
@@ -1904,7 +1906,7 @@ dix_enqueue_events(void)
 }
 
 int
-main(int argc, char **argv)

[PATCH v3 xserver 0/6] tests: Use single binary

2017-01-04 Thread Mihail Konev
v3: fix build of v2-2 (and maybe v2 too)

Mihail Konev (6):
  tests: Refactor wraps into protocol-common.c
  tests: Convert test/xi1/ to single binary
  tests: Convert test/xi2/ to single binary
  tests: Convert test/ to single binary
  tests: Move test/{xi1,xi2}/tests to test/
  tests: Remove obsolete libxservertest.la

 configure.ac |   2 -
 test/.gitignore  |  12 +--
 test/Makefile.am | 157 +--
 test/fixes.c |   4 +-
 test/hashtabletest.c |   4 +-
 test/input.c |   4 +-
 test/list.c  |   4 +-
 test/misc.c  |   4 +-
 test/signal-logging.c|   4 +-
 test/string.c|   3 +-
 test/tests-common.c  |  33 +++
 test/tests-common.h  |  11 +++
 test/tests.c |  41 
 test/tests.h |  38 
 test/touch.c |   6 +-
 test/xfree86.c   |   4 +-
 test/xi1/.gitignore  |   1 -
 test/xi1/Makefile.am |  34 ---
 test/xi1/protocol-xchangedevicecontrol.c |   3 +-
 test/xi2/.gitignore  |  11 ---
 test/xi2/Makefile.am |  70 --
 test/xi2/protocol-common.c   |  41 
 test/xi2/protocol-common.h   |   2 +
 test/xi2/protocol-eventconvert.c |   4 +-
 test/xi2/protocol-xigetclientpointer.c   |  19 +---
 test/xi2/protocol-xigetselectedevents.c  |  24 +
 test/xi2/protocol-xipassivegrabdevice.c  |  25 ++---
 test/xi2/protocol-xiquerydevice.c|   4 +-
 test/xi2/protocol-xiquerypointer.c   |  23 +
 test/xi2/protocol-xiqueryversion.c   |   4 +-
 test/xi2/protocol-xiselectevents.c   |  31 ++
 test/xi2/protocol-xisetclientpointer.c   |  19 +---
 test/xi2/protocol-xiwarppointer.c|  22 +
 test/xi2/xi2.c   |   6 +-
 test/xkb.c   |   4 +-
 test/xtest.c |   4 +-
 36 files changed, 355 insertions(+), 327 deletions(-)
 create mode 100644 test/tests-common.c
 create mode 100644 test/tests-common.h
 create mode 100644 test/tests.c
 create mode 100644 test/tests.h
 delete mode 100644 test/xi1/.gitignore
 delete mode 100644 test/xi1/Makefile.am
 delete mode 100644 test/xi2/.gitignore
 delete mode 100644 test/xi2/Makefile.am

-- 
2.9.2

___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel

[PATCH v2-2 xserver 3/6] tests: Convert test/ to single binary

2017-01-04 Thread Mihail Konev
Part of refactoring the tests into a single binary,
to make partial rebuild slightly faster and less verbose.

Signed-off-by: Mihail Konev 
---
Fix v2's simple-xinit warning about asprintf declaration
(AM_CFLAGS vs. tests_CFLAGS).

 test/.gitignore   | 12 +---
 test/Makefile.am  | 51 +++
 test/fixes.c  |  4 +++-
 test/hashtabletest.c  |  4 +++-
 test/input.c  |  4 +++-
 test/list.c   |  4 +++-
 test/misc.c   |  4 +++-
 test/signal-logging.c |  4 +++-
 test/string.c |  3 ++-
 test/tests-common.h   |  2 ++
 test/tests.c  | 25 +
 test/tests.h  | 12 
 test/touch.c  |  6 +-
 test/xfree86.c|  4 +++-
 test/xkb.c|  4 +++-
 test/xtest.c  |  4 +++-
 16 files changed, 101 insertions(+), 46 deletions(-)
 create mode 100644 test/tests.c

diff --git a/test/.gitignore b/test/.gitignore
index 47f766c5f620..5fd66e3f4ec7 100644
--- a/test/.gitignore
+++ b/test/.gitignore
@@ -1,16 +1,6 @@
-fixes
-hashtabletest
-input
-list
-misc
+tests
 os
 sdksyms.c
-string
-touch
-xfree86
-xkb
-xtest
-signal-logging
 piglit-results
 simple-xinit
 *.log
diff --git a/test/Makefile.am b/test/Makefile.am
index 064e1c5b736f..4d38a219d0ef 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -1,21 +1,19 @@
 if ENABLE_UNIT_TESTS
 SUBDIRS= .
-TEST_PROGS = list string
+tests_CPPFLAGS=
+
 if XORG
 # Tests that require at least some DDX functions in order to fully link
 # For now, requires xf86 ddx, could be adjusted to use another
 SUBDIRS += xi1 xi2
-TEST_PROGS += xkb input xtest misc fixes xfree86 signal-logging touch
 if RES
-TEST_PROGS += hashtabletest
+RES_SRCS = hashtabletest.c
+tests_CPPFLAGS += -DRES_TESTS
 endif
 endif
 check_LTLIBRARIES = libxservertest.la
 
-noinst_PROGRAMS = \
-   simple-xinit \
-   $(TEST_PROGS) \
-   $(NULL)
+noinst_PROGRAMS = simple-xinit tests
 
 if XVFB
 XVFB_TESTS = scripts/xvfb-piglit.sh
@@ -31,8 +29,7 @@ SCRIPT_TESTS = \
$(XEPHYR_GLAMOR_TESTS) \
$(NULL)
 
-TESTS = \
-   $(TEST_PROGS) \
+TESTS = tests \
$(SCRIPT_TESTS) \
$(NULL)
 
@@ -44,28 +41,34 @@ TESTS_ENVIRONMENT = \
 
 AM_CFLAGS = $(DIX_CFLAGS) @XORG_CFLAGS@
 AM_CPPFLAGS = $(XORG_INCS)
+
 if XORG
-AM_CPPFLAGS += -I$(top_srcdir)/hw/xfree86/parser \
+tests_CPPFLAGS += -I$(top_srcdir)/hw/xfree86/parser \
-I$(top_srcdir)/hw/xfree86/ddc \
-I$(top_srcdir)/hw/xfree86/i2c -I$(top_srcdir)/hw/xfree86/modes \
-I$(top_srcdir)/hw/xfree86/ramdac -I$(top_srcdir)/hw/xfree86/dri \
-I$(top_srcdir)/hw/xfree86/dri2 -I$(top_srcdir)/dri3
 endif
-TEST_LDADD=libxservertest.la $(XORG_SYS_LIBS) $(XSERVER_SYS_LIBS) 
$(GLX_SYS_LIBS)
+tests_LDADD = libxservertest.la $(XORG_SYS_LIBS) $(XSERVER_SYS_LIBS) 
$(GLX_SYS_LIBS)
 
 if SPECIAL_DTRACE_OBJECTS
-TEST_LDADD += $(OS_LIB) $(DIX_LIB)
-endif
-
-xkb_LDADD=$(TEST_LDADD)
-input_LDADD=$(TEST_LDADD)
-xtest_LDADD=$(TEST_LDADD)
-misc_LDADD=$(TEST_LDADD)
-fixes_LDADD=$(TEST_LDADD)
-xfree86_LDADD=$(TEST_LDADD)
-touch_LDADD=$(TEST_LDADD)
-signal_logging_LDADD=$(TEST_LDADD)
-hashtabletest_LDADD=$(TEST_LDADD)
+tests_LDADD += $(OS_LIB) $(DIX_LIB)
+endif
+
+tests_SOURCES = \
+tests-common.c \
+fixes.c \
+input.c \
+list.c \
+misc.c \
+signal-logging.c \
+string.c \
+touch.c \
+xfree86.c \
+xkb.c \
+xtest.c \
+$(RES_SRCS) \
+tests.c
 
 libxservertest_la_LIBADD = $(XSERVER_LIBS)
 if XORG
@@ -153,7 +156,7 @@ endif
 if XQUARTZ
 libxservertest_la_LIBADD += \
 $(top_builddir)/miext/rootless/librootless.la
-TEST_LDADD += -lXplugin
+tests_LDADD += -lXplugin
 endif
 
 if XWIN_MULTIWINDOWEXTWM
diff --git a/test/fixes.c b/test/fixes.c
index 4ac6750e4179..573d948dc0e0 100644
--- a/test/fixes.c
+++ b/test/fixes.c
@@ -31,6 +31,8 @@
 #include 
 #include 
 
+#include "tests-common.h"
+
 static void
 _fixes_test_direction(struct PointerBarrier *barrier, int d[4], int permitted)
 {
@@ -343,7 +345,7 @@ fixes_pointer_barrier_clamp_test(void)
 }
 
 int
-main(int argc, char **argv)
+fixes_test(void)
 {
 
 fixes_pointer_barriers_test();
diff --git a/test/hashtabletest.c b/test/hashtabletest.c
index 86a0c58c6bb0..0387587cb5d1 100644
--- a/test/hashtabletest.c
+++ b/test/hashtabletest.c
@@ -8,6 +8,8 @@
 #include "hashtable.h"
 #include "resource.h"
 
+#include "tests-common.h"
+
 static void
 print_xid(void* ptr, void* v)
 {
@@ -154,7 +156,7 @@ test3(void)
 }
 
 int
-main(void)
+hashtabletest_test(void)
 {
 int ok = test1();
 ok = ok && test2();
diff --git a/test/input.c b/test/input.c
index 91ee43c46ad9..4cd39bb48073 100644
--- a/test/input.c
+++ b/test/input.c
@@ -43,6 +43,8 @@
 #include "mi.h"
 #include "assert.h"
 
+#include "tests-common.h"
+
 /**
  * Init a device with axes.
  * Verify values set on the device.
@@ -1904,7 +1906,7 @@ dix_enqueue_events(void)
 

Re: [RFC] Visual Class for On-Screen HDR Drawables

2017-01-04 Thread Adam Jackson
On Tue, 2017-01-03 at 19:27 -0800, Keith Packard wrote:
> > Adam Jackson  writes:
> > Finally, the rop and planemask parts of the GC really don't make sense
> > for floats. I'd be inclined to define the new visual class such that
> > only GXcopy with planemask ~0 is defined.
> 
> It's either that or define all core rendering in terms of the
> transformed sRGB unorm pixel values? That almost seems worse.

Agreed. Why bother to specify an excruciatingly exact behaviour that
nobody wants or will use.

> And should we define Render to work "right" with these formats?

Either we define the interaction with Render, or automatic redirection
(and backing store) don't work. But again we're painted into a bit of a
corner:

typedef struct {
CARD16  red B16;
CARD16  redMask B16;
CARD16  green B16;
CARD16  greenMask B16;
CARD16  blue B16;
CARD16  blueMask B16;
CARD16  alpha B16;
CARD16  alphaMask B16;
} xDirectFormat;

Since we can't express the real masks we'd again be forced to operate
on HDR-destroying sRGB. We could add an internal format that operated
on the float representation, but we can't expose that to clients
without a protocol bump.

- ajax
___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel

[PATCH fbdev] Fix shadow fb allocation size (v2)

2017-01-04 Thread Adam Jackson
->bitsPerPixel is rather obviously eight times too large.

v2: Use ->displayWidth - the pitch - not ->virtualX (Keith Packard)

Signed-off-by: Adam Jackson 
---
 src/fbdev.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/fbdev.c b/src/fbdev.c
index 2c658fe..4309d76 100644
--- a/src/fbdev.c
+++ b/src/fbdev.c
@@ -827,8 +827,8 @@ FBDevScreenInit(SCREEN_INIT_ARGS_DECL)
fPtr->fbstart = fPtr->fbmem + fPtr->fboff;
 
if (fPtr->shadowFB) {
-   fPtr->shadow = calloc(1, pScrn->virtualX * pScrn->virtualY *
- pScrn->bitsPerPixel);
+   fPtr->shadow = calloc(1, pScrn->displayWidth * pScrn->virtualY *
+ ((pScrn->bitsPerPixel + 7) / 8));
 
if (!fPtr->shadow) {
xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
-- 
2.9.3

___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel