RE: xcbproto: Meson added + doc

2024-06-06 Thread Peter Harris
> For the python related utilities: find_vpython.sh (find a python
> interpreter matching a version condition) and compile_py.sh (self
> explanatory), they have to be distributed.

I haven't looked at your repository, so please forgive me if I've missed
something important. But shouldn't these be handled by the Meson Python
module instead of shelling out to a script?

https://mesonbuild.com/Python-module.html

Peter Harris

Rocket Software, Inc. and subsidiaries ■ 77 Fourth Avenue, Waltham MA 02451 ■ 
Main Office Toll Free Number: +1 855.577.4323
Contact Customer Support: 
https://my.rocketsoftware.com/RocketCommunity/RCEmailSupport
Unsubscribe from Marketing Messages/Manage Your Subscription Preferences - 
http://www.rocketsoftware.com/manage-your-email-preferences
Privacy Policy - http://www.rocketsoftware.com/company/legal/privacy-policy


This communication and any attachments may contain confidential information of 
Rocket Software, Inc. All unauthorized use, disclosure or distribution is 
prohibited. If you are not the intended recipient, please notify Rocket 
Software immediately and destroy all copies of this communication. Thank you.


Re: [EXTERNAL] - trouble with Xace receive hook

2024-02-02 Thread Peter Harris

On 2024-02-02 4:10 PM, Enrico Weigelt, metux IT consult wrote:

Hello folks,


I'm currently writing a security extension and having trouble
understanding what's going on w/ receive hook and xeyes:

when moving the mouse, xeyes receives an event on the root window:
GenericEvent with evtype DestroyNotify. (when blocking this one, the
eyes don't move anymore).

Why does it get DestroyNotify, instead of MotionNotify ?

What am I doing wrong ?


You're looking up a Generic Event using the list of core (non-generic) 
event types.


First you need to look up the extension (in the extension field). Then 
you can look up the extension-specific event in evtype.


Assuming the extension is XInput, in this case you have an XI_RawMotion 
(17) instead of a DestroyNotify (17).


Peter Harris



Re: [EXTERNAL] - [Xlib] Ignoring BadAccess errors

2021-04-21 Thread Peter Harris

On 2021-04-20 7:19 AM, Nekun wrote:

I need a function which robustly returns an error


For this, you can call XGetXCBConnection and then use xcb "checked" 
functions to reliably retrieve the error (if any). For example, 
xcb_bell_checked() followed by xcb_request_check().


when we in untrusted context, which returned exactly when client 
is untrusted and not for any other reasons


Sorry, I'm afraid I can't help with this part.

Peter Harris
___
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: [EXTERNAL] - Re: [PATCH xserver 2/2] os: Add epoll-like port implementation for Solaris

2019-09-23 Thread Peter Harris
On 2019-09-23 Alan Coopersmith wrote:
> On 10/12/17 1:48 PM, Peter Harris wrote:
> > x11perf -noop with 200 xlogos connected is slightly faster with ports:
> >
> >before   after Operation
> > --   -   
> > 1840.0   1920.0 (1.04)   X protocol NoOperation
> 
> Is the version you tested with a different revision of the code than what got
> pushed?  After finally getting Xorg to build on Solaris 11.4 with meson, I 
> found
> that the code in git master doesn't build.  (I'd never noticed before since 
> it's not
> hooked up in autoconf, only meson.)

Well, that's embarrassing. It looks like I never tested the version I sent to 
X.org, due to a typo in my make file. (We use neither autoconf nor meson, 
although we should be switching to meson soon).

> The changes I needed to compile follow - tested briefly in Xnest with xev, 
> xterm,
> & x11perf -noop without seeing any problems.

These changes look good to me.

Sorry about that.

Peter Harris
___
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: [EXTERNAL] - [PATCH xorgproto] Add DPMSInfoNotify event

2018-10-02 Thread Peter Harris
On 2018-10-02 Alexander Volkov wrote:
> 
> -#define DPMSNumberEvents 0
> +#define DPMSNumberEvents 1

I don't have a strong opinion, so feel free to ignore me, but in general we 
don't add core events any more (the limited event space is already full in some 
configurations).

The "modern" way to add events to extensions is called "generic events". Xcb 
has . I'm not sure how Xlib works. See the Present extension 
for a recent example that uses generic events.

Peter Harris
___
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] composite: Fix use-after-free in compReparentWindow

2018-02-22 Thread Peter Harris
If an implicitly redirected window is unredirected by the reparent
operation, cw will be a stale pointer.

Signed-off-by: Peter Harris <phar...@opentext.com>
---
 composite/compwindow.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/composite/compwindow.c b/composite/compwindow.c
index e74ce661a..54b4e6ac4 100644
--- a/composite/compwindow.c
+++ b/composite/compwindow.c
@@ -432,7 +432,7 @@ compReparentWindow(WindowPtr pWin, WindowPtr pPriorParent)
 {
 ScreenPtr pScreen = pWin->drawable.pScreen;
 CompScreenPtr cs = GetCompScreen(pScreen);
-CompWindowPtr cw = GetCompWindow(pWin);
+CompWindowPtr cw;
 
 pScreen->ReparentWindow = cs->ReparentWindow;
 /*
@@ -471,6 +471,7 @@ compReparentWindow(WindowPtr pWin, WindowPtr pPriorParent)
 cs->ReparentWindow = pScreen->ReparentWindow;
 pScreen->ReparentWindow = compReparentWindow;
 
+cw = GetCompWindow(pWin);
 if (pWin->damagedDescendants || (cw && cw->damaged))
 compMarkAncestors(pWin);
 
-- 
2.14.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 3/3] render: Fix default picture format initialization

2018-02-22 Thread Peter Harris
> "depth" for a picture format is the sum of bits of a/r/g/b, and not x.
> The default format list was creating an x8r8g8b8 format at depth 32,
> which is wrong. Likewise, servers supporting depth 30 would get an
> x8r8g8b8 format at depth 30, which is nonsense.

>  formats[nformats].format = PICT_x8r8g8b8;
> -formats[nformats].depth = 32;
> +formats[nformats].depth = 24;

The RENDER extension forces a depth 32 pixmap format. It does not force depth 
24. So with a 16bpp root window, there may not be a depth 24 pixmap format, and 
this picture format would not be usable at all (BadMatch with every possible 
drawable). Also, d32 x8r8g8b8 is used in the wild (eg. it looks like gtk2 
sometimes uses it to avoid manually filling the alpha channel with 0xFF). I 
suspect we want to keep this one as-is.

A "depth 30 x8r8g8b8" probably isn't useful most of the time, but maybe it 
makes sense for PutImage-then-convert-in-the-server an x8r8g8b8 image to 
x2r10g10b10 without needing a second (not-depth-30) pixmap?

Peter Harris
___
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 util/macros] Drop -fno-strict-aliasing from XORG_CWARNFLAGS

2017-12-14 Thread Peter Harris
On 2017-12-14 11:35 AM, Michel Dänzer wrote:
> I don't think compilers can reliably warn about all strict aliasing
> violations yet (ever?).
> 
> Is this really worth the risk? Do you have any numbers showing tangible
> benefits of this change?

The main benefit is in code cleanliness, not necessarily performance.

The risk if we don't make this change is to those of us with non-gcc
compilers (that don't have -fno-strict-aliasing or an equivalent as an
option). Replacing -fno-strict-aliasing with -Werror=strict-aliasing is
a step in the right direction.

Peter Harris
-- 
   Open Text Connectivity Solutions Group
Peter Harrishttp://connectivity.opentext.com/
Research and DevelopmentPhone: +1 905 762 6001
phar...@opentext.comToll Free: 1 877 359 4866
___
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] composite: Propagate damagedDescendants when reparented

2017-12-14 Thread Peter Harris
If a window that is fully covered by an automatic-redirected descendant
(even implicitly, eg. via BackingStores) is reparented, the automatic
updates could be broken if the new parent is not marked as having
damaged descendants.

Fix this issue by propagating the damagedDescendants flag whenever a
window is reparented.

Signed-off-by: Peter Harris <phar...@opentext.com>
---
 composite/compalloc.c  | 21 +
 composite/compint.h|  2 ++
 composite/compwindow.c |  5 +
 3 files changed, 20 insertions(+), 8 deletions(-)

diff --git a/composite/compalloc.c b/composite/compalloc.c
index 05ffc7e85..433dc820a 100644
--- a/composite/compalloc.c
+++ b/composite/compalloc.c
@@ -67,6 +67,18 @@ compBlockHandler(ScreenPtr pScreen, void *pTimeout)
 cs->BlockHandler = NULL;
 }
 
+void
+compMarkAncestors(WindowPtr pWin)
+{
+pWin = pWin->parent;
+while (pWin) {
+if (pWin->damagedDescendants)
+return;
+pWin->damagedDescendants = TRUE;
+pWin = pWin->parent;
+}
+}
+
 static void
 compReportDamage(DamagePtr pDamage, RegionPtr pRegion, void *closure)
 {
@@ -81,14 +93,7 @@ compReportDamage(DamagePtr pDamage, RegionPtr pRegion, void 
*closure)
 }
 cw->damaged = TRUE;
 
-/* Mark the ancestors */
-pWin = pWin->parent;
-while (pWin) {
-if (pWin->damagedDescendants)
-break;
-pWin->damagedDescendants = TRUE;
-pWin = pWin->parent;
-}
+compMarkAncestors(pWin);
 }
 
 static void
diff --git a/composite/compint.h b/composite/compint.h
index f05c2d8a5..89f6507b9 100644
--- a/composite/compint.h
+++ b/composite/compint.h
@@ -236,6 +236,8 @@ Bool
 compReallocPixmap(WindowPtr pWin, int x, int y,
   unsigned int w, unsigned int h, int bw);
 
+void compMarkAncestors(WindowPtr pWin);
+
 /*
  * compinit.c
  */
diff --git a/composite/compwindow.c b/composite/compwindow.c
index f88238146..e74ce661a 100644
--- a/composite/compwindow.c
+++ b/composite/compwindow.c
@@ -432,6 +432,7 @@ compReparentWindow(WindowPtr pWin, WindowPtr pPriorParent)
 {
 ScreenPtr pScreen = pWin->drawable.pScreen;
 CompScreenPtr cs = GetCompScreen(pScreen);
+CompWindowPtr cw = GetCompWindow(pWin);
 
 pScreen->ReparentWindow = cs->ReparentWindow;
 /*
@@ -469,6 +470,10 @@ compReparentWindow(WindowPtr pWin, WindowPtr pPriorParent)
 (*pScreen->ReparentWindow) (pWin, pPriorParent);
 cs->ReparentWindow = pScreen->ReparentWindow;
 pScreen->ReparentWindow = compReparentWindow;
+
+if (pWin->damagedDescendants || (cw && cw->damaged))
+compMarkAncestors(pWin);
+
 compCheckTree(pWin->drawable.pScreen);
 }
 
-- 
2.14.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

[PATCH xserver 2/2] os: Add epoll-like port implementation for Solaris

2017-10-12 Thread Peter Harris
x11perf -noop with 200 xlogos connected is slightly faster with ports:

  before   after Operation
--   -   
1840.0   1920.0 (1.04)   X protocol NoOperation

Signed-off-by: Peter Harris <phar...@opentext.com>
---
 include/meson.build |   1 +
 os/ospoll.c | 128 +---
 2 files changed, 122 insertions(+), 7 deletions(-)

diff --git a/include/meson.build b/include/meson.build
index e0ebee258..8eec9ce36 100644
--- a/include/meson.build
+++ b/include/meson.build
@@ -126,6 +126,7 @@ conf_data.set('HAVE_MMAP', cc.has_function('mmap'))
 conf_data.set('HAVE_POLL', cc.has_function('poll'))
 conf_data.set('HAVE_POLLSET_CREATE', cc.has_function('pollset_create'))
 conf_data.set('HAVE_POSIX_FALLOCATE', cc.has_function('posix_fallocate'))
+conf_data.set('HAVE_PORT_CREATE', cc.has_function('port_create'))
 conf_data.set('HAVE_REALLOCARRAY', cc.has_function('reallocarray', 
dependencies: libbsd_dep))
 conf_data.set('HAVE_SETEUID', cc.has_function('seteuid'))
 conf_data.set('HAVE_SETITIMER', cc.has_function('setitimer'))
diff --git a/os/ospoll.c b/os/ospoll.c
index 4a59a5e6b..db9e73811 100644
--- a/os/ospoll.c
+++ b/os/ospoll.c
@@ -38,6 +38,12 @@
 #define HAVE_OSPOLL 1
 #endif
 
+#if !HAVE_OSPOLL && defined(HAVE_PORT_CREATE)
+#include 
+#define PORT1
+#define HAVE_OSPOLL 1
+#endif
+
 #if !HAVE_OSPOLL && defined(HAVE_EPOLL_CREATE1)
 #include 
 #define EPOLL   1
@@ -71,7 +77,7 @@ struct ospoll {
 
 #endif
 
-#if EPOLL
+#if EPOLL || PORT
 #include 
 
 /* epoll-based implementation */
@@ -128,7 +134,7 @@ ospoll_find(struct ospoll *ospoll, int fd)
 
 while (lo <= hi) {
 int m = (lo + hi) >> 1;
-#if EPOLL
+#if EPOLL || PORT
 int t = ospoll->fds[m]->fd;
 #endif
 #if POLL || POLLSET
@@ -145,7 +151,7 @@ ospoll_find(struct ospoll *ospoll, int fd)
 return -(lo + 1);
 }
 
-#if EPOLL
+#if EPOLL || PORT
 static void
 ospoll_clean_deleted(struct ospoll *ospoll)
 {
@@ -205,6 +211,17 @@ ospoll_create(void)
 }
 return ospoll;
 #endif
+#if PORT
+struct ospoll *ospoll = calloc(1, sizeof (struct ospoll));
+
+ospoll->epoll_fd = port_create();
+if (ospoll->epoll_fd < 0) {
+free (ospoll);
+return NULL;
+}
+xorg_list_init(>deleted);
+return ospoll;
+#endif
 #if EPOLL
 struct ospoll   *ospoll = calloc(1, sizeof (struct ospoll));
 
@@ -232,7 +249,7 @@ ospoll_destroy(struct ospoll *ospoll)
 free(ospoll);
 }
 #endif
-#if EPOLL
+#if EPOLL || PORT
 if (ospoll) {
 assert (ospoll->num == 0);
 close(ospoll->epoll_fd);
@@ -282,6 +299,41 @@ ospoll_add(struct ospoll *ospoll, int fd,
 ospoll->fds[pos].callback = callback;
 ospoll->fds[pos].data = data;
 #endif
+#if PORT
+struct ospollfd *osfd;
+
+if (pos < 0) {
+osfd = calloc(1, sizeof (struct ospollfd));
+if (!osfd)
+return FALSE;
+
+if (ospoll->num >= ospoll->size) {
+struct ospollfd **new_fds;
+int new_size = ospoll->size ? ospoll->size * 2 : MAXCLIENTS * 2;
+
+new_fds = reallocarray(ospoll->fds, new_size, sizeof 
(ospoll->fds[0]));
+if (!new_fds) {
+free (osfd);
+return FALSE;
+}
+ospoll->fds = new_fds;
+ospoll->size = new_size;
+}
+
+osfd->fd = fd;
+osfd->xevents = 0;
+
+pos = -pos - 1;
+array_insert(ospoll->fds, ospoll->num, sizeof (ospoll->fds[0]), pos);
+ospoll->fds[pos] = osfd;
+ospoll->num++;
+} else {
+osfd = ospoll->fds[pos];
+}
+osfd->data = data;
+osfd->callback = callback;
+osfd->trigger = trigger;
+#endif
 #if EPOLL
 struct ospollfd *osfd;
 
@@ -378,6 +430,16 @@ ospoll_remove(struct ospoll *ospoll, int fd)
 array_delete(ospoll->fds, ospoll->num, sizeof (ospoll->fds[0]), pos);
 ospoll->num--;
 #endif
+#if PORT
+struct ospollfd *osfd = ospoll->fds[pos];
+port_dissociate(ospoll->epoll_fd, PORT_SOURCE_FD, fd);
+
+array_delete(ospoll->fds, ospoll->num, sizeof (ospoll->fds[0]), pos);
+ospoll->num--;
+osfd->callback = NULL;
+osfd->data = NULL;
+xorg_list_add(>deleted, >deleted);
+#endif
 #if EPOLL
 struct ospollfd *osfd = ospoll->fds[pos];
 struct epoll_event ev;
@@ -400,6 +462,19 @@ ospoll_remove(struct ospoll *ospoll, int fd)
 }
 }
 
+#if PORT
+static void
+epoll_mod(struct ospoll *ospoll, struct ospollfd *osfd)
+{
+int events = 0;
+if (osfd->xevents & X_NOTIFY_READ)
+events |= EPOLLIN;
+if (osfd->xevents & X_NOTIFY_WRITE)
+events |= EPOLLOUT;
+port_associate(ospool->epoll_fd, PORT_SOUR

[PATCH xserver 1/2] os: Add epoll-like pollset implementation for AIX

2017-10-12 Thread Peter Harris
AIX's poll only allows FD_SETSIZE entries in the fd list, which is
insufficient for expanded MaxClients.

As a bonus, x11perf -noop with ~250 xlogos connected is slightly faster
with pollset:

 before  after Operation
-      
575.0   599.0 (1.04)   X protocol NoOperation

Signed-off-by: Peter Harris <phar...@opentext.com>
---
 include/meson.build |   1 +
 os/ospoll.c | 146 +++-
 2 files changed, 146 insertions(+), 1 deletion(-)

diff --git a/include/meson.build b/include/meson.build
index 5d746eb70..e0ebee258 100644
--- a/include/meson.build
+++ b/include/meson.build
@@ -124,6 +124,7 @@ conf_data.set('HAVE_GETPROGNAME', 
cc.has_function('getprogname'))
 conf_data.set('HAVE_GETZONEID', cc.has_function('getzoneid'))
 conf_data.set('HAVE_MMAP', cc.has_function('mmap'))
 conf_data.set('HAVE_POLL', cc.has_function('poll'))
+conf_data.set('HAVE_POLLSET_CREATE', cc.has_function('pollset_create'))
 conf_data.set('HAVE_POSIX_FALLOCATE', cc.has_function('posix_fallocate'))
 conf_data.set('HAVE_REALLOCARRAY', cc.has_function('reallocarray', 
dependencies: libbsd_dep))
 conf_data.set('HAVE_SETEUID', cc.has_function('seteuid'))
diff --git a/os/ospoll.c b/os/ospoll.c
index ca14a0c8c..4a59a5e6b 100644
--- a/os/ospoll.c
+++ b/os/ospoll.c
@@ -32,6 +32,12 @@
 #include "ospoll.h"
 #include "list.h"
 
+#if !HAVE_OSPOLL && defined(HAVE_POLLSET_CREATE)
+#include 
+#define POLLSET 1
+#define HAVE_OSPOLL 1
+#endif
+
 #if !HAVE_OSPOLL && defined(HAVE_EPOLL_CREATE1)
 #include 
 #define EPOLL   1
@@ -44,6 +50,27 @@
 #define HAVE_OSPOLL 1
 #endif
 
+#if POLLSET
+
+// pollset-based implementation (as seen on AIX)
+struct ospollfd {
+int fd;
+int xevents;
+short   revents;
+enum ospoll_trigger trigger;
+void(*callback)(int fd, int xevents, void *data);
+void*data;
+};
+
+struct ospoll {
+pollset_t   ps;
+struct ospollfd *fds;
+int num;
+int size;
+};
+
+#endif
+
 #if EPOLL
 #include 
 
@@ -104,7 +131,7 @@ ospoll_find(struct ospoll *ospoll, int fd)
 #if EPOLL
 int t = ospoll->fds[m]->fd;
 #endif
-#if POLL
+#if POLL || POLLSET
 int t = ospoll->fds[m].fd;
 #endif
 
@@ -168,6 +195,16 @@ array_delete(void *base, size_t num, size_t size, size_t 
pos)
 struct ospoll *
 ospoll_create(void)
 {
+#if POLLSET
+struct ospoll *ospoll = calloc(1, sizeof (struct ospoll));
+
+ospoll->ps = pollset_create(-1);
+if (ospoll->ps < 0) {
+free (ospoll);
+return NULL;
+}
+return ospoll;
+#endif
 #if EPOLL
 struct ospoll   *ospoll = calloc(1, sizeof (struct ospoll));
 
@@ -187,6 +224,14 @@ ospoll_create(void)
 void
 ospoll_destroy(struct ospoll *ospoll)
 {
+#if POLLSET
+if (ospoll) {
+assert (ospoll->num == 0);
+pollset_destroy(ospoll->ps);
+free(ospoll->fds);
+free(ospoll);
+}
+#endif
 #if EPOLL
 if (ospoll) {
 assert (ospoll->num == 0);
@@ -213,6 +258,30 @@ ospoll_add(struct ospoll *ospoll, int fd,
void *data)
 {
 int pos = ospoll_find(ospoll, fd);
+#if POLLSET
+if (pos < 0) {
+if (ospoll->num == ospoll->size) {
+struct ospollfd *new_fds;
+int new_size = ospoll->size ? ospoll->size * 2 : MAXCLIENTS * 2;
+
+new_fds = reallocarray(ospoll->fds, new_size, sizeof 
(ospoll->fds[0]));
+if (!new_fds)
+return FALSE;
+ospoll->fds = new_fds;
+ospoll->size = new_size;
+}
+pos = -pos - 1;
+array_insert(ospoll->fds, ospoll->num, sizeof (ospoll->fds[0]), pos);
+ospoll->num++;
+
+ospoll->fds[pos].fd = fd;
+ospoll->fds[pos].xevents = 0;
+ospoll->fds[pos].revents = 0;
+}
+ospoll->fds[pos].trigger = trigger;
+ospoll->fds[pos].callback = callback;
+ospoll->fds[pos].data = data;
+#endif
 #if EPOLL
 struct ospollfd *osfd;
 
@@ -301,6 +370,14 @@ ospoll_remove(struct ospoll *ospoll, int fd)
 
 pos = ospoll_find(ospoll, fd);
 if (pos >= 0) {
+#if POLLSET
+struct ospollfd *osfd = >fds[pos];
+struct poll_ctl ctl = { .cmd = PS_DELETE, .fd = fd };
+pollset_ctl(ospoll->ps, , 1);
+
+array_delete(ospoll->fds, ospoll->num, sizeof (ospoll->fds[0]), pos);
+ospoll->num--;
+#endif
 #if EPOLL
 struct ospollfd *osfd = ospoll->fds[pos];
 struct epoll_event ev;
@@ -346,6 +423,19 @@ ospoll_listen(struct ospoll *ospoll, int fd, int xevents)
 int pos = ospoll_find(ospoll, fd);
 
 if (pos >= 0) {
+#if POLLSET
+struct poll_ctl ctl = { .cmd = PS_MOD, .fd = fd };

Re: [PATCH xserver v2] meson: Fix epoll detection

2017-08-14 Thread Peter Harris
On 2017-08-14 4:45 PM, Keith Packard wrote:
> Peter Harris <phar...@opentext.com> writes:
>> -#if !HAVE_OSPOLL && HAVE_EPOLL_CREATE1
>> +#if !HAVE_OSPOLL && defined(HAVE_EPOLL_CREATE1)
> 
> Should be using defined for HAVE_OSPOLL as well?

HAVE_OSPOLL is only defined inside this file, not by autoconf/meson, so
it's always defined to 1.

The rest of os/ospoll.c uses #if instead of #ifdef everywhere. I'd be
inclined to update all of them if I were to paint that particular bikeshed.

Peter Harris
-- 
   Open Text Connectivity Solutions Group
Peter Harrishttp://connectivity.opentext.com/
Research and DevelopmentPhone: +1 905 762 6001
phar...@opentext.comToll Free: 1 877 359 4866
___
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] meson: Fix epoll detection

2017-08-11 Thread Peter Harris
On 2017-08-11 5:50 AM, Peter Hutterer wrote:
> On Tue, Aug 08, 2017 at 11:16:13AM -0400, Peter Harris wrote:
>> The epoll code depends on epoll_create1, not epoll_create.
>>
>> The trinary " ? 1 : false" is used because HAVE_EPOLL_CREATE1 is tested
>> with #if instead of #ifdef.
> 
> might be worth using conf_data.set10(...) then? that should write out 0/1
> correctly.

".set10" writes 1 or 0, whereas "? 1 : false" writes 1 or #undef, which
more closely matches what autoconf does.

I'm fine with .set10 if you don't mind a little divergence. Or I could
change #if HAVE_EPOLL_CREATE1 to #ifdef HAVE_EPOLL_CREATE1 to match
(most of) the rest of the server instead, if you prefer.

Peter Harris
-- 
   Open Text Connectivity Solutions Group
Peter Harrishttp://connectivity.opentext.com/
Research and DevelopmentPhone: +1 905 762 6001
phar...@opentext.comToll Free: 1 877 359 4866
___
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] meson: Fix epoll detection

2017-08-08 Thread Peter Harris
The epoll code depends on epoll_create1, not epoll_create.

The trinary " ? 1 : false" is used because HAVE_EPOLL_CREATE1 is tested
with #if instead of #ifdef.

Signed-off-by: Peter Harris <phar...@opentext.com>
---
 include/meson.build | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/meson.build b/include/meson.build
index 78ec521ac..850c140fa 100644
--- a/include/meson.build
+++ b/include/meson.build
@@ -110,7 +110,7 @@ conf_data.set('HAVE_UNISTD_H', cc.has_header('unistd.h'))
 conf_data.set('HAVE_ARC4RANDOM_BUF', cc.has_function('arc4random_buf', 
dependencies: libbsd_dep))
 conf_data.set('HAVE_BACKTRACE', cc.has_function('backtrace'))
 conf_data.set('HAVE_CBRT', cc.has_function('cbrt'))
-conf_data.set('HAVE_EPOLL_CREATE', cc.has_function('epoll_create'))
+conf_data.set('HAVE_EPOLL_CREATE1', cc.has_function('epoll_create1') ? 1 : 
false)
 conf_data.set('HAVE_FFS', cc.has_function('ffs'))
 conf_data.set('HAVE_GETUID', cc.has_function('getuid'))
 conf_data.set('HAVE_GETEUID', cc.has_function('geteuid'))
-- 
2.11.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: [PATCH xserver] glx: Erase glx client private before using

2017-08-03 Thread Peter Harris
On 2017-08-03 11:50 AM, Keith Packard wrote:
> Adam Jackson <a...@nwnk.net> writes:
> 
>>
>> I beg your pardon?
>>
>> if (!dixRegisterPrivateKey
>> (, PRIVATE_CLIENT, sizeof(__GLXclientState)))
>> return;
>>
>> Client privates aren't pre-zeroed? I was pretty sure they were.
> 
> Nope:
> 
> ...
> clients[i] = client =
> dixAllocateObjectWithPrivates(ClientRec, PRIVATE_CLIENT);
> ...
> #define dixAllocateObjectWithPrivates(t, type) (t *) 
> _dixAllocateObjectWithPrivates(sizeof(t), sizeof(t), offsetof(t, 
> devPrivates), type)
> ...
> void *
> _dixAllocateObjectWithPrivates(unsigned baseSize, unsigned clear,
>unsigned offset, DevPrivateType type)
> ...
> object = malloc(totalSize);
> if (!object)
> return NULL;
> 
> memset(object, '\0', clear);

...
privates = (PrivatePtr) (((char *) object) + baseSize);
devPrivates = (PrivatePtr *) ((char *) object + offset);

_dixInitPrivates(devPrivates, privates, type);

which in turn calls

memset(addr, '\0', global_keys[type].offset);

(where addr is "privates").

> I could easily be convinced that this is a bug and that
> _dixAllocateObjectWithPrivates should clear the entire object and
> privates out, as I was also surprised to see this.

I could easily be convinced that client structures are re-used; I
haven't checked that path.

Peter Harris
-- 
   Open Text Connectivity Solutions Group
Peter Harrishttp://connectivity.opentext.com/
Research and DevelopmentPhone: +1 905 762 6001
phar...@opentext.comToll Free: 1 877 359 4866
___
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: [EXTERNAL] - Re: [PATCH xserver 4/4] meson: Detect strlcat/strlcpy/reallocarray in libbsd

2017-05-10 Thread Peter Harris
On 2017-05-10 3:26 PM, Adam Jackson wrote:
> On Wed, 2017-05-10 at 10:11 +0100, Eric Engestrom wrote:
>> On Tuesday, 2017-05-09 19:39:47 -0400, Peter Harris wrote:
>>> +#if defined HAVE_LIBBSD && defined HAVE_REALLOCARRAY
>>
>> nit: most of the codebase uses `defined(FOO)` (313 vs 5 occurences)
>> quick sed to fix it: s/defined\s+(\w+)/defined\(\1\)/g
> 
> Fixed this and merged the series:

Thanks!

Peter Harris
-- 
   Open Text Connectivity Solutions Group
Peter Harrishttp://connectivity.opentext.com/
Research and DevelopmentPhone: +1 905 762 6001
phar...@opentext.comToll Free: 1 877 359 4866
___
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 4/4] meson: Detect strlcat/strlcpy/reallocarray in libbsd

2017-05-09 Thread Peter Harris
If we're linking with libbsd anyway, we might as well use the functions
it provides instead of compiling our replacements.

Signed-off-by: Peter Harris <phar...@opentext.com>
---
 include/meson.build | 6 +++---
 include/os.h| 6 ++
 2 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/include/meson.build b/include/meson.build
index 40614e23b..7296b47b5 100644
--- a/include/meson.build
+++ b/include/meson.build
@@ -112,15 +112,15 @@ conf_data.set('HAVE_GETZONEID', 
cc.has_function('getzoneid'))
 conf_data.set('HAVE_MMAP', cc.has_function('mmap'))
 conf_data.set('HAVE_POLL', cc.has_function('poll'))
 conf_data.set('HAVE_POSIX_FALLOCATE', cc.has_function('posix_fallocate'))
-conf_data.set('HAVE_REALLOCARRAY', cc.has_function('reallocarray'))
+conf_data.set('HAVE_REALLOCARRAY', cc.has_function('reallocarray', 
dependencies: libbsd_dep))
 conf_data.set('HAVE_SETEUID', cc.has_function('seteuid'))
 conf_data.set('HAVE_SETITIMER', cc.has_function('setitimer'))
 conf_data.set('HAVE_SHMCTL64', cc.has_function('shmctl64'))
 conf_data.set('HAVE_SIGACTION', cc.has_function('sigaction'))
 conf_data.set('HAVE_STRCASECMP', cc.has_function('strcasecmp'))
 conf_data.set('HAVE_STRCASESTR', cc.has_function('strcasestr'))
-conf_data.set('HAVE_STRLCAT', cc.has_function('strlcat'))
-conf_data.set('HAVE_STRLCPY', cc.has_function('strlcpy'))
+conf_data.set('HAVE_STRLCAT', cc.has_function('strlcat', dependencies: 
libbsd_dep))
+conf_data.set('HAVE_STRLCPY', cc.has_function('strlcpy', dependencies: 
libbsd_dep))
 conf_data.set('HAVE_STRNCASECMP', cc.has_function('strncasecmp'))
 conf_data.set('HAVE_STRNDUP', cc.has_function('strndup'))
 conf_data.set('HAVE_TIMINGSAFE_MEMCMP', cc.has_function('timingsafe_memcmp'))
diff --git a/include/os.h b/include/os.h
index fb09d00c7..8fd8fb212 100644
--- a/include/os.h
+++ b/include/os.h
@@ -54,6 +54,12 @@ SOFTWARE.
 #ifdef MONOTONIC_CLOCK
 #include 
 #endif
+#if defined HAVE_LIBBSD && defined HAVE_REALLOCARRAY
+#include/* for reallocarray */
+#endif
+#if defined HAVE_LIBBSD && defined HAVE_STRLCPY
+#include/* for strlcpy, strlcat */
+#endif
 
 #define SCREEN_SAVER_ON   0
 #define SCREEN_SAVER_OFF  1
-- 
2.11.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

[PATCH xserver 2/4] meson: Detect more functions

2017-05-09 Thread Peter Harris
Set HAVE_REALLOCARRAY, HAVE_SIGACTION, HAVE_STRCASESTR, HAVE_STRLCAT,
HAVE_STRLCPY, HAVE_TIMINGSAFE_MEMCMP, and BUSFAULT.

Signed-off-by: Peter Harris <phar...@opentext.com>
---
 include/meson.build | 10 --
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/include/meson.build b/include/meson.build
index d032fb37f..40614e23b 100644
--- a/include/meson.build
+++ b/include/meson.build
@@ -59,8 +59,6 @@ conf_data.set('CONFIG_WSCONS', host_machine.system() == 
'openbsd')
 # that just uses whatever directory works?
 conf_data.set_quoted('SHMDIR', '/tmp')
 
-conf_data.set('HAVE_SIGACTION', '1') # XXX
-conf_data.set('BUSFAULT', '1') # XXX
 conf_data.set('XSHMFENCE', '1') # XXX
 conf_data.set('WITH_LIBDRM', '1') # XXX
 conf_data.set('GLAMOR_HAS_DRM_NAME_FROM_FD_2',
@@ -114,16 +112,24 @@ conf_data.set('HAVE_GETZONEID', 
cc.has_function('getzoneid'))
 conf_data.set('HAVE_MMAP', cc.has_function('mmap'))
 conf_data.set('HAVE_POLL', cc.has_function('poll'))
 conf_data.set('HAVE_POSIX_FALLOCATE', cc.has_function('posix_fallocate'))
+conf_data.set('HAVE_REALLOCARRAY', cc.has_function('reallocarray'))
 conf_data.set('HAVE_SETEUID', cc.has_function('seteuid'))
 conf_data.set('HAVE_SETITIMER', cc.has_function('setitimer'))
 conf_data.set('HAVE_SHMCTL64', cc.has_function('shmctl64'))
+conf_data.set('HAVE_SIGACTION', cc.has_function('sigaction'))
 conf_data.set('HAVE_STRCASECMP', cc.has_function('strcasecmp'))
+conf_data.set('HAVE_STRCASESTR', cc.has_function('strcasestr'))
+conf_data.set('HAVE_STRLCAT', cc.has_function('strlcat'))
+conf_data.set('HAVE_STRLCPY', cc.has_function('strlcpy'))
 conf_data.set('HAVE_STRNCASECMP', cc.has_function('strncasecmp'))
 conf_data.set('HAVE_STRNDUP', cc.has_function('strndup'))
+conf_data.set('HAVE_TIMINGSAFE_MEMCMP', cc.has_function('timingsafe_memcmp'))
 conf_data.set('HAVE_VASPRINTF', cc.has_function('vasprintf'))
 conf_data.set('HAVE_VSNPRINTF', cc.has_function('vsnprintf'))
 conf_data.set('HAVE_WALKCONTEXT', cc.has_function('walkcontext'))
 
+conf_data.set('BUSFAULT', conf_data.get('HAVE_SIGACTION'))
+
 # Don't let X dependencies typedef 'pointer'
 conf_data.set('_XTYPEDEF_POINTER', '1')
 conf_data.set('_XITYPEDEF_POINTER', '1')
-- 
2.11.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

[PATCH xserver 1/4] meson: Detect arc4random_buf

2017-05-09 Thread Peter Harris
Signed-off-by: Peter Harris <phar...@opentext.com>
---
 include/meson.build | 1 +
 1 file changed, 1 insertion(+)

diff --git a/include/meson.build b/include/meson.build
index 761f158d7..d032fb37f 100644
--- a/include/meson.build
+++ b/include/meson.build
@@ -98,6 +98,7 @@ conf_data.set('HAVE_SYS_UTSNAME_H', 
cc.has_header('sys/utsname.h'))
 conf_data.set('HAVE_SYS_SYSMACROS_H', cc.has_header('sys/sysmacros.h'))
 conf_data.set('HAVE_UNISTD_H', cc.has_header('unistd.h'))
 
+conf_data.set('HAVE_ARC4RANDOM_BUF', cc.has_function('arc4random_buf', 
dependencies: libbsd_dep))
 conf_data.set('HAVE_BACKTRACE', cc.has_function('backtrace'))
 conf_data.set('HAVE_CBRT', cc.has_function('cbrt'))
 conf_data.set('HAVE_EPOLL_CREATE', cc.has_function('epoll_create'))
-- 
2.11.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

[PATCH xserver 3/4] meson: Only detect each function once

2017-05-09 Thread Peter Harris
Use conf_data outside of include/ to avoid re-running detection of the
same functions.

Signed-off-by: Peter Harris <phar...@opentext.com>
---
 os/meson.build | 18 +-
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/os/meson.build b/os/meson.build
index 724e6d1a8..940c6f4d0 100644
--- a/os/meson.build
+++ b/os/meson.build
@@ -21,32 +21,32 @@ srcs_os = [
 
 # Wrapper code for missing C library functions
 srcs_libc = []
-if not cc.has_function('reallocarray')
+if not conf_data.get('HAVE_REALLOCARRAY')
 srcs_libc += 'reallocarray.c'
 endif
-if not cc.has_function('strcasecmp')
+if not conf_data.get('HAVE_STRCASECMP')
 srcs_libc += 'strcasecmp.c'
 endif
-if not cc.has_function('strcasestr')
+if not conf_data.get('HAVE_STRCASESTR')
 srcs_libc += 'strcasestr.c'
 endif
-if not cc.has_function('strlcat')
+if not conf_data.get('HAVE_STRLCAT')
 srcs_libc += 'strlcat.c'
 endif
-if not cc.has_function('strlcpy')
+if not conf_data.get('HAVE_STRLCPY')
 srcs_libc += 'strlcpy.c'
 endif
-if not cc.has_function('strndup')
+if not conf_data.get('HAVE_STRNDUP')
 srcs_libc += 'strndup.c'
 endif
-if not cc.has_function('timingsafe_memcmp')
+if not conf_data.get('HAVE_TIMINGSAFE_MEMCMP')
 srcs_libc += 'timingsafe_memcmp.c'
 endif
-if not cc.has_function('poll')
+if not conf_data.get('HAVE_POLL')
 srcs_os += 'xserver_poll.c'
 endif
 
-if cc.has_function('sigaction')
+if conf_data.get('BUSFAULT')
 srcs_os += 'busfault.c'
 endif
 
-- 
2.11.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

[PATCH xserver 0/4] A few meson fixes

2017-05-09 Thread Peter Harris
Mostly I was annoyed at the unused return value warning from the
non-arc4random path. I noticed a few other minor things while I was in
there.

Peter Harris (4):
  meson: Detect arc4random_buf
  meson: Detect more functions
  meson: Only detect each function once
  meson: Detect strlcat/strlcpy/reallocarray in libbsd

 include/meson.build | 11 +--
 include/os.h|  6 ++
 os/meson.build  | 18 +-
 3 files changed, 24 insertions(+), 11 deletions(-)
___
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 v2] Fix id in error when resource does not exist

2016-10-06 Thread Peter Harris
On 2016-10-06 1:07 PM, Adam Jackson wrote:
> On Thu, 2016-09-29 at 11:17 -0400, Peter Harris wrote:
>> Always set client->errorValue before returning an error.
> 
> As sensible as this seems, I think it's wrong.  I ran across something
> similar a few years ago:
> 
> https://lists.freedesktop.org/archives/xorg-devel/2011-June/023462.html
> 
> BadMatch errors are specified as not filling in errorValue, so...
> 
>> @@ -1220,11 +1220,13 @@ dixLookupResourceByType(void **result, XID id, 
>> RESTYPE rtype,
>>  if (res->id == id && res->type == rtype)
>>  break;
>>  }
>> +if (client) {
>> +client->errorValue = id;
>> +}
>>  if (!res)
>>  return resourceTypes[rtype & TypeMask].errorValue;
>>  
>>  if (client) {
>> -client->errorValue = id;
>>  cid = XaceHook(XACE_RESOURCE_ACCESS, client, id, res->type,
>> res->value, RT_NONE, NULL, mode);
>>  if (cid == BadValue)
> 
> ... imagine ChangeGC specifying more than one of {tile, stipple, font,
> clipmask pixmap}.  Whichever one is looked up last will be the
> errorValue thrown with the eventual BadMatch, which beyond being
> against the spec also means you might be misled about which resource is
> failing the match.

But that's already the case with the current code. When the lookup
succeeds, client->errorValue is set to whatever was looked up (by the
line removed in this patch). Yes, the next BadMatch is going to have
nonsense in a few bytes defined to be padding bytes, but that was
already the case.

This patch only moves the setting of client->errorValue above the
"Resource Not Found" return. So the error definitely[1] isn't BadMatch,
and we want the ID to be the thing that actually doesn't exist, instead
of the previous thing that does exist.

This patch only makes a difference[1] when the error value isn't BadMatch.

The thing that bit me was a BadGC with errorValue set to the drawable of
the offending request, which took some head-scratching to figure out.

Peter Harris

[1] Unless an extension calls SetResourceTypeErrorValue(resType,
BadMatch). Which would be crazy.
-- 
   Open Text Connectivity Solutions Group
Peter Harrishttp://connectivity.opentext.com/
Research and DevelopmentPhone: +1 905 762 6001
phar...@opentext.comToll Free: 1 877 359 4866
___
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 v2] Fix id in error when resource does not exist

2016-09-29 Thread Peter Harris
Always set client->errorValue before returning an error.

Test program:

#include 
#include 
#include 

#define BAD_VALUE 0xFACE0FF

int main(int argc, char *argv[]) {
int screen = 0;
xcb_connection_t *c = xcb_connect(NULL, );
if (!c) {
printf("Cannot connect\n");
return 1;
}

xcb_void_cookie_t tok = xcb_free_gc_checked(c, BAD_VALUE);
xcb_g_context_error_t *err = (xcb_g_context_error_t *)xcb_request_check(c, 
tok);
if (!err) {
printf("Unexpected request success\n");
return 1;
}
if (err->bad_value != BAD_VALUE) {
printf("Error: Got 0x%X, expected 0x%X\n", err->bad_value, BAD_VALUE);
return 1;
}
printf("Success! Got expected bad value of 0x%X\n", BAD_VALUE);
return 0;
}

Signed-off-by: Peter Harris <phar...@opentext.com>
---

v2 changes: Add sign-off


 dix/resource.c | 8 ++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/dix/resource.c b/dix/resource.c
index ad71b24..68efd24 100644
--- a/dix/resource.c
+++ b/dix/resource.c
@@ -1220,11 +1220,13 @@ dixLookupResourceByType(void **result, XID id, RESTYPE 
rtype,
 if (res->id == id && res->type == rtype)
 break;
 }
+if (client) {
+client->errorValue = id;
+}
 if (!res)
 return resourceTypes[rtype & TypeMask].errorValue;
 
 if (client) {
-client->errorValue = id;
 cid = XaceHook(XACE_RESOURCE_ACCESS, client, id, res->type,
res->value, RT_NONE, NULL, mode);
 if (cid == BadValue)
@@ -1253,11 +1255,13 @@ dixLookupResourceByClass(void **result, XID id, RESTYPE 
rclass,
 if (res->id == id && (res->type & rclass))
 break;
 }
+if (client) {
+client->errorValue = id;
+}
 if (!res)
 return BadValue;
 
 if (client) {
-client->errorValue = id;
 cid = XaceHook(XACE_RESOURCE_ACCESS, client, id, res->type,
res->value, RT_NONE, NULL, mode);
 if (cid != Success)
-- 
2.7.4

___
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] Fix id in error when resource does not exist

2016-09-28 Thread Peter Harris
Always set client->errorValue before returning an error.


Test program:

#include 
#include 
#include 

#define BAD_VALUE 0xFACE0FF

int main(int argc, char *argv[]) {
int screen = 0;
xcb_connection_t *c = xcb_connect(NULL, );
if (!c) {
printf("Cannot connect\n");
return 1;
}

xcb_void_cookie_t tok = xcb_free_gc_checked(c, BAD_VALUE);
xcb_g_context_error_t *err = (xcb_g_context_error_t *)xcb_request_check(c, 
tok);
if (!err) {
printf("Unexpected request success\n");
return 1;
}
if (err->bad_value != BAD_VALUE) {
printf("Error: Got 0x%X, expected 0x%X\n", err->bad_value, BAD_VALUE);
return 1;
}
printf("Success! Got expected bad value of 0x%X\n", BAD_VALUE);
return 0;
}

---

I was confused for a while when a BadGC error report had the XID of a drawable
in it.

 dix/resource.c | 8 ++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/dix/resource.c b/dix/resource.c
index ad71b24..68efd24 100644
--- a/dix/resource.c
+++ b/dix/resource.c
@@ -1220,11 +1220,13 @@ dixLookupResourceByType(void **result, XID id, RESTYPE 
rtype,
 if (res->id == id && res->type == rtype)
 break;
 }
+if (client) {
+client->errorValue = id;
+}
 if (!res)
 return resourceTypes[rtype & TypeMask].errorValue;
 
 if (client) {
-client->errorValue = id;
 cid = XaceHook(XACE_RESOURCE_ACCESS, client, id, res->type,
res->value, RT_NONE, NULL, mode);
 if (cid == BadValue)
@@ -1253,11 +1255,13 @@ dixLookupResourceByClass(void **result, XID id, RESTYPE 
rclass,
 if (res->id == id && (res->type & rclass))
 break;
 }
+if (client) {
+client->errorValue = id;
+}
 if (!res)
 return BadValue;
 
 if (client) {
-client->errorValue = id;
 cid = XaceHook(XACE_RESOURCE_ACCESS, client, id, res->type,
res->value, RT_NONE, NULL, mode);
 if (cid != Success)
-- 
2.7.4

___
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: Damage as a DIX notion

2016-09-26 Thread Peter Harris
On 2016-09-26 5:34 AM, Michel Dänzer wrote:
> On 26/09/16 11:23 AM, Keith Packard wrote:
>> A data-driven approach would be awesome here. Do we have a reasonable
>> performance metric? I'm no fan of gratuitous complexity, but text
>> performance is pretty important to me.
> 
> Here are some data points with the radeon driver using glamor on
> radeonsi. This is comparing the default configuration with Option
> "TearFree" (which uses extents based damage tracking as described in
> my other post):
> 
> 1: /tmp/baseline.txt
> 2: /tmp/tearfree.txt
> 
>1 2 Operation
>    -   -
>  19400.014800.0 ( 0.763)   Dot 
>966.0  915.0 ( 0.947)   Char in 80-char aa line (Charter 
> 10) 

I've found that careful use of the _mm_max_epi16/_mm_min_epi16
intrinsics pushes the cost for calculating the bounds of Dot down into
the noise. Presumably the non-Intel platforms have something similar in
their SIMD instruction sets too, but I'm not sure how "pixman" you want
to go on this.

Peter Harris
-- 
   Open Text Connectivity Solutions Group
Peter Harrishttp://connectivity.opentext.com/
Research and DevelopmentPhone: +1 905 762 6001
phar...@opentext.comToll Free: 1 877 359 4866
___
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] FlushAllOutput: Only call FlushCallbacks when actually flushing data

2016-07-11 Thread Peter Harris
On 2016-07-08 16:33, Keith Packard wrote:
> Adam Jackson <a...@nwnk.net> writes:
> 
>> Still not cool with committing code that we _know_ will break a
>> supported platform.
> 
> Oh, right, windows. Hrm. Suggestions welcome, but I suspect the only
> workable solution will be to write some windows-specific code that does
> the wait for multiple objects thing. We can't use select because the
> fd_set data structure, while 'poll-like', has a fixed number of fds, and
> we can't use poll because it's broken.

The number of fds in fd_set isn't really fixed. FD_SETSIZE is user
controlled, so I can't imagine a problem with massaging fd_set into C99
variable-length-array form:

typedef struct xfd_set {
u_int fd_count;
SOCKET  fd_array[];
} xfd_set;

and reallocing to taste.

Peter Harris
-- 
   Open Text Connectivity Solutions Group
Peter Harrishttp://connectivity.opentext.com/
Research and DevelopmentPhone: +1 905 762 6001
phar...@opentext.comToll Free: 1 877 359 4866
___
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: pythonic XCB build error

2016-04-11 Thread Peter Harris
On 2016-04-11 12:32, Simon Thum wrote:
> Does anyone know what is the "correct" fix? Older/newer python, wait for
> master to fix it, set the tab differently?

I'd like to invite you to review patches on the xcb list. If you would
be kind enough to review/test
https://lists.freedesktop.org/archives/xcb/2016-March/010711.html and
https://lists.freedesktop.org/archives/xcb/2016-March/010710.html and
surrounding patch sets, they will go into master faster.

Thanks,
 Peter Harris
-- 
   Open Text Connectivity Solutions Group
Peter Harrishttp://connectivity.opentext.com/
Research and DevelopmentPhone: +1 905 762 6001
phar...@opentext.comToll Free: 1 877 359 4866
___
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] os: Treat ssh as a non-local client

2015-12-08 Thread Peter Harris
On 2015-12-08 13:55, Adam Jackson wrote:
> 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.

Was sshd never updated to take advantage of "dix: Extend initial
connection handshake for forwarding proxies"?

http://cgit.freedesktop.org/xorg/xserver/commit/?id=78fa121f4097d29458e5453c13473595df06e26e

Peter Harris
-- 
   Open Text Connectivity Solutions Group
Peter Harrishttp://connectivity.opentext.com/
Research and DevelopmentPhone: +1 905 762 6001
phar...@opentext.comToll Free: 1 877 359 4866
___
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 01/20] Remove non-smart scheduler. Don't require setitimer.

2015-11-20 Thread Peter Harris
On 2015-11-17 15:10, Adam Jackson wrote:
> On Wed, 2015-11-11 at 22:02 -0800, Keith Packard wrote:
>> This allows the server to call GetTimeInMillis() after each request is
>> processed to avoid needing setitimer. -dumbSched now turns off the
>> setitimer.
> 
> I'm not sure there are real systems we'd be protecting by not requiring
> setitimer.  But, at least on my Ivybridge, this only dings noop
> performance by like 1% when using -dumbSched.  Probably this would be
> worse on non-vdso setups, but anyone with both of those problems is
> already in pretty bad shape.

Data point:

I've got a Dell box (also Ivy Bridge) where calling GetTimeInMillis()
after each request dings noop performance by like 30% because the TSC is
unstable.

Performance would be fine on Fedora, where the server uses
CLOCK_MONOTONIC_COARSE, but Ubuntu's CLOCK_MONOTONIC_COARSE only has a
4ms resolution so it falls back to reading the HPET every time.

That said, this box is an outlier. Every other recent box I can put my
hands on has a fast GetTimeInMillis().

Peter Harris
-- 
   Open Text Connectivity Solutions Group
Peter Harrishttp://connectivity.opentext.com/
Research and DevelopmentPhone: +1 905 762 6001
phar...@opentext.comToll Free: 1 877 359 4866
___
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 2/7] Add 'likely' and 'unlikely' macros

2015-05-15 Thread Peter Harris
On 2015-05-15 01:48, Alan Coopersmith wrote:
 
 Speaking of which, something I've wondered about for a while, but never
 had time to test, is if telling the server to optimize for valid requests
 would make a difference, such as:

  #define REQUEST_AT_LEAST_SIZE(req) \
 -if ((sizeof(req)  2)  client-req_len )\
 +if (_X_UNLIKELY((sizeof(req)  2)  client-req_len )) \
   return(BadLength)

 If anyone wants to try it out and report back, please do so!

Slightly less than 1% improvement on x11perf -noop. Stable over multiple
runs:

  before   after Operation
--   -   
1380.0   1390.0 (1.01)   X protocol NoOperation

I didn't try the full patch or a full x11perf run, but it seems unlikely
that it would be significant on a real load.

Test environment:
Intel(R) Xeon(R) CPU E5-1607 v2 @ 3.00GHz
gcc 4.9.2-10ubuntu13
Relevant CFLAGS: -m64 -mtune=generic -O2 -flto

Peter Harris
-- 
   Open Text Connectivity Solutions Group
Peter Harrishttp://connectivity.opentext.com/
Research and DevelopmentPhone: +1 905 762 6001
phar...@opentext.comToll Free: 1 877 359 4866
___
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] Fix border tile origin when background is ParentRelative

2015-05-12 Thread Peter Harris
According to
http://www.x.org/releases/X11R7.7/doc/xproto/x11protocol.html#requests:CreateWindow
The border tile origin is always the same as the background tile
origin.

ChangeWindowAttributes goes to some effort to make sure it repaints
the border tile whenever the background origin may have changed, but
miPaintWindow was ignoring the background origin.

Found by xts XChangeWindowAttributes-3

Signed-off-by: Peter Harris phar...@opentext.com
---

Originally sent in
http://lists.x.org/archives/xorg-devel/2015-February/045606.html ; no
reviews (for or against) since.

 mi/miexpose.c | 13 +
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/mi/miexpose.c b/mi/miexpose.c
index c4118f1..4124d67 100644
--- a/mi/miexpose.c
+++ b/mi/miexpose.c
@@ -478,14 +478,21 @@ miPaintWindow(WindowPtr pWin, RegionPtr prgn, int what)
 else {
 PixmapPtr pixmap;
 
-tile_x_off = drawable-x;
-tile_y_off = drawable-y;
+fill = pWin-border;
+solid = pWin-borderIsPixel;
 
 /* servers without pixmaps draw their own borders */
 if (!pScreen-GetWindowPixmap)
 return;
 pixmap = (*pScreen-GetWindowPixmap) ((WindowPtr) drawable);
 drawable = pixmap-drawable;
+
+while (pWin-backgroundState == ParentRelative)
+pWin = pWin-parent;
+
+tile_x_off = pWin-drawable.x;
+tile_y_off = pWin-drawable.y;
+
 #ifdef COMPOSITE
 draw_x_off = pixmap-screen_x;
 draw_y_off = pixmap-screen_y;
@@ -495,8 +502,6 @@ miPaintWindow(WindowPtr pWin, RegionPtr prgn, int what)
 draw_x_off = 0;
 draw_y_off = 0;
 #endif
-fill = pWin-border;
-solid = pWin-borderIsPixel;
 }
 
 gcval[0].val = GXcopy;
-- 
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] Fix border tile origin when background is ParentRelative

2015-02-13 Thread Peter Harris
According to
http://www.x.org/releases/X11R7.7/doc/xproto/x11protocol.html#requests:CreateWindow
The border tile origin is always the same as the background tile
origin.

ChangeWindowAttributes goes to some effort to make sure it repaints
the border tile whenever the background origin may have changed, but
miPaintWindow was ignoring the background origin.

Found by xts XChangeWindowAttributes-3

Signed-off-by: Peter Harris phar...@opentext.com
---
 mi/miexpose.c | 13 +
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/mi/miexpose.c b/mi/miexpose.c
index fc4dbc0..3e49f15 100644
--- a/mi/miexpose.c
+++ b/mi/miexpose.c
@@ -478,14 +478,21 @@ miPaintWindow(WindowPtr pWin, RegionPtr prgn, int what)
 else {
 PixmapPtr pixmap;
 
-tile_x_off = drawable-x;
-tile_y_off = drawable-y;
+fill = pWin-border;
+solid = pWin-borderIsPixel;
 
 /* servers without pixmaps draw their own borders */
 if (!pScreen-GetWindowPixmap)
 return;
 pixmap = (*pScreen-GetWindowPixmap) ((WindowPtr) drawable);
 drawable = pixmap-drawable;
+
+while (pWin-backgroundState == ParentRelative)
+pWin = pWin-parent;
+
+tile_x_off = pWin-drawable.x;
+tile_y_off = pWin-drawable.y;
+
 #ifdef COMPOSITE
 draw_x_off = pixmap-screen_x;
 draw_y_off = pixmap-screen_y;
@@ -495,8 +502,6 @@ miPaintWindow(WindowPtr pWin, RegionPtr prgn, int what)
 draw_x_off = 0;
 draw_y_off = 0;
 #endif
-fill = pWin-border;
-solid = pWin-borderIsPixel;
 }
 
 gcval[0].val = GXcopy;
-- 
2.1.0

___
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 fixesproto] cursor-name is after cursor-image in GetCursorImageAndName

2015-02-03 Thread Peter Harris
Signed-off-by: Peter Harris phar...@opentext.com
---
 fixesproto.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fixesproto.txt b/fixesproto.txt
index 24c782d..6e3811e 100644
--- a/fixesproto.txt
+++ b/fixesproto.txt
@@ -469,8 +469,8 @@ GetCursorImageAndName
y-hot:  CARD16
cursor-serial:  CARD32
cursor-atom:ATOM
-   cursor-name:LISTofCARD8
cursor-image:   LISTofCARD32
+   cursor-name:LISTofCARD8
 
This is similar to GetCursorImage except for including both
the atom and name of the current cursor.
-- 
2.1.0

___
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 xts 2/2] libproto: RcvRep: Don't overwrite memory in QueryFont

2015-01-26 Thread Peter Harris
On 2015-01-21 15:19, Ian Romanick wrote:
 On 01/20/2015 05:57 PM, Peter Harris wrote:
 If the server returns a bogus (short) reply to a swapped QueryFont
 request, RcvRep swaps past the end of its buffer, smashing the heap.

 Signed-off-by: Peter Harris phar...@opentext.com
 
 Given the calculated_length check later in that case, this change looks
 trivially correct.
 
 Reviewed-by: Ian Romanick ian.d.roman...@intel.com

Pushed. Thanks for the review.

Peter Harris
-- 
   Open Text Connectivity Solutions Group
Peter Harrishttp://connectivity.opentext.com/
Research and DevelopmentPhone: +1 905 762 6001
phar...@opentext.comToll Free: 1 877 359 4866
___
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 xts 1/2] libproto: Fix buffer read overrun

