Re: [PATCH xserver v2.1] os: Treat ssh as a non-local client (v2)

2015-12-11 Thread Michel Dänzer
On 11.12.2015 18:17, Martin Peres wrote:
> On 11/12/15 04:34, Michel Dänzer wrote:
>> From: Adam Jackson 
>>
>> By the time we get to ComputeLocalClient, we've already done
>> NextAvailableClient → ReserveClientIds → DetermineClientCmd (assuming
>> we're built with #define CLIENTIDS), so we can look up the name of the
>> client process and refuse to treat ssh's X forwarding as if it were
>> local.
>>
>> v2: (Michel Dänzer)
>>  * Only match "ssh" itself, not other executable names starting with
>>that prefix.
>>  * Ignore executable path for the match.
>>
>> Signed-off-by: Adam Jackson 
>> Signed-off-by: Michel Dänzer 
>> ---
>>
>> v2.1: Slightly extended code comment
>>
>>   os/access.c | 29 ++---
>>   1 file changed, 26 insertions(+), 3 deletions(-)
>>
>> diff --git a/os/access.c b/os/access.c
>> index 10a48c3..3e32128 100644
>> --- a/os/access.c
>> +++ b/os/access.c
>> @@ -101,6 +101,7 @@ SOFTWARE.
>>   #include 
>>   #include 
>>   #include 
>> +#include 
>> #ifndef NO_LOCAL_CLIENT_CRED
>>   #include 
>> @@ -1081,9 +1082,8 @@ ResetHosts(const char *display)
>>   }
>>   }
>>   -/* Is client on the local host */
>> -Bool
>> -ComputeLocalClient(ClientPtr client)
>> +static Bool
>> +xtransLocalClient(ClientPtr client)
>>   {
>>   int alen, family, notused;
>>   Xtransaddr *from = NULL;
>> @@ -1116,6 +1116,29 @@ ComputeLocalClient(ClientPtr client)
>>   return FALSE;
>>   }
>>   +/* Is client on the local host */
>> +Bool
>> +ComputeLocalClient(ClientPtr client)
>> +{
>> +if (!xtransLocalClient(client))
>> +return FALSE;
>> +
>> +#ifndef WIN32
> Why add this ifndef?

Because libgen.h and basename() aren't available on Windows AFAICT. I
figured this use case probably isn't common enough on Windows anyway to
bother making it work there as well.


> And why all clients of an xserver running on windows should be
> considered local?

You misread the patch. There's no change in behaviour on Windows,
because xtransLocalClient and by extension ComputeLocalClient returns
FALSE in all the same cases ComputeLocalClient did before the patch.


>> +/* If the executable name is "ssh", assume that this client
>> connection
>> + * is forwarded from another host via SSH
>> + */
>> +if (client->clientIds->cmdname) {
>> +char *cmdname = strdup(client->clientIds->cmdname);
>> +Bool ret = strcmp(basename(cmdname), "ssh") != 0;
>> +
>> +free(cmdname);
>> +return ret;
>> +}
>> +#endif
>> +
>> +return TRUE;
>> +}
>> +
>>   /*
>>* Return the uid and all gids of a connected local client
>>* Allocates a LocalClientCredRec - caller must call
>> FreeLocalClientCreds


-- 
Earthling Michel Dänzer   |   http://www.amd.com
Libre software enthusiast | Mesa and X developer
___
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 xserver 4/8] Create a threaded mechanism for input [v3]

2015-12-11 Thread Mark Kettenis
> From: Keith Packard 
> Date: Thu, 10 Dec 2015 07:18:23 -0800
> 
> Mark Kettenis  writes:
> 
> > Ugh.  Exporting global variables as part of the ABI is generally not
> > such a good idea.  Perhaps it is better to use functions to acquire
> > and release the input mutex instead?
> 
> Yeah, it's not a performance sensitive operation, so hiding the globals
> in a function is a good idea. I'll leave the stub versions as static
> inline so I don't have to move them to the new file (inputthread.c)
> later, just redefine them in the header file.
> 
> > Also, using TLS (i.e. __thread variables) isn't portable.  That
> > mechanism certainly isn't supported by all platforms supported by
> > Xorg.
> 
> I can add some autoconf magic to autodetect whether this is supported
> and disable threaded input where it isn't.

Is that really necessary?  If I understand the code correctly, you're
using the __thread variable just to implement a recursive mutex.
There are ways to do that without using a per-thread counter, which
would avoid using the non-portable __thread storage class.

However, is there a reason why you didn't use the
PTHREAD_MUTEX_RECURSIVE mtex type that is standardized by POSIX?
___
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 xserver] xfree86: add NoMatchFoo directives for InputClass sections

2015-12-11 Thread Benjamin Tissoires
On Fri, Dec 11, 2015 at 10:42 AM, Peter Hutterer
 wrote:
> On Fri, Dec 11, 2015 at 09:58:34AM +0100, Benjamin Tissoires wrote:
>> Hi Peter,
>>
>> On Fri, Dec 11, 2015 at 12:58 AM, Peter Hutterer
>>  wrote:
>> > InputClass sections use various MatchFoo directives to decide which device 
>> > to
>> > apply to. This usually works fine for specific snippets but has drawbacks 
>> > for
>> > snippets that apply more generally to a multitude of devices.
>> >
>> > This patch adds a NoMatchFoo directive to negate a match, thus allowing
>> > snippets that only apply if a given condition is not set. Specifically, 
>> > this
>> > allows for more flexible fallback driver matching, it is now possible to 
>> > use a
>> > snippet that says "assign driver foo, but only if driver bar wasn't already
>> > assigned to it". For example:
>> >
>> > Section "InputClass"
>> >Identifier "libinput for tablets"
>> >MatchIsTablet "true"
>> >NoMatchDriver "wacom"
>> >Driver "libinput"
>> > EndSection
>> >
>> > The above only assigns libinput to tablet devices if wacom isn't already
>> > assigned to this device, making it possible to select a specific driver by
>> > installing/uninstalling it.
>> >
>> > Signed-off-by: Peter Hutterer 
>>
>> Thanks, that was quicker than expected :)
>>
>> Just 2 nitpicks/questions:
>>
>> > ---
>> >  hw/xfree86/common/xf86Xinput.c | 15 +
>> >  hw/xfree86/man/xorg.conf.man   | 15 +
>> >  hw/xfree86/parser/InputClass.c | 76 
>> > --
>> >  hw/xfree86/parser/xf86Parser.h |  1 +
>> >  hw/xfree86/parser/xf86tokens.h | 12 ++-
>> >  5 files changed, 102 insertions(+), 17 deletions(-)
>> >
>> > diff --git a/hw/xfree86/common/xf86Xinput.c 
>> > b/hw/xfree86/common/xf86Xinput.c
>> > index c56a2b9..fead782 100644
>> > --- a/hw/xfree86/common/xf86Xinput.c
>> > +++ b/hw/xfree86/common/xf86Xinput.c
>> > @@ -540,21 +540,24 @@ MatchAttrToken(const char *attr, struct xorg_list 
>> > *patterns,
>> >  if (xorg_list_is_empty(patterns))
>> >  return TRUE;
>> >
>> > -/* If there are patterns but no attribute, reject the match */
>> > -if (!attr)
>> > -return FALSE;
>> > -
>> >  /*
>> >   * Otherwise, iterate the list of patterns ensuring each entry has a
>>
>> If we remove the previous comment, we should probably remove the
>> "Otherwise" here.
>
> fixed locally, thanks.
>
>>
>> >   * match. Each list entry is a separate Match line of the same type.
>> >   */
>> >  xorg_list_for_each_entry(group, patterns, entry) {
>> >  char *const *cur;
>> > -Bool match = FALSE;
>> > +Bool is_negated = group->is_negated;
>> > +Bool match = is_negated;
>> > +
>> > +/* If there's a pattern but no attribute, we reject the match for 
>> > a
>> > + * MatchFoo directive, and accept it for a NoMatchFoo directive
>> > + */
>>
>> I don't follow the logic here. Can you explain why a MatchFoo would be
>> rejected while a NoMatchFoo won't? I can't find an example for this
>> situation.
>
> If you have a snippet that says "Match on foo" and you have NULL, we reject
> because foo isn't NULL. If you have a snippet that says "Dont match on foo"
> and you have NULL, we accept because NULL isn't foo :)
>
> I hit this case with this snippet:
> Section "InputClass"
>   NoMatchDriver "libinput"
>   Driver "evdev"
>   ...
> EndSection
>
> If libinput isn't installed and the udev backend doesn't set the driver
> (which it usually doesn't except on some old debian LTS systems), we would
> always reject the match and thus never assign a driver.
>

Oh I see my mistake now. I thought the 'attr' was the string
"libinput" in this example, while it is the currently stored attribute
for this particular matching pattern.

The patch is then:
Reviewed-by: Benjamin Tissoires 

Cheers,
Benjamin

>
>> > +if (!attr)
>> > +return is_negated;
>> >
>> >  for (cur = group->values; *cur; cur++)
>> >  if ((*compare) (attr, *cur) == 0) {
>> > -match = TRUE;
>> > +match = !is_negated;
>> >  break;
>> >  }
>> >  if (!match)
>> > diff --git a/hw/xfree86/man/xorg.conf.man b/hw/xfree86/man/xorg.conf.man
>> > index 08eb7a9..d794df4 100644
>> > --- a/hw/xfree86/man/xorg.conf.man
>> > +++ b/hw/xfree86/man/xorg.conf.man
>> > @@ -1092,6 +1092,7 @@ attribute. For example:
>> >  .B  "# either gizmo or gadget
>> >  .B  "MatchProduct \*qexample\*q
>> >  .B  "MatchProduct \*qgizmo|gadget\*q
>> > +.B  "NoMatchDriver \*qdrivername\*q
>> >  .I  "..."
>> >  .B  "EndSection"
>> >  .fi
>> > @@ -1160,6 +1161,20 @@ if no named
>> >  .B ServerLayout
>> >  sections have been found.
>> >  .PP
>> > +The above directives have equivalents for negative matching with the
>> > +.B 

Re: [PATCH xserver v2.1] os: Treat ssh as a non-local client (v2)

2015-12-11 Thread Emil Velikov
On 11 December 2015 at 10:20, Martin Peres  wrote:
> On 11/12/15 11:30, Michel Dänzer wrote:
>>
>> On 11.12.2015 18:17, Martin Peres wrote:
>>>
>>> On 11/12/15 04:34, Michel Dänzer wrote:

 From: Adam Jackson 

 By the time we get to ComputeLocalClient, we've already done
 NextAvailableClient → ReserveClientIds → DetermineClientCmd (assuming
 we're built with #define CLIENTIDS), so we can look up the name of the
 client process and refuse to treat ssh's X forwarding as if it were
 local.

 v2: (Michel Dänzer)
   * Only match "ssh" itself, not other executable names starting
 with
 that prefix.
   * Ignore executable path for the match.

 Signed-off-by: Adam Jackson 
 Signed-off-by: Michel Dänzer 
 ---

 v2.1: Slightly extended code comment

os/access.c | 29 ++---
1 file changed, 26 insertions(+), 3 deletions(-)

 diff --git a/os/access.c b/os/access.c
 index 10a48c3..3e32128 100644
 --- a/os/access.c
 +++ b/os/access.c
 @@ -101,6 +101,7 @@ SOFTWARE.
#include 
#include 
#include 
 +#include 
  #ifndef NO_LOCAL_CLIENT_CRED
#include 
 @@ -1081,9 +1082,8 @@ ResetHosts(const char *display)
}
}
-/* Is client on the local host */
 -Bool
 -ComputeLocalClient(ClientPtr client)
 +static Bool
 +xtransLocalClient(ClientPtr client)
{
int alen, family, notused;
Xtransaddr *from = NULL;
 @@ -1116,6 +1116,29 @@ ComputeLocalClient(ClientPtr client)
return FALSE;
}
+/* Is client on the local host */
 +Bool
 +ComputeLocalClient(ClientPtr client)
 +{
 +if (!xtransLocalClient(client))
 +return FALSE;
 +
 +#ifndef WIN32
>>>
>>> Why add this ifndef?
>>
>> Because libgen.h and basename() aren't available on Windows AFAICT. I
>> figured this use case probably isn't common enough on Windows anyway to
>> bother making it work there as well.
>
>
> You are right, basename is a POSIX function and mingw does expose it, but it
> turns out msvc does not. As you said, it is probably not worth the effort to
> add msvc support that no-one will be able to test anyway.
>
There's no (intentional) MSVC or mingw support in xserver that I know
of - only Cygwin. There is also the GNU version of the function
(#define _GNU_SOURCE + #include ) although I'm not sure if
Cygwin has either of them. I'd assume Jon can follow up as needed.

-Emil
___
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 xserver v2.1] os: Treat ssh as a non-local client (v2)

2015-12-11 Thread Martin Peres

On 11/12/15 11:30, Michel Dänzer wrote:

On 11.12.2015 18:17, Martin Peres wrote:

On 11/12/15 04:34, Michel Dänzer wrote:

From: Adam Jackson 

By the time we get to ComputeLocalClient, we've already done
NextAvailableClient → ReserveClientIds → DetermineClientCmd (assuming
we're built with #define CLIENTIDS), so we can look up the name of the
client process and refuse to treat ssh's X forwarding as if it were
local.

v2: (Michel Dänzer)
  * Only match "ssh" itself, not other executable names starting with
that prefix.
  * Ignore executable path for the match.

Signed-off-by: Adam Jackson 
Signed-off-by: Michel Dänzer 
---

v2.1: Slightly extended code comment

   os/access.c | 29 ++---
   1 file changed, 26 insertions(+), 3 deletions(-)

diff --git a/os/access.c b/os/access.c
index 10a48c3..3e32128 100644
--- a/os/access.c
+++ b/os/access.c
@@ -101,6 +101,7 @@ SOFTWARE.
   #include 
   #include 
   #include 
+#include 
 #ifndef NO_LOCAL_CLIENT_CRED
   #include 
@@ -1081,9 +1082,8 @@ ResetHosts(const char *display)
   }
   }
   -/* Is client on the local host */
-Bool
-ComputeLocalClient(ClientPtr client)
+static Bool
+xtransLocalClient(ClientPtr client)
   {
   int alen, family, notused;
   Xtransaddr *from = NULL;
@@ -1116,6 +1116,29 @@ ComputeLocalClient(ClientPtr client)
   return FALSE;
   }
   +/* Is client on the local host */
+Bool
+ComputeLocalClient(ClientPtr client)
+{
+if (!xtransLocalClient(client))
+return FALSE;
+
+#ifndef WIN32

Why add this ifndef?

Because libgen.h and basename() aren't available on Windows AFAICT. I
figured this use case probably isn't common enough on Windows anyway to
bother making it work there as well.


You are right, basename is a POSIX function and mingw does expose it, 
but it turns out msvc does not. As you said, it is probably not worth 
the effort to add msvc support that no-one will be able to test anyway.





And why all clients of an xserver running on windows should be
considered local?

You misread the patch. There's no change in behaviour on Windows,
because xtransLocalClient and by extension ComputeLocalClient returns
FALSE in all the same cases ComputeLocalClient did before the patch.


Yes, indeed. The added code is just filtering one more case.

Reviewed-by: Martin Peres 





+/* If the executable name is "ssh", assume that this client
connection
+ * is forwarded from another host via SSH
+ */
+if (client->clientIds->cmdname) {
+char *cmdname = strdup(client->clientIds->cmdname);
+Bool ret = strcmp(basename(cmdname), "ssh") != 0;
+
+free(cmdname);
+return ret;
+}
+#endif
+
+return TRUE;
+}
+
   /*
* Return the uid and all gids of a connected local client
* Allocates a LocalClientCredRec - caller must call
FreeLocalClientCreds




___
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 inputproto] specs: Set TZ=UTC before calling asciidoc

2015-12-11 Thread Andreas Boll
2015-12-11 10:20 GMT+01:00 Uli Schlachter :
> Am 10.12.2015 um 21:25 schrieb Andreas Boll:
>> Set TZ=UTC before calling asciidoc to make the embedded dates invariant
>> to timezones in order to make the package build reproducibly.
>>
>> Fixes bug:
>> https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=795981
>>
>> Suggested-by: Eduard Sanou 
>> Signed-off-by: Andreas Boll 
>> ---
>>  specs/Makefile.am | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/specs/Makefile.am b/specs/Makefile.am
>> index a83cf40..d04f4d0 100644
>> --- a/specs/Makefile.am
>> +++ b/specs/Makefile.am
>> @@ -6,7 +6,7 @@ doc_DATA = XI2proto.html XIproto.html
>>  dist_doc_DATA = XI2proto.txt XIproto.txt
>>
>>  %.html: %.txt
>> - $(AM_V_GEN)$(ASCIIDOC) -o $@ $<
>> + TZ=UTC $(AM_V_GEN)$(ASCIIDOC) -o $@ $<
>
> Shouldn't this be $(AM_V_GEN)TZ=UTC $(ASCIIDOC) -o $@ $
> $(AM_V_GEN) can evaluate to '@echo "  GEN" $@;' which would break the 
> build
> (make wouldn't see the @-prefix and your env var is only passed to echo)
>
Indeed, fixed in v2
We tested this only on verbose builds.

Thanks for the review,
Andreas


>>
>>  CLEANFILES = $(doc_DATA)
>>
>>
>
> Uli
> --
> A normal person is just someone you don't know well enough yet.
>  - Nettie Wiebe
___
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 xserver] xfree86: add NoMatchFoo directives for InputClass sections

2015-12-11 Thread Peter Hutterer
On Fri, Dec 11, 2015 at 09:58:34AM +0100, Benjamin Tissoires wrote:
> Hi Peter,
> 
> On Fri, Dec 11, 2015 at 12:58 AM, Peter Hutterer
>  wrote:
> > InputClass sections use various MatchFoo directives to decide which device 
> > to
> > apply to. This usually works fine for specific snippets but has drawbacks 
> > for
> > snippets that apply more generally to a multitude of devices.
> >
> > This patch adds a NoMatchFoo directive to negate a match, thus allowing
> > snippets that only apply if a given condition is not set. Specifically, this
> > allows for more flexible fallback driver matching, it is now possible to 
> > use a
> > snippet that says "assign driver foo, but only if driver bar wasn't already
> > assigned to it". For example:
> >
> > Section "InputClass"
> >Identifier "libinput for tablets"
> >MatchIsTablet "true"
> >NoMatchDriver "wacom"
> >Driver "libinput"
> > EndSection
> >
> > The above only assigns libinput to tablet devices if wacom isn't already
> > assigned to this device, making it possible to select a specific driver by
> > installing/uninstalling it.
> >
> > Signed-off-by: Peter Hutterer 
> 
> Thanks, that was quicker than expected :)
> 
> Just 2 nitpicks/questions:
> 
> > ---
> >  hw/xfree86/common/xf86Xinput.c | 15 +
> >  hw/xfree86/man/xorg.conf.man   | 15 +
> >  hw/xfree86/parser/InputClass.c | 76 
> > --
> >  hw/xfree86/parser/xf86Parser.h |  1 +
> >  hw/xfree86/parser/xf86tokens.h | 12 ++-
> >  5 files changed, 102 insertions(+), 17 deletions(-)
> >
> > diff --git a/hw/xfree86/common/xf86Xinput.c b/hw/xfree86/common/xf86Xinput.c
> > index c56a2b9..fead782 100644
> > --- a/hw/xfree86/common/xf86Xinput.c
> > +++ b/hw/xfree86/common/xf86Xinput.c
> > @@ -540,21 +540,24 @@ MatchAttrToken(const char *attr, struct xorg_list 
> > *patterns,
> >  if (xorg_list_is_empty(patterns))
> >  return TRUE;
> >
> > -/* If there are patterns but no attribute, reject the match */
> > -if (!attr)
> > -return FALSE;
> > -
> >  /*
> >   * Otherwise, iterate the list of patterns ensuring each entry has a
> 
> If we remove the previous comment, we should probably remove the
> "Otherwise" here.

fixed locally, thanks.

> 
> >   * match. Each list entry is a separate Match line of the same type.
> >   */
> >  xorg_list_for_each_entry(group, patterns, entry) {
> >  char *const *cur;
> > -Bool match = FALSE;
> > +Bool is_negated = group->is_negated;
> > +Bool match = is_negated;
> > +
> > +/* If there's a pattern but no attribute, we reject the match for a
> > + * MatchFoo directive, and accept it for a NoMatchFoo directive
> > + */
> 
> I don't follow the logic here. Can you explain why a MatchFoo would be
> rejected while a NoMatchFoo won't? I can't find an example for this
> situation.

If you have a snippet that says "Match on foo" and you have NULL, we reject
because foo isn't NULL. If you have a snippet that says "Dont match on foo"
and you have NULL, we accept because NULL isn't foo :)

I hit this case with this snippet:
Section "InputClass"
  NoMatchDriver "libinput"
  Driver "evdev"
  ...
EndSection

If libinput isn't installed and the udev backend doesn't set the driver
(which it usually doesn't except on some old debian LTS systems), we would
always reject the match and thus never assign a driver.

Cheers,
   Peter


> > +if (!attr)
> > +return is_negated;
> >
> >  for (cur = group->values; *cur; cur++)
> >  if ((*compare) (attr, *cur) == 0) {
> > -match = TRUE;
> > +match = !is_negated;
> >  break;
> >  }
> >  if (!match)
> > diff --git a/hw/xfree86/man/xorg.conf.man b/hw/xfree86/man/xorg.conf.man
> > index 08eb7a9..d794df4 100644
> > --- a/hw/xfree86/man/xorg.conf.man
> > +++ b/hw/xfree86/man/xorg.conf.man
> > @@ -1092,6 +1092,7 @@ attribute. For example:
> >  .B  "# either gizmo or gadget
> >  .B  "MatchProduct \*qexample\*q
> >  .B  "MatchProduct \*qgizmo|gadget\*q
> > +.B  "NoMatchDriver \*qdrivername\*q
> >  .I  "..."
> >  .B  "EndSection"
> >  .fi
> > @@ -1160,6 +1161,20 @@ if no named
> >  .B ServerLayout
> >  sections have been found.
> >  .PP
> > +The above directives have equivalents for negative matching with the
> > +.B NoMatchProduct,
> > +.B NoMatchVendor,
> > +.B NoMatchDevicePath,
> > +.B NoMatchOS,
> > +.B NoMatchPnPID,
> > +.B NoMatchUSBID,
> > +.B NoMatchDriver,
> > +.B NoMatchTag,
> > +and
> > +.B NoMatchLayout
> > +directives. These NoMatch directives match if the subsequent match is not
> > +met by the device.
> > +.PP
> >  The second type of entry is used to match device types. These entries take 
> > a
> >  boolean argument similar to
> >  .B Option
> > diff --git a/hw/xfree86/parser/InputClass.c 

[PATCH xserver] modesetting: Consume all available udev events at once

2015-12-11 Thread Daniel Martin
From: Daniel Martin 

We get multiple udev events for actions like docking a laptop into its
station or plugging a monitor to the station. By consuming as much
events as we can, we reduce the number of output re-evalutions.

I.e. having a Lenovo X250 in a ThinkPad Ultra Dock and plugging a
monitor to the station generates 5 udev events. Or having 2 monitors
attached to the station and docking the laptop generates 7 events.

It depends on the timing how many events can consumed at once.

Signed-off-by: Daniel Martin 
---
 hw/xfree86/drivers/modesetting/drmmode_display.c | 13 +++--
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/hw/xfree86/drivers/modesetting/drmmode_display.c 
b/hw/xfree86/drivers/modesetting/drmmode_display.c
index 0d34ca1..eeccb82 100644
--- a/hw/xfree86/drivers/modesetting/drmmode_display.c
+++ b/hw/xfree86/drivers/modesetting/drmmode_display.c
@@ -1944,16 +1944,19 @@ drmmode_handle_uevents(int fd, void *closure)
 drmModeResPtr mode_res;
 xf86CrtcConfigPtr  config = XF86_CRTC_CONFIG_PTR(scrn);
 int i, j;
-Bool found;
+Bool found = FALSE;
 Bool changed = FALSE;
 
-dev = udev_monitor_receive_device(drmmode->uevent_monitor);
-if (!dev)
+while ((dev = udev_monitor_receive_device(drmmode->uevent_monitor))) {
+udev_device_unref(dev);
+found = TRUE;
+}
+if (!found)
 return;
 
 mode_res = drmModeGetResources(drmmode->fd);
 if (!mode_res)
-goto out;
+return;
 
 if (mode_res->count_crtcs != config->num_crtc) {
 ErrorF("number of CRTCs changed - failed to handle, %d vs %d\n", 
mode_res->count_crtcs, config->num_crtc);
@@ -2012,9 +2015,7 @@ drmmode_handle_uevents(int fd, void *closure)
 
 out_free_res:
 drmModeFreeResources(mode_res);
-out:
 RRGetInfo(xf86ScrnToScreen(scrn), TRUE);
-udev_device_unref(dev);
 }
 #endif
 
-- 
2.6.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 inputproto] specs: Set TZ=UTC before calling asciidoc

2015-12-11 Thread Andreas Boll
Set TZ=UTC before calling asciidoc to make the embedded dates invariant
to timezones in order to make the package build reproducibly.

Fixes bug:
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=795981

v2: Set TZ=UTC after $(AM_V_GEN) (fixes non-verbose build)

Suggested-by: Eduard Sanou 
Signed-off-by: Andreas Boll 
---
 specs/Makefile.am | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/specs/Makefile.am b/specs/Makefile.am
index a83cf40..f2454bc 100644
--- a/specs/Makefile.am
+++ b/specs/Makefile.am
@@ -6,7 +6,7 @@ doc_DATA = XI2proto.html XIproto.html
 dist_doc_DATA = XI2proto.txt XIproto.txt
 
 %.html: %.txt
-   $(AM_V_GEN)$(ASCIIDOC) -o $@ $<
+   $(AM_V_GEN)TZ=UTC $(ASCIIDOC) -o $@ $<
 
 CLEANFILES = $(doc_DATA)
 
-- 
2.1.4

___
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 kdrive/ephyr v7 6/9] kdrive: don't let evdev driver overwrite existing device names

2015-12-11 Thread Laércio de Sousa
KDrive evdev driver deliberately name grabbed devices as "Evdev mouse"
or "Evdev keyboard". This patch will make it skip this step if
grabbed devices are already named (i.e. from udev).

Signed-off-by: Laércio de Sousa 
---
 hw/kdrive/linux/evdev.c | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/hw/kdrive/linux/evdev.c b/hw/kdrive/linux/evdev.c
index fecbae4..57a6dbf 100644
--- a/hw/kdrive/linux/evdev.c
+++ b/hw/kdrive/linux/evdev.c
@@ -220,7 +220,8 @@ EvdevPtrInit(KdPointerInfo * pi)
 
 close(fd);
 
-pi->name = strdup("Evdev mouse");
+if (!pi->name)
+pi->name = strdup("Evdev mouse");
 
 return Success;
 }
@@ -390,7 +391,8 @@ EvdevKbdInit(KdKeyboardInfo * ki)
 
 close(fd);
 
-ki->name = strdup("Evdev keyboard");
+if (!ki->name)
+ki->name = strdup("Evdev keyboard");
 
 readMapping(ki);
 
-- 
2.1.4

___
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 kdrive/ephyr v7 4/9] kdrive: update evdev keyboard LEDs (#22302)

2015-12-11 Thread Laércio de Sousa
From: Mikhail Krivtsov 

When one hits {Num,Caps,Scroll}Lock key on a Xephyr's keyboard,
keyboard itself works as expected but LEDs are not updated
and always stay in off.

Currently logical LEDs are propagated to physical keyboard LEDs
for "CoreKeyboard" only. All "kdrive" keyboards are not
"CoreKeyboard" and LEDs of "kdrive" keyboards are always "dead".

One possible solution is cloning "CoreKeyboard" LEDs to all
"kdrive" keyboards.

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

Signed-off-by: Laércio de Sousa 
---
 hw/kdrive/linux/evdev.c | 11 ---
 hw/kdrive/src/kinput.c  | 23 +++
 2 files changed, 31 insertions(+), 3 deletions(-)

diff --git a/hw/kdrive/linux/evdev.c b/hw/kdrive/linux/evdev.c
index 63e8409..fecbae4 100644
--- a/hw/kdrive/linux/evdev.c
+++ b/hw/kdrive/linux/evdev.c
@@ -440,10 +440,16 @@ EvdevKbdEnable(KdKeyboardInfo * ki)
 static void
 EvdevKbdLeds(KdKeyboardInfo * ki, int leds)
 {
-/*struct input_event event;
+struct input_event event;
 Kevdev *ke;
+if (!ki) return; // This shouldn't happen but just for safety.
 
-ki->driverPrivate = ke;
+ke = ki->driverPrivate;
+if (!ke) {
+   ErrorF("[%s:%u:%s] can't update LEDs of _disabled_ evdev keyboard\n",
+   __FILE__, __LINE__, __FUNCTION__);
+   return;
+}
 
 memset(, 0, sizeof(event));
 
@@ -466,7 +472,6 @@ EvdevKbdLeds(KdKeyboardInfo * ki, int leds)
 event.code = LED_COMPOSE;
 event.value = leds & (1 << 3) ? 1 : 0;
 write(ke->fd, (char *) , sizeof(event));
-*/
 }
 
 static void
diff --git a/hw/kdrive/src/kinput.c b/hw/kdrive/src/kinput.c
index 682b63a..e9a5f24 100644
--- a/hw/kdrive/src/kinput.c
+++ b/hw/kdrive/src/kinput.c
@@ -618,6 +618,28 @@ KdSetLed(KdKeyboardInfo * ki, int led, Bool on)
 KdSetLeds(ki, ki->dixdev->kbdfeed->ctrl.leds);
 }
 
+/*
+ * For unknown reason, logical keyboard LEDs are propagated to physical
+ * keyboard LEDs for "CoreKeyboard" only. All "kdrive" keyboards are
+ * not "CoreKeyboard" and LEDs of "kdrive" keyboards are always "dead".
+ * As workaround, the following function will clone "CoreKeyboard" LEDs
+ * to all "kdrive" keyboards.
+ */
+static void
+KdCloneCoreLEDs(void)
+{
+DeviceIntPtr pCoreKeyboard = inputInfo.keyboard;
+if (pCoreKeyboard && pCoreKeyboard->kbdfeed) {
+   Leds leds = pCoreKeyboard->kbdfeed->ctrl.leds;
+   KdKeyboardInfo *tmp;
+   for (tmp = kdKeyboards; tmp; tmp = tmp->next) {
+   if (tmp->leds != leds) {
+KdSetLeds(tmp, tmp->leds = leds);
+   }
+}
+}
+}
+
 void
 KdSetPointerMatrix(KdPointerMatrix * matrix)
 {
@@ -2163,6 +2185,7 @@ ProcessInputEvents(void)
 if (kdSwitchPending)
 KdProcessSwitch();
 KdCheckLock();
+KdCloneCoreLEDs();
 }
 
 /* At the moment, absolute/relative is up to the client. */
-- 
2.1.4

___
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 kdrive/ephyr v7 8/9] ephyr: ignore "-novtswitch", "-sharevts", and "-layout seatXXX" command-line options

2015-12-11 Thread Laércio de Sousa
Multi-seat-capable display managers commonly pass command-line options
like "-novtswitch", "-sharevts", or "-layout seat" to Xorg server, but 
Xephyr
currently refuses to start if these options are passed to it,
which may break Xephyr-based single-GPU multiseat setups.

Signed-off-by: Laércio de Sousa 
---
 hw/kdrive/ephyr/ephyrinit.c | 7 +++
 1 file changed, 7 insertions(+)

diff --git a/hw/kdrive/ephyr/ephyrinit.c b/hw/kdrive/ephyr/ephyrinit.c
index d86baf2..09ada96 100644
--- a/hw/kdrive/ephyr/ephyrinit.c
+++ b/hw/kdrive/ephyr/ephyrinit.c
@@ -369,6 +369,13 @@ ddxProcessArgument(int argc, char **argv, int i)
 EphyrWantNoHostGrab = 1;
 return 1;
 }
+else if (!strcmp(argv[i], "-sharevts") || 
+ !strcmp(argv[i], "-novtswitch")) {
+return 1;
+}
+else if (!strcmp(argv[i], "-layout")) {
+return 2;
+}
 
 return KdProcessArgument(argc, argv, i);
 }
-- 
2.1.4

___
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 kdrive/ephyr v7 0/9] Xephyr input hot-plugging support and other additions for single-GPU multi-seat

2015-12-11 Thread Laércio de Sousa
PLEASE NOTE: Xephyr is NOT my preferred approach for single-GPU
multi-seat configuration (mainly due to its current evdev-based
limited support for handling input devices --- no touchpads,
no touchscreens, no joysticks), but it's the easiest one to implement
in the moment. The best approach by far (in Linux specifically) would
require KMS device node splitting, as proposed in
https://dvdhrm.wordpress.com/2013/09/01/splitting-drm-and-kms-device-nodes/.
Until such a solution is completely implemented and supported by
video drivers, the most common approach for single-GPU multi-seat
configuration is based on nested X servers, i.e. a bare Xorg server
spanning all desired video outputs, on top of which we launch a nested
X server for each output. My preferred approach in this case would be
Xorg itself with xf86-video-nested driver, but the latter is currently
unmaintained, and I have no knowledge about video drivers and no spare time
to maintain it. The other approach (historically the most used one)
is Xephyr: it's currently actively maintained, it has reasonable graphics
performance (compared to xf86-video-nested) and it has a minimal support for
input devices (keyboard and mouse only), but it still have some gaps
for a more comfortable multi-seat configuration. This patch series
intend to fill them.

This is the v7 of patch series which provides some missing parts
for full single-GPU multi-seat support in Xephyr. The main difference
to v6 is that now ephyr input driver for kdrive won't be loaded
in multi-seat mode, i.e. if -seat option is passed to Xephyr, so that
it'll handle only its seat's input hardware. In this version, we've
also dropped patch to add command-line options -host-display and
-host-auth for Xephyr (use "env DISPLAY=... XAUTHORITY=... Xephyr" instead).

Example of Xephyr-based seat configuration in LightDM 1.12 or newer based
on this patch series (provided that a bare X server on display number :90,
with two outputs named LVDS and VGA, is already running):

[Seat:seat-LVDS]
xserver-command=env DISPLAY=:90 Xephyr -dpi 96 -sw-cursor -xkbrules evdev 
-xkblayout br -xkbmodel abnt2 -output LVDS

[Seat:seat-VGA]
xserver-command=evn DISPLAY=:90 Xephyr -dpi 96 -sw-cursor -xkbrules evdev 
-xkblayout br -xkbmodel abnt2 -output VGA

** HISTORY **
v6 adds "-novtswitch" to the list of command-line
arguments ignored by Xephyr.

v5 only builds input hot-plugging for kdrive if one
of CONFIG_UDEV or CONFIG_HAL options is enabled.

v4 drops explicit option -input-hotplug. Since input hot-plugging support
in Xephyr is very unlikely to be used outside multi-seat context,
it's now automatically enabled if, and only if, -seat option is passed.

v3 includes two patches: one that introduces a new flag to better
distinguish between real keyboards and other key input devices (so that
kdrive can grab keyboards only), and another one that prevents kdrive
evdev driver from deliberately renaming keyboard and pointer devices
if they are already named (e.g. from udev), with potential memory leaks.

v2 fixes some problems found in v1, like double-free errors for some
InputOption objects, and memory corruptions when a USB keyboard or mouse is
unplugged and replugged several times, due to the fact that their FDs may not be
successfully unregistered when they are unplugged. It also brings new patches
for improving NewInputDeviceRequest() implementation in hw/kdrive/src/kinput.c
(making use of KdParseKbdOptions() and KdParsePointerOptions() as requested),
and some other minor changes.

Some patches provide new command-line options to make it
easier to launch Xephyr directly from display manager, rather
than from within a user session.

One of them fixes an issue where Xephyr keyboards' LEDs are not toggled
when NumLock, CapsLock, and ScrollLock are pressed.

The most significant one introduces input hotplugging support for
keyboards and pointers with both hal and udev backends.

Laércio de Sousa (8):
  kdrive: fix up NewInputDeviceRequest() implementation
  kdrive: set "evdev" driver for input devices automatically, if
available.
  kdrive: introduce input hot-plugging support for udev and hal backends
(#33140)
  kdrive: add options to set default XKB properties
  kdrive: don't let evdev driver overwrite existing device names
  config/udev: better distinguish between real keyboards and other key
input devices
  ephyr: ignore "-novtswitch", "-sharevts", and "-layout seatXXX"
command-line options
  ephyr: don't load ephyr input driver if -seat option is passed

Mikhail Krivtsov (1):
  kdrive: update evdev keyboard LEDs (#22302)

 config/hal.c   |   2 +-
 config/udev.c  |   4 +
 config/wscons.c|   2 +-
 hw/kdrive/ephyr/ephyrinit.c|  42 +++--
 hw/kdrive/linux/evdev.c|  17 +-
 hw/kdrive/src/Makefile.am  |   8 +
 hw/kdrive/src/kdrive.c |  79 ++
 hw/kdrive/src/kinfo.c  |   4 +
 hw/kdrive/src/kinput.c | 346 

[PATCH kdrive/ephyr v7 1/9] kdrive: fix up NewInputDeviceRequest() implementation

2015-12-11 Thread Laércio de Sousa
This patch simplifies NewInputDeviceRequest() implementation
in kinput.c, making use of improved KdParseKbdOptions()/KdParsePointerOptions()
and merging several "if (ki)"/"if (pi)" clauses.

Signed-off-by: Laércio de Sousa 
---
 hw/kdrive/src/kinput.c | 76 --
 1 file changed, 30 insertions(+), 46 deletions(-)

diff --git a/hw/kdrive/src/kinput.c b/hw/kdrive/src/kinput.c
index 1fdaa52..980fd3e 100644
--- a/hw/kdrive/src/kinput.c
+++ b/hw/kdrive/src/kinput.c
@@ -1091,6 +1091,8 @@ KdParseKbdOptions(KdKeyboardInfo * ki)
 ki->xkbOptions = strdup(value);
 else if (!strcasecmp(key, "device"))
 ki->path = strdup(value);
+else if (!strcasecmp(key, "driver"))
+ki->driver = KdFindKeyboardDriver(value);
 else
 ErrorF("Kbd option key (%s) of value (%s) not assigned!\n",
key, value);
@@ -1171,18 +1173,20 @@ KdParsePointerOptions(KdPointerInfo * pi)
 const char *key = input_option_get_key(option);
 const char *value = input_option_get_value(option);
 
-if (!strcmp(key, "emulatemiddle"))
+if (!strcasecmp(key, "emulatemiddle"))
 pi->emulateMiddleButton = TRUE;
-else if (!strcmp(key, "noemulatemiddle"))
+else if (!strcasecmp(key, "noemulatemiddle"))
 pi->emulateMiddleButton = FALSE;
-else if (!strcmp(key, "transformcoord"))
+else if (!strcasecmp(key, "transformcoord"))
 pi->transformCoordinates = TRUE;
-else if (!strcmp(key, "rawcoord"))
+else if (!strcasecmp(key, "rawcoord"))
 pi->transformCoordinates = FALSE;
 else if (!strcasecmp(key, "device"))
 pi->path = strdup(value);
 else if (!strcasecmp(key, "protocol"))
 pi->protocol = strdup(value);
+else if (!strcasecmp(key, "driver"))
+pi->driver = KdFindPointerDriver(value);
 else
 ErrorF("Pointer option key (%s) of value (%s) not assigned!\n",
key, value);
@@ -2152,68 +2156,48 @@ NewInputDeviceRequest(InputOption *options, 
InputAttributes * attrs,
 #endif
 }
 
-if (!ki && !pi) {
-ErrorF("unrecognised device identifier!\n");
-return BadValue;
-}
-
-/* FIXME: change this code below to use KdParseKbdOptions and
- * KdParsePointerOptions */
-nt_list_for_each_entry(option, options, list.next) {
-const char *key = input_option_get_key(option);
-const char *value = input_option_get_value(option);
+if (pi) {
+pi->options = options;
+KdParsePointerOptions(pi);
 
-if (strcmp(key, "device") == 0) {
-if (pi && value)
-pi->path = strdup(value);
-else if (ki && value)
-ki->path = strdup(value);
-}
-else if (strcmp(key, "driver") == 0) {
-if (pi) {
-pi->driver = KdFindPointerDriver(value);
-if (!pi->driver) {
-ErrorF("couldn't find driver!\n");
-KdFreePointer(pi);
-return BadValue;
-}
-pi->options = options;
-}
-else if (ki) {
-ki->driver = KdFindKeyboardDriver(value);
-if (!ki->driver) {
-ErrorF("couldn't find driver!\n");
-KdFreeKeyboard(ki);
-return BadValue;
-}
-ki->options = options;
-}
+if (!pi->driver) {
+ErrorF("couldn't find driver!\n");
+KdFreePointer(pi);
+return BadValue;
 }
-}
 
-if (pi) {
 if (KdAddPointer(pi) != Success ||
 ActivateDevice(pi->dixdev, TRUE) != Success ||
 EnableDevice(pi->dixdev, TRUE) != TRUE) {
 ErrorF("couldn't add or enable pointer\n");
 return BadImplementation;
 }
+
+*pdev = pi->dixdev;
 }
 else if (ki) {
+ki->options = options;
+KdParseKbdOptions(ki);
+
+if (!ki->driver) {
+ErrorF("couldn't find driver!\n");
+KdFreeKeyboard(ki);
+return BadValue;
+}
+
 if (KdAddKeyboard(ki) != Success ||
 ActivateDevice(ki->dixdev, TRUE) != Success ||
 EnableDevice(ki->dixdev, TRUE) != TRUE) {
 ErrorF("couldn't add or enable keyboard\n");
 return BadImplementation;
 }
-}
 
-if (pi) {
-*pdev = pi->dixdev;
-}
-else if (ki) {
 *pdev = ki->dixdev;
 }
+else {
+ErrorF("unrecognised device identifier!\n");
+return BadValue;
+}
 
 return Success;
 }
-- 
2.1.4

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

[PATCH kdrive/ephyr v7 2/9] kdrive: set "evdev" driver for input devices automatically, if available.

2015-12-11 Thread Laércio de Sousa
If kdrive input driver "evdev" is available, no other driver was explicitly
set for a given input device, and its kernel device node is /dev/input/event*,
this patch will make kdrive set "evdev" driver automatically for such device.

Signed-off-by: Laércio de Sousa 
---
 hw/kdrive/src/kinput.c | 25 +
 1 file changed, 25 insertions(+)

diff --git a/hw/kdrive/src/kinput.c b/hw/kdrive/src/kinput.c
index 980fd3e..3a1c6a0 100644
--- a/hw/kdrive/src/kinput.c
+++ b/hw/kdrive/src/kinput.c
@@ -51,6 +51,11 @@
 #include "inpututils.h"
 #include "optionstr.h"
 
+#ifdef KDRIVE_EVDEV
+#define DEV_INPUT_EVENT_PREFIX "/dev/input/event"
+#define DEV_INPUT_EVENT_PREFIX_LEN (sizeof(DEV_INPUT_EVENT_PREFIX) - 1)
+#endif
+
 #define AtomFromName(x) MakeAtom(x, strlen(x), 1)
 
 struct KdConfigDevice {
@@ -1097,6 +1102,16 @@ KdParseKbdOptions(KdKeyboardInfo * ki)
 ErrorF("Kbd option key (%s) of value (%s) not assigned!\n",
key, value);
 }
+
+#ifdef KDRIVE_EVDEV
+if (!ki->driver && ki->path != NULL &&
+strncasecmp(ki->path,
+DEV_INPUT_EVENT_PREFIX,
+DEV_INPUT_EVENT_PREFIX_LEN) == 0) {
+ki->driver = KdFindKeyboardDriver("evdev");
+ki->options = input_option_new(ki->options, "driver", "evdev");
+}
+#endif
 }
 
 KdKeyboardInfo *
@@ -1191,6 +1206,16 @@ KdParsePointerOptions(KdPointerInfo * pi)
 ErrorF("Pointer option key (%s) of value (%s) not assigned!\n",
key, value);
 }
+
+#ifdef KDRIVE_EVDEV
+if (!pi->driver && pi->path != NULL &&
+strncasecmp(pi->path,
+DEV_INPUT_EVENT_PREFIX,
+DEV_INPUT_EVENT_PREFIX_LEN) == 0) {
+pi->driver = KdFindPointerDriver("evdev");
+pi->options = input_option_new(pi->options, "driver", "evdev");
+}
+#endif
 }
 
 KdPointerInfo *
-- 
2.1.4

___
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 kdrive/ephyr v7 7/9] config/udev: better distinguish between real keyboards and other key input devices

2015-12-11 Thread Laércio de Sousa
This patch introduces a new flag ATTR_KEY for hotplugged input devices,
so we can better distinguish between real keyboards (i.e. devices with
udev property ID_INPUT_KEYBOARD="1") and other key input devices like
lid switches, power buttons, etc.

All supported hotplug backends (udev, hal, and wscons) will set both
flags ATTR_KEY and ATTR_KEYBOARD for real keyboards, but udev backend
will set ATTR_KEY, but not ATTR_KEYBOARD, for non-keyboard key input
devices (hal and wscons will set both flags in any case). With this
distinction, kdrive input hotplugging mechanism will be allowed to
only grab real keyboards, as other key input devices are currently
not supported.

In order to don't break current behaviour, this patch will replace all
ATTR_KEYBOARD occurrences with ATTR_KEY in hw/xfree86/common/xf86Xinput.c.

Signed-off-by: Laércio de Sousa 
---
 config/hal.c   |  2 +-
 config/udev.c  |  4 
 config/wscons.c|  2 +-
 hw/kdrive/src/kinput.c |  4 +++-
 hw/xfree86/common/xf86Xinput.c |  2 +-
 include/input.h| 13 +++--
 6 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/config/hal.c b/config/hal.c
index ea574ca..c76eced 100644
--- a/config/hal.c
+++ b/config/hal.c
@@ -170,7 +170,7 @@ device_added(LibHalContext * hal_ctx, const char *udi)
 free(hal_tags);
 
 if (libhal_device_query_capability(hal_ctx, udi, "input.keys", NULL))
-attrs.flags |= ATTR_KEYBOARD;
+attrs.flags |= ATTR_KEY | ATTR_KEYBOARD;
 if (libhal_device_query_capability(hal_ctx, udi, "input.mouse", NULL))
 attrs.flags |= ATTR_POINTER;
 if (libhal_device_query_capability(hal_ctx, udi, "input.joystick", NULL))
diff --git a/config/udev.c b/config/udev.c
index 08a954b..1a6e82a 100644
--- a/config/udev.c
+++ b/config/udev.c
@@ -240,6 +240,10 @@ device_added(struct udev_device *udev_device)
 }
 else if (!strcmp(key, "ID_INPUT_KEY")) {
 LOG_PROPERTY(path, key, value);
+attrs.flags |= ATTR_KEY;
+}
+else if (!strcmp(key, "ID_INPUT_KEYBOARD")) {
+LOG_PROPERTY(path, key, value);
 attrs.flags |= ATTR_KEYBOARD;
 }
 else if (!strcmp(key, "ID_INPUT_MOUSE")) {
diff --git a/config/wscons.c b/config/wscons.c
index fb114bd..ee45675 100644
--- a/config/wscons.c
+++ b/config/wscons.c
@@ -163,7 +163,7 @@ wscons_add_keyboard(void)
 }
 
  kbd_config_done:
-attrs.flags |= ATTR_KEYBOARD;
+attrs.flags |= ATTR_KEY | ATTR_KEYBOARD;
 rc = NewInputDeviceRequest(input_options, , );
 if (rc != Success)
 goto unwind;
diff --git a/hw/kdrive/src/kinput.c b/hw/kdrive/src/kinput.c
index 0acf82e..277f6ad 100644
--- a/hw/kdrive/src/kinput.c
+++ b/hw/kdrive/src/kinput.c
@@ -2366,7 +2366,9 @@ NewInputDeviceRequest(InputOption *options, 
InputAttributes * attrs,
 *pdev = ki->dixdev;
 }
 else {
-ErrorF("unrecognised device identifier!\n");
+ErrorF("unrecognised device identifier: %s\n",
+   input_option_get_value(input_option_find(optionsdup,
+"device")));
 input_option_free_list();
 return BadValue;
 }
diff --git a/hw/xfree86/common/xf86Xinput.c b/hw/xfree86/common/xf86Xinput.c
index c56a2b9..b362d27 100644
--- a/hw/xfree86/common/xf86Xinput.c
+++ b/hw/xfree86/common/xf86Xinput.c
@@ -632,7 +632,7 @@ InputClassMatches(const XF86ConfInputClassPtr iclass, const 
InputInfoPtr idev,
 
 /* MatchIs* booleans */
 if (iclass->is_keyboard.set &&
-iclass->is_keyboard.val != ! !(attrs->flags & ATTR_KEYBOARD))
+iclass->is_keyboard.val != ! !(attrs->flags & ATTR_KEY))
 return FALSE;
 if (iclass->is_pointer.set &&
 iclass->is_pointer.val != ! !(attrs->flags & ATTR_POINTER))
diff --git a/include/input.h b/include/input.h
index d8bd9c6..19ef0c9 100644
--- a/include/input.h
+++ b/include/input.h
@@ -230,12 +230,13 @@ typedef struct _InputAttributes {
 uint32_t flags;
 } InputAttributes;
 
-#define ATTR_KEYBOARD (1<<0)
-#define ATTR_POINTER (1<<1)
-#define ATTR_JOYSTICK (1<<2)
-#define ATTR_TABLET (1<<3)
-#define ATTR_TOUCHPAD (1<<4)
-#define ATTR_TOUCHSCREEN (1<<5)
+#define ATTR_KEY (1<<0)
+#define ATTR_KEYBOARD (1<<1)
+#define ATTR_POINTER (1<<2)
+#define ATTR_JOYSTICK (1<<3)
+#define ATTR_TABLET (1<<4)
+#define ATTR_TOUCHPAD (1<<5)
+#define ATTR_TOUCHSCREEN (1<<6)
 
 /* Key/Button has been run through all input processing and events sent to 
clients. */
 #define KEY_PROCESSED 1
-- 
2.1.4

___
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 kdrive/ephyr v7 9/9] ephyr: don't load ephyr input driver if -seat option is passed

2015-12-11 Thread Laércio de Sousa
When used for single-GPU multi-seat purposes, there's no need to
enable ephyr virtual input devices, since Xephyr is supposed to
handle its own hardware devices.

