[PATCH xf86-input-libinput] draglock: fix memory overwrite during draglock parsing

2018-07-09 Thread Peter Hutterer
Passing in the size of the array but using it as "number of elements" inside
the function. Rename a bunch of arguments to avoid this.

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

Signed-off-by: Peter Hutterer 
---
Martin: this is the same basic change as your patch in 107166, but a lot
more garnish to change from the ambiguous "sz" to the less ambiguous
"nelem".

 src/draglock.c | 14 +++---
 src/draglock.h |  6 +++---
 src/xf86libinput.c |  2 +-
 3 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/src/draglock.c b/src/draglock.c
index b0bcac3..e0a91d0 100644
--- a/src/draglock.c
+++ b/src/draglock.c
@@ -116,7 +116,7 @@ draglock_get_meta(const struct draglock *dl)
 }
 
 size_t
-draglock_get_pairs(const struct draglock *dl, int *array, size_t sz)
+draglock_get_pairs(const struct draglock *dl, int *array, size_t nelem)
 {
unsigned int i;
size_t last = 0;
@@ -131,8 +131,8 @@ draglock_get_pairs(const struct draglock *dl, int *array, 
size_t sz)
}
 
/* size N array with a[0] == 0, the rest ordered by button number */
-   memset(array, 0, sz * sizeof(array[0]));
-   for (i = 0; i < sz && i < ARRAY_SIZE(dl->lock_pair); i++) {
+   memset(array, 0, nelem * sizeof(array[0]));
+   for (i = 0; i < nelem && i < ARRAY_SIZE(dl->lock_pair); i++) {
array[i] = dl->lock_pair[i];
if (array[i] != 0 && i > last)
last = i;
@@ -153,20 +153,20 @@ draglock_set_meta(struct draglock *dl, int meta_button)
 }
 
 int
-draglock_set_pairs(struct draglock *dl, const int *array, size_t sz)
+draglock_set_pairs(struct draglock *dl, const int *array, size_t nelem)
 {
unsigned int i;
 
-   if (sz == 0 || array[0] != 0)
+   if (nelem == 0 || array[0] != 0)
return 1;
 
-   for (i = 0; i < sz; i++) {
+   for (i = 0; i < nelem; i++) {
if (array[i] < 0 || array[i] >= DRAGLOCK_MAX_BUTTONS)
return 1;
}
 
dl->mode = DRAGLOCK_DISABLED;
-   for (i = 0; i < sz; i++) {
+   for (i = 0; i < nelem; i++) {
dl->lock_pair[i] = array[i];
if (dl->lock_pair[i])
dl->mode = DRAGLOCK_PAIRS;
diff --git a/src/draglock.h b/src/draglock.h
index acc1314..900d538 100644
--- a/src/draglock.h
+++ b/src/draglock.h
@@ -107,13 +107,13 @@ draglock_get_meta(const struct draglock *dl);
  * @note Button numbers start at 1, array[0] is always 0.
  *
  * @param[in|out] array Caller-allocated array to hold the button mappings.
- * @param[in] sz Maximum number of elements in array
+ * @param[in] nelem Maximum number of elements in array
  *
  * @return The number of valid elements in array or 0 if the current mode is
  * not DRAGLOCK_PAIRS
  */
 size_t
-draglock_get_pairs(const struct draglock *dl, int *array, size_t sz);
+draglock_get_pairs(const struct draglock *dl, int *array, size_t nelem);
 
 /**
  * Set the drag lock config to the DRAGLOCK_META mode, with the given
@@ -140,7 +140,7 @@ draglock_set_meta(struct draglock *dl, int meta_button);
  * @return 0 on successor nonzero otherwise
  */
 int
-draglock_set_pairs(struct draglock *dl, const int *array, size_t sz);
+draglock_set_pairs(struct draglock *dl, const int *array, size_t nelem);
 
 /**
  * Process the given button event through the drag lock state machine.
diff --git a/src/xf86libinput.c b/src/xf86libinput.c
index 2e950cd..34f1102 100644
--- a/src/xf86libinput.c
+++ b/src/xf86libinput.c
@@ -5326,7 +5326,7 @@ LibinputInitDragLockProperty(DeviceIntPtr dev,
break;
case DRAGLOCK_PAIRS:
sz = draglock_get_pairs(_data->draglock,
-   dl_values, sizeof(dl_values));
+   dl_values, ARRAY_SIZE(dl_values));
break;
default:
xf86IDrvMsg(dev->public.devicePrivate,
-- 
2.17.1

___
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] xwayland: don't use logical size for RRMode

2018-07-09 Thread Simon Ser
On July 9, 2018 3:42 PM, Olivier Fourdan  wrote:
> So, can you please elaborate exactly what this is supposed to fix and
> how to reproduce the issue?

I've configured my compositor with a 90 degree output rotation. Here are the
values sent by my compositor, as received by xwayland:

output_handle_mode 1600 850
xdg_output_handle_logical_size 850 1600

As far as I can tell this is correct.

Without this patch, if I open for instance Firefox, pointer events are correctly
handled if the pointer is in the top half of the screen, but when the pointer
moves in the bottom part the Y axis coordinate gets stuck. Here's xrandr's
output:

Screen 0: minimum 320 x 200, current 850 x 1600, maximum 8192 x 8192
XWAYLAND0 connected 1600x848+0+0 left (normal left inverted right x axis y 
axis) 0mm x 0mm
   848x1600  59.95*+

This patch fixes this bug. Here's xrandr's output:

Screen 0: minimum 320 x 200, current 850 x 1600, maximum 8192 x 8192
XWAYLAND0 connected 850x1600+0+0 left (normal left inverted right x axis y 
axis) 0mm x 0mm
   1600x850  59.92*+

Notice the difference between the logical geometry (850x1600+0+0) and the
current mode (1600x850).

I just noticed this patch breaks HiDPI outputs (xrandr advertises a
850x1600+0+0 logical geometry). We might want to use the logical size for
RRMode, but compensate transformations. What do you think?

Thanks,

Simon

___
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: gitlab migration (including account update plans, please read)

2018-07-09 Thread Adam Jackson
On Mon, 2018-07-02 at 10:23 -0700, Keith Packard wrote:

> For the first step, I'd like to propose moving the x server git
> repository to gitlab in the coming week, with the switch-over happening
> on the morning of July 9.

This is now done:

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

The old git URLs still work, so this change should be transparent for
existing checkouts. We'll be moving more repositories over the coming
weeks.

Currently the xorg group in gitlab is derived from the pre-existing
freedesktop LDAP group. This is a bit excessive, there's over 250
people in the group in total and not even a fifth of those are
regularly active. If you're both a group member and a project member
the highest privilege level is used; currently, this would mean all of
these accounts are maintainers for every project.

That's not _different_ from the current state of affairs, but since we
now have the easy ability to delegate access control per-project, we
should take the opportunity to prune the list of xorg group
members. These accounts will still exist in gitlab, and if the
contributor returns they are welcome to rejoin. As a totally arbitrary
cutoff I'd suggest pruning anyone who hasn't had an Author or Commit
credit in git in the last, say, three years.

If you want a differently arbitrary cutoff, or have other feedback,
please speak up.

- ajax
___
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-video-amdgpu 0/3] Add RandR lease support [v2]

2018-07-09 Thread Keith Packard
Michel Dänzer  writes:

> On 2018-07-07 02:36 AM, Keith Packard wrote:

> Well, this is unfortunate timing. Last Friday, I finally got around to
> porting these myself, as I had promised I would, but ran out of time for
> sending them out before the weekend. Sent out now:

Not a problem at all -- it gave me a chance to review the code again
which made it easier to read over your version.

> As my patches are simpler (due to e.g. taking advantage of existing
> XF86_* defines), I'm inclined to go with them. Sorry for any time you've
> wasted. If you could review my patches and maybe test that the lease
> functionality is actually working, that would be much appreciated.

All done. Thanks for getting these ready for merging. It was pretty
funny that we both decided to work on this on the same day after letting
them sit for a few months.

-- 
-keith


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

Re: [PATCH xserver] xwayland: don't use logical size for RRMode

2018-07-09 Thread Olivier Fourdan
Hi,

On Mon, 9 Jul 2018 at 09:17, Simon Ser  wrote:
>
> The logical size is the size of the output in the global compositor
> space. The mode width/height shouldn't be transformed and scaled.
>
> This fixes issues with pointer input on transformed outputs.
>
> Signed-Off-By: Simon Ser 
> ---
>  hw/xwayland/xwayland-output.c | 9 ++---
>  hw/xwayland/xwayland.h| 3 ++-
>  2 files changed, 8 insertions(+), 4 deletions(-)
>
> diff --git a/hw/xwayland/xwayland-output.c b/hw/xwayland/xwayland-output.c
> index 379062549..44fd5c26a 100644
> --- a/hw/xwayland/xwayland-output.c
> +++ b/hw/xwayland/xwayland-output.c
> @@ -113,12 +113,15 @@ output_handle_mode(void *data, struct wl_output 
> *wl_output, uint32_t flags,
>  if (!(flags & WL_OUTPUT_MODE_CURRENT))
>  return;
>
> +xwl_output->mode_width = width;
> +xwl_output->mode_height = height;
> +xwl_output->mode_refresh = refresh;

So, with that patch mode_width/height reflects the wl_output size.

> +
>  /* Apply the change from wl_output only if xdg-output is not supported */
>  if (!xwl_output->xdg_output) {
>  xwl_output->width = width;
>  xwl_output->height = height;
>  }
> -xwl_output->refresh = refresh;
>  }
>
>  static inline void
> @@ -224,8 +227,8 @@ apply_output_change(struct xwl_output *xwl_output)
>  /* xdg-output sends output size in compositor space. so already rotated 
> */
>  need_rotate = (xwl_output->xdg_output == NULL);
>
> -randr_mode = xwayland_cvt(xwl_output->width, xwl_output->height,
> -  xwl_output->refresh / 1000.0, 0, 0);
> +randr_mode = xwayland_cvt(xwl_output->mode_width, 
> xwl_output->mode_height,
> +  xwl_output->mode_refresh / 1000.0, 0, 0);

And we'd advertise wl_ouput size as RR size? That's not how it's meant
to work, we want RR to reflect the xdg-output (logical) size.

>  RROutputSetModes(xwl_output->randr_output, _mode, 1, 1);
>  RRCrtcNotify(xwl_output->randr_crtc, randr_mode,
>   xwl_output->x, xwl_output->y,
> diff --git a/hw/xwayland/xwayland.h b/hw/xwayland/xwayland.h
> index d70ad54bf..66daf58de 100644
> --- a/hw/xwayland/xwayland.h
> +++ b/hw/xwayland/xwayland.h
> @@ -368,7 +368,8 @@ struct xwl_output {
>  struct xwl_screen *xwl_screen;
>  RROutputPtr randr_output;
>  RRCrtcPtr randr_crtc;
> -int32_t x, y, width, height, refresh;
> +int32_t x, y, width, height;
> +int32_t mode_width, mode_height, mode_refresh;
>  Rotation rotation;
>  Bool wl_output_done;
>  Bool xdg_output_done;
> --
> 2.18.0

So, can you please elaborate exactly what this is supposed to fix and
how to reproduce the issue?

Cheers,
Olivier
___
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-video-amdgpu 3/3] Add RandR leases with modesetting driver support [v7]

2018-07-09 Thread Michel Dänzer
On 2018-07-07 02:36 AM, Keith Packard wrote:
> This adds support for RandR CRTC/Output leases through the modesetting
> driver, creating a lease using new kernel infrastructure and returning
> that to a client through an fd which will have access to only those
> resources.
> 
> [...]
> 
> + nobjects = ncrtc + noutput;
> +
> + if (nobjects == 0)
> + return BadValue;

As I mentioned on IRC, this addition can already overflow (to a non-0
value). That's one reason I decided against using xallocarray in my
patch (but instead explicitly check against overflow of the addition and
multiplication).


-- 
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 xf86-video-amdgpu 0/3] Add RandR lease support [v2]

2018-07-09 Thread Michel Dänzer
On 2018-07-07 02:36 AM, Keith Packard wrote:
> When we last saw these patches, they required current X server bits to build,
> while the project requires that the driver build back to X server 1.13. I've
> added suitable checks and wrapped the new code in #ifdefs now.

Well, this is unfortunate timing. Last Friday, I finally got around to
porting these myself, as I had promised I would, but ran out of time for
sending them out before the weekend. Sent out now:

https://patchwork.freedesktop.org/series/46153/

As my patches are simpler (due to e.g. taking advantage of existing
XF86_* defines), I'm inclined to go with them. Sorry for any time you've
wasted. If you could review my patches and maybe test that the lease
functionality is actually working, that would be much appreciated.


P.S. Until we migrate to gitlab, xf86-video-amdgpu patches are normally
being reviewed on the amd-gfx mailing list.

-- 
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: Revisiting the issue of obtaining Xorg commit privilege

2018-07-09 Thread René Rebe
Hi,

On 07 Jul 2018, at 10:33, Michel Dänzer  wrote:

> On 2018-07-07 04:56 AM, Kevin Brace wrote:
>> Hi,
>> 
>> I have not seen any movement in obtaining xorg/driver commit privilege.
>> 
>> https://bugs.freedesktop.org/show_bug.cgi?id=106605
>> 
>> Please note that several of my r128 DDX patches have been committed by 
>> Connor Behan.
> 
> The r128 repository will soon be migrated to gitlab.freedesktop.org,
> then it will be easier to give you write access.

as indicated earlier I would be invested to apply some patches and “maintain” 
the -impact and -suncg6 driver.
Should I just wait for the gitlab transition or actively ping or sometime?

René

-- 
 ExactCODE GmbH, Lietzenburger Str. 42, DE-10789 Berlin
 http://exactcode.com | http://exactscan.com | http://ocrkit.com | 
http://t2-project.org | http://rene.rebe.de

___
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: don't use logical size for RRMode

2018-07-09 Thread Simon Ser
The logical size is the size of the output in the global compositor
space. The mode width/height shouldn't be transformed and scaled.

This fixes issues with pointer input on transformed outputs.

Signed-Off-By: Simon Ser 
---
 hw/xwayland/xwayland-output.c | 9 ++---
 hw/xwayland/xwayland.h| 3 ++-
 2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/hw/xwayland/xwayland-output.c b/hw/xwayland/xwayland-output.c
index 379062549..44fd5c26a 100644
--- a/hw/xwayland/xwayland-output.c
+++ b/hw/xwayland/xwayland-output.c
@@ -113,12 +113,15 @@ output_handle_mode(void *data, struct wl_output 
*wl_output, uint32_t flags,
 if (!(flags & WL_OUTPUT_MODE_CURRENT))
 return;
 
+xwl_output->mode_width = width;
+xwl_output->mode_height = height;
+xwl_output->mode_refresh = refresh;
+
 /* Apply the change from wl_output only if xdg-output is not supported */
 if (!xwl_output->xdg_output) {
 xwl_output->width = width;
 xwl_output->height = height;
 }
-xwl_output->refresh = refresh;
 }
 
 static inline void
@@ -224,8 +227,8 @@ apply_output_change(struct xwl_output *xwl_output)
 /* xdg-output sends output size in compositor space. so already rotated */
 need_rotate = (xwl_output->xdg_output == NULL);
 
-randr_mode = xwayland_cvt(xwl_output->width, xwl_output->height,
-  xwl_output->refresh / 1000.0, 0, 0);
+randr_mode = xwayland_cvt(xwl_output->mode_width, xwl_output->mode_height,
+  xwl_output->mode_refresh / 1000.0, 0, 0);
 RROutputSetModes(xwl_output->randr_output, _mode, 1, 1);
 RRCrtcNotify(xwl_output->randr_crtc, randr_mode,
  xwl_output->x, xwl_output->y,
diff --git a/hw/xwayland/xwayland.h b/hw/xwayland/xwayland.h
index d70ad54bf..66daf58de 100644
--- a/hw/xwayland/xwayland.h
+++ b/hw/xwayland/xwayland.h
@@ -368,7 +368,8 @@ struct xwl_output {
 struct xwl_screen *xwl_screen;
 RROutputPtr randr_output;
 RRCrtcPtr randr_crtc;
-int32_t x, y, width, height, refresh;
+int32_t x, y, width, height;
+int32_t mode_width, mode_height, mode_refresh;
 Rotation rotation;
 Bool wl_output_done;
 Bool xdg_output_done;
-- 
2.18.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