Re: [Linuxwacom-devel] [PATCH 0/4] xsetwacom: NVIDIA TwinView support for MapToOutput

2011-06-20 Thread Jason Gerecke
On Sun, Jun 19, 2011 at 9:01 PM, Peter Hutterer
peter.hutte...@who-t.net wrote:

 Subject says it all. I haven't actually tested this on account of not having
 a server that has the transformation matrix _and_ uses the nvidia binary
 driver but the matrix looks correct. Testing feedback would be appreciated.

 Cheers,
  Peter


Talk about spooky action at a distance... I needed a diversion
Friday and whipped up this set of patches as well. I was going to test
them under the binary driver this morning before submitting them to
the list, but it looks like I've been beaten.

Review and test results coming soon (but the a quick 5-second glance
looks almost identical to what I did)...

Jason

---
Day xee-nee-svsh duu-'ushtlh-ts'it;
nuu-wee-ya' duu-xan' 'vm-nvshtlh-ts'it.
Huu-chan xuu naa~-gha.

--
EditLive Enterprise is the world's most technically advanced content
authoring tool. Experience the power of Track Changes, Inline Image
Editing and ensure content is compliant with Accessibility Checking.
http://p.sf.net/sfu/ephox-dev2dev
___
Linuxwacom-devel mailing list
Linuxwacom-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel


Re: [Linuxwacom-devel] [PATCH 3/4] xsetwacom: move matrix calculation into a separate function