Signed-off-by: Laércio de Sousa 
---
 hw/kdrive/ephyr/ephyrinit.c | 35 ++-
 1 file changed, 18 insertions(+), 17 deletions(-)

diff --git a/hw/kdrive/ephyr/ephyrinit.c b/hw/kdrive/ephyr/ephyrinit.c
index 09ada96..da43382 100644
--- a/hw/kdrive/ephyr/ephyrinit.c
+++ b/hw/kdrive/ephyr/ephyrinit.c
@@ -94,29 +94,30 @@ InitInput(int argc, char **argv)
 KdKeyboardInfo *ki;
 KdPointerInfo *pi;
 
-KdAddKeyboardDriver();
 #ifdef KDRIVE_EVDEV
 KdAddKeyboardDriver();
-#endif
-KdAddPointerDriver();
-#ifdef KDRIVE_EVDEV
 KdAddPointerDriver();
 #endif
 
-if (!kdHasKbd) {
-ki = KdNewKeyboard();
-if (!ki)
-FatalError("Couldn't create Xephyr keyboard\n");
-ki->driver = 
-KdAddKeyboard(ki);
-}
+if (!SeatId) {
+KdAddKeyboardDriver();
+KdAddPointerDriver();
 
-if (!kdHasPointer) {
-pi = KdNewPointer();
-if (!pi)
-FatalError("Couldn't create Xephyr pointer\n");
-pi->driver = 
-KdAddPointer(pi);
+if (!kdHasKbd) {
+ki = KdNewKeyboard();
+if (!ki)
+FatalError("Couldn't create Xephyr keyboard\n");
+ki->driver = 
+KdAddKeyboard(ki);
+}
+
+if (!kdHasPointer) {
+pi = KdNewPointer();
+if (!pi)
+FatalError("Couldn't create Xephyr pointer\n");
+pi->driver = 
+KdAddPointer(pi);
+}
 }
 
 KdInitInput();
-- 
2.1.4

___
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 kdrive/ephyr v7 5/9] kdrive: add options to set default XKB properties

2015-12-11 Thread Laércio de Sousa
This patch introduces convenient command-line options -xkbrules,
-xkbmodel, -xkblayout, -xkbvariant, and -xkboptions, to set default
values for these properties.

These options can be handful in cases where corresponding values can't
be taken from devices' udev properties, and compile-time default
values don't match user locale.

Signed-off-by: Laércio de Sousa 
---
 hw/kdrive/src/kdrive.c | 40 
 hw/kdrive/src/kinput.c | 16 +++-
 2 files changed, 51 insertions(+), 5 deletions(-)

diff --git a/hw/kdrive/src/kdrive.c b/hw/kdrive/src/kdrive.c
index 8930ace..1578458 100644
--- a/hw/kdrive/src/kdrive.c
+++ b/hw/kdrive/src/kdrive.c
@@ -85,6 +85,11 @@ char *kdSwitchCmd;
 DDXPointRec kdOrigin;
 Bool kdHasPointer = FALSE;
 Bool kdHasKbd = FALSE;
+const char *kdGlobalXkbRules = NULL;
+const char *kdGlobalXkbModel = NULL;
+const char *kdGlobalXkbLayout = NULL;
+const char *kdGlobalXkbVariant = NULL;
+const char *kdGlobalXkbOptions = NULL;
 
 static Bool kdCaughtSignal = FALSE;
 
@@ -451,6 +456,11 @@ KdUseMsg(void)
 ("-mouse driver [,n,,options]Specify the pointer driver and its 
options (n is the number of buttons)\n");
 ErrorF
 ("-keybd driver [,,options]  Specify the keyboard driver and its 
options\n");
+ErrorF("-xkbrulesSet default XkbRules value (can be overriden by 
-keybd options)\n");
+ErrorF("-xkbmodelSet default XkbModel value (can be overriden by 
-keybd options)\n");
+ErrorF("-xkblayout   Set default XkbLayout value (can be overriden by 
-keybd options)\n");
+ErrorF("-xkbvariant  Set default XkbVariant value (can be overriden by 
-keybd options)\n");
+ErrorF("-xkboptions  Set default XkbOptions value (can be overriden by 
-keybd options)\n");
 ErrorF("-zaphod  Disable cursor screen switching\n");
 ErrorF("-2button Emulate 3 button mouse\n");
 ErrorF("-3button Disable 3 button mouse emulation\n");
@@ -559,6 +569,36 @@ KdProcessArgument(int argc, char **argv, int i)
 sscanf(argv[i], "vt%2d", ) == 1) {
 return 1;
 }
+if (!strcmp(argv[i], "-xkbrules")) {
+if (i + 1 >= argc)
+UseMsg();
+kdGlobalXkbRules = argv[i + 1];
+return 2;
+}
+if (!strcmp(argv[i], "-xkbmodel")) {
+if (i + 1 >= argc)
+UseMsg();
+kdGlobalXkbModel = argv[i + 1];
+return 2;
+}
+if (!strcmp(argv[i], "-xkblayout")) {
+if (i + 1 >= argc)
+UseMsg();
+kdGlobalXkbLayout = argv[i + 1];
+return 2;
+}
+if (!strcmp(argv[i], "-xkbvariant")) {
+if (i + 1 >= argc)
+UseMsg();
+kdGlobalXkbVariant = argv[i + 1];
+return 2;
+}
+if (!strcmp(argv[i], "-xkboptions")) {
+if (i + 1 >= argc)
+UseMsg();
+kdGlobalXkbOptions = argv[i + 1];
+return 2;
+}
 if (!strcmp(argv[i], "-mouse") || !strcmp(argv[i], "-pointer")) {
 if (i + 1 >= argc)
 UseMsg();
diff --git a/hw/kdrive/src/kinput.c b/hw/kdrive/src/kinput.c
index e9a5f24..0acf82e 100644
--- a/hw/kdrive/src/kinput.c
+++ b/hw/kdrive/src/kinput.c
@@ -102,6 +102,12 @@ static int kdNumInputFds;
 
 extern Bool kdRawPointerCoordinates;
 
+extern const char *kdGlobalXkbRules;
+extern const char *kdGlobalXkbModel;
+extern const char *kdGlobalXkbLayout;
+extern const char *kdGlobalXkbVariant;
+extern const char *kdGlobalXkbOptions;
+
 static void
 KdSigio(int sig)
 {
@@ -931,11 +937,11 @@ KdNewKeyboard(void)
 ki->options = NULL;
 ki->name = strdup("Generic Keyboard");
 ki->path = NULL;
-ki->xkbRules = strdup(XKB_DFLT_RULES);
-ki->xkbModel = strdup(XKB_DFLT_MODEL);
-ki->xkbLayout = strdup(XKB_DFLT_LAYOUT);
-ki->xkbVariant = strdup(XKB_DFLT_VARIANT);
-ki->xkbOptions = strdup(XKB_DFLT_OPTIONS);
+ki->xkbRules = strdup(kdGlobalXkbRules ? kdGlobalXkbRules : 
XKB_DFLT_RULES);
+ki->xkbModel = strdup(kdGlobalXkbModel ? kdGlobalXkbModel : 
XKB_DFLT_MODEL);
+ki->xkbLayout = strdup(kdGlobalXkbLayout ? kdGlobalXkbLayout : 
XKB_DFLT_LAYOUT);
+ki->xkbVariant = strdup(kdGlobalXkbVariant ? kdGlobalXkbVariant 
:XKB_DFLT_VARIANT);
+ki->xkbOptions = strdup(kdGlobalXkbOptions ? kdGlobalXkbOptions : 
XKB_DFLT_OPTIONS);
 
 return ki;
 }
-- 
2.1.4

___
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 kdrive/ephyr v7 3/9] kdrive: introduce input hot-plugging support for udev and hal backends (#33140)

2015-12-11 Thread Laércio de Sousa
This patch introduces input hot-plugging support for kdrive-based
applications in multi-seat context. This feature is enabled
by passing -seat option with desired seat name. All keyboard/mouse
devices assigned to that seat will be automatically grabbed
by kdrive.

It supports udev and hal backends for input hot-plugging support.
Another patches may be required for wscons backend.

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

Signed-off-by: Laércio de Sousa 
---
 hw/kdrive/src/Makefile.am |   8 ++
 hw/kdrive/src/kdrive.c|  39 +
 hw/kdrive/src/kinfo.c |   4 +
 hw/kdrive/src/kinput.c| 212 +-
 4 files changed, 241 insertions(+), 22 deletions(-)

diff --git a/hw/kdrive/src/Makefile.am b/hw/kdrive/src/Makefile.am
index d69f0dd..b7f94b0 100644
--- a/hw/kdrive/src/Makefile.am
+++ b/hw/kdrive/src/Makefile.am
@@ -23,3 +23,11 @@ libkdrive_la_SOURCES =   \
kshadow.c   \
$(KDRIVE_XV_SOURCES) \
 $(top_srcdir)/mi/miinitext.c
+
+if CONFIG_UDEV
+libkdrive_la_LIBADD = $(top_builddir)/config/libconfig.la
+else
+if CONFIG_HAL
+libkdrive_la_LIBADD = $(top_builddir)/config/libconfig.la
+endif
+endif
diff --git a/hw/kdrive/src/kdrive.c b/hw/kdrive/src/kdrive.c
index dddbe6e..8930ace 100644
--- a/hw/kdrive/src/kdrive.c
+++ b/hw/kdrive/src/kdrive.c
@@ -45,6 +45,10 @@
 
 #include 
 
+#if defined(CONFIG_UDEV) || defined(CONFIG_HAL)
+#include 
+#endif
+
 typedef struct _kdDepths {
 CARD8 depth;
 CARD8 bpp;
@@ -1125,6 +1129,11 @@ KdInitOutput(ScreenInfo * pScreenInfo, int argc, char 
**argv)
 KdAddScreen(pScreenInfo, screen, argc, argv);
 
 OsRegisterSigWrapper(KdSignalWrapper);
+
+#if defined(CONFIG_UDEV) || defined(CONFIG_HAL)
+if (SeatId) /* Enable input hot-plugging */
+config_pre_init();
+#endif
 }
 
 void
@@ -1143,3 +1152,33 @@ DPMSSupported(void)
 {
 return FALSE;
 }
+
+/* These stubs can be safely removed once we can
+ * split input and GPU parts in hotplug.h et al. */
+#ifdef CONFIG_UDEV_KMS
+void
+NewGPUDeviceRequest(struct OdevAttributes *attribs)
+{
+}
+
+void
+DeleteGPUDeviceRequest(struct OdevAttributes *attribs)
+{
+}
+#endif
+
+struct xf86_platform_device *
+xf86_find_platform_device_by_devnum(int major, int minor)
+{
+return NULL;
+}
+
+void
+systemd_logind_release_fd(int _major, int _minor, int fd)
+{
+}
+
+void
+systemd_logind_vtenter(void)
+{
+}
diff --git a/hw/kdrive/src/kinfo.c b/hw/kdrive/src/kinfo.c
index 01ae1e4..f91d575 100644
--- a/hw/kdrive/src/kinfo.c
+++ b/hw/kdrive/src/kinfo.c
@@ -134,6 +134,7 @@ KdFreePointer(KdPointerInfo * pi)
 free(pi->name);
 free(pi->path);
 input_option_free_list(>options);
+pi->next = NULL;
 free(pi);
 }
 
@@ -145,6 +146,9 @@ KdFreeKeyboard(KdKeyboardInfo * ki)
 free(ki->xkbRules);
 free(ki->xkbModel);
 free(ki->xkbLayout);
+free(ki->xkbVariant);
+free(ki->xkbOptions);
+input_option_free_list(>options);
 ki->next = NULL;
 free(ki);
 }
diff --git a/hw/kdrive/src/kinput.c b/hw/kdrive/src/kinput.c
index 3a1c6a0..682b63a 100644
--- a/hw/kdrive/src/kinput.c
+++ b/hw/kdrive/src/kinput.c
@@ -51,6 +51,10 @@
 #include "inpututils.h"
 #include "optionstr.h"
 
+#if defined(CONFIG_UDEV) || defined(CONFIG_HAL)
+#include 
+#endif
+
 #ifdef KDRIVE_EVDEV
 #define DEV_INPUT_EVENT_PREFIX "/dev/input/event"
 #define DEV_INPUT_EVENT_PREFIX_LEN (sizeof(DEV_INPUT_EVENT_PREFIX) - 1)
@@ -407,7 +411,8 @@ KdPointerProc(DeviceIntPtr pDevice, int onoff)
 #endif
 if (!pi->driver) {
 if (!pi->driverPrivate) {
-ErrorF("no driver specified for %s\n", pi->name);
+ErrorF("no driver specified for pointer device \"%s\" (%s)\n",
+   pi->name ? pi->name : "(unnamed)", pi->path);
 return BadImplementation;
 }
 
@@ -727,7 +732,8 @@ KdKeyboardProc(DeviceIntPtr pDevice, int onoff)
 #endif
 if (!ki->driver) {
 if (!ki->driverPrivate) {
-ErrorF("no driver specified!\n");
+ErrorF("no driver specified for keyboard device \"%s\" (%s)\n",
+   ki->name ? ki->name : "(unnamed)", ki->path);
 return BadImplementation;
 }
 
@@ -901,6 +907,8 @@ KdNewKeyboard(void)
 ki->bellDuration = 200;
 ki->next = NULL;
 ki->options = NULL;
+ki->name = strdup("Generic Keyboard");
+ki->path = NULL;
 ki->xkbRules = strdup(XKB_DFLT_RULES);
 ki->xkbModel = strdup(XKB_DFLT_MODEL);
 ki->xkbLayout = strdup(XKB_DFLT_LAYOUT);
@@ -1084,18 +1092,52 @@ KdParseKbdOptions(KdKeyboardInfo * ki)
 const char *key = input_option_get_key(option);
 const char *value = input_option_get_value(option);
 
-if (strcasecmp(key, "XkbRules") == 0)
+if (
+#if defined(CONFIG_UDEV) || defined(CONFIG_HAL)
+strcasecmp(key, "xkb_rules") == 0 ||
+#endif
+

Re: [PATCH xserver v2.1] os: Treat ssh as a non-local client (v2)

2015-12-11 Thread Jon Turney

On 11/12/2015 10:31, Emil Velikov wrote:

On 11 December 2015 at 10:20, Martin Peres  wrote:

On 11/12/15 11:30, Michel Dänzer wrote:

On 11.12.2015 18:17, Martin Peres wrote:

On 11/12/15 04:34, Michel Dänzer wrote:

From: Adam Jackson 

[...]

+#ifndef WIN32


Side note:  WIN32 just means that the Win32 API is available, and may be 
defined even on Cygwin after including windows.h (so it doesn't really 
indicate what the target is)


This is why the circumlocution "!defined(WIN32) || defined(__CYGWIN__)" 
(or it's inverse) is used in places, and to be strictly correct should 
probably be used here.



Why add this ifndef?


Because libgen.h and basename() aren't available on Windows AFAICT. I
figured this use case probably isn't common enough on Windows anyway to
bother making it work there as well.


You are right, basename is a POSIX function and mingw does expose it, but it
turns out msvc does not. As you said, it is probably not worth the effort to
add msvc support that no-one will be able to test anyway.


There's no (intentional) MSVC or mingw support in xserver that I know
of - only Cygwin. There is also the GNU version of the function
(#define _GNU_SOURCE + #include ) although I'm not sure if
Cygwin has either of them. I'd assume Jon can follow up as needed.


No, there should be support in the X server for building it for MinGW. 
doc/c-extension touches upon this subject briefly.


I suspect it may be broken in master due to recent changes, but I do try 
to upstream patches from Xming to keep it building for MinGW, even 
though my primary interest is building xserver for Cygwin.


(There also exists VcXsrv, which uses a much larger set of patches and 
some special tools to build the X.Org Xserver with MSVC)


___
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-ati] Fix uninitialized variable warnings reported by clang.

2015-12-11 Thread Thomas Klausner
Signed-off-by: Thomas Klausner 
---
 src/radeon_drm_queue.c | 8 
 src/radeon_kms.c   | 2 +-
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/radeon_drm_queue.c b/src/radeon_drm_queue.c
index 5e54ef8..84d0509 100644
--- a/src/radeon_drm_queue.c
+++ b/src/radeon_drm_queue.c
@@ -59,7 +59,7 @@ radeon_drm_queue_handler(int fd, unsigned int frame, unsigned 
int sec,
 unsigned int usec, void *user_ptr)
 {
struct radeon_drm_queue_entry *user_data = user_ptr;
-   struct radeon_drm_queue_entry *e, *tmp;
+   struct radeon_drm_queue_entry *e = NULL, *tmp;
 
xorg_list_for_each_entry_safe(e, tmp, _drm_queue, list) {
if (e == user_data) {
@@ -119,7 +119,7 @@ radeon_drm_abort_one(struct radeon_drm_queue_entry *e)
 void
 radeon_drm_abort_client(ClientPtr client)
 {
-struct radeon_drm_queue_entry *e, *tmp;
+struct radeon_drm_queue_entry *e = NULL, *tmp;
 
 xorg_list_for_each_entry_safe(e, tmp, _drm_queue, list) {
if (e->client == client)
@@ -142,7 +142,7 @@ radeon_drm_abort_entry(struct radeon_drm_queue_entry *entry)
 void
 radeon_drm_abort_id(uint64_t id)
 {
-struct radeon_drm_queue_entry *e, *tmp;
+struct radeon_drm_queue_entry *e = NULL, *tmp;
 
 xorg_list_for_each_entry_safe(e, tmp, _drm_queue, list) {
if (e->id == id) {
@@ -170,7 +170,7 @@ radeon_drm_queue_init()
 void
 radeon_drm_queue_close(ScrnInfoPtr scrn)
 {
-struct radeon_drm_queue_entry *e, *tmp;
+struct radeon_drm_queue_entry *e = NULL, *tmp;
 
 xorg_list_for_each_entry_safe(e, tmp, _drm_queue, list) {
if (e->scrn == scrn)
diff --git a/src/radeon_kms.c b/src/radeon_kms.c
index d459740..d6d17bc 100644
--- a/src/radeon_kms.c
+++ b/src/radeon_kms.c
@@ -303,7 +303,7 @@ static void
 radeon_dirty_update(ScreenPtr screen)
 {
RegionPtr region;
-   PixmapDirtyUpdatePtr ent;
+   PixmapDirtyUpdatePtr ent = NULL;
 
if (xorg_list_is_empty(>pixmap_dirty_list))
return;
-- 
2.6.4

___
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 xserver 4/8] Create a threaded mechanism for input [v3]

2015-12-11 Thread Keith Packard
Mark Kettenis  writes:

> However, is there a reason why you didn't use the
> PTHREAD_MUTEX_RECURSIVE mtex type that is standardized by POSIX?

Sorry, my documentation only mentions a non-portable version of
recursive mutexes. I didn't even know that recursive mutexes had been
standardized. Looks like we've got options.

-- 
-keith


signature.asc
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

Re: [PATCH xserver 4/8] Create a threaded mechanism for input [v3]

2015-12-11 Thread Keith Packard
Keith Packard  writes:

> Mark Kettenis  writes:
>
>> However, is there a reason why you didn't use the
>> PTHREAD_MUTEX_RECURSIVE mtex type that is standardized by POSIX?
>
> Sorry, my documentation only mentions a non-portable version of
> recursive mutexes. I didn't even know that recursive mutexes had been
> standardized. Looks like we've got options.

So, how about this preference plan, picking the first one which works:

 1) PTHREAD_MUTEX_RECURSIVE
 2) PTHREAD_MUTEX_RECURSIVE_NP
 3) PTHREAD_MUTEX_NORMAL + __thread variable
 4) PTHREAD_MUTEX_NORMAL + thread specific variables
 
-- 
-keith


signature.asc
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

Re: [PATCH xserver 4/8] Create a threaded mechanism for input [v3]

2015-12-11 Thread Julien Cristau
On Thu, Dec 10, 2015 at 11:42:36 -0800, Keith Packard wrote:

> Mark Kettenis  writes:
> 
> > Ugh.  Exporting global variables as part of the ABI is generally not
> > such a good idea.  Perhaps it is better to use functions to acquire
> > and release the input mutex instead?
> 
> Yeah, the mutex isn't exactly performance critical.
> 
> > Also, using TLS (i.e. __thread variables) isn't portable.  That
> > mechanism certainly isn't supported by all platforms supported by
> > Xorg.
> 
> Ok, I've added support for pthread_setspecific/pthread_getspecific and
> made sure that works; I cannot test the autoconf bits (other than
> verifying that if I misspell '__thread' as '__tread' it fails as
> expected).
> 
You could maybe use
http://www.gnu.org/software/autoconf-archive/ax_tls.html for the
autoconf bits?

Cheers,
Julien
___
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 xserver v2.1] os: Treat ssh as a non-local client (v2)

2015-12-11 Thread Martin Peres

On 11/12/15 04:34, Michel Dänzer wrote:

From: Adam Jackson 

By the time we get to ComputeLocalClient, we've already done
NextAvailableClient → ReserveClientIds → DetermineClientCmd (assuming
we're built with #define CLIENTIDS), so we can look up the name of the
client process and refuse to treat ssh's X forwarding as if it were
local.

v2: (Michel Dänzer)
 * Only match "ssh" itself, not other executable names starting with
   that prefix.
 * Ignore executable path for the match.

Signed-off-by: Adam Jackson 
Signed-off-by: Michel Dänzer 
---

v2.1: Slightly extended code comment

  os/access.c | 29 ++---
  1 file changed, 26 insertions(+), 3 deletions(-)

diff --git a/os/access.c b/os/access.c
index 10a48c3..3e32128 100644
--- a/os/access.c
+++ b/os/access.c
@@ -101,6 +101,7 @@ SOFTWARE.
  #include 
  #include 
  #include 
+#include 
  
  #ifndef NO_LOCAL_CLIENT_CRED

  #include 
@@ -1081,9 +1082,8 @@ ResetHosts(const char *display)
  }
  }
  
-/* Is client on the local host */

-Bool
-ComputeLocalClient(ClientPtr client)
+static Bool
+xtransLocalClient(ClientPtr client)
  {
  int alen, family, notused;
  Xtransaddr *from = NULL;
@@ -1116,6 +1116,29 @@ ComputeLocalClient(ClientPtr client)
  return FALSE;
  }
  
+/* Is client on the local host */

+Bool
+ComputeLocalClient(ClientPtr client)
+{
+if (!xtransLocalClient(client))
+return FALSE;
+
+#ifndef WIN32
Why add this ifndef? And why all clients of an xserver running on 
windows should be considered local?


Seems like this function is implementing the logic "Can we safely use 
the features of posix-provided extensions?" instead of sticking to what 
the name suggests. If it is a hack, it would be nice to document it at 
least :)


Thanks for spending time on this!

+/* If the executable name is "ssh", assume that this client connection
+ * is forwarded from another host via SSH
+ */
+if (client->clientIds->cmdname) {
+char *cmdname = strdup(client->clientIds->cmdname);
+Bool ret = strcmp(basename(cmdname), "ssh") != 0;
+
+free(cmdname);
+return ret;
+}
+#endif
+
+return TRUE;
+}
+
  /*
   * Return the uid and all gids of a connected local client
   * Allocates a LocalClientCredRec - caller must call FreeLocalClientCreds


___
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 inputproto] specs: Set TZ=UTC before calling asciidoc

2015-12-11 Thread Uli Schlachter
Am 10.12.2015 um 21:25 schrieb Andreas Boll:
> Set TZ=UTC before calling asciidoc to make the embedded dates invariant
> to timezones in order to make the package build reproducibly.
> 
> Fixes bug:
> https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=795981
> 
> Suggested-by: Eduard Sanou 
> Signed-off-by: Andreas Boll 
> ---
>  specs/Makefile.am | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/specs/Makefile.am b/specs/Makefile.am
> index a83cf40..d04f4d0 100644
> --- a/specs/Makefile.am
> +++ b/specs/Makefile.am
> @@ -6,7 +6,7 @@ doc_DATA = XI2proto.html XIproto.html
>  dist_doc_DATA = XI2proto.txt XIproto.txt
>  
>  %.html: %.txt
> - $(AM_V_GEN)$(ASCIIDOC) -o $@ $<
> + TZ=UTC $(AM_V_GEN)$(ASCIIDOC) -o $@ $<

Shouldn't this be $(AM_V_GEN)TZ=UTC $(ASCIIDOC) -o $@ $  
>  CLEANFILES = $(doc_DATA)
>  
> 

Uli
-- 
A normal person is just someone you don't know well enough yet.
 - Nettie Wiebe
___
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 xserver] xfree86: add NoMatchFoo directives for InputClass sections

2015-12-11 Thread Benjamin Tissoires
Hi Peter,

On Fri, Dec 11, 2015 at 12:58 AM, Peter Hutterer
 wrote:
> InputClass sections use various MatchFoo directives to decide which device to
> apply to. This usually works fine for specific snippets but has drawbacks for
> snippets that apply more generally to a multitude of devices.
>
> This patch adds a NoMatchFoo directive to negate a match, thus allowing
> snippets that only apply if a given condition is not set. Specifically, this
> allows for more flexible fallback driver matching, it is now possible to use a
> snippet that says "assign driver foo, but only if driver bar wasn't already
> assigned to it". For example:
>
> Section "InputClass"
>Identifier "libinput for tablets"
>MatchIsTablet "true"
>NoMatchDriver "wacom"
>Driver "libinput"
> EndSection
>
> The above only assigns libinput to tablet devices if wacom isn't already
> assigned to this device, making it possible to select a specific driver by
> installing/uninstalling it.
>
> Signed-off-by: Peter Hutterer 

Thanks, that was quicker than expected :)

Just 2 nitpicks/questions:

> ---
>  hw/xfree86/common/xf86Xinput.c | 15 +
>  hw/xfree86/man/xorg.conf.man   | 15 +
>  hw/xfree86/parser/InputClass.c | 76 
> --
>  hw/xfree86/parser/xf86Parser.h |  1 +
>  hw/xfree86/parser/xf86tokens.h | 12 ++-
>  5 files changed, 102 insertions(+), 17 deletions(-)
>
> diff --git a/hw/xfree86/common/xf86Xinput.c b/hw/xfree86/common/xf86Xinput.c
> index c56a2b9..fead782 100644
> --- a/hw/xfree86/common/xf86Xinput.c
> +++ b/hw/xfree86/common/xf86Xinput.c
> @@ -540,21 +540,24 @@ MatchAttrToken(const char *attr, struct xorg_list 
> *patterns,
>  if (xorg_list_is_empty(patterns))
>  return TRUE;
>
> -/* If there are patterns but no attribute, reject the match */
> -if (!attr)
> -return FALSE;
> -
>  /*
>   * Otherwise, iterate the list of patterns ensuring each entry has a

If we remove the previous comment, we should probably remove the
"Otherwise" here.

>   * match. Each list entry is a separate Match line of the same type.
>   */
>  xorg_list_for_each_entry(group, patterns, entry) {
>  char *const *cur;
> -Bool match = FALSE;
> +Bool is_negated = group->is_negated;
> +Bool match = is_negated;
> +
> +/* If there's a pattern but no attribute, we reject the match for a
> + * MatchFoo directive, and accept it for a NoMatchFoo directive
> + */

I don't follow the logic here. Can you explain why a MatchFoo would be
rejected while a NoMatchFoo won't? I can't find an example for this
situation.

The rest of the patch looks good to me.

Cheers,
Benjamin

> +if (!attr)
> +return is_negated;
>
>  for (cur = group->values; *cur; cur++)
>  if ((*compare) (attr, *cur) == 0) {
> -match = TRUE;
> +match = !is_negated;
>  break;
>  }
>  if (!match)
> diff --git a/hw/xfree86/man/xorg.conf.man b/hw/xfree86/man/xorg.conf.man
> index 08eb7a9..d794df4 100644
> --- a/hw/xfree86/man/xorg.conf.man
> +++ b/hw/xfree86/man/xorg.conf.man
> @@ -1092,6 +1092,7 @@ attribute. For example:
>  .B  "# either gizmo or gadget
>  .B  "MatchProduct \*qexample\*q
>  .B  "MatchProduct \*qgizmo|gadget\*q
> +.B  "NoMatchDriver \*qdrivername\*q
>  .I  "..."
>  .B  "EndSection"
>  .fi
> @@ -1160,6 +1161,20 @@ if no named
>  .B ServerLayout
>  sections have been found.
>  .PP
> +The above directives have equivalents for negative matching with the
> +.B NoMatchProduct,
> +.B NoMatchVendor,
> +.B NoMatchDevicePath,
> +.B NoMatchOS,
> +.B NoMatchPnPID,
> +.B NoMatchUSBID,
> +.B NoMatchDriver,
> +.B NoMatchTag,
> +and
> +.B NoMatchLayout
> +directives. These NoMatch directives match if the subsequent match is not
> +met by the device.
> +.PP
>  The second type of entry is used to match device types. These entries take a
>  boolean argument similar to
>  .B Option
> diff --git a/hw/xfree86/parser/InputClass.c b/hw/xfree86/parser/InputClass.c
> index 2b68aaa..5d3b59c 100644
> --- a/hw/xfree86/parser/InputClass.c
> +++ b/hw/xfree86/parser/InputClass.c
> @@ -55,6 +55,15 @@ xf86ConfigSymTabRec InputClassTab[] = {
>  {MATCH_IS_TABLET, "matchistablet"},
>  {MATCH_IS_TOUCHPAD, "matchistouchpad"},
>  {MATCH_IS_TOUCHSCREEN, "matchistouchscreen"},
> +{NOMATCH_PRODUCT, "nomatchproduct"},
> +{NOMATCH_VENDOR, "nomatchvendor"},
> +{NOMATCH_DEVICE_PATH, "nomatchdevicepath"},
> +{NOMATCH_OS, "nomatchos"},
> +{NOMATCH_PNPID, "nomatchpnpid"},
> +{NOMATCH_USBID, "nomatchusbid"},
> +{NOMATCH_DRIVER, "nomatchdriver"},
> +{NOMATCH_TAG, "nomatchtag"},
> +{NOMATCH_LAYOUT, "nomatchlayout"},
>  {-1, ""},
>  };
>
> @@ -138,13 +147,19 @@ xf86freeInputClassList(XF86ConfInputClassPtr ptr)
>
>  #define TOKEN_SEP "|"
>
> +enum