2015-01-21 Thread Peter Harris
On 2015-01-21 15:21, Ian Romanick wrote:
 On 01/20/2015 05:57 PM, Peter Harris wrote:
 Found by -fsanitize=address

 Signed-off-by: Peter Harris phar...@opentext.com
 ---
  xts5/src/libproto/ShowSup.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)

 diff --git a/xts5/src/libproto/ShowSup.c b/xts5/src/libproto/ShowSup.c
 index a05ff7d..b8ba796 100644
 --- a/xts5/src/libproto/ShowSup.c
 +++ b/xts5/src/libproto/ShowSup.c
 @@ -581,7 +581,7 @@ int  format;
  int i;
  
  if (nval  0) {
 -valuePtr = (CARD32 *) ((CARD32 *) rp + size);
 +valuePtr = (CARD32 *) ((CARD8 *) rp + size);
 
 The original code seems so bogus that the error must be trivially
 observable.  How did this remain undetected for so long?  It was in the
 initial import in February 2005... 10 years ago!

The values are thrown away unless you set XT_DEBUG = 2 (the default is
0), so the fact that it's trying to print garbage isn't likely to be
noticed.

You really need -fsanitize=address (or valgrind or efence or similar) to
trap on the bogus memory read. I never would have noticed if I hadn't
been playing with -fsanitize=address to try to find the bug fixed by
patch 2/2. (it didn't help; -fsanitize=address changed xtest enough that
it stopped triggering the bug in my server)

 As a side note... I'm impressed that ajax hasn't kill every bit of
 pre-C89 code from git.freedesktop.org. :)

:)

Peter Harris
-- 
   Open Text Connectivity Solutions Group
Peter Harrishttp://connectivity.opentext.com/
Research and DevelopmentPhone: +1 905 762 6001
phar...@opentext.comToll Free: 1 877 359 4866
___
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 xts 2/2] libproto: RcvRep: Don't overwrite memory in QueryFont

2015-01-20 Thread Peter Harris
If the server returns a bogus (short) reply to a swapped QueryFont
request, RcvRep swaps past the end of its buffer, smashing the heap.

Signed-off-by: Peter Harris phar...@opentext.com
---
 xts5/src/libproto/RcvRep.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/xts5/src/libproto/RcvRep.c b/xts5/src/libproto/RcvRep.c
index c375d5a..946ce6f 100644
--- a/xts5/src/libproto/RcvRep.c
+++ b/xts5/src/libproto/RcvRep.c
@@ -374,6 +374,10 @@ int client;   /* */
wbcopy(rbp,valuePtr, 32);
break;
case X_QueryFont:
+   if (rp-generic.length  7) {
+   
Length_Error(max(bytes_there,calculated_length2),client,rp,type,QueryFont,7);
+   break;
+   }
valuePtr =  (unsigned char *) (((xQueryFontReply 
*)rp)-minBounds);
Unpack_Shorts((unsigned short *) valuePtr, rbp, 6, needswap);
rbp += 4;
-- 
2.1.0

___
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 xts 1/2] libproto: Fix buffer read overrun

2015-01-20 Thread Peter Harris
Found by -fsanitize=address

Signed-off-by: Peter Harris phar...@opentext.com
---
 xts5/src/libproto/ShowSup.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/xts5/src/libproto/ShowSup.c b/xts5/src/libproto/ShowSup.c
index a05ff7d..b8ba796 100644
--- a/xts5/src/libproto/ShowSup.c
+++ b/xts5/src/libproto/ShowSup.c
@@ -581,7 +581,7 @@ int format;
int i;

if (nval  0) {
-   valuePtr = (CARD32 *) ((CARD32 *) rp + size);
+   valuePtr = (CARD32 *) ((CARD8 *) rp + size);
for (i = 0; i  nval; i++) {
Log_Some(\tfontprop %d, name = 0x%lx, value = 
0x%lx\n, i, *valuePtr, *(valuePtr+1));
valuePtr += 2;
@@ -598,7 +598,7 @@ int format;
int i;
 
if (nval  0) {
-   valuePtr = (CARD16 *) ((CARD16 *) rp + size);
+   valuePtr = (CARD16 *) ((CARD8 *) rp + size);
for (i = 0; i  nval; i++) {
Log_Some(\tcharinfo %d, left-side-bearing = %d, 
right-side-bearing = %d, character-width = %d, ascent = %d, descent = %d, 
attributes = 0x%x\n, i, *valuePtr, *(valuePtr+1), *(valuePtr+2), 
*(valuePtr+3), *(valuePtr+4), *(valuePtr+5));
valuePtr += 6;
-- 
2.1.0

___
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] dix: Fix hang in ConfineToShape

2015-01-19 Thread Peter Harris
If the initial point is more than one pixel left, right, or below the
bounding box of the region, ConfineToShape will enter an infinite loop.

Avoid the infinite loop by resetting the position to the edge of the
bounding box if the initial point is outside the bounding box.

Signed-off-by: Peter Harris phar...@opentext.com
---
 dix/events.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/dix/events.c b/dix/events.c
index b8c67fd..d378366 100644
--- a/dix/events.c
+++ b/dix/events.c
@@ -687,15 +687,15 @@ ConfineToShape(DeviceIntPtr pDev, RegionPtr shape, int 
*px, int *py)
 x += incx;
 if (x = box.x2) {
 incx = -1;
-x = *px - 1;
+x = min(box.x2, *px) - 1;
 }
 else if (x  box.x1) {
 incx = 1;
-x = *px;
+x = max(box.x1, *px);
 y += incy;
 if (y = box.y2) {
 incy = -1;
-y = *py - 1;
+y = min(box.y2, *py) - 1;
 }
 else if (y  box.y1)
 return; /* should never get here! */
-- 
2.1.0

___
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] Fix overflow of ConnectionOutput-size and -count

2014-11-17 Thread Peter Harris
When (long) is larger than (int), and when realloc succeeds with sizes
larger than INT_MAX, ConnectionOutput-size and ConnectionOutput-count
overflow and become negative.

When ConnectionOutput-count is negative, InsertIOV does not actually
insert an IOV, and FlushClient goes into an infinite loop of writev(fd,
iov, 0) [an empty list].

Avoid this situation by killing the client when it has more than INT_MAX
unread bytes of data.

Signed-off-by: Peter Harris phar...@opentext.com
---

Alternatively, we could change -size and -count to long (or ssize_t or
ptrdiff_t).

 os/io.c | 7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/os/io.c b/os/io.c
index 8181a86..1084c9a 100644
--- a/os/io.c
+++ b/os/io.c
@@ -971,10 +971,11 @@ FlushClient(ClientPtr who, OsCommPtr oc, const void 
*__extraBuf, int extraCount)
 }
 
 if (notWritten  oco-size) {
-unsigned char *obuf;
+unsigned char *obuf = NULL;
 
-obuf = (unsigned char *) realloc(oco-buf,
- notWritten + BUFSIZE);
+if (notWritten + BUFSIZE = INT_MAX) {
+obuf = realloc(oco-buf, notWritten + BUFSIZE);
+}
 if (!obuf) {
 _XSERVTransDisconnect(oc-trans_conn);
 _XSERVTransClose(oc-trans_conn);
-- 
2.1.0

___
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 6/8] dix: Switch window unmap to mark normally instead of UnmapValData

2014-11-17 Thread Peter Harris
On 2014-11-17 15:41, Adam Jackson wrote:
 diff --git a/dix/window.c b/dix/window.c
 index a82c294..af63703 100644
 --- a/dix/window.c
 +++ b/dix/window.c
 @@ -2748,7 +2748,7 @@ UnmapWindow(WindowPtr pWin, Bool fromConfigure)
  if (SubStrSend(pWin, pParent))
  DeliverUnmapNotify(pWin, fromConfigure);
  if (wasPaintable  !fromConfigure) {
 -pWin-valdata = UnmapValData;
 +(*pScreen-MarkWindow) (pWin);
  (*pScreen-MarkOverlappedWindows) (pWin, pWin-nextSib, pLayerWin);
  (*pScreen-MarkWindow) (pLayerWin-parent);
  }

This is going to leak a valdata every time a window wasPaintable and
becomes not paintable. miValidateTree, near the bottom, just sets
valdata to NULL after emptying the clip list. (I didn't see an addition
of a free() in PATCH 2/8, but that hunk should probably be with this
patch anyway to avoid breaking bisect).

Peter Harris
-- 
   Open Text Connectivity Solutions Group
Peter Harrishttp://connectivity.opentext.com/
Research and DevelopmentPhone: +1 905 762 6001
phar...@opentext.comToll Free: 1 877 359 4866
___
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 00/37] Implement backing store's Always mode

2014-10-21 Thread Peter Harris
On 2014-10-10 04:12, Adam Jackson wrote:
 On Wed, 2014-10-08 at 17:04 +0200, Adam Jackson wrote:
 
 I'm not in any way convinced this is correct yet, in fact I'm pretty sure
 it's not.  And there's some work that would be nice to follow this with [4].
 But it's close enough that I'd like to get some more eyes on it.
 
 I may have been too modest here.  A backport of this series to 1.13
 appears to be correct enough for the customer app that provoked this
 work.

Works for me, too, after the UnmapWindow/UnmapSubwindows fix. And I get
to drop a rather ugly local patch that sprinkles  pWin-backingStore
!= Always all over the place.

For the series, Reviewed-by: Peter Harris phar...@opentext.com

Peter Harris
-- 
   Open Text Connectivity Solutions Group
Peter Harrishttp://connectivity.opentext.com/
Research and DevelopmentPhone: +1 905 762 6001
phar...@opentext.comToll Free: 1 877 359 4866
___
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 21/37] dix: Drive tree mark/validate on unmap from paintable not viewable

2014-10-20 Thread Peter Harris
It's possible I missed a patch or resolved a conflict incorrectly, but
I'm getting crashes after this patch series.

Reproducible by running twm and opening/closing the root window popup menu.

On 2014-10-08 11:04, Adam Jackson wrote:
 @@ -2742,7 +2742,7 @@ UnmapWindow(WindowPtr pWin, Bool fromConfigure)
  return Success;
  if (SubStrSend(pWin, pParent))
  DeliverUnmapNotify(pWin, fromConfigure);
 -if (wasViewable  !fromConfigure) {
 +if (wasPaintable  !fromConfigure) {
  pWin-valdata = UnmapValData;

UnmapValData is a special not-pointer that is only valid if
!pWin-paintable (or !pWin-viewable before this patch series). If
Composite resets pWin-paintable on this window, miComputeClips will dx
= pParent-drawable.x - pParent-valdata-before.oldAbsCorner.x; causing
everything to explode.

  (*pScreen-MarkOverlappedWindows) (pWin, pWin-nextSib, pLayerWin);
  (*pScreen-MarkWindow) (pLayerWin-parent);
 @@ -2750,13 +2750,11 @@ UnmapWindow(WindowPtr pWin, Bool fromConfigure)
  pWin-mapped = FALSE;
  if (wasRealized)
  UnrealizeTree(pWin, fromConfigure);
 -if (wasViewable) {
 -if (!fromConfigure) {
 -(*pScreen-ValidateTree) (pLayerWin-parent, pWin, VTUnmap);
 -(*pScreen-HandleExposures) (pLayerWin-parent);
 -if (pScreen-PostValidateTree)
 -(*pScreen-PostValidateTree) (pLayerWin-parent, pWin, 
 VTUnmap);
 -}
 +if (wasPaintable  !fromConfigure) {

An extra block here

+if (pWin-paintable) {
+pWin-valdata = NULL;
+pScreen-MarkWindow(pWin);
+}

appears to fix the crash. I haven't considered the equivalent for
UnmapSubwindows yet.

Peter Harris
-- 
   Open Text Connectivity Solutions Group
Peter Harrishttp://connectivity.opentext.com/
Research and DevelopmentPhone: +1 905 762 6001
phar...@opentext.comToll Free: 1 877 359 4866
___
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] fb: Fix Bresenham algorithms for commonly used small segments.

2014-10-16 Thread Peter Harris
On 2014-10-14 12:41, Alex Orange wrote:
 Please pardon my inexperience, is there any further action I need
 to/should take to get this patch committed?

If you CC'd Keith Packard on your initial email, then no. We just wait
for Keith to get back into patch vacuuming mode, which usually happens
every couple of weeks.

If you did not CC Keith Packard on your initial email, you can append my
Reviewed-by: line to the commit message and send the patch directly to
Keith Packard to get it into his patch queue.

Patches sometimes get accidentally missed, so it's appropriate to
comment or re-send every couple of weeks.

See also http://wiki.x.org/wiki/Development/Documentation/SubmittingPatches/

Peter Harris
-- 
   Open Text Connectivity Solutions Group
Peter Harrishttp://connectivity.opentext.com/
Research and DevelopmentPhone: +1 905 762 6001
phar...@opentext.comToll Free: 1 877 359 4866
___
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] fb: Fix Bresenham algorithms for commonly used small segments.

2014-10-06 Thread Peter Harris
On 2014-10-03 17:41, Alex Orange wrote:
 Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=54168
 
 Fix errors introducted in 863d528a9f76d0e8f122aebf19f8564a4c67a938. Said
 patch does indeed remove the problematic writes to bad memory, however
 it also introduces errors in the algoritm. This patch has the effect of
 reverting said patch and adding an if in the proper location to catch
 the out of bounds memory write without causing problems to the overall
 algorithm.
 
 Signed-off-by: Alex Orange crazyca...@gmail.com

Reviewed-by: Peter Harris phar...@opentext.com
Tested-by: Peter Harris phar...@opentext.com

Peter Harris
-- 
   Open Text Connectivity Solutions Group
Peter Harrishttp://connectivity.opentext.com/
Research and DevelopmentPhone: +1 905 762 6001
phar...@opentext.comToll Free: 1 877 359 4866
___
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] fb: Fix origin of source picture in fbGlyphs

2014-04-22 Thread Peter Harris
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On 2014-04-21 23:51, Keith Packard wrote:
 
 I've merged your fix and added your test app to the commit message 
 so that the next time we find that this is broken, we can make
 sure the fix doesn't break this case again...

Good idea. Thanks.

It appears git ate all the #include lines. The line starts with a #,
it must be a comment, right? Sigh.

Peter Harris
- -- 
   Open Text Connectivity Solutions Group
Peter Harrishttp://connectivity.opentext.com/
Research and DevelopmentPhone: +1 905 762 6001
phar...@opentext.comToll Free: 1 877 359 4866
-BEGIN PGP SIGNATURE-
Version: GnuPG v2.0.17 (MingW32)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iEYEARECAAYFAlNWdgUACgkQsbmxTd/lXed/+QCg3I3U/Cr0ni1kSaB4qtnIqbqW
eZcAn3nli6FdAGFJrmFPRo7stnA6TdX0
=xsGF
-END 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] fb: Fix origin of source picture in fbGlyphs

2014-04-21 Thread Peter Harris
On 2014-04-21 18:20, Keith Packard wrote:
 Peter Harris phar...@opentext.com writes:
 
 If a source picture doesn't repeat and a mask format is specified, the
 incorrect calulation of the origin of the glyphs caused the glyphs to
 not be drawn at all.

 Noticed when running gtk-demo from RHEL 6.5 and selecting Rotated
 Text.
 
 Can you explain a bit more about how to reproduce this? I'm running the
 gtk+2.0 gtk-demo app from the gtk2.0-examples debian package and not
 seeing anything obviously incorrect?

RHEL is about the only distribution us Debian users can call outdated
with a straight face.

Recent gtk-demo uses a solid (or at least repeating) source picture. The
older gtk-demo used a non-repeating source picture with a width and
height equal to that of the rotated text. I think the older gtk-demo is
the only app I've ever seen in the wild that uses a non-repeating source
picture.

I just whipped up a minimal example; see attached. With miGlyphs (eg.
before 9cbcb5bd6a5360a128d15b77a02d8d3351f74366) it draws a green X in
the middle of the window. With fbGlyphs (before my patch), the window
stays blank.

Peter Harris
-- 
   Open Text Connectivity Solutions Group
Peter Harrishttp://connectivity.opentext.com/
Research and DevelopmentPhone: +1 905 762 6001
phar...@opentext.comToll Free: 1 877 359 4866
#include stdio.h
#include stdlib.h
#include time.h
#include xcb/xcb.h
#include xcb/xproto.h
#include xcb/render.h

// 16 x 16 pictfmt_a8 glyph
static const char glyph[] = {
0xff, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0xff,
0, 0xff, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0xff, 0,
0, 0, 0xff, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0xff, 0, 0,
0, 0, 0, 0xff, 0, 0, 0, 0, 0, 0, 0, 0, 0xff, 0, 0, 0,
0, 0, 0, 0, 0xff, 0, 0, 0, 0, 0, 0, 0xff, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0xff, 0, 0, 0, 0, 0xff, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0xff, 0, 0, 0xff, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0xff, 0xff, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0xff, 0xff, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0xff, 0, 0, 0xff, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0xff, 0, 0, 0, 0, 0xff, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0xff, 0, 0, 0, 0, 0, 0, 0xff, 0, 0, 0, 0,
0, 0, 0, 0xff, 0, 0, 0, 0, 0, 0, 0, 0, 0xff, 0, 0, 0,
0, 0, 0xff, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0xff, 0, 0,
0, 0xff, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0xff, 0,
0xff, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0xff,
};

#define GLYPH_SIZE 16
#define WIN_SIZE 200

static struct {
uint8_t len;
uint8_t pad[3];
uint16_t deltax, deltay;
uint8_t glyph;
uint8_t pad2[3];
} elt = { len:1, glyph:1, deltax:WIN_SIZE/2 - GLYPH_SIZE/2, deltay:WIN_SIZE/2 - 
GLYPH_SIZE/2 };


int main(int argc, char *argv[])
{
int screen;
xcb_connection_t *c = xcb_connect(NULL, screen);
if (!c || xcb_connection_has_error(c)) {
fprintf(stderr, Cannot open default display \%s\\n, 
getenv(DISPLAY));
return EXIT_FAILURE;
}

// Find root window and depth
const xcb_setup_t *setup = xcb_get_setup(c);
if (screen = setup-roots_len)
screen = 0;
xcb_screen_iterator_t si = xcb_setup_roots_iterator(setup);
for (int i=0; i  screen; i++)
xcb_screen_next(si);
xcb_window_t root = si.data-root;
uint8_t depth = si.data-root_depth;
xcb_visualid_t visual = si.data-root_visual;

// Find picture formats
xcb_render_query_pict_formats_reply_t *qpf;
qpf = xcb_render_query_pict_formats_reply(c, 
xcb_render_query_pict_formats(c), NULL);
if (!qpf) {
fprintf(stderr, Cannot query RENDER picture formats\n);
return EXIT_FAILURE;
}
xcb_render_pictformat_t fmt_a8 = 0;
xcb_render_pictforminfo_iterator_t pfi =
xcb_render_query_pict_formats_formats_iterator(qpf);
for (int i = 0; i  xcb_render_query_pict_formats_formats_length(qpf); i++) 
{

if (pfi.data-depth == 8 
pfi.data-type == XCB_RENDER_PICT_TYPE_DIRECT 
pfi.data-direct.alpha_mask == 0xFF) {
fmt_a8 = pfi.data-id;
break;
}
xcb_render_pictforminfo_next(pfi);
}
if (!fmt_a8) {
fprintf(stderr, Cannot find a8 RENDER picture format\n);
return EXIT_FAILURE;
}

xcb_render_pictformat_t fmt_visual = 0;
xcb_render_pictscreen_iterator_t psi =
xcb_render_query_pict_formats_screens_iterator(qpf);
for (int i = 0; i  xcb_render_query_pict_formats_screens_length(qpf); i++) 
{
xcb_render_pictdepth_iterator_t pdi =
xcb_render_pictscreen_depths_iterator(psi.data);
for (int j = 0; i  xcb_render_pictscreen_depths_length(psi.data); i++) 
{
xcb_render_pictvisual_iterator_t pvi =
xcb_render_pictdepth_visuals_iterator(pdi.data);
for (int k = 0; k  xcb_render_pictdepth_visuals_length(pdi.data); 
i++) {
if (pvi.data-visual == visual) {
fmt_visual

[PATCH] composite: Fix memory leak in compCopyWindow

2014-04-16 Thread Peter Harris
Signed-off-by: Peter Harris phar...@opentext.com
---
 composite/compwindow.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/composite/compwindow.c b/composite/compwindow.c
index 8824294..9a6b2da 100644
--- a/composite/compwindow.c
+++ b/composite/compwindow.c
@@ -525,6 +525,7 @@ compCopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, 
RegionPtr prgnSrc)
 }
 FreeScratchGC(pGC);
 }
+RegionUninit(rgnDst);
 return;
 }
 dx = pPixmap-screen_x - cw-oldx;
-- 
1.9.1

___
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] fb: Fix origin of source picture in fbGlyphs

2014-04-11 Thread Peter Harris
If a source picture doesn't repeat and a mask format is specified, the
incorrect calulation of the origin of the glyphs caused the glyphs to
not be drawn at all.

Noticed when running gtk-demo from RHEL 6.5 and selecting Rotated
Text.

Signed-off-by: Peter Harris phar...@opentext.com
---
 fb/fbpict.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fb/fbpict.c b/fb/fbpict.c
index c2ee8a5..21baf89 100644
--- a/fb/fbpict.c
+++ b/fb/fbpict.c
@@ -191,7 +191,7 @@ fbGlyphs(CARD8 op,
pixman_glyph_get_extents(glyphCache, n_glyphs, pglyphs, extents);
 
pixman_composite_glyphs(op, srcImage, dstImage, format,
-   xSrc + srcXoff + xDst, ySrc + srcYoff + yDst,
+   xSrc + srcXoff + extents.x1 - xDst, ySrc + 
srcYoff + extents.y1 - yDst,
extents.x1, extents.y1,
extents.x1 + dstXoff, extents.y1 + dstYoff,
extents.x2 - extents.x1,
-- 
1.9.1

___
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 libXfont] Fix buffer read overrun

2014-04-11 Thread Peter Harris
On 2014-04-07 15:49, Alan Coopersmith wrote:
 On 04/ 7/14 11:29 AM, Peter Harris wrote:
 FreeType is only eight bytes long. The atom FreeType\x00\x?? is
 probably not what the author intended.
 
 Reviewed-by: Alan Coopersmith alan.coopersm...@oracle.com

Thanks. Pushed.

Peter Harris
-- 
   Open Text Connectivity Solutions Group
Peter Harrishttp://connectivity.opentext.com/
Research and DevelopmentPhone: +1 905 762 6001
phar...@opentext.comToll Free: 1 877 359 4866
___
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 libXfont] Fix buffer read overrun

2014-04-07 Thread Peter Harris
FreeType is only eight bytes long. The atom FreeType\x00\x?? is
probably not what the author intended.

Signed-off-by: Peter Harris phar...@opentext.com
---
 src/FreeType/ftfuncs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/FreeType/ftfuncs.c b/src/FreeType/ftfuncs.c
index 65efefc..a4969d1 100644
--- a/src/FreeType/ftfuncs.c
+++ b/src/FreeType/ftfuncs.c
@@ -1867,7 +1867,7 @@ FreeTypeAddProperties(FTFontPtr font, FontScalablePtr 
vals, FontInfoPtr info,
 i++;
 
 info-props[i].name  = MakeAtom(RASTERIZER_NAME, 15, TRUE);
-info-props[i].value = MakeAtom(FreeType, 10, TRUE);
+info-props[i].value = MakeAtom(FreeType, 8, TRUE);
 info-isStringProp[i] = 1;
 i++;
 
-- 
1.9.1

___
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 xts] Drop use of perl's given/when construct

2014-03-21 Thread Peter Harris
On 2014-03-19 04:47, Peter Hutterer wrote:
 On Tue, Mar 18, 2014 at 11:08:42AM -0400, Peter Harris wrote:
 The perl mongers have retroactively marked this construct
 experimental, five and a half years after it was marked stable.

 http://perldoc.perl.org/perl5180delta.html#The-smartmatch-family-of-features-are-now-experimental

 Signed-off-by: Peter Harris phar...@opentext.com
 
 Acked-by: Peter Hutterer peter.hutte...@who-t.net

Thanks. Pushed.

Peter Harris
-- 
   Open Text Connectivity Solutions Group
Peter Harrishttp://connectivity.opentext.com/
Research and DevelopmentPhone: +1 905 762 6001
phar...@opentext.comToll Free: 1 877 359 4866
___
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 xts] Drop use of perl's given/when construct

2014-03-18 Thread Peter Harris
The perl mongers have retroactively marked this construct
experimental, five and a half years after it was marked stable.

http://perldoc.perl.org/perl5180delta.html#The-smartmatch-family-of-features-are-now-experimental

Signed-off-by: Peter Harris phar...@opentext.com
---
 xts5/bin/xts-config.in | 13 +
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/xts5/bin/xts-config.in b/xts5/bin/xts-config.in
index dbe84da..2dbe653 100755
--- a/xts5/bin/xts-config.in
+++ b/xts5/bin/xts-config.in
@@ -1,6 +1,5 @@
 #!/usr/bin/perl -pi.bak
 
-use 5.10.0;
 use warnings;
 use strict;
 use Sys::Hostname;
@@ -136,10 +135,16 @@ BEGIN
 
$::vars{XT_PIXMAP_DEPTHS} =~ s/,?\s+/ /g;
 
-   given ($::vars{XT_DOES_BACKING_STORE})
+   if ($::vars{XT_DOES_BACKING_STORE} =~ /yes/i)
+   {
+   $::vars{XT_DOES_BACKING_STORE} = 2;
+   }
+   elsif ($::vars{XT_DOES_BACKING_STORE} =~ /no/i)
+   {
+   $::vars{XT_DOES_BACKING_STORE} = 1;
+   }
+   else
{
-   $::vars{XT_DOES_BACKING_STORE} = 2 when (/yes/i);
-   $::vars{XT_DOES_BACKING_STORE} = 1 when (/when/i);
$::vars{XT_DOES_BACKING_STORE} = 0;
}
 
-- 
1.9.0

___
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] Avoid starting a comment with */*

2014-03-11 Thread Peter Harris
On 2014-03-11 01:45, Thomas Klausner wrote:
 -extern _X_EXPORT Bool AddCallback(CallbackListPtr * /*pcbl */ ,
 -  CallbackProcPtr /*callback */ ,
 -  void */*data */ );
 +extern _X_EXPORT Bool AddCallback(CallbackListPtr *pcbl,
 +  CallbackProcPtr callback,
 +  void *data);
 
 I was always told that I should avoid function argument names in
 prototypes in header files because they can break when macros are
 used; but this patch adds such names.

Huh. I assumed it was some pre-ANSI thing, but I never bothered to check.

In my experience, some editors with ctags-like functionality provide
better documentation when names are present (although to be honest,
commented names might be included too). I was not previously familiar
with the when macros are used problem. After some searching, I presume
you refer to
https://www.securecoding.cert.org/confluence/display/seccode/API08-C.+Avoid+parameter+names+in+a+function+prototype

That's at least mildly silly. If the same names are used in the function
declaration as are used in the function definition, even their contrived
does not result in a syntax error example will be a syntax error at
the function definition site. And, indeed, their search CERT for this
vulnerability link returns No results found.

https://www.kb.cert.org/vulnotes/bymetric?searchviewamp;query=FIELD+KEYWORDS+contains+API08-C

 Does adding a space in '*/*', i.e. making it '* /*', also work?
 
 Like this:
 extern _X_EXPORT Bool AddCallback(CallbackListPtr * /* pcbl */,
   CallbackProcPtr /* callback */,
   void * /* data */);

Yes, that also works.

There are instances of both (named parameters, and * /* ) already in
some of those header files. I just picked one option at random.

Thanks for reviewing.

Peter Harris
-- 
   Open Text Connectivity Solutions Group
Peter Harrishttp://connectivity.opentext.com/
Research and DevelopmentPhone: +1 905 762 6001
phar...@opentext.comToll Free: 1 877 359 4866
___
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] Avoid starting a comment with */*

2014-03-10 Thread Peter Harris
Even though -Wcomment doesn't mind it (in gcc or clang), the appearance
of */* confuses the syntax highlighter of some editors (eg. vim), and
causes warnings in MSVC.

Signed-off-by: Peter Harris phar...@opentext.com
---
 include/callback.h   | 18 ++--
 include/colormap.h   | 16 +--
 include/cursor.h |  4 +--
 include/dix.h| 69 --
 include/dixfont.h| 10 +++
 include/dixgrabs.h   |  4 +--
 include/gc.h |  4 +--
 include/gcstruct.h   | 38 -
 include/input.h  |  8 +++---
 include/os.h | 52 +--
 include/pixmap.h | 14 +-
 include/property.h   | 36 
 include/resource.h   | 74 -
 include/scrnintstr.h | 26 +-
 include/window.h | 20 +++---
 include/xkbsrv.h | 18 ++--
 mi/mi.h  | 78 ++--
 os/access.c  |  6 ++--
 18 files changed, 243 insertions(+), 252 deletions(-)

diff --git a/include/callback.h b/include/callback.h
index df638c0..fe7015e 100644
--- a/include/callback.h
+++ b/include/callback.h
@@ -64,16 +64,16 @@ typedef struct _CallbackList *CallbackListPtr;  /* also in 
misc.h */
 
 typedef void (*CallbackProcPtr) (CallbackListPtr *, void *, void *);
 
-extern _X_EXPORT Bool AddCallback(CallbackListPtr * /*pcbl */ ,
-  CallbackProcPtr /*callback */ ,
-  void */*data */ );
+extern _X_EXPORT Bool AddCallback(CallbackListPtr *pcbl,
+  CallbackProcPtr callback,
+  void *data);
 
-extern _X_EXPORT Bool DeleteCallback(CallbackListPtr * /*pcbl */ ,
- CallbackProcPtr /*callback */ ,
- void */*data */ );
+extern _X_EXPORT Bool DeleteCallback(CallbackListPtr *pcbl,
+ CallbackProcPtr callback,
+ void *data);
 
-extern _X_EXPORT void _CallCallbacks(CallbackListPtr * /*pcbl */ ,
- void */*call_data */ );
+extern _X_EXPORT void _CallCallbacks(CallbackListPtr *pcbl,
+ void *call_data);
 
 static inline void
 CallCallbacks(CallbackListPtr *pcbl, void *call_data)
@@ -83,7 +83,7 @@ CallCallbacks(CallbackListPtr *pcbl, void *call_data)
 _CallCallbacks(pcbl, call_data);
 }
 
-extern _X_EXPORT void DeleteCallbackList(CallbackListPtr * /*pcbl */ );
+extern _X_EXPORT void DeleteCallbackList(CallbackListPtr *pcbl);
 
 extern _X_EXPORT void InitCallbackManager(void);
 extern _X_EXPORT void DeleteCallbackManager(void);
diff --git a/include/colormap.h b/include/colormap.h
index 9ca..b89bbe1 100644
--- a/include/colormap.h
+++ b/include/colormap.h
@@ -82,14 +82,14 @@ extern _X_EXPORT int CreateColormap(Colormap /*mid */ ,
 int /*alloc */ ,
 int /*client */ );
 
-extern _X_EXPORT int FreeColormap(void */*pmap */ ,
-  XID /*mid */ );
+extern _X_EXPORT int FreeColormap(void *pmap,
+  XID mid);
 
-extern _X_EXPORT int TellLostMap(WindowPtr /*pwin */ ,
- void */* Colormap *pmid */ );
+extern _X_EXPORT int TellLostMap(WindowPtr pwin,
+ void *value);
 
-extern _X_EXPORT int TellGainedMap(WindowPtr /*pwin */ ,
-   void */* Colormap *pmid */ );
+extern _X_EXPORT int TellGainedMap(WindowPtr pwin,
+   void *value);
 
 extern _X_EXPORT int CopyColormapAndFree(Colormap /*mid */ ,
  ColormapPtr /*pSrc */ ,
@@ -126,8 +126,8 @@ extern _X_EXPORT int QueryColors(ColormapPtr /*pmap */ ,
  xrgb * /*prgbList */ ,
  ClientPtr client);
 
-extern _X_EXPORT int FreeClientPixels(void */*pcr */ ,
-  XID /*fakeid */ );
+extern _X_EXPORT int FreeClientPixels(void *pcr,
+  XID fakeid);
 
 extern _X_EXPORT int AllocColorCells(int /*client */ ,
  ColormapPtr /*pmap */ ,
diff --git a/include/cursor.h b/include/cursor.h
index 9da08af..1e483ac 100644
--- a/include/cursor.h
+++ b/include/cursor.h
@@ -68,8 +68,8 @@ extern _X_EXPORT DevScreenPrivateKeyRec cursorScreenDevPriv;
 
 extern _X_EXPORT CursorPtr rootCursor;
 
-extern _X_EXPORT int FreeCursor(void */*pCurs */ ,
-XID /*cid */ );
+extern _X_EXPORT int FreeCursor(void *pCurs,
+XID cid);
 
 extern _X_EXPORT CursorPtr RefCursor(CursorPtr /* cursor */);
 extern _X_EXPORT CursorPtr UnrefCursor(CursorPtr

Re: [PATCH 5/6] Add DRI3

2013-11-06 Thread Peter Harris
On 2013-11-05 19:39, Keith Packard wrote:
 diff --git a/src/xproto.xml b/src/xproto.xml
 index bf4dcbf..c9f6979 100644
 --- a/src/xproto.xml
 +++ b/src/xproto.xml
 @@ -1080,7 +1080,24 @@ The number of keycodes altered.
  /doc
/event
  
 -
 +  event name=ge number=35
 +field type=CARD8 name=extension/
 +field type=CARD32 name=length/
 +field type=CARD16 name=evtype/
 +pad bytes=22 /
 +doc
 +  briefgeneric event (with length)/brief
 +  field name=extension![CDATA[
 +The major opcode of the extension creating this event
 +  ]]/field
 +  field name=length![CDATA[
 +The amount (in 4-byte units) of data beyond 32 bytes
 +  ]]/field
 +  field name=evtype![CDATA[
 +The extension-specific event type
 +  ]]/field
 +/doc
 +  /event

I'm curious about this hunk. It isn't hurting anything, but I don't see
where it would be needed or used.

xcb.h already has xcb_ge_event_t. Is this hunk solely for the doc
section? Or for the #define XCB_GE 35 ?

Peter Harris
-- 
   Open Text Connectivity Solutions Group
Peter Harrishttp://connectivity.opentext.com/
Research and DevelopmentPhone: +1 905 762 6001
phar...@opentext.comToll Free: 1 877 359 4866
___
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 1/6] Move the INT64 types in sync.xml to the sync: namespace

2013-11-06 Thread Peter Harris
On 2013-11-05 19:39, Keith Packard wrote:
 This makes sure we use the crazy sync-specific 64-bit datatype instead
 of the global INT64 type
 
 Signed-off-by: Keith Packard kei...@keithp.com
 ---
  src/sync.xml | 26 +-
  1 file changed, 13 insertions(+), 13 deletions(-)
 
 diff --git a/src/sync.xml b/src/sync.xml
 index 516d149..ae3bbbc 100644
 --- a/src/sync.xml
 +++ b/src/sync.xml
 @@ -41,14 +41,14 @@ for licensing information.
  item name=Events   bit5/bit/item
/enum
  
 -  struct name=INT64
 +  struct name=sync:INT64

This change isn't necessary, and should probably be omitted.

For the rest of the changes in this patch,
Reviewed-by: Peter Harris phar...@opentext.com

Peter Harris
-- 
   Open Text Connectivity Solutions Group
Peter Harrishttp://connectivity.opentext.com/
Research and DevelopmentPhone: +1 905 762 6001
phar...@opentext.comToll Free: 1 877 359 4866
___
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 6/6] Add Present protocol specification

2013-11-06 Thread Peter Harris
On 2013-11-05 19:39, Keith Packard wrote:
 Signed-off-by: Keith Packard kei...@keithp.com
 diff --git a/src/xproto.xml b/src/xproto.xml
 index c9f6979..8a2e276 100644
 --- a/src/xproto.xml
 +++ b/src/xproto.xml
 @@ -1085,6 +1085,7 @@ The number of keycodes altered.
  field type=CARD32 name=length/
  field type=CARD16 name=evtype/
  pad bytes=22 /
 +field type=CARD32 name=full_sequence/
  doc
briefgeneric event (with length)/brief
field name=extension![CDATA[

NAK.

This field is not on the wire, it is an implementation detail of libxcb.

This appears to be a workaround from before
http://cgit.freedesktop.org/xcb/libxcb/commit/?id=45619dc71e9411a526d7c69595cf615b1b1206cf
, and should not be necessary with libxcb built from git.

Peter Harris
-- 
   Open Text Connectivity Solutions Group
Peter Harrishttp://connectivity.opentext.com/
Research and DevelopmentPhone: +1 905 762 6001
phar...@opentext.comToll Free: 1 877 359 4866
___
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 1/6] Move the INT64 types in sync.xml to the sync: namespace

2013-11-06 Thread Peter Harris
On 2013-11-06 13:11, Keith Packard wrote:
 Peter Harris phar...@opentext.com writes:
 
 diff --git a/src/sync.xml b/src/sync.xml index 516d149..ae3bbbc
 100644 --- a/src/sync.xml +++ b/src/sync.xml @@ -41,14 +41,14
 @@ for licensing information. item name=Events
 bit5/bit/item /enum
 
 -  struct name=INT64 +  struct name=sync:INT64
 
 This change isn't necessary, and should probably be omitted.
 
 I'm sure I don't understand the XML that well, but why wouldn't I
 need the namespaced name for this instance?

This line declares a struct. All declarations are in the enclosing
namespace by definition.

The others are references, which aren't pinned to the enclosing
namespace (or there would be far too many xproto:Foo everywhere).

The oldest example of namespaces in xcb is glx.xml, which declares
 xidtype name=WINDOW /
(note the lack of a namespace in the declaration) and then uses
glx:WINDOW to reference it for the remainder of the file, or
xproto:WINDOW to reference the core WINDOW type.

Peter Harris
-- 
   Open Text Connectivity Solutions Group
Peter Harrishttp://connectivity.opentext.com/
Research and DevelopmentPhone: +1 905 762 6001
phar...@opentext.comToll Free: 1 877 359 4866
___
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 6/6] Add Present protocol specification

2013-11-06 Thread Peter Harris
On 2013-11-06 13:54, Keith Packard wrote:
 Peter Harris phar...@opentext.com writes:
 
 NAK.
 
 This field is not on the wire, it is an implementation detail of
 libxcb.
 
 This appears to be a workaround from before 
 http://cgit.freedesktop.org/xcb/libxcb/commit/?id=45619dc71e9411a526d7c69595cf615b1b1206cf

 
, and should not be necessary with libxcb built from git.
 
 Sorry, I hadn't rebased. I've done that and fixed the present.xml
 file to use xge=true.

Thanks.

For the commits that touch xcb/proto:src/*.xml in
~keithp/xcb-proto.git dri3,
Reviewed-by: Peter Harris phar...@opentext.com

Peter Harris
-- 
   Open Text Connectivity Solutions Group
Peter Harrishttp://connectivity.opentext.com/
Research and DevelopmentPhone: +1 905 762 6001
phar...@opentext.comToll Free: 1 877 359 4866
___
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 5/7] Add event queue splitting

2013-11-06 Thread Peter Harris
On 2013-11-05 19:41, Keith Packard wrote:
 This allows apps to peel off certain XGE events into separate queues
 for custom handling. Designed to support the Present extension
 
 Signed-off-by: Keith Packard kei...@keithp.com

Re: xcb_register_for_special_event, xcb_unregister_for_special_event,
xcb_check_for_special_event, and xcb_wait_for_special_event.

There was some push-back the last time something similar to this came
up, on the theory that it should be in a separate library from xcb[1].
That said, we may have reached the point where it's just too useful to
not have in libxcb.

Does this interface work for the rest of the things needed for GLX?

Adding Josh Tripplett to the CC list.

 diff --git a/src/xcb.h b/src/xcb.h
 index f7dc6af..f99e677 100644
 --- a/src/xcb.h
 +++ b/src/xcb.h
 @@ -138,23 +138,6 @@ typedef struct {
  } xcb_generic_event_t;
  
  /**
 - * @brief GE event
 - *
 - * An event as sent by the XGE extension. The length field specifies the
 - * number of 4-byte blocks trailing the struct.
 - */
 -typedef struct {
 -uint8_t  response_type;  /** Type of the response */
 -uint8_t  pad0;   /** Padding */
 -uint16_t sequence;   /** Sequence number */
 -uint32_t length;
 -uint16_t event_type;
 -uint16_t pad1;
 -uint32_t pad[5]; /** Padding */
 -uint32_t full_sequence;  /** full sequence */
 -} xcb_ge_event_t;
 -
 -/**

This hunk doesn't appear to be related to event queue splitting. Should
it be in a separate commit?

Peter Harris

[1] http://lists.freedesktop.org/archives/xcb/2012-January/007571.html
-- 
   Open Text Connectivity Solutions Group
Peter Harrishttp://connectivity.opentext.com/
Research and DevelopmentPhone: +1 905 762 6001
phar...@opentext.comToll Free: 1 877 359 4866
___
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: [Xcb] [PATCH 5/7] Add event queue splitting

2013-11-06 Thread Peter Harris
On 2013-11-06 19:55, Eric Anholt wrote:
 We tried to do this with event queue filtering the same way we do
 with xlib, and it got NAKed.  Then we came up with new events and a
 new mechanism so that we could do this, and it's getting NAKed
 again.

Dude. It's not getting NAKed, it's getting Woah, this is out of left
field, this is the first I've ever heard of it, can we please have a
couple of days to think about it before we ACK it?ed.

 If we can get an API for this, we can move to pure XCB for GLX,

Yeah, that would be awesome.

Peter Harris
-- 
   Open Text Connectivity Solutions Group
Peter Harrishttp://connectivity.opentext.com/
Research and DevelopmentPhone: +1 905 762 6001
phar...@opentext.comToll Free: 1 877 359 4866
___
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: [Xcb] [PATCH 5/7] Add event queue splitting

2013-11-06 Thread Peter Harris
On 2013-11-06 19:55, Josh Triplett wrote:
 On Wed, Nov 06, 2013 at 02:34:03PM -0500, Peter Harris wrote:
 On 2013-11-05 19:41, Keith Packard wrote:
 This allows apps to peel off certain XGE events into separate queues
 for custom handling. Designed to support the Present extension

 Signed-off-by: Keith Packard kei...@keithp.com

 Re: xcb_register_for_special_event, xcb_unregister_for_special_event,
 xcb_check_for_special_event, and xcb_wait_for_special_event.

 There was some push-back the last time something similar to this came
 up, on the theory that it should be in a separate library from xcb[1].
 That said, we may have reached the point where it's just too useful to
 not have in libxcb.

 Does this interface work for the rest of the things needed for GLX?
 
 The last time that Jamey and I spoke about this, we agreed that this
 type of mechanism would be required to make GL work, and that there's
 really no other way to support it.  However, I'd like to see it not
 XGE-specific, so that it could support the existing events GL needs
 today, not just the new Present/DRI3 approach.
 
 The architecture we'd discussed was effectively that it should be
 possible to create one or more separate event queues from the primary
 one, add filters that peel off events into those queues (which XCB will
 automatically apply as events arrive), and then read the next event from
 a queue.

Now that I've had a chance to look at the implementation, it implements
precisely what you describe[1].

Adding support for another type of filter (eg. for core events) would be
a single additional function; the API is not married to XGE-plus-eid events.

There are a couple of minor naming niggles (eg. Perhaps
xcb_check_for_special_event should be named xcb_poll_for_special_event
to match the naming of the rest of the XCB poll functions, or the
already-mentioned name of the function that creates a special
XGE-plus-eid event queue), but that's just bikeshedding.

Reviewed-by: Peter Harris phar...@opentext.com

Peter Harris

[1] With the caveat that each new / separate event queue is created with
exactly one filter. If you want multiple event types, you create
multiple event queues. If the GLX people are happy with this limit, I'm
ecstatic, since it means there aren't a bunch of functions for attaching
filters to queues and other bookkeeping.
-- 
   Open Text Connectivity Solutions Group
Peter Harrishttp://connectivity.opentext.com/
Research and DevelopmentPhone: +1 905 762 6001
phar...@opentext.comToll Free: 1 877 359 4866
___
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 2/3] composite: Automatically enable backing store support on the screen

2013-09-12 Thread Peter Harris

For the series,
Reviewed-by: Peter Harris phar...@opentext.com

One minor bikeshed-coloured nit:

On 2013-09-12 12:04, Adam Jackson wrote:
  compRedirectWindow(serverClient, pWin, 
 CompositeRedirectAutomatic);
  pWin-backStorage = (pointer) (intptr_t) 1;
 -}
 -else {
 +} else {
  compUnredirectWindow(serverClient, pWin,
   CompositeRedirectAutomatic);
  pWin-backStorage = NULL;

This hunk undoes the -nce flag passed to indent.
http://cgit.freedesktop.org/xorg/util/modular/tree/x-indent.sh#n12

I prefer -ce myself, so I'd rather see a patch to x-indent.sh than the
removal of this hunk, but I didn't speak up fast enough at the time.

Peter Harris
-- 
   Open Text Connectivity Solutions Group
Peter Harrishttp://connectivity.opentext.com/
Research and DevelopmentPhone: +1 905 762 6001
phar...@opentext.comToll Free: 1 877 359 4866
___
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] Fix random hangs handling too-big requests

2013-08-12 Thread Peter Harris
On 2013-08-05 16:20, Aaron Plattner wrote:
 On 07/15/13 16:44, Peter Harris wrote:
 If a request is too big, input-ignoreBytes is set. When ignoreBytes is
 set, the number of bytes got now is artificially set to zero so the
 rest of the server does not process the partial request.

 Make sure the input buffer is not put back on the AvailableInput list,
 or the ignoreBytes count could be assigned to an unrelated client.
 
 Is this still necessary as of 67c66606c760c263d7a4c2d1bba43ed6225a4e7c ?

Yes, I believe it is. 67c66606c7 deals with closed clients. This patch
deals with clients that are still live, and just haven't sent the
ridiculous number of bytes yet when another client starts sending requests.

 Signed-off-by: Peter Harris phar...@opentext.com
 ---
   os/io.c |2 +-
   1 file changed, 1 insertion(+), 1 deletion(-)

 diff --git a/os/io.c b/os/io.c
 index 0d980ab..3f7e3e0 100644
 --- a/os/io.c
 +++ b/os/io.c
 @@ -451,7 +451,7 @@ ReadRequestFromClient(ClientPtr client)
   }
   }
   else {
 -if (!gotnow)
 +if (!gotnow  !oc-input-ignoreBytes)
   AvailableInput = oc;
   if (!SmartScheduleDisable)
   FD_CLR(fd, ClientsWithInput);


-- 
   Open Text Connectivity Solutions Group
Peter Harrishttp://connectivity.opentext.com/
Research and DevelopmentPhone: +1 905 762 6001
phar...@opentext.comToll Free: 1 877 359 4866
___
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 xserver] Don't count RetainPermanent clients twice in security.c

2013-07-15 Thread Peter Harris
If a RetainPermanent client is subsequently killed by a KillClient
request, the reference count is decremented twice. This can cause the
server to prematurely kill other clients using the same Authorization.

Signed-off-by: Peter Harris phar...@opentext.com
---
 Xext/security.c |   11 ---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/Xext/security.c b/Xext/security.c
index 6cc9aa0..7bf6cc4 100644
--- a/Xext/security.c
+++ b/Xext/security.c
@@ -57,8 +57,9 @@ static DevPrivateKeyRec stateKeyRec;
 
 /* This is what we store as client security state */
 typedef struct {
-int haveState;
-unsigned int trustLevel;
+unsigned int haveState  :1;
+unsigned int live   :1;
+unsigned int trustLevel :2;
 XID authId;
 } SecurityStateRec;
 
@@ -141,6 +142,7 @@ SecurityLabelInitial(void)
 state = dixLookupPrivate(serverClient-devPrivates, stateKey);
 state-trustLevel = XSecurityClientTrusted;
 state-haveState = TRUE;
+state-live = FALSE;
 }
 
 /*
@@ -953,6 +955,7 @@ SecurityClientState(CallbackListPtr *pcbl, pointer unused, 
pointer calldata)
 state-trustLevel = XSecurityClientTrusted;
 state-authId = None;
 state-haveState = TRUE;
+state-live = FALSE;
 break;
 
 case ClientStateRunning:
@@ -963,6 +966,7 @@ SecurityClientState(CallbackListPtr *pcbl, pointer unused, 
pointer calldata)
 if (rc == Success) {
 /* it is a generated authorization */
 pAuth-refcnt++;
+state-live = TRUE;
 if (pAuth-refcnt == 1  pAuth-timer)
 TimerCancel(pAuth-timer);
 
@@ -975,9 +979,10 @@ SecurityClientState(CallbackListPtr *pcbl, pointer unused, 
pointer calldata)
 rc = dixLookupResourceByType((pointer *) pAuth, state-authId,
  SecurityAuthorizationResType, 
serverClient,
  DixGetAttrAccess);
-if (rc == Success) {
+if (rc == Success  state-live) {
 /* it is a generated authorization */
 pAuth-refcnt--;
+state-live = FALSE;
 if (pAuth-refcnt == 0)
 SecurityStartAuthorizationTimer(pAuth);
 }
-- 
1.7.10.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 xserver] Avoid stack smash when drawing dashed lines

2013-07-15 Thread Peter Harris
X.org Bug 54013 https://bugs.freedesktop.org/show_bug.cgi?id=54013

Signed-off-by: Peter Harris phar...@opentext.com
---

See https://bugs.freedesktop.org/show_bug.cgi?id=54013 for a test case.

 mi/miwideline.c |6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/mi/miwideline.c b/mi/miwideline.c
index ca18f15..b76e7a8 100644
--- a/mi/miwideline.c
+++ b/mi/miwideline.c
@@ -994,7 +994,7 @@ miLineProjectingCap(DrawablePtr pDrawable, GCPtr pGC, 
unsigned long pixel,
 {
 int xorgi = 0, yorgi = 0;
 int lw;
-PolyEdgeRec lefts[2], rights[2];
+PolyEdgeRec lefts[4], rights[4];
 int lefty, righty, topy, bottomy;
 PolyEdgePtr left, right;
 PolyEdgePtr top, bottom;
@@ -1166,7 +1166,7 @@ miWideSegment(DrawablePtr pDrawable,
 PolyEdgePtr top, bottom;
 int lefty, righty, topy, bottomy;
 int signdx;
-PolyEdgeRec lefts[2], rights[2];
+PolyEdgeRec lefts[4], rights[4];
 LineFacePtr tface;
 int lw = pGC-lineWidth;
 
@@ -1520,7 +1520,7 @@ miWideDashSegment(DrawablePtr pDrawable,
 PolyVertexRec vertices[4];
 PolyVertexRec saveRight, saveBottom;
 PolySlopeRec slopes[4];
-PolyEdgeRec left[2], right[2];
+PolyEdgeRec left[4], right[4];
 LineFaceRec lcapFace, rcapFace;
 int nleft, nright;
 int h;
-- 
1.7.10.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 xserver] Fix random hangs handling too-big requests

2013-07-15 Thread Peter Harris
If a request is too big, input-ignoreBytes is set. When ignoreBytes is
set, the number of bytes got now is artificially set to zero so the
rest of the server does not process the partial request.

Make sure the input buffer is not put back on the AvailableInput list,
or the ignoreBytes count could be assigned to an unrelated client.

Signed-off-by: Peter Harris phar...@opentext.com
---
 os/io.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/os/io.c b/os/io.c
index 0d980ab..3f7e3e0 100644
--- a/os/io.c
+++ b/os/io.c
@@ -451,7 +451,7 @@ ReadRequestFromClient(ClientPtr client)
 }
 }
 else {
-if (!gotnow)
+if (!gotnow  !oc-input-ignoreBytes)
 AvailableInput = oc;
 if (!SmartScheduleDisable)
 FD_CLR(fd, ClientsWithInput);
-- 
1.7.10.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 xts v2] XI/ChangePointerDevice: Fix double-free

2013-07-04 Thread Peter Harris
On 2013-06-28 00:35, Peter Hutterer wrote:
 
 I'd probably add the second part of the commit message here as comment, but
 either way
 Reviewed-by: Peter Hutterer peter.hutte...@who-t.net

Thanks for the review. I added the comment and pushed.

Peter Harris
-- 
   Open Text Connectivity Solutions Group
Peter Harrishttp://connectivity.opentext.com/
Research and DevelopmentPhone: +1 905 762 6001
phar...@opentext.comToll Free: 1 877 359 4866
___
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 compositeproto] Document update field in Unredirect requests

2013-06-18 Thread Peter Harris
Signed-off-by: Peter Harris phar...@opentext.com
---

Looks like the spec was missed when this field was added to the headers back
in 2003 (the CVS commit now known as
11105d870631fe5f858291fbf167f1da400d7fa9 ).

 compositeproto.txt |8 ++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/compositeproto.txt b/compositeproto.txt
index c1d099c..4614c7b 100644
--- a/compositeproto.txt
+++ b/compositeproto.txt
@@ -214,22 +214,26 @@ operations other than QueryVersion.
 UnredirectWindow:
 
window: Window
+   update  UPDATETYPE
 
errors: Window, Value
 
Redirection of the specified window will be terminated. If
the specified window was not selected for redirection by the
-   current client, a 'Value' error results.
+   current client, or the UPDATETYPE doesn't match, a 'Value' error
+   results.
 
 UnredirectWindows:
 
window: Window
+   update  UPDATETYPE
 
errors: Window, Value
 
Redirection of all children of window will be terminated. If
the specified window was not selected for sub-redirection by the
-   current client, a 'Value' error results.
+   current client, or the UPDATETYPE doesn't match, a 'Value' error
+   results.
 
 9. Clip lists
 
-- 
1.7.10.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 xts] XI/ChangePointerDevice: Fix double-free

2013-06-11 Thread Peter Harris
On 2013-06-11 05:25, Peter Hutterer wrote:
 
 this just doesn't look right, it's a bit confusing.
 bogus is only used for the deviceid and only a problem for XCloseDevice, so
 you should be able to move the device = bogus call down past
 XCloseDevice(). that closes the already open device and then works on the
 copy for the rest, which doesn't care about the stuff other than the device
 id.

Wouldn't that result in a double-free? (time passes) Oh, I see. xts
leaks all those XDevice pointers.

 tbh, a better change would even be to change all the future calls to
 directly use bogus to signal that this is not a valid device anyway.

v2 incoming.

Thanks for the review.

Peter Harris
-- 
   Open Text Connectivity Solutions Group
Peter Harrishttp://connectivity.opentext.com/
Research and DevelopmentPhone: +1 905 762 6001
phar...@opentext.comToll Free: 1 877 359 4866
___
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 xts] XI/ChangePointerDevice: Check for XOpenDevice failures

2013-06-11 Thread Peter Harris
Signed-off-by: Peter Harris phar...@opentext.com
---
 xts5/XI/ChangePointerDevice.m |   20 
 1 file changed, 20 insertions(+)

diff --git a/xts5/XI/ChangePointerDevice.m b/xts5/XI/ChangePointerDevice.m
index c7cb55f..dfd827a 100644
--- a/xts5/XI/ChangePointerDevice.m
+++ b/xts5/XI/ChangePointerDevice.m
@@ -160,6 +160,11 @@ int i, ndevices, savid;
FAIL;
}
device = XOpenDevice(display, savid);
+   if (!device) {
+   tet_infoline(ERROR: XOpenDevice failed);
+   tet_result(TET_UNRESOLVED);
+   return;
+   }
XCALL;
if (verify_ptr(display, savid))
CHECK;
@@ -210,6 +215,11 @@ char *buttons;
XCALL;
XSync(display, 0);
dev = XOpenDevice (display, savid);
+   if (!dev) {
+   tet_infoline(ERROR: XOpenDevice failed);
+   tet_result(TET_UNRESOLVED);
+   return;
+   }
DeviceMotionNotify(dev, dmn, dmnc);
XSelectExtensionEvent (display, DRW(display), dmnc, 1);
XSync(display, 0);
@@ -314,6 +324,11 @@ int i, ndevices, savid;
FAIL;
}
device = XOpenDevice(display, savid);
+   if (!device) {
+   tet_infoline(ERROR: XOpenDevice failed);
+   tet_result(TET_UNRESOLVED);
+   return;
+   }
XCALL;
if (verify_ptr(display, savid))
CHECK;
@@ -700,6 +715,11 @@ XDevice bogus;
FAIL;
 
device = XOpenDevice(display, savid);
+   if (!device) {
+   tet_infoline(ERROR: XOpenDevice failed);
+   tet_result(TET_UNRESOLVED);
+   return;
+   }
XCALL;
XSync(display,0);
if (verify_ptr(display, savid))
-- 
1.7.10.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 xts v2] XI/ChangePointerDevice: Fix double-free

2013-06-11 Thread Peter Harris
XCloseDevice frees the device parameter, even if it references an
invalid device. Therefore, the device parameter must not be on the stack.

Since xts5/XI does not clean up the devices created by
Setup_Extension_DeviceInfo, it is safe to XCloseDevice device.

Signed-off-by: Peter Harris phar...@opentext.com
---
 xts5/XI/ChangePointerDevice.m |   55 -
 1 file changed, 27 insertions(+), 28 deletions(-)

diff --git a/xts5/XI/ChangePointerDevice.m b/xts5/XI/ChangePointerDevice.m
index d203f6e..c7cb55f 100644
--- a/xts5/XI/ChangePointerDevice.m
+++ b/xts5/XI/ChangePointerDevice.m
@@ -415,7 +415,6 @@ XDevice bogus;
else
FAIL;
 
-   device = bogus;
XCloseDevice(display, device);
XSync(display,0);
if (geterr() == baddevice)
@@ -426,7 +425,7 @@ XDevice bogus;
else
FAIL;
 
-   XSetDeviceMode(display, device, Absolute);
+   XSetDeviceMode(display, bogus, Absolute);
XSync(display,0);
if (geterr() == baddevice)
{
@@ -436,7 +435,7 @@ XDevice bogus;
else
FAIL;
 
-   XGetDeviceMotionEvents(display, device, CurrentTime, CurrentTime,
+   XGetDeviceMotionEvents(display, bogus, CurrentTime, CurrentTime,
nevents, mode, evcount);
if (geterr() == baddevice)
{
@@ -446,7 +445,7 @@ XDevice bogus;
else
FAIL;
 
-   XChangeKeyboardDevice(display, device);
+   XChangeKeyboardDevice(display, bogus);
XSync(display,0);
if (geterr() == baddevice)
{
@@ -456,7 +455,7 @@ XDevice bogus;
else
FAIL;
 
-   XChangePointerDevice(display, device, 0, 1);
+   XChangePointerDevice(display, bogus, 0, 1);
XSync(display,0);
if (geterr() == baddevice)
{
@@ -466,7 +465,7 @@ XDevice bogus;
else
FAIL;
 
-   XGrabDevice(display, device, w, True, 1, devicemotionnotifyclass,
+   XGrabDevice(display, bogus, w, True, 1, devicemotionnotifyclass,
   GrabModeAsync, GrabModeAsync, CurrentTime);
if (geterr() == baddevice)
{
@@ -476,7 +475,7 @@ XDevice bogus;
else
FAIL;
 
-   XUngrabDevice(display, device, CurrentTime);
+   XUngrabDevice(display, bogus, CurrentTime);
XSync(display,0);
if (geterr() == baddevice)
{
@@ -486,7 +485,7 @@ XDevice bogus;
else
FAIL;
 
-   XGrabDeviceKey(display, device, AnyKey, AnyModifier, NULL, 
+   XGrabDeviceKey(display, bogus, AnyKey, AnyModifier, NULL,
   w, True, 0, NULL, GrabModeAsync, GrabModeAsync);
if (geterr() == baddevice)
{
@@ -496,7 +495,7 @@ XDevice bogus;
else
FAIL;
 
-   XUngrabDeviceKey(display, device, AnyKey, AnyModifier, NULL, w);
+   XUngrabDeviceKey(display, bogus, AnyKey, AnyModifier, NULL, w);
XSync(display,0);
 
if (geterr() == baddevice)
@@ -507,7 +506,7 @@ XDevice bogus;
else
FAIL;
 
-   XGrabDeviceButton(display, device, AnyButton, AnyModifier, NULL, 
+   XGrabDeviceButton(display, bogus, AnyButton, AnyModifier, NULL,
   w, True, 0, NULL, GrabModeAsync, GrabModeAsync);
if (geterr() == baddevice)
{
@@ -517,7 +516,7 @@ XDevice bogus;
else
FAIL;
 
-   XUngrabDeviceButton(display, device, AnyButton, AnyModifier, NULL, w);
+   XUngrabDeviceButton(display, bogus, AnyButton, AnyModifier, NULL, w);
XSync(display,0);
if (geterr() == baddevice)
{
@@ -527,7 +526,7 @@ XDevice bogus;
else
FAIL;
 
-   XAllowDeviceEvents(display, device, AsyncAll, CurrentTime);
+   XAllowDeviceEvents(display, bogus, AsyncAll, CurrentTime);
XSync(display,0);
if (geterr() == baddevice)
{
@@ -537,7 +536,7 @@ XDevice bogus;
else
FAIL;
 
-   XGetDeviceFocus(display, device, focus, revert, time);
+   XGetDeviceFocus(display, bogus, focus, revert, time);
if (geterr() == baddevice)
{
CHECK;
@@ -546,7 +545,7 @@ XDevice bogus;
else
FAIL;
 
-   XSetDeviceFocus(display, device, None, RevertToNone, CurrentTime);
+   XSetDeviceFocus(display, bogus, None, RevertToNone, CurrentTime);
XSync(display,0);
if (geterr() == baddevice)
{
@@ -556,7 +555,7 @@ XDevice bogus;
else
FAIL;
 
-   XGetFeedbackControl(display, device, nfeed);
+   XGetFeedbackControl(display, bogus, nfeed);
if (geterr() == baddevice)
{
CHECK;
@@ -568,7 +567,7 @@ XDevice bogus;
feedctl.class = KbdFeedbackClass;
feedctl.percent = 0;
mask = DvPercent;
-   XChangeFeedbackControl(display, device, mask

[PATCH xts] XI/ChangePointerDevice: Fix double-free

2013-06-10 Thread Peter Harris
XCloseDevice frees the device parameter, even if it references an
invalid device. Therefore, the device parameter must have been malloc'd.

Signed-off-by: Peter Harris phar...@opentext.com
---
 xts5/XI/ChangePointerDevice.m |6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/xts5/XI/ChangePointerDevice.m b/xts5/XI/ChangePointerDevice.m
index d203f6e..332a9d8 100644
--- a/xts5/XI/ChangePointerDevice.m
+++ b/xts5/XI/ChangePointerDevice.m
@@ -372,7 +372,7 @@ unsigned char bmap[8];
 XDeviceResolutionControl dctl;
 XEventClass devicemotionnotifyclass;
 XEvent ev;
-XDevice bogus;
+XDevice bogus, *copy;
 
 
if (!Setup_Extension_DeviceInfo(ValMask) || NumValuators  2)
@@ -415,8 +415,10 @@ XDevice bogus;
else
FAIL;
 
+   copy = malloc(sizeof(bogus));
+   memcpy(copy, bogus, sizeof(bogus));
device = bogus;
-   XCloseDevice(display, device);
+   XCloseDevice(display, copy);
XSync(display,0);
if (geterr() == baddevice)
{
-- 
1.7.10.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 xts 1/2] xts5/XI: Fix SEGV when double-freeing Display

2013-06-05 Thread Peter Harris
Only XOpenDisplay pairs with XCloseDisplay. The Display pointer returned
by opendisplay is self-closing.

Signed-off-by: Peter Harris phar...@opentext.com
---

XCloseDisplay was formatted with spaces instead of tabs, which implies that
it was added later. But the change was pre-git, so I have no way of knowing
if XOpenDisplay was changed to opendisplay after that change, or what.

 xts5/XI/CloseDevice.m   |4 
 xts5/XI/GrabDevice.m|4 
 xts5/XI/GrabDeviceButton.m  |   10 --
 xts5/XI/SendExtensionEvent.m|5 +++--
 xts5/XI/XSelectExtensionEvent.m |   12 +---
 5 files changed, 4 insertions(+), 31 deletions(-)

diff --git a/xts5/XI/CloseDevice.m b/xts5/XI/CloseDevice.m
index c1bc64c..0646630 100644
--- a/xts5/XI/CloseDevice.m
+++ b/xts5/XI/CloseDevice.m
@@ -180,7 +180,6 @@ XDevice *dev2;
CHECKPASS(3);
 XUngrabDevice(client1, dev2, CurrentTime);
 XSync(client1, 0);
-XCloseDisplay(client1);
Close_Extension_Display();
 
 ASSERTION Good B 3
@@ -239,7 +238,6 @@ int Min_KeyCode, Max_KeyCode, numkeys;
CHECKPASS(3);
 XUngrabDevice(client1, dev2, CurrentTime);
 XSync(client1, 0);
-XCloseDisplay(client1);
Close_Extension_Display();
 
 ASSERTION Good B 3
@@ -323,7 +321,6 @@ int Min_KeyCode, Max_KeyCode, numkeys;
CHECKPASS(count+4);
 XUngrabDevice(client1, dev2, CurrentTime);
 XSync(client1, 0);
-XCloseDisplay(client1);
Close_Extension_Display();
 
 
@@ -388,7 +385,6 @@ int Min_KeyCode, Max_KeyCode, numkeys;
}
devicerelkeys(dev2);
CHECKPASS(6);
-XCloseDisplay(client1);
Close_Extension_Display();
 
 ASSERTION Bad B 3
diff --git a/xts5/XI/GrabDevice.m b/xts5/XI/GrabDevice.m
index 9f6bf17..0b23254 100644
--- a/xts5/XI/GrabDevice.m
+++ b/xts5/XI/GrabDevice.m
@@ -500,7 +500,6 @@ XEventClass dmnc;
 
/* Clear any extra events */
XSync(client2, True);
-XCloseDisplay(client2);
 
 ASSERTION Bad B 3
 When the
@@ -572,8 +571,6 @@ int ret;
FAIL;
}
 
-XCloseDisplay(client1);
-XCloseDisplay(client2);
CHECKPASS(1);
 ASSERTION Bad B 3
 When the device is frozen by an active grab of another client, then
@@ -613,7 +610,6 @@ int ret;
}
 
XUngrabKeyboard (display, CurrentTime);
-XCloseDisplay(client2);
CHECKPASS(1);
 ASSERTION Bad B 3
 When the specified time is earlier than the last-device-grab time or later
diff --git a/xts5/XI/GrabDeviceButton.m b/xts5/XI/GrabDeviceButton.m
index 511122c..c43165c 100644
--- a/xts5/XI/GrabDeviceButton.m
+++ b/xts5/XI/GrabDeviceButton.m
@@ -161,7 +161,6 @@ Display *client1;
devicebuttonrel (display, Devs.Button, Button1);
devicerelbuttons (Devs.Button);
XUngrabDeviceButton(display, device, AnyButton, AnyModifier, 
modifier_device, grab_window);
-   XCloseDisplay(client1);
 
 ASSERTION Good B 3
 When the conditions for activating the grab are otherwise satisfied
@@ -223,7 +222,6 @@ Display *client1;
XUngrabDeviceButton(display, device, AnyButton, AnyModifier, 
modifier_device, grab_window);
 XSync(display, 0);
 XSync(client1, 0);
-XCloseDisplay(client1);
CHECKPASS(3);
 
 ASSERTION Good B 3
@@ -326,7 +324,6 @@ Display *client1;
XUngrabDeviceButton(display, device, AnyButton, AnyModifier, 
modifier_device, grab_window);
 XUngrabDevice(client1, Devs.Button, CurrentTime);
 XSync(client1, 0);
-XCloseDisplay(client1);
CHECKPASS(3);
 
 ASSERTION Good B 3
@@ -460,7 +457,6 @@ Display *client1;
XUngrabDeviceButton(display, device, AnyButton, AnyModifier, 
modifier_device, grab_window);
 XUngrabDevice (client1, Devs.Button, CurrentTime);
 XSync(client1, 0);
-XCloseDisplay(client1);
 
 ASSERTION Good B 3
 A call to xname overrides all previous passive grabs by the same
@@ -622,7 +618,6 @@ Display *client1;
devicerelbuttons (Devs.Button);
relalldev();
XUngrabDeviceButton(display, device, AnyButton, AnyModifier, 
modifier_device, grab_window);
-XCloseDisplay(client1);
 
 ASSERTION Good B 3
 When the
@@ -697,7 +692,6 @@ XAnyClassPtr any;
devicebuttonrel (display, Devs.Button, i);
}
devicerelbuttons (Devs.Button);
-XCloseDisplay(client1);
CHECKPASS(count);
 
 ASSERTION Good B 3
@@ -755,7 +749,6 @@ Display *client1;
XUngrabDeviceButton(display, device, AnyButton, AnyModifier, 
modifier_device, grab_window);
 XUngrabDevice(client1, Devs.Button, CurrentTime);
 XSync(client1, 0);
-XCloseDisplay(client1);
CHECKPASS(2);
 
 ASSERTION Good B 3
@@ -813,7 +806,6 @@ int ret;
NULL, grab_window);
 XUngrabDevice(client1, Devs.Button, CurrentTime);
 XSync(client1,0);
-XCloseDisplay(client1

[PATCH xts 2/2] XI/ChangeFeedbackControl: Always set f

2013-06-05 Thread Peter Harris
XChangeFeedbackControl will SEGV if the last parameter is NULL.

Signed-off-by: Peter Harris phar...@opentext.com
---
 xts5/XI/ChangeFeedbackControl.m |   21 +
 1 file changed, 21 insertions(+)

diff --git a/xts5/XI/ChangeFeedbackControl.m b/xts5/XI/ChangeFeedbackControl.m
index e240e67..8b6ec3c 100644
--- a/xts5/XI/ChangeFeedbackControl.m
+++ b/xts5/XI/ChangeFeedbackControl.m
@@ -572,6 +572,16 @@ Do a ChangeFeedbackControl, specifying a device that has 
no feedbacks.
 
 if (Setup_Extension_DeviceInfo(NFeedMask))
 {
+XBellFeedbackControl belf;
+belf.class = BellFeedbackClass;
+belf.length = sizeof (XBellFeedbackControl);
+belf.pitch = 0;
+belf.id = 0;
+belf.percent = -2;
+belf.pitch = 0;
+belf.duration = 100;
+f = (XFeedbackControl *) belf;
+
 device = Devs.NoFeedback;
 XCALL;
 if (geterr() == BadMatch)
@@ -592,6 +602,7 @@ Do a ChangeFeedbackControl, specifying an invalid device.
 XDevice bogus;
 int baddevice;
 int ximajor, first, err;
+XBellFeedbackControl belf;
 
 if (!XQueryExtension (display, INAME, ximajor, first, err)) {
untested(%s: Input extension not supported.\n, TestName);
@@ -601,6 +612,16 @@ int ximajor, first, err;
 BadDevice (display, baddevice);
 bogus.device_id = -1;
 device = bogus;
+
+belf.class = BellFeedbackClass;
+belf.length = sizeof (XBellFeedbackControl);
+belf.pitch = 0;
+belf.id = 0;
+belf.percent = -2;
+belf.pitch = 0;
+belf.duration = 100;
+f = (XFeedbackControl *) belf;
+
 XCALL;
 if (geterr() == baddevice)
CHECK;
-- 
1.7.10.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 xts] Write results directly to results directory

2013-06-03 Thread Peter Harris
If an installed xtest is run, the user does not normally have write
access to the test directory. Writing intermediate files and results
directly to the results directory avoids a number of spurious FAILs and
UNRESOLVEDs.

Signed-off-by: Peter Harris phar...@opentext.com
---
 xts5/Xlib16/XrmCombineFileDatabase.m |   16 -
 xts5/Xlib16/XrmGetFileDatabase.m |   10 +++---
 xts5/Xlib16/XrmPutFileDatabase.m |2 +-
 xts5/Xlib17/XReadBitmapFile.m|6 ++--
 xts5/Xlib17/XWriteBitmapFile.m   |   16 -
 xts5/Xt9/XtAppAddInput.m |   12 +++
 xts5/Xt9/XtAppMainLoop.m |4 +--
 xts5/Xt9/XtAppNextEvent.m|4 +--
 xts5/Xt9/XtAppPeekEvent.m|4 +--
 xts5/Xt9/XtAppPending.m  |8 ++---
 xts5/Xt9/XtAppProcessEvent.m |   12 +++
 xts5/XtC/XtAddInput.m|   12 +++
 xts5/XtC/XtMainLoop.m|4 +--
 xts5/XtC/XtNextEvent.m   |4 +--
 xts5/XtC/XtPeekEvent.m   |6 ++--
 xts5/XtC/XtProcessEvent.m|   10 +++---
 xts5/include/XtTest.h|1 +
 xts5/include/xtlibproto.h|2 ++
 xts5/src/lib/Makefile.am |1 +
 xts5/src/lib/block.c |   14 
 xts5/src/lib/checkarea.c |2 +-
 xts5/src/lib/dumpimage.c |2 +-
 xts5/src/lib/outfile.c   |   65 ++
 xts5/src/lib/savimage.c  |2 +-
 xts5/src/lib/verimage.c  |7 ++--
 xts5/src/xim/linklocale.c|4 +--
 xts5/src/xim/xim_save.c  |2 +-
 27 files changed, 152 insertions(+), 80 deletions(-)
 create mode 100644 xts5/src/lib/outfile.c

diff --git a/xts5/Xlib16/XrmCombineFileDatabase.m 
b/xts5/Xlib16/XrmCombineFileDatabase.m
index 5881ae4..b06d471 100644
--- a/xts5/Xlib16/XrmCombineFileDatabase.m
+++ b/xts5/Xlib16/XrmCombineFileDatabase.m
@@ -150,13 +150,13 @@ shall merge the contents of a resource file into a 
database.
gfd_return = XrmGetStringDatabase(src_spec1);
 
tet_infoline(PREP: Add data to resource file);
-   (void)XrmPutFileDatabase(gfd_return, file_name_good);
+   (void)XrmPutFileDatabase(gfd_return, outfile(file_name_good));
tet_infoline(PREP: Add to database);
 
(void)XrmPutLineResource(dst_database_id, dst_spec);
 
tet_infoline(TEST: Call to XrmCombineFileDatabase merges resource file 
into database);
-   XrmCombineFileDatabase(file_name_good, dst_database_id, True);
+   XrmCombineFileDatabase(outfile(file_name_good), dst_database_id, True);
 
XSync(display_arg, 0);
XSetErrorHandler(unexp_err);  
@@ -234,13 +234,13 @@ the entry in target_db.
(void)XrmPutLineResource(gfd_return, src_spec3);
 
tet_infoline(PREP: Add data to resource file);
-   (void)XrmPutFileDatabase(gfd_return, file_name_good);
+   (void)XrmPutFileDatabase(gfd_return, outfile(file_name_good));
 
tet_infoline(PREP: Add to database);
(void)XrmPutLineResource(dst_database_id, dst_spec);
 
tet_infoline(TEST: Entry in the file replaces the database entry);
-   XrmCombineFileDatabase(file_name_good, dst_database_id, True);
+   XrmCombineFileDatabase(outfile(file_name_good), dst_database_id, True);
 
XSync(display_arg, 0);
XSetErrorHandler(unexp_err);  
@@ -318,13 +318,13 @@ replace the entry in target_db.
(void)XrmPutLineResource(gfd_return, src_spec3);
 
tet_infoline(PREP: Add data to resource file);
-   (void)XrmPutFileDatabase(gfd_return, file_name_good);
+   (void)XrmPutFileDatabase(gfd_return, outfile(file_name_good));
 
tet_infoline(PREP: Add to database);
(void)XrmPutLineResource(dst_database_id, dst_spec);
 
tet_infoline(TEST: Entry in the file does not replace the database 
entry);
-   XrmCombineFileDatabase(file_name_good, dst_database_id, False);
+   XrmCombineFileDatabase(outfile(file_name_good), dst_database_id, 
False);
 
XSync(display_arg, 0);
XSetErrorHandler(unexp_err);  
@@ -401,12 +401,12 @@ filename in it.
gfd_return = XrmGetStringDatabase(src_spec1);
(void)XrmPutLineResource(gfd_return, src_spec2);
(void)XrmPutLineResource(gfd_return, src_spec3);
-   (void)XrmPutFileDatabase(gfd_return, file_name_good);
+   (void)XrmPutFileDatabase(gfd_return, outfile(file_name_good));
 
dst_database_id = NULL;
 
tet_infoline(TEST: When target_db is NULL a new database is created);
-   XrmCombineFileDatabase(file_name_good, dst_database_id, True);
+   XrmCombineFileDatabase(outfile(file_name_good), dst_database_id, True);
 
XSync(display_arg, 0);
XSetErrorHandler(unexp_err);  
diff --git a/xts5/Xlib16/XrmGetFileDatabase.m b/xts5/Xlib16/XrmGetFileDatabase.m
index 9b6a60a..1094a9f 100644
--- a/xts5/Xlib16

Re: [PATCH xts] Write results directly to results directory

2013-06-03 Thread Peter Harris
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On 2013-06-03 17:49, Jamey Sharp wrote:
 Seems like a smart idea and solid patch. I have a couple
 suggestions you can do with as you please:
 
 On Mon, Jun 03, 2013 at 04:33:35PM -0400, Peter Harris wrote:
 If an installed xtest is run, the user does not normally have
 write access to the test directory. Writing intermediate files
 and results directly to the results directory avoids a number of
 spurious FAILs and UNRESOLVEDs.
 ...
 +const char * +outfile(const char *fn) +{ +  char *out = (char
 *)fn;
 
 This assignment to out is dead; I'd delete the initializer.

If dirname() fails, goto done will return the value assigned in this
line. It appears it is not possible for dirname() to fail, so I'll
remove this and the failure check too for v2.

 +regid(NULL, (union regtypes *)out, REG_MALLOC);
 
 I don't know the XTS codebase (and don't want to, but...): Does
 regid register a resource to be freed at the end of the current
 test?

Yes.

 Either way: Reviewed-by: Jamey Sharp ja...@minilop.net

Thanks.

Peter Harris
- -- 
   Open Text Connectivity Solutions Group
Peter Harrishttp://connectivity.opentext.com/
Research and DevelopmentPhone: +1 905 762 6001
phar...@opentext.comToll Free: 1 877 359 4866
-BEGIN PGP SIGNATURE-
Version: GnuPG v2.0.17 (MingW32)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iEYEARECAAYFAlGtF7oACgkQsbmxTd/lXecrpACeNbliK5kvx7u5q5BrzbI4xg8z
4p8Anigcav6tKAhVQi/SCAgttIoNPMOU
=o3jE
-END 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


[PATCH xts 1/3] Fix automatic configuration of BackingStores

2013-05-31 Thread Peter Harris
xdpyinfo reports NO, WHEN MAPPED or YES, but XT_DOES_BACKING_STORE
expects a 0, 1, or 2.

Signed-off-by: Peter Harris phar...@opentext.com
---

This bumps the minimum version of Perl required up to 5.10.

Both RHEL and Debian stable have perl 5.10. Is there anybody out there
who runs XTS on a system that does not also have at least perl 5.10?

 xts5/bin/xts-config.in |   10 +-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/xts5/bin/xts-config.in b/xts5/bin/xts-config.in
index e22ba56..dbe84da 100755
--- a/xts5/bin/xts-config.in
+++ b/xts5/bin/xts-config.in
@@ -1,5 +1,6 @@
 #!/usr/bin/perl -pi.bak
 
+use 5.10.0;
 use warnings;
 use strict;
 use Sys::Hostname;
@@ -135,8 +136,15 @@ BEGIN
 
$::vars{XT_PIXMAP_DEPTHS} =~ s/,?\s+/ /g;
 
+   given ($::vars{XT_DOES_BACKING_STORE})
+   {
+   $::vars{XT_DOES_BACKING_STORE} = 2 when (/yes/i);
+   $::vars{XT_DOES_BACKING_STORE} = 1 when (/when/i);
+   $::vars{XT_DOES_BACKING_STORE} = 0;
+   }
+
foreach my $var (qw(TET_EXEC_IN_PLACE XT_EXTENSIONS
-   XT_DOES_BACKING_STORE XT_DOES_SAVE_UNDERS
+   XT_DOES_SAVE_UNDERS
XT_POSIX_SYSTEM XT_TCP XT_LOCAL
XT_SAVE_SERVER_IMAGE XT_OPTION_NO_CHECK 
XT_OPTION_NO_TRACE
XT_DEBUG_OVERRIDE_REDIRECT XT_DEBUG_PAUSE_AFTER
-- 
1.7.10.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 xts 2/3] Disable ColormapNotify test if implicit colormaps

2013-05-31 Thread Peter Harris
If the server supports more than one simultaneously installed colormap,
it probably does implicit installation too. If the server implicitly
installs the colormap when it is created, there will be no
ColormapNotify when InstallColormap is called. In that case, the event
count will be wrong, and the test will report FAIL even though it
shouldn't.

Signed-off-by: Peter Harris phar...@opentext.com
---
 xts5/Xlib10/XInstallColormap.m |8 
 1 file changed, 8 insertions(+)

diff --git a/xts5/Xlib10/XInstallColormap.m b/xts5/Xlib10/XInstallColormap.m
index cabe836..10d4117 100644
--- a/xts5/Xlib10/XInstallColormap.m
+++ b/xts5/Xlib10/XInstallColormap.m
@@ -207,6 +207,7 @@ Window  base;
 Window w1, w2;
 Window w3nocm;
 XEvent ev;
+Screen *screen;
 XColormapEvent good;
 XColormapEvent *cmp;
 intgot;
@@ -217,6 +218,13 @@ intgot;
good.new = False;
good.state = ColormapInstalled;
 
+   screen = ScreenOfDisplay(display, DefaultScreen(display));
+   if (MaxCmapsOfScreen(screen)  1) {
+   untested(Cannot reliably test ColormapNotify when the server 
has implicit colormaps);
+   report(  Server supports more than one installed colormap);
+   return;
+   }
+
for (resetvinf(VI_WIN); nextvinf(vp); ) {
 
base = makewin(display, vp);
-- 
1.7.10.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 xts 3/3] Fix XSetWMSizeHints et al.

2013-05-31 Thread Peter Harris
Xlib, since release 1.1.2, only transmits fields for which the
corresponding flags bit is set (to avoid a potential information leak).

Set the flags field to include all the fields to be tested.

Signed-off-by: Peter Harris phar...@opentext.com
---
 xts5/Xlib15/XGetWMNormalHints.m |7 ---
 xts5/Xlib15/XGetWMSizeHints.m   |7 ---
 xts5/Xlib15/XSetWMNormalHints.m |8 
 xts5/Xlib15/XSetWMProperties/XSetWMProperties.m |8 
 xts5/Xlib15/XSetWMSizeHints.m   |9 +
 5 files changed, 21 insertions(+), 18 deletions(-)

diff --git a/xts5/Xlib15/XGetWMNormalHints.m b/xts5/Xlib15/XGetWMNormalHints.m
index 5a754d0..28dd70a 100644
--- a/xts5/Xlib15/XGetWMNormalHints.m
+++ b/xts5/Xlib15/XGetWMNormalHints.m
@@ -111,7 +111,8 @@ long*supplied_return = supret;
 #include   X11/Xatom.h
 #defineNumPropSizeElements 18
 #defineOldNumPropSizeElements 15
-static XSizeHints  sizehints = { 0 ,1,2,3,4,5,6,7,8,9,10, {11,12} ,  
{13,14},  15, 16, 17};
+#define AllFlags 
(USPosition|USSize|PPosition|PSize|PMinSize|PMaxSize|PResizeInc|PAspect|PBaseSize|PWinGravity)
+static XSizeHints  sizehints = { AllFlags ,1,2,3,4,5,6,7,8,9,10, {11,12} , 
 {13,14},  15, 16, 17};
 static XSizeHints  rhints = { 100, 101, 102, 103, 104, 105, 106, 107, 108, 
109, 110,
   {111, 112}, {113, 114}, 115, 116, 117 };
 static longsupret;
@@ -161,8 +162,8 @@ XVisualInfo *vp;
} else
CHECK;

-   if(rhints.flags != 0) {
-   report(The flags component of the XSizeHints structure was %lu 
instead of 0., rhints.flags);
+   if(rhints.flags != AllFlags) {
+   report(The flags component of the XSizeHints structure was %lX 
instead of %X., rhints.flags, AllFlags);
FAIL;
} else
CHECK;
diff --git a/xts5/Xlib15/XGetWMSizeHints.m b/xts5/Xlib15/XGetWMSizeHints.m
index 21cccda..0e0370b 100644
--- a/xts5/Xlib15/XGetWMSizeHints.m
+++ b/xts5/Xlib15/XGetWMSizeHints.m
@@ -112,7 +112,8 @@ Atomproperty = XA_WM_NORMAL_HINTS;
 #include   X11/Xatom.h
 #defineNumPropSizeElements 18
 #defineOldNumPropSizeElements 15
-static XSizeHints  sizehints = {0,1,2,3,4,5,6,7,8,9,10, {11,12} ,  
{13,14},  15, 16, 17};
+#define AllFlags 
(USPosition|USSize|PPosition|PSize|PMinSize|PMaxSize|PResizeInc|PAspect|PBaseSize|PWinGravity)
+static XSizeHints  sizehints = {AllFlags,1,2,3,4,5,6,7,8,9,10, {11,12} ,  
{13,14},  15, 16, 17};
 static XSizeHints  rhints =
{100,101,102,103,104,105,106,107,108,109,110, {111,112} ,  {113,114},  115, 
116, 117};
 static longsupret;
 ASSERTION Good A
@@ -161,8 +162,8 @@ XVisualInfo *vp;
} else
CHECK;

-   if(rhints.flags != 0) {
-   report(The flags component of the XSizeHints structure was %lu 
instead of 0., rhints.flags);
+   if(rhints.flags != AllFlags) {
+   report(The flags component of the XSizeHints structure was %lX 
instead of %X., rhints.flags, AllFlags);
FAIL;
} else
CHECK;
diff --git a/xts5/Xlib15/XSetWMNormalHints.m b/xts5/Xlib15/XSetWMNormalHints.m
index 44325a6..5216314 100644
--- a/xts5/Xlib15/XSetWMNormalHints.m
+++ b/xts5/Xlib15/XSetWMNormalHints.m
@@ -109,8 +109,8 @@ XSizeHints  *hints = sizehints_0;
 EXTERN
 #include   X11/Xatom.h
 #defineNewNumPropSizeElements 18   /* ICCCM v. 1 */
-static XSizeHints  sizehints_0 = { PAllHints,0,0,0,0,0,0,0,0,0,0, {0,0}, 
{0,0}, 0,0,0};
-static XSizeHints  sizehints_1 = { PAllHints,1,2,3,4,5,6,7,8,9,10, 
{11,12}, {13,14}, 15, 16, 17};
+static XSizeHints  sizehints_0 = { 
PAllHints|PBaseSize|PWinGravity,0,0,0,0,0,0,0,0,0,0, {0,0}, {0,0}, 0,0,0};
+static XSizeHints  sizehints_1 = { 
PAllHints|PBaseSize|PWinGravity,1,2,3,4,5,6,7,8,9,10, {11,12}, {13,14}, 15, 16, 
17};
 ASSERTION Good A
 A call to xname sets the
 .S WM_NORMAL_HINTS
@@ -188,8 +188,8 @@ int i;
pp.base_height = (int)uls[++i]; /* added by ICCCM version 1 */
pp.win_gravity = (int)uls[++i]; /* added by ICCCM version 1 */
 
-   if(pp.flags != PAllHints) {
-   report(The flags component of the XSizeHints structure was %lu 
instead of PAllHints (%ld)., pp.flags, PAllHints);
+   if(pp.flags != (PAllHints|PBaseSize|PWinGravity)) {
+   report(The flags component of the XSizeHints structure was %lu 
instead of PAllHints|PBaseSize|PWinGravity (%ld)., pp.flags, 
PAllHints|PBaseSize|PWinGravity);
FAIL;
} else
CHECK;
diff --git a/xts5/Xlib15/XSetWMProperties/XSetWMProperties.m 
b/xts5/Xlib15/XSetWMProperties/XSetWMProperties.m
index 9ef85f7..8058915 100644
--- a/xts5/Xlib15/XSetWMProperties/XSetWMProperties.m
+++ b/xts5/Xlib15/XSetWMProperties

[PATCH xts 1/2] Fix pointer/int warnings in xts5/xim/response.c

2013-05-30 Thread Peter Harris
psd-data.bitmap is never set, but it's better to make sure we never
try to free() an XID.

Signed-off-by: Peter Harris phar...@opentext.com
---
 xts5/src/xim/response.c |6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/xts5/src/xim/response.c b/xts5/src/xim/response.c
index b00ccdd..c554acb 100644
--- a/xts5/src/xim/response.c
+++ b/xts5/src/xim/response.c
@@ -455,8 +455,8 @@ void xim_response_pop_cb(pstk)
}
else
{
-   if(psd-data.bitmap != NULL)
-   free(psd-data.bitmap);
+   if(psd-data.bitmap != None)
+   XFreePixmap(Dsp, 
psd-data.bitmap);
}
break;
default:
@@ -1133,7 +1133,7 @@ static Pixmap read_pixmap()
parse_skwhite(presponse);
}
 
-   return(NULL);
+   return(None);
 }
 
 /* read the callback data from a response file for */
-- 
1.7.10.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 xts 2/2] XI: Fix random failures on LP64 platforms

2013-05-30 Thread Peter Harris
It turns out that XID is a 'long' for historical reasons, but the XInput
error macros expect a pointer-to-int.

Signed-off-by: Peter Harris phar...@opentext.com
---
 xts5/XI/AllowDeviceEvents.m |2 +-
 xts5/XI/ChangeDeviceControl.m   |2 +-
 xts5/XI/ChangeFeedbackControl.m |2 +-
 xts5/XI/ChangeKeyboardDevice.m  |4 ++--
 xts5/XI/ChangePointerDevice.m   |4 ++--
 xts5/XI/CloseDevice.m   |4 ++--
 xts5/XI/DeviceBell.m|2 +-
 xts5/XI/GetDeviceMotionEvents.m |2 +-
 xts5/XI/GetFeedbackControl.m|2 +-
 xts5/XI/GrabDevice.m|6 +++---
 xts5/XI/GrabDeviceButton.m  |6 +++---
 xts5/XI/GrabDeviceKey.m |6 +++---
 xts5/XI/OpenDevice.m|4 ++--
 xts5/XI/SendExtensionEvent.m|4 ++--
 xts5/XI/SetDeviceButtonMapping.m|2 +-
 xts5/XI/SetDeviceMode.m |2 +-
 xts5/XI/SetDeviceModifierMapping.m  |2 +-
 xts5/XI/SetDeviceValuators.m|2 +-
 xts5/XI/UngrabDeviceButton.m|5 +++--
 xts5/XI/UngrabDeviceKey.m   |4 ++--
 xts5/XI/XGetDeviceControl.m |2 +-
 xts5/XI/XGetDeviceFocus.m   |2 +-
 xts5/XI/XGetDeviceKeyMapping.m  |2 +-
 xts5/XI/XGetDeviceModifierMapping.m |2 +-
 xts5/XI/XQueryDeviceState.m |2 +-
 xts5/XI/XSelectExtensionEvent.m |2 +-
 xts5/XI/XSetDeviceFocus.m   |2 +-
 xts5/XI/XUngrabDevice.m |2 +-
 28 files changed, 42 insertions(+), 41 deletions(-)

diff --git a/xts5/XI/AllowDeviceEvents.m b/xts5/XI/AllowDeviceEvents.m
index 90e26a2..ecde6ae 100644
--- a/xts5/XI/AllowDeviceEvents.m
+++ b/xts5/XI/AllowDeviceEvents.m
@@ -1338,7 +1338,7 @@ is specified.
 Make the call with an invalid device.
 CODE baddevice
 XDevice nodevice;
-XID baddevice;
+int baddevice;
 int ret;
 
if (!grabstartup())
diff --git a/xts5/XI/ChangeDeviceControl.m b/xts5/XI/ChangeDeviceControl.m
index 92f56d6..4ce7ae7 100644
--- a/xts5/XI/ChangeDeviceControl.m
+++ b/xts5/XI/ChangeDeviceControl.m
@@ -465,7 +465,7 @@ If an invalid device is specified, a BadDevice error will 
result.
 Do a ChangeDeviceControl request, specifying an invalid device.
 CODE baddevice
 XDevice bogus;
-XID baddevice;
+int baddevice;
 int ximajor, first, err, ret, val;
 
 if (!XQueryExtension (display, INAME, ximajor, first, err))
diff --git a/xts5/XI/ChangeFeedbackControl.m b/xts5/XI/ChangeFeedbackControl.m
index febb934..e240e67 100644
--- a/xts5/XI/ChangeFeedbackControl.m
+++ b/xts5/XI/ChangeFeedbackControl.m
@@ -590,7 +590,7 @@ If an invalid device is specified, a BadDevice error will 
result.
 Do a ChangeFeedbackControl, specifying an invalid device.
 CODE baddevice
 XDevice bogus;
-XID baddevice;
+int baddevice;
 int ximajor, first, err;
 
 if (!XQueryExtension (display, INAME, ximajor, first, err)) {
diff --git a/xts5/XI/ChangeKeyboardDevice.m b/xts5/XI/ChangeKeyboardDevice.m
index 678db9e..b0b6b16 100644
--- a/xts5/XI/ChangeKeyboardDevice.m
+++ b/xts5/XI/ChangeKeyboardDevice.m
@@ -351,7 +351,7 @@ Change the keyboard to a new device.
 Verify that all input device extension requests that require a Device pointer
 fail with a BadDevice error, when the new keyboard is specified.
 CODE
-XID baddevice;
+int baddevice;
 int devicekeypress;
 XDeviceInfo *list;
 int i, ndevices, revert, nfeed, mask, ksyms_per;
@@ -690,7 +690,7 @@ is specified.
 Make the call with an invalid device.
 CODE baddevice
 XDevice nodevice;
-XID baddevice;
+int baddevice;
 int ximajor, first, err;
 
if (!XQueryExtension (display, INAME, ximajor, first, err))
diff --git a/xts5/XI/ChangePointerDevice.m b/xts5/XI/ChangePointerDevice.m
index 0c18a58..d203f6e 100644
--- a/xts5/XI/ChangePointerDevice.m
+++ b/xts5/XI/ChangePointerDevice.m
@@ -358,7 +358,7 @@ Change the pointer to a new device.
 Verify that all input device extension requests that require a Device pointer
 fail with a BadDevice error, when the new pointer is specified.
 CODE
-XID baddevice;
+int baddevice;
 int devicemotionnotify;
 XDeviceInfo *list;
 int i, ndevices, revert, nfeed, mask, ksyms_per, savid;
@@ -722,7 +722,7 @@ When an invalid device is specified, a BadDevice error will 
result.
 Make the call with an invalid device.
 CODE baddevice
 XDevice nodevice;
-XID baddevice;
+int baddevice;
 int ximajor, first, err;
 
if (!XQueryExtension (display, INAME, ximajor, first, err))
diff --git a/xts5/XI/CloseDevice.m b/xts5/XI/CloseDevice.m
index 1ab0273..c1bc64c 100644
--- a/xts5/XI/CloseDevice.m
+++ b/xts5/XI/CloseDevice.m
@@ -400,7 +400,7 @@ Call xname to close a device.
 Call other input device extension requests.
 Verify a BadDevice error occurs.
 CODE
-XIDbaddevice; 
+intbaddevice;
 intdevicekeypress;
 XDeviceInfo *list;
 int ret, i, j, ndevices, revert, nfeed, mask, ksyms_per;
@@ -813,7 +813,7 @@ is specified.
 STRATEGY
 Make the call with an invalid device.
 CODE baddevice
-XID baddevice;
+int

[PATCH xts] Add XInput sections to all

2013-05-29 Thread Peter Harris
Signed-off-by: Peter Harris phar...@opentext.com
---
 xts5/tet_scen |4 
 1 file changed, 4 insertions(+)

diff --git a/xts5/tet_scen b/xts5/tet_scen
index fa13bca..6c32f0a 100644
--- a/xts5/tet_scen
+++ b/xts5/tet_scen
@@ -186,6 +186,10 @@ all
:include:/scenarios/XtE_scen
VSW5TESTSUITE SECTION ShapeExt 11 11 0 0
:include:/scenarios/shape_scen
+   VSW5TESTSUITE SECTION XI 36 316 0 0
+   :include:/scenarios/XI_scen
+   VSW5TESTSUITE SECTION XIproto 35 107 0 0
+   :include:/scenarios/XIproto_scen
 
 Interface
VSW5TESTSUITE SECTION Xlib3 109 161 0 0
-- 
1.7.10.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: [RFC][PATCH] Make GetXIDRange O(1) instead of O(N^2)

2013-05-28 Thread Peter Harris
On 2013-05-28 03:15, Roberto Ragusa wrote:
 I hope someone can explain the ID reuse stuff. I'm not able to say
 what applications rely on this, but I can say that in my first
 implementation I assumed one add and one free for each ID and the
 KDE desktop was not able to start (and fluxbox too, IIRC).

Clients can reuse IDs, as long as the lifespans are disjoint (otherwise
GetXIDRange would be much less useful). A client cannot reuse an active
ID (see LEGAL_NEW_RESOURCE).

The server can reuse IDs internally in order to create related objects
of a constrained lifetime. For example, A GLX window has a
__glXDrawableRes resource which uses the same ID as the RT_WINDOW it is
based on, so when the client frees the RT_WINDOW the __glXDrawableRes is
also freed automatically.

(Why didn't SGI just use AllocateWindowPrivate? The shared resource ID
mechanism predates the shared devPrivates mechanism. Possibly by enough
that shared devPrivates didn't exist when GLX was being written).

The whole point of GetXIDRange was to avoid the need to track free
resource IDs on the client side. Since computers have a few orders of
magnitude more storage now than they did in 1987, maybe it makes sense
to add (optional?) resource ID tracking to Xlib instead of the server?
In the typical case, Xlib could be re-using IDs before generating new
ones, so the rbtree (or even a simple stack of reusable IDs) shouldn't
grow as large as it would in the server.

(In xcb, resource IDs are explicit. An xcb application that would
benefit from reusing free IDs can already do so.)

Peter Harris
-- 
   Open Text Connectivity Solutions Group
Peter Harrishttp://connectivity.opentext.com/
Research and DevelopmentPhone: +1 905 762 6001
phar...@opentext.comToll Free: 1 877 359 4866
___
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: Initial DRI3000 protocol specs available

2013-02-20 Thread Peter Harris
On 2013-02-19 22:46, Keith Packard wrote:
 A.3 Protocol Events
 
 The Swap extension specifies the SwapComplete event.
 
 ┌───
 SwapComplete
   1   CARD8   type
   1   CARD8   extension
   2   CARD16  sequenceNumber
   4   DRAWABLEdrawable
   4   CARD32  ust_hi
   4   CARD32  ust_lo
   4   CARD32  msc_hi
   4   CARD32  msc_lo
   4   CARD32  sbc_hi
   4   CARD32  sbc_lo
 └───

May I suggest that all new events be Generic Events? One event isn't too
bad, but the legacy event space is already crowded.

SwapComplete
1   35  GenericEvent
1   CARD8   extension
2   CARD16  sequenceNumber
4   2   length
2   CARD16  evtype
2   unused
4   DRAWABLEdrawable
4   CARD32  ust_hi
4   CARD32  ust_lo
4   CARD32  msc_hi
4   CARD32  msc_lo
4   CARD32  sbc_hi
4   CARD32  sbc_lo

(I assume extension in the original is a typo. If it isn't and an
extra byte of data is needed, it easily fits in the two bytes of
unused after evtype).

Peter Harris
-- 
   Open Text Connectivity Solutions Group
Peter Harrishttp://connectivity.opentext.com/
Research and DevelopmentPhone: +1 905 762 6001
phar...@opentext.comToll Free: 1 877 359 4866
___
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: [Xcb] [PATCH] Remove fieldref from sole list in GetIndicatorMap reply

2013-02-19 Thread Peter Harris
On 2013-02-19 15:51, Alan Coopersmith wrote:
 On 02/19/13 12:47 PM, Peter Harris wrote:
 I was going to, but I can't locate the XKB protocol spec. There isn't
 one in xorg/proto/kbproto, and the specs in xorg/lib/libX11 appear to
 document the Xlib interface only, not the on-wire protocol.
 
 I see a specs directory in proto/kbproto when I look:
 http://cgit.freedesktop.org/xorg/proto/kbproto/tree/specs

A git pull fixed that. Apparently my local copy was over two years old.
Oops.

 Does anyone happen to know where the XKB proto spec is? I want to read
 it before I file a bug against the server.
 
 http://www.x.org/releases/X11R7.7/doc/kbproto/xkbproto.html (or .pdf)
 for the formatted version.

Even better. Thanks.

Peter Harris
-- 
   Open Text Connectivity Solutions Group
Peter Harrishttp://connectivity.opentext.com/
Research and DevelopmentPhone: +1 905 762 6001
phar...@opentext.comToll Free: 1 877 359 4866
___
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] Set nIndicators in XkbGetIndicatorMap

2013-02-19 Thread Peter Harris
Xlib doesn't use this value (it computes it from the reply length
instead) which is why nobody has noticed yet. But the spec
http://www.x.org/releases/X11R7.7/doc/kbproto/xkbproto.html
says that it should be set.

Signed-off-by: Peter Harris phar...@opentext.com
---
 xkb/xkb.c |1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/xkb/xkb.c b/xkb/xkb.c
index 7e51e40..2ad6574 100644
--- a/xkb/xkb.c
+++ b/xkb/xkb.c
@@ -3073,6 +3073,7 @@ XkbComputeGetIndicatorMapReplySize(XkbIndicatorPtr 
indicators,
 nIndicators++;
 }
 rep-length = (nIndicators * SIZEOF(xkbIndicatorMapWireDesc)) / 4;
+rep-nIndicators = nIndicators;
 return Success;
 }
 
-- 
1.7.2.5

___
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: [Xcb] [PATCH] Remove fieldref from sole list in GetIndicatorMap reply

2013-02-19 Thread Peter Harris
Context for xorg-devel, since this thread started on the xcb list: The
nIndicators field is never set in xkbGetIndicatorMapReply (nor does the
Xlib half read it).

http://cgit.freedesktop.org/xorg/proto/kbproto/tree/XKBproto.h#n487

On 2013-02-19 14:46, Bart Massey wrote:
 Seems to me that there's also a problem here if the protocol specifies
 a reply field that is not being set by the server. Has someone filed a
 bug report against the server here? --Bart

I was going to, but I can't locate the XKB protocol spec. There isn't
one in xorg/proto/kbproto, and the specs in xorg/lib/libX11 appear to
document the Xlib interface only, not the on-wire protocol.

Does anyone happen to know where the XKB proto spec is? I want to read
it before I file a bug against the server.

Thanks,
 Peter Harris
-- 
   Open Text Connectivity Solutions Group
Peter Harrishttp://connectivity.opentext.com/
Research and DevelopmentPhone: +1 905 762 6001
phar...@opentext.comToll Free: 1 877 359 4866
___
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 xts] xts5: include xtrans CFLAGS when building libXst

2013-01-07 Thread Peter Harris
On 2013-01-04 21:15, Aaron Plattner wrote:
 If xtrans is installed in a weird location, libXst fails to build:
 
  ConnDis.c:43:31: fatal error: X11/Xtrans/Xtrans.h: No such file or directory
 
 Fix this by including $(XT_CFLAGS) to pick up the path to Xtrans.h.
 
 Signed-off-by: Aaron Plattner aplatt...@nvidia.com

Reviewed-by: Peter Harris phar...@opentext.com

Peter Harris
-- 
   Open Text Connectivity Solutions Group
Peter Harrishttp://connectivity.opentext.com/
Research and DevelopmentPhone: +1 905 762 6001
phar...@opentext.comToll Free: 1 877 359 4866
___
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 xts] Set XT_DISPLAYHOST for remote connections

2013-01-07 Thread Peter Harris
On 2013-01-04 21:12, Aaron Plattner wrote:
 On 01/02/2013 02:38 PM, Peter Harris wrote:
 Some tests segfault if XT_DISPLAY is set and XT_DISPLAYHOST is not.

 Signed-off-by: Peter Harris phar...@opentext.com
 
 Reviewed-by: Aaron Plattner aplatt...@nvidia.com
 
 Which test?

Xlib3/XOpenDisplay

 Tested-by: Aaron Plattner aplatt...@nvidia.com

Thanks.

I just noticed, however, that

 +my @displayhost = split(/:/, $::vars{DISPLAY}, 2);
 +$::vars{XT_DISPLAYHOST} = $displayhost[0];

can't work for IPv6 literal addresses. I need to split on the last :,
not the first one.

I'll redo the patch.

Peter Harris
-- 
   Open Text Connectivity Solutions Group
Peter Harrishttp://connectivity.opentext.com/
Research and DevelopmentPhone: +1 905 762 6001
phar...@opentext.comToll Free: 1 877 359 4866
___
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


[PATCHv2 xts] Set XT_DISPLAYHOST for remote connections

2013-01-07 Thread Peter Harris
Xlib3/XOpenDisplay may segfault if XT_DISPLAY is set and XT_DISPLAYHOST
is not.

Signed-off-by: Peter Harris phar...@opentext.com
---
This version works with IPv6 literal addresses. XOpenDisplay still
parses them incorrectly, but at least it doesn't crash.

 xts5/bin/xts-config.in |8 
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/xts5/bin/xts-config.in b/xts5/bin/xts-config.in
index 9e30b5f..e22ba56 100755
--- a/xts5/bin/xts-config.in
+++ b/xts5/bin/xts-config.in
@@ -99,6 +99,14 @@ BEGIN
}
else
{
+   $::vars{XT_TCP} = Yes;
+   my $hostname = ;
+   my $offset = rindex($::vars{DISPLAY}, ':');
+   if ($offset = 0) {
+   $hostname = substr($::vars{DISPLAY}, 0, $offset);
+   }
+   $::vars{XT_DISPLAYHOST} = $hostname;
+
# Not a local display; admin is responsible for placing
# xtest fonts on the font path before running xts-config.
$::vars{XT_FONTPATH} = $::vars{XT_FONTPATH_GOOD};
-- 
1.7.2.5

___
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 xts] Set XT_DISPLAYHOST for remote connections

2013-01-02 Thread Peter Harris
Some tests segfault if XT_DISPLAY is set and XT_DISPLAYHOST is not.

Signed-off-by: Peter Harris phar...@opentext.com
---
 xts5/bin/xts-config.in |4 
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/xts5/bin/xts-config.in b/xts5/bin/xts-config.in
index 9e30b5f..ce55618 100755
--- a/xts5/bin/xts-config.in
+++ b/xts5/bin/xts-config.in
@@ -99,6 +99,10 @@ BEGIN
}
else
{
+   $::vars{XT_TCP} = Yes;
+   my @displayhost = split(/:/, $::vars{DISPLAY}, 2);
+   $::vars{XT_DISPLAYHOST} = $displayhost[0];
+
# Not a local display; admin is responsible for placing
# xtest fonts on the font path before running xts-config.
$::vars{XT_FONTPATH} = $::vars{XT_FONTPATH_GOOD};
-- 
1.7.2.5

___
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 xts] Build blowup

2012-12-20 Thread Peter Harris
On 2012-12-19 09:07, Dan Nicholson wrote:
 On Tue, Dec 18, 2012 at 10:44 AM, Peter Harris phar...@opentext.com wrote:
 Rename from pixval/blowup to bin/xts-blowup, add Makefile.am, and
 delete old-style Makefile.
 ---

 Was blowup really not ported to the new build system yet, or is there
 some alternative tool that people use these days?
 
 I think when I was doing the port, blowup seemed to be only a fringe
 tool and I figured I'd get back to it later. 3 years later...
 
 Reviewed-by: Dan Nicholson dbn.li...@gmail.com

Thanks. Pushed.

Peter Harris
-- 
   Open Text Connectivity Solutions Group
Peter Harrishttp://connectivity.opentext.com/
Research and DevelopmentPhone: +1 905 762 6001
phar...@opentext.comToll Free: 1 877 359 4866
___
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 xts] Build blowup

2012-12-18 Thread Peter Harris
Rename from pixval/blowup to bin/xts-blowup, add Makefile.am, and
delete old-style Makefile.
---

Was blowup really not ported to the new build system yet, or is there
some alternative tool that people use these days?

 configure.ac|1 +
 xts5/src/Makefile.am|2 +-
 xts5/src/bin/Makefile.am|2 +-
 xts5/src/bin/blowup/.gitignore  |1 +
 xts5/src/bin/blowup/Makefile.am |7 +++
 xts5/src/{pixval = bin}/blowup/ajax.c  |0
 xts5/src/{pixval = bin}/blowup/vblowup_c.c |4 +-
 xts5/src/pixval/blowup/.cvsignore   |1 -
 xts5/src/pixval/blowup/Makefile |   76 ---
 9 files changed, 13 insertions(+), 81 deletions(-)
 create mode 100644 xts5/src/bin/blowup/.gitignore
 create mode 100644 xts5/src/bin/blowup/Makefile.am
 rename xts5/src/{pixval = bin}/blowup/ajax.c (100%)
 rename xts5/src/{pixval = bin}/blowup/vblowup_c.c (99%)
 delete mode 100644 xts5/src/pixval/blowup/.cvsignore
 delete mode 100644 xts5/src/pixval/blowup/Makefile
 delete mode 100644 xts5/src/pixval/include/Dummy
 delete mode 100644 xts5/src/pixval/pvtools/Dummy

diff --git a/configure.ac b/configure.ac
index d08b759..57e88df 100644
--- a/configure.ac
+++ b/configure.ac
@@ -163,6 +163,7 @@ xts5/src/libXtaw/Makefile
 xts5/src/libXtTest/Makefile
 xts5/src/xim/Makefile
 xts5/src/bin/Makefile
+xts5/src/bin/blowup/Makefile
 xts5/src/bin/mc/Makefile
 xts5/src/bin/reports/Makefile
 xts5/fonts/Makefile
diff --git a/xts5/src/Makefile.am b/xts5/src/Makefile.am
index 7bd74fd..a59493e 100644
--- a/xts5/src/Makefile.am
+++ b/xts5/src/Makefile.am
@@ -1,4 +1,4 @@
-#SUBDIRS = lib libproto libXR5 libXtaw libXtmu libXtTest pixval xim
+#SUBDIRS = lib libproto libXR5 libXtaw libXtmu libXtTest xim
 SUBDIRS = lib libproto libXR5 libXtaw libXtTest xim bin
 
 xtslibdir = $(libexecdir)/xts5
diff --git a/xts5/src/bin/Makefile.am b/xts5/src/bin/Makefile.am
index a3edbda..aaf9e75 100644
--- a/xts5/src/bin/Makefile.am
+++ b/xts5/src/bin/Makefile.am
@@ -1 +1 @@
-SUBDIRS = mc reports
+SUBDIRS = blowup mc reports
diff --git a/xts5/src/bin/blowup/.gitignore b/xts5/src/bin/blowup/.gitignore
new file mode 100644
index 000..51eec4e
--- /dev/null
+++ b/xts5/src/bin/blowup/.gitignore
@@ -0,0 +1 @@
+xts-blowup
diff --git a/xts5/src/bin/blowup/Makefile.am b/xts5/src/bin/blowup/Makefile.am
new file mode 100644
index 000..732bf1e
--- /dev/null
+++ b/xts5/src/bin/blowup/Makefile.am
@@ -0,0 +1,7 @@
+include ../../../common.mk
+
+AM_CFLAGS = -I$(top_srcdir)/xts5/include $(XTS_CFLAGS)
+AM_LDFLAGS = $(XTS_LIBS)
+
+bin_PROGRAMS = xts-blowup
+xts_blowup_SOURCES = ajax.c vblowup_c.c
diff --git a/xts5/src/pixval/blowup/ajax.c b/xts5/src/bin/blowup/ajax.c
similarity index 100%
rename from xts5/src/pixval/blowup/ajax.c
rename to xts5/src/bin/blowup/ajax.c
diff --git a/xts5/src/pixval/blowup/vblowup_c.c 
b/xts5/src/bin/blowup/vblowup_c.c
similarity index 99%
rename from xts5/src/pixval/blowup/vblowup_c.c
rename to xts5/src/bin/blowup/vblowup_c.c
index 9412e5e..a7eedfc 100644
--- a/xts5/src/pixval/blowup/vblowup_c.c
+++ b/xts5/src/bin/blowup/vblowup_c.c
@@ -273,6 +273,8 @@ SOFTWARE.
 #endif
 
 #include stdio.h
+#include stdlib.h
+#include string.h
 #include X11/Xlib.h  /* xlib defs */
 #include X11/cursorfont.h/* cursor info */
 /* #include drawutil.h   // color thingys */
@@ -527,8 +529,6 @@ void (*expose_handler)();
 int*winzoomp;
 char   *font_name;
 {  
-   extern void free();
-   extern char *malloc();
 intshow_color = compare_color;

  
Fontfid;
diff --git a/xts5/src/pixval/blowup/.cvsignore 
b/xts5/src/pixval/blowup/.cvsignore
deleted file mode 100644
index 2d11e27..000
--- a/xts5/src/pixval/blowup/.cvsignore
+++ /dev/null
@@ -1 +0,0 @@
-blowup
diff --git a/xts5/src/pixval/blowup/Makefile b/xts5/src/pixval/blowup/Makefile
deleted file mode 100644
index 71d74c5..000
--- a/xts5/src/pixval/blowup/Makefile
+++ /dev/null
@@ -1,76 +0,0 @@
-#
-# Copyright (c) 2005 X.Org Foundation LLC
-# 
-# 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 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 

[PATCH xts] Remove pad adjustments from Xproto/GetImage/PutImage

2012-12-17 Thread Peter Harris
GetImage adjusts the length field incorrectly, and PutImage does not
adjust the length field at all.

Since the only stored images are those from GetImage, it makes more
sense to remove the pad code entirely than to fix it.

Signed-off-by: Peter Harris phar...@opentext.com
---

Xtest defaults to using half the width of your monitor for the pPutImage
test. Nobody noticed the bug before now because the noop pad adjustment
case is the common case. 640, 800, 1024, and 1280 are all an even
multiple of 32.

I noticed because my monitor in portrait mode has a width of 1050.

 xts5/src/libproto/RcvRep.c  |   34 +++---
 xts5/src/libproto/SendReq.c |   38 --
 2 files changed, 11 insertions(+), 61 deletions(-)

diff --git a/xts5/src/libproto/RcvRep.c b/xts5/src/libproto/RcvRep.c
index fca2265..c375d5a 100644
--- a/xts5/src/libproto/RcvRep.c
+++ b/xts5/src/libproto/RcvRep.c
@@ -507,26 +507,16 @@ int client;   /* */
case X_GetImage:
{
 /*
- * Images are stored in the test programs in client byte order and
- * unpadded.  This allows images to be independent of the server.
- * However the server will send images in server byte order and 
- * padded.  This routine unpacks from server form into client-normal
- * form.  Note that we're assuming client-normal images are padded to
- * byte boundary; otherwise the translation is more complicated.
- * Similarly, left-pad must be zero.
+ * Images are stored in the test programs in server byte order and
+ * padding.
  */
 
-   int row, col = 1;
-   unsigned char my_sex = *((unsigned char *) col) ^ 1;
-   unsigned char server_sex =
-   (Xst_clients[client].cl_dpy) - byte_order;
-   long flip = my_sex ^ server_sex;  /* assume MSBFirst == 1 */
int server_pad = (Xst_clients[client].cl_dpy) - bitmap_pad;
-   int dst_width /*in bytes*/ =
+   int byte_width /*in bytes*/ =
(Xst_clients[client].cl_imagewidth + 7)  3;
-   int src_width /*in bytes*/ = dst_width +
-   ((dst_width % (server_pad3)) == 0 ? 0 :
-(server_pad3) - dst_width % (server_pad3));
+   int src_width /*in bytes*/ = byte_width +
+   ((byte_width % (server_pad3)) == 0 ? 0 :
+(server_pad3) - byte_width % (server_pad3));

char *dst = (char *)rp + sizeof(xReply);
 
@@ -540,17 +530,7 @@ int client;   /* */
break;
 }
 
-   rp-generic.length =
-   (dst_width * Xst_clients[client].cl_imageheight)  2;
-
-   for (row = 0; row  Xst_clients[client].cl_imageheight; row++)
-   for(col = 0; col  src_width; col++)
-
-   if (col  dst_width)  {
-   *(dst++) = *((char *)((long)rbp++ ^ flip));
-   }  else  {
-   rbp++;
-   }
+   memcpy(dst, rbp, calculated_length * 4);
}
break;
case X_ListInstalledColormaps:
diff --git a/xts5/src/libproto/SendReq.c b/xts5/src/libproto/SendReq.c
index 0320594..4677a31 100644
--- a/xts5/src/libproto/SendReq.c
+++ b/xts5/src/libproto/SendReq.c
@@ -876,34 +876,12 @@ int pollreq;
case X_PutImage:
{
 /*
- * Images are stored in the test programs in client byte order and
- * unpadded.  This allows images to be independent of the server.
- * However the server will expect images in server byte order and 
- * padded.  This routine sends an altered xPutImageReq which the server
- * will like.  Note that we're assuming client-normal form means that
- * rows are padded to a byte boundary; otherwise the translation is
- * more complex.  Similarly, left-pad must be zero.
+ * Images are stored in the test programs in server byte order and
+ * padding.
  */
 
-   int row, col = 1;
-   unsigned char my_sex = *((unsigned char *) col) ^ 1;
-   unsigned char server_sex =
-   (Xst_clients[client].cl_dpy) - byte_order;
-   long flip = my_sex ^ server_sex;  /* assume MSBFirst == 1 */
-   int server_pad = (Xst_clients[client].cl_dpy) - bitmap_pad;
-   int src_width /*in bytes*/ =
-   (int)(((xPutImageReq *)rp)-width + 7)  3;
-   int dst_width /*in bytes*/ = src_width +
-   ((src_width % (server_pad3)) == 0 ? 0 :
-(server_pad3) - src_width % (server_pad3));
char *src = (char *)rp + sizeof(xPutImageReq);
char **dst = ((Get_Display(client)-bufptr));
-   char

Re: [PATCH xtest] Allow space in read buffer for CRLF and NUL

2012-12-13 Thread Peter Harris
On 2012-12-06 18:38, Aaron Plattner wrote:
 Reviewed-by: Aaron Plattner aplatt...@nvidia.com

Thanks. Pushed.

Peter Harris
-- 
   Open Text Connectivity Solutions Group
Peter Harrishttp://connectivity.opentext.com/
Research and DevelopmentPhone: +1 905 762 6001
phar...@opentext.comToll Free: 1 877 359 4866
___
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 xtest] Allow space in read buffer for CRLF and NUL

2012-12-04 Thread Peter Harris
tcc will limit output lines to 512 characters not including CRLF. In
addition, there needs to be space in the buffer for the trailing NUL
that fgets will append.

Without this change, xts-report will exit prematurely if it sees a
maximum length line.

Signed-off-by: Peter Harris phar...@opentext.com
---
 xts5/src/bin/reports/xts-report.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/xts5/src/bin/reports/xts-report.c 
b/xts5/src/bin/reports/xts-report.c
index 8e4b1e4..c1ca468 100644
--- a/xts5/src/bin/reports/xts-report.c
+++ b/xts5/src/bin/reports/xts-report.c
@@ -219,7 +219,7 @@ int fabort=0;
 /*message type*/
 intmtype;
 /*messages read in here*/
-char   linebuf[512];
+char   linebuf[515];
 /*pointer into where we are in the message*/
 char   *pline;
 
-- 
1.7.2.5

___
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] Don't count RetainPermanent clients twice in security.c

2012-11-23 Thread Peter Harris
On 2012-11-23 16:44, Peter Harris wrote:
 If a RetainPermanent client is subsequently killed by a KillClient
 request, the reference count is decremented twice. This can cause the
 server to prematurely kill other clients using the same Authorization.

Attached is a simple app to demonstrate the problem. The window should
stay up forever (or until manually killed), but after 60 seconds (the
default security Auth timeout) the window disappears.

In the real world, the activity isn't all done by the same application.
The RetainPermanent/KillClient cycle is usually different apps separated
in time fighting over the root window (eg. xsetroot killing a previous
xsetroot), which can cause unrelated windows to disappear seemingly at
random.

Peter Harris
-- 
   Open Text Connectivity Solutions Group
Peter Harrishttp://connectivity.opentext.com/
Research and DevelopmentPhone: +1 905 762 6001
phar...@opentext.comToll Free: 1 877 359 4866
#include stdio.h
#include stdlib.h
#include string.h
#include unistd.h
#include xcb/xcb.h
#include X11/Xlib.h
#include X11/extensions/security.h

#define CYCLES 24

static int get_auth(xcb_auth_info_t *auth)
{
Display *dpy;

dpy = XOpenDisplay(NULL);
if (!dpy) {
fprintf(stderr, Cannot open control display\n);
return 1;
}

int major, minor;
int rv = XSecurityQueryExtension(dpy, major, minor);
if (!rv) {
fprintf(stderr, Cannot query SECURITY extension\n);
return 1;
}

Xauth *in, *out;
in = XSecurityAllocXauth();
in-name = auth-name;
in-name_length = auth-namelen;
in-data = NULL;
in-data_length = 0;
XSecurityAuthorization id;
XSecurityAuthorizationAttributes attr = { .trust_level = 
XSecurityClientTrusted };
out = XSecurityGenerateAuthorization(dpy, in, XSecurityTrustLevel, attr, 
id);

XSecurityFreeXauth(in);

if (!out) {
fprintf(stderr, Cannot generate SECURITY cookie\n);
return 1;
}

auth-datalen = out-data_length;
auth-data = malloc(out-data_length);
memcpy(auth-data, out-data, auth-datalen);
XSecurityFreeXauth(out);

return 0;
}

static xcb_screen_t *root_visual(xcb_connection_t *c, int scnum)
{
const xcb_setup_t *s = xcb_get_setup(c);
if (scnum  xcb_setup_roots_length(s))
scnum = 0;
xcb_screen_iterator_t it = xcb_setup_roots_iterator(s);
for (int i=0; i  scnum; i++) {
xcb_screen_next(it);
}
return it.data;
}

int main(int argc, char *argv[])
{
xcb_auth_info_t auth = { .name = MIT-MAGIC-COOKIE-1 };
auth.namelen = strlen(auth.name);
int rv = get_auth(auth);
if (rv)
return rv;

int scnum;
xcb_connection_t *c = xcb_connect_to_display_with_auth_info(NULL, auth, 
scnum);
if (!c || xcb_connection_has_error(c)) {
fprintf(stderr, Cannot open dummy window connection\n);
return 1;
}

xcb_screen_t *root = root_visual(c, scnum);

xcb_window_t win = xcb_generate_id(c);
uint32_t list[] = { root-black_pixel };
xcb_create_window(c, XCB_COPY_FROM_PARENT, win, root-root,
100, 100, 100, 100, // x, y, w, h
0, XCB_WINDOW_CLASS_INPUT_OUTPUT, XCB_COPY_FROM_PARENT,
XCB_CW_BACK_PIXEL, list);
xcb_map_window(c, win);
xcb_flush(c);

printf(Doing RetainPermanent trick);
fflush(stdout);
xcb_window_t prev = 0;
for (int i=0; i  CYCLES; i++) {
xcb_connection_t *rp = xcb_connect_to_display_with_auth_info(NULL, 
auth, scnum);
if (!rp || xcb_connection_has_error(rp)) {
fprintf(stderr, Cannot open default display on iteration %d\n, i);
return 1;
}

if (prev)
xcb_kill_client(rp, prev);
prev = xcb_generate_id(rp);
xcb_create_window(rp, XCB_COPY_FROM_PARENT, prev, root-root,
10, 10, 10, 10, // x, y, w, h
0, XCB_WINDOW_CLASS_INPUT_OUTPUT, XCB_COPY_FROM_PARENT,
0, NULL);

xcb_set_close_down_mode(rp, XCB_CLOSE_DOWN_RETAIN_PERMANENT);
xcb_flush(rp);
usleep(10 * 1000);
xcb_disconnect(rp);

printf(.);
fflush(stdout);
usleep(100 * 1000); // make sure server noticed close
}

printf(\nWaiting to see what happens\n);
xcb_generic_event_t *ev;
while (ev = xcb_wait_for_event(c)) {
if (!ev || xcb_connection_has_error(c)) {
printf(Connection Error.\n);
return 2;
}
free(ev);
}

return 0;
}
___
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 test/xts] Don't add local paths when the server is remote

2012-08-15 Thread Peter Harris
XT_FONTPATH has to be a valid font path.

Also trim at least one remote path from XT_FONTPATH_GOOD, so it
isn't the same as XT_FONTPATH.

Signed-off-by: Peter Harris phar...@opentext.com
---

This works well in my setup. Is anyone relying on xtest font directories
being
in the same location on separate machines?

 xts5/bin/xts-config.in |   18 ++
 1 files changed, 18 insertions(+), 0 deletions(-)

diff --git a/xts5/bin/xts-config.in b/xts5/bin/xts-config.in
index 3d10c13..9e30b5f 100755
--- a/xts5/bin/xts-config.in
+++ b/xts5/bin/xts-config.in
@@ -97,6 +97,24 @@ BEGIN
$::vars{XT_DISPLAYHOST} = ;
}
}
+   else
+   {
+   # Not a local display; admin is responsible for placing
+   # xtest fonts on the font path before running xts-config.
+   $::vars{XT_FONTPATH} = $::vars{XT_FONTPATH_GOOD};
+   my @fp = split(/,/, $::vars{XT_FONTPATH});
+
+   # Remove xtest directory
+   my @fpg = grep(!/xtest/i, @fp);
+
+   # If xtest directory is not called xtest, remove the
+   # last directory in the path (as it's less likely to
+   # be the path containing default/cursor than the
+   # first directory in the path).
+   pop @fpg if (scalar(@fp) == scalar(@fpg));
+
+   $::vars{XT_FONTPATH_GOOD} = join(',', @fpg);
+   }
if($::vars{XT_SCREEN_COUNT}  1)
{
-- 
1.7.2.5

.

___
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 test/xts] Fix XSendEvent tests

2012-08-15 Thread Peter Harris
On 2012-08-03 17:17, Jeremy Huddleston Sequoia wrote:
 For the series of 3 patches:
 
 Reviewed-by: Jeremy Huddleston Sequoia jerem...@apple.com

Thanks. Pushed.

Peter Harris
-- 
   Open Text Connectivity Solutions Group
Peter Harrishttp://connectivity.opentext.com/
Research and DevelopmentPhone: +1 905 762 6001
phar...@opentext.comToll Free: 1 877 359 4866
___
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


  1   2   >