2011-06-20 Thread Jason Gerecke
On Sun, Jun 19, 2011 at 9:01 PM, Peter Hutterer
peter.hutte...@who-t.net wrote:
 Signed-off-by: Peter Hutterer peter.hutte...@who-t.net
 ---
  tools/xsetwacom.c |   62 +++-
  1 files changed, 37 insertions(+), 25 deletions(-)

 diff --git a/tools/xsetwacom.c b/tools/xsetwacom.c
 index 47518ee..1a313df 100644
 --- a/tools/xsetwacom.c
 +++ b/tools/xsetwacom.c
 @@ -1963,6 +1963,41 @@ static void _set_matrix_prop(Display *dpy, XDevice 
 *dev, const float fmatrix[9])
        XFlush(dpy);
  }

 +/**
 + * Set the matrix for the given device for the screen defined by offset and
 + * dimensions.
 + */
 +static void _set_matrix(Display *dpy, XDevice *dev,
 +                       int offset_x, int offset_y,
 +                       int screen_width, int screen_height)
 +{
 +       int width = DisplayWidth(dpy, DefaultScreen(dpy));
 +       int height = DisplayHeight(dpy, DefaultScreen(dpy));
 +
 +       /* offset */
 +       float x = 1.0 * offset_x/width;
 +       float y = 1.0 * offset_y/height;
 +
 +       /* mapping */
 +       float w = 1.0 * screen_width/width;
 +       float h = 1.0 * screen_height/height;
 +
 +       float matrix[9] = { 1, 0, 0,
 +               0, 1, 0,
 +               0, 0, 1};
 +       matrix[2] = x;
 +       matrix[5] = y;
 +       matrix[0] = w;
 +       matrix[4] = h;
 +
 +       TRACE(Transformation matrix:\n);
 +       TRACE( [ %f %f %f ]\n, matrix[0], matrix[1], matrix[2]);
 +       TRACE( [ %f %f %f ]\n, matrix[3], matrix[4], matrix[5]);
 +       TRACE( [ %f %f %f ]\n, matrix[6], matrix[7], matrix[8]);
 +
 +       _set_matrix_prop(dpy, dev, matrix);
 +}
 +
  static void set_output_xrandr(Display *dpy, XDevice *dev, param_t *param, 
 int argc, char **argv)
  {
        int min, maj;
 @@ -2014,31 +2049,8 @@ static void set_output_xrandr(Display *dpy, XDevice 
 *dev, param_t *param, int ar
        /* crtc holds our screen info, need to compare to actual screen size */
        if (found)
        {
 -               int width = DisplayWidth(dpy, DefaultScreen(dpy));
 -               int height = DisplayHeight(dpy, DefaultScreen(dpy));
 -
 -               /* offset */
 -               float x = 1.0 * crtc_info-x/width;
 -               float y = 1.0 * crtc_info-y/height;
 -
 -               /* mapping */
 -               float w = 1.0 * crtc_info-width/width;
 -               float h = 1.0 * crtc_info-height/height;
 -
 -               float matrix[9] = { 1, 0, 0,
 -                                   0, 1, 0,
 -                                   0, 0, 1};
 -               matrix[2] = x;
 -               matrix[5] = y;
 -               matrix[0] = w;
 -               matrix[4] = h;
 -
 -               TRACE(Transformation matrix:\n);
 -               TRACE( [ %f %f %f ]\n, matrix[0], matrix[1], matrix[2]);
 -               TRACE( [ %f %f %f ]\n, matrix[3], matrix[4], matrix[5]);
 -               TRACE( [ %f %f %f ]\n, matrix[6], matrix[7], matrix[8]);
 -
 -               _set_matrix_prop(dpy, dev, matrix);
 +               _set_matrix(dpy, dev, crtc_info-x, crtc_info-y,
 +                               crtc_info-x, crtc_info-y);

I'm guessing you meant to write: _set_matrix(dpy, dev, crtc_info-x,
crtc_info-y, crtc_info-width, crtc_info-height);

        } else
                printf(Unable to find output '%s'. 
                        Output may not be connected.\n, output_name);
 --
 1.7.5.4


Jason

---
Day xee-nee-svsh duu-'ushtlh-ts'it;
nuu-wee-ya' duu-xan' 'vm-nvshtlh-ts'it.
Huu-chan xuu naa~-gha.

--
EditLive Enterprise is the world's most technically advanced content
authoring tool. Experience the power of Track Changes, Inline Image
Editing and ensure content is compliant with Accessibility Checking.
http://p.sf.net/sfu/ephox-dev2dev
___
Linuxwacom-devel mailing list
Linuxwacom-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel


Re: [Linuxwacom-devel] [PATCH 4/4] xsetwacom: Support MapToOutput for TwinView.

2011-06-20 Thread Jason Gerecke
On Sun, Jun 19, 2011 at 9:01 PM, Peter Hutterer
peter.hutte...@who-t.net wrote:
 The NVIDIA binary driver doesn't support RandR 1.2. Test for the NV-CONTROL
 extension and assume the binary driver is running when this extension is
 detected. Then use Xinerama to query the screen offset and set the
 transformation matrix accordingly.

 User commands:
    xsetwacom set device name MapToOutput HEAD-0
    xsetwacom set device name MapToOutput HEAD-1

 Signed-off-by: Peter Hutterer peter.hutte...@who-t.net
 ---
  configure.ac      |    2 +-
  man/xsetwacom.man |    3 +-
  tools/xsetwacom.c |   64 
 -
  3 files changed, 66 insertions(+), 3 deletions(-)

 diff --git a/configure.ac b/configure.ac
 index 408e75f..c151e54 100644
 --- a/configure.ac
 +++ b/configure.ac
 @@ -53,7 +53,7 @@ AC_CHECK_LIB([m], [rint])
  PKG_CHECK_MODULES(XORG, [xorg-server = 1.7.0] xproto xext kbproto 
 inputproto randrproto)

  # Obtain compiler/linker options for the xsetwacom tool
 -PKG_CHECK_MODULES(X11, x11 xi xrandr)
 +PKG_CHECK_MODULES(X11, x11 xi xrandr xinerama)

  # Obtain compiler/linker options for libudev used by ISDV4 code
  PKG_CHECK_MODULES(UDEV, libudev)
 diff --git a/man/xsetwacom.man b/man/xsetwacom.man
 index 3a5fa40..564e1d0 100644
 --- a/man/xsetwacom.man
 +++ b/man/xsetwacom.man
 @@ -126,7 +126,8 @@ outputs may be obtained with the xrandr tool. The output 
 mapping
  configuration is a onetime setting and does not track output
  reconfigurations; the command needs to be re-run whenever the output
  configuration changes. When used with tablet rotation, the tablet must be
 -rotated before it is mapped to the new screen.
 +rotated before it is mapped to the new screen. When running the NVIDIA
 +binary driver, the output names are HEAD-0 and HEAD-1.
  This parameter is write-only and cannot be queried.

See comment below on expanding syntax to HEAD-N (where N can be any
digit from 0 to 9). If you remove the NV-CONTROL restriction, you may
also want to mention the syntax works for any driver exposing info
through Xinerama.

  .TP
  \fBMode\fR Absolute|Relative
 diff --git a/tools/xsetwacom.c b/tools/xsetwacom.c
 index 1a313df..94c9db2 100644
 --- a/tools/xsetwacom.c
 +++ b/tools/xsetwacom.c
 @@ -37,6 +37,7 @@
  #include X11/Xatom.h
  #include X11/extensions/XInput.h
  #include X11/extensions/Xrandr.h
 +#include X11/extensions/Xinerama.h
  #include X11/XKBlib.h

  #define TRACE(...) \
 @@ -2058,8 +2059,64 @@ static void set_output_xrandr(Display *dpy, XDevice 
 *dev, param_t *param, int ar
        XRRFreeScreenResources(res);
  }

 +/**
 + * Adjust the transformation matrix based on the twinview settings. This
 + * would better be done with libXNVCtrl but until they learn to package it
 + * properly, rely on Xinerama. Besides, libXNVCtrl isn't available on RHEL,
 + * so we'd have to do it through Xinerama there anyway.
 + */
 +static void set_output_twinview(Display *dpy, XDevice *dev, param_t *param, 
 int argc, char **argv)

I'd prefer if this were named e.g. 'set_output_xinerama' since there
is nothing inherently TwinView-related in it.

 +{
 +       char *output_name;
 +       int event, error;
 +       XineramaScreenInfo *screens;
 +       int nscreens;
 +       int head;
 +
 +       if (!XineramaQueryExtension(dpy, event, error))
 +       {
 +               fprintf(stderr, Unable to set screen mapping. Xinerama 
 extension not found\n);
 +               return;
 +       }
 +
 +       output_name = argv[0];
 +       if (strncmp(output_name, HEAD-, 5) != 0)
 +       {
 +               fprintf(stderr, Please specify the output name as HEAD-0 or 
 HEAD-1\n);
 +               return;
 +       }
 +
 +       head = output_name[5] - '0';
 +       if (head != 0  head != 1)
 +       {
 +               fprintf(stderr, Please specify the output name as HEAD-0 or 
 HEAD-1\n);
 +               return;
 +       }
 +
 +       screens = XineramaQueryScreens(dpy, nscreens);
 +
 +       if (nscreens == 0)
 +       {
 +               fprintf(stderr, Xinerama failed to query screens.\n);
 +               goto out;
 +       } else if (nscreens != 2)
 +       {
 +               fprintf(stderr, Found %d screens, but this command requires 
 exactly 2.\n, nscreens);
 +               goto out;
 +       }

My code uses convert_value_from_user to allow an arbitrary (positive)
integer as a head number. That's definitely overkill, but supporting
up to 10 heads (still probably overkill) would require only a trivial
change to this code and work with the rarer tri- and quad-head setups.

 +
 +       _set_matrix(dpy, dev,
 +                   screens[head].x_org, screens[head].y_org,
 +                   screens[head].width, screens[head].height);
 +
 +out:
 +       XFree(screens);
 +}
 +
  static void set_output(Display *dpy, XDevice *dev, param_t *param, int argc, 
 char **argv)
  {
 +       int opcode, event, error;
 +
        if (argc != param-arg_count)
        {
                

[Linuxwacom-devel] 50-wacom-conf issues

2011-06-20 Thread Favux ...
Just a heads up.  We just finished setting up unclepedro's Thinkpad
X220t (first usb instead of ISDV4 Thinkpad) in Ubuntu 11.04 (Natty
Narwhal) on Ubuntu forums.  According to xinput list the kernel is
exporting the two parent devices as:

ISD-V4 Pen
ISD-V4 Finger

So we had to add the keyword ISD-V4 to the MatchProduct line:

MatchProduct Wacom|WACOM|ISD-V4|Hanwang

Any thoughts on how to handle this?


Also the Waltop tablets seem to be working fine on xf86-input-wacom
with kernel 2.6.38 thanks to Nikolai Kondrashov's kernel patches.  I'm
thinking it is time to add Waltop back into the match line:

MatchProduct Wacom|WACOM|WALTOP|Hanwang

Any objections?

Favux

--
EditLive Enterprise is the world's most technically advanced content
authoring tool. Experience the power of Track Changes, Inline Image
Editing and ensure content is compliant with Accessibility Checking.
http://p.sf.net/sfu/ephox-dev2dev
___
Linuxwacom-devel mailing list
Linuxwacom-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel


[Linuxwacom-devel] [PATCH] Silent compiler

2011-06-20 Thread Ping Cheng
Initialize rotation to ROTATE_NONE so compiler won't complain.

Signed-off-by: Ping Cheng pingl...@gmail.com
---
 src/wcmValidateDevice.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/wcmValidateDevice.c b/src/wcmValidateDevice.c
index 409a42f..e2598cb 100644
--- a/src/wcmValidateDevice.c
+++ b/src/wcmValidateDevice.c
@@ -719,7 +719,7 @@ Bool wcmParseOptions(InputInfoPtr pInfo, Bool is_primary, 
Bool is_dependent)
 
if (s)
{
-   int rotation;
+   int rotation = ROTATE_NONE;
 
if (xf86NameCmp(s, CW) == 0)
rotation = ROTATE_CW;
-- 
1.7.5.4


--
EditLive Enterprise is the world's most technically advanced content
authoring tool. Experience the power of Track Changes, Inline Image
Editing and ensure content is compliant with Accessibility Checking.
http://p.sf.net/sfu/ephox-dev2dev
___
Linuxwacom-devel mailing list
Linuxwacom-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel


Re: [Linuxwacom-devel] 50-wacom-conf issues

2011-06-20 Thread Peter A. H. Peterson
Quoting Favux ...:
 Just a heads up.  We just finished setting up unclepedro's Thinkpad
 X220t (first usb instead of ISDV4 Thinkpad) in Ubuntu 11.04 (Natty
 Narwhal) on Ubuntu forums.  According to xinput list the kernel is
 exporting the two parent devices as:
 
 ISD-V4 Pen
 ISD-V4 Finger
 
 So we had to add the keyword ISD-V4 to the MatchProduct line:
 
 MatchProduct Wacom|WACOM|ISD-V4|Hanwang
 
 Any thoughts on how to handle this?

I honestly know nothing about how any Xorg/wacom internals work, but
I'm very thankful for the work of this crew, and I'm certainly willing
to do some testing for folks. I'm planning to set up a small testing
partition or two so that I can boot into an OS I can hose without
being too disappointed. :)

Anyway, send me a message if you need anything, and I will also plan
to report here (and elsewhere) as I run into any issues.

Thanks again to Favux for all the help.

pedro

-- 
Peter A. H. Peterson
Graduate Student Researcher
Laboratory for Advanced Systems Research
University of California, Los Angeles

--
EditLive Enterprise is the world's most technically advanced content
authoring tool. Experience the power of Track Changes, Inline Image
Editing and ensure content is compliant with Accessibility Checking.
http://p.sf.net/sfu/ephox-dev2dev
___
Linuxwacom-devel mailing list
Linuxwacom-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel


Re: [Linuxwacom-devel] 50-wacom-conf issues

2011-06-20 Thread Peter Hutterer
On Mon, Jun 20, 2011 at 01:24:53PM -0500, Favux ... wrote:
 Just a heads up.  We just finished setting up unclepedro's Thinkpad
 X220t (first usb instead of ISDV4 Thinkpad) in Ubuntu 11.04 (Natty
 Narwhal) on Ubuntu forums.  According to xinput list the kernel is
 exporting the two parent devices as:
 
 ISD-V4 Pen
 ISD-V4 Finger
 
 So we had to add the keyword ISD-V4 to the MatchProduct line:
 
 MatchProduct Wacom|WACOM|ISD-V4|Hanwang
 
 Any thoughts on how to handle this?
 
 
 Also the Waltop tablets seem to be working fine on xf86-input-wacom
 with kernel 2.6.38 thanks to Nikolai Kondrashov's kernel patches.  I'm
 thinking it is time to add Waltop back into the match line:
 
 MatchProduct Wacom|WACOM|WALTOP|Hanwang
 
 Any objections?

sounds good, please send me a patch so I can merge this in again.

Cheers,
  Peter

--
EditLive Enterprise is the world's most technically advanced content
authoring tool. Experience the power of Track Changes, Inline Image
Editing and ensure content is compliant with Accessibility Checking.
http://p.sf.net/sfu/ephox-dev2dev
___
Linuxwacom-devel mailing list
Linuxwacom-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel


Re: [Linuxwacom-devel] 50-wacom-conf issues

2011-06-20 Thread Ping Cheng
On Mon, Jun 20, 2011 at 11:24 AM, Favux ... favux...@gmail.com wrote:

 Just a heads up.  We just finished setting up unclepedro's Thinkpad
 X220t (first usb instead of ISDV4 Thinkpad) in Ubuntu 11.04 (Natty
 Narwhal) on Ubuntu forums.  According to xinput list the kernel is
 exporting the two parent devices as:

 ISD-V4 Pen
 ISD-V4 Finger

 So we had to add the keyword ISD-V4 to the MatchProduct line:


ISD-V4 is from the wacom kernel driver. It is for the USB tablet in Lenovo
laptop.

Ping



 MatchProduct Wacom|WACOM|ISD-V4|Hanwang

 Any thoughts on how to handle this?


 Also the Waltop tablets seem to be working fine on xf86-input-wacom
 with kernel 2.6.38 thanks to Nikolai Kondrashov's kernel patches.  I'm
 thinking it is time to add Waltop back into the match line:

 MatchProduct Wacom|WACOM|WALTOP|Hanwang

 Any objections?

 Favux


 --
 EditLive Enterprise is the world's most technically advanced content
 authoring tool. Experience the power of Track Changes, Inline Image
 Editing and ensure content is compliant with Accessibility Checking.
 http://p.sf.net/sfu/ephox-dev2dev
 ___
 Linuxwacom-devel mailing list
 Linuxwacom-devel@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel

--
EditLive Enterprise is the world's most technically advanced content
authoring tool. Experience the power of Track Changes, Inline Image
Editing and ensure content is compliant with Accessibility Checking.
http://p.sf.net/sfu/ephox-dev2dev___
Linuxwacom-devel mailing list
Linuxwacom-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel