Re: [PATCH xserver] miext/damage: take care of the coordinate mode in damagePolyPoint

2018-09-21 Thread Eric Anholt
Cedric Roux  writes:

> The mode (CoordModeOrigin or CoordModePrevious) was not taken into
> account when computing the box. The result was a bad drawing of
> points in some situations (on my hardware/software configuration,
> calling XDrawString followed by XDrawPoints in the mode
> CoordModePrevious).
>
> Signed-off-by: Cedric Roux 

Thanks for the fix!  I wrote up a little testsuite for damage that we
can use to test these bugs in the future and made a MR for the whole
thing:

https://gitlab.freedesktop.org/xorg/xserver/merge_requests/23


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] xwayland: Use `double` for `xwl_tablet_tool`

2018-09-21 Thread Olivier Fourdan
So we do not lose subpixel precision in Xwayland.

Suggested-by: Peter Hutterer 
Signed-off-by: Olivier Fourdan 
Tested-by: Jean-Loup Tastet
Closes: https://gitlab.freedesktop.org/libinput/libinput/issues/138
---
 MR: https://gitlab.freedesktop.org/xorg/xserver/merge_requests/21

 hw/xwayland/xwayland-input.c | 20 ++--
 hw/xwayland/xwayland.h   | 12 ++--
 2 files changed, 16 insertions(+), 16 deletions(-)

diff --git a/hw/xwayland/xwayland-input.c b/hw/xwayland/xwayland-input.c
index 6fd3c416b..7f08b36e2 100644
--- a/hw/xwayland/xwayland-input.c
+++ b/hw/xwayland/xwayland-input.c
@@ -1604,8 +1604,8 @@ tablet_tool_motion(void *data, struct zwp_tablet_tool_v2 
*tool,
 struct xwl_tablet_tool *xwl_tablet_tool = data;
 struct xwl_seat *xwl_seat = xwl_tablet_tool->seat;
 int32_t dx, dy;
-int sx = wl_fixed_to_int(x);
-int sy = wl_fixed_to_int(y);
+double sx = wl_fixed_to_double(x);
+double sy = wl_fixed_to_double(y);
 
 if (!xwl_seat->tablet_focus_window)
 return;
@@ -1613,8 +1613,8 @@ tablet_tool_motion(void *data, struct zwp_tablet_tool_v2 
*tool,
 dx = xwl_seat->tablet_focus_window->window->drawable.x;
 dy = xwl_seat->tablet_focus_window->window->drawable.y;
 
-xwl_tablet_tool->x = dx + sx;
-xwl_tablet_tool->y = dy + sy;
+xwl_tablet_tool->x = (double) dx + sx;
+xwl_tablet_tool->y = (double) dy + sy;
 }
 
 static void
@@ -1772,15 +1772,15 @@ tablet_tool_frame(void *data, struct zwp_tablet_tool_v2 
*tool, uint32_t time)
 int button;
 
 valuator_mask_zero();
-valuator_mask_set(, 0, xwl_tablet_tool->x);
-valuator_mask_set(, 1, xwl_tablet_tool->y);
+valuator_mask_set_double(, 0, xwl_tablet_tool->x);
+valuator_mask_set_double(, 1, xwl_tablet_tool->y);
 valuator_mask_set(, 2, xwl_tablet_tool->pressure);
-valuator_mask_set(, 3, xwl_tablet_tool->tilt_x);
-valuator_mask_set(, 4, xwl_tablet_tool->tilt_y);
-valuator_mask_set(, 5, xwl_tablet_tool->rotation + 
xwl_tablet_tool->slider);
+valuator_mask_set_double(, 3, xwl_tablet_tool->tilt_x);
+valuator_mask_set_double(, 4, xwl_tablet_tool->tilt_y);
+valuator_mask_set_double(, 5, xwl_tablet_tool->rotation + 
xwl_tablet_tool->slider);
 
 QueuePointerEvents(xwl_tablet_tool->xdevice, MotionNotify, 0,
-   POINTER_ABSOLUTE | POINTER_SCREEN, );
+   POINTER_ABSOLUTE | POINTER_DESKTOP, );
 
 valuator_mask_zero();
 
diff --git a/hw/xwayland/xwayland.h b/hw/xwayland/xwayland.h
index 1a6e2f380..67819e178 100644
--- a/hw/xwayland/xwayland.h
+++ b/hw/xwayland/xwayland.h
@@ -311,13 +311,13 @@ struct xwl_tablet_tool {
 
 DeviceIntPtr xdevice;
 uint32_t proximity_in_serial;
-uint32_t x;
-uint32_t y;
+double x;
+double y;
 uint32_t pressure;
-float tilt_x;
-float tilt_y;
-float rotation;
-float slider;
+double tilt_x;
+double tilt_y;
+double rotation;
+double slider;
 
 uint32_t buttons_now,
  buttons_prev;
-- 
2.19.0

___
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: [RFC PATCH xserver] xwayland: Avoid assert failure in flips_stop()

2018-09-21 Thread Roman Gilg
Great detailed analysis in the backtrace! :)

What confused me at first was that the present_wnmd_flips_stop function is
called at all in this state because it should only be called when at least
one flip has been done and in this case xwl_window->present_window must
have been set to the presenting (child) window.

I believe now the root problem is that the window did in fact some flips in
the past, but on the reparent operation a new parent window with a new
xwl_window struct is set, which then has a different present_window value.
That means when reparenting of a child window with flips the
xwl_window->present_window values must be updated on the old parent (to
NULL) and on the new parent (to the new child window). Or more generic this
must be done on any unmap/map operation.

One extra case must be considered: if there is already a different child
window doing flips on the new parent window the reparented child window
must be instructed to stop its flips.
___
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