[PATCH] xf86i2c: add pscrn for drivers to use

2012-05-24 Thread Dave Airlie
From: Dave Airlie airl...@redhat.com

This just adds a pScrn pointer into the struct for the drivers to use
instead of scrnIndex. Mostly scrnIndex is used for logging, but some
drivers use it to lookup xf86Screens, so let them stash a pScrn instead.

Removing the scrnIndex is a bit more involved and I'm not sure its worth
the effort. Doing i2c in the X server is legacy code as far as I'm concerned.

Signed-off-by: Dave Airlie airl...@redhat.com
---
 hw/xfree86/i2c/xf86i2c.c |1 +
 hw/xfree86/i2c/xf86i2c.h |2 ++
 2 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/hw/xfree86/i2c/xf86i2c.c b/hw/xfree86/i2c/xf86i2c.c
index 1273f4b..2d261d4 100644
--- a/hw/xfree86/i2c/xf86i2c.c
+++ b/hw/xfree86/i2c/xf86i2c.c
@@ -709,6 +709,7 @@ xf86CreateI2CBusRec(void)
 
 if (b != NULL) {
 b-scrnIndex = -1;
+b-pScrn = NULL;
 b-HoldTime = 5;/* 100 kHz bus */
 b-BitTimeout = 5;
 b-ByteTimeout = 5;
diff --git a/hw/xfree86/i2c/xf86i2c.h b/hw/xfree86/i2c/xf86i2c.h
index 9a8fb21..e296d7d 100644
--- a/hw/xfree86/i2c/xf86i2c.h
+++ b/hw/xfree86/i2c/xf86i2c.h
@@ -6,6 +6,7 @@
 #define _XF86I2C_H
 
 #include regionstr.h
+#include xf86.h
 
 typedef unsigned char I2CByte;
 typedef unsigned short I2CSlaveAddr;
@@ -18,6 +19,7 @@ typedef struct _I2CDevRec *I2CDevPtr;
 typedef struct _I2CBusRec {
 char *BusName;
 int scrnIndex;
+ScrnInfoPtr pScrn;
 
 void (*I2CUDelay) (I2CBusPtr b, int usec);
 
-- 
1.7.6

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


Re: [PATCH] cvt: add -i/--interlaced to documentation

2012-05-24 Thread Alon Levy
On Wed, May 23, 2012 at 04:37:48PM -0700, Alan Coopersmith wrote:
 On 05/20/12 04:54 AM, Alon Levy wrote:
  Signed-off-by: Alon Levy al...@redhat.com
 
 cvt.c currently says:
 
 /*
  * I'm not documenting --interlaced for obvious reasons, even though I did
  * implement it. I also can't deny having looked at gtf here.
  */
 
 Are those reasons no longer valid?  (Sadly they're not obvious to me.)

Missed that, sorry for the noise. I don't know either. Please ignore the
patch.

 
 At the very least a patch to document --interlaced should remove the comment
 claiming it's intentionally undocumented, preferably explain why the change
 in intentions has been made.
 
 -- 
   -Alan Coopersmith-  alan.coopersm...@oracle.com
Oracle Solaris Engineering - http://blogs.oracle.com/alanc
___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel


Re: [PATCH] prevent X crash on pressing multimedia buttons, again

2012-05-24 Thread Michal Suchanek
On 24 May 2012 04:42, Peter Hutterer peter.hutte...@who-t.net wrote:

 what is the trigger for this again? Is this the warp pointer case?


Attaching console output.

Thanks

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


Re: [PATCH] xf86i2c: add pscrn for drivers to use

2012-05-24 Thread Alex Deucher
On Thu, May 24, 2012 at 2:28 AM, Dave Airlie airl...@gmail.com wrote:
 From: Dave Airlie airl...@redhat.com

 This just adds a pScrn pointer into the struct for the drivers to use
 instead of scrnIndex. Mostly scrnIndex is used for logging, but some
 drivers use it to lookup xf86Screens, so let them stash a pScrn instead.

 Removing the scrnIndex is a bit more involved and I'm not sure its worth
 the effort. Doing i2c in the X server is legacy code as far as I'm concerned.

 Signed-off-by: Dave Airlie airl...@redhat.com

Maybe someday we can rip out all this old crap and finally drop
support for 15 year old hw.

Reviewed-by: Alex Deucher alexander.deuc...@amd.com

 ---
  hw/xfree86/i2c/xf86i2c.c |    1 +
  hw/xfree86/i2c/xf86i2c.h |    2 ++
  2 files changed, 3 insertions(+), 0 deletions(-)

 diff --git a/hw/xfree86/i2c/xf86i2c.c b/hw/xfree86/i2c/xf86i2c.c
 index 1273f4b..2d261d4 100644
 --- a/hw/xfree86/i2c/xf86i2c.c
 +++ b/hw/xfree86/i2c/xf86i2c.c
 @@ -709,6 +709,7 @@ xf86CreateI2CBusRec(void)

     if (b != NULL) {
         b-scrnIndex = -1;
 +        b-pScrn = NULL;
         b-HoldTime = 5;        /* 100 kHz bus */
         b-BitTimeout = 5;
         b-ByteTimeout = 5;
 diff --git a/hw/xfree86/i2c/xf86i2c.h b/hw/xfree86/i2c/xf86i2c.h
 index 9a8fb21..e296d7d 100644
 --- a/hw/xfree86/i2c/xf86i2c.h
 +++ b/hw/xfree86/i2c/xf86i2c.h
 @@ -6,6 +6,7 @@
  #define _XF86I2C_H

  #include regionstr.h
 +#include xf86.h

  typedef unsigned char I2CByte;
  typedef unsigned short I2CSlaveAddr;
 @@ -18,6 +19,7 @@ typedef struct _I2CDevRec *I2CDevPtr;
  typedef struct _I2CBusRec {
     char *BusName;
     int scrnIndex;
 +    ScrnInfoPtr pScrn;

     void (*I2CUDelay) (I2CBusPtr b, int usec);

 --
 1.7.6

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


Re: [PATCH xorg-gtest] Update source files to use new headers

2012-05-24 Thread Chase Douglas
On 05/23/2012 08:13 PM, Peter Hutterer wrote:
 introduced in e1c010f23272e61c28c73aa603b477ba6fbae875
 
 Signed-off-by: Peter Hutterer peter.hutte...@who-t.net

I'm guessing I compile checked while I still had the old headers
installed in /usr/include...

 ---
  examples/xorg-gtest-example.cpp |2 +-
  src/device.cpp  |2 +-
  src/environment.cpp |4 ++--
  src/process.cpp |2 +-
  src/test.cpp|2 +-
  src/xorg-gtest_main.cpp |2 +-
  6 files changed, 7 insertions(+), 7 deletions(-)
 
 diff --git a/examples/xorg-gtest-example.cpp b/examples/xorg-gtest-example.cpp
 index 529fdda..1058bac 100644
 --- a/examples/xorg-gtest-example.cpp
 +++ b/examples/xorg-gtest-example.cpp
 @@ -1,4 +1,4 @@
 -#include xorg/gtest/test.h
 +#include xorg/gtest/xorg-gtest_test.h

This should be using the main header file xorg-gtest.h. I'll fix that up.

Reviewed-by: Chase Douglas chase.doug...@canonical.com

And applied.

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


Re: [PATCH 2/2 xorg-gtest] Namespace xorg-gtest header filenames

2012-05-24 Thread Chase Douglas
On 05/23/2012 08:13 PM, Peter Hutterer wrote:
 On Mon, May 21, 2012 at 10:54:08AM -0700, Chase Douglas wrote:
 On 05/20/2012 02:55 PM, Peter Hutterer wrote:
 On Fri, May 18, 2012 at 01:23:32PM -0700, Chase Douglas wrote:
 Due to the default automake compilation flags including -I. -I.., it is
 possible to pick up an xorg-gtest header like device.h instead of a
 project header. Namespacing the headers should resolve this issue. Users
 should be including xorg-gtest.h instead of individual headers, so this
 should not cause compilation failures.

 Signed-off-by: Chase Douglas chase.doug...@canonical.com
 ---
  include/Makefile.am  |8 +-
  include/xorg/gtest/environment.h |  184 
 --
  include/xorg/gtest/evemu/device.h|   91 -
  include/xorg/gtest/evemu/xorg-gtest_device.h |   91 +
  include/xorg/gtest/process.h |  166 
 ---
  include/xorg/gtest/test.h|  104 ---
  include/xorg/gtest/xorg-gtest.h  |8 +-
  include/xorg/gtest/xorg-gtest_environment.h  |  184 
 ++
  include/xorg/gtest/xorg-gtest_process.h  |  166 
 +++
  include/xorg/gtest/xorg-gtest_test.h |  104 +++
  10 files changed, 553 insertions(+), 553 deletions(-)
  delete mode 100644 include/xorg/gtest/environment.h
  delete mode 100644 include/xorg/gtest/evemu/device.h
  create mode 100644 include/xorg/gtest/evemu/xorg-gtest_device.h
  delete mode 100644 include/xorg/gtest/process.h
  delete mode 100644 include/xorg/gtest/test.h
  create mode 100644 include/xorg/gtest/xorg-gtest_environment.h
  create mode 100644 include/xorg/gtest/xorg-gtest_process.h
  create mode 100644 include/xorg/gtest/xorg-gtest_test.h

 tbh i'm not a big fan of a xorg-gtest_test naming. Can't we just use dashes?

 It's a bit too late for xorg-gtest_main.cpp, so I'd prefer to stick the
 the same semantics throughout xorg-gtest. It's not perfect, I probably
 would pick different semantics if I were to do it over again, but these
 header file names are just an implementation detail, so meh.
 
 really too late? how many users are out there?

We've got three in uTouch: utouch-frame, utouch-grail, and utouch-geis.
I don't really want to go through a rename dance for all these projects
for a bike shedding.

 judging from e1c010f23272e61c28c73aa603b477ba6fbae875 the rename was
 incomplete anyway, there are a few source files left that reference the old
 headers still (see the patch I just sent out)

Yeah, whoops :(. Thanks for catching it.

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


fbBlt - memcpy on overlapping ranges

2012-05-24 Thread Michal Srb
Hi,

In fb/fbblt.c in fbBlt function, memcpy is used to blit inside lines:

if (!upsidedown)
 for (i = 0; i  height; i++)
 MEMCPY_WRAPPED(dst + i * dstStride, src + i * srcStride, width);
else
 for (i = height - 1; i = 0; i--)
 MEMCPY_WRAPPED(dst + i * dstStride, src + i * srcStride, width);


Where MEMCPY_WRAPPED is normaly expanded to standard memcpy function.

In case of blitting in horizontal direction of less than width overlapping 
will occur. According to memcpy documentation, result is undefined in such 
case. Shouldn't memmove be used instead?

(This does happen, found using clang's AddressSanitizer - steps I used: run X 
without any client in vmware, then kate and then kwin.)

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


Re: fbBlt - memcpy on overlapping ranges

2012-05-24 Thread Mihai Donțu
On Thu, 24 May 2012 17:20:16 +0200 Michal Srb wrote:
 Hi,
 
 In fb/fbblt.c in fbBlt function, memcpy is used to blit inside lines:
 
 if (!upsidedown)
  for (i = 0; i  height; i++)
  MEMCPY_WRAPPED(dst + i * dstStride, src + i * srcStride,
 width); else
  for (i = height - 1; i = 0; i--)
  MEMCPY_WRAPPED(dst + i * dstStride, src + i * srcStride,
 width);
 
 
 Where MEMCPY_WRAPPED is normaly expanded to standard memcpy function.
 
 In case of blitting in horizontal direction of less than width
 overlapping will occur. According to memcpy documentation, result is
 undefined in such case. Shouldn't memmove be used instead?
 
 (This does happen, found using clang's AddressSanitizer - steps I
 used: run X without any client in vmware, then kate and then kwin.)
 

If an overlap does happen, then one should use memmove(), at least as
far as GNU libc is concerned[1].

[1] http://lwn.net/Articles/414467/

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

RE: [Linaro-mm-sig] New xf86-video-armsoc DDX driver

2012-05-24 Thread Tom Cooksey


 -Original Message-
 From: Daniel Vetter [mailto:daniel.vet...@ffwll.ch] On Behalf Of Daniel
 Vetter
 Sent: 21 May 2012 10:04
 To: Dave Airlie
 Cc: Tom Cooksey; linaro-mm-...@lists.linaro.org; xorg-
 de...@lists.x.org; dri-de...@lists.freedesktop.org
 Subject: Re: [Linaro-mm-sig] New xf86-video-armsoc DDX driver
 
 On Mon, May 21, 2012 at 09:55:06AM +0100, Dave Airlie wrote:
   * Define a new x-server sub-module interface to allow a seperate
.so 2D driver to be loaded (this is the approach the current
OMAP DDX uses).
 
  This seems the sanest.
 
 Or go the intel glamour route and stitch together a somewhat generic 2d
 accel code on top of GL. That should give you reasonable (albeit likely
 not stellar) X render performance.
 -Daniel

I'm not sure that would perform well on a tile-based deferred renderer
like Mali. To perform well, we need to gather an entire frame's worth
of rendering/draw-calls before passing them to the GPU to render. I
believe this is not the typical use-case of EXA? How much of the
framebuffer is re-drawn between flushes?


Cheers,

Tom





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


[PULL] Fix signal-unsafe logging

2012-05-24 Thread Chase Douglas
The following changes since commit 9bc53d8cb04af2be3feeebb1b10774c2d599a76b:

  dri2: SProcDRI2Connect - send the response. (2012-05-22 21:19:40 -0700)

are available in the git repository at:

  git://people.freedesktop.org/~cndougla/xserver signal-logging-v5

for you to fetch changes up to 30659c54c72b2d04de1d87c545129a06395c3fa9:

  Log in OsVendorFatalError() in a signal safe manner (2012-05-24 09:52:25 
-0700)


Chase Douglas (16):
  test/touch: Initialize device name
  Add global variable inSignalContext
  Save log file file descriptor for signal context logging
  Add FormatUInt64{,Hex}() for formatting numbers in a signal safe manner
  Add LogMessageVerbSigSafe() for logging messages while in signal context
  Add ErrorSigSafe() alternative to ErrorF()
  Print backtrace in a signal-safe manner
  Make BUG_WARN* signal safe
  Warn when attempting to log in a signal unsafe manner from signal context
  Log messages in GetTouchEvents() in a signal safe manner
  Log messages in TouchBeginDDXTouch() in a signal-safe manner
  Log mieq enqueue overflow in a signal safe manner
  Log safely in fatal signal handler
  Log in UnloadModuleOrDriver() in a signal safe manner
  Log in LoaderUnload() in a signal safe manner
  Log in OsVendorFatalError() in a signal safe manner

 dix/getevents.c  |4 +-
 dix/touch.c  |5 +-
 hw/xfree86/common/xf86Init.c |   14 ++--
 hw/xfree86/loader/loader.c   |2 +-
 hw/xfree86/loader/loadmod.c  |5 +-
 hw/xfree86/os-support/shared/sigio.c |4 +
 include/globals.h|3 +
 include/misc.h   |   10 ++-
 include/os.h |   57 ++
 mi/mieq.c|   19 +++--
 os/backtrace.c   |   49 +++-
 os/log.c |  143 +-
 os/osinit.c  |8 +-
 os/utils.c   |   46 +++
 test/.gitignore  |1 +
 test/Makefile.am |3 +-
 test/signal-logging.c|  115 +++
 test/touch.c |5 ++
 18 files changed, 436 insertions(+), 57 deletions(-)
 create mode 100644 test/signal-logging.c
___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel


Re: [PATCH v4 07/16] Print backtrace in a signal-safe manner

2012-05-24 Thread Chase Douglas
On 05/23/2012 09:49 PM, Peter Hutterer wrote:
 On Mon, May 14, 2012 at 02:14:28PM -0700, Chase Douglas wrote:
 Backtraces are often printed in signal context, such as when a segfault
 occurs.

 Signed-off-by: Chase Douglas chase.doug...@canonical.com
 ---
  os/backtrace.c |   49 +
  1 file changed, 29 insertions(+), 20 deletions(-)

 diff --git a/os/backtrace.c b/os/backtrace.c
 index 81348f4..d41c3f3 100644
 --- a/os/backtrace.c
 +++ b/os/backtrace.c
 @@ -45,29 +45,37 @@ xorg_backtrace(void)
  int size, i;
  Dl_info info;
  
 -ErrorF(\n);
 -ErrorF(Backtrace:\n);
 +ErrorSigSafe(\n);
 +ErrorSigSafe(Backtrace:\n);
  size = backtrace(array, 64);
  for (i = 0; i  size; i++) {
  int rc = dladdr(array[i], info);
  
  if (rc == 0) {
 -ErrorF(%d: ?? [%p]\n, i, array[i]);
 +ErrorSigSafe(%u: ?? [%p]\n, i, array[i]);
  continue;
  }
  mod = (info.dli_fname  *info.dli_fname) ? info.dli_fname : 
 (vdso);
  if (info.dli_saddr)
 -ErrorF(%d: %s (%s+0x%lx) [%p]\n, i, mod,
 -   info.dli_sname,
 -   (long unsigned int) ((char *) array[i] -
 -(char *) info.dli_saddr), array[i]);
 +ErrorSigSafe(
 +%u: %s (%s+0x%x) [%p]\n,
 +i,
 +mod,
 +info.dli_sname,
 +(long unsigned int)((char *) array[i] -
 +(char *) info.dli_saddr),
 +array[i]);
  else
 -ErrorF(%d: %s (%p+0x%lx) [%p]\n, i, mod,
 -   info.dli_fbase,
 -   (long unsigned int) ((char *) array[i] -
 -(char *) info.dli_fbase), array[i]);
 +ErrorSigSafe(
 +%u: %s (%s+0x%x) [%p]\n,
 
 typo: this should be %u: %s (%p+0x%lx) [%p]\n (note the %p, not %s). The
 backtrace looks like garbage otherwise.
 
 Reviewed-by: Peter Hutterer peter.hutte...@who-t.net otherwise

Thanks, I've fixed this up.

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


Re: [PATCH v3 1/3] Add xorg-gtest integration test framework

2012-05-24 Thread Chase Douglas
On 05/23/2012 08:32 PM, Peter Hutterer wrote:
 pulled the branch you sent me that contained (amongst others) this patchset.
 
 On Fri, May 18, 2012 at 02:02:04PM -0700, Chase Douglas wrote:
 Signed-off-by: Chase Douglas chase.doug...@canonical.com
 ---
 Changes since v2:
 * Refreshed xorg-gtest.m4 and Makefile-xorg-gtest.am for xorg-gtest changes

  configure.ac|   21 +-
  m4/xorg-gtest.m4|  110 
 +++
  test/integration/Makefile-xorg-gtest.am |   64 ++
  test/integration/Makefile.am|4 ++
 
 What's missing here is that test/Makefile.am needs integration in the
 SUBDIRS, otherwise the tests won't be built.

I could have sworn I did this, but I guess not. I've added it in.

 and when building them, I get 
 xi2.cpp: In member function ‘virtual void
 XInput2Test_DisableDeviceEndTouches_Test::TestBody()’:
 xi2.cpp:308:177: error: ‘wait_for_device’ was not declared in this scope
 xi2.cpp:313:162: error: ‘wait_for_event_of_type’ was not declared in this
 scope
 xi2.cpp:337:162: error: ‘wait_for_event_of_type’ was not declared in this
 scope
 
 I suspect they are supposed to be in there somewhere, but neither xorg-gtest
 nor this tree had it.

I fixed up the XIQueryPointer test, but then when I rebased the end
touches on device disable branch on top I forgot to fix up its test
too. I guess I then didn't bother to recompile and test :(. My fault.

I'll resend all five patches together so you can review the changes. The
branch has been updated if you want to pull:

git://people.freedesktop.org/~cndougla/xserver integration-tests

Thanks,

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

[PATCH v4 1/5] Add xorg-gtest integration test framework

2012-05-24 Thread Chase Douglas
Signed-off-by: Chase Douglas chase.doug...@canonical.com
---
Changes since v3:
* Add integration test directory to test/Makefile.am SUBDIRS

 configure.ac|   21 +-
 m4/xorg-gtest.m4|  110 +++
 test/Makefile.am|2 +-
 test/integration/Makefile-xorg-gtest.am |   64 ++
 test/integration/Makefile.am|4 ++
 5 files changed, 199 insertions(+), 2 deletions(-)
 create mode 100644 m4/xorg-gtest.m4
 create mode 100644 test/integration/Makefile-xorg-gtest.am
 create mode 100644 test/integration/Makefile.am

diff --git a/configure.ac b/configure.ac
index 97ceab1..ba10b2e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -35,7 +35,7 @@ AM_MAINTAINER_MODE
 # Require xorg-macros minimum of 1.14 for XORG_COMPILER_BRAND in 
XORG_DEFAULT_OPTIONS
 m4_ifndef([XORG_MACROS_VERSION],
   [m4_fatal([must install xorg-macros 1.14 or later before running 
autoconf/autogen])])
-XORG_MACROS_VERSION(1.14)
+XORG_MACROS_VERSION(1.17)
 XORG_DEFAULT_OPTIONS
 XORG_WITH_DOXYGEN(1.6.1)
 XORG_CHECK_SGML_DOCTOOLS(1.8)
@@ -45,6 +45,7 @@ XORG_WITH_XMLTO(0.0.20)
 XORG_WITH_FOP
 XORG_WITH_XSLTPROC
 XORG_ENABLE_UNIT_TESTS
+XORG_ENABLE_INTEGRATION_TESTS
 XORG_LD_WRAP([optional])
 
 m4_ifndef([XORG_FONT_MACROS_VERSION], [m4_fatal([must install fontutil 1.1 or 
later before running autoconf/autogen])])
@@ -2143,6 +2144,23 @@ AM_CONDITIONAL(XEPHYR, [test x$KDRIVE = xyes  test 
x$XEPHYR = xyes])
 AM_CONDITIONAL(BUILD_KDRIVEFBDEVLIB, [test x$KDRIVE = xyes  test 
x$KDRIVEFBDEVLIB = xyes])
 AM_CONDITIONAL(XFAKESERVER, [test x$KDRIVE = xyes  test x$XFAKE = xyes])
 
+dnl ---
+dnl Tests section.
+dnl ---
+
+if [test x$XORG = xyes  test x$enable_integration_tests != xno]; then
+AC_PROG_CXX
+CHECK_XORG_GTEST
+AM_CONDITIONAL(ENABLE_XORG_GTEST_TESTS, [test x$have_xorg_gtest = xyes])
+if [test x$have_xorg_gtest = xyes]; then
+AC_MSG_NOTICE([xorg-gtest is available, tests will be built])
+elif [test x$enable_integration_tests = xyes]; then
+AC_MSG_ERROR([xorg-gtest is not available])
+else
+AC_MSG_NOTICE([xorg-gtest is not available, tests will not be built])
+fi
+fi
+
 dnl and the rest of these are generic, so they're in config.h
 dnl 
 dnl though, thanks to the passing of some significant amount of time, the
@@ -2275,6 +2293,7 @@ hw/kdrive/linux/Makefile
 hw/kdrive/src/Makefile
 test/Makefile
 test/xi2/Makefile
+test/integration/Makefile
 xserver.ent
 xorg-server.pc
 ])
diff --git a/m4/xorg-gtest.m4 b/m4/xorg-gtest.m4
new file mode 100644
index 000..062842c
--- /dev/null
+++ b/m4/xorg-gtest.m4
@@ -0,0 +1,110 @@
+# serial 2
+
+# Copyright (C) 2012 Canonical, Ltd.
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the Software), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice (including the next
+# paragraph) shall be included in all copies or substantial portions of the
+# Software.
+#
+# THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+# SOFTWARE.
+
+# Checks whether the gtest source is available on the system. Allows for
+# adjusting the include and source path. Sets have_gtest=yes if the source is
+# present. Sets GTEST_CPPFLAGS and GTEST_SOURCE to the preprocessor flags and
+# source location respectively.
+AC_DEFUN([_CHECK_GTEST],
+[
+  AC_ARG_WITH([gtest-source-path],
+  [AS_HELP_STRING([--with-gtest-source-path],
+  [location of the Google test sources, defaults 
to /usr/src/gtest])],
+  [GTEST_SOURCE=$withval; GTEST_CPPFLAGS=-I$withval/include],
+  [GTEST_SOURCE=/usr/src/gtest])
+
+  AC_ARG_WITH([gtest-include-path],
+  [AS_HELP_STRING([--with-gtest-include-path],
+  [location of the Google test headers])],
+  [GTEST_CPPFLAGS=-I$withval])
+
+  GTEST_CPPFLAGS=$GTEST_CPPFLAGS -I$GTEST_SOURCE
+
+  AC_CHECK_FILES([$GTEST_SOURCE/src/gtest-all.cc]
+ [$GTEST_SOURCE/src/gtest_main.cc],
+ 

[PATCH v4 2/5] Add XInput 2.x integration test framework

2012-05-24 Thread Chase Douglas
Signed-off-by: Chase Douglas chase.doug...@canonical.com
Reviewed-by: Peter Hutterer peter.hutte...@who-t.net
---
 configure.ac |   14 +++
 test/integration/.gitignore  |1 +
 test/integration/Makefile.am |   24 ++
 test/integration/xi2.cpp |  194 ++
 4 files changed, 233 insertions(+)
 create mode 100644 test/integration/.gitignore
 create mode 100644 test/integration/xi2.cpp

diff --git a/configure.ac b/configure.ac
index ba10b2e..0c511b8 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2161,6 +2161,20 @@ if [test x$XORG = xyes  test 
x$enable_integration_tests != xno]; then
 fi
 fi
 
+PKG_CHECK_MODULES(TEST_X11, x11, have_test_x11=yes, have_test_x11=no)
+PKG_CHECK_MODULES(TEST_XINPUT, [xi = 1.6], have_test_xinput=yes, 
have_test_xinput=no)
+
+if [test x$have_test_x11 != xyes]; then
+AC_MSG_NOTICE([libX11 not available, skipping input tests])
+elif [test x$have_test_xinput != xyes]; then
+AC_MSG_NOTICE([libXi 1.6 not available, skipping input tests])
+elif [test x$have_xorg_gtest_evemu != xyes]; then
+AC_MSG_NOTICE([uTouch-Evemu not available, skipping input tests])
+else
+enable_input_tests=yes
+fi
+AM_CONDITIONAL(ENABLE_XORG_GTEST_INPUT_TESTS, [test x$enable_input_tests = 
xyes])
+
 dnl and the rest of these are generic, so they're in config.h
 dnl 
 dnl though, thanks to the passing of some significant amount of time, the
diff --git a/test/integration/.gitignore b/test/integration/.gitignore
new file mode 100644
index 000..ab86ebf
--- /dev/null
+++ b/test/integration/.gitignore
@@ -0,0 +1 @@
+gtest-tests
diff --git a/test/integration/Makefile.am b/test/integration/Makefile.am
index 2028d35..ff9789e 100644
--- a/test/integration/Makefile.am
+++ b/test/integration/Makefile.am
@@ -1,4 +1,28 @@
+TESTS =
+
 if ENABLE_XORG_GTEST_TESTS
 include $(top_srcdir)/test/integration/Makefile-xorg-gtest.am
 noinst_LIBRARIES = $(XORG_GTEST_BUILD_LIBS)
+
+if ENABLE_XORG_GTEST_INPUT_TESTS
+TESTS += gtest-tests
 endif
+endif
+
+noinst_PROGRAMS = $(TESTS)
+
+AM_CPPFLAGS = \
+   -DDEFAULT_XORG_SERVER=\$(abs_top_builddir)/hw/xfree86/Xorg\ \
+   -DTEST_ROOT_DIR=\$(abs_top_srcdir)/test/integration/\ \
+   $(GTEST_CPPFLAGS) \
+   $(XORG_GTEST_CPPFLAGS)
+
+AM_CXXFLAGS = $(GTEST_CXXFLAGS) $(XORG_GTEST_CXXFLAGS)
+
+gtest_tests_SOURCES = xi2.cpp
+gtest_tests_LDADD = \
+   $(TEST_XINPUT_LIBS) \
+   $(TEST_X11_LIBS) \
+   $(XORG_GTEST_LIBS) \
+   $(EVEMU_LIBS) \
+   $(XORG_GTEST_MAIN_LIBS)
diff --git a/test/integration/xi2.cpp b/test/integration/xi2.cpp
new file mode 100644
index 000..d3c3a30
--- /dev/null
+++ b/test/integration/xi2.cpp
@@ -0,0 +1,194 @@
+#include stdexcept
+
+#include xorg/gtest/xorg-gtest.h
+
+#include X11/extensions/XInput2.h
+
+namespace {
+
+/**
+ * Wait for an event on the X connection.
+ *
+ * @param [in] display The X display connection
+ * @param [in] timeout The timeout in milliseconds
+ *
+ * @return Whether an event is available
+ */
+bool WaitForEvent(::Display *display, time_t timeout = 1000)
+{
+fd_set fds;
+FD_ZERO(fds);
+
+int display_fd = ConnectionNumber(display);
+
+XSync(display, False);
+
+if (XPending(display))
+return true;
+else {
+FD_SET(display_fd, fds);
+
+struct timeval timeval = {
+static_casttime_t(timeout / 1000),
+static_casttime_t(timeout % 1000),
+};
+
+int ret;
+if (timeout)
+ret = select(display_fd + 1, fds, NULL, NULL, timeval);
+else
+ret = select(display_fd + 1, fds, NULL, NULL, NULL);
+
+if (ret  0)
+throw std::runtime_error(Failed to select on X fd);
+
+if (ret == 0)
+return false;
+
+return XPending(display);
+}
+}
+
+/**
+ * Wait for an event of a specific type on the X connection.
+ *
+ * All events preceding the matching event are discarded. If no event was found
+ * before the timeout expires, all events in the queue will have been 
discarded.
+ *
+ * @param [in] display   The X display connection
+ * @param [in] type  The X core protocol event type
+ * @param [in] extension The X extension opcode of a generic event, or -1 for
+ *   any generic event
+ * @param [in] evtypeThe X extension event type of a generic event, or -1
+ *   for any event of the given extension
+ * @param [in] timeout   The timeout in milliseconds
+ *
+ * @return Whether an event is available
+ */
+bool WaitForEventOfType(::Display *display, int type, int extension, int 
evtype,
+time_t timeout = 1000)
+{
+while (WaitForEvent(display)) {
+XEvent event;
+if (!XPeekEvent(display, event))
+throw std::runtime_error(Failed to peek X event);
+
+if (event.type != type) {
+if (XNextEvent(display, event) != Success)
+throw std::runtime_error(Failed to remove X 

[PATCH v4 3/5] Add test for XIQueryPointer button mask when physical touch is active

2012-05-24 Thread Chase Douglas
Signed-off-by: Chase Douglas chase.doug...@canonical.com
Reviewed-by: Peter Hutterer peter.hutte...@who-t.net
---
 .../recordings/ntrig_dell_xt2/device.prop  |   32 +
 .../recordings/ntrig_dell_xt2/touch_1_begin.record |   11 +++
 .../recordings/ntrig_dell_xt2/touch_1_end.record   |3 +
 test/integration/xi2.cpp   |   76 
 4 files changed, 122 insertions(+)
 create mode 100644 test/integration/recordings/ntrig_dell_xt2/device.prop
 create mode 100644 
test/integration/recordings/ntrig_dell_xt2/touch_1_begin.record
 create mode 100644 
test/integration/recordings/ntrig_dell_xt2/touch_1_end.record

diff --git a/test/integration/recordings/ntrig_dell_xt2/device.prop 
b/test/integration/recordings/ntrig_dell_xt2/device.prop
new file mode 100644
index 000..2738c04
--- /dev/null
+++ b/test/integration/recordings/ntrig_dell_xt2/device.prop
@@ -0,0 +1,32 @@
+N: N-Trig MultiTouch (Virtual Test Device)
+I: 0003 1b96 0001 0110
+P: 00 00 00 00 00 00 00 00
+B: 00 0b 00 00 00 00 00 00 00
+B: 01 00 00 00 00 00 00 00 00
+B: 01 00 00 00 00 00 00 00 00
+B: 01 00 00 00 00 00 00 00 00
+B: 01 00 00 00 00 00 00 00 00
+B: 01 00 00 00 00 00 00 00 00
+B: 01 00 04 00 00 00 00 00 00
+B: 01 00 00 00 00 00 00 00 00
+B: 01 00 00 00 00 00 00 00 00
+B: 01 00 00 00 00 00 00 00 00
+B: 01 00 00 00 00 00 00 00 00
+B: 01 00 00 00 00 00 00 00 00
+B: 01 00 00 00 00 00 00 00 00
+B: 02 00 00 00 00 00 00 00 00
+B: 03 03 00 00 00 00 01 73 00
+B: 04 00 00 00 00 00 00 00 00
+B: 05 00 00 00 00 00 00 00 00
+B: 11 00 00 00 00 00 00 00 00
+B: 12 00 00 00 00 00 00 00 00
+B: 15 00 00 00 00 00 00 00 00
+B: 15 00 00 00 00 00 00 00 00
+A: 00 0 9600 75 0
+A: 01 0 7200 78 0
+A: 28 0 255 0 0
+A: 30 0 9600 200 0
+A: 31 0 7200 150 0
+A: 34 0 1 0 0
+A: 35 0 9600 75 0
+A: 36 0 7200 78 0
diff --git a/test/integration/recordings/ntrig_dell_xt2/touch_1_begin.record 
b/test/integration/recordings/ntrig_dell_xt2/touch_1_begin.record
new file mode 100644
index 000..28a849b
--- /dev/null
+++ b/test/integration/recordings/ntrig_dell_xt2/touch_1_begin.record
@@ -0,0 +1,11 @@
+E: 1327542640.244087 0003  2745
+E: 1327542640.244089 0003 0001 1639
+E: 1327542640.244090 0003 0035 2745
+E: 1327542640.244091 0003 0036 1639
+E: 1327542640.244092 0003 0034 0
+E: 1327542640.244093 0003 0030 468
+E: 1327542640.244094 0003 0031 306
+E: 1327542640.244095  0002 0
+E: 1327542640.244251 0001 014d 1
+E: 1327542640.244251 0001 014a 1
+E: 1327542640.244253   0
diff --git a/test/integration/recordings/ntrig_dell_xt2/touch_1_end.record 
b/test/integration/recordings/ntrig_dell_xt2/touch_1_end.record
new file mode 100644
index 000..cd6a9d9
--- /dev/null
+++ b/test/integration/recordings/ntrig_dell_xt2/touch_1_end.record
@@ -0,0 +1,3 @@
+E: 1327542642.244253 0001 014d 0
+E: 1327542642.244253 0001 014a 0
+E: 1327542642.244253   0
diff --git a/test/integration/xi2.cpp b/test/integration/xi2.cpp
index d3c3a30..e6cd312 100644
--- a/test/integration/xi2.cpp
+++ b/test/integration/xi2.cpp
@@ -192,3 +192,79 @@ protected:
 
 int xi2_opcode_;
 };
+
+/**
+ * XIQueryPointer for XInput 2.1 and earlier should report the first button
+ * pressed if a touch is physically active. For XInput 2.2 and later clients,
+ * the first button should not be reported.
+ */
+TEST_P(XInput2Test, XIQueryPointerTouchscreen)
+{
+XIEventMask mask;
+mask.deviceid = XIAllDevices;
+mask.mask_len = XIMaskLen(XI_HierarchyChanged);
+mask.mask = reinterpret_castunsigned char*(
+calloc(XIMaskLen(XI_HierarchyChanged), 1));
+XISetMask(mask.mask, XI_HierarchyChanged);
+
+ASSERT_EQ(Success,
+  XISelectEvents(Display(), DefaultRootWindow(Display()), mask,
+ 1));
+
+mask.deviceid = XIAllMasterDevices;
+XIClearMask(mask.mask, XI_HierarchyChanged);
+XISetMask(mask.mask, XI_ButtonPress);
+
+ASSERT_EQ(Success,
+  XISelectEvents(Display(), DefaultRootWindow(Display()), mask,
+ 1));
+
+free(mask.mask);
+
+XFlush(Display());
+
+xorg::testing::evemu::Device device(
+TEST_ROOT_DIR recordings/ntrig_dell_xt2/device.prop);
+
+ASSERT_TRUE(WaitForDevice(Display(),
+  N-Trig MultiTouch (Virtual Test Device)));
+
+device.Play(TEST_ROOT_DIR 
recordings/ntrig_dell_xt2/touch_1_begin.record);
+
+ASSERT_TRUE(WaitForEventOfType(Display(), GenericEvent, xi2_opcode_,
+   XI_ButtonPress));
+
+XEvent event;
+ASSERT_EQ(Success, XNextEvent(Display(), event));
+
+XGenericEventCookie *xcookie = event.xcookie;
+ASSERT_TRUE(XGetEventData(Display(), xcookie));
+
+XIDeviceEvent *device_event =
+reinterpret_castXIDeviceEvent*(xcookie-data);
+
+Window root;
+Window child;
+double root_x;
+double root_y;
+double win_x;
+double win_y;
+XIButtonState buttons;
+XIModifierState modifiers;
+XIGroupState 

[PATCH v4 4/5] Add test for touch end on device disable

2012-05-24 Thread Chase Douglas
When a device is disabled, all physically active touches must end.

Signed-off-by: Chase Douglas chase.doug...@canonical.com
Reviewed-by: Peter Hutterer peter.hutte...@who-t.net
---
Changes since v3:
* Fix wait_for_event functions to WaitForEvent functions

 test/integration/xi2.cpp |   71 ++
 1 file changed, 71 insertions(+)

diff --git a/test/integration/xi2.cpp b/test/integration/xi2.cpp
index e6cd312..42b973f 100644
--- a/test/integration/xi2.cpp
+++ b/test/integration/xi2.cpp
@@ -2,6 +2,7 @@
 
 #include xorg/gtest/xorg-gtest.h
 
+#include X11/extensions/XInput.h
 #include X11/extensions/XInput2.h
 
 namespace {
@@ -267,4 +268,74 @@ TEST_P(XInput2Test, XIQueryPointerTouchscreen)
 XFreeEventData(Display(), xcookie);
 }
 
+/**
+ * When a device is disabled, any physically active touches should end.
+ */
+TEST_P(XInput2Test, DisableDeviceEndTouches)
+{
+/* This is an XInput 2.2 and later test only */
+if (GetParam()  2)
+return;
+
+XIEventMask mask;
+mask.deviceid = XIAllDevices;
+mask.mask_len = XIMaskLen(XI_TouchEnd);
+mask.mask = reinterpret_castunsigned char*(
+calloc(XIMaskLen(XI_HierarchyChanged), 1));
+XISetMask(mask.mask, XI_HierarchyChanged);
+
+ASSERT_EQ(Success,
+  XISelectEvents(Display(), DefaultRootWindow(Display()), mask,
+ 1));
+
+mask.deviceid = XIAllMasterDevices;
+XIClearMask(mask.mask, XI_HierarchyChanged);
+XISetMask(mask.mask, XI_TouchBegin);
+XISetMask(mask.mask, XI_TouchUpdate);
+XISetMask(mask.mask, XI_TouchEnd);
+
+ASSERT_EQ(Success,
+  XISelectEvents(Display(), DefaultRootWindow(Display()), mask,
+ 1));
+
+free(mask.mask);
+
+XFlush(Display());
+
+xorg::testing::evemu::Device device(
+TEST_ROOT_DIR recordings/ntrig_dell_xt2/device.prop);
+
+ASSERT_TRUE(WaitForDevice(Display(),
+  N-Trig MultiTouch (Virtual Test Device)));
+
+device.Play(TEST_ROOT_DIR 
recordings/ntrig_dell_xt2/touch_1_begin.record);
+
+ASSERT_TRUE(WaitForEventOfType(Display(), GenericEvent, xi2_opcode_,
+   XI_TouchBegin));
+
+XEvent event;
+ASSERT_EQ(Success, XNextEvent(Display(), event));
+
+XGenericEventCookie *xcookie = event.xcookie;
+ASSERT_TRUE(XGetEventData(Display(), xcookie));
+
+XIDeviceEvent *device_event =
+reinterpret_castXIDeviceEvent*(xcookie-data);
+
+XDevice *xdevice = XOpenDevice(Display(), device_event-sourceid);
+XFreeEventData(Display(), xcookie);
+ASSERT_TRUE(xdevice != NULL);
+
+XDeviceEnableControl enable_control;
+enable_control.enable = false;
+XDeviceControl *control = reinterpret_castXDeviceControl*(control);
+ASSERT_TRUE(XChangeDeviceControl(Display(), xdevice, DEVICE_ENABLE,
+ control));
+XCloseDevice(Display(), xdevice);
+XFlush(Display());
+
+ASSERT_TRUE(WaitForEventOfType(Display(), GenericEvent, xi2_opcode_,
+   XI_TouchEnd));
+}
+
 INSTANTIATE_TEST_CASE_P(, XInput2Test, ::testing::Range(0, 3));
-- 
1.7.9.5

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


[PATCH v4 5/5] End physically active touches when device is disabled

2012-05-24 Thread Chase Douglas
Otherwise:

* We can't end the touches while device is disabled
* New touches after enabling the device may erroneously be mapped to old
  logical touches

Signed-off-by: Chase Douglas chase.doug...@canonical.com
Reviewed-by: Peter Hutterer peter.hutte...@who-t.net
---
 dix/devices.c   |1 +
 dix/touch.c |   28 
 include/input.h |1 +
 3 files changed, 30 insertions(+)

diff --git a/dix/devices.c b/dix/devices.c
index 0c62a01..dc5f51c 100644
--- a/dix/devices.c
+++ b/dix/devices.c
@@ -437,6 +437,7 @@ DisableDevice(DeviceIntPtr dev, BOOL sendevent)
 if (*prev != dev)
 return FALSE;
 
+TouchEndPhysicallyActiveTouches(dev);
 ReleaseButtonsAndKeys(dev);
 SyncRemoveDeviceIdleTime(dev-idle_counter);
 dev-idle_counter = NULL;
diff --git a/dix/touch.c b/dix/touch.c
index 401cb98..c9f72a9 100644
--- a/dix/touch.c
+++ b/dix/touch.c
@@ -1028,3 +1028,31 @@ TouchAcceptReject(ClientPtr client, DeviceIntPtr dev, 
int mode,
 
 return TouchListenerAcceptReject(dev, ti, i, mode);
 }
+
+/**
+ * End physically active touches for a device.
+ */
+void
+TouchEndPhysicallyActiveTouches(DeviceIntPtr dev)
+{
+InternalEvent *eventlist = InitEventList(GetMaximumEventsNum());
+int i;
+
+OsBlockSignals();
+mieqProcessInputEvents();
+for (i = 0; i  dev-last.num_touches; i++) {
+DDXTouchPointInfoPtr ddxti = dev-last.touches + i;
+
+if (ddxti-active) {
+int j;
+int nevents = GetTouchEvents(eventlist, dev, ddxti-ddx_id,
+ XI_TouchEnd, 0, NULL);
+
+for (j = 0; j  nevents; j++)
+mieqProcessDeviceEvent(dev, eventlist + j, NULL);
+}
+}
+OsReleaseSignals();
+
+FreeEventList(eventlist, GetMaximumEventsNum());
+}
diff --git a/include/input.h b/include/input.h
index bcf98a6..c702929 100644
--- a/include/input.h
+++ b/include/input.h
@@ -579,6 +579,7 @@ extern int TouchListenerAcceptReject(DeviceIntPtr dev, 
TouchPointInfoPtr ti,
  int listener, int mode);
 extern int TouchAcceptReject(ClientPtr client, DeviceIntPtr dev, int mode,
  uint32_t touchid, Window grab_window, XID *error);
+extern void TouchEndPhysicallyActiveTouches(DeviceIntPtr dev);
 
 /* misc event helpers */
 extern Mask GetEventMask(DeviceIntPtr dev, xEvent *ev, InputClientsPtr 
clients);
-- 
1.7.9.5

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


[PATCH] xf86: xf86ClearEntityListForScreen should take a pScrn

2012-05-24 Thread Dave Airlie
From: Dave Airlie airl...@redhat.com

When adding GPU screens this make life easier.

Signed-off-by: Dave Airlie airl...@redhat.com
---
 hw/xfree86/common/xf86Bus.c|3 +--
 hw/xfree86/common/xf86Helper.c |2 +-
 hw/xfree86/common/xf86Priv.h   |2 +-
 3 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/hw/xfree86/common/xf86Bus.c b/hw/xfree86/common/xf86Bus.c
index beb41c2..f158ac9 100644
--- a/hw/xfree86/common/xf86Bus.c
+++ b/hw/xfree86/common/xf86Bus.c
@@ -381,9 +381,8 @@ xf86RemoveEntityFromScreen(ScrnInfoPtr pScrn, int 
entityIndex)
  * to mark it's entities unused. Called by xf86DeleteScreen().
  */
 void
-xf86ClearEntityListForScreen(int scrnIndex)
+xf86ClearEntityListForScreen(ScrnInfoPtr pScrn)
 {
-ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
 int i, entityIndex;
 
 if (pScrn-entityList == NULL || pScrn-numEntities == 0)
diff --git a/hw/xfree86/common/xf86Helper.c b/hw/xfree86/common/xf86Helper.c
index a8f9fb5..9b23f9b 100644
--- a/hw/xfree86/common/xf86Helper.c
+++ b/hw/xfree86/common/xf86Helper.c
@@ -231,7 +231,7 @@ xf86DeleteScreen(ScrnInfoPtr pScrn, int flags)
 
 free(pScrn-privates);
 
-xf86ClearEntityListForScreen(scrnIndex);
+xf86ClearEntityListForScreen(pScrn);
 
 free(pScrn);
 
diff --git a/hw/xfree86/common/xf86Priv.h b/hw/xfree86/common/xf86Priv.h
index 6c5efea..42a3b30 100644
--- a/hw/xfree86/common/xf86Priv.h
+++ b/hw/xfree86/common/xf86Priv.h
@@ -114,7 +114,7 @@ extern _X_EXPORT void xf86BusProbe(void);
 extern _X_EXPORT void xf86AccessEnter(void);
 extern _X_EXPORT void xf86AccessLeave(void);
 extern _X_EXPORT void xf86PostProbe(void);
-extern _X_EXPORT void xf86ClearEntityListForScreen(int scrnIndex);
+extern _X_EXPORT void xf86ClearEntityListForScreen(ScrnInfoPtr pScrn);
 extern _X_EXPORT void xf86AddDevToEntity(int entityIndex, GDevPtr dev);
 extern _X_EXPORT void xf86RemoveDevFromEntity(int entityIndex, GDevPtr dev);
 
-- 
1.7.6

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


Re: [PATCH] xf86: xf86ClearEntityListForScreen should take a pScrn

2012-05-24 Thread Peter Hutterer
On Thu, May 24, 2012 at 08:14:55PM +0100, Dave Airlie wrote:
 From: Dave Airlie airl...@redhat.com
 
 When adding GPU screens this make life easier.
 
 Signed-off-by: Dave Airlie airl...@redhat.com

Reviewed-by: Peter Hutterer peter.hutte...@who-t.net

Cheers,
  Peter

 ---
  hw/xfree86/common/xf86Bus.c|3 +--
  hw/xfree86/common/xf86Helper.c |2 +-
  hw/xfree86/common/xf86Priv.h   |2 +-
  3 files changed, 3 insertions(+), 4 deletions(-)
 
 diff --git a/hw/xfree86/common/xf86Bus.c b/hw/xfree86/common/xf86Bus.c
 index beb41c2..f158ac9 100644
 --- a/hw/xfree86/common/xf86Bus.c
 +++ b/hw/xfree86/common/xf86Bus.c
 @@ -381,9 +381,8 @@ xf86RemoveEntityFromScreen(ScrnInfoPtr pScrn, int 
 entityIndex)
   * to mark it's entities unused. Called by xf86DeleteScreen().
   */
  void
 -xf86ClearEntityListForScreen(int scrnIndex)
 +xf86ClearEntityListForScreen(ScrnInfoPtr pScrn)
  {
 -ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
  int i, entityIndex;
  
  if (pScrn-entityList == NULL || pScrn-numEntities == 0)
 diff --git a/hw/xfree86/common/xf86Helper.c b/hw/xfree86/common/xf86Helper.c
 index a8f9fb5..9b23f9b 100644
 --- a/hw/xfree86/common/xf86Helper.c
 +++ b/hw/xfree86/common/xf86Helper.c
 @@ -231,7 +231,7 @@ xf86DeleteScreen(ScrnInfoPtr pScrn, int flags)
  
  free(pScrn-privates);
  
 -xf86ClearEntityListForScreen(scrnIndex);
 +xf86ClearEntityListForScreen(pScrn);
  
  free(pScrn);
  
 diff --git a/hw/xfree86/common/xf86Priv.h b/hw/xfree86/common/xf86Priv.h
 index 6c5efea..42a3b30 100644
 --- a/hw/xfree86/common/xf86Priv.h
 +++ b/hw/xfree86/common/xf86Priv.h
 @@ -114,7 +114,7 @@ extern _X_EXPORT void xf86BusProbe(void);
  extern _X_EXPORT void xf86AccessEnter(void);
  extern _X_EXPORT void xf86AccessLeave(void);
  extern _X_EXPORT void xf86PostProbe(void);
 -extern _X_EXPORT void xf86ClearEntityListForScreen(int scrnIndex);
 +extern _X_EXPORT void xf86ClearEntityListForScreen(ScrnInfoPtr pScrn);
  extern _X_EXPORT void xf86AddDevToEntity(int entityIndex, GDevPtr dev);
  extern _X_EXPORT void xf86RemoveDevFromEntity(int entityIndex, GDevPtr dev);
  
 -- 
 1.7.6
 
 ___
 xorg-devel@lists.x.org: X.Org development
 Archives: http://lists.x.org/archives/xorg-devel
 Info: http://lists.x.org/mailman/listinfo/xorg-devel
 
___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel


Re: [PATCH] xf86: xf86ClearEntityListForScreen should take a pScrn

2012-05-24 Thread Alan Coopersmith
On 05/24/12 12:14 PM, Dave Airlie wrote:
 From: Dave Airlie airl...@redhat.com
 
 When adding GPU screens this make life easier.
 
 Signed-off-by: Dave Airlie airl...@redhat.com

Reviewed-by: Alan Coopersmith alan.coopersm...@oracle.com

but you'd earn bonus points for also fixing the comment above the
function definition to have the right name for it:

/*
 * xf86ClearEntitiesForScreen() - called when a screen is deleted
 * to mark it's entities unused. Called by xf86DeleteScreen().
 */
void
xf86ClearEntityListForScreen(int scrnIndex)
{

-- 
-Alan Coopersmith-  alan.coopersm...@oracle.com
 Oracle Solaris Engineering - http://blogs.oracle.com/alanc
___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel


Re: [PULL] Fix signal-unsafe logging

2012-05-24 Thread Peter Hutterer
Keith:

I'll pull this into my tree, this needs an input API bump and I need to
check if the input drivers can be updated easily for this first. When I
tried yesterday, I got logspam to no end.

On Thu, May 24, 2012 at 09:57:37AM -0700, Chase Douglas wrote:
 The following changes since commit 9bc53d8cb04af2be3feeebb1b10774c2d599a76b:
 
   dri2: SProcDRI2Connect - send the response. (2012-05-22 21:19:40 -0700)
 
 are available in the git repository at:
 
   git://people.freedesktop.org/~cndougla/xserver signal-logging-v5
 
 for you to fetch changes up to 30659c54c72b2d04de1d87c545129a06395c3fa9:
 
   Log in OsVendorFatalError() in a signal safe manner (2012-05-24 09:52:25 
 -0700)
 
 
 Chase Douglas (16):
   test/touch: Initialize device name
   Add global variable inSignalContext
   Save log file file descriptor for signal context logging
   Add FormatUInt64{,Hex}() for formatting numbers in a signal safe manner
   Add LogMessageVerbSigSafe() for logging messages while in signal context
   Add ErrorSigSafe() alternative to ErrorF()
   Print backtrace in a signal-safe manner
   Make BUG_WARN* signal safe
   Warn when attempting to log in a signal unsafe manner from signal 
 context
   Log messages in GetTouchEvents() in a signal safe manner
   Log messages in TouchBeginDDXTouch() in a signal-safe manner
   Log mieq enqueue overflow in a signal safe manner
   Log safely in fatal signal handler
   Log in UnloadModuleOrDriver() in a signal safe manner
   Log in LoaderUnload() in a signal safe manner
   Log in OsVendorFatalError() in a signal safe manner
 
  dix/getevents.c  |4 +-
  dix/touch.c  |5 +-
  hw/xfree86/common/xf86Init.c |   14 ++--
  hw/xfree86/loader/loader.c   |2 +-
  hw/xfree86/loader/loadmod.c  |5 +-
  hw/xfree86/os-support/shared/sigio.c |4 +
  include/globals.h|3 +
  include/misc.h   |   10 ++-
  include/os.h |   57 ++
  mi/mieq.c|   19 +++--
  os/backtrace.c   |   49 +++-
  os/log.c |  143 
 +-
  os/osinit.c  |8 +-
  os/utils.c   |   46 +++
  test/.gitignore  |1 +
  test/Makefile.am |3 +-
  test/signal-logging.c|  115 +++
  test/touch.c |5 ++
  18 files changed, 436 insertions(+), 57 deletions(-)
  create mode 100644 test/signal-logging.c
___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel


Re: [PATCH v4 4/5] Add test for touch end on device disable

2012-05-24 Thread Peter Hutterer
On Thu, May 24, 2012 at 10:27:59AM -0700, Chase Douglas wrote:
 When a device is disabled, all physically active touches must end.
 
 Signed-off-by: Chase Douglas chase.doug...@canonical.com
 Reviewed-by: Peter Hutterer peter.hutte...@who-t.net
 ---
 Changes since v3:
 * Fix wait_for_event functions to WaitForEvent functions
 
  test/integration/xi2.cpp |   71 
 ++
  1 file changed, 71 insertions(+)
 
 diff --git a/test/integration/xi2.cpp b/test/integration/xi2.cpp
 index e6cd312..42b973f 100644
 --- a/test/integration/xi2.cpp
 +++ b/test/integration/xi2.cpp
 @@ -2,6 +2,7 @@
  
  #include xorg/gtest/xorg-gtest.h
  
 +#include X11/extensions/XInput.h
  #include X11/extensions/XInput2.h
  
  namespace {
 @@ -267,4 +268,74 @@ TEST_P(XInput2Test, XIQueryPointerTouchscreen)
  XFreeEventData(Display(), xcookie);
  }
  
 +/**
 + * When a device is disabled, any physically active touches should end.
 + */
 +TEST_P(XInput2Test, DisableDeviceEndTouches)
 +{
 +/* This is an XInput 2.2 and later test only */
 +if (GetParam()  2)
 +return;
 +
 +XIEventMask mask;
 +mask.deviceid = XIAllDevices;
 +mask.mask_len = XIMaskLen(XI_TouchEnd);
 +mask.mask = reinterpret_castunsigned char*(
 +calloc(XIMaskLen(XI_HierarchyChanged), 1));

this should be XI_TouchEnd here, btw.
a better way to avoid these errors is to use mask.mask_len as alloc size
instead of duplicating the XIMaskLen macro. 

Cheers,
  Peter

 +XISetMask(mask.mask, XI_HierarchyChanged);
 +
 +ASSERT_EQ(Success,
 +  XISelectEvents(Display(), DefaultRootWindow(Display()), mask,
 + 1));
 +
 +mask.deviceid = XIAllMasterDevices;
 +XIClearMask(mask.mask, XI_HierarchyChanged);
 +XISetMask(mask.mask, XI_TouchBegin);
 +XISetMask(mask.mask, XI_TouchUpdate);
 +XISetMask(mask.mask, XI_TouchEnd);
 +
 +ASSERT_EQ(Success,
 +  XISelectEvents(Display(), DefaultRootWindow(Display()), mask,
 + 1));
 +
 +free(mask.mask);
 +
 +XFlush(Display());
 +
 +xorg::testing::evemu::Device device(
 +TEST_ROOT_DIR recordings/ntrig_dell_xt2/device.prop);
 +
 +ASSERT_TRUE(WaitForDevice(Display(),
 +  N-Trig MultiTouch (Virtual Test Device)));
 +
 +device.Play(TEST_ROOT_DIR 
 recordings/ntrig_dell_xt2/touch_1_begin.record);
 +
 +ASSERT_TRUE(WaitForEventOfType(Display(), GenericEvent, xi2_opcode_,
 +   XI_TouchBegin));
 +
 +XEvent event;
 +ASSERT_EQ(Success, XNextEvent(Display(), event));
 +
 +XGenericEventCookie *xcookie = event.xcookie;
 +ASSERT_TRUE(XGetEventData(Display(), xcookie));
 +
 +XIDeviceEvent *device_event =
 +reinterpret_castXIDeviceEvent*(xcookie-data);
 +
 +XDevice *xdevice = XOpenDevice(Display(), device_event-sourceid);
 +XFreeEventData(Display(), xcookie);
 +ASSERT_TRUE(xdevice != NULL);
 +
 +XDeviceEnableControl enable_control;
 +enable_control.enable = false;
 +XDeviceControl *control = reinterpret_castXDeviceControl*(control);
 +ASSERT_TRUE(XChangeDeviceControl(Display(), xdevice, DEVICE_ENABLE,
 + control));
 +XCloseDevice(Display(), xdevice);
 +XFlush(Display());
 +
 +ASSERT_TRUE(WaitForEventOfType(Display(), GenericEvent, xi2_opcode_,
 +   XI_TouchEnd));
 +}
 +
  INSTANTIATE_TEST_CASE_P(, XInput2Test, ::testing::Range(0, 3));
 -- 
 1.7.9.5
 
___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel


[PATCH xorg-gtest 1/2] Print the display we were trying to start up on.

2012-05-24 Thread Peter Hutterer
Signed-off-by: Peter Hutterer peter.hutte...@who-t.net
---
 src/environment.cpp |6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/environment.cpp b/src/environment.cpp
index 38765ac..9e58e4a 100644
--- a/src/environment.cpp
+++ b/src/environment.cpp
@@ -124,8 +124,10 @@ void xorg::testing::Environment::SetUp() {
 int pid = waitpid(d_-process.Pid(), status, WNOHANG);
 if (pid == d_-process.Pid()) {
   std::string message;
-  message += X server failed to start. Ensure that the \dummy\ video 
- driver is installed. If the X.org server is older than 1.12, 

+  message += X server failed to start on display ;
+  message += display_string;
+  message += . Ensure that the \dummy\ video driver is installed. 
+ If the X.org server is older than 1.12, 
  tests will need to be run as root. Check ;
   message += d_-path_to_log_file;
   message +=  for any errors;
-- 
1.7.10.1

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


[PATCH xorg-gtest 2/2] XCloseDisplay(3) cannot handle NULL

2012-05-24 Thread Peter Hutterer
If the display failed to start, tearing it down with a NULL pointer causes a
segfault.

Signed-off-by: Peter Hutterer peter.hutte...@who-t.net
---
 src/test.cpp |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/test.cpp b/src/test.cpp
index c2df5a7..f016f06 100644
--- a/src/test.cpp
+++ b/src/test.cpp
@@ -48,7 +48,8 @@ void xorg::testing::Test::SetUp() {
 }
 
 void xorg::testing::Test::TearDown() {
-  XCloseDisplay(d_-display);
+  if (d_-display)
+XCloseDisplay(d_-display);
   d_-display = NULL;
 }
 
-- 
1.7.10.1

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


Re: [PATCH v3 1/3] Add xorg-gtest integration test framework

2012-05-24 Thread Peter Hutterer
On Thu, May 24, 2012 at 10:25:00AM -0700, Chase Douglas wrote:
 On 05/23/2012 08:32 PM, Peter Hutterer wrote:
  pulled the branch you sent me that contained (amongst others) this patchset.
  
  On Fri, May 18, 2012 at 02:02:04PM -0700, Chase Douglas wrote:
  Signed-off-by: Chase Douglas chase.doug...@canonical.com
  ---
  Changes since v2:
  * Refreshed xorg-gtest.m4 and Makefile-xorg-gtest.am for xorg-gtest changes
 
   configure.ac|   21 +-
   m4/xorg-gtest.m4|  110 
  +++
   test/integration/Makefile-xorg-gtest.am |   64 ++
   test/integration/Makefile.am|4 ++
  
  What's missing here is that test/Makefile.am needs integration in the
  SUBDIRS, otherwise the tests won't be built.
 
 I could have sworn I did this, but I guess not. I've added it in.
 
  and when building them, I get 
  xi2.cpp: In member function ‘virtual void
  XInput2Test_DisableDeviceEndTouches_Test::TestBody()’:
  xi2.cpp:308:177: error: ‘wait_for_device’ was not declared in this scope
  xi2.cpp:313:162: error: ‘wait_for_event_of_type’ was not declared in this
  scope
  xi2.cpp:337:162: error: ‘wait_for_event_of_type’ was not declared in this
  scope
  
  I suspect they are supposed to be in there somewhere, but neither xorg-gtest
  nor this tree had it.
 
 I fixed up the XIQueryPointer test, but then when I rebased the end
 touches on device disable branch on top I forgot to fix up its test
 too. I guess I then didn't bother to recompile and test :(. My fault.
 
 I'll resend all five patches together so you can review the changes. The
 branch has been updated if you want to pull:
 
 git://people.freedesktop.org/~cndougla/xserver integration-tests

this took me a _long_ time to get running and it still fails. A few of the
issues I encountered:

- For some reason the default :133 display doesn't work here. Could be some
  stale socket interfering, i'm not sure at this point.
  If the server fails to start up this way, there is no log file despite the
  message suggesting to look at it. I spent quite a while recompiling trying
  to figure out why the input ABIs of the drivers weren't working with the
  test but worked in my normal server - turns out the log file was leftover
  and didn't get updated at all here.
  Suggestion: move the log file before trying to start the server.

- We require root for evemu, the current error message is confusing there.
  Suggestion: skip the test with a warning if evemu is required but the test
  is not run as root.

- I got segfaults when running the tests (approx every second run), see the
  patches for xorg-gtest to send out but even after those I still get the
  sporadic:
unknown file: Failure
C++ exception with description Failed to open connection to display thrown in 
SetUp().
[  FAILED  ] XInput2Test.DisableDeviceEndTouches/1, where GetParam() = 1 (51 ms)

Now I'm down to 3 errors that suggest either missing patches in the server
or broken tests:

make[1]: Entering directory `/home/whot/xorg/xserver/test/integration'
[==] Running 6 tests from 1 test case.
[--] Global test environment set-up.
[--] 6 tests from XInput2Test
[ RUN  ] XInput2Test.XIQueryPointerTouchscreen/0
xi2.cpp:264: Failure
Value of: XIMaskIsSet(buttons.mask, 0)
  Actual: false
Expected: true
[  FAILED  ] XInput2Test.XIQueryPointerTouchscreen/0, where GetParam() = 0 (417 
ms)
[ RUN  ] XInput2Test.XIQueryPointerTouchscreen/1
xi2.cpp:264: Failure
Value of: XIMaskIsSet(buttons.mask, 0)
  Actual: false
Expected: true
[  FAILED  ] XInput2Test.XIQueryPointerTouchscreen/1, where GetParam() = 1 (366 
ms)
[ RUN  ] XInput2Test.XIQueryPointerTouchscreen/2
[   OK ] XInput2Test.XIQueryPointerTouchscreen/2 (385 ms)
[ RUN  ] XInput2Test.DisableDeviceEndTouches/0
[   OK ] XInput2Test.DisableDeviceEndTouches/0 (345 ms)
[ RUN  ] XInput2Test.DisableDeviceEndTouches/1
[   OK ] XInput2Test.DisableDeviceEndTouches/1 (341 ms)
[ RUN  ] XInput2Test.DisableDeviceEndTouches/2
xi2.cpp:338: Failure
Value of: WaitForEventOfType(Display(), GenericEvent, xi2_opcode_, XI_TouchEnd)
  Actual: false
Expected: true
[  FAILED  ] XInput2Test.DisableDeviceEndTouches/2, where GetParam() = 2 (1396 
ms)
[--] 6 tests from XInput2Test (3251 ms total)

[--] Global test environment tear-down
[==] 6 tests from 1 test case ran. (6255 ms total)
[  PASSED  ] 3 tests.
[  FAILED  ] 3 tests, listed below:
[  FAILED  ] XInput2Test.XIQueryPointerTouchscreen/0, where GetParam() = 0
[  FAILED  ] XInput2Test.XIQueryPointerTouchscreen/1, where GetParam() = 1
[  FAILED  ] XInput2Test.DisableDeviceEndTouches/2, where GetParam() = 2

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

[PULL] Xvfb leaks, DGA mouse wheel support

2012-05-24 Thread Peter Hutterer
The following changes since commit 9bc53d8cb04af2be3feeebb1b10774c2d599a76b:

  dri2: SProcDRI2Connect - send the response. (2012-05-22 21:19:40 -0700)

are available in the git repository at:

  git://people.freedesktop.org/~whot/xserver for-keith

for you to fetch changes up to 594b4a4f0601066d09e49a84c5af8c2eb6f07240:

  Xext: include dix-config.h (2012-05-24 15:52:38 +1000)


Julien Cristau (2):
  Xi: make stub DeleteInputDeviceRequest call RemoveDevice
  Xvfb: destroy the screen pixmap in CloseScreen

Marcin Slusarz (1):
  xfree86: fix mouse wheel support for DGA clients

Peter Hutterer (1):
  Xext: include dix-config.h

 Xext/hashtable.c   |4 ++
 Xi/stubs.c |1 +
 hw/vfb/InitOutput.c|7 +++
 hw/xfree86/common/xf86Xinput.c |   94 +---
 4 files changed, 90 insertions(+), 16 deletions(-)


pgpUxFDxdB6QL.pgp
Description: PGP signature
___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel

[PATCH evdev] Use LogMessageVerbSigSafe if available

2012-05-24 Thread Peter Hutterer
Messages logged during the signal handler should use LogMessageVerbSigSafe
as of ABI 18.

Signed-off-by: Peter Hutterer peter.hutte...@who-t.net
---
 src/evdev.c |   17 +++--
 src/evdev.h |4 
 2 files changed, 11 insertions(+), 10 deletions(-)

diff --git a/src/evdev.c b/src/evdev.c
index 4b86f66..27ea605 100644
--- a/src/evdev.c
+++ b/src/evdev.c
@@ -787,9 +787,10 @@ EvdevProcessTouchEvent(InputInfoPtr pInfo, struct 
input_event *ev)
 valuator_mask_copy(pEvdev-mt_mask,
pEvdev-last_mt_vals[slot_index]);
 else
-xf86IDrvMsg(pInfo, X_WARNING,
-Attempted to copy values from out-of-range 
-slot, touch events may be incorrect.\n);
+LogMessageVerbSigSafe(X_WARNING, 0,
+%s: Attempted to copy values from 
out-of-range 
+slot, touch events may be incorrect.\n,
+pInfo-name);
 } else
 pEvdev-slot_state = SLOTSTATE_CLOSE;
 } else {
@@ -,19 +1112,15 @@ EvdevReadInput(InputInfoPtr pInfo)
 close(pInfo-fd);
 pInfo-fd = -1;
 } else if (errno != EAGAIN)
-{
-/* We use X_NONE here because it doesn't alloc */
-xf86MsgVerb(X_NONE, 0, %s: Read error: %s\n, pInfo-name,
-strerror(errno));
-}
+LogMessageVerbSigSafe(X_ERROR, 0, %s: Read error: %s\n, 
pInfo-name,
+   strerror(errno));
 break;
 }
 
 /* The kernel promises that we always only read a complete
  * event, so len != sizeof ev is an error. */
 if (len % sizeof(ev[0])) {
-/* We use X_NONE here because it doesn't alloc */
-xf86MsgVerb(X_NONE, 0, %s: Read error: %s\n, pInfo-name, 
strerror(errno));
+LogMessageVerbSigSafe(X_ERROR, 0, %s: Read error: %s\n, 
pInfo-name, strerror(errno));
 break;
 }
 
diff --git a/src/evdev.h b/src/evdev.h
index 309b215..f9bd234 100644
--- a/src/evdev.h
+++ b/src/evdev.h
@@ -67,6 +67,10 @@
 #define HAVE_SMOOTH_SCROLLING 1
 #endif
 
+#if GET_ABI_MAJOR(ABI_XINPUT_VERSION)  18
+#define LogMessageVerbSigSafe xf86MsgVerb
+#endif
+
 #define EVDEV_MAXBUTTONS 32
 #define EVDEV_MAXQUEUE 32
 
-- 
1.7.10.1

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


[PATCH synaptics] Use LogMessageVerbSigSafe on ABI 18

2012-05-24 Thread Peter Hutterer
Signed-off-by: Peter Hutterer peter.hutte...@who-t.net
---
 src/eventcomm.c |7 ---
 src/synapticsstr.h  |4 
 test/fake-symbols.c |8 
 3 files changed, 16 insertions(+), 3 deletions(-)

diff --git a/src/eventcomm.c b/src/eventcomm.c
index 6cfbcc7..57070c8 100644
--- a/src/eventcomm.c
+++ b/src/eventcomm.c
@@ -556,9 +556,10 @@ EventProcessTouchEvent(InputInfoPtr pInfo, struct 
SynapticsHwState *hw,
 valuator_mask_copy(hw-mt_mask[slot_index],
proto_data-last_mt_vals[slot_index]);
 else
-xf86IDrvMsg(pInfo, X_WARNING,
-Attempted to copy values from out-of-range 
-slot, touch events may be incorrect.\n);
+LogMessageVerbSigSafe(X_WARNING, 0,
+  %s: Attempted to copy values from 
out-of-range 
+  slot, touch events may be 
incorrect.\n,
+  pInfo-name);
 }
 else if (hw-slot_state[slot_index] != SLOTSTATE_EMPTY) {
 hw-slot_state[slot_index] = SLOTSTATE_CLOSE;
diff --git a/src/synapticsstr.h b/src/synapticsstr.h
index 384b7bb..79087a2 100644
--- a/src/synapticsstr.h
+++ b/src/synapticsstr.h
@@ -25,6 +25,10 @@
 #include synproto.h
 #include xserver-properties.h
 
+#if GET_ABI_MAJOR(ABI_XINPUT_VERSION)  18
+#define LogMessageVerbSigSafe xf86MsgVerb
+#endif
+
 #ifdef DBG
 #undef DBG
 #endif
diff --git a/test/fake-symbols.c b/test/fake-symbols.c
index 173e1af..9e5a9ee 100644
--- a/test/fake-symbols.c
+++ b/test/fake-symbols.c
@@ -316,6 +316,14 @@ xf86IDrvMsg(InputInfoPtr dev, MessageType type, const char 
*format, ...)
 return;
 }
 
+struct log_param_t;
+_X_EXPORT void
+_LogMessageVerbSigSafe(MessageType type, int verb, const char *format,
+   const log_param_t *args, int num_args)
+{
+return;
+}
+
 _X_EXPORT void
 xf86PostMotionEventP(DeviceIntPtr device,
  int is_absolute, int first_valuator, int num_valuators,
-- 
1.7.10.1

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


[PATCH] Fix Xephyr build when DRI is enabled but GLX is not

2012-05-24 Thread Alan Coopersmith
Signed-off-by: Alan Coopersmith alan.coopersm...@oracle.com
---
 configure.ac|8 ++--
 hw/kdrive/ephyr/Makefile.am |7 ++-
 hw/kdrive/ephyr/ephyr.c |2 ++
 hw/kdrive/ephyr/hostx.c |4 
 4 files changed, 18 insertions(+), 3 deletions(-)

diff --git a/configure.ac b/configure.ac
index 97ceab1..7440156 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2068,8 +2068,12 @@ if test $KDRIVE = yes; then
 if test x$XV = xyes; then
 XEPHYR_REQUIRED_LIBS=$XEPHYR_REQUIRED_LIBS xv
 fi
-if test x$DRI = xyes  test x$GLX = xyes; then
-XEPHYR_REQUIRED_LIBS=$XEPHYR_REQUIRED_LIBS $LIBGL libdrm
+if test x$DRI = xyes ; then
+if test x$GLX = xyes; then
+XEPHYR_REQUIRED_LIBS=$XEPHYR_REQUIRED_LIBS $LIBGL libdrm
+else
+XEPHYR_REQUIRED_LIBS=$XEPHYR_REQUIRED_LIBS libdrm
+fi
 fi
 
 if test x$XEPHYR = xauto; then
diff --git a/hw/kdrive/ephyr/Makefile.am b/hw/kdrive/ephyr/Makefile.am
index 9d9b64e..127444f 100644
--- a/hw/kdrive/ephyr/Makefile.am
+++ b/hw/kdrive/ephyr/Makefile.am
@@ -36,7 +36,9 @@ HOSTDRI_SRCS =\
ephyrdri.c  \
ephyrdri.h  \
XF86dri.c   \
-   xf86dri.h   \
+   xf86dri.h
+
+HOSTGLX_SRCS = \
ephyrglxext.c   \
ephyrglxext.h   \
ephyrhostglx.c  \
@@ -57,6 +59,9 @@ endif
 
 if DRI
 libxephyr_hostdri_la_SOURCES = $(HOSTDRI_SRCS)
+if GLX
+libxephyr_hostdri_la_SOURCES += $(HOSTGLX_SRCS)
+endif
 endif
 
 libxephyr_la_SOURCES = $(XEPHYR_SRCS)
diff --git a/hw/kdrive/ephyr/ephyr.c b/hw/kdrive/ephyr/ephyr.c
index 8eda539..86a7a53 100644
--- a/hw/kdrive/ephyr/ephyr.c
+++ b/hw/kdrive/ephyr/ephyr.c
@@ -633,7 +633,9 @@ ephyrInitScreen(ScreenPtr pScreen)
 }
 if (!ephyrNoDRI) {
 ephyrDRIExtensionInit(pScreen);
+#ifdef GLXEXT
 ephyrHijackGLXExtension();
+#endif
 }
 #endif
 
diff --git a/hw/kdrive/ephyr/hostx.c b/hw/kdrive/ephyr/hostx.c
index 6988f16..491c07a 100644
--- a/hw/kdrive/ephyr/hostx.c
+++ b/hw/kdrive/ephyr/hostx.c
@@ -1363,6 +1363,7 @@ hostx_has_dri(void)
 int
 hostx_has_glx(void)
 {
+#ifdef GLXEXT
 Display *dpy = hostx_get_display();
 int event_base = 0, error_base = 0;
 
@@ -1370,6 +1371,9 @@ hostx_has_glx(void)
 return FALSE;
 }
 return TRUE;
+#else
+return FALSE;
+#endif
 }
 
 #endif  /* XF86DRI */
-- 
1.7.9.2

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


[PATCH xf86-video-mga 1/2] Move PCI vendor/device id defines into mga.h instead of using xf86PciInfo.h

2012-05-24 Thread Alan Coopersmith
Silences deprecation warnings from xf86PciInfo.h in current Xorg servers

Signed-off-by: Alan Coopersmith alan.coopersm...@oracle.com
---

Both of these patches are just compile-tested, not actually run, since
I don't have any mga hardware handy and haven't tracked down which of
the servers in our test labs use mga in their service processors.

 src/mga.h |   45 +++--
 src/mga_bios.c|3 ---
 src/mga_dac3026.c |3 ---
 src/mga_dacG.c|3 ---
 src/mga_dga.c |1 -
 src/mga_dh.c  |3 ---
 src/mga_dri.c |1 -
 src/mga_driver.c  |3 ---
 src/mga_exa.c |1 -
 src/mga_g450pll.c |3 ---
 src/mga_hwcurs.c  |1 -
 src/mga_merge.c   |2 --
 src/mga_shadow.c  |1 -
 src/mga_storm.c   |3 ---
 src/mga_video.c   |1 -
 15 files changed, 23 insertions(+), 51 deletions(-)

diff --git a/src/mga.h b/src/mga.h
index 77406f1..7d94d59 100644
--- a/src/mga.h
+++ b/src/mga.h
@@ -116,29 +116,30 @@ void MGAdbg_outreg32(ScrnInfoPtr, int,int, char*);
 #define OUTREG(addr,val) MGAdbg_outreg32(pScrn, addr, val, __FUNCTION__)
 #endif /* EXTRADEBUG */
 
-#ifndef PCI_CHIP_MGAG200_SE_A_PCI
-#define PCI_CHIP_MGAG200_SE_A_PCI 0x0522
-#endif
-
-#ifndef PCI_CHIP_MGAG200_SE_B_PCI
-#define PCI_CHIP_MGAG200_SE_B_PCI 0x0524
-#endif
-
-#ifndef PCI_CHIP_MGAG200_WINBOND_PCI
-#define PCI_CHIP_MGAG200_WINBOND_PCI 0x0532
-#endif
-
-#ifndef PCI_CHIP_MGAG200_EV_PCI
-#define PCI_CHIP_MGAG200_EV_PCI 0x0530
-#endif
-
-#ifndef PCI_CHIP_MGAG200_EH_PCI
-#define PCI_CHIP_MGAG200_EH_PCI 0x0533
-#endif
+/*
+ * PCI vendor/device ids, formerly in xf86PciInfo.h
+ */
 
-#ifndef PCI_CHIP_MGAG200_ER_PCI
-#define PCI_CHIP_MGAG200_ER_PCI 0x0534
-#endif
+#define PCI_VENDOR_MATROX   0x102B
+
+#define PCI_CHIP_MGA20850x0518
+#define PCI_CHIP_MGA20640x0519
+#define PCI_CHIP_MGA10640x051A
+#define PCI_CHIP_MGA21640x051B
+#define PCI_CHIP_MGA2164_AGP0x051F
+
+#define PCI_CHIP_MGAG100_PCI0x1000
+#define PCI_CHIP_MGAG1000x1001
+#define PCI_CHIP_MGAG200_PCI0x0520
+#define PCI_CHIP_MGAG2000x0521
+#define PCI_CHIP_MGAG200_SE_A_PCI   0x0522
+#define PCI_CHIP_MGAG200_SE_B_PCI   0x0524
+#define PCI_CHIP_MGAG200_WINBOND_PCI0x0532
+#define PCI_CHIP_MGAG200_EV_PCI 0x0530
+#define PCI_CHIP_MGAG200_EH_PCI 0x0533
+#define PCI_CHIP_MGAG200_ER_PCI 0x0534
+#define PCI_CHIP_MGAG4000x0525
+#define PCI_CHIP_MGAG5500x2527
 
 /*
  * Read/write to the DAC via MMIO 
diff --git a/src/mga_bios.c b/src/mga_bios.c
index b533dd1..a391b2c 100644
--- a/src/mga_bios.c
+++ b/src/mga_bios.c
@@ -46,9 +46,6 @@
 
 #include compiler.h
 
-/* Drivers for PCI hardware need this */
-#include xf86PciInfo.h
-
 /* Drivers that need to access the PCI config space directly need this */
 #include xf86Pci.h
 
diff --git a/src/mga_dac3026.c b/src/mga_dac3026.c
index 35bd9a3..97c2c7a 100644
--- a/src/mga_dac3026.c
+++ b/src/mga_dac3026.c
@@ -42,9 +42,6 @@
 #include xf86.h
 #include xf86_OSproc.h
 
-/* Drivers for PCI hardware need this */
-#include xf86PciInfo.h
-
 /* Drivers that need to access the PCI config space directly need this */
 #include xf86Pci.h
 
diff --git a/src/mga_dacG.c b/src/mga_dacG.c
index b489dea..ea598be 100644
--- a/src/mga_dacG.c
+++ b/src/mga_dacG.c
@@ -12,9 +12,6 @@
 #include xf86.h
 #include xf86_OSproc.h
 
-/* Drivers for PCI hardware need this */
-#include xf86PciInfo.h
-
 /* Drivers that need to access the PCI config space directly need this */
 #include xf86Pci.h
 
diff --git a/src/mga_dga.c b/src/mga_dga.c
index 224e4ba..6c26e44 100644
--- a/src/mga_dga.c
+++ b/src/mga_dga.c
@@ -5,7 +5,6 @@
 #include xf86.h
 #include xf86_OSproc.h
 #include xf86Pci.h
-#include xf86PciInfo.h
 #include xaa.h
 #include xaalocal.h
 #include mga.h
diff --git a/src/mga_dh.c b/src/mga_dh.c
index d9c0d34..2b597b5 100644
--- a/src/mga_dh.c
+++ b/src/mga_dh.c
@@ -12,9 +12,6 @@
 #include xf86.h
 #include xf86_OSproc.h
 
-/* Drivers for PCI hardware need this */
-#include xf86PciInfo.h
-
 /* Drivers that need to access the PCI config space directly need this */  
 #include xf86Pci.h
 
diff --git a/src/mga_dri.c b/src/mga_dri.c
index 1454994..4156bb5 100644
--- a/src/mga_dri.c
+++ b/src/mga_dri.c
@@ -33,7 +33,6 @@
 #include xf86.h
 #include xf86_OSproc.h
 
-#include xf86PciInfo.h
 #include xf86Pci.h
 
 #include miline.h
diff --git a/src/mga_driver.c b/src/mga_driver.c
index 61eb96c..806692a 100644
--- a/src/mga_driver.c
+++ b/src/mga_driver.c
@@ -65,9 +65,6 @@
 
 #include compiler.h
 
-/* Drivers for PCI hardware need this */
-#include xf86PciInfo.h
-
 /* Drivers that need to access the PCI config space directly need this */
 #ifndef XSERVER_LIBPCIACCESS
 #include xf86Pci.h
diff --git a/src/mga_exa.c b/src/mga_exa.c
index ced6452..6cb4ae6 100644
--- a/src/mga_exa.c
+++ b/src/mga_exa.c
@@ -45,7 +45,6 @@
 

[PATCH xf86-video-mga 2/2] Add const qualifier to char *from in MGAdoDDC

2012-05-24 Thread Alan Coopersmith
Only used to store arguments to pass as printf %s strings to xf86DrvMsg

Fixes gcc warnings:
mga_driver.c: In function 'MGAdoDDC':
mga_driver.c:1338:7: warning: assignment discards qualifiers from pointer 
target type
mga_driver.c:1343:11: warning: assignment discards qualifiers from pointer 
target type
mga_driver.c:1351:8: warning: assignment discards qualifiers from pointer 
target type
mga_driver.c:1359:8: warning: assignment discards qualifiers from pointer 
target type

Signed-off-by: Alan Coopersmith alan.coopersm...@oracle.com
---
 src/mga_driver.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/mga_driver.c b/src/mga_driver.c
index 806692a..0c04d74 100644
--- a/src/mga_driver.c
+++ b/src/mga_driver.c
@@ -1263,7 +1263,7 @@ MGAdoDDC(ScrnInfoPtr pScrn)
 vgaHWPtr hwp;
 MGAPtr pMga;
 xf86MonPtr MonInfo = NULL;
-char *from = NULL;
+const char *from = NULL;
 
 hwp = VGAHWPTR(pScrn);
 pMga = MGAPTR(pScrn);
-- 
1.7.9.2

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