Re: [PATCH xf86-video-amdgpu] amdgpu_probe: Do not close server managed drm fds

2016-10-18 Thread Michel Dänzer

[ Moving to the amd-gfx mailing list, where xf86-video-amdgpu (and -ati)
patches are reviewed ]

On 18/10/16 11:48 PM, Hans de Goede wrote:
> This fixes the xserver only seeing AMD/ATI devices supported by the amdgpu
> driver, as by the time xf86-video-ati gets a chance to probe them, the
> fd has been closed.

That basically makes sense, but I have one question: Why does amdgpu get
probed in the first place in that case? I was under the impression that
this should only happen for GPUs bound to the amdgpu kernel driver, due
to Section "OutputClass" in /usr/share/X11/xorg.conf.d/10-amdgpu.conf .


> diff --git a/src/amdgpu_probe.c b/src/amdgpu_probe.c
> index 213d245..5d17fe5 100644
> --- a/src/amdgpu_probe.c
> +++ b/src/amdgpu_probe.c
> @@ -142,6 +142,15 @@ static int amdgpu_kernel_open_fd(ScrnInfoPtr pScrn, char 
> *busid,
>   return fd;
>  }
>  
> +static void amdgpu_kernel_close_fd(AMDGPUEntPtr pAMDGPUEnt)
> +{
> +#ifdef XF86_PDEV_SERVER_FD
> + if (!(pAMDGPUEnt->platform_dev &&
> +   pAMDGPUEnt->platform_dev->flags & XF86_PDEV_SERVER_FD))
> +#endif
> + drmClose(pAMDGPUEnt->fd);
> +}

AMDGPUFreeRec could also be refactored to call this function.


> @@ -164,7 +173,7 @@ static Bool amdgpu_open_drm_master(ScrnInfoPtr pScrn, 
> AMDGPUEntPtr pAMDGPUEnt,
>   if (err != 0) {
>   xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
>  "[drm] failed to set drm interface version.\n");
> - drmClose(pAMDGPUEnt->fd);
> + amdgpu_kernel_close_fd(pAMDGPUEnt);
>   return FALSE;
>   }
> @@ -252,7 +261,7 @@ static Bool amdgpu_get_scrninfo(int entity_num, struct 
> pci_device *pci_dev)
>   return TRUE;
>  
>  error_amdgpu:
> - drmClose(pAMDGPUEnt->fd);
> + amdgpu_kernel_close_fd(pAMDGPUEnt);
>  error_fd:
>   free(pPriv->ptr);
>  error:

These two hunks aren't really necessary, right? These only get called
from amdgpu_pci_probe, in which case pAMDGPUEnt->platform_dev remains NULL.


> @@ -347,6 +356,7 @@ amdgpu_platform_probe(DriverPtr pDriver,
>  
>   pPriv->ptr = xnfcalloc(sizeof(AMDGPUEntRec), 1);
>   pAMDGPUEnt = pPriv->ptr;
> + pAMDGPUEnt->platform_dev = dev;
>   pAMDGPUEnt->fd = amdgpu_kernel_open_fd(pScrn, busid, dev);
>   if (pAMDGPUEnt->fd < 0)
>   goto error_fd;
> @@ -365,7 +375,6 @@ amdgpu_platform_probe(DriverPtr pDriver,
>   pAMDGPUEnt = pPriv->ptr;
>   pAMDGPUEnt->fd_ref++;
>   }
> - pAMDGPUEnt->platform_dev = dev;
>  
>   xf86SetEntityInstanceForScreen(pScrn, pEnt->index,
>  xf86GetNumEntityInstances(pEnt->

These two hunks aren't really necessary either, are they?


-- 
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: https://lists.x.org/mailman/listinfo/xorg-devel

Re: [PATCH libX11 3/4] Fixes: warning: variable 'req' set but not,used

2016-10-18 Thread Peter Hutterer
On Sat, Jun 04, 2016 at 05:19:59PM +0200, walter harms wrote:
> Fixes: warning: variable 'req' set but not used [-Wunused-but-set-variable]
>by marking req _X_UNUSED
>   Solution was discussed on xorg-devel ML
>Peter Hutter, Alan Coopersmith
> Re: [PATCH libX11 3/5] fix: warning: pointer targets in passing 
> argument 2 of '_XSend' differ in signedness [-Wpointer-sign]
>   
> Signed-off-by: harms wha...@bfs.de

just saw that float past. please use the standard s-o-b that everyone else
uses (as added by git commit -s). that goes for the series.

Cheers,
   Peter

> 
> ---
>  src/GetFPath.c | 2 +-
>  src/GetIFocus.c| 2 +-
>  src/GetKCnt.c  | 2 +-
>  src/GetPCnt.c  | 2 +-
>  src/GetPntMap.c| 2 +-
>  src/GetSSaver.c| 2 +-
>  src/GrServer.c | 2 +-
>  src/LiHosts.c  | 2 +-
>  src/ListExt.c  | 2 +-
>  src/Macros.c   | 2 +-
>  src/ModMap.c   | 4 ++--
>  src/QuKeybd.c  | 2 +-
>  src/ReconfWM.c | 2 +-
>  src/Sync.c | 2 +-
>  src/UngrabSvr.c| 2 +-
>  src/XlibInt.c  | 2 +-
>  src/xcms/cmsCmap.c | 2 +-
>  17 files changed, 18 insertions(+), 18 deletions(-)
> 
> diff --git a/src/GetFPath.c b/src/GetFPath.c
> index 8c3f49c..3d87e4f 100644
> --- a/src/GetFPath.c
> +++ b/src/GetFPath.c
> @@ -42,7 +42,7 @@ char **XGetFontPath(
>   int count = 0;
>   register unsigned i;
>   register int length;
> - register xReq *req;
> + _X_UNUSED register xReq *req;
> 
>   LockDisplay(dpy);
>   GetEmptyReq (GetFontPath, req);
> diff --git a/src/GetIFocus.c b/src/GetIFocus.c
> index 5d43ead..0a7f36e 100644
> --- a/src/GetIFocus.c
> +++ b/src/GetIFocus.c
> @@ -36,7 +36,7 @@ XGetInputFocus(
>   int *revert_to)
>  {
>  xGetInputFocusReply rep;
> -register xReq *req;
> +_X_UNUSED register xReq *req;
>  LockDisplay(dpy);
>  GetEmptyReq(GetInputFocus, req);
>  (void) _XReply (dpy, (xReply *), 0, xTrue);
> diff --git a/src/GetKCnt.c b/src/GetKCnt.c
> index 17f487f..5829fbe 100644
> --- a/src/GetKCnt.c
> +++ b/src/GetKCnt.c
> @@ -35,7 +35,7 @@ XGetKeyboardControl (
>  register XKeyboardState *state)
>  {
>  xGetKeyboardControlReply rep;
> -register xReq *req;
> +_X_UNUSED register xReq *req;
>  LockDisplay(dpy);
>  GetEmptyReq (GetKeyboardControl, req);
>  (void) _XReply (dpy, (xReply *) ,
> diff --git a/src/GetPCnt.c b/src/GetPCnt.c
> index 2c35d21..72d9495 100644
> --- a/src/GetPCnt.c
> +++ b/src/GetPCnt.c
> @@ -38,7 +38,7 @@ XGetPointerControl(
>   int *threshold)
>  {
>  xGetPointerControlReply rep;
> -xReq *req;
> +_X_UNUSED xReq *req;
>  LockDisplay(dpy);
>  GetEmptyReq(GetPointerControl, req);
>  (void) _XReply (dpy, (xReply *), 0, xTrue);
> diff --git a/src/GetPntMap.c b/src/GetPntMap.c
> index 29fdf21..07625f8 100644
> --- a/src/GetPntMap.c
> +++ b/src/GetPntMap.c
> @@ -45,7 +45,7 @@ int XGetPointerMapping (
>  unsigned char mapping[256];  /* known fixed size */
>  unsigned long nbytes, remainder = 0;
>  xGetPointerMappingReply rep;
> -register xReq *req;
> +_X_UNUSED register xReq *req;
> 
>  LockDisplay(dpy);
>  GetEmptyReq(GetPointerMapping, req);
> diff --git a/src/GetSSaver.c b/src/GetSSaver.c
> index 1aba3bb..7c2a306 100644
> --- a/src/GetSSaver.c
> +++ b/src/GetSSaver.c
> @@ -40,7 +40,7 @@ XGetScreenSaver(
> 
>  {
>  xGetScreenSaverReply rep;
> -register xReq *req;
> +_X_UNUSED register xReq *req;
>  LockDisplay(dpy);
>  GetEmptyReq(GetScreenSaver, req);
> 
> diff --git a/src/GrServer.c b/src/GrServer.c
> index 11d21e4..c4c62be 100644
> --- a/src/GrServer.c
> +++ b/src/GrServer.c
> @@ -32,7 +32,7 @@ in this Software without prior written authorization from 
> The Open Group.
>  int
>  XGrabServer (register Display *dpy)
>  {
> - register xReq *req;
> + _X_UNUSED register xReq *req;
>   LockDisplay(dpy);
>  GetEmptyReq(GrabServer, req);
>   UnlockDisplay(dpy);
> diff --git a/src/LiHosts.c b/src/LiHosts.c
> index 83cf3c7..29c36ff 100644
> --- a/src/LiHosts.c
> +++ b/src/LiHosts.c
> @@ -77,7 +77,7 @@ XHostAddress *XListHosts (
>  xListHostsReply reply;
>  unsigned char *buf, *bp;
>  register unsigned i;
> -register xListHostsReq *req;
> +_X_UNUSED register xListHostsReq *req;
>  XServerInterpretedAddress *sip;
> 
>  *nhosts = 0;
> diff --git a/src/ListExt.c b/src/ListExt.c
> index be6b989..b6677e9 100644
> --- a/src/ListExt.c
> +++ b/src/ListExt.c
> @@ -41,7 +41,7 @@ char **XListExtensions(
>   int count = 0;
>   register unsigned i;
>   register int length;
> - register xReq *req;
> + _X_UNUSED register xReq *req;
>   unsigned long rlen = 0;
> 
>   LockDisplay(dpy);
> diff --git a/src/Macros.c b/src/Macros.c
> index 394a764..dcd0380 100644
> --- a/src/Macros.c
> +++ b/src/Macros.c
> @@ -283,7 +283,7 @@ int XAddPixel(
>  int
>  XNoOp (register Display *dpy)
>  {
> -register xReq *req;
> +

Re: [PATCH xserver] glamor: Isolate GLX client code to its own library

2016-10-18 Thread Eric Anholt
Adam Jackson  writes:

> This is a step towards making libglamor_egl and Xwayland not link
> against libGL (which brings in client-side libraries, which is just
> icky).

Is it actually necessary?  Given that the epoxy GLX symbols always
exist, and we're linking against epoxy, it seems like we could just drop
our -lGL.

libglamor_egl should pretty clearly not be linking to libGL, though, so
I'm in favor of following where this leads.


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

[PATCH xserver] glamor: Isolate GLX client code to its own library

2016-10-18 Thread Adam Jackson
This is a step towards making libglamor_egl and Xwayland not link
against libGL (which brings in client-side libraries, which is just
icky).

Signed-off-by: Adam Jackson 
---
 glamor/Makefile.am  | 13 +++--
 glamor/glamor_glx_stubs.c   | 37 +
 hw/kdrive/ephyr/Makefile.am |  1 +
 hw/xwayland/Makefile.am |  3 ++-
 4 files changed, 51 insertions(+), 3 deletions(-)
 create mode 100644 glamor/glamor_glx_stubs.c

diff --git a/glamor/Makefile.am b/glamor/Makefile.am
index 8c79994..fd52e30 100644
--- a/glamor/Makefile.am
+++ b/glamor/Makefile.am
@@ -1,4 +1,8 @@
-noinst_LTLIBRARIES = libglamor.la libglamor_egl_stubs.la
+noinst_LTLIBRARIES = \
+   libglamor.la \
+   libglamor_egl_stubs.la \
+   libglamor_glx.la \
+   libglamor_glx_stubs.la
 
 libglamor_la_LIBADD = $(GLAMOR_LIBS)
 
@@ -13,7 +17,6 @@ libglamor_la_SOURCES = \
glamor_debug.h \
glamor_font.c \
glamor_font.h \
-   glamor_glx.c \
glamor_composite_glyphs.c \
glamor_image.c \
glamor_lines.c \
@@ -58,4 +61,10 @@ libglamor_egl_stubs_la_SOURCES = \
glamor_egl_stubs.c \
glamor_egl.h
 
+libglamor_glx_la_SOURCES = \
+   glamor_glx.c
+
+libglamor_glx_stubs_la_SOURCES = \
+   glamor_glx_stubs.c
+
 sdk_HEADERS = glamor.h
diff --git a/glamor/glamor_glx_stubs.c b/glamor/glamor_glx_stubs.c
new file mode 100644
index 000..7f29386
--- /dev/null
+++ b/glamor/glamor_glx_stubs.c
@@ -0,0 +1,37 @@
+/*
+ * Copyright © 2013 Intel Corporation
+ *
+ * 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.
+ */
+
+#include 
+#include "glamor_context.h"
+
+static void
+glamor_glx_make_current(struct glamor_context *glamor_ctx)
+{
+}
+
+
+Bool
+glamor_glx_screen_init(struct glamor_context *glamor_ctx)
+{
+return False;
+}
diff --git a/hw/kdrive/ephyr/Makefile.am b/hw/kdrive/ephyr/Makefile.am
index 6ce0d6f..f988271 100644
--- a/hw/kdrive/ephyr/Makefile.am
+++ b/hw/kdrive/ephyr/Makefile.am
@@ -66,6 +66,7 @@ if GLAMOR
 AM_CPPFLAGS += $(XLIB_CFLAGS)
 XEPHYR_GLAMOR_LIB = \
$(top_builddir)/glamor/libglamor.la \
+   $(top_builddir)/glamor/libglamor_glx.la \
$(top_builddir)/glamor/libglamor_egl_stubs.la \
$()
 endif
diff --git a/hw/xwayland/Makefile.am b/hw/xwayland/Makefile.am
index a3c9fce..fdb825a 100644
--- a/hw/xwayland/Makefile.am
+++ b/hw/xwayland/Makefile.am
@@ -46,7 +46,8 @@ glamor_built_sources =\
 
 Xwayland_built_sources += $(glamor_built_sources)
 
-glamor_lib = $(top_builddir)/glamor/libglamor.la
+glamor_lib = $(top_builddir)/glamor/libglamor.la \
+$(top_builddir)/glamor/libglamor_glx_stubs.la
 
 Xwayland_LDADD += $(GLAMOR_LIBS) $(GBM_LIBS) -lEGL -lGL
 Xwayland_DEPENDENCIES = $(glamor_lib) $(XWAYLAND_LIBS)
-- 
2.9.3

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

Re: [PATCH] xfree86: Xorg.wrap: Do not require root rights for cards with 0 outputs

2016-10-18 Thread Eric Engestrom
On Tuesday, 2016-10-18 16:36:32 +0200, Hans de Goede wrote:
> Prior to this commit the Xorg.wrap code to detect if root rights
> are necessary checked for DRM_IOCTL_MODE_GETRESOURCES succeeding *and*
> reporting more then 0 output connectors.
> 
> DRM_IOCTL_MODE_GETRESOURCES succeeding alone is enough to differentiate
> between old drm only cards (which need ums and thus root) and kms capable
> cards.
> 
> Some hybrid gfx laptops have 0 output connectors on one of their 2 GPUs,
> resulting in Xorg needlessly running as root. This commits removes the
> res.count_connectors > 0 check, fixing this.
> 
> Signed-off-by: Hans de Goede 

Reviewed-by: Eric Engestrom 

> ---
>  hw/xfree86/xorg-wrapper.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/hw/xfree86/xorg-wrapper.c b/hw/xfree86/xorg-wrapper.c
> index d930962..a25e6ff 100644
> --- a/hw/xfree86/xorg-wrapper.c
> +++ b/hw/xfree86/xorg-wrapper.c
> @@ -240,7 +240,7 @@ int main(int argc, char *argv[])
>  
>  memset(, 0, sizeof(struct drm_mode_card_res));
>  r = ioctl(fd, DRM_IOCTL_MODE_GETRESOURCES, );
> -if (r == 0 && res.count_connectors > 0)
> +if (r == 0)
>  kms_cards++;
>  
>  close(fd);
> -- 
> 2.9.3
___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel

[PATCH xf86-video-amdgpu] amdgpu_probe: Do not close server managed drm fds

2016-10-18 Thread Hans de Goede
This fixes the xserver only seeing AMD/ATI devices supported by the amdgpu
driver, as by the time xf86-video-ati gets a chance to probe them, the
fd has been closed.

This fixes e.g. Xorg not seeing the dGPU on a Lenovo Thinkpad E465 laptop
with a CARRIZO iGPU and a HAINAN dGPU.

Signed-off-by: Hans de Goede 
---
 src/amdgpu_probe.c | 17 +
 1 file changed, 13 insertions(+), 4 deletions(-)

diff --git a/src/amdgpu_probe.c b/src/amdgpu_probe.c
index 213d245..5d17fe5 100644
--- a/src/amdgpu_probe.c
+++ b/src/amdgpu_probe.c
@@ -142,6 +142,15 @@ static int amdgpu_kernel_open_fd(ScrnInfoPtr pScrn, char 
*busid,
return fd;
 }
 
+static void amdgpu_kernel_close_fd(AMDGPUEntPtr pAMDGPUEnt)
+{
+#ifdef XF86_PDEV_SERVER_FD
+   if (!(pAMDGPUEnt->platform_dev &&
+ pAMDGPUEnt->platform_dev->flags & XF86_PDEV_SERVER_FD))
+#endif
+   drmClose(pAMDGPUEnt->fd);
+}
+
 static Bool amdgpu_open_drm_master(ScrnInfoPtr pScrn, AMDGPUEntPtr pAMDGPUEnt,
   char *busid)
 {
@@ -164,7 +173,7 @@ static Bool amdgpu_open_drm_master(ScrnInfoPtr pScrn, 
AMDGPUEntPtr pAMDGPUEnt,
if (err != 0) {
xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
   "[drm] failed to set drm interface version.\n");
-   drmClose(pAMDGPUEnt->fd);
+   amdgpu_kernel_close_fd(pAMDGPUEnt);
return FALSE;
}
 
@@ -252,7 +261,7 @@ static Bool amdgpu_get_scrninfo(int entity_num, struct 
pci_device *pci_dev)
return TRUE;
 
 error_amdgpu:
-   drmClose(pAMDGPUEnt->fd);
+   amdgpu_kernel_close_fd(pAMDGPUEnt);
 error_fd:
free(pPriv->ptr);
 error:
@@ -347,6 +356,7 @@ amdgpu_platform_probe(DriverPtr pDriver,
 
pPriv->ptr = xnfcalloc(sizeof(AMDGPUEntRec), 1);
pAMDGPUEnt = pPriv->ptr;
+   pAMDGPUEnt->platform_dev = dev;
pAMDGPUEnt->fd = amdgpu_kernel_open_fd(pScrn, busid, dev);
if (pAMDGPUEnt->fd < 0)
goto error_fd;
@@ -365,7 +375,6 @@ amdgpu_platform_probe(DriverPtr pDriver,
pAMDGPUEnt = pPriv->ptr;
pAMDGPUEnt->fd_ref++;
}
-   pAMDGPUEnt->platform_dev = dev;
 
xf86SetEntityInstanceForScreen(pScrn, pEnt->index,
   xf86GetNumEntityInstances(pEnt->
@@ -377,7 +386,7 @@ amdgpu_platform_probe(DriverPtr pDriver,
return TRUE;
 
 error_amdgpu:
-   drmClose(pAMDGPUEnt->fd);
+   amdgpu_kernel_close_fd(pAMDGPUEnt);
 error_fd:
free(pPriv->ptr);
 error:
-- 
2.9.3

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

[PATCH] xfree86: Xorg.wrap: Do not require root rights for cards with 0 outputs

2016-10-18 Thread Hans de Goede
Prior to this commit the Xorg.wrap code to detect if root rights
are necessary checked for DRM_IOCTL_MODE_GETRESOURCES succeeding *and*
reporting more then 0 output connectors.

DRM_IOCTL_MODE_GETRESOURCES succeeding alone is enough to differentiate
between old drm only cards (which need ums and thus root) and kms capable
cards.

Some hybrid gfx laptops have 0 output connectors on one of their 2 GPUs,
resulting in Xorg needlessly running as root. This commits removes the
res.count_connectors > 0 check, fixing this.

Signed-off-by: Hans de Goede 
---
 hw/xfree86/xorg-wrapper.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/xfree86/xorg-wrapper.c b/hw/xfree86/xorg-wrapper.c
index d930962..a25e6ff 100644
--- a/hw/xfree86/xorg-wrapper.c
+++ b/hw/xfree86/xorg-wrapper.c
@@ -240,7 +240,7 @@ int main(int argc, char *argv[])
 
 memset(, 0, sizeof(struct drm_mode_card_res));
 r = ioctl(fd, DRM_IOCTL_MODE_GETRESOURCES, );
-if (r == 0 && res.count_connectors > 0)
+if (r == 0)
 kms_cards++;
 
 close(fd);
-- 
2.9.3

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

Re: [PATCH v3 xserver] modesetting: fix glamor ifdef

2016-10-18 Thread Jon Turney

On 15/10/2016 05:13, Mihail Konev wrote:

Add a missing ifdef needed for --disable-glamor.

Signed-off-by: Mihail Konev 


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

Re: [PATCH xf86-input-libinput] Swap the registered input device on DEVICE_OFF when needed

2016-10-18 Thread Hans de Goede

Hi,

On 18-10-16 03:47, Peter Hutterer wrote:

If we don't swap out the pInfo previously passed to xf86AddEnabledDevice(),
the thread eventually calls read_input on a struct that has been deleted.
Avoid this by swapping out the to-be-destroyed pInfo with the first one we
find.

Reproducer: sudo udevadm trigger --type=devices --action=add

Signed-off-by: Peter Hutterer 


Patch looks good to me:

Reviewed-by: Hans de Goede 

Regards,

Hans



---
Changes to the RFC:
- checking for the driver now

 src/xf86libinput.c | 46 ++
 1 file changed, 46 insertions(+)

diff --git a/src/xf86libinput.c b/src/xf86libinput.c
index 69f7ae3..061e495 100644
--- a/src/xf86libinput.c
+++ b/src/xf86libinput.c
@@ -87,6 +87,7 @@
 struct xf86libinput_driver {
struct libinput *libinput;
int device_enabled_count;
+   void *registered_InputInfoPtr;
 };

 static struct xf86libinput_driver driver_context;
@@ -583,6 +584,7 @@ xf86libinput_on(DeviceIntPtr dev)
if (driver_context.device_enabled_count == 0) {
 #if HAVE_THREADED_INPUT
xf86AddEnabledDevice(pInfo);
+   driver_context.registered_InputInfoPtr = pInfo;
 #else
/* Can't use xf86AddEnabledDevice on an epollfd */
AddEnabledDevice(pInfo->fd);
@@ -1131,6 +1133,39 @@ xf86libinput_init(DeviceIntPtr dev)
return 0;
 }

+static bool
+is_libinput_device(InputInfoPtr pInfo)
+{
+   char *driver;
+   BOOL rc;
+
+   driver = xf86CheckStrOption(pInfo->options, "driver", "");
+   rc = strcmp(driver, "libinput") == 0;
+   free(driver);
+
+   return rc;
+}
+
+static void
+swap_registered_device(InputInfoPtr pInfo)
+{
+   InputInfoPtr next;
+
+   if (pInfo != driver_context.registered_InputInfoPtr)
+   return;
+
+   next = xf86FirstLocalDevice();
+   while (next == pInfo || !is_libinput_device(next))
+   next = next->next;
+
+   input_lock();
+   xf86RemoveEnabledDevice(pInfo);
+   if (next) /* shouldn't ever be NULL anyway */
+   xf86AddEnabledDevice(next);
+   driver_context.registered_InputInfoPtr = next;
+   input_unlock();
+}
+
 static void
 xf86libinput_destroy(DeviceIntPtr dev)
 {
@@ -1138,6 +1173,17 @@ xf86libinput_destroy(DeviceIntPtr dev)
struct xf86libinput *driver_data = pInfo->private;
struct xf86libinput_device *shared_device = driver_data->shared_device;

+   /* If the device being destroyed is the one we used for
+* xf86AddEnabledDevice(), we need to swap it out for one that is
+* still live. xf86AddEnabledDevice() buffers some data and once the
+* deletes pInfo (when DEVICE_OFF completes) the thread will keep
+* calling that struct's read_input because we never removed it.
+* Avoid this by removing ours and substituting one that's still
+* valid, the fd is the same anyway (libinput's epollfd).
+*/
+   if (driver_context.device_enabled_count > 0)
+   swap_registered_device(pInfo);
+
xorg_list_del(_data->shared_device_link);

if (driver_data->tablet_tool)


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

Re: [PATCH libX11 3/4] Fixes: warning: variable 'req' set but not, used

2016-10-18 Thread Ulrich Sibiller
On Sat, Jun 4, 2016 at 5:19 PM, walter harms  wrote:
> Fixes: warning: variable 'req' set but not used [-Wunused-but-set-variable]
>by marking req _X_UNUSED
> Solution was discussed on xorg-devel ML
>Peter Hutter, Alan Coopersmith
> Re: [PATCH libX11 3/5] fix: warning: pointer targets in passing 
> argument 2 of '_XSend' differ in signedness [-Wpointer-sign]

Hello,

I see a lot unapplied stuff on patchwork, so is there any plan to
clear the backlog?

I am specially interested in the patch series by Walter Harms mentioned above.

Thanks,

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

Re: [PATCH xserver] inputthread: leave the main thread's name as-is

2016-10-18 Thread Jeremy Huddleston Sequoia
Shouldn't glibc be fixed instead?  Why punish the platforms that do it right?

--Jeremy

> On Oct 17, 2016, at 21:13, Peter Hutterer  wrote:
> 
> On Linux, setting the main thread's name changes the program name
> (/proc/self/comm). Setting it to MainThread breaks scripts that rely on
> the command name, e.g. ps -C Xorg.
> 
> Signed-off-by: Peter Hutterer 
> ---
> os/inputthread.c | 6 --
> 1 file changed, 6 deletions(-)
> 
> diff --git a/os/inputthread.c b/os/inputthread.c
> index 4980502..65247b4 100644
> --- a/os/inputthread.c
> +++ b/os/inputthread.c
> @@ -433,12 +433,6 @@ InputThreadPreInit(void)
> }
> hotplugPipeWrite = hotplugPipe[1];
> 
> -#if defined(HAVE_PTHREAD_SETNAME_NP_WITH_TID)
> -pthread_setname_np (pthread_self(), "MainThread");
> -#elif defined(HAVE_PTHREAD_SETNAME_NP_WITHOUT_TID)
> -pthread_setname_np ("MainThread");
> -#endif
> -
> }
> 
> /**
> -- 
> 2.7.4
> 



smime.p7s
Description: S/MIME cryptographic signature
___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel