[PATCH app/sessreg] Use off_t instead of long to make largefile support work

2016-05-29 Thread Egbert Eich
From: Egbert Eich <e...@suse.de>

We already use the AC_SYS_LARGEFILE in configure.ac. This macro will only
work properly if the correct tyles are used: relace long by off_t when
calculating file offsets.

Signed-off-by: Egbert Eich <e...@suse.de>
Found-by: Herbert Kütz 
---
 sessreg.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/sessreg.c b/sessreg.c
index bdfe8f0..3efd8d9 100644
--- a/sessreg.c
+++ b/sessreg.c
@@ -327,7 +327,7 @@ main (int argc, char **argv)
 # else
utmp = open (utmp_file, O_RDWR);
if (utmp != -1) {
-   syserr ((int) lseek (utmp, (long) slot_number * sizeof 
(struct utmp), 0), "lseek");
+   syserr ((int) lseek (utmp, (off_t) slot_number * sizeof 
(struct utmp), 0), "lseek");
sysnerr (write (utmp, (char *) _entry, sizeof 
(utmp_entry))
== sizeof (utmp_entry), "write utmp 
entry");
close (utmp);
@@ -362,7 +362,7 @@ main (int argc, char **argv)
if (llog != -1) {
struct lastlog ll;
 
-   sysnerr (lseek(llog, (long) (pwd->pw_uid*sizeof(ll)), 0)
+   sysnerr (lseek(llog, (off_t) (pwd->pw_uid*sizeof(ll)), 
0)
!= -1, "seeking lastlog entry");
memset(, 0, sizeof(ll));
ll.ll_time = current_time;
@@ -628,7 +628,7 @@ findslot (char *line_name, char *host_name, int addp, int 
slot)
 * first, try to locate a previous entry for this display
 * also record location of a free slots in case we need a new one
 */
-   syserr ((int) lseek (utmp, (long) slot * sizeof (struct utmp), 0), 
"lseek");
+   syserr ((int) lseek (utmp, (off_t) slot * sizeof (struct utmp), 0), 
"lseek");
 
if (!host_name)
host_name = "";
-- 
2.7.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] Panning: Set panning state in xf86RandR12ScreenSetSize()

2016-01-15 Thread Egbert Eich
Right after verifying the panning area the per-crtc panning state should
be set. Since the panning state is global for all CRTCs, enable it if
enabled for one CRTC.
This fixes panning when set in the configuration.

Bugzilla: https://bugzilla.opensuse.org/show_bug.cgi?id=771521
Signed-off-by: Egbert Eich <e...@freedesktop.org>
---
 hw/xfree86/modes/xf86RandR12.c | 5 +
 1 file changed, 5 insertions(+)

diff --git a/hw/xfree86/modes/xf86RandR12.c b/hw/xfree86/modes/xf86RandR12.c
index eae7016..0c807bc 100644
--- a/hw/xfree86/modes/xf86RandR12.c
+++ b/hw/xfree86/modes/xf86RandR12.c
@@ -681,6 +681,7 @@ xf86RandR12ScreenSetSize(ScreenPtr pScreen,
 WindowPtr pRoot = pScreen->root;
 PixmapPtr pScrnPix;
 Bool ret = FALSE;
+Bool panning = FALSE;
 int c;
 
 if (randrp->virtualX == -1 || randrp->virtualY == -1) {
@@ -709,6 +710,9 @@ xf86RandR12ScreenSetSize(ScreenPtr pScreen,
 if (crtc->panningTrackingArea.y2 > crtc->panningTrackingArea.y1)
 crtc->panningTrackingArea.y2 += height - pScreen->height;
 xf86RandR13VerifyPanningArea(crtc, width, height);
+if (!panning) {
+panning = PANNING_ENABLED (crtc);
+}
 xf86RandR13Pan(crtc, randrp->pointerX, randrp->pointerY);
 }
 }
@@ -718,6 +722,7 @@ xf86RandR12ScreenSetSize(ScreenPtr pScreen,
 pScreen->height = pScrnPix->drawable.height = height;
 randrp->mmWidth = pScreen->mmWidth = mmWidth;
 randrp->mmHeight = pScreen->mmHeight = mmHeight;
+randrp->panning = panning;
 
 xf86SetViewport(pScreen, pScreen->width - 1, pScreen->height - 1);
 xf86SetViewport(pScreen, 0, 0);
-- 
2.7.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 xserver] busfault_sigaction: Only initialize pointer when matched

2016-01-11 Thread Egbert Eich
When looping over the registered map ranges, don't use
the variable holding the final result as loop variable -
It would always be initialized, on an empty list or
when we run past the end of the list when no entry was
found.

Signed-off-by: Egbert Eich <e...@freedesktop.org>
---
 os/busfault.c | 8 +---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/os/busfault.c b/os/busfault.c
index d4afa6d..53f02e6 100644
--- a/os/busfault.c
+++ b/os/busfault.c
@@ -98,13 +98,15 @@ static void
 busfault_sigaction(int sig, siginfo_t *info, void *param)
 {
 void*fault = info->si_addr;
-struct busfault *busfault = NULL;
+struct busfault *tmp, *busfault = NULL;
 void*new_addr;
 
 /* Locate the faulting address in our list of shared segments
  */
-xorg_list_for_each_entry(busfault, , list) {
-if ((char *) busfault->addr <= (char *) fault && (char *) fault < 
(char *) busfault->addr + busfault->size) {
+xorg_list_for_each_entry(tmp, , list) {
+if ((char *) tmp->addr <= (char *) fault &&
+(char *) fault < (char *) tmp->addr + tmp->size) {
+busfault = tmp;
 break;
 }
 }
-- 
2.5.3

___
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] kdrive/UnregisterFd: Fix off by one

2015-11-24 Thread Egbert Eich
From: Egbert Eich <e...@suse.de>

The number of FDs has been decremented already, therefore the
number contained the index of the top one that is to me moved down.

This problem was introduced by:
  commit 1110b71e360195aab040d835b54540ab558638c5
  Author: Chris Clayton <chris2...@googlemail.com>

kdrive: fix build error on gcc 4.8 for out-of-bounds array access

The reason for the warning was likely a confused compiler.
Hoping to reduce the confusion by moving the decrement behind the end
if the copy loop.

Signed-off-by: Egbert Eich <e...@suse.de>
---
 hw/kdrive/src/kinput.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/kdrive/src/kinput.c b/hw/kdrive/src/kinput.c
index 4bb9315..d5741f1 100644
--- a/hw/kdrive/src/kinput.c
+++ b/hw/kdrive/src/kinput.c
@@ -220,9 +220,9 @@ KdUnregisterFd(void *closure, int fd, Bool do_close)
 KdRemoveFd(kdInputFds[i].fd);
 if (do_close)
 close(kdInputFds[i].fd);
-kdNumInputFds--;
 for (j = i; j < (kdNumInputFds - 1); j++)
 kdInputFds[j] = kdInputFds[j + 1];
+kdNumInputFds--;
 break;
 }
 }
-- 
2.5.3

___
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] XDMCP: Fix format in XDMCP fatal error printing

2015-11-10 Thread Egbert Eich
From: Egbert Eich <e...@suse.de>

XdmcpFatal() calls FatalError() with '%*.*s' in the format string.
FatalError() uses the async safe versions of printf() which only
support a subset of the POSIX printf formats - they don't contain
the '*' width and precision specifiers.

Bugzilla: https://bugzilla.opensuse.org/show_bug.cgi?id=948713
Signed-off-by: Egbert Eich <e...@suse.de>
---
 os/xdmcp.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/os/xdmcp.c b/os/xdmcp.c
index 5bdcbe9..899e02e 100644
--- a/os/xdmcp.c
+++ b/os/xdmcp.c
@@ -1403,8 +1403,9 @@ _X_NORETURN
 static void
 XdmcpFatal(const char *type, ARRAY8Ptr status)
 {
-FatalError("XDMCP fatal error: %s %*.*s\n", type,
-   status->length, status->length, status->data);
+char *msg = strndup((char *)status->data, status->length);
+FatalError("XDMCP fatal error: %s %s\n", type, msg);
+/*NOTREACHED*/
 }
 
 static void
-- 
2.5.3

___
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 app/xdm] dm: Don't crash if argc == 0

2015-05-27 Thread Egbert Eich
From: Egbert Eich e...@suse.de

It is not guaranteed that argc  0. So make sure we don't crash
if no valid command line arguments are given.

Signed-off-by: Egbert Eich e...@suse.de
---
 xdm/dm.c | 47 +++
 1 file changed, 27 insertions(+), 20 deletions(-)

diff --git a/xdm/dm.c b/xdm/dm.c
index 603cc63..bdc830a 100644
--- a/xdm/dm.c
+++ b/xdm/dm.c
@@ -129,8 +129,13 @@ main (int argc, char **argv)
 if (((oldumask = umask(022))  002) == 002)
(void) umask (oldumask);
 #ifndef NOXDMTITLE
-Title = argv[0];
-TitleLen = (argv[argc - 1] + strlen(argv[argc - 1])) - Title;
+if (argc  0) {
+Title = argv[0];
+TitleLen = (argv[argc - 1] + strlen(argv[argc - 1])) - Title;
+} else {
+Title = NULL;
+TitleLen = 0;
+}
 #endif
 
 #ifdef USESECUREWARE
@@ -1074,25 +1079,27 @@ void SetTitle (char *name, ...)
 char   *s;
 va_listargs;
 
-va_start(args,name);
-*p++ = '-';
---left;
-s = name;
-while (s)
-{
-   while (*s  left  0)
-   {
-   *p++ = *s++;
-   left--;
-   }
-   s = va_arg (args, char *);
-}
-while (left  0)
-{
-   *p++ = ' ';
-   --left;
+if (p != NULL  left  0) {
+va_start(args,name);
+*p++ = '-';
+--left;
+s = name;
+while (s)
+{
+while (*s  left  0)
+{
+*p++ = *s++;
+left--;
+}
+s = va_arg (args, char *);
+}
+while (left  0)
+{
+*p++ = ' ';
+--left;
+}
+va_end(args);
 }
-va_end(args);
 # endif
 }
 #endif
-- 
1.8.4.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 app/xdm] Fix notorious execution scenario for xdm

2015-05-27 Thread Egbert Eich
I ran across a notorious scenario where xdm was executed
with argc was 0. This caused xdm to segfault.
While this scenario was most likely invalid, it unveiled
a rather minor issue in xdm's arument handling.
So here is a fix.

Egbert Eich (1):
  dm: Don't crash if argc == 0

 xdm/dm.c | 47 +++
 1 file changed, 27 insertions(+), 20 deletions(-)

-- 
1.8.4.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] RandR: Remove sensless checks for xf86RandR12Key

2015-03-31 Thread Egbert Eich
When xf86RandR12Key is not set we will not get to the places where
these tests are done as the functions in question are not called.
In most cases we would have crashed before these checks anyway.

Signed-off-by: Egbert Eich e...@freedesktop.org
---
 hw/xfree86/modes/xf86RandR12.c | 13 -
 1 file changed, 4 insertions(+), 9 deletions(-)

diff --git a/hw/xfree86/modes/xf86RandR12.c b/hw/xfree86/modes/xf86RandR12.c
index b1c306a..5c1ba71 100644
--- a/hw/xfree86/modes/xf86RandR12.c
+++ b/hw/xfree86/modes/xf86RandR12.c
@@ -683,11 +683,9 @@ xf86RandR12ScreenSetSize(ScreenPtr pScreen,
 Bool ret = FALSE;
 int c;
 
-if (xf86RandR12Key) {
-if (randrp-virtualX == -1 || randrp-virtualY == -1) {
-randrp-virtualX = pScrn-virtualX;
-randrp-virtualY = pScrn-virtualY;
-}
+if (randrp-virtualX == -1 || randrp-virtualY == -1) {
+randrp-virtualX = pScrn-virtualX;
+randrp-virtualY = pScrn-virtualY;
 }
 if (pRoot  pScrn-vtSema)
 (*pScrn-EnableDisableFBAccess) (pScrn, FALSE);
@@ -730,7 +728,7 @@ xf86RandR12ScreenSetSize(ScreenPtr pScreen,
 if (pRoot  pScrn-vtSema)
 (*pScrn-EnableDisableFBAccess) (pScrn, TRUE);
 #if RANDR_12_INTERFACE
-if (xf86RandR12Key  pScreen-root  ret)
+if (pScreen-root  ret)
 RRScreenSizeNotify(pScreen);
 #endif
 return ret;
@@ -826,9 +824,6 @@ xf86RandR12CreateScreenResources(ScreenPtr pScreen)
 xf86RandR12ScreenSetSize(pScreen, width, height, mmWidth, mmHeight);
 }
 
-if (xf86RandR12Key == NULL)
-return TRUE;
-
 if (randrp-virtualX == -1 || randrp-virtualY == -1) {
 randrp-virtualX = pScrn-virtualX;
 randrp-virtualY = pScrn-virtualY;
-- 
1.8.4.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 4/5] Xephyr: Fix screen image draw for the non-Glamor non-XHSM case

2015-03-31 Thread Egbert Eich
xcb_image_put() prints the entire image, therefore don't use an offset.

Signed-off-by: Egbert Eich e...@freedesktop.org
---
 hw/kdrive/ephyr/hostx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/kdrive/ephyr/hostx.c b/hw/kdrive/ephyr/hostx.c
index bdffba9..99b7716 100644
--- a/hw/kdrive/ephyr/hostx.c
+++ b/hw/kdrive/ephyr/hostx.c
@@ -1035,7 +1035,7 @@ hostx_paint_rect(KdScreenInfo *screen,
 }
 else {
 xcb_image_put(HostX.conn, scrpriv-win, HostX.gc, scrpriv-ximg,
-  dx, dy, 0);
+  0, 0, 0);
 }
 
 xcb_aux_sync(HostX.conn);
-- 
1.8.4.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 3/5] Xephyr: Fix compile when debugging is enabled

2015-03-31 Thread Egbert Eich
Signed-off-by: Egbert Eich e...@freedesktop.org
---
 hw/kdrive/ephyr/hostx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/kdrive/ephyr/hostx.c b/hw/kdrive/ephyr/hostx.c
index a516c20..bdffba9 100644
--- a/hw/kdrive/ephyr/hostx.c
+++ b/hw/kdrive/ephyr/hostx.c
@@ -798,7 +798,7 @@ hostx_screen_init(KdScreenInfo *screen,
 }
 
 EPHYR_DBG(host_screen=%p x=%d, y=%d, wxh=%dx%d, buffer_height=%d,
-  host_screen, x, y, width, height, buffer_height);
+  screen, x, y, width, height, buffer_height);
 
 if (scrpriv-ximg != NULL) {
 /* Free up the image data if previously used
-- 
1.8.4.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 0/5] Xephyr: Numerous issues

2015-03-31 Thread Egbert Eich
These are fixes for issues I ran into when looking into an
issue with Xephyr on IBM z-Series.
Actually only the last one is related to be-le. The others
however were unveiled by this special use case.

Egbert Eich (5):
  Xephyr: Don't crash when no command line argument is specified
  Xephyr: Print default server display number if none is specified
  Xephyr: Fix compile when debugging is enabled
  Xephyr: Fix screen image draw for the non-Glamor  non-XHSM case
  Xephyr: Fix broken image when endianess of client machine and
host-Xserver differ

 configure.ac|  4 +++-
 hw/kdrive/ephyr/ephyrinit.c | 11 +++
 hw/kdrive/ephyr/hostx.c | 16 
 hw/kdrive/fake/Makefile.am  |  1 +
 hw/kdrive/fbdev/Makefile.am |  1 +
 5 files changed, 24 insertions(+), 9 deletions(-)

-- 
1.8.4.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 5/5] Xephyr: Fix broken image when endianess of client machine and host-Xserver differ

2015-03-31 Thread Egbert Eich
The image is created in the native byte order of the machine Xephyr is
rendered on however drawn in the image byte order of the Xephyr server.
Correct byte order in the xcb_image_t structure and convert to native
before updating the window.
If depths of Xephyr and host server differ this is already taken care of
by the depth conversion routine.
It is a terrible wase to always convert and transmit the entire image
no matter of the size of the damaged area. One should probably use
sub-images here. For now we leave this as an exercise.

Signed-off-by: Egbert Eich e...@freedesktop.org
---
 hw/kdrive/ephyr/hostx.c | 12 ++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/hw/kdrive/ephyr/hostx.c b/hw/kdrive/ephyr/hostx.c
index 99b7716..2c8f743 100644
--- a/hw/kdrive/ephyr/hostx.c
+++ b/hw/kdrive/ephyr/hostx.c
@@ -866,6 +866,11 @@ hostx_screen_init(KdScreenInfo *screen,
 ~0,
 NULL);
 
+/* Match server byte order so that the image can be converted to
+ * the native byte order by xcb_image_put() before drawing */
+if (host_depth_matches_server(scrpriv))
+scrpriv-ximg-byte_order = IMAGE_BYTE_ORDER;
+
 scrpriv-ximg-data =
 malloc(scrpriv-ximg-stride * buffer_height);
 }
@@ -1034,8 +1039,11 @@ hostx_paint_rect(KdScreenInfo *screen,
   sx, sy, dx, dy, width, height, FALSE);
 }
 else {
-xcb_image_put(HostX.conn, scrpriv-win, HostX.gc, scrpriv-ximg,
-  0, 0, 0);
+/* This is slow and could be done better */
+xcb_image_t *img = xcb_image_native (HostX.conn, scrpriv-ximg, 1);
+xcb_image_put(HostX.conn, scrpriv-win, HostX.gc, img, 0, 0, 0);
+if (scrpriv-ximg != img)
+xcb_image_destroy(img);
 }
 
 xcb_aux_sync(HostX.conn);
-- 
1.8.4.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 2/5] Xephyr: Print default server display number if none is specified

2015-03-31 Thread Egbert Eich
Signed-off-by: Egbert Eich e...@freedesktop.org
---
 hw/kdrive/ephyr/hostx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/kdrive/ephyr/hostx.c b/hw/kdrive/ephyr/hostx.c
index c67ff60..a516c20 100644
--- a/hw/kdrive/ephyr/hostx.c
+++ b/hw/kdrive/ephyr/hostx.c
@@ -177,7 +177,7 @@ hostx_set_win_title(KdScreenInfo *screen, const char 
*extra_text)
 
 memset(buf, 0, BUF_LEN + 1);
 snprintf(buf, BUF_LEN, Xephyr on %s.%d %s,
- HostX.server_dpy_name,
+ HostX.server_dpy_name ? HostX.server_dpy_name : :0,
  scrpriv-mynum, (extra_text != NULL) ? extra_text : );
 
 xcb_icccm_set_wm_name(HostX.conn,
-- 
1.8.4.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 1/5] Xephyr: Don't crash when no command line argument is specified

2015-03-31 Thread Egbert Eich
From: Egbert Eich e...@suse.de

The DDX specific command line parsing function only gets called
if command line arguments are present. Therefore this function
is not suitable to initialize mandatory global variables.
Replace main() instead.

Signed-off-by: Egbert Eich e...@freedesktop.org
---
 configure.ac|  4 +++-
 hw/kdrive/ephyr/ephyrinit.c | 11 +++
 hw/kdrive/fake/Makefile.am  |  1 +
 hw/kdrive/fbdev/Makefile.am |  1 +
 4 files changed, 12 insertions(+), 5 deletions(-)

diff --git a/configure.ac b/configure.ac
index 280c369..fe79422 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2423,7 +2423,8 @@ if test $KDRIVE = yes; then
fi
;;
 esac
-KDRIVE_LOCAL_LIBS=$MAIN_LIB $DIX_LIB $KDRIVE_LIB
+KDRIVE_MAIN_LIB=$MAIN_LIB
+KDRIVE_LOCAL_LIBS=$DIX_LIB $KDRIVE_LIB
 KDRIVE_LOCAL_LIBS=$KDRIVE_LOCAL_LIBS $FB_LIB $MI_LIB $KDRIVE_PURE_LIBS
 KDRIVE_LOCAL_LIBS=$KDRIVE_LOCAL_LIBS $KDRIVE_OS_LIB
 KDRIVE_LIBS=$KDRIVE_LOCAL_LIBS $XSERVER_SYS_LIBS $GLX_SYS_LIBS 
$DLOPEN_LIBS $TSLIB_LIBS
@@ -2435,6 +2436,7 @@ AC_SUBST([KDRIVE_INCS])
 AC_SUBST([KDRIVE_PURE_INCS])
 AC_SUBST([KDRIVE_CFLAGS])
 AC_SUBST([KDRIVE_PURE_LIBS])
+AC_SUBST([KDRIVE_MAIN_LIB])
 AC_SUBST([KDRIVE_LOCAL_LIBS])
 AC_SUBST([KDRIVE_LIBS])
 AM_CONDITIONAL(KDRIVELINUX, [test x$KDRIVELINUX = xyes])
diff --git a/hw/kdrive/ephyr/ephyrinit.c b/hw/kdrive/ephyr/ephyrinit.c
index 897aa19..8fbaf1d 100644
--- a/hw/kdrive/ephyr/ephyrinit.c
+++ b/hw/kdrive/ephyr/ephyrinit.c
@@ -52,6 +52,13 @@ void processScreenOrOutputArg(const char *screen_size, const 
char *output, char
 void processOutputArg(const char *output, char *parent_id);
 void processScreenArg(const char *screen_size, char *parent_id);
 
+int
+main(int argc, char *argv[], char *envp[])
+{
+hostx_use_resname(basename(argv[0]), 0);
+return dix_main(argc, argv, envp);
+}
+
 void
 InitCard(char *name)
 {
@@ -209,10 +216,6 @@ ddxProcessArgument(int argc, char **argv, int i)
 
 EPHYR_DBG(mark argv[%d]='%s', i, argv[i]);
 
-if (i == 1) {
-hostx_use_resname(basename(argv[0]), 0);
-}
-
 if (!strcmp(argv[i], -parent)) {
 if (i + 1  argc) {
 int j;
diff --git a/hw/kdrive/fake/Makefile.am b/hw/kdrive/fake/Makefile.am
index 14c99c3..d28bd27 100644
--- a/hw/kdrive/fake/Makefile.am
+++ b/hw/kdrive/fake/Makefile.am
@@ -18,6 +18,7 @@ Xfake_SOURCES = \
 
 Xfake_LDADD =  \
libfake.la  \
+   @KDRIVE_MAIN_LIB@   \
@KDRIVE_LIBS@
 
 Xfake_LDFLAGS = $(LD_EXPORT_SYMBOLS_FLAG)
diff --git a/hw/kdrive/fbdev/Makefile.am b/hw/kdrive/fbdev/Makefile.am
index 7e8ba02..d550c13 100644
--- a/hw/kdrive/fbdev/Makefile.am
+++ b/hw/kdrive/fbdev/Makefile.am
@@ -16,6 +16,7 @@ Xfbdev_SOURCES = \
 
 Xfbdev_LDADD = \
libfbdev.la \
+   @KDRIVE_MAIN_LIB@   \
@KDRIVE_LIBS@
 
 Xfbdev_DEPENDENCIES =  \
-- 
1.8.4.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] sdksyms.sh: Make sdksyms.sh work with gcc5.

2015-03-03 Thread Egbert Eich
Hans asked for other suggestions to fix the gcc5 breakage 
of sdksyms.sh. So here is my take on it.

Egbert Eich (1):
  symbols: Fix sdksyms.sh to cope with gcc5

 hw/xfree86/sdksyms.sh | 14 +-
 1 file changed, 13 insertions(+), 1 deletion(-)

-- 
1.8.4.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] symbols: Fix sdksyms.sh to cope with gcc5

2015-03-03 Thread Egbert Eich
Gcc5 adds additional lines stating line numbers before and
after __attribute__() which need to be skipped.

Signed-off-by: Egbert Eich e...@freedesktop.org
---
 hw/xfree86/sdksyms.sh | 14 +-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/hw/xfree86/sdksyms.sh b/hw/xfree86/sdksyms.sh
index 2305073..05ac410 100755
--- a/hw/xfree86/sdksyms.sh
+++ b/hw/xfree86/sdksyms.sh
@@ -350,13 +350,25 @@ BEGIN {
 if (sdk) {
n = 3;
 
+# skip line numbers GCC 5 adds before __attribute__
+while ($n ==  || $0 ~ /^# [0-9]+ /) {
+   getline;
+   n = 1;
+}
+
# skip attribute, if any
while ($n ~ /^(__attribute__|__global)/ ||
# skip modifiers, if any
$n ~ /^\*?(unsigned|const|volatile|struct|_X_EXPORT)$/ ||
# skip pointer
-   $n ~ /^[a-zA-Z0-9_]*\*$/)
+   $n ~ /^[a-zA-Z0-9_]*\*$/) {
n++;
+# skip line numbers GCC 5 adds after __attribute__
+while ($n ==  || $0 ~ /^# [0-9]+ /) {
+   getline;
+   n = 1;
+}
+}
 
# type specifier may not be set, as in
#   extern _X_EXPORT unsigned name(...)
-- 
1.8.4.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

Nomination Period for the X.Org Foundation BoD Election ENDS

2015-02-12 Thread Egbert Eich


Just as a reminder, the nomination period for the X.Org Foundation
Board of Directors election ends on 

 Monday, Feb 16 2015, 23:59 UTC (12:59 PM UTC).

If you would like to nominate yourself, please send email to
electi...@x.org.
Please note that to be a candidate in this election your have
to be a member. If you have not done so, please register or 
renew your membership by above time by visiting:
   https://members.x.org

Please note, that all memberships have been expired before
the initial election announcement went out.
Therefore, if you want to participate in the election as a
voter, please register or renew your membership!

For further information please visit:
http://www.x.org/wiki/BoardOfDirectors/Elections/2015/

Cheers,
Egbert.
___
xorg@lists.x.org: X.Org support
Archives: http://lists.freedesktop.org/archives/xorg
Info: http://lists.x.org/mailman/listinfo/xorg
Your subscription address: %(user_address)s

Nomination Period for the X.Org Foundation BoD Election ENDS

2015-02-12 Thread Egbert Eich


Just as a reminder, the nomination period for the X.Org Foundation
Board of Directors election ends on 

 Monday, Feb 16 2015, 23:59 UTC (12:59 PM UTC).

If you would like to nominate yourself, please send email to
electi...@x.org.
Please note that to be a candidate in this election your have
to be a member. If you have not done so, please register or 
renew your membership by above time by visiting:
   https://members.x.org

Please note, that all memberships have been expired before
the initial election announcement went out.
Therefore, if you want to participate in the election as a
voter, please register or renew your membership!

For further information please visit:
http://www.x.org/wiki/BoardOfDirectors/Elections/2015/

Cheers,
Egbert.
___
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

2015 Elections to the X.Org Board of Directors and Approval to Changes of the X.Org By Laws

2015-01-26 Thread Egbert Eich
The X.Org Foundation is holding elections for

   - The Board of Directors
   - Adoption of changes to the By Laws.

Election Schedule
=

QA Session for the
  By Law changes start:Jan 26
Nomination period Start:   Jan 26  00:00 UTC
Nomination period End: Feb 15   23:59 UTC  (3 weeks)
Deadline of X.Org
  membership application
  renewal: Feb 16   23:59 UTC
Publication of Candidates
start of Candiate QA: Feb 17  (3 weeks)
Election Start:Mar 09  00:00 UTC
Election End:  Mar 22  23:59 UTC   (2 weeks)

==
| PLEASE NOTE:
| The memberships of all X.Org Members have been expired!
| To participate in this election you MUST renew your membership
| by the deadline mentioned above!
| Please go to http://members.x.org/ for membership application or renewal.
==

You will find updated info on the elections at:

http://www.x.org/wiki/BoardOfDirectors/Elections/2015/

Board Election
==

The terms of the following Board Members will end this year:

   Alan Coopersmith,
   Martin Peres,
   Peter Hutterer,
   Stuart Kreitmann

There are 4 seats on the X.Org Board of Directors up for reelection.

The Elections overview page http://www.x.org/wiki/BoardOfDirectors/Elections/
describes the voting methods and process.

The election process starts with a 2 week nomination period.
If you would like to nominate yourself please send email to the election
committee electi...@x.org, giving your
- name
- current professional affiliation
- a statement of contribution to X.Org or related technologies
- a personal statement


To vote or to be elected to the Board you needed to be a Member of the
X.Org Foundation.
To be a Member of the X.Org Foundation you need to apply or renew your
membership until the end of the nomination period.

Changes to the By Laws of the X.Org Foundation
==

The X.Org Foundation plans to join SPI (Software in Public Interest).
SPI has given it's formal approval and invited the X.Org Foundation
to join.
In order to join the Members of the X.Org Foundation need to approve
this and need to approve a change to the By Laws of the X.Org Foundation.

This vote of the members on joining SPI and on changing the By Laws will
take place alongside the election to the BoD.

The formal deadline for joining SPI is April 9, 2015.

There will be a QA session on the SPI membership and the new By Laws
starting with the nomination period of the candidates.
(Please also see separate announcement).

QA
===

After the nomination period members have the chance to meet the candidates
and ask questions on the members mailing list members _AT_ x.org.

The QA session regarding the By Law changes and the joining SPI starts
immediately also on the members mailing list. A QA wiki page will also
be added.


Regards,
Egbert.
___
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

2015 Elections to the X.Org Board of Directors and Approval to Changes of the X.Org By Laws

2015-01-26 Thread Egbert Eich
The X.Org Foundation is holding elections for

   - The Board of Directors
   - Adoption of changes to the By Laws.

Election Schedule
=

QA Session for the
  By Law changes start:Jan 26
Nomination period Start:   Jan 26  00:00 UTC
Nomination period End: Feb 15   23:59 UTC  (3 weeks)
Deadline of X.Org
  membership application
  renewal: Feb 16   23:59 UTC
Publication of Candidates
start of Candiate QA: Feb 17  (3 weeks)
Election Start:Mar 09  00:00 UTC
Election End:  Mar 22  23:59 UTC   (2 weeks)

==
| PLEASE NOTE:
| The memberships of all X.Org Members have been expired!
| To participate in this election you MUST renew your membership
| by the deadline mentioned above!
| Please go to http://members.x.org/ for membership application or renewal.
==

You will find updated info on the elections at:

http://www.x.org/wiki/BoardOfDirectors/Elections/2015/

Board Election
==

The terms of the following Board Members will end this year:

   Alan Coopersmith,
   Martin Peres,
   Peter Hutterer,
   Stuart Kreitmann

There are 4 seats on the X.Org Board of Directors up for reelection.

The Elections overview page http://www.x.org/wiki/BoardOfDirectors/Elections/
describes the voting methods and process.

The election process starts with a 2 week nomination period.
If you would like to nominate yourself please send email to the election
committee electi...@x.org, giving your
- name
- current professional affiliation
- a statement of contribution to X.Org or related technologies
- a personal statement


To vote or to be elected to the Board you needed to be a Member of the
X.Org Foundation.
To be a Member of the X.Org Foundation you need to apply or renew your
membership until the end of the nomination period.

Changes to the By Laws of the X.Org Foundation
==

The X.Org Foundation plans to join SPI (Software in Public Interest).
SPI has given it's formal approval and invited the X.Org Foundation
to join.
In order to join the Members of the X.Org Foundation need to approve
this and need to approve a change to the By Laws of the X.Org Foundation.

This vote of the members on joining SPI and on changing the By Laws will
take place alongside the election to the BoD.

The formal deadline for joining SPI is April 9, 2015.

There will be a QA session on the SPI membership and the new By Laws
starting with the nomination period of the candidates.
(Please also see separate announcement).

QA
===

After the nomination period members have the chance to meet the candidates
and ask questions on the members mailing list members _AT_ x.org.

The QA session regarding the By Law changes and the joining SPI starts
immediately also on the members mailing list. A QA wiki page will also
be added.


Regards,
Egbert.
___
xorg@lists.x.org: X.Org support
Archives: http://lists.freedesktop.org/archives/xorg
Info: http://lists.x.org/mailman/listinfo/xorg
Your subscription address: %(user_address)s

Re: [PATCH driver/intel] Allow copy_front() to fail and clean up gracefully if it does

2014-09-26 Thread Egbert Eich

Hi Chris,

Chris Wilson writes:
  
  Also realised that even this should be fixed up as a last resort by
  falling back to the shadow CRTC allocation. That band-aid should be
  working again.
  
  Hopefully
  
  commit 9f7c1a4c4f2a6352263c36e75a984ed4095adbc0
  Author: Chris Wilson ch...@chris-wilson.co.uk
  Date:   Thu Sep 25 16:29:14 2014 +0100
  
  sna: Check for scanout pitch restrictions on linear GPU bo
  
  When converting a linear cached CPU bo into an uncached GPU bo, we must
  be careful to adhere to the scanout restrictions if they apply for this
  transfer or this Pixmap.
  
  Reported-by: Egbert Eich e...@suse.com
  Signed-off-by: Chris Wilson ch...@chris-wilson.co.uk
  
  catches all the cases where we need to check the alignment on the pitch
  before changing the cache level. If not, it now explicitly converts the
  bo before making the framebuffer.

thanks for looking into this! I can confirm that the patch works.

I took a brief look into why the server terminates at server reset
when the the patch which fixes the tiling isn't applied. 
This happens in sna_create_screen_resources() when sna_pixmap_force_to_gpu() 
fails and the entire creatSecreenResources fails.
Since sna_pixmap_force_to_gpu() is allowed to fail at other places
as alternatives will be used I looked who might need this call. 
The only thing I found was sna_copy_fbcon() which will fail in 
assert(priv  priv-gpu_bo). sna_copy_fbcon() is however not vital:
The fix below made this work for me.
This is a simple hack, one could also use a bo to a supported front 
buffer instead of insisiting a GPU bo.

Later on use_shadow() should take care of a the failure of 
sna_pixmap_force_to_gpu() in sna_create_screen_resources(). 

Or can you think of another reason why this is needed so early?

Cheers,
Egbert.

From: Egbert Eich e...@freedesktop.org
Date: Fri, 26 Sep 2014 17:57:55 +0200
Subject: [PATCH driver/intel] In sna_create_screen_resources() don't make
 sna_pixmap_force_to_gpu() mandatory

Signed-off-by: Egbert Eich e...@freedesktop.org
---
 src/sna/sna_display.c |  3 ++-
 src/sna/sna_driver.c  | 11 +--
 2 files changed, 3 insertions(+), 11 deletions(-)

diff --git a/src/sna/sna_display.c b/src/sna/sna_display.c
index 0aa7557..a55bdb9 100644
--- a/src/sna/sna_display.c
+++ b/src/sna/sna_display.c
@@ -1625,7 +1625,8 @@ void sna_copy_fbcon(struct sna *sna)
assert((sna-flags  SNA_IS_HOSTED) == 0);
 
priv = sna_pixmap(sna-front);
-   assert(priv  priv-gpu_bo);
+   if (!priv || !priv-gpu_bo)
+   return;
 
/* Scan the connectors for a framebuffer and assume that is the fbcon */
VG_CLEAR(fbcon);
diff --git a/src/sna/sna_driver.c b/src/sna/sna_driver.c
index 7eed214..fe2a6ec 100644
--- a/src/sna/sna_driver.c
+++ b/src/sna/sna_driver.c
@@ -248,16 +248,7 @@ static Bool sna_create_screen_resources(ScreenPtr screen)
return FALSE;
}
 
-   if (!sna_pixmap_force_to_gpu(new_front, MOVE_READ)) {
-   xf86DrvMsg(screen-myNum, X_ERROR,
-  [intel] Failed to allocate video resources for 
front buffer %dx%d at depth %d\n,
-  screen-width,
-  screen-height,
-  screen-rootDepth);
-   screen-DestroyPixmap(new_front);
-   return FALSE;
-   }
-
+   sna_pixmap_force_to_gpu(new_front, MOVE_READ);
screen-SetScreenPixmap(new_front);
assert(screen-GetScreenPixmap(screen) == new_front);
assert(sna-front == new_front);
-- 
1.8.4.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 driver/intel] Allow copy_front() to fail and clean up gracefully if it does

2014-09-25 Thread Egbert Eich
Chris Wilson writes:
  On Wed, Sep 24, 2014 at 01:23:26PM +0200, Egbert Eich wrote:
   Chris Wilson writes:
 On Wed, Sep 24, 2014 at 12:34:29PM +0200, Egbert Eich wrote:
  
  For panning one needs to be able to draw into the screen pixmap 
   outside 
  of the area exposed by the crtc.
 
 Note that the screen pixmap still exists and is drawn into by the
 clients. What should happen with the panning is that the CRTC is updated
 through set_mode_major which invalidates the new CRTC location in the 
   big
 screen Pixmap and the contents copied during the next shadow update.
 
 That's the theory at least...
   
   Ok, so this isn't working. I will look into this as it's easy for me
   to trigger this situation.
  
  Are you using an OpenGL compositor? So far bare X, awesome, dwm,
  enlightenment and kwin/xrender behave correctly. But gnome-shell and
  kwin/gl are broken, which is not an issue with the ddx.
  -Chris

With that patch from me which you accepted, yes, but even without it, 
a fallback should be used but this doesn't work.
I found this:
In sna_pixmap_move_to_gpu() you move a CPU bo to the GPU if available
and feasable. Shouldn't you check for the proper pitch alignment as well?
Without it, use_shadow() fails in sna_crtc_attach(), thus fb_get() is
called for a bo that was previously created for the cpu which may not
be what is expected by the GPU.
Quickly hacking in a test for 64bit alignment (which isn't correct for
all use cases) fixes the panning issue for me.


Cheers,
Egbert.
___
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 driver/intel] Allow copy_front() to fail and clean up gracefully if it does

2014-09-24 Thread Egbert Eich
From: Egbert Eich e...@suse.de

copy_front() calls sna_pixmap_force_to_gpu() which may fail. If we pretend
to have been successful and continue the caller sna_mode_resize() may finish
successfully pretending a mode change has succeeded which might leave a mode
behind which is unusable.
This patch makes copy_front() fail if sna_pixmap_force_to_gpu() fails which
allows sna_mode_resize() to detect this situation, clean up gracefully,
ie. destroy the newly created front pixmap and fail itself. This way an
application requesting such a mode will receive a proper XError while the
previous mode will be restored leaving the user with a usable mode.

Signed-off-by: Egbert Eich e...@freedesktop.org
---
 src/sna/sna_display.c | 15 ++-
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/src/sna/sna_display.c b/src/sna/sna_display.c
index 2a98fb9..25873c4 100644
--- a/src/sna/sna_display.c
+++ b/src/sna/sna_display.c
@@ -4044,22 +4044,22 @@ void sna_mode_discover(struct sna *sna)
}
 }
 
-static void copy_front(struct sna *sna, PixmapPtr old, PixmapPtr new)
+static Bool copy_front(struct sna *sna, PixmapPtr old, PixmapPtr new)
 {
struct sna_pixmap *old_priv, *new_priv;
 
DBG((%s\n, __FUNCTION__));
 
if (wedged(sna))
-   return;
+   return FALSE;
 
old_priv = sna_pixmap_force_to_gpu(old, MOVE_READ);
if (!old_priv)
-   return;
+   return FALSE;
 
new_priv = sna_pixmap_force_to_gpu(new, MOVE_WRITE);
if (!new_priv)
-   return;
+   return FALSE;
 
if (old_priv-clear) {
(void)sna-render.fill_one(sna, new, new_priv-gpu_bo,
@@ -4137,6 +4137,8 @@ static void copy_front(struct sna *sna, PixmapPtr old, 
PixmapPtr new)
}
 
sna_damage_all(new_priv-gpu_damage, new);
+
+   return TRUE;
 }
 
 static Bool
@@ -4182,7 +4184,10 @@ sna_mode_resize(ScrnInfoPtr scrn, int width, int height)
assert(sna-mode.shadow_damage == NULL);
assert(sna-mode.shadow == NULL);
 
-   copy_front(sna, sna-front, new_front);
+   if (!copy_front(sna, sna-front, new_front)) {
+   screen-DestroyPixmap(new_front);
+   return FALSE;
+   }
 
screen-SetScreenPixmap(new_front);
assert(screen-GetScreenPixmap(screen) == new_front);
-- 
1.8.4.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 driver/intel] In sna_pixmap_alloc_gpu() process user selected tiling thru kgem_choose_tiling()

2014-09-24 Thread Egbert Eich
From: Egbert Eich e...@suse.de

In sna_pixmap_alloc_gpu() a different than the default tiling may be picked
by a usage hint. Before passing the tiling to kgem_create_2d() fix it up
by calling kgem_choose_tiling(). This avoids kgem_surface_size() not being able
to find a surface size for the tiling value.

Signed-off-by: Egbert Eich e...@freedesktop.org
---
 src/sna/sna_accel.c | 5 +
 1 file changed, 5 insertions(+)

diff --git a/src/sna/sna_accel.c b/src/sna/sna_accel.c
index ab43831..16726ee 100644
--- a/src/sna/sna_accel.c
+++ b/src/sna/sna_accel.c
@@ -1618,6 +1618,11 @@ static bool sna_pixmap_alloc_gpu(struct sna *sna,
if (pixmap-usage_hint == SNA_CREATE_FB  (sna-flags  SNA_LINEAR_FB) 
== 0) {
flags |= CREATE_SCANOUT;
tiling = -I915_TILING_X;
+   tiling = kgem_choose_tiling(sna-kgem,
+   tiling,
+   pixmap-drawable.width,
+   pixmap-drawable.height,
+   pixmap-drawable.bitsPerPixel);
} else
tiling = sna_pixmap_default_tiling(sna, pixmap);
 
-- 
1.8.4.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 driver/intel] Allow copy_front() to fail and clean up gracefully if it does

2014-09-24 Thread Egbert Eich
Chris Wilson writes:
  On Wed, Sep 24, 2014 at 08:17:59AM +0200, Egbert Eich wrote:
   From: Egbert Eich e...@suse.de
   
   copy_front() calls sna_pixmap_force_to_gpu() which may fail. If we pretend
   to have been successful and continue the caller sna_mode_resize() may 
   finish
   successfully pretending a mode change has succeeded which might leave a 
   mode
   behind which is unusable.
  
  Show me the actual bug. If the copy fails, the new framebuffer contents
  are just left uninitialised (normal X behaviour) until they get
  immediately redrawn. The subsequent modeset does not depend upon the screen
  Pixmap fitting into GPU memory, but that it can fit individual CRTC into
  the GTT.

Then the mode should have failed somewhere else maybe.

The underlying issue of the problem was fixed by the other
patch I have sent today. This problem caused kgem_surface_size() 
to return NULL and thus kgem_create_2d() and ulitmately 
sna_pixmap_force_to_gpu() to fail.
With the the other fix applied kgem_surface_size() doesn't
fail any longer for my test case - still it may fail for other 
reasons.

Here is the test scenario:

Pineview Chipset, start a bare X server (without the other patch applied
to the driver), start xterm on it.

On my system 'xrandr -q' gives:

Screen 0: minimum 8 x 8, current 1366 x 768, maximum 32767 x 32767
LVDS1 connected 1366x768+0+0 (normal left inverted right x axis y axis) 222mm x 
125mm
   1366x768   60.0*+
   1024x768   60.0  
   800x60060.3 56.2  
   640x48059.9  
VGA1 disconnected (normal left inverted right x axis y axis)
VIRTUAL1 disconnected (normal left inverted right x axis y axis)

now run 'xrandr --output LVDS1 --panning 3048x768' (or whatever
other output it uses).

Without the other patch applied kgem_surface_size() fails, without
*both* patches applied the mode set succeeds and 'xandr -q' now gives:

Screen 0: minimum 8 x 8, current 3048 x 768, maximum 32767 x 32767
LVDS1 connected 3048x768+0+0 (normal left inverted right x axis y axis) 222mm x 
125mm panning 3048x768+0+0
   1366x768   60.0*+
   1024x768   60.0  
   800x60060.3 56.2  
   640x48059.9  
VGA1 disconnected (normal left inverted right x axis y axis)
VIRTUAL1 disconnected (normal left inverted right x axis y axis)

Observation 1:
Screen doesn't pan: when moving the cursor to the right edge,
screen and cursor become out of sync, screen content doesnt get
update ie. starting a new application (like xclock) succeeds but
nothing is drawn).

Observation 2:
Terminating xterm makes the server reset which fails with

intel(0): [intel] Failed to allocate video resources for front buffer 3048x768 
at depth 24

in sna_create_screen_resources() due to sna_pixmap_force_to_gpu()
failing. The reason for the failure is the same as described above.

As I said: these failures go away with the other patch I posted today
and which you OKed and the code in this patch is no longer triggered.
Still there are other conditions under which kgem_surface_size() may 
return 0. 
For panning one needs to be able to draw into the screen pixmap outside 
of the area exposed by the crtc.

Cheers,
Egbert.
___
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 driver/intel] Allow copy_front() to fail and clean up gracefully if it does

2014-09-24 Thread Egbert Eich
Chris Wilson writes:
  On Wed, Sep 24, 2014 at 12:34:29PM +0200, Egbert Eich wrote:
   
   For panning one needs to be able to draw into the screen pixmap outside 
   of the area exposed by the crtc.
  
  Note that the screen pixmap still exists and is drawn into by the
  clients. What should happen with the panning is that the CRTC is updated
  through set_mode_major which invalidates the new CRTC location in the big
  screen Pixmap and the contents copied during the next shadow update.
  
  That's the theory at least...

Ok, so this isn't working. I will look into this as it's easy for me
to trigger this situation.
But this still doesn't address the failing sna_create_screen_resources().

Cheers,
Egbert.
___
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 driver/intel] Allow copy_front() to fail and clean up gracefully if it does

2014-09-24 Thread Egbert Eich
Chris Wilson writes:
  On Wed, Sep 24, 2014 at 01:23:26PM +0200, Egbert Eich wrote:
   Chris Wilson writes:
 On Wed, Sep 24, 2014 at 12:34:29PM +0200, Egbert Eich wrote:
  
  For panning one needs to be able to draw into the screen pixmap 
   outside 
  of the area exposed by the crtc.
 
 Note that the screen pixmap still exists and is drawn into by the
 clients. What should happen with the panning is that the CRTC is updated
 through set_mode_major which invalidates the new CRTC location in the 
   big
 screen Pixmap and the contents copied during the next shadow update.
 
 That's the theory at least...
   
   Ok, so this isn't working. I will look into this as it's easy for me
   to trigger this situation.
  
  Are you using an OpenGL compositor? So far bare X, awesome, dwm,
  enlightenment and kwin/xrender behave correctly. But gnome-shell and
  kwin/gl are broken, which is not an issue with the ddx.

No, as I wrote earlier I'm using bare X. I'm not using the latest driver bits
however. Will try and do this and get back to you.

Cheers,
Egbert.

___
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] BellProc: Send bell event on core protocol bell when requested

2014-08-04 Thread Egbert Eich
XKB allows to override the BellProc() ringing the 'keyboard bell':
instead an event is sent to an X client which can perform an
appropriate action.
In most cases this effectively prevents the core protocol bell
from ringing: if no BellProc() is set for the device, no attempt
is made to ring a bell.
This patch ensures that an XKB bell event is sent also when
the core protocol bell is rung end thus an appropriate action
can be taken by a client.

Signed-off-by: Egbert Eich e...@freedesktop.org
---
 dix/devices.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/dix/devices.c b/dix/devices.c
index 7f079ff..5d26fae 100644
--- a/dix/devices.c
+++ b/dix/devices.c
@@ -2257,7 +2257,7 @@ ProcBell(ClientPtr client)
 for (dev = inputInfo.devices; dev; dev = dev-next) {
 if ((dev == keybd ||
  (!IsMaster(dev)  GetMaster(dev, MASTER_KEYBOARD) == keybd)) 
-dev-kbdfeed  dev-kbdfeed-BellProc) {
+((dev-kbdfeed  dev-kbdfeed-BellProc) || dev-xkb_interest)) {
 
 rc = XaceHook(XACE_DEVICE_ACCESS, client, dev, DixBellAccess);
 if (rc != Success)
-- 
1.8.4.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: Xorg copyright infrigement

2014-04-28 Thread Egbert Eich
On Sun, Apr 27, 2014 at 12:28:46PM +0200, Mateusz Jończyk wrote:
  
  The xls however, felt as if it was meant as a reference implementation, 
  aimed at
  improving the proliferation of CVT. If graham does get contacted, i think he
  would agree.
 I don't have any doubts that the Authors of the XLS would agree to inclusion 
 of its
 derivative works in XOrg and other programs.
 Until that happens, however, we cannot rely on it.
  
  Now, before we do get access to those documents, how are you intending to
  circumvent this claimed copyright infringement without infringing yourself 
  under
  your very strict rules?
 We could just rewrite it using the Chinese wall principle:
 http://en.wikipedia.org/wiki/Clean_room_design

Gentlemen - please get out of this rat hole!

The implemenation in the X.Org repo - from which other implemenations 
were derived - is not a copy of the code in the spread sheet and
therefore does not infringe on any copyright held by the author of it: 
the spread sheet is in XLS, the X.Org implemenation is C code:
The *only* thing in common with the spread sheet is the *algorithm*.

This algorithm however is a published and publically available VESA 
standard.

One can obtain VESA standards either
- by downloading them if they are available for free download (some are) 
- by purchasing them
- by being a member of VESA.

The beauty of VESA standards is that they are royalty free: Once one 
has obtained one one can freely implement it.
In our case here, the algorithm if the CVT standard was published by 
VESA and made available for free download thru the said spread sheet 
(instead of a pdf document).

So why on earth would anybody now want to do a clean room implemenation 
of a standard that is publically available?

The *only* thing that should be done is to get rid of the paragraph 
containing the eye-brow raiser term 'stolen' to something saying:

This code is an implemenation of the VESA CVT standard.
This standard can be obtained from http://www.vesa.org.

Cheers,
Egbert.

___
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 driver/ast 00/15] Set of cleanup patches

2014-04-24 Thread Egbert Eich
While I was testing the AST 2400 support I cleaned up the code
a bit.
Basically I
- fixed a bunch of compiler warnings
- removed unused functions
- cleaned up namespace issues (either made functions static or
  renamed them so that they live in the ast driver name space).
  This removes potential conflicts with symbols from the Xserver
  or other drivers or modules.
- fixed ABI compatibility issues with older Xservers
- moved the firmware for the DP501 from ast_vgatool.c to 
  a separate file. This made ast_vgatool.c much easier to handle.


Egbert Eich (15):
  Fix compiler warnings: get rid if xf86PciInfo.h
  Fix compiler warnings: get rid of deprecated IOADDRESS
  Fix compiler warnings: add DrawablePtr argument to ASTPutImage
  Remove upused functions from ast_vgatools.c
  Clean up namespace in ast_vgatools.c
  Clean up namespace in ast_2dtool.c
  Clean up namespace in ast_cursor.c
  Clean up namespace in ast_mode.c
  Clean up namespace in ast_accel.c
  Clean up namespace in ast_tool.c
  Include local headers only when needed
  Fix typo
  Fix ABI version conflict in xf86UnclaimPciSlot()
  Move firmware for DP501 to a separate file
  Add _AST_H_ define to ast.h

 src/Makefile.am   |1 +
 src/ast.h |   68 +-
 src/ast_2dtool.c  |   45 +-
 src/ast_2dtool.h  |2 +
 src/ast_accel.c   |   86 +-
 src/ast_cursor.c  |8 +-
 src/ast_dp501fw.h | 3326 
 src/ast_driver.c  |  136 +-
 src/ast_mode.c|  121 +-
 src/ast_tool.c|7 -
 src/ast_vgatool.c | 3606 +
 11 files changed, 3618 insertions(+), 3788 deletions(-)
 create mode 100644 src/ast_dp501fw.h

-- 
1.8.4.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 driver/ast 05/15] Clean up namespace in ast_vgatools.c

2014-04-24 Thread Egbert Eich
From: Egbert Eich e...@suse.de

- Make local functions static
  This sometimes helps the compiler to optimize.
- Make sure exported functions have 'AST' in their name.
  This avoids name space conflicts with the server or other drivers.
- Place declaration of exported functions in a header file.
  This ensures that changes to the function type or arguments are followed
  thru everywhere.

Signed-off-by: Egbert Eich e...@suse.de
---
 src/ast.h |  24 ++
 src/ast_driver.c  |  72 ++---
 src/ast_mode.c|  10 +---
 src/ast_vgatool.c | 136 +++---
 4 files changed, 107 insertions(+), 135 deletions(-)

diff --git a/src/ast.h b/src/ast.h
index 3b56a6c..75a1a98 100644
--- a/src/ast.h
+++ b/src/ast.h
@@ -305,6 +305,30 @@ typedef struct _ASTRec {
 
 #define ASTPTR(p) ((ASTRecPtr)((p)-driverPrivate))
 
+/* ast_vgatool.c */
+extern Bool bASTIsVGAEnabled(ScrnInfoPtr pScrn);
+extern Bool ASTGetVGA2EDID(ScrnInfoPtr pScrn, unsigned char *pEDIDBuffer);
+extern void ASTDisplayPowerManagementSet(ScrnInfoPtr pScrn, int 
PowerManagementMode, int flags);
+extern void vASTLoadPalette(ScrnInfoPtr pScrn, int numColors, int *indices, 
LOCO *colors, VisualPtr pVisual);
+extern void ASTBlankScreen(ScrnInfoPtr pScreen, Bool unblack);
+extern void vAST1000DisplayOn(ScrnInfoPtr pScrn);
+extern void vAST1000DisplayOff(ScrnInfoPtr pScrn);
+extern void vASTSetStartAddressCRT1(ASTRecPtr pAST, ULONG base);
+extern void ASTGetScratchOptions(ScrnInfoPtr pScrn);
+void ASTGetChipType(ScrnInfoPtr pScrn);
+ULONG ASTGetMaxDCLK(ScrnInfoPtr pScrn);
+ULONG ASTGetVRAMInfo(ScrnInfoPtr pScrn);
+void ASTGetDRAMInfo(ScrnInfoPtr pScrn);
+Bool bASTRegInit(ScrnInfoPtr pScrn);
+void vASTOpenKey(ScrnInfoPtr pScrn);
+Bool ASTReadEDID_M68K(ScrnInfoPtr pScrn, BYTE *pEDIDData);
+UCHAR ASTGetLinkMaxCLK(ScrnInfoPtr pScrn);
+Bool ASTGetVGAEDID(ScrnInfoPtr pScrn, unsigned char *pEDIDBuffer);
+Bool bASTInitAST1180(ScrnInfoPtr pScrn);
+void ASTGetAST1180DRAMInfo(ScrnInfoPtr pScrn);
+void vASTEnableVGAMMIO(ScrnInfoPtr pScrn);
+Bool ASTInitVGA(ScrnInfoPtr pScrn, ULONG Flags);
+
 /* Include Files */
 #include ast_mode.h
 #include ast_vgatool.h
diff --git a/src/ast_driver.c b/src/ast_driver.c
index b04b026..a35d0ba 100644
--- a/src/ast_driver.c
+++ b/src/ast_driver.c
@@ -63,29 +63,7 @@ extern Bool ASTUnmapMem(ScrnInfoPtr pScrn);
 extern Bool ASTMapMMIO(ScrnInfoPtr pScrn);
 extern void ASTUnmapMMIO(ScrnInfoPtr pScrn);
 
-extern void vASTOpenKey(ScrnInfoPtr pScrn);
-extern Bool bASTRegInit(ScrnInfoPtr pScrn);
-extern void GetDRAMInfo(ScrnInfoPtr pScrn);
-extern ULONG GetVRAMInfo(ScrnInfoPtr pScrn);
-extern ULONG GetMaxDCLK(ScrnInfoPtr pScrn);
-extern void GetChipType(ScrnInfoPtr pScrn);
-extern void GetScratchOptions(ScrnInfoPtr pScrn);
-extern void vASTLoadPalette(ScrnInfoPtr pScrn, int numColors, int *indices, 
LOCO *colors, VisualPtr pVisual);
-extern void ASTDisplayPowerManagementSet(ScrnInfoPtr pScrn, int 
PowerManagementMode, int flags);
-extern void vSetStartAddressCRT1(ASTRecPtr pAST, ULONG base);
 extern Bool ASTSetMode(ScrnInfoPtr pScrn, DisplayModePtr mode);
-extern Bool GetVGA2EDID(ScrnInfoPtr pScrn, unsigned char *pEDIDBuffer);
-extern void vInitDRAMReg(ScrnInfoPtr pScrn);
-extern Bool bIsVGAEnabled(ScrnInfoPtr pScrn);
-extern void ASTBlankScreen(ScrnInfoPtr pScreen, Bool unblack);
-extern Bool InitVGA(ScrnInfoPtr pScrn, ULONG Flags);
-extern Bool GetVGAEDID(ScrnInfoPtr pScrn, unsigned char *pEDIDBuffer);
-extern Bool bInitAST1180(ScrnInfoPtr pScrn);
-extern void GetAST1180DRAMInfo(ScrnInfoPtr pScrn);
-extern void vEnableASTVGAMMIO(ScrnInfoPtr pScrn);
-
-extern Bool ReadEDID_M68K(ScrnInfoPtr pScrn, BYTE *pEDIDData);
-extern UCHAR GetLinkMaxCLK(ScrnInfoPtr pScrn);
 
 extern Bool bInitCMDQInfo(ScrnInfoPtr pScrn, ASTRecPtr pAST);
 extern Bool bEnableCMDQ(ScrnInfoPtr pScrn, ASTRecPtr pAST);
@@ -645,22 +623,22 @@ ASTPreInit(ScrnInfoPtr pScrn, int flags)
}
 
/* Init AST1180 */
-   bInitAST1180(pScrn);
+   bASTInitAST1180(pScrn);
 
/* Get AST1180 Information */
-   GetAST1180DRAMInfo(pScrn);
+   ASTGetAST1180DRAMInfo(pScrn);
pScrn-videoRam = pAST-ulVRAMSize / 1024;
 
}
else
{
/* Enable VGA MMIO Access */
-   vEnableASTVGAMMIO(pScrn);
+   vASTEnableVGAMMIO(pScrn);
 
/* Init VGA Adapter */
if (!xf86IsPrimaryPci(pAST-PciInfo))
{
-   InitVGA(pScrn, 0);
+   ASTInitVGA(pScrn, 0);
}
 
vASTOpenKey(pScrn);
@@ -672,16 +650,16 @@ ASTPreInit(ScrnInfoPtr pScrn, int flags)
else if (PCI_DEV_REVISION(pAST-PciInfo) = 0x20)
pAST-jChipType = AST2300;
else if (PCI_DEV_REVISION(pAST-PciInfo) = 0x10)
-   GetChipType(pScrn);
+   ASTGetChipType(pScrn);
else
pAST-jChipType = AST2000;
 
/* Get Options from Scratch */
-   GetScratchOptions(pScrn);
+   ASTGetScratchOptions(pScrn);
 
/* Get DRAM

[PATCH driver/ast 00/15] Set of cleanup patches

2014-04-24 Thread Egbert Eich
[2nd attempt - sorry for the noise]

While I was testing the AST 2400 support I cleaned up the code a bit.
Basically I
- fixed a bunch of compiler warnings
- removed unused functions
- cleaned up namespace issues (either made functions static or
  renamed them so that they live in the ast driver name space).
  This removes potential conflicts with symbols from the Xserver
  or other drivers or modules.  
- fixed ABI compatibility issues with older Xservers
- moved the firmware for the DP501 from ast_vgatool.c too
  a separate file. This made ast_vgatool.c much easier to handle.   
  
Egbert Eich (15):
  Fix compiler warnings: get rid if xf86PciInfo.h
  Fix compiler warnings: get rid of deprecated IOADDRESS
  Fix compiler warnings: add DrawablePtr argument to ASTPutImage
  Remove upused functions from ast_vgatools.c
  Clean up namespace in ast_vgatools.c
  Clean up namespace in ast_2dtool.c
  Clean up namespace in ast_cursor.c
  Clean up namespace in ast_mode.c
  Clean up namespace in ast_accel.c
  Clean up namespace in ast_tool.c
  Include local headers only when needed
  Fix typo
  Fix ABI version conflict in xf86UnclaimPciSlot()
  Move firmware for DP501 to a separate file
  Add _AST_H_ define to ast.h

 src/Makefile.am   |1 +
 src/ast.h |   68 +-
 src/ast_2dtool.c  |   45 +-
 src/ast_2dtool.h  |2 +
 src/ast_accel.c   |   86 +-
 src/ast_cursor.c  |8 +-
 src/ast_dp501fw.h | 3326 
 src/ast_driver.c  |  136 +-
 src/ast_mode.c|  121 +-
 src/ast_tool.c|7 -
 src/ast_vgatool.c | 3606 +
 11 files changed, 3618 insertions(+), 3788 deletions(-)
 create mode 100644 src/ast_dp501fw.h

-- 
1.8.4.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 driver/ast 09/15] Clean up namespace in ast_accel.c

2014-04-24 Thread Egbert Eich
From: Egbert Eich e...@suse.de

- Made sure exported functions have 'AST' in their name.
  This avoids name space conflicts with the server or other drivers.
- Placed declaration of exported functions in a header file.
  This ensures that changes to the function type or arguments are followed
  thru everywhere.

Signed-off-by: Egbert Eich e...@suse.de
---
 src/ast.h| 7 +++
 src/ast_accel.c  | 1 -
 src/ast_driver.c | 6 --
 3 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/src/ast.h b/src/ast.h
index 89971d3..a50f182 100644
--- a/src/ast.h
+++ b/src/ast.h
@@ -345,6 +345,13 @@ void ASTDisableHWC(ScrnInfoPtr pScrn);
 /* ast_mode.c */
 Bool ASTSetMode(ScrnInfoPtr pScrn, DisplayModePtr mode);
 
+/* ast_accel.c */
+#ifdef HAVE_XAA_H
+Bool ASTAccelInit(ScreenPtr pScreen);
+#endif
+void ASTDisplayVideo(ScrnInfoPtr pScrn, ASTPortPrivPtr pPriv, RegionPtr 
clipBoxes, int id);
+
+
 /* Include Files */
 #include ast_mode.h
 #include ast_vgatool.h
diff --git a/src/ast_accel.c b/src/ast_accel.c
index 6fd0ca9..1217b01 100644
--- a/src/ast_accel.c
+++ b/src/ast_accel.c
@@ -98,7 +98,6 @@ int ASTXAAPatternROP[16]=
 };
 
 /* Prototype type declaration */
-Bool ASTAccelInit(ScreenPtr pScreen);
 static void ASTSync(ScrnInfoPtr pScrn);
 static void ASTSetupForScreenToScreenCopy(ScrnInfoPtr pScrn,
   int xdir, int ydir, int rop,
diff --git a/src/ast_driver.c b/src/ast_driver.c
index 8e3a814..3d3f01a 100644
--- a/src/ast_driver.c
+++ b/src/ast_driver.c
@@ -63,10 +63,6 @@ extern Bool ASTUnmapMem(ScrnInfoPtr pScrn);
 extern Bool ASTMapMMIO(ScrnInfoPtr pScrn);
 extern void ASTUnmapMMIO(ScrnInfoPtr pScrn);
 
-#ifdef HAVE_XAA_H
-extern Bool ASTAccelInit(ScreenPtr pScreen);
-#endif
-
 /* Mandatory functions */
 static void ASTIdentify(int flags);
 const OptionInfoRec *ASTAvailableOptions(int chipid, int busid);
@@ -2096,8 +2092,6 @@ static int ASTQueryImageAttributes(ScrnInfoPtr pScrn, int 
id,
 return size;
 }
 
-extern void ASTDisplayVideo(ScrnInfoPtr pScrn, ASTPortPrivPtr pPriv, RegionPtr 
clipBoxes, int id);
-
 static int ASTPutImage(ScrnInfoPtr pScrn,
   short src_x, short src_y,
   short drw_x, short drw_y,
-- 
1.8.4.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 driver/ast 08/15] Clean up namespace in ast_mode.c

2014-04-24 Thread Egbert Eich
From: Egbert Eich e...@suse.de

- Make local functions static
  This sometimes helps the compiler to optimize.
- Made sure exported functions have 'AST' in their name.
  This avoids name space conflicts with the server or other drivers.
- Placed declaration of exported functions in a header file.
  This ensures that changes to the function type or arguments are followed
  thru everywhere.

Signed-off-by: Egbert Eich e...@suse.de
---
 src/ast.h|  3 ++
 src/ast_driver.c |  2 --
 src/ast_mode.c   | 96 +++-
 3 files changed, 50 insertions(+), 51 deletions(-)

diff --git a/src/ast.h b/src/ast.h
index 707149e..89971d3 100644
--- a/src/ast.h
+++ b/src/ast.h
@@ -342,6 +342,9 @@ Bool bASTInitHWC(ScrnInfoPtr pScrn, ASTRecPtr pAST);
 void ASTDisableHWC(ScrnInfoPtr pScrn);
 #endif
 
+/* ast_mode.c */
+Bool ASTSetMode(ScrnInfoPtr pScrn, DisplayModePtr mode);
+
 /* Include Files */
 #include ast_mode.h
 #include ast_vgatool.h
diff --git a/src/ast_driver.c b/src/ast_driver.c
index 4fc8b28..8e3a814 100644
--- a/src/ast_driver.c
+++ b/src/ast_driver.c
@@ -63,8 +63,6 @@ extern Bool ASTUnmapMem(ScrnInfoPtr pScrn);
 extern Bool ASTMapMMIO(ScrnInfoPtr pScrn);
 extern void ASTUnmapMMIO(ScrnInfoPtr pScrn);
 
-extern Bool ASTSetMode(ScrnInfoPtr pScrn, DisplayModePtr mode);
-
 #ifdef HAVE_XAA_H
 extern Bool ASTAccelInit(ScreenPtr pScreen);
 #endif
diff --git a/src/ast_mode.c b/src/ast_mode.c
index 9e41bd4..ceb2ddb 100644
--- a/src/ast_mode.c
+++ b/src/ast_mode.c
@@ -53,7 +53,7 @@
 /* Driver specific headers */
 #include ast.h
 
-VBIOS_STDTABLE_STRUCT StdTable[] = {
+static VBIOS_STDTABLE_STRUCT StdTable[] = {
 /* MD_2_3_400 */
 {
 0x67,
@@ -126,7 +126,7 @@ VBIOS_STDTABLE_STRUCT StdTable[] = {
 },
 };
 
-VBIOS_ENHTABLE_STRUCT  Res640x480Table[] = {
+static VBIOS_ENHTABLE_STRUCT  Res640x480Table[] = {
 { 800, 640, 8, 96, 525, 480, 2, 2, VCLK25_175, /* 60Hz */
   (SyncNN | HBorder | VBorder | Charx8Dot), 60, 1, 0x2E },
 { 832, 640, 16, 40, 520, 480, 1, 3, VCLK31_5,  /* 72Hz */
@@ -140,7 +140,7 @@ VBIOS_ENHTABLE_STRUCT  Res640x480Table[] = {
 };
 
 
-VBIOS_ENHTABLE_STRUCT  Res800x600Table[] = {
+static VBIOS_ENHTABLE_STRUCT  Res800x600Table[] = {
 {1024, 800, 24, 72, 625, 600, 1, 2, VCLK36,/* 56Hz */
   (SyncPP | Charx8Dot), 56, 1, 0x30 },
 {1056, 800, 40, 128, 628, 600, 1, 4, VCLK40,   /* 60Hz */
@@ -155,8 +155,7 @@ VBIOS_ENHTABLE_STRUCT  Res800x600Table[] = {
   (SyncPP | Charx8Dot), 0xFF, 5, 0x30 },
 };
 
-
-VBIOS_ENHTABLE_STRUCT  Res1024x768Table[] = {
+static VBIOS_ENHTABLE_STRUCT  Res1024x768Table[] = {
 {1344, 1024, 24, 136, 806, 768, 3, 6, VCLK65,  /* 60Hz */
   (SyncNN | Charx8Dot), 60, 1, 0x31 },
 {1328, 1024, 24, 136, 806, 768, 3, 6, VCLK75,  /* 70Hz */
@@ -169,7 +168,7 @@ VBIOS_ENHTABLE_STRUCT  Res1024x768Table[] = {
   (SyncPP | Charx8Dot), 0xFF, 4, 0x31 },
 };
 
-VBIOS_ENHTABLE_STRUCT  Res1280x1024Table[] = {
+static VBIOS_ENHTABLE_STRUCT  Res1280x1024Table[] = {
 {1688, 1280, 48, 112, 1066, 1024, 1, 3, VCLK108,   /* 60Hz */
   (SyncPP | Charx8Dot), 60, 1, 0x32 },
 {1688, 1280, 16, 144, 1066, 1024, 1, 3, VCLK135,   /* 75Hz */
@@ -180,7 +179,7 @@ VBIOS_ENHTABLE_STRUCT  Res1280x1024Table[] = {
   (SyncPP | Charx8Dot), 0xFF, 3, 0x32 },
 };
 
-VBIOS_ENHTABLE_STRUCT  Res1600x1200Table[] = {
+static VBIOS_ENHTABLE_STRUCT  Res1600x1200Table[] = {
 {2160, 1600, 64, 192, 1250, 1200, 1, 3, VCLK162,   /* 60Hz */
   (SyncPP | Charx8Dot), 60, 1, 0x33 },
 {2160, 1600, 64, 192, 1250, 1200, 1, 3, VCLK162,   /* end */
@@ -188,21 +187,21 @@ VBIOS_ENHTABLE_STRUCT  Res1600x1200Table[] = {
 };
 
 /* 16:9 */
-VBIOS_ENHTABLE_STRUCT  Res1360x768Table[] = {
+static VBIOS_ENHTABLE_STRUCT  Res1360x768Table[] = {
 {1792, 1360, 64,112, 795,  768, 3, 6, VCLK85_5,/* 60Hz */
   (SyncPP | Charx8Dot | LineCompareOff | WideScreenMode | NewModeInfo), 
60, 1, 0x39 },
 {1792, 1360, 64,112, 795,  768, 3, 6, VCLK85_5,/* end */
   (SyncPP | Charx8Dot | LineCompareOff | WideScreenMode | NewModeInfo), 
0xFF, 1, 0x39 },
 };
 
-VBIOS_ENHTABLE_STRUCT  Res1600x900Table[] = {
+static VBIOS_ENHTABLE_STRUCT  Res1600x900Table[] = {
 {1760, 1600, 48, 32, 926,  900, 3, 5, VCLK97_75,   /* 60Hz CVT RB */
   (SyncNP | Charx8Dot | LineCompareOff | WideScreenMode | NewModeInfo), 
60, 1, 0x3A },
 {1760, 1600, 48, 32, 926,  900, 3, 5, VCLK97_75,   /* end */
   (SyncNP | Charx8Dot | LineCompareOff | WideScreenMode | NewModeInfo), 
0xFF, 1, 0x3A },
 };
 
-VBIOS_ENHTABLE_STRUCT  Res1920x1080Table[] = {
+static VBIOS_ENHTABLE_STRUCT  Res1920x1080Table[] = {
 {2200, 1920, 88, 44, 1125, 1080, 4, 5, VCLK148_5,  /* HDTV 60Hz */
   (SyncPP | Charx8Dot | LineCompareOff | WideScreenMode | NewModeInfo), 
60, 1, 0x38 },
 {2200, 1920, 88, 44, 1125, 1080, 4, 5, VCLK148_5,  /* end */
@@ -210,7 +209,7 @@ VBIOS_ENHTABLE_STRUCT  Res1920x1080Table

[PATCH driver/ast 12/15] Fix typo

2014-04-24 Thread Egbert Eich
From: Egbert Eich e...@suse.de

Chontel - Chrontel

Signed-off-by: Egbert Eich e...@suse.de
---
 src/ast_mode.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/ast_mode.c b/src/ast_mode.c
index 59488c4..a52ee71 100644
--- a/src/ast_mode.c
+++ b/src/ast_mode.c
@@ -420,7 +420,7 @@ static BOOL bSetAST1180CRTCReg(ScrnInfoPtr pScrn,  
DisplayModePtr mode, PVBIOS_M
 static BOOL bSetAST1180OffsetReg(ScrnInfoPtr pScrn,  DisplayModePtr mode, 
PVBIOS_MODE_INFO pVGAModeInfo);
 static BOOL bSetAST1180DCLKReg(ScrnInfoPtr pScrn,  DisplayModePtr mode, 
PVBIOS_MODE_INFO pVGAModeInfo);
 static BOOL bSetAST1180ExtReg(ScrnInfoPtr pScrn,  DisplayModePtr mode, 
PVBIOS_MODE_INFO pVGAModeInfo);
-static void vInitChontelReg(ScrnInfoPtr pScrn, DisplayModePtr mode, 
PVBIOS_MODE_INFO pVGAModeInfo);
+static void vInitChrontelReg(ScrnInfoPtr pScrn, DisplayModePtr mode, 
PVBIOS_MODE_INFO pVGAModeInfo);
 
 Bool
 ASTSetMode(ScrnInfoPtr pScrn, DisplayModePtr mode)
@@ -443,7 +443,7 @@ ASTSetMode(ScrnInfoPtr pScrn, DisplayModePtr mode)
 bSetAST1180DCLKReg(pScrn, mode, vgamodeinfo);
 bSetAST1180ExtReg(pScrn, mode, vgamodeinfo);
 
-vInitChontelReg(pScrn, mode, vgamodeinfo);
+vInitChrontelReg(pScrn, mode, vgamodeinfo);
 }
 else
 {
@@ -1176,7 +1176,7 @@ static UCHAR GetChrontelReg(ASTRecPtr pAST, UCHAR 
jChannel, UCHAR jIndex)
 return (jData);
 }
 
-static void vInitChontelReg(ScrnInfoPtr pScrn, DisplayModePtr mode, 
PVBIOS_MODE_INFO pVGAModeInfo)
+static void vInitChrontelReg(ScrnInfoPtr pScrn, DisplayModePtr mode, 
PVBIOS_MODE_INFO pVGAModeInfo)
 {
 
 PVBIOS_ENHTABLE_STRUCT pEnhModePtr = pVGAModeInfo-pEnhTableEntry;
-- 
1.8.4.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 driver/ast 06/15] Clean up namespace in ast_2dtool.c

2014-04-24 Thread Egbert Eich
From: Egbert Eich e...@suse.de

- Make local functions static
  This sometimes helps the compiler to optimize.
- Make sure exported functions have 'AST' in their name.
  This avoids name space conflicts with the server or other drivers.
- Place declaration of exported functions in a header file.
  This ensures that changes to the function type or arguments are followed
  thru everywhere.

Signed-off-by: Egbert Eich e...@suse.de
---
 src/ast.h|  6 
 src/ast_2dtool.c | 42 
 src/ast_2dtool.h |  2 ++
 src/ast_accel.c  | 83 ++--
 src/ast_driver.c | 10 ++-
 src/ast_mode.c   |  5 +---
 6 files changed, 68 insertions(+), 80 deletions(-)

diff --git a/src/ast.h b/src/ast.h
index 75a1a98..20df2e1 100644
--- a/src/ast.h
+++ b/src/ast.h
@@ -329,6 +329,12 @@ void ASTGetAST1180DRAMInfo(ScrnInfoPtr pScrn);
 void vASTEnableVGAMMIO(ScrnInfoPtr pScrn);
 Bool ASTInitVGA(ScrnInfoPtr pScrn, ULONG Flags);
 
+/* ast_2dtool.c */
+void vASTWaitEngIdle(ScrnInfoPtr pScrn, ASTRecPtr pAST);
+UCHAR *pASTjRequestCMDQ(ASTRecPtr pAST, ULONG ulDataLen);
+Bool bASTEnable2D(ScrnInfoPtr pScrn, ASTRecPtr pAST);
+void vASTDisable2D(ScrnInfoPtr pScrn, ASTRecPtr pAST);
+
 /* Include Files */
 #include ast_mode.h
 #include ast_vgatool.h
diff --git a/src/ast_2dtool.c b/src/ast_2dtool.c
index 47f0d64..3cf83fe 100644
--- a/src/ast_2dtool.c
+++ b/src/ast_2dtool.c
@@ -53,16 +53,8 @@
 typedef Bool (*PFN_bENABLE_CMDQ)(ScrnInfoPtr , ASTRecPtr);
 
 /* Prototype type declaration */
-Bool bInitCMDQInfo(ScrnInfoPtr pScrn, ASTRecPtr pAST);
-Bool bEnableCMDQ(ScrnInfoPtr pScrn, ASTRecPtr pAST);
-Bool bEnableCMDQ2300(ScrnInfoPtr pScrn, ASTRecPtr pAST);
-Bool bEnable2D(ScrnInfoPtr pScrn, ASTRecPtr pAST);
-void vDisable2D(ScrnInfoPtr pScrn, ASTRecPtr pAST);
-void vWaitEngIdle(ScrnInfoPtr pScrn, ASTRecPtr pAST);
-UCHAR *pjRequestCMDQ(ASTRecPtr pAST, ULONG   ulDataLen);
-Bool bGetLineTerm(_LINEInfo *LineInfo, LINEPARAM *dsLineParam);
 
-Bool
+static Bool
 bInitCMDQInfo(ScrnInfoPtr pScrn, ASTRecPtr pAST)
 {
 
@@ -110,12 +102,12 @@ bInitCMDQInfo(ScrnInfoPtr pScrn, ASTRecPtr pAST)
 return (TRUE);
 }
 
-Bool
+static Bool
 bEnableCMDQ(ScrnInfoPtr pScrn, ASTRecPtr pAST)
 {
 ULONG ulVMCmdQBasePort = 0;
 
-vWaitEngIdle(pScrn, pAST);
+vASTWaitEngIdle(pScrn, pAST);
 
 /* set DBG Select Info */
 if (pAST-DBGSelect)
@@ -176,12 +168,12 @@ bEnableCMDQ(ScrnInfoPtr pScrn, ASTRecPtr pAST)
 return (TRUE);
 }
 
-Bool
+static Bool
 bEnableCMDQ2300(ScrnInfoPtr pScrn, ASTRecPtr pAST)
 {
 ULONG ulVMCmdQBasePort = 0, ulNewModeData;
 
-vWaitEngIdle(pScrn, pAST);
+vASTWaitEngIdle(pScrn, pAST);
 
 /* set DBG Select Info */
 if (pAST-DBGSelect)
@@ -242,7 +234,7 @@ bEnableCMDQ2300(ScrnInfoPtr pScrn, ASTRecPtr pAST)
 } /* bEnableCMDQ2300 */
 
 Bool
-bEnable2D(ScrnInfoPtr pScrn, ASTRecPtr pAST)
+bASTEnable2D(ScrnInfoPtr pScrn, ASTRecPtr pAST)
 {
 ULONG ulData;
 PFN_bENABLE_CMDQ pfnEnableCMDQ = bEnableCMDQ;
@@ -272,13 +264,13 @@ bEnable2D(ScrnInfoPtr pScrn, ASTRecPtr pAST)
 
 if (!bInitCMDQInfo(pScrn, pAST))
 {
-vDisable2D(pScrn, pAST);
+vASTDisable2D(pScrn, pAST);
return (FALSE);
 }
 
 if (!pfnEnableCMDQ(pScrn, pAST))
 {
-vDisable2D(pScrn, pAST);
+vASTDisable2D(pScrn, pAST);
return (FALSE);
 }
 
@@ -286,11 +278,11 @@ bEnable2D(ScrnInfoPtr pScrn, ASTRecPtr pAST)
 }
 
 void
-vDisable2D(ScrnInfoPtr pScrn, ASTRecPtr pAST)
+vASTDisable2D(ScrnInfoPtr pScrn, ASTRecPtr pAST)
 {
 
-vWaitEngIdle(pScrn, pAST);
-vWaitEngIdle(pScrn, pAST);
+vASTWaitEngIdle(pScrn, pAST);
+vASTWaitEngIdle(pScrn, pAST);
 
 /* restore 2D settings */
 if (pAST-jChipType != AST1180)
@@ -309,7 +301,7 @@ vDisable2D(ScrnInfoPtr pScrn, ASTRecPtr pAST)
 
 
 void
-vWaitEngIdle(ScrnInfoPtr pScrn, ASTRecPtr pAST)
+vASTWaitEngIdle(ScrnInfoPtr pScrn, ASTRecPtr pAST)
 {
 ULONG ulEngState, ulEngState2;
 UCHAR jReg;
@@ -320,11 +312,11 @@ vWaitEngIdle(ScrnInfoPtr pScrn, ASTRecPtr pAST)
 
 /* 2D disable if 0xA4 D[0] = 1 */
 GetIndexRegMask(CRTC_PORT, 0xA4, 0x01, jReg);
-if (!jReg) goto Exit_vWaitEngIdle;
+if (!jReg) goto Exit_vASTWaitEngIdle;
 
 /* 2D not work if in std. mode */
 GetIndexRegMask(CRTC_PORT, 0xA3, 0x0F, jReg);
-if (!jReg) goto Exit_vWaitEngIdle;
+if (!jReg) goto Exit_vASTWaitEngIdle;
 }
 
 if (*(ULONG *) (pAST-CMDQInfo.pjCmdQBasePort)  0x0200)   /* MMIO 
Mode */
@@ -341,7 +333,7 @@ vWaitEngIdle(ScrnInfoPtr pScrn, ASTRecPtr pAST)
 
 } while ((ulEngState  ulEngCheckSetting) || (ulEngState != ulEngState2));
 
-Exit_vWaitEngIdle:
+Exit_vASTWaitEngIdle:
 ;
 }
 
@@ -362,7 +354,7 @@ static __inline ULONG ulGetCMDQLength(ASTRecPtr pAST, ULONG 
ulWritePointer, ULON
 return ((ulReadPointer  3) - ulWritePointer - CMD_QUEUE_GUARD_BAND)  
ulCMDQMask;
 }
 
-UCHAR *pjRequestCMDQ(
+UCHAR *pASTjRequestCMDQ

[PATCH driver/ast 07/15] Clean up namespace in ast_cursor.c

2014-04-24 Thread Egbert Eich
From: Egbert Eich e...@suse.de

- Make sure exported functions have 'AST' in their name.
  This avoids name space conflicts with the server or other drivers.
- Place declaration of exported functions in a header file.
  This ensures that changes to the function type or arguments are followed
  thru everywhere.
---
 src/ast.h| 7 +++
 src/ast_cursor.c | 5 +
 src/ast_driver.c | 3 ---
 src/ast_mode.c   | 5 +
 4 files changed, 9 insertions(+), 11 deletions(-)

diff --git a/src/ast.h b/src/ast.h
index 20df2e1..707149e 100644
--- a/src/ast.h
+++ b/src/ast.h
@@ -335,6 +335,13 @@ UCHAR *pASTjRequestCMDQ(ASTRecPtr pAST, ULONG ulDataLen);
 Bool bASTEnable2D(ScrnInfoPtr pScrn, ASTRecPtr pAST);
 void vASTDisable2D(ScrnInfoPtr pScrn, ASTRecPtr pAST);
 
+/* ast_cursor.c */
+#ifdef  HWC
+Bool ASTCursorInit(ScreenPtr pScreen);
+Bool bASTInitHWC(ScrnInfoPtr pScrn, ASTRecPtr pAST);
+void ASTDisableHWC(ScrnInfoPtr pScrn);
+#endif
+
 /* Include Files */
 #include ast_mode.h
 #include ast_vgatool.h
diff --git a/src/ast_cursor.c b/src/ast_cursor.c
index 7bfa15f..4598daa 100644
--- a/src/ast_cursor.c
+++ b/src/ast_cursor.c
@@ -53,9 +53,6 @@
 
 #ifdef HWC
 /* Prototype type declaration */
-Bool ASTCursorInit(ScreenPtr pScreen);
-Bool bInitHWC(ScrnInfoPtr pScrn, ASTRecPtr pAST);
-void ASTDisableHWC(ScrnInfoPtr pScrn);
 static void ASTShowCursor(ScrnInfoPtr pScrn);
 static void ASTHideCursor(ScrnInfoPtr pScrn);
 static void ASTSetCursorPosition(ScrnInfoPtr pScrn, int x, int y);
@@ -111,7 +108,7 @@ ASTCursorInit(ScreenPtr pScreen)
 
 }
 
-Bool bInitHWC(ScrnInfoPtr pScrn, ASTRecPtr pAST)
+Bool bASTInitHWC(ScrnInfoPtr pScrn, ASTRecPtr pAST)
 {
 ScreenPtr  pScreen;
 
diff --git a/src/ast_driver.c b/src/ast_driver.c
index 5b02c9e..4fc8b28 100644
--- a/src/ast_driver.c
+++ b/src/ast_driver.c
@@ -69,9 +69,6 @@ extern Bool ASTSetMode(ScrnInfoPtr pScrn, DisplayModePtr 
mode);
 extern Bool ASTAccelInit(ScreenPtr pScreen);
 #endif
 
-extern Bool ASTCursorInit(ScreenPtr pScreen);
-extern void ASTDisableHWC(ScrnInfoPtr pScrn);
-
 /* Mandatory functions */
 static void ASTIdentify(int flags);
 const OptionInfoRec *ASTAvailableOptions(int chipid, int busid);
diff --git a/src/ast_mode.c b/src/ast_mode.c
index 3d06700..9e41bd4 100644
--- a/src/ast_mode.c
+++ b/src/ast_mode.c
@@ -406,9 +406,6 @@ VBIOS_DAC_INFO DAC_VGA[] = {
  { 0x00, 0x00, 0x00 },  { 0x00, 0x00, 0x00 },  { 0x00, 0x00, 0x00 },  { 0x00, 
0x00, 0x00 },
 };
 
-/* extern. function */
-extern Bool bInitHWC(ScrnInfoPtr pScrn, ASTRecPtr pAST);
-
 /* Prototype type declaration*/
 Bool ASTSetMode(ScrnInfoPtr pScrn, DisplayModePtr mode);
 Bool bGetAST1000VGAModeInfo(ScrnInfoPtr pScrn, DisplayModePtr mode, 
PVBIOS_MODE_INFO pVGAModeInfo);
@@ -477,7 +474,7 @@ ASTSetMode(ScrnInfoPtr pScrn, DisplayModePtr mode)
 #endif
 #ifdef HWC
if (!pAST-noHWC) {
-   if (!bInitHWC(pScrn, pAST)) {
+   if (!bASTInitHWC(pScrn, pAST)) {
xf86DrvMsg(pScrn-scrnIndex, X_ERROR,Init HWC failed\n);
pAST-noHWC = TRUE;
}
-- 
1.8.4.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 driver/ast 11/15] Include local headers only when needed

2014-04-24 Thread Egbert Eich
From: Egbert Eich e...@suse.de

Move inclusion of local headers from ast.h to the individual
files. Include only those headers which are needed.

Signed-off-by: Egbert Eich e...@suse.de
---
 src/ast.h | 5 -
 src/ast_2dtool.c  | 2 ++
 src/ast_accel.c   | 1 +
 src/ast_cursor.c  | 2 ++
 src/ast_driver.c  | 3 +++
 src/ast_mode.c| 2 ++
 src/ast_vgatool.c | 1 +
 7 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/src/ast.h b/src/ast.h
index 953f257..6001b63 100644
--- a/src/ast.h
+++ b/src/ast.h
@@ -357,8 +357,3 @@ Bool ASTUnmapMem(ScrnInfoPtr pScrn);
 Bool ASTMapMMIO(ScrnInfoPtr pScrn);
 void ASTUnmapMMIO(ScrnInfoPtr pScrn);
 
-/* Include Files */
-#include ast_mode.h
-#include ast_vgatool.h
-#include ast_2dtool.h
-#include ast_cursor.h
diff --git a/src/ast_2dtool.c b/src/ast_2dtool.c
index 3cf83fe..b4f0a4a 100644
--- a/src/ast_2dtool.c
+++ b/src/ast_2dtool.c
@@ -48,6 +48,8 @@
 
 /* Driver specific headers */
 #include ast.h
+#include ast_vgatool.h
+#include ast_2dtool.h
 
 #ifdef Accel_2D
 typedef Bool (*PFN_bENABLE_CMDQ)(ScrnInfoPtr , ASTRecPtr);
diff --git a/src/ast_accel.c b/src/ast_accel.c
index 1217b01..fd91688 100644
--- a/src/ast_accel.c
+++ b/src/ast_accel.c
@@ -52,6 +52,7 @@
 
 /* Driver specific headers */
 #include ast.h
+#include ast_2dtool.h
 
 #ifdef Accel_2D
 
diff --git a/src/ast_cursor.c b/src/ast_cursor.c
index 4598daa..5031aac 100644
--- a/src/ast_cursor.c
+++ b/src/ast_cursor.c
@@ -50,6 +50,8 @@
 
 /* Driver specific headers */
 #include ast.h
+#include ast_vgatool.h
+#include ast_cursor.h
 
 #ifdef HWC
 /* Prototype type declaration */
diff --git a/src/ast_driver.c b/src/ast_driver.c
index 863e590..b6accbf 100644
--- a/src/ast_driver.c
+++ b/src/ast_driver.c
@@ -56,6 +56,9 @@
 
 /* Driver specific headers */
 #include ast.h
+#include ast_mode.h
+#include ast_vgatool.h
+#include ast_2dtool.h
 
 /* Mandatory functions */
 static void ASTIdentify(int flags);
diff --git a/src/ast_mode.c b/src/ast_mode.c
index ceb2ddb..59488c4 100644
--- a/src/ast_mode.c
+++ b/src/ast_mode.c
@@ -52,6 +52,8 @@
 
 /* Driver specific headers */
 #include ast.h
+#include ast_mode.h
+#include ast_vgatool.h
 
 static VBIOS_STDTABLE_STRUCT StdTable[] = {
 /* MD_2_3_400 */
diff --git a/src/ast_vgatool.c b/src/ast_vgatool.c
index b42ac7a..9a96ac5 100644
--- a/src/ast_vgatool.c
+++ b/src/ast_vgatool.c
@@ -52,6 +52,7 @@
 
 /* Driver specific headers */
 #include ast.h
+#include ast_vgatool.h
 
 
 __inline ULONG MIndwm(UCHAR *mmiobase, ULONG r)
-- 
1.8.4.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 driver/ast 01/15] Fix compiler warnings: get rid if xf86PciInfo.h

2014-04-24 Thread Egbert Eich
From: Egbert Eich e...@suse.de

xf86PciInfo.h is not needed in the ASpeed driver at all.

Signed-off-by: Egbert Eich e...@suse.de
---
 src/ast_2dtool.c  | 1 -
 src/ast_accel.c   | 1 -
 src/ast_cursor.c  | 1 -
 src/ast_driver.c  | 1 -
 src/ast_mode.c| 1 -
 src/ast_tool.c| 1 -
 src/ast_vgatool.c | 1 -
 7 files changed, 7 deletions(-)

diff --git a/src/ast_2dtool.c b/src/ast_2dtool.c
index 210d75c..47f0d64 100644
--- a/src/ast_2dtool.c
+++ b/src/ast_2dtool.c
@@ -36,7 +36,6 @@
 #include xf86xv.h
 #include X11/extensions/Xv.h
 
-#include xf86PciInfo.h
 #include xf86Pci.h
 
 /* framebuffer offscreen manager */
diff --git a/src/ast_accel.c b/src/ast_accel.c
index 71eeb79..3bfe7ee 100644
--- a/src/ast_accel.c
+++ b/src/ast_accel.c
@@ -36,7 +36,6 @@
 #include xf86xv.h
 #include X11/extensions/Xv.h
 
-#include xf86PciInfo.h
 #include xf86Pci.h
 
 /* framebuffer offscreen manager */
diff --git a/src/ast_cursor.c b/src/ast_cursor.c
index 80d787a..7bfa15f 100644
--- a/src/ast_cursor.c
+++ b/src/ast_cursor.c
@@ -36,7 +36,6 @@
 #include xf86xv.h
 #include X11/extensions/Xv.h
 
-#include xf86PciInfo.h
 #include xf86Pci.h
 
 /* framebuffer offscreen manager */
diff --git a/src/ast_driver.c b/src/ast_driver.c
index 5f7fa8e..c2ba129 100644
--- a/src/ast_driver.c
+++ b/src/ast_driver.c
@@ -40,7 +40,6 @@
 #include xf86xv.h
 #include X11/extensions/Xv.h
 
-#include xf86PciInfo.h
 #include xf86Pci.h
 
 /* framebuffer offscreen manager */
diff --git a/src/ast_mode.c b/src/ast_mode.c
index 964fe7a..8c3d828 100644
--- a/src/ast_mode.c
+++ b/src/ast_mode.c
@@ -36,7 +36,6 @@
 #include xf86xv.h
 #include X11/extensions/Xv.h
 
-#include xf86PciInfo.h
 #include xf86Pci.h
 
 /* framebuffer offscreen manager */
diff --git a/src/ast_tool.c b/src/ast_tool.c
index 7f1362e..1e1cb6b 100644
--- a/src/ast_tool.c
+++ b/src/ast_tool.c
@@ -36,7 +36,6 @@
 #include xf86xv.h
 #include X11/extensions/Xv.h
 
-#include xf86PciInfo.h
 #include xf86Pci.h
 
 /* framebuffer offscreen manager */
diff --git a/src/ast_vgatool.c b/src/ast_vgatool.c
index 73d379c..8522a6f 100644
--- a/src/ast_vgatool.c
+++ b/src/ast_vgatool.c
@@ -36,7 +36,6 @@
 #include xf86xv.h
 #include X11/extensions/Xv.h
 
-#include xf86PciInfo.h
 #include xf86Pci.h
 
 /* framebuffer offscreen manager */
-- 
1.8.4.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 driver/ast 02/15] Fix compiler warnings: get rid of deprecated IOADDRESS

2014-04-24 Thread Egbert Eich
From: Egbert Eich e...@suse.de

For newer ABI versions IOADDRESS can be replaced by int
which is big enough to hold an PIO offset.

Signed-off-by: Egbert Eich e...@suse.de
---
 src/ast.h|  6 --
 src/ast_driver.c | 18 --
 2 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/src/ast.h b/src/ast.h
index cbe62fb..3b56a6c 100644
--- a/src/ast.h
+++ b/src/ast.h
@@ -261,9 +261,11 @@ typedef struct _ASTRec {
 unsigned long  FbMapSize;
 unsigned long  MMIOMapSize;
 
-IOADDRESS  IODBase;/* Base of PIO memory area */
-IOADDRESS  PIOOffset;
+#if GET_ABI_MAJOR(ABI_VIDEODRV_VERSION)  12
 IOADDRESS  RelocateIO;
+#else
+intRelocateIO;
+#endif
 
 VIDEOMODE  VideoModeInfo;
 ASTRegRec   SavedReg;
diff --git a/src/ast_driver.c b/src/ast_driver.c
index c2ba129..639562d 100644
--- a/src/ast_driver.c
+++ b/src/ast_driver.c
@@ -570,23 +570,21 @@ ASTPreInit(ScrnInfoPtr pScrn, int flags)
xf86DrvMsg(pScrn-scrnIndex, from, Chipset: \%s\\n,
  (pScrn-chipset != NULL) ? pScrn-chipset : Unknown ast);
 
-   /* Resource Allocation */
+
 #if GET_ABI_MAJOR(ABI_VIDEODRV_VERSION)  12
-pAST-IODBase = pScrn-domainIOBase;
-#else
-pAST-IODBase = 0;
-#endif
 /* Patch the PIOOffset inside vgaHW in order to force
  * the vgaHW module to use our relocated i/o ports.
  */
+VGAHWPTR(pScrn)-PIOOffset =
+   pScrn-domainIOBase + PCI_REGION_BASE(pAST-PciInfo, 2, REGION_IO) - 
0x380;
+
+pAST-RelocateIO = pScrn-domainIOBase +
+   PCI_REGION_BASE(pAST-PciInfo, 2, REGION_IO);
+#else
+pAST-RelocateIO = (PCI_REGION_BASE(pAST-PciInfo, 2, REGION_IO));
 
-#if GET_ABI_MAJOR(ABI_VIDEODRV_VERSION)  12
-VGAHWPTR(pScrn)-PIOOffset = /* ... */
 #endif
-   pAST-PIOOffset =
-   pAST-IODBase + PCI_REGION_BASE(pAST-PciInfo, 2, REGION_IO) - 0x380;
 
-pAST-RelocateIO = (IOADDRESS)(PCI_REGION_BASE(pAST-PciInfo, 2, 
REGION_IO) + pAST-IODBase);
 
if (pAST-pEnt-device-MemBase != 0) {
   pAST-FBPhysAddr = pAST-pEnt-device-MemBase;
-- 
1.8.4.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 driver/ast 13/15] Fix ABI version conflict in xf86UnclaimPciSlot()

2014-04-24 Thread Egbert Eich
From: Egbert Eich e...@suse.de

xf86UnclaimPciSlot() received a GDevPtr as 2nd argument with
ABI_VIDEODRV_VERSION 13.

Signed-off-by: Egbert Eich e...@suse.de
---
 src/ast_driver.c | 6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/ast_driver.c b/src/ast_driver.c
index b6accbf..be1ac0f 100644
--- a/src/ast_driver.c
+++ b/src/ast_driver.c
@@ -281,7 +281,11 @@ ASTProbe(DriverPtr drv, int flags)
pPci-device_id, pPci-bus, pPci-domain, 
pPci-dev, pPci-func);
 xf86DrvMsg(0, X_ERROR,
ast: This driver cannot operate until it has 
been unloaded.\n);
-xf86UnclaimPciSlot(pPci, devSections[0]);
+xf86UnclaimPciSlot(pPci
+#if GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) = 13
+  , devSections[0]
+#endif
+  );
 free(devSections);
 return FALSE;
 }
-- 
1.8.4.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] arch: Fix image and bitmap byte order for ppc64le

2014-02-25 Thread Egbert Eich
On Mon, Feb 24, 2014 at 11:18:27AM +0100, Mark Kettenis wrote:
  X-Original-To: xorg-devel@lists.x.org
  From: Egbert Eich e...@freedesktop.org
  Date: Mon, 24 Feb 2014 10:57:23 +0100
  
  From: Dinar Valeev dval...@suse.com
  
  So far PPC was big endian for sure. For ppc64le this is no longer
  true.
 
 Isn't it safer to revert the logic?  I'm not sure all
 compilers/platforms define __BIG_ENDIAN__ when appropriate, and in
 that case existing working PowerPC platforms will get the wrong byte
 orders.  So something like:

I've used the __BIG_ENDIAN__ define before to differentiate between
the two most common endianesses and it has always worked - also on
PPC (BE). But to make sure there is no breakage I will send a new
patch.

Cheers,
Egbert.
___
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] arch: Fix image and bitmap byte order for ppc64le

2014-02-24 Thread Egbert Eich
From: Dinar Valeev dval...@suse.com

So far PPC was big endian for sure. For ppc64le this is no longer
true.

Signed-off-by: Egbert Eich e...@freedesktop.org
---
 include/servermd.h | 9 +++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/include/servermd.h b/include/servermd.h
index 11f6c10..360b701 100644
--- a/include/servermd.h
+++ b/include/servermd.h
@@ -114,8 +114,13 @@ SOFTWARE.
 
 #if defined(__powerpc__) || defined(__ppc__) || defined(__ppc64__)
 
-#define IMAGE_BYTE_ORDERMSBFirst
-#define BITMAP_BIT_ORDERMSBFirst
+# if defined(__BIG_ENDIAN__)
+#  define IMAGE_BYTE_ORDER  MSBFirst
+#  define BITMAP_BIT_ORDER  MSBFirst
+# else
+#  define IMAGE_BYTE_ORDER  LSBFirst
+#  define BITMAP_BIT_ORDER  LSBFirst
+# endif
 #define GLYPHPADBYTES   4
 
 #endif  /* PowerPC */
-- 
1.8.4.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 v2] arch: Fix image and bitmap byte order for ppc64le

2014-02-24 Thread Egbert Eich
From: Dinar Valeev dval...@suse.com

So far PPC was big endian for sure. For ppc64le this is no longer
true.

Signed-off-by: Egbert Eich e...@freedesktop.org
---
 include/servermd.h | 9 +++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/include/servermd.h b/include/servermd.h
index 11f6c10..256d84b 100644
--- a/include/servermd.h
+++ b/include/servermd.h
@@ -114,8 +114,13 @@ SOFTWARE.
 
 #if defined(__powerpc__) || defined(__ppc__) || defined(__ppc64__)
 
-#define IMAGE_BYTE_ORDERMSBFirst
-#define BITMAP_BIT_ORDERMSBFirst
+#if defined(__LITTLE_ENDIAN__)
+#define IMAGE_BYTE_ORDER  LSBFirst
+#define BITMAP_BIT_ORDER  LSBFirst
+#else
+#define IMAGE_BYTE_ORDER  MSBFirst
+#define BITMAP_BIT_ORDER  MSBFirst
+#endif
 #define GLYPHPADBYTES   4
 
 #endif  /* PowerPC */
-- 
1.8.4.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 app/xev v2] Add event filter for button events

2014-02-12 Thread Egbert Eich
Signed-off-by: Egbert Eich e...@freedesktop.org
---
 man/xev.man | 2 +-
 xev.c   | 5 -
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/man/xev.man b/man/xev.man
index 4edec10..ba70463 100644
--- a/man/xev.man
+++ b/man/xev.man
@@ -62,7 +62,7 @@ The
 option can be specified multiple times to select multiple types of events.
 When not specified, all events are selected.
 Available event masks: keyboard mouse expose visibility structure substructure
-focus property colormap owner_grab_button randr
+focus property colormap owner_grab_button randr button
 .TP 8
 .B \-version
 This option prints the program version and exits.
diff --git a/xev.c b/xev.c
index 45c283f..6cde09a 100644
--- a/xev.c
+++ b/xev.c
@@ -890,7 +890,7 @@ usage (const char *errmsg)
 -event event_mask   select 'event_mask' events,
Supported event masks: keyboard mouse expose visibility structure,
   substructure focus property colormap,
-  owner_grab_button randr,
+  owner_grab_button randr button,
This option can be specified multiple times to select multiple,
event masks.,
 ,
@@ -940,6 +940,9 @@ parse_event_mask (const char *s, long event_masks[])
   LeaveWindowMask | PointerMotionMask | Button1MotionMask |
   Button2MotionMask | Button3MotionMask | Button4MotionMask |
   Button5MotionMask | ButtonMotionMask },
+   { button,
+  EVENT_MASK_INDEX_CORE,
+  ButtonPressMask | ButtonReleaseMask },
 { expose,
   EVENT_MASK_INDEX_CORE,
   ExposureMask },
-- 
1.8.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 app/xev] Add event filter for motion and button events

2014-02-11 Thread Egbert Eich
Signed-off-by: Egbert Eich e...@freedesktop.org
---
 man/xev.man |  2 +-
 xev.c   | 10 +-
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/man/xev.man b/man/xev.man
index 4edec10..b6cb476 100644
--- a/man/xev.man
+++ b/man/xev.man
@@ -62,7 +62,7 @@ The
 option can be specified multiple times to select multiple types of events.
 When not specified, all events are selected.
 Available event masks: keyboard mouse expose visibility structure substructure
-focus property colormap owner_grab_button randr
+focus property colormap owner_grab_button randr motion button
 .TP 8
 .B \-version
 This option prints the program version and exits.
diff --git a/xev.c b/xev.c
index 45c283f..31ca018 100644
--- a/xev.c
+++ b/xev.c
@@ -890,7 +890,7 @@ usage (const char *errmsg)
 -event event_mask   select 'event_mask' events,
Supported event masks: keyboard mouse expose visibility structure,
   substructure focus property colormap,
-  owner_grab_button randr,
+  owner_grab_button randr button motion,
This option can be specified multiple times to select multiple,
event masks.,
 ,
@@ -940,6 +940,14 @@ parse_event_mask (const char *s, long event_masks[])
   LeaveWindowMask | PointerMotionMask | Button1MotionMask |
   Button2MotionMask | Button3MotionMask | Button4MotionMask |
   Button5MotionMask | ButtonMotionMask },
+{ motion,
+  EVENT_MASK_INDEX_CORE,
+  PointerMotionMask | Button1MotionMask |
+  Button2MotionMask | Button3MotionMask | Button4MotionMask |
+  Button5MotionMask | ButtonMotionMask },
+   { button,
+  EVENT_MASK_INDEX_CORE,
+  ButtonPressMask | ButtonReleaseMask },
 { expose,
   EVENT_MASK_INDEX_CORE,
   ExposureMask },
-- 
1.8.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


Re: [PATCH] DIX/ConfineTo: Improve algorithm to jump to the nearest point inside

2014-02-09 Thread Egbert Eich
Hi Keith,

sorry for delaying this. I was occupied with other things and
therefore wanted to wait for a bigger time window.

On Fri, Oct 04, 2013 at 04:07:28PM -0700, Keith Packard wrote:
 Egbert Eich e...@freedesktop.org writes:
 
  ConfineToShape does not work well: The cursor often times doesn't jump
  to the point closest to the current cursor position outside the shape.
  This patch fixes this.
 
 I came up with something a bit simpler which confines the point to each
 box in the region and then picks the result which moves the cursor the
 shortest distance. I think it would generate the same result, but I
 stuck a bunch of range tests in the distance computation to avoid
 overflow in weird cases. Dunno if you like this better or not?

Yeah, it's definitely simpler and it is doing the same thing.
It tests for the opposite condition and therefore doesn't need 
as many test cases.

Something else I noticed: If the pointer is placed outside the horizontal
and vertical strips determined by the bounding box of the window, placement 
is still wrong.
This is due to the clamping of the cursor coordinates to the bounding box on
grabs. For shaped windows - at least with the new ConfineTo in place - this
clamping seems not to be required.
A patch will follow.

 
 commit d8a52a3a3b5bc4a1ff0a986e87dd6c36366e531b
 Author: Keith Packard kei...@keithp.com
 Date:   Fri Oct 4 16:00:49 2013 -0700
 
 Improved ConfineToShape
 
 Find the box within the region which is closest to the point and move
 there.
 
 Signed-off-by: Keith Packard kei...@keithp.com
 
 diff --git a/dix/events.c b/dix/events.c
 index 086601a..8610e60 100644
 --- a/dix/events.c
 +++ b/dix/events.c
 @@ -667,37 +667,62 @@ SetCriticalEvent(int event)
  criticalEvents[event  3] |= 1  (event  7);
  }
  
 +static uint32_t
 +ConfineToBox(int x, int y, BoxPtr box, int *px, int16_t *py)

^^
   You probably want to use an int here or fix the other types
   as well. As it is it will produce a big compiler warning.
   I see your point here, you wanted to make sure that the 
   distance ^ 2 still fits into an int. But this is already
   done by clamping dx and dy to 32767.

 +{
 +int dx, dy;
 +
 +*px = x;
 +*py = y;
 +
 +if (*px  box-x1)
 +*px = box-x1;
 +else if (*px = box-x2)
 +*px = box-x2 - 1;
 +
 +if (*py  box-y1)
 +*py = box-y1;
 +else if (*py = box-y2)
 +*py = box-y2 - 1;
 +
 +dx = x - *px;
 +if (dx  0) dx = -dx;
 +if (dx  32767)
 +dx = 32767;
 +dy = y - *py;
 +if (dy  0) dy = -dy;
 +if (dy  32767)
 +dy = 32767;
 +
 +return (uint32_t) dx * (uint32_t) dx + (uint32_t) dy * (uint32_t) dy;
 +}
 +
  void
  ConfineToShape(DeviceIntPtr pDev, RegionPtr shape, int *px, int *py)
  {
 -BoxRec box;
 +BoxPtr box;
 +int nbox;
  int x = *px, y = *py;
 -int incx = 1, incy = 1;
 +int bx, by;
 +uint32_t box_dist_2;
 +int best_x, best_y;
 +uint32_t best_dist_2;
 +int i;
  
 -if (RegionContainsPoint(shape, x, y, box))
 +if (RegionContainsPoint(shape, x, y, NULL))
  return;
 -box = *RegionExtents(shape);
 -/* this is rather crude */
 -do {
 -x += incx;
 -if (x = box.x2) {
 -incx = -1;
 -x = *px - 1;
 -}
 -else if (x  box.x1) {
 -incx = 1;
 -x = *px;
 -y += incy;
 -if (y = box.y2) {
 -incy = -1;
 -y = *py - 1;
 -}
 -else if (y  box.y1)
 -return; /* should never get here! */
 +box = REGION_RECTS(shape);

You probably intended to do:

   nbox = REGION_NUM_RECTS(shape);
   for (i = 0; i  nbox; i++) {
   

 +for (i = 0; i  REGION_NUM_RECTS(shape); i++) {
 +box_dist_2 = ConfineToBox(x, y, box[i], bx, by);


[..]

Cheers,
Egbert.
___
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] XDMCP: For IPv6 add IPv6 link local addresses to the end of the list

2014-02-08 Thread Egbert Eich
On Sat, Feb 08, 2014 at 08:58:34PM +0600, Alexander E. Patrakov wrote:
 
 I have looked, and I have some remarks.

Thanks for doing so!

 
 First, there is an almost identical copy-paste between the two places where
 entries are added to linklocal_list. Maybe it's worth making that a
 function? And why the difference between IN6_IS_ADDR_LINKLOCAL in one place
 and +IN6_IS_ADDR_LINKLOCAL in the other?
 
 Second, that piece doesn't deal with realloc failures.

Right.

 
 Third, the commit message does not reassure the readers that XDMCP over
 link-local addresses works at all (I have not tried this) and is a
 supportable configuration. If any of these conditions are false, then let's
 just drop these addresses, like we do with IN6_IS_ADDR_LOOPBACK.

AFAIR they don't. This was why this issue had popped up.

 
 ... OK, actually I have tested IPv6 UDP communication using link-local
 addresses using netcat6. It doesn't work (-EINVAL on bind() that is used to
 set the source address and port), so I will be very much surprised if XDMCP
 works. If that requirement did not violate the list rules, I would even
 require a tcpdump capture of a successful XDMCP session and some X11 traffic
 along with the patch.

Ok, it's been a while and I didn't write the patch but I believe the whole
reason for this patch was to move the link-local addresses out of the way
ie. at the end of the list where they don't bother anybody.
Therefore dropping them would also be an option - codewise it would be simpler
and address most of the other concerns voiced.

Reinhard, what do you thing?

Thanks for reviewing!

Cheers,
Egbert.
___
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] XDMCP: For IPv6 add IPv6 link local addresses to the end of the list

2014-02-08 Thread Egbert Eich
On Sat, Feb 08, 2014 at 07:45:54PM +0100, Egbert Eich wrote:
  ... OK, actually I have tested IPv6 UDP communication using link-local
  addresses using netcat6. It doesn't work (-EINVAL on bind() that is used to
  set the source address and port), so I will be very much surprised if XDMCP
  works. If that requirement did not violate the list rules, I would even
  require a tcpdump capture of a successful XDMCP session and some X11 traffic
  along with the patch.
 
 Ok, it's been a while and I didn't write the patch but I believe the whole
 reason for this patch was to move the link-local addresses out of the way
 ie. at the end of the list where they don't bother anybody.
 Therefore dropping them would also be an option - codewise it would be simpler
 and address most of the other concerns voiced.
 

In fact, I've rechecked and we are now using a much simpler patch which does 
drop the link local address rather than fiddling with the order. This seems to
have been used for quite a while now.
I've ported this to the current Xserver head.
See attachment - would this be ok?

Cheers,
Egbert.
From e2e0c678592478c2b1449b0008aa5e4fb0717ace Mon Sep 17 00:00:00 2001
From: Reinhard Max m...@suse.de
Date: Sat, 8 Feb 2014 19:32:08 +0100
Subject: [PATCH] XDMCP: Ignore IPv6 link local addresses

Ignore IPv6 link local addresses (fe80::/10), because
they need a scope identifier, which we have no way
of telling to the other end.

Signed-off-by: Egbert Eich e...@freedesktop.org
---
 os/access.c | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/os/access.c b/os/access.c
index e8c0781..1a2df34 100644
--- a/os/access.c
+++ b/os/access.c
@@ -600,7 +600,8 @@ DefineSelf(int fd)
 continue;
 #if defined(IPv6)  defined(AF_INET6)
 else if (family == FamilyInternet6 
- IN6_IS_ADDR_LOOPBACK((struct in6_addr *) addr))
+ (IN6_IS_ADDR_LOOPBACK((struct in6_addr *) addr) ||
+  IN6_IS_ADDR_LINKLOCAL((struct in6_addr *)addr)))
 continue;
 #endif
 
@@ -733,7 +734,8 @@ DefineSelf(int fd)
 continue;
 #if defined(IPv6)  defined(AF_INET6)
 else if (family == FamilyInternet6 
- IN6_IS_ADDR_LOOPBACK((struct in6_addr *) addr))
+ (IN6_IS_ADDR_LOOPBACK((struct in6_addr *) addr) ||
+  IN6_IS_ADDR_LINKLOCAL((struct in6_addr *)addr)))
 continue;
 #endif
 XdmcpRegisterConnection(family, (char *) addr, len);
-- 
1.8.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

Re: [PATCH] XDMCP: For IPv6 add IPv6 link local addresses to the end of the list

2014-02-08 Thread Egbert Eich
On Sun, Feb 09, 2014 at 01:51:58AM +0600, Alexander E. Patrakov wrote:
 
 Not tested, but looks OK. Although, if I were you, I'd replace no way of
 telling to the other end with no way of guessing for the other end in the
 commit message. But I don't insist.
 
 Even if the protocol had the field for that, there is simply no information
 available on any other host to fill it correctly.
 

Thanks for looking into this!

Ok, I've made the commit message a bit more precise also taking into account
your suggestion (see attachment).
Would you add your Reviewed-By: ?

Cheers,
Egbert.
From d1c228d21f5d6ff99fd025d08e85658f1c2c05f0 Mon Sep 17 00:00:00 2001
From: Reinhard Max m...@suse.de
Date: Sat, 8 Feb 2014 19:32:08 +0100
Subject: [PATCH] XDMCP: Ignore IPv6 link local addresses

Ignore IPv6 link local addresses (fe80::/10), because
the other end would need a scope identifier to determine
the interface, which it has no way to guess.

Signed-off-by: Egbert Eich e...@freedesktop.org
---
 os/access.c | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/os/access.c b/os/access.c
index e8c0781..1a2df34 100644
--- a/os/access.c
+++ b/os/access.c
@@ -600,7 +600,8 @@ DefineSelf(int fd)
 continue;
 #if defined(IPv6)  defined(AF_INET6)
 else if (family == FamilyInternet6 
- IN6_IS_ADDR_LOOPBACK((struct in6_addr *) addr))
+ (IN6_IS_ADDR_LOOPBACK((struct in6_addr *) addr) ||
+  IN6_IS_ADDR_LINKLOCAL((struct in6_addr *)addr)))
 continue;
 #endif
 
@@ -733,7 +734,8 @@ DefineSelf(int fd)
 continue;
 #if defined(IPv6)  defined(AF_INET6)
 else if (family == FamilyInternet6 
- IN6_IS_ADDR_LOOPBACK((struct in6_addr *) addr))
+ (IN6_IS_ADDR_LOOPBACK((struct in6_addr *) addr) ||
+  IN6_IS_ADDR_LINKLOCAL((struct in6_addr *)addr)))
 continue;
 #endif
 XdmcpRegisterConnection(family, (char *) addr, len);
-- 
1.8.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

Re: [PATCH] DIX/ConfineTo: Improve algorithm to jump to the nearest point inside

2014-02-07 Thread Egbert Eich
Hi Keith,

sorry for delaying this. I was occupied with other things and
therefore wanted to wait for a bigger time window.

On Fri, Oct 04, 2013 at 04:07:28PM -0700, Keith Packard wrote:
 Egbert Eich e...@freedesktop.org writes:
 
  ConfineToShape does not work well: The cursor often times doesn't jump
  to the point closest to the current cursor position outside the shape.
  This patch fixes this.
 
 I came up with something a bit simpler which confines the point to each
 box in the region and then picks the result which moves the cursor the
 shortest distance. I think it would generate the same result, but I
 stuck a bunch of range tests in the distance computation to avoid
 overflow in weird cases. Dunno if you like this better or not?

Yeah, it's definitely simpler and it is doing the same thing.
It tests for the opposite condition and therefore doesn't need 
as many test cases.

Something else I noticed: If the pointer is placed outside the horizontal
and vertical strips determined by the bounding box of the window, placement 
is still wrong.
This is due to the clamping of the cursor coordinates to the bounding box on
grabs. For shaped windows - at least with the new ConfineTo in place - this
clamping seems not to be required.
A patch will follow.

 
 commit d8a52a3a3b5bc4a1ff0a986e87dd6c36366e531b
 Author: Keith Packard kei...@keithp.com
 Date:   Fri Oct 4 16:00:49 2013 -0700
 
 Improved ConfineToShape
 
 Find the box within the region which is closest to the point and move
 there.
 
 Signed-off-by: Keith Packard kei...@keithp.com
 
 diff --git a/dix/events.c b/dix/events.c
 index 086601a..8610e60 100644
 --- a/dix/events.c
 +++ b/dix/events.c
 @@ -667,37 +667,62 @@ SetCriticalEvent(int event)
  criticalEvents[event  3] |= 1  (event  7);
  }
  
 +static uint32_t
 +ConfineToBox(int x, int y, BoxPtr box, int *px, int16_t *py)

^^
   You probably want to use an int here or fix the other types
   as well. As it is it will produce a big compiler warning.
   I see your point here, you wanted to make sure that the 
   distance ^ 2 still fits into an int. But this is already
   done by clamping dx and dy to 32767.

 +{
 +int dx, dy;
 +
 +*px = x;
 +*py = y;
 +
 +if (*px  box-x1)
 +*px = box-x1;
 +else if (*px = box-x2)
 +*px = box-x2 - 1;
 +
 +if (*py  box-y1)
 +*py = box-y1;
 +else if (*py = box-y2)
 +*py = box-y2 - 1;
 +
 +dx = x - *px;
 +if (dx  0) dx = -dx;
 +if (dx  32767)
 +dx = 32767;
 +dy = y - *py;
 +if (dy  0) dy = -dy;
 +if (dy  32767)
 +dy = 32767;
 +
 +return (uint32_t) dx * (uint32_t) dx + (uint32_t) dy * (uint32_t) dy;
 +}
 +
  void
  ConfineToShape(DeviceIntPtr pDev, RegionPtr shape, int *px, int *py)
  {
 -BoxRec box;
 +BoxPtr box;
 +int nbox;
  int x = *px, y = *py;
 -int incx = 1, incy = 1;
 +int bx, by;
 +uint32_t box_dist_2;
 +int best_x, best_y;
 +uint32_t best_dist_2;
 +int i;
  
 -if (RegionContainsPoint(shape, x, y, box))
 +if (RegionContainsPoint(shape, x, y, NULL))
  return;
 -box = *RegionExtents(shape);
 -/* this is rather crude */
 -do {
 -x += incx;
 -if (x = box.x2) {
 -incx = -1;
 -x = *px - 1;
 -}
 -else if (x  box.x1) {
 -incx = 1;
 -x = *px;
 -y += incy;
 -if (y = box.y2) {
 -incy = -1;
 -y = *py - 1;
 -}
 -else if (y  box.y1)
 -return; /* should never get here! */
 +box = REGION_RECTS(shape);

You probably intended to do:

   nbox = REGION_NUM_RECTS(shape);
   for (i = 0; i  nbox; i++) {
   

 +for (i = 0; i  REGION_NUM_RECTS(shape); i++) {
 +box_dist_2 = ConfineToBox(x, y, box[i], bx, by);


[..]

Cheers,
Egbert.
___
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/ConfineTo] Don't bother about the bounding box when grabbing a shaped window

2014-02-07 Thread Egbert Eich
Limiting the the cursor coordinates on the bounding box of a shaped
window before applying ConfineTo leads to strange cursor placement
when the pointer is located outside  the vertial and horizontal
strip of this bounding box.
Ignoring the bounding box when a shape is set leads to the correct
behavior.

Signed-off-by: Egbert Eich e...@freedesktop.org
---
 dix/events.c | 78 +---
 1 file changed, 43 insertions(+), 35 deletions(-)

diff --git a/dix/events.c b/dix/events.c
index 8d7d12b..d3b4609 100644
--- a/dix/events.c
+++ b/dix/events.c
@@ -758,17 +758,19 @@ CheckPhysLimits(DeviceIntPtr pDev, CursorPtr cursor, Bool 
generateEvents,
 (*pScreen-ConstrainCursor) (pDev, pScreen, pSprite-physLimits);
 }
 
-/* constrain the pointer to those limits */
-if (new.x  pSprite-physLimits.x1)
-new.x = pSprite-physLimits.x1;
-else if (new.x = pSprite-physLimits.x2)
-new.x = pSprite-physLimits.x2 - 1;
-if (new.y  pSprite-physLimits.y1)
-new.y = pSprite-physLimits.y1;
-else if (new.y = pSprite-physLimits.y2)
-new.y = pSprite-physLimits.y2 - 1;
 if (pSprite-hotShape)
 ConfineToShape(pDev, pSprite-hotShape, new.x, new.y);
+else {
+/* constrain the pointer to those limits */
+if (new.x  pSprite-physLimits.x1)
+new.x = pSprite-physLimits.x1;
+else if (new.x = pSprite-physLimits.x2)
+new.x = pSprite-physLimits.x2 - 1;
+if (new.y  pSprite-physLimits.y1)
+new.y = pSprite-physLimits.y1;
+else if (new.y = pSprite-physLimits.y2)
+new.y = pSprite-physLimits.y2 - 1;
+}
 if ((
 #ifdef PANORAMIX
 noPanoramiXExtension 
@@ -919,7 +921,8 @@ ConfineCursorToWindow(DeviceIntPtr pDev, WindowPtr pWin, 
Bool generateEvents,
 return;
 }
 #endif
-pSprite-hotLimits = *RegionExtents(pWin-borderSize);
+if (!wBoundingShape(pWin))
+pSprite-hotLimits = *RegionExtents(pWin-borderSize);
 pSprite-hotShape = wBoundingShape(pWin) ? pWin-borderSize
 : NullRegion;
 CheckPhysLimits(pDev, pSprite-current, generateEvents,
@@ -3083,17 +3086,19 @@ CheckMotion(DeviceEvent *ev, DeviceIntPtr pDev)
 
 pSprite-hot.x = ev-root_x;
 pSprite-hot.y = ev-root_y;
-if (pSprite-hot.x  pSprite-physLimits.x1)
-pSprite-hot.x = pSprite-physLimits.x1;
-else if (pSprite-hot.x = pSprite-physLimits.x2)
-pSprite-hot.x = pSprite-physLimits.x2 - 1;
-if (pSprite-hot.y  pSprite-physLimits.y1)
-pSprite-hot.y = pSprite-physLimits.y1;
-else if (pSprite-hot.y = pSprite-physLimits.y2)
-pSprite-hot.y = pSprite-physLimits.y2 - 1;
 if (pSprite-hotShape)
 ConfineToShape(pDev, pSprite-hotShape, pSprite-hot.x,
pSprite-hot.y);
+else {
+if (pSprite-hot.x  pSprite-physLimits.x1)
+pSprite-hot.x = pSprite-physLimits.x1;
+else if (pSprite-hot.x = pSprite-physLimits.x2)
+pSprite-hot.x = pSprite-physLimits.x2 - 1;
+if (pSprite-hot.y  pSprite-physLimits.y1)
+pSprite-hot.y = pSprite-physLimits.y1;
+else if (pSprite-hot.y = pSprite-physLimits.y2)
+pSprite-hot.y = pSprite-physLimits.y2 - 1;
+}
 pSprite-hotPhys = pSprite-hot;
 
 if ((pSprite-hotPhys.x != ev-root_x) ||
@@ -3560,17 +3565,18 @@ XineramaWarpPointer(ClientPtr client)
 x += stuff-dstX;
 y += stuff-dstY;
 
-if (x  pSprite-physLimits.x1)
-x = pSprite-physLimits.x1;
-else if (x = pSprite-physLimits.x2)
-x = pSprite-physLimits.x2 - 1;
-if (y  pSprite-physLimits.y1)
-y = pSprite-physLimits.y1;
-else if (y = pSprite-physLimits.y2)
-y = pSprite-physLimits.y2 - 1;
 if (pSprite-hotShape)
 ConfineToShape(PickPointer(client), pSprite-hotShape, x, y);
-
+else {
+if (x  pSprite-physLimits.x1)
+x = pSprite-physLimits.x1;
+else if (x = pSprite-physLimits.x2)
+x = pSprite-physLimits.x2 - 1;
+if (y  pSprite-physLimits.y1)
+y = pSprite-physLimits.y1;
+else if (y = pSprite-physLimits.y2)
+y = pSprite-physLimits.y2 - 1;
+}
 XineramaSetCursorPosition(PickPointer(client), x, y, TRUE);
 
 return Success;
@@ -3663,16 +3669,18 @@ ProcWarpPointer(ClientPtr client)
 y = newScreen-height - 1;
 
 if (newScreen == pSprite-hotPhys.pScreen) {
-if (x  pSprite-physLimits.x1)
-x = pSprite-physLimits.x1;
-else if (x = pSprite-physLimits.x2)
-x = pSprite-physLimits.x2 - 1;
-if (y  pSprite-physLimits.y1)
-y = pSprite-physLimits.y1;
-else if (y = pSprite-physLimits.y2)
-y = pSprite-physLimits.y2 - 1;
 if (pSprite-hotShape

[PATCH app/scripts] Add ssh support to 'xon'

2014-02-07 Thread Egbert Eich
'xon' has been around for ages, it's a small script that can be used
to start any xclient remotely.
It did so by opening a shell connection using 'rsh' or 'rcmd' to
connect to the remote system. Today (hopefully) nobody has rsh
installed any more for security reasons.
'ssh' has become the remote login tool of chioce which also allows
to tunnel the X protocol over a secure channel.
This patch adds ssh support to xon to make it useful again.

Signed-off-by: Egbert Eich e...@freedesktop.org
---

I could be talked into nuking the rsh, rcmd support completely which
would greatly simlify things.


 xon | 61 -
 1 file changed, 48 insertions(+), 13 deletions(-)

diff --git a/xon b/xon
index 772b357..959e0e7 100644
--- a/xon
+++ b/xon
@@ -32,20 +32,27 @@ target=$1
 shift
 label=$target
 resource=xterm-$label
-if [ -f /usr/bin/remsh ]; then
+if [ -x /usr/bin/ssh ]; then
+rsh=/usr/bin/ssh
+elif [ -f /usr/bin/remsh ]; then
 rsh=/usr/bin/remsh
 elif [ -f /usr/bin/rcmd ]; then
 rsh=/usr/bin/rcmd
 else
 rsh=rsh
 fi
-rcmd=$rsh $target -n
-case $DISPLAY in
+case $rsh in
+*ssh) rcmd_args=-Y $target ;;
+*) rcmd_args=$target -n ;;
+esac
+
+display=$DISPLAY
+case $display in
 unix:*)
-   DISPLAY=`echo $DISPLAY | sed 's/unix//'`
+   display=`echo $display | sed 's/unix//'`
;;
 esac
-case $DISPLAY in
+case $display in
 :*)
case `uname` in
Linux*)
@@ -61,10 +68,10 @@ case $DISPLAY in
esac
hostname=`echo $fullname | sed 's/\..*$//'`
if [ $hostname = $target ] || [ $fullname = $target ]; then
-   DISPLAY=$DISPLAY
+   display=$display
rcmd=sh -c
else
-   DISPLAY=$fullname$DISPLAY
+   display=$fullname$display
fi
;;
 esac
@@ -79,17 +86,23 @@ x)
xpath='HOME=${HOME-`pwd`} 
XUSERFILESEARCHPATH=${XUSERFILESEARCHPATH-'$XUSERFILESEARCHPATH'} '
;;
 esac
-redirect=  /dev/null  /dev/null 21 
+debug=n
 command=
 ls=-ls
 continue=:
+remote_background=
+rcmd_background_arg=
+
 while $continue; do
case $1 in
-remote)
shift
if [ $rsh != sh ]; then
rsh=$1
-   rcmd=$rsh $target -n
+   case $rsh in
+   *ssh) rcmd_args=-fY $target ;;
+   *) rcmd_args=$target -n ;;
+   esac
fi
shift;;
-user)
@@ -102,7 +115,10 @@ while $continue; do
 
username=-l $1
label=$target $1
-   rcmd=$rsh $target $username -n
+   case $rsh in
+   *ssh) rcmd_args=-Y ${username}@${target} ;;
+   *) rcmd_args=$rsh $target $username -n ;;
+   esac
shift
case x$XAUTHORITY in
x)
@@ -139,7 +155,7 @@ while $continue; do
;;
-debug)
shift
-   redirect=
+   debug=y
;;
-screen)
shift
@@ -149,7 +165,7 @@ while $continue; do
usage -screen option requires an argument
fi
 
-   DISPLAY=`echo $DISPLAY | sed 
's/:\\([0-9][0-9]*\\)\\.[0-9]/:\1/'`.$1
+   display=`echo $display | sed 
's/:\\([0-9][0-9]*\\)\\.[0-9]/:\1/'`.$1
shift
;;
*)
@@ -171,7 +187,26 @@ x*)
sess_mangr=SESSION_MANAGER=$SESSION_MANAGER 
;;
 esac
-vars='PATH=${PATH:+$PATH:}/usr/X11R6/bin 
'$xpath$xauth$sess_mangrDISPLAY=$DISPLAY
+vars='PATH=${PATH:+$PATH:}/usr/X11R6/bin '$xpath$xauth$sess_mangr
+case $rsh in
+*ssh) 
+   rcmd_background_arg=-f 
+   ;;
+*) 
+   remote_background=;
+   DISPLAY=$display
+   vars=${vars}DISPLAY=$DISPLAY 
+   ;;
+esac
+
+if [ $debug = n ]
+then
+rcmd_args=$rcmd_background_arg$rcmd_args
+redirect=  /dev/null  /dev/null 21 $remote_background
+fi
+
+[ z = z$rcmd ]  rcmd=$rsh $rcmd_args
+
 case $# in
 0)
$rcmd 'sh -c ''$vars' xterm '$ls' -name '$resource' -T 
'$label' -n '$label' '$redirect'
-- 
1.8.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


Re: [PATCH] XDMCP: For IPv6 add IPv6 link local addresses to the end of the list

2014-02-07 Thread Egbert Eich
It would be nice if someone took a look at this issue. So far
noone has commented on this patch.

Cheers,
Egbert.


On Wed, Aug 14, 2013 at 06:17:59PM +0200, Egbert Eich wrote:
 From: Reinhard Max m...@suse.de
 
 For IPv6 add a link local addresses to the end of the list passed to
 the XDMCP servers.
 Reason: for link local addresses the XDMCP server would need to either
 know the interface thru a scope identifier or try all available interfaces.
 If they don't this address will fail in which case the XDMCP server
 could still try the other addresses passed - however some only try
 the first address and then give up.
 Even if this seems to be the wrong place to fix this it seems to be
 easier than fixing all display servers.
 
 Signed-off-by: Egbert Eich e...@freedesktop.org
 ---
  os/access.c | 45 +
  1 file changed, 45 insertions(+)
 
 diff --git a/os/access.c b/os/access.c
 index 88a44d9..2767fe3 100644
 --- a/os/access.c
 +++ b/os/access.c
 @@ -505,6 +505,12 @@ DefineSelf(int fd)
  unsigned char *addr;
  int family;
  register HOST *host;
 +struct ipv6_locallink {
 +unsigned char *addr;
 +int len;
 +} *linklocal_list = NULL;
 +int num_linklocals = 0;
 +int i;
  
  #ifndef HAVE_GETIFADDRS
  
 @@ -602,6 +608,20 @@ DefineSelf(int fd)
  else if (family == FamilyInternet6 
   IN6_IS_ADDR_LOOPBACK((struct in6_addr *) addr))
  continue;
 +/* Register IPv6 link local addresses (fe80::/10) at the end,
 + * because they need a scope identifier, which we have no way
 + * of telling to the other end.
 + */
 +
 +if (family == FamilyInternet6 
 +IN6_IS_ADDR_LINKLOCAL((struct in6_addr *)addr)) {
 +linklocal_list = realloc(linklocal_list,
 + sizeof(struct ipv6_locallink)
 + * ++num_linklocals);
 +linklocal_list[num_linklocals - 1].len = len;
 +linklocal_list[num_linklocals - 1].addr = addr;
 +continue;
 +}
  #endif
  
  /*
 @@ -667,6 +687,11 @@ DefineSelf(int fd)
  }
  #endif  /* XDMCP */
  }
 +for (i = 0; i  num_linklocals; i++)
 +XdmcpRegisterConnection (FamilyInternet6,
 + (char *)linklocal_list[i].addr,
 + linklocal_list[i].len);
 +
  if (bufptr != buf)
  free(bufptr);
  #else   /* HAVE_GETIFADDRS */
 @@ -735,6 +760,19 @@ DefineSelf(int fd)
  else if (family == FamilyInternet6 
   IN6_IS_ADDR_LOOPBACK((struct in6_addr *) addr))
  continue;
 +/* Register IPv6 link local addresses (fe80::/10) at the end,
 + * because they need a scope identifier, which we have no way
 + * of telling to the other end.
 + */
 +if (family == FamilyInternet6 
 ++IN6_IS_ADDR_LINKLOCAL((struct in6_addr *)addr)) {
 +linklocal_list = realloc(linklocal_list,
 + sizeof(struct ipv6_locallink)
 + * ++num_linklocals);
 +linklocal_list[num_linklocals - 1].len = len;
 +linklocal_list[num_linklocals - 1].addr = addr;
 +continue;
 +}
  #endif
  XdmcpRegisterConnection(family, (char *) addr, len);
  #if defined(IPv6)  defined(AF_INET6)
 @@ -752,9 +790,16 @@ DefineSelf(int fd)
  #endif  /* XDMCP */
  
  }   /* for */
 +
 +for (i = 0; i  num_linklocals; i++)
 +XdmcpRegisterConnection (FamilyInternet6,
 + (char *)linklocal_list[i].addr,
 + linklocal_list[i].len);
  freeifaddrs(ifap);
  #endif  /* HAVE_GETIFADDRS */
  
 +free(linklocal_list);
 +
  /*
   * add something of FamilyLocalHost
   */
 -- 
 1.8.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 2/2] libxf86config: libxf86config_internal - libxf86config

2014-02-07 Thread Egbert Eich
Now since the installable libxf86config is gone, rename
libxf86config_internal to libxf86config.

Signed-off-by: Egbert Eich e...@freedesktop.org
---
 hw/xfree86/Makefile.am| 2 +-
 hw/xfree86/parser/Makefile.am | 4 ++--
 test/Makefile.am  | 2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/hw/xfree86/Makefile.am b/hw/xfree86/Makefile.am
index 9672904..7bb7310 100644
--- a/hw/xfree86/Makefile.am
+++ b/hw/xfree86/Makefile.am
@@ -54,7 +54,7 @@ LOCAL_LIBS = \
 loader/libloader.la \
 common/libcommon.la \
 os-support/libxorgos.la \
-parser/libxf86config_internal.la \
+parser/libxf86config.la \
 dixmods/libdixmods.la \
 modes/libxf86modes.la \
 ramdac/libramdac.la \
diff --git a/hw/xfree86/parser/Makefile.am b/hw/xfree86/parser/Makefile.am
index 3e99b92..d142bcd 100644
--- a/hw/xfree86/parser/Makefile.am
+++ b/hw/xfree86/parser/Makefile.am
@@ -1,4 +1,4 @@
-noinst_LTLIBRARIES = libxf86config_internal.la
+noinst_LTLIBRARIES = libxf86config.la
 
 INTERNAL_SOURCES= \
Device.c \
@@ -19,7 +19,7 @@ INTERNAL_SOURCES= \
DRI.c \
Extensions.c
 
-libxf86config_internal_la_SOURCES = \
+libxf86config_la_SOURCES = \
$(INTERNAL_SOURCES)
 
 AM_CFLAGS = $(DIX_CFLAGS) $(XORG_CFLAGS) \
diff --git a/test/Makefile.am b/test/Makefile.am
index 2852bb3..d87ab7f 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -47,7 +47,7 @@ libxservertest_la_LIBADD += \
 $(top_builddir)/hw/xfree86/loader/libloader.la \
 $(top_builddir)/hw/xfree86/os-support/libxorgos.la \
 $(top_builddir)/hw/xfree86/common/libcommon.la \
-$(top_builddir)/hw/xfree86/parser/libxf86config_internal.la \
+$(top_builddir)/hw/xfree86/parser/libxf86config.la \
 $(top_builddir)/hw/xfree86/dixmods/libdixmods.la \
 $(top_builddir)/hw/xfree86/modes/libxf86modes.la \
 $(top_builddir)/hw/xfree86/ramdac/libramdac.la \
-- 
1.8.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 1/2] libxf86config: Remove

2014-02-07 Thread Egbert Eich
The library used by the Xserver to read and parse the configuration file
could be built so that it culd be installed as a separate lib and used
by external programs.
Apparently there has not been any interest in this for quite a while as
this library has been broken for a long time now in the sense that it
was calling functions provided by the Xserver which were not implemented
for the external library.
Since this library is useless as it is anyway when built let's drop support
for it.

Signed-off-by: Egbert Eich e...@freedesktop.org
---
 configure.ac|  8 
 hw/xfree86/parser/Makefile.am   | 14 --
 hw/xfree86/parser/configProcs.h |  3 +--
 3 files changed, 1 insertion(+), 24 deletions(-)

diff --git a/configure.ac b/configure.ac
index c6764f5..ca85ccf 100644
--- a/configure.ac
+++ b/configure.ac
@@ -558,11 +558,6 @@ AC_ARG_ENABLE(sparkle,AS_HELP_STRING([--enable-sparkle], 
[Enable updating of X11
[ XQUARTZ_SPARKLE=${enableval} ],
[ XQUARTZ_SPARKLE=no ])
 AC_SUBST([XQUARTZ_SPARKLE])
-AC_ARG_ENABLE(install-libxf86config,
-   AS_HELP_STRING([--enable-install-libxf86config],
-   [Install libxf86config (default: disabled)]),
-   [INSTALL_LIBXF86CONFIG=$enableval],
-   [INSTALL_LIBXF86CONFIG=no])
 AC_ARG_ENABLE(visibility, AS_HELP_STRING([--enable-visibility], [Enable 
symbol visibility (default: auto)]),
[SYMBOL_VISIBILITY=$enableval],
[SYMBOL_VISIBILITY=auto])
@@ -695,9 +690,6 @@ AM_CONDITIONAL(INT10_VM86, [test x$INT10 = xvm86])
 AM_CONDITIONAL(INT10_X86EMU, [test x$INT10 = xx86emu])
 AM_CONDITIONAL(INT10_STUB, [test x$INT10 = xstub])
 
-dnl Handle installing libxf86config
-AM_CONDITIONAL(INSTALL_LIBXF86CONFIG, [test x$INSTALL_LIBXF86CONFIG = xyes])
-
 dnl DDX Detection... Yes, it's ugly to have it here... but we need to
 dnl handle this early on so that we don't require unsupported extensions
 case $host_os in
diff --git a/hw/xfree86/parser/Makefile.am b/hw/xfree86/parser/Makefile.am
index 3bf62e8..3e99b92 100644
--- a/hw/xfree86/parser/Makefile.am
+++ b/hw/xfree86/parser/Makefile.am
@@ -1,12 +1,4 @@
-if INSTALL_LIBXF86CONFIG
 noinst_LTLIBRARIES = libxf86config_internal.la
-lib_LTLIBRARIES = libxf86config.la
-LIBHEADERS = \
-   xf86Optrec.h \
-   xf86Parser.h
-else
-noinst_LTLIBRARIES = libxf86config_internal.la
-endif
 
 INTERNAL_SOURCES= \
Device.c \
@@ -30,12 +22,6 @@ INTERNAL_SOURCES= \
 libxf86config_internal_la_SOURCES = \
$(INTERNAL_SOURCES)
 
-libxf86config_la_SOURCES = \
-   $(top_srcdir)/os/xprintf.c \
-   $(INTERNAL_SOURCES)
-libxf86config_la_CFLAGS = $(AM_CFLAGS)
-libxf86config_la_LDFLAGS = -static
-
 AM_CFLAGS = $(DIX_CFLAGS) $(XORG_CFLAGS) \
-DSYSCONFDIR=\$(sysconfdir)\ \
-DDATADIR=\$(datadir)\
diff --git a/hw/xfree86/parser/configProcs.h b/hw/xfree86/parser/configProcs.h
index 60509dc..770a5bc 100644
--- a/hw/xfree86/parser/configProcs.h
+++ b/hw/xfree86/parser/configProcs.h
@@ -27,8 +27,7 @@
 
 /* Private procs.  Public procs are in xf86Parser.h and xf86Optrec.h */
 
-/* exported functions are/were used by the X Server, and need to be
- * made public when installing libxf86config */
+/* exported functions are/were used by the X Server */
 
 /* Device.c */
 XF86ConfDevicePtr xf86parseDeviceSection(void);
-- 
1.8.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


Re: [PATCH] DIX/ConfineTo: Improve algorithm to jump to the nearest point inside

2014-02-07 Thread Egbert Eich
On Fri, Feb 07, 2014 at 11:38:25AM +0100, Egbert Eich wrote:
  
  commit d8a52a3a3b5bc4a1ff0a986e87dd6c36366e531b
  Author: Keith Packard kei...@keithp.com
  Date:   Fri Oct 4 16:00:49 2013 -0700
  
  Improved ConfineToShape
  
  Find the box within the region which is closest to the point and move
  there.
  
  Signed-off-by: Keith Packard kei...@keithp.com
  
   
  +static uint32_t
  +ConfineToBox(int x, int y, BoxPtr box, int *px, int16_t *py)
 
 ^^
You probably want to use an int here or fix the other types
as well. As it is it will produce a big compiler warning.
I see your point here, you wanted to make sure that the 
distance ^ 2 still fits into an int. But this is already
done by clamping dx and dy to 32767.
 
[..]

  +BoxPtr box;
  +int nbox;
   int x = *px, y = *py;
  -int incx = 1, incy = 1;
  +int bx, by;
  +uint32_t box_dist_2;
  +int best_x, best_y;
  -return; /* should never get here! */
  +box = REGION_RECTS(shape);
 
 You probably intended to do:
 
nbox = REGION_NUM_RECTS(shape);
for (i = 0; i  nbox; i++) {

 
  +for (i = 0; i  REGION_NUM_RECTS(shape); i++) {
  +box_dist_2 = ConfineToBox(x, y, box[i], bx, by);
 
 
 [..]
 

And, BTW, with the two points addressed,

Reviewed-By: Egbert Eich e...@freedesktop.org
___
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 v2] OS/ACPI: Make socket to acpid is non-blocking

2013-11-15 Thread Egbert Eich
On Thu, Nov 14, 2013 at 01:20:44PM +0900, Keith Packard wrote:
 Egbert Eich e...@freedesktop.org writes:
 
   static CARD32
   lnxACPICheckTimer(OsTimerPtr timer, CARD32 now, pointer arg)
   {
  +struct timeval timeval = { 0, 0 };
   DebugF(ACPI: trying to reopen\n);
  -if (doLnxACPIOpen()) {
  +if (doLnxACPIOpen(timeval)) {
 
 Does this actually work with a timeout of 0? I'd assume that acpid could
 never accept the connection in time.
 
 A timeout of 100ms or so seems like it'd be a bunch more reliable?

Yes, you're probably correct. If we can rely on that the listener on 
the other side exists when we get EINPROGRESS it's worthwhile waiting
a bit. Stevens/Rago says: At this point the connection is complete.
A quick look at the Linux kernel reveals two things:

1. For UNIX sockets the listner does exist when the connect timeout is 
   checked.
2. UNIX sockets never seem to return EINPROGRESS. In the cases where a
   timeout is exceeded, EAGAIN is returned.

Thus the code path in question seems to be irrelevant - at least on 
Linux. My findings however do beg the question, if we shouldn't also
handle the EAGAIN case.

What do you think?

Cheers,
Egbert.


___
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 v2] OS/ACPI: Make socket to acpid is non-blocking

2013-11-15 Thread Egbert Eich
On Fri, Nov 15, 2013 at 11:25:49AM +0100, Egbert Eich wrote:
 On Thu, Nov 14, 2013 at 01:20:44PM +0900, Keith Packard wrote:
  Egbert Eich e...@freedesktop.org writes:
  
static CARD32
lnxACPICheckTimer(OsTimerPtr timer, CARD32 now, pointer arg)
{
   +struct timeval timeval = { 0, 0 };
DebugF(ACPI: trying to reopen\n);
   -if (doLnxACPIOpen()) {
   +if (doLnxACPIOpen(timeval)) {
  
  Does this actually work with a timeout of 0? I'd assume that acpid could
  never accept the connection in time.
  
  A timeout of 100ms or so seems like it'd be a bunch more reliable?

It seems irrelevant, but I'd give it 30ms as in the lnxACPIOpen() case.

 
 Yes, you're probably correct. If we can rely on that the listener on 
 the other side exists when we get EINPROGRESS it's worthwhile waiting
 a bit. Stevens/Rago says: At this point the connection is complete.
 A quick look at the Linux kernel reveals two things:
 
 1. For UNIX sockets the listner does exist when the connect timeout is 
checked.
 2. UNIX sockets never seem to return EINPROGRESS. In the cases where a
timeout is exceeded, EAGAIN is returned.
 
 Thus the code path in question seems to be irrelevant - at least on 
 Linux. My findings however do beg the question, if we shouldn't also
 handle the EAGAIN case.
 
 What do you think?

In fact we do already. I'm still going to update the patch to improve the 
errno mess a bit.

Cheers,
Egbert.
___
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 v3] OS/ACPI: Make socket to acpid is non-blocking

2013-11-15 Thread Egbert Eich
If a connect to the acpid socket is delayed connect will
hang stalling the Xserver.  To avoid this this create a
non-blocking socket.
If connect returns EINPROGRESS use select() and getsockopt()
to check for completion of the connect request.
Use a different timeout to select() wether we connect for
the first time or reconnect.

Signed-off-by: Egbert Eich e...@freedesktop.org
---
v3: Increase select() timeout when retrying as suggested by
Keith Packard kei...@keithp.com.
Fix some errno confusion.

 hw/xfree86/os-support/linux/lnx_acpi.c | 39 +++---
 1 file changed, 31 insertions(+), 8 deletions(-)

diff --git a/hw/xfree86/os-support/linux/lnx_acpi.c 
b/hw/xfree86/os-support/linux/lnx_acpi.c
index 52cc708..9cbd840 100644
--- a/hw/xfree86/os-support/linux/lnx_acpi.c
+++ b/hw/xfree86/os-support/linux/lnx_acpi.c
@@ -32,7 +32,7 @@
 #define ACPI_VIDEO_HEAD_INVALID(~0u - 1)
 #define ACPI_VIDEO_HEAD_END(~0u)
 
-static PMClose doLnxACPIOpen(void);
+static PMClose doLnxACPIOpen(struct timeval *);
 static void lnxCloseACPI(void);
 static pointer ACPIihPtr = NULL;
 static OsTimerPtr acpiTimer = NULL;
@@ -58,8 +58,9 @@ lnxACPIReopen(OsTimerPtr timer, CARD32 time, pointer arg)
 static CARD32
 lnxACPICheckTimer(OsTimerPtr timer, CARD32 now, pointer arg)
 {
+struct timeval timeval = { 0, 3 };
 DebugF(ACPI: trying to reopen\n);
-if (doLnxACPIOpen()) {
+if (doLnxACPIOpen(timeval)) {
 DebugF(ACPI: successfully reopened\n);
 acpiTimer = NULL;
 return 0;
@@ -146,7 +147,7 @@ lnxACPIConfirmEventToOs(int fd, pmEvent event)
 }
 
 static PMClose
-doLnxACPIOpen(void)
+doLnxACPIOpen(struct timeval *tv_p)
 {
 int fd = -1;
 struct sockaddr_un addr;
@@ -157,17 +158,37 @@ doLnxACPIOpen(void)
 return NULL;
 
 DebugF(ACPI: Opening device\n);
-fd = socket(AF_UNIX, SOCK_STREAM, 0);
+fd = socket(AF_UNIX, SOCK_STREAM | SOCK_NONBLOCK, 0);
 if (fd  -1) {
 memset(addr, 0, sizeof(addr));
 addr.sun_family = AF_UNIX;
 strcpy(addr.sun_path, ACPI_SOCKET);
 r = connect(fd, (struct sockaddr*)addr, sizeof(addr));
 if (r == -1) {
-if (errno != warned)
+int sock_errno = errno;
+if (sock_errno == EINPROGRESS) {
+fd_set fds;
+int result;
+do {
+FD_ZERO(fds);
+FD_SET(fd, fds);
+result = select(fd + 1, NULL, fds, NULL, tv_p);
+}  while (result  0  errno == EINTR);
+if (result  0)
+sock_errno = errno;
+else if (result  0) {
+socklen_t size = sizeof(sock_errno);
+if (0  getsockopt(fd, SOL_SOCKET, SO_ERROR, sock_errno,
+   size))
+sock_errno = errno;
+if (!sock_errno)
+goto success;
+}
+}
+if (sock_errno != warned)
 xf86MsgVerb(X_WARNING,3,Open ACPI failed (%s) (%s)\n,
-ACPI_SOCKET, strerror(errno));
-warned = errno;
+ACPI_SOCKET, strerror(sock_errno));
+warned = sock_errno;
 shutdown(fd, SHUT_RDWR);
 close(fd);
 return NULL;
@@ -175,6 +196,7 @@ doLnxACPIOpen(void)
 } else
 return NULL;
 
+ success:
 xf86PMGetEventFromOs = lnxACPIGetEventFromOs;
 xf86PMConfirmEventToOs = lnxACPIConfirmEventToOs;
 ACPIihPtr = xf86AddGeneralHandler(fd, xf86HandlePMEvents, NULL);
@@ -195,8 +217,9 @@ PMClose
 lnxACPIOpen(void)
 {
 PMClose ret;
+struct timeval timeval = { 0, 3 };
 DebugF(ACPI: OSPMOpen called\n);
-ret = doLnxACPIOpen();
+ret = doLnxACPIOpen(timeval);
 
 return ret;
 }
-- 
1.8.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 v2] DDX/modes: Add a sanity check when using screen sizes from EDID

2013-10-05 Thread Egbert Eich
EDID sometimes lies about screen sizes. Since the screen size is used
by clients to determine the DPI a wrong ration will lead to terrible
looking fonts.
Add a sanity check for the h/v ratio cutting off at 2.4. This would
still accept the cinemascope aspect ratio as valid.
Also add message suggesting to add a quirk table entry.

Signed-off-by: Egbert Eich e...@freedesktop.org
---
 v2: Avoid division in ratio calculation. 
 Pointed out by Keith Packard kei...@keithp.com 

 hw/xfree86/modes/xf86Crtc.c | 20 
 1 file changed, 16 insertions(+), 4 deletions(-)

diff --git a/hw/xfree86/modes/xf86Crtc.c b/hw/xfree86/modes/xf86Crtc.c
index 35845e8..2a02c85 100644
--- a/hw/xfree86/modes/xf86Crtc.c
+++ b/hw/xfree86/modes/xf86Crtc.c
@@ -3045,10 +3045,22 @@ handle_detailed_physical_size(struct 
detailed_monitor_section
 if (det_mon-type == DT 
 det_mon-section.d_timings.h_size != 0 
 det_mon-section.d_timings.v_size != 0) {
-
-p-output-mm_width = det_mon-section.d_timings.h_size;
-p-output-mm_height = det_mon-section.d_timings.v_size;
-p-ret = TRUE;
+/* some sanity checking for aspect ratio:
+   assume any h / v (or v / h)  2.4 to be bogus.
+   This would even include cinemascope */
+if (((det_mon-section.d_timings.h_size * 5) 
+ (det_mon-section.d_timings.v_size * 12)) 
+((det_mon-section.d_timings.v_size * 5) 
+ (det_mon-section.d_timings.h_size * 12))) {
+p-output-mm_width = det_mon-section.d_timings.h_size;
+p-output-mm_height = det_mon-section.d_timings.v_size;
+p-ret = TRUE;
+} else
+xf86DrvMsg(p-output-scrn-scrnIndex, X_WARNING,
+   Output %s: Strange aspect ratio (%i/%i), 
+   consider adding a quirk\n, p-output-name,
+   det_mon-section.d_timings.h_size,
+   det_mon-section.d_timings.v_size);
 }
 }
 
-- 
1.8.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 v2] DDX/fbdevhw: Disable FBIOBLANK ioctl if not supported

2013-10-05 Thread Egbert Eich
Some ioctls may not be supported by the kernel however their failure
is non-fatal to the driver. Unfortunately we only know once we try
to execute the ioctl however the sematics of the fbdev driver API
doesn't allow upper layers to disable the call.
Instead of changing the fbdevHW driver API just disable the call to
this ioctl on the module level when detecting such a case.

Signed-off-by: Egbert Eich e...@freedesktop.org
---
v2: Retry on EINTR and ERESTART. Suggested by Keith Packard kei...@keithp.com

 hw/xfree86/fbdevhw/fbdevhw.c | 49 +++-
 1 file changed, 44 insertions(+), 5 deletions(-)

diff --git a/hw/xfree86/fbdevhw/fbdevhw.c b/hw/xfree86/fbdevhw/fbdevhw.c
index cbb4093..8ddd239 100644
--- a/hw/xfree86/fbdevhw/fbdevhw.c
+++ b/hw/xfree86/fbdevhw/fbdevhw.c
@@ -76,8 +76,14 @@ typedef struct {
 /* buildin video mode */
 DisplayModeRec buildin;
 
+/* disable non-fatal unsupported ioctls */
+CARD32 unsupported_ioctls;
 } fbdevHWRec, *fbdevHWPtr;
 
+enum {
+FBIOBLANK_UNSUPPORTED = 0,
+};
+
 Bool
 fbdevHWGetRec(ScrnInfoPtr pScrn)
 {
@@ -833,6 +839,9 @@ fbdevHWDPMSSet(ScrnInfoPtr pScrn, int mode, int flags)
 if (!pScrn-vtSema)
 return;
 
+if (fPtr-unsupported_ioctls  (1  FBIOBLANK_UNSUPPORTED))
+return;
+
 switch (mode) {
 case DPMSModeOn:
 fbmode = 0;
@@ -850,9 +859,23 @@ fbdevHWDPMSSet(ScrnInfoPtr pScrn, int mode, int flags)
 return;
 }
 
-if (-1 == ioctl(fPtr-fd, FBIOBLANK, (void *) fbmode))
-xf86DrvMsg(pScrn-scrnIndex, X_ERROR,
-   FBIOBLANK: %s\n, strerror(errno));
+RETRY:
+if (-1 == ioctl(fPtr-fd, FBIOBLANK, (void *) fbmode)) {
+switch (errno) {
+case EAGAIN:
+xf86DrvMsg(pScrn-scrnIndex, X_INFO,
+   FBIOBLANK: %s\n, strerror(errno));
+   break;
+case EINTR:
+case ERESTART:
+goto RETRY;
+default:
+fPtr-unsupported_ioctls |= (1  FBIOBLANK_UNSUPPORTED);
+xf86DrvMsg(pScrn-scrnIndex, X_INFO,
+   FBIOBLANK: %s (Screen blanking not supported 
+   by kernel - disabling)\n, strerror(errno));
+}
+}
 }
 
 Bool
@@ -865,11 +888,27 @@ fbdevHWSaveScreen(ScreenPtr pScreen, int mode)
 if (!pScrn-vtSema)
 return TRUE;
 
+if (fPtr-unsupported_ioctls  (1  FBIOBLANK_UNSUPPORTED))
+return FALSE;
+
 unblank = xf86IsUnblank(mode);
 
+RETRY:
 if (-1 == ioctl(fPtr-fd, FBIOBLANK, (void *) (1 - unblank))) {
-xf86DrvMsg(pScrn-scrnIndex, X_ERROR,
-   FBIOBLANK: %s\n, strerror(errno));
+switch (errno) {
+case EAGAIN:
+xf86DrvMsg(pScrn-scrnIndex, X_INFO,
+   FBIOBLANK: %s\n, strerror(errno));
+break;
+case EINTR:
+case ERESTART:
+goto RETRY;
+default:
+fPtr-unsupported_ioctls |= (1  FBIOBLANK_UNSUPPORTED);
+xf86DrvMsg(pScrn-scrnIndex, X_INFO,
+   FBIOBLANK: %s (Screen blanking not supported 
+   by kernel - disabling)\n, strerror(errno));
+}
 return FALSE;
 }
 
-- 
1.8.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 v3] xnest: Ignore GetImage() error in xnestGetImage()

2013-10-05 Thread Egbert Eich
From: Radek Doulik r...@novell.com

When an Xnest instance is not viewable it will crash when a client in
that instance calls GetImage. This is because the Xnest server will
itself receives a BadMatch error.
This patch ignores the error. The application which has requested the
image will receive garbage - this however is fully legal according
to the specs as obscured areas will always contain garbage if there
isn't some sort of backing store as discussed in
https://bugs.freedesktop.org/show_bug.cgi?id=9488
The applied patch is a version from Dadek Doulik.

v2: Call XSync() before changing error handlers as suggested by
Daniel Stone dan...@fooishbar.org.
v3: Don't call Xsync before restoring error handler as any errors
generated by XGetImage() should be processed when this call
returns as suggested by Jamey Sharp ja...@minilop.net

Signed-off-by: Egbert Eich e...@freedesktop.org
---
 hw/xnest/GCOps.c | 13 +
 1 file changed, 13 insertions(+)

diff --git a/hw/xnest/GCOps.c b/hw/xnest/GCOps.c
index e26a136..d00511d 100644
--- a/hw/xnest/GCOps.c
+++ b/hw/xnest/GCOps.c
@@ -94,15 +94,28 @@ xnestPutImage(DrawablePtr pDrawable, GCPtr pGC, int depth, 
int x, int y,
 }
 }
 
+static int
+xnestIgnoreErrorHandler (Display *display,
+ XErrorEvent *event)
+{
+return False; /* return value is ignored */
+}
+
 void
 xnestGetImage(DrawablePtr pDrawable, int x, int y, int w, int h,
   unsigned int format, unsigned long planeMask, char *pImage)
 {
 XImage *ximage;
 int length;
+int (*old_handler)(Display*, XErrorEvent*);
+
+/* we may get BadMatch error when xnest window is minimized */
+XSync(xnestDisplay, False);
+old_handler = XSetErrorHandler (xnestIgnoreErrorHandler);
 
 ximage = XGetImage(xnestDisplay, xnestDrawable(pDrawable),
x, y, w, h, planeMask, format);
+XSetErrorHandler(old_handler);
 
 if (ximage) {
 length = ximage-bytes_per_line * ximage-height;
-- 
1.8.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


Re: [PATCH replace] DDX/fbdevhw: Disable FBIOBLANK ioctl if not supported

2013-10-05 Thread Egbert Eich
On Fri, Oct 04, 2013 at 02:32:30PM -0700, Keith Packard wrote:
 Egbert Eich e...@freedesktop.org writes:
 
  Some ioctls may not be supported by the kernel however their failure
  is non-fatal to the driver. Unfortunately we only know once we try
  to execute the ioctl however the sematics of the fbdev driver API
  doesn't allow upper layers to disable the call.
  Instead of changing the fbdevHW driver API just disable the call to
  this ioctl on the module level when detecting such a case.
 
 I'd not bother with remembering whether the ioctls were supported and
 just call every time, ignoring any errors and not printing
 anything ever.

Originally this patch was ment to prevent a message from being printed 
every time the server tried to blank the screen.
Too many users were posting useless log files thinking this (harmless)
message had something to do with the issue they were seeing.
This then outgrew the original purpose - now since this code gets touched
anyway we could just as well fix the error handling.

 
 If you want an error message on the first call, I think just having a
 static boolean within the lexical scope of the function would be simpler
 than adding the per-device bitmask, enum of unsupported ioctl names etc.
 
 Of course, I don't care *that* deeply either, so if this is really what
 you want...
 
  +if (-1 == ioctl(fPtr-fd, FBIOBLANK, (void *) fbmode)) {
  +switch (errno) {
  +case EAGAIN:
  +case EINTR:
  +case ERESTART:
  +xf86DrvMsg(pScrn-scrnIndex, X_INFO,
  +   FBIOBLANK: %s\n, strerror(errno));
  +break;
 
 Presumably some of these values should cause the driver to retry the
 operation?
 

Yeah, we should probably loop and retry on EINTR and ERESTART.
Will change this and resend.

Cheers,
Egbert.


___
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] OS/ACPI: Make socket to acpid is non-blocking

2013-10-05 Thread Egbert Eich
On Fri, Oct 04, 2013 at 04:14:29PM -0700, Keith Packard wrote:
 Egbert Eich e...@freedesktop.org writes:
 
  If a connect to the acpid socket is delayed connect will
  hang stalling the Xserver.  To avoid this this create a
  non-blocking socket.
 
 Do you have cases which actually cause a delay in this case? Seems like
 acpid shouldn't be significantly delayed in responding to connect
 requests...

We received a backtrace from a partner that clearly showed that the
Xserver was stuck in the connect call after a resume from S4.
Unfortunately we have never been able to obtain sufficient information 
to get down to the root cause. 
What we did learn however was, that a proprietary driver stack was use 
and that the previous version of this stack had set xf86acpiDisableFlag 
to false thus this connect never got called. This version had never 
experienced any hang.

We then changed the connect to non-blocking and implemented the retry 
sceme and have been carrying this patch since. I'm not aware of any
similar problems after that.

Cheers,
Egbert.


___
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 v2] xnest: Ignore GetImage() error in xnestGetImage()

2013-10-04 Thread Egbert Eich
From: Radek Doulik r...@novell.com

When an Xnest instance is not viewable it will crash when a client in
that instance calls GetImage. This is because the Xnest server will
itself receives a BadMatch error.
This patch ignores the error. The application which has requested the
image will receive garbage - this however is fully legal according
to the specs as obscured areas will always contain garbage if there
isn't some sort of backing store as discussed in
https://bugs.freedesktop.org/show_bug.cgi?id=9488
The applied patch is a version from Dadek Doulik.

v2: Call XSync() before changing error handlers as suggested by
Daniel Stone dan...@fooishbar.org.

Signed-off-by: Egbert Eich e...@freedesktop.org
---
 hw/xnest/GCOps.c | 14 ++
 1 file changed, 14 insertions(+)

diff --git a/hw/xnest/GCOps.c b/hw/xnest/GCOps.c
index e26a136..7b1956d 100644
--- a/hw/xnest/GCOps.c
+++ b/hw/xnest/GCOps.c
@@ -94,15 +94,29 @@ xnestPutImage(DrawablePtr pDrawable, GCPtr pGC, int depth, 
int x, int y,
 }
 }
 
+static int
+xnestIgnoreErrorHandler (Display *display,
+ XErrorEvent *event)
+{
+return False; /* return value is ignored */
+}
+
 void
 xnestGetImage(DrawablePtr pDrawable, int x, int y, int w, int h,
   unsigned int format, unsigned long planeMask, char *pImage)
 {
 XImage *ximage;
 int length;
+int (*old_handler)(Display*, XErrorEvent*);
+
+/* we may get BadMatch error when xnest window is minimized */
+XSync(xnestDisplay, False);
+old_handler = XSetErrorHandler (xnestIgnoreErrorHandler);
 
 ximage = XGetImage(xnestDisplay, xnestDrawable(pDrawable),
x, y, w, h, planeMask, format);
+XSync(xnestDisplay, False);
+XSetErrorHandler(old_handler);
 
 if (ximage) {
 length = ximage-bytes_per_line * ximage-height;
-- 
1.8.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


Re: [REPOST PATCH xauth] Look for FamilyLocal if inet or inet6 address is loopback

2013-10-01 Thread Egbert Eich
Jeremy,

On Sun, Sep 29, 2013 at 08:29:48AM -0700, Jeremy Huddleston Sequoia wrote:
 You had incorrect casting in the IN6_IS_ADDR_* macros.  Does Linux (or 
 whatever platform you tested on) cast the arguments to those macros for you 
 (thus correcting / undoing the casting that you provided)?  That seems quite 
 dangerous.
 
 I initially reverted this but then noticed it was a trivial error and pushed 
 a commit with the fixed cast.
 

Thanks! Good catch!

Unfortunately, with the semi-recent glibc on my Linux build machine 
at least, there are casts in both macros which will defeat any type 
checking whatsoever :(
Ie:

# define IN6_IS_ADDR_UNSPECIFIED(a) \
  (__extension__  \
   ({ const struct in6_addr *__a = (const struct in6_addr *) (a); \
  __a-s6_addr32[0] == 0  \
   __a-s6_addr32[1] == 0   \
   __a-s6_addr32[2] == 0   \
   __a-s6_addr32[3] == 0; }))

Cheers,
Egbert.



___
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/2] DIX/Xi: Don't grab device buttons if no grab is registered

2013-10-01 Thread Egbert Eich
On Fri, Aug 30, 2013 at 02:00:55PM +1000, Peter Hutterer wrote:
 On Fri, Aug 16, 2013 at 01:56:07PM +0200, Egbert Eich wrote:
  On Fri, Aug 16, 2013 at 03:37:42PM +1000, Peter Hutterer wrote:
   On Thu, Aug 15, 2013 at 03:49:21PM +0200, Egbert Eich wrote:

   
   it is specified, see XIproto.txt:
 For DeviceButtonPress events, the client may specify whether or
 not an implicit passive grab should be done when the button is
 pressed. If the client wants to guarantee that it will receive
 a DeviceButtonRelease event for each DeviceButtonPress event it
 receives, it should specify the DeviceButtonPressGrab event
 class as well as the DeviceButtonPress event class. This
 restricts the client in that only one client at a time may
 request DeviceButtonPress events from the same device and
 window if any client specifies this class.
   
   I read this as default: no implicit grab, DeviceButtonPressGrab: always
   implicit grab.
  
  Exactly. The current behavior is to do an implicit grab, though.
  
   
  
  A customer had the issue that he wanted to receive Xi events on the same
  window with two clients simultaniously. He claimed that this was working
  with Xserver 1.5.2 which we shipped with SLE-11 originally but 'broke' 
  with the first SP when he got Xserver 1.6.5.
 
 when was this problem being reported? wikipedia tells me SP1 was released in
 June 2010. either way, if that broke in 1.6 it means we've now shipped 8
 versions of X with the broken behaviour and restoring it could well break
 some other application. rock, hard place, frying pan, etc.
 

This problem has been reported in 2011. We subsequently changed the behavior
back to the old one in the Xserver we ship at SUSE for SLE11 as the Xserver
upgrade changed the behavior within an existing product.
From our side we did not see any reports that something else broke after
restoring the old behavior.
Technically we could carry this patch for the existing product but drop
it for a new one as we can much more easily break existing behavior
then.
The customer used the Xi extension so that two separate clients would 
receive both button events - press and release. In his controlled 
environment the customer was able to ensure that noone ever did a
DeviceButtonPressGrab on those.

I do see your point regarding 'the broken behavior has been around for
so long'. However we still have specs and the current behavior don't
match the specs. How good are the specs if we deviate (even slightly)
from them?
We don't seem to have a good procedure how to deal with cases where
the implementation doesn't meet the specs.
In the past we seemed to have had cases where the specs have been 
written long _after_ the implemenation (maybe not as written specs 
but in from of vsw5 test cases) and have contradicted what had long 
been implemented. Of course in this case there is little question 
that we should rather stick to the implemenation.
However here we have broken the spec-ed behavior at some point along 
the way and not discovered it for some time - should we really keep 
the spec-violating behavior? 
Currently we don't even seem to document such.

ATM I see two issues with this:

a. There may be application developers who design their software 
   according to what is allowed by the specs. They may rightfully 
   argue that _we_ are violating the expected behavior - not them.
b. The X Window System is a protocol specification together with 
   the SI.  This means that alternative implementations of the 
   X protocol that may behave according to the specs and thus differ 
   from us.


Cheers,
Egbert.
___
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 xauth] Handle v4-mapped inet6 addresses correctly

2013-09-30 Thread Egbert Eich
Handling of v4-mapped inet6 addresses has been introduced
with commit 58140dbbd39389ad6af58e201e055f3d4b92d368:

   Look for FamilyLocal if inet or inet6 address is loopback

These adresses should be treated as inet addresses. This patch
makes the code consistent with the handling if xcb_auth.c in
libxcb.

Signed-off-by: Egbert Eich e...@freedesktop.org
---
 gethost.c | 26 --
 1 file changed, 16 insertions(+), 10 deletions(-)

diff --git a/gethost.c b/gethost.c
index 48977bb..0a5aff5 100644
--- a/gethost.c
+++ b/gethost.c
@@ -245,17 +245,23 @@ struct addrlist *get_address_info (
} else if (ai-ai_family == AF_INET6) {
struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *)ai-ai_addr;
src = (sin6-sin6_addr);
-if (IN6_IS_ADDR_V4MAPPED((const struct in6_addr *)src)
-|| IN6_IS_ADDR_LOOPBACK((const struct in6_addr *)src)) {
-family = FamilyLocal;
-if (get_local_hostname (buf, sizeof buf)) {
-src = buf;
-len = strlen (buf);
-} else
-src = NULL;
+if (!IN6_IS_ADDR_V4MAPPED((const struct in6_addr *)src)) {
+if (IN6_IS_ADDR_LOOPBACK((const struct in6_addr *)src)) {
+family = FamilyLocal;
+if (get_local_hostname (buf, sizeof buf)) {
+src = buf;
+len = strlen (buf);
+} else
+src = NULL;
+} else {
+len = sizeof(sin6-sin6_addr);
+family = FamilyInternet6;
+}
 } else {
-len = sizeof(sin6-sin6_addr);
-family = FamilyInternet6;
+src = (sin6-sin6_addr.s6_addr[12]);
+len = sizeof(((struct sockaddr_in *)
+  ai-ai_addr)-sin_addr);
+family = FamilyInternet;
 }
}
 
-- 
1.8.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


Re: [PATCH V2 xauth] Make matching algorithm mimic XauGet*AuthByAddr

2013-09-19 Thread Egbert Eich
Meanwhile I came across 

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

where Tilmann proposes a fix for exactly the same problem.

The solutions differ to some extent so let me try to explain
what the differences are and why I chose to solve it the way
shown below.

On Wed, Aug 14, 2013 at 10:11:06PM +0200, Egbert Eich wrote:

 Xlib (xcb) uses XauGetBestAuthByAddr() when looking for an
 authorization. 'xauth [n]list $DISPLAY' used a slightly
 stricter algorithm which doesn't find a possible authorization
 for cases where either the family is set to FamilyWild or
 address the address length is 0.
 
 Signed-off-by: Egbert Eich e...@freedesktop.org
 ---
 v2: Tried to make condition more readable as suggested 
 by walter harms wha...@bfs.de.
 
  process.c | 14 +-
  1 file changed, 9 insertions(+), 5 deletions(-)
 
 diff --git a/process.c b/process.c
 index a9466a7..7ae5f21 100644
 --- a/process.c
 +++ b/process.c
 @@ -1064,11 +1064,15 @@ eq_auth(Xauth *a, Xauth *b)
  static int
  match_auth_dpy(register Xauth *a, register Xauth *b)
  {
 -return ((a-family == b-family 
 -  a-address_length == b-address_length 
 -  a-number_length == b-number_length 
 -  memcmp(a-address, b-address, a-address_length) == 0 
 -  memcmp(a-number, b-number, a-number_length) == 0) ? 1 : 0);
 +if (a-family != FamilyWild  b-family != FamilyWild 
 +(a-family != b-family || a-address_length != b-address_length ||
 + memcmp(a-address, b-address, a-address_length) != 0))
 +return 0;
 +if (a-number_length != 0  b-number_length != 0 
 +  (a-number_length != b-number_length ||
 +   memcmp(a-number, b-number, a-number_length) != 0))
 +return 0;
 +return 1;
  }

Both Tilmann's patch in 

 https://bugs.freedesktop.org/attachment.cgi?id=65284

and mine address the missing handling of FamilyWild in xauth.

When a FamilyWild entry is found Tilman's patch also takes the the 
address length and address into account while in the above patch 
this data is ignored if one of the entries to compare belongs to 
FamilyWild.

Tilman's patch introduces a special handling for FamilyWild in 
iterdpy() when match_auth_dpy() fails while the above fix directly 
adds this handling to match_auth_dpy().
The modification of match_auth_dpy() also affects match_auth() which 
calls this function.

I've now looked for indicators if the address should be ignored when 
a FamilyWild is encountered.

1. 'man Xsecurity' states: 
...  A special connection family (FamilyWild, value 65535) causes an 
entry to match  every  display, allowing  the  entry  to be used for 
all connections. ...

2. Looking at XauGetAuthByAddr() and XauGetBestAuthByAddr() in libXau, 
   the address field gets ignored when one of the two entries to compare 
   is FamilyWild.
   In fact the patch makes the comparisons in match_auth_dpy() and match_auth()
   very much identical to those in XauGetAuthByAddr() and XauGetBestAuthByAddr()
   
The goal I tried to achieve in my patch was to make the behavior of xauth 
identical to the behavior of X clients looking for the closest matching 
authentication entry in the credentials file. X clients use 
XauGetBestAuthByAddr() 
(thru xcb) to find this entry.
   

Cheers,
Egbert.
___
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: [REPOST PATCH xauth] Don't crash when running past the end of the chain

2013-09-18 Thread Egbert Eich

Hi!

On August 14 I've reposted three patches for xauth to this mailing list.
I did so, because I had discovered that a 'Dr. Tilmann Bubeck' has added
himself as maintainer of the xauth package to the xorg/doc/xorg-docs/MAINTAINERS
file on Jan. 22 2013 - considering the change frequency of this file this 
is not that long ago.
The only reply I ever got on any of the 3 posts was by Walter Harms.

So I did a quick check in the xauth package which did not turn up any
contribution by this individual.

After doing further investigations I concluded that this commit apparently 
was the only thing that he has ever contributed to any X.Org related package.

Research on Google did not turn up any relevant affiliation to any X.Org 
related software.

For this change his name and email address is listed not only for the author
but also for the committer.

This begs the question how did this commit ever get into the xorg-docs
package?
Did he commit this change himself - and if so, how did he get commit 
access to the X.Org repos?
Or if he didn't do it himself (and he may not even be aware of this commit), 
who else did - using his name and email?

Cheers,
Egbert.
___
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: [REPOST PATCH xauth] Don't crash when running past the end of the chain

2013-09-18 Thread Egbert Eich

Hi Tilman,

On Wed, Sep 18, 2013 at 10:28:14PM +0200, Dr. Tilmann Bubeck wrote:
 Hi Egbert,
 
 I developed a patch for xauth to fix some nasty problems. I first asked Alan
 to apply the patch but he had not enough time to do it. So after some time
 he gave me access to Xorg as a commiter (I certainly did not do this on my
 own).
 
 So my plan was to look after xauth, which I still want to do. However, I
 changed my employer in the mean time so I currently have not much spare
 time. But this will change soon, as I am now more incorporated to my new
 job.
 
 I now promise to apply the patch and all other pending stuff until the end
 of the month. If I fail, then feel free to remove me from the MAINTAINERs
 file and revoke my access rights. However, I am confident, that I can do it,
 because it really is not much to do.


I finally found your patches in bugzilla - you made a fix for exactly one
of the problems I also addressed ie:

   [PATCH xauth] Make matching algorithm mimic XauGet*AuthByAddr

Your approach is similar however there is a difference and I'm currently trying 
to find out which way is the correct one. I had some reason why I chose my way
but since it was quite some time ago I don't exactly recall why.
Thus I'm looking into this ATM.

Regarding committing the patches I can commit patches myself - I just don't
want to step over the maintainer. I would suggest that I commit

   [PATCH xauth] Don't crash when running past the end of the chain 

as this fixes a segfault and should be pretty straight forward.
I would suggest that you have a look at at

   [PATCH xauth] Look for FamilyLocal if inet or inet6 address is loopback

as it is always good to have a second look - if I didn't do anything 
stupid. I will bounce the 3 messages to you in case you don't have them
any more.

Good night! 

Cheers,
Egbert.


 
 Feel free to contact me for further questions.
 
 Kind regards,
  Tilmann
 
 Am 18.09.2013 19:44, schrieb Egbert Eich:
 
 Hi!
 
 On August 14 I've reposted three patches for xauth to this mailing list.
 I did so, because I had discovered that a 'Dr. Tilmann Bubeck' has added
 himself as maintainer of the xauth package to the 
 xorg/doc/xorg-docs/MAINTAINERS
 file on Jan. 22 2013 - considering the change frequency of this file this
 is not that long ago.
 The only reply I ever got on any of the 3 posts was by Walter Harms.
 
 So I did a quick check in the xauth package which did not turn up any
 contribution by this individual.
 
 After doing further investigations I concluded that this commit apparently
 was the only thing that he has ever contributed to any X.Org related package.
 
 Research on Google did not turn up any relevant affiliation to any X.Org
 related software.
 
 For this change his name and email address is listed not only for the author
 but also for the committer.
 
 This begs the question how did this commit ever get into the xorg-docs
 package?
 Did he commit this change himself - and if so, how did he get commit
 access to the X.Org repos?
 Or if he didn't do it himself (and he may not even be aware of this commit),
 who else did - using his name and email?
 
 Cheers,
  Egbert.
 
 
 -- 
 Mit freundlichen Gruessen,
   Tilmann Bubeck
 
 
  dr. tilmann bubeck, it professional  geek
 
  t...@bubecks.de   /  http://www.bubecks.de
  mobile: 0172-8842972  /  fon: 0711-7227719 /  fax: 0711-7227734
  widmaierstr. 58   /  70567 stuttgart   /  germany
___
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] OS/ACPI: Reconnect to acpid when it gets restarted

2013-09-17 Thread Egbert Eich
Hi Keith!

Back from Vienna :)

On Mon, Sep 09, 2013 at 04:23:20PM -0700, Keith Packard wrote:
 Egbert Eich e...@freedesktop.org writes:
 
  +PMClose
  +lnxACPIPoll(void)
  +{
  +TimerSet(NULL, 0, 1, lnxACPICheckTimer, NULL);
 
 I'm betting this is supposed to be:
 
acpiTimer = TimerSet(NULL, 0, 1, lnxACPICheckTimer, NULL);

Right. Huh, not sure why this was forgotten.

 
 I'm also not understanding how this code is supposed to detect an acpid
 failure and automatically reconnect; seems like that would take a check
 in the ACPI event reading code? Did I just miss something?


Ok, now I see: the title of the patch is wrong. Originally I had this
in the patch I had in SUSE. But then you(and ajax) already added the 
reconnect functionality.

fa9a49a9(Adam Jackson   2006-05-18 18:18:41 +   83)if (n = 
0) {
9838b703(Keith Packard  2012-03-21 12:55:09 -0700   84)
lnxCloseACPI();
9838b703(Keith Packard  2012-03-21 12:55:09 -0700   85)
TimerSet(NULL, 0, ACPI_REOPEN_DELAY, lnxACPIReopen, NULL);
9838b703(Keith Packard  2012-03-21 12:55:09 -0700   86)
return 0;
fa9a49a9(Adam Jackson   2006-05-18 18:18:41 +   87)}

What this patch is supposed to add is a retry if the (re)open doesn't succeed:
Without this patch if acpid isn't active at the time the DDX tries to (re)open,
we will loose it.
Thus the title of the patch should probably be:

   OS/ACPI: Retry (re)connecting to acpid until successful

Maybe we should give up trying at some point. But then again we have a 10 sec
retry interval. 

I will resend this and the next patch with corrected changelog entries and the
one bug fixed.

Cheers,
Egbert.
___
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 v2] OS/ACPI: Make socket to acpid is non-blocking

2013-09-16 Thread Egbert Eich
If a connect to the acpid socket is delayed connect will
hang stalling the Xserver.  To avoid this create a non-blocking
socket.
If connect returns EINPROGRESS use select() and getsockopt()
to check for completion of the connect request.
Use a different timeout to select() whether we connect for
the first time or reconnect.

Signed-off-by: Egbert Eich e...@freedesktop.org
---
v2: Fixed log message.

 hw/xfree86/os-support/linux/lnx_acpi.c | 34 +-
 1 file changed, 29 insertions(+), 5 deletions(-)

diff --git a/hw/xfree86/os-support/linux/lnx_acpi.c 
b/hw/xfree86/os-support/linux/lnx_acpi.c
index 7385869..12b16b0 100644
--- a/hw/xfree86/os-support/linux/lnx_acpi.c
+++ b/hw/xfree86/os-support/linux/lnx_acpi.c
@@ -32,7 +32,7 @@
 #define ACPI_VIDEO_HEAD_INVALID(~0u - 1)
 #define ACPI_VIDEO_HEAD_END(~0u)
 
-static PMClose doLnxACPIOpen(void);
+static PMClose doLnxACPIOpen(struct timeval *);
 static void lnxCloseACPI(void);
 static pointer ACPIihPtr = NULL;
 static OsTimerPtr acpiTimer = NULL;
@@ -58,8 +58,9 @@ lnxACPIReopen(OsTimerPtr timer, CARD32 time, pointer arg)
 static CARD32
 lnxACPICheckTimer(OsTimerPtr timer, CARD32 now, pointer arg)
 {
+struct timeval timeval = { 0, 0 };
 DebugF(ACPI: trying to reopen\n);
-if (doLnxACPIOpen()) {
+if (doLnxACPIOpen(timeval)) {
 DebugF(ACPI: successfully reopened\n);
 acpiTimer = NULL;
 return 0;
@@ -146,7 +147,7 @@ lnxACPIConfirmEventToOs(int fd, pmEvent event)
 }
 
 static PMClose
-doLnxACPIOpen(void)
+doLnxACPIOpen(struct timeval *tv_p)
 {
 int fd = -1;
 struct sockaddr_un addr;
@@ -157,13 +158,34 @@ doLnxACPIOpen(void)
 return NULL;
 
 DebugF(ACPI: Opening device\n);
-fd = socket(AF_UNIX, SOCK_STREAM, 0);
+fd = socket(AF_UNIX, SOCK_STREAM | SOCK_NONBLOCK, 0);
 if (fd  -1) {
 memset(addr, 0, sizeof(addr));
 addr.sun_family = AF_UNIX;
 strcpy(addr.sun_path, ACPI_SOCKET);
 r = connect(fd, (struct sockaddr*)addr, sizeof(addr));
 if (r == -1) {
+int sock_errno = errno;
+if (sock_errno == EINPROGRESS) {
+fd_set fds;
+int result;
+do {
+FD_ZERO(fds);
+FD_SET(fd, fds);
+result = select(fd + 1, NULL, fds, NULL, tv_p);
+}  while (result  0  errno == EINTR);
+if (result  0)
+sock_errno = errno;
+else if (result  0) {
+int sock_errno;
+socklen_t size = sizeof(sock_errno);
+if (0  getsockopt(fd, SOL_SOCKET, SO_ERROR, sock_errno,
+   size))
+sock_errno = errno;
+if (!sock_errno)
+goto success;
+}
+}
 if (errno != warned)
 xf86MsgVerb(X_WARNING,3,Open ACPI failed (%s) (%s)\n,
 ACPI_SOCKET, strerror(errno));
@@ -175,6 +197,7 @@ doLnxACPIOpen(void)
 } else
 return NULL;
 
+ success:
 xf86PMGetEventFromOs = lnxACPIGetEventFromOs;
 xf86PMConfirmEventToOs = lnxACPIConfirmEventToOs;
 ACPIihPtr = xf86AddGeneralHandler(fd, xf86HandlePMEvents, NULL);
@@ -195,8 +218,9 @@ PMClose
 lnxACPIOpen(void)
 {
 PMClose ret;
+struct timeval timeval = { 0, 3 };
 DebugF(ACPI: OSPMOpen called\n);
-ret = doLnxACPIOpen();
+ret = doLnxACPIOpen(timeval);
 
 return ret;
 }
-- 
1.8.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 v2] OS/ACPI: Retry (re)connecting to acpid until successful

2013-09-16 Thread Egbert Eich
On Linux the Xserver connects to the ACPI daemon to
receive power management events. If this daemon isn't
running when the Xserver starts or restarts while the
Xserver is active the connection is lost.
This adds a timer which periodically tries to (re)connect.

Signed-off-by: Egbert Eich e...@freedesktop.org
---
v2: Don't forget to set acpiTimer.
Fixed description.

 hw/xfree86/os-support/linux/lnx_acpi.c | 66 +++---
 hw/xfree86/os-support/linux/lnx_apm.c  |  9 +
 2 files changed, 62 insertions(+), 13 deletions(-)

diff --git a/hw/xfree86/os-support/linux/lnx_acpi.c 
b/hw/xfree86/os-support/linux/lnx_acpi.c
index dcaa19e..7385869 100644
--- a/hw/xfree86/os-support/linux/lnx_acpi.c
+++ b/hw/xfree86/os-support/linux/lnx_acpi.c
@@ -32,9 +32,12 @@
 #define ACPI_VIDEO_HEAD_INVALID(~0u - 1)
 #define ACPI_VIDEO_HEAD_END(~0u)
 
+static PMClose doLnxACPIOpen(void);
 static void lnxCloseACPI(void);
 static pointer ACPIihPtr = NULL;
+static OsTimerPtr acpiTimer = NULL;
 PMClose lnxACPIOpen(void);
+PMClose lnxACPIPoll(void);
 
 /* in milliseconds */
 #define ACPI_REOPEN_DELAY 1000
@@ -52,6 +55,18 @@ lnxACPIReopen(OsTimerPtr timer, CARD32 time, pointer arg)
 
 #define LINE_LENGTH 80
 
+static CARD32
+lnxACPICheckTimer(OsTimerPtr timer, CARD32 now, pointer arg)
+{
+DebugF(ACPI: trying to reopen\n);
+if (doLnxACPIOpen()) {
+DebugF(ACPI: successfully reopened\n);
+acpiTimer = NULL;
+return 0;
+}
+return 1;
+}
+
 static int
 lnxACPIGetEventFromOs(int fd, pmEvent * events, int num)
 {
@@ -66,7 +81,7 @@ lnxACPIGetEventFromOs(int fd, pmEvent * events, int num)
 
 if (n = 0) {
 lnxCloseACPI();
-TimerSet(NULL, 0, ACPI_REOPEN_DELAY, lnxACPIReopen, NULL);
+acpiTimer = TimerSet(NULL, 0, ACPI_REOPEN_DELAY, lnxACPIReopen, NULL);
 return 0;
 }
 /* FIXME: this only processes the first read ACPI event  might break
@@ -130,33 +145,35 @@ lnxACPIConfirmEventToOs(int fd, pmEvent event)
 }
 }
 
-PMClose
-lnxACPIOpen(void)
+static PMClose
+doLnxACPIOpen(void)
 {
-int fd;
+int fd = -1;
 struct sockaddr_un addr;
 int r = -1;
 static int warned = 0;
 
-DebugF(ACPI: OSPMOpen called\n);
 if (ACPIihPtr || !xf86Info.pmFlag)
 return NULL;
 
 DebugF(ACPI: Opening device\n);
-if ((fd = socket(AF_UNIX, SOCK_STREAM, 0))  -1) {
+fd = socket(AF_UNIX, SOCK_STREAM, 0);
+if (fd  -1) {
 memset(addr, 0, sizeof(addr));
 addr.sun_family = AF_UNIX;
 strcpy(addr.sun_path, ACPI_SOCKET);
-if ((r = connect(fd, (struct sockaddr *) addr, sizeof(addr))) == -1) {
-if (!warned)
-xf86MsgVerb(X_WARNING, 3, Open ACPI failed (%s) (%s)\n,
+r = connect(fd, (struct sockaddr*)addr, sizeof(addr));
+if (r == -1) {
+if (errno != warned)
+xf86MsgVerb(X_WARNING,3,Open ACPI failed (%s) (%s)\n,
 ACPI_SOCKET, strerror(errno));
-warned = 1;
-shutdown(fd, 2);
+warned = errno;
+shutdown(fd, SHUT_RDWR);
 close(fd);
 return NULL;
 }
-}
+} else
+return NULL;
 
 xf86PMGetEventFromOs = lnxACPIGetEventFromOs;
 xf86PMConfirmEventToOs = lnxACPIConfirmEventToOs;
@@ -167,6 +184,23 @@ lnxACPIOpen(void)
 return lnxCloseACPI;
 }
 
+PMClose
+lnxACPIPoll(void)
+{
+TimerSet(NULL, 0, 1, lnxACPICheckTimer, NULL);
+return lnxCloseACPI;
+}
+
+PMClose
+lnxACPIOpen(void)
+{
+PMClose ret;
+DebugF(ACPI: OSPMOpen called\n);
+ret = doLnxACPIOpen();
+
+return ret;
+}
+
 static void
 lnxCloseACPI(void)
 {
@@ -175,8 +209,14 @@ lnxCloseACPI(void)
 DebugF(ACPI: Closing device\n);
 if (ACPIihPtr) {
 fd = xf86RemoveGeneralHandler(ACPIihPtr);
-shutdown(fd, 2);
+shutdown(fd, SHUT_RDWR);
 close(fd);
 ACPIihPtr = NULL;
+xf86PMGetEventFromOs = NULL;
+xf86PMConfirmEventToOs = NULL;
+if (acpiTimer) {
+TimerCancel(acpiTimer);
+acpiTimer = NULL;
+}
 }
 }
diff --git a/hw/xfree86/os-support/linux/lnx_apm.c 
b/hw/xfree86/os-support/linux/lnx_apm.c
index 3879340..2628f5c 100644
--- a/hw/xfree86/os-support/linux/lnx_apm.c
+++ b/hw/xfree86/os-support/linux/lnx_apm.c
@@ -12,6 +12,7 @@
 
 #ifdef HAVE_ACPI
 extern PMClose lnxACPIOpen(void);
+extern PMClose lnxACPIPoll(void);
 #endif
 
 #ifdef HAVE_APM
@@ -149,6 +150,14 @@ xf86OSPMOpen(void)
 ret = lnxAPMOpen();
 #endif
 
+#ifdef HAVE_ACPI
+/* if we can neither open ACPI nor APM poll for an ACPI service to
+   become available */
+
+if (!ret  !xf86acpiDisableFlag)
+   ret = lnxACPIPoll();
+#endif
+
 return ret;
 }
 
-- 
1.8.1.4

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

Re: [PATCH driver/nv 2/2] VGA/PowerPC: Implement MMIO access function to ST01 for PowerPC only

2013-08-16 Thread Egbert Eich
On Thu, Aug 15, 2013 at 04:29:00PM +0200, Mark Kettenis wrote:
  From: Egbert Eich e...@freedesktop.org
  Date: Tue, 13 Aug 2013 21:38:20 +0200
  
  Access to most VGA registers is done thru MMIO. For the ST01 register
  PIO access is used to maintain timing for DACDelay(), a delay function
  internal to libvgahw used to slow down access to the DAC registers
  sufficiently.
  PowerPC does not support PIO access, thus an access function thru
  MMIO is needed.
 
 Reviewed-by: Mark Kettenis kette...@openbsd.org

Thanks, Mark.
I've just pushed
   init: Initialize VGA IOBase before using it
I will wait pushing this one until I get test results 
telling me that setting up the VGA IOBase itself
doesn't solve the problem on PowerPC64.


Cheers,
Egbert.
___
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/2] DIX/Xi: Don't grab device buttons if no grab is registered

2013-08-16 Thread Egbert Eich
On Fri, Aug 16, 2013 at 03:37:42PM +1000, Peter Hutterer wrote:
 On Thu, Aug 15, 2013 at 03:49:21PM +0200, Egbert Eich wrote:
  Core events implicietely grab buttons on button press events, for
 
 typo
 
  Xi (ie. device) button press events this is not specified.
 
 it is specified, see XIproto.txt:
   For DeviceButtonPress events, the client may specify whether or
   not an implicit passive grab should be done when the button is
   pressed. If the client wants to guarantee that it will receive
   a DeviceButtonRelease event for each DeviceButtonPress event it
   receives, it should specify the DeviceButtonPressGrab event
   class as well as the DeviceButtonPress event class. This
   restricts the client in that only one client at a time may
   request DeviceButtonPress events from the same device and
   window if any client specifies this class.
 
 I read this as default: no implicit grab, DeviceButtonPressGrab: always
 implicit grab.

Exactly. The current behavior is to do an implicit grab, though.

 
  The test clause we are removing however applied the core event
  behavior also to Xi events causing button release events being
  delivered only to a single client even if no client explicitely
  belongs to the DeviceButtonPressGrabClass.
  Note: while this behavior is reasonable there is nothing in the
  Xi specs that guarantees the delivery of a ButtonRelease event
  for every ButtonPress event if the client hasn't specifically
  registered for the DeviceButtonPressGrab class.
  In other words this patch removes the 'implicite dragging' from
  Xi extension button events.
 
 This doesn't take the DeviceButtonPressGrab into account then.
 how about this diff?
 
 diff --git a/dix/events.c b/dix/events.c
 index c3a0ae7..10351e3 100644
 --- a/dix/events.c
 +++ b/dix/events.c
 @@ -1990,6 +1990,8 @@ ActivateImplicitGrab(DeviceIntPtr dev, ClientPtr 
 client, WindowPtr win,
 
  if (type == ButtonPress)
  grabtype = CORE;
 +else if (type == DeviceButtonPress  (deliveryMask  
 DeviceButtonGrabMask))
 +grabtype = XI;

It does, but shouldn't this situation be taken care of by calling 
CheckDeviceGrabAndHintWindow() a few lines down in DeliverEventsToWindow()?
If we do this the code path in CheckDeviceGrabAndHintWindow()
   ...
   else if ((type == DeviceButtonPress)  (!grab) 
 (deliveryMask  DeviceButtonGrabMask)) {
GrabPtr tempGrab;
   ...
   }

is probably never being called.


  else if ((type = xi2_get_type(event)) == XI_ButtonPress)
  grabtype = XI2;
  else
 
 what I do wonder though is if there are clients that rely on the current
 behaviour. did you have something break that triggered this patchset?

A customer had the issue that he wanted to receive Xi events on the same
window with two clients simultaniously. He claimed that this was working
with Xserver 1.5.2 which we shipped with SLE-11 originally but 'broke' 
with the first SP when he got Xserver 1.6.5.

Cheers,
Egbert.
___
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] DDX/PCI: Check harder for primary PCI device

2013-08-16 Thread Egbert Eich
On Thu, Aug 15, 2013 at 04:19:17PM +0200, Mark Kettenis wrote:

 I think dropping this non-libpciaccess fallback codepath should be the
 goal.  Currently of all the systems supported by libpciaccess, only
 FreeBSD and OpenBSD don't implement the oot_vga callback function.
 And I've got the OpenBSD code written, which I'll send back upstream
 once our KMS support stabilizes a bit.
 
 So I fear you're just adding dead code here.  My suggestion would be
 to simply drop this diff.  But I won't object if others chime in and
 think this diff still has value.

Basically I'm fine with this. I guess dropping this depends on FreeBSD
being able to switch over to the libpciaccess method.
Does anyone have any idea about a time line here?

Cheers,
Egbert.
___
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 v2] DIX/Xi: Pass correct client to CheckDeviceGrabAndHintWindow()

2013-08-16 Thread Egbert Eich
If we have a client which has registered for a DeviceButton grab
be sure to pass this to CheckDeviceGrabAndHintWindow(). Since the
order of clients is arbitrary there is no guarantee that the last
client in the list is the one that belongs to this class.

Signed-off-by: Egbert Eich e...@freedesktop.org
---
v2: Coding style fixes, added comment to code as suggested by
Peter Hutterer peter.hutte...@who-t.net

 dix/events.c | 23 ---
 1 file changed, 16 insertions(+), 7 deletions(-)

diff --git a/dix/events.c b/dix/events.c
index 40673ce..3572dc5 100644
--- a/dix/events.c
+++ b/dix/events.c
@@ -2149,6 +2149,7 @@ DeliverEventToInputClients(DeviceIntPtr dev, InputClients 
* inputclients,
 {
 int attempt;
 enum EventDeliveryState rc = EVENT_NOT_DELIVERED;
+Bool have_device_button_grab_class_client = FALSE;
 
 for (; inputclients; inputclients = inputclients-next) {
 Mask mask;
@@ -2168,13 +2169,21 @@ DeliverEventToInputClients(DeviceIntPtr dev, 
InputClients * inputclients,
 events, count,
 mask, filter, grab))) {
 if (attempt  0) {
-rc = EVENT_DELIVERED;
-*client_return = client;
-*mask_return = mask;
-/* Success overrides non-success, so if we've been
- * successful on one client, return that */
-}
-else if (rc == EVENT_NOT_DELIVERED)
+/*
+ * The order of clients is arbitrary therefore if one
+ * client belongs to DeviceButtonGrabClass make sure to
+ * catch it.
+ */
+if (!have_device_button_grab_class_client) {
+rc = EVENT_DELIVERED;
+*client_return = client;
+*mask_return = mask;
+/* Success overrides non-success, so if we've been
+ * successful on one client, return that */
+if (mask  DeviceButtonGrabMask)
+have_device_button_grab_class_client = TRUE;
+}
+} else if (rc == EVENT_NOT_DELIVERED)
 rc = EVENT_REJECTED;
 }
 }
-- 
1.8.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] ARM64: Add support for aarch64

2013-08-15 Thread Egbert Eich
From: Andreas Schwab sch...@suse.de

Signed-off-by: Andreas Schwab sch...@suse.de
---
 hw/xfree86/common/compiler.h|  2 +-
 hw/xfree86/os-support/linux/lnx_video.c |  3 ++-
 include/servermd.h  | 14 ++
 3 files changed, 17 insertions(+), 2 deletions(-)

diff --git a/hw/xfree86/common/compiler.h b/hw/xfree86/common/compiler.h
index c980bee..3a57186 100644
--- a/hw/xfree86/common/compiler.h
+++ b/hw/xfree86/common/compiler.h
@@ -1351,7 +1351,7 @@ stl_u(unsigned long val, unsigned int *p)
 #else   /* ix86 */
 
 #if !defined(__SUNPRO_C)
-#if !defined(FAKEIT)  !defined(__mc68000__)  !defined(__arm__)  
!defined(__sh__)  !defined(__hppa__)  !defined(__s390__)  
!defined(__m32r__)
+#if !defined(FAKEIT)  !defined(__mc68000__)  !defined(__arm__)  
!defined(__sh__)  !defined(__hppa__)  !defined(__s390__)  
!defined(__m32r__)  !defined(__aarch64__)
 #ifdef GCCUSESGAS
 
 /*
diff --git a/hw/xfree86/os-support/linux/lnx_video.c 
b/hw/xfree86/os-support/linux/lnx_video.c
index d9a5da1..43d0a36 100644
--- a/hw/xfree86/os-support/linux/lnx_video.c
+++ b/hw/xfree86/os-support/linux/lnx_video.c
@@ -58,7 +58,8 @@ static Bool ExtendedEnabled = FALSE;
   !defined(__sparc__)  \
   !defined(__mips__)  \
   !defined(__nds32__)  \
-  !defined(__arm__)
+  !defined(__arm__)  \
+  !defined(__aarch64__)
 
 /*
  * Due to conflicts with compiler.h, don't rely on sys/io.h to declare
diff --git a/include/servermd.h b/include/servermd.h
index d6a9a3a..11f6c10 100644
--- a/include/servermd.h
+++ b/include/servermd.h
@@ -286,6 +286,20 @@ SOFTWARE.
 #define GLYPHPADBYTES  4
 #endif  /* linux/s390 */
 
+#ifdef __aarch64__
+
+#ifdef __AARCH64EL__
+#define IMAGE_BYTE_ORDERLSBFirst
+#define BITMAP_BIT_ORDERLSBFirst
+#endif
+#ifdef __AARCH64EB__
+#define IMAGE_BYTE_ORDERMSBFirst
+#define BITMAP_BIT_ORDERMSBFirst
+#endif
+#define GLYPHPADBYTES   4
+
+#endif  /* __aarch64__ */
+
 /* size of buffer to use with GetImage, measured in bytes. There's obviously
  * a trade-off between the amount of heap used and the number of times the
  * ddx routine has to be called.
-- 
1.8.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] DDX/libxf86config: Fix missing server internal symbols

2013-08-15 Thread Egbert Eich
With the option --enable-install-libxf86config the config file parser
can be installed independently. This however makes sense only if this
lib doesn't use any symbols from the Xserver.

Fix a.) by including os/utils.o and os/strlcpy.c
b.) by implementing simple replacements for VErrorF(), ErrorF
and xstrtokenize()
c.) by replacing xf86CheckBoolOption() with  xf86findOptionValue()
which requires a sligtly more complicated sematics.

Signed-off-by: Egbert Eich e...@freedesktop.org
---
Please note:
This fix has been taken from an enterprise product at SUSE. It has been 
ported to the current HEAD and tested minimally. 
Going forward we won't need this feature any more.
However a broken feature should either be removed or fixed (if a fix is
available).

 hw/xfree86/parser/Layout.c | 11 +++---
 hw/xfree86/parser/Makefile.am  |  2 +
 hw/xfree86/parser/standalone.c | 88 ++
 3 files changed, 96 insertions(+), 5 deletions(-)
 create mode 100644 hw/xfree86/parser/standalone.c

diff --git a/hw/xfree86/parser/Layout.c b/hw/xfree86/parser/Layout.c
index cbd8d24..1d9c1ad 100644
--- a/hw/xfree86/parser/Layout.c
+++ b/hw/xfree86/parser/Layout.c
@@ -62,9 +62,6 @@
 #include string.h
 #include optionstr.h
 
-/* Needed for auto server layout */
-extern int xf86CheckBoolOption(void *optlist, const char *name, int deflt);
-
 extern LexRec val;
 
 static xf86ConfigSymTabRec LayoutTab[] = {
@@ -431,8 +428,12 @@ xf86layoutAddInputDevices(XF86ConfigPtr config, 
XF86ConfLayoutPtr layout)
 
 /* add all AutoServerLayout devices to the server layout */
 while (input) {
-if (xf86CheckBoolOption
-(input-inp_option_lst, AutoServerLayout, FALSE)) {
+   Bool asl_value = FALSE;
+   char *s = xf86findOptionValue(input-inp_option_lst ,
+ AutoServerLayout);
+   Bool asl_found = xf86getBoolValue(asl_value, s);
+   if (asl_found == TRUE  asl_value == TRUE) {
+
 XF86ConfInputrefPtr iref = layout-lay_input_lst;
 
 /* avoid duplicates if referenced but lists AutoServerLayout too */
diff --git a/hw/xfree86/parser/Makefile.am b/hw/xfree86/parser/Makefile.am
index 002cfbf..654daed 100644
--- a/hw/xfree86/parser/Makefile.am
+++ b/hw/xfree86/parser/Makefile.am
@@ -32,6 +32,8 @@ libxf86config_internal_la_SOURCES = \
 
 libxf86config_la_SOURCES = \
$(top_srcdir)/os/xprintf.c \
+   $(top_srcdir)/os/strlcpy.c \
+   standalone.c \
$(INTERNAL_SOURCES)
 libxf86config_la_CFLAGS = $(AM_CFLAGS)
 libxf86config_la_LDFLAGS = -static
diff --git a/hw/xfree86/parser/standalone.c b/hw/xfree86/parser/standalone.c
new file mode 100644
index 000..dfd36da
--- /dev/null
+++ b/hw/xfree86/parser/standalone.c
@@ -0,0 +1,88 @@
+/*
+ * Copyright (c) 2013 Egbert Eich
+ *
+ * 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 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+
+#ifdef HAVE_XORG_CONFIG_H
+#include xorg-config.h
+#endif
+
+#include stdarg.h
+#include string.h
+#include os.h
+
+/*
+ * Tokenize a string into a NULL terminated array of strings. Always returns
+ * an allocated array unless an error occurs.
+ */
+char**
+xstrtokenize(const char *str, const char *separators)
+{
+char **list, **nlist;
+char *tok, *tmp;
+unsigned num = 0, n;
+
+if (!str)
+return NULL;
+list = calloc(1, sizeof(*list));
+if (!list)
+return NULL;
+tmp = strdup(str);
+if (!tmp)
+goto error;
+for (tok = strtok(tmp, separators); tok; tok = strtok(NULL, separators)) {
+nlist = realloc(list, (num + 2) * sizeof(*list));
+if (!nlist)
+goto error;
+list = nlist;
+list[num] = strdup(tok);
+if (!list[num])
+goto error;
+list[++num] = NULL;
+}
+free(tmp);
+return list;
+
+error:
+free(tmp);
+for (n = 0; n  num; n++)
+free(list[n]);
+free(list);
+return NULL

[PATCH 0/2] Patches for Xi

2013-08-15 Thread Egbert Eich
Here are two patches for Xi:
The first is a fix for DeviceButtonGrabClass: if multiple clients
have registered for button events on the same window, the client
belonging to DeviceButtonGrabClass should grab the button on press 
so it will receive release events. Presently however this is not 
guaranteed: the client which was started last will get the grab, 
no matter if it belongs to DeviceButtonGrabClass or not.

The latter one changes the behavior if two clients belonging
to DeviceButtonClass register for events on the same window.
Presently the behavior is the same as for core events: an implicite
grab is activated on one of the clients so this client will
receive the release events while the other won't.
This patch changes the behavior so that always all clients will
see both press and release events ifnone of them belongs to 
DeviceButtonGrabClass.
The specs don't guarantee that a client not belonging to this
class will receive a release event when it has received a button
press. So either behavior is covered by the spec.
This I'm putting this patch up for discussion - there is nothing
that would mandate to change the behavior. It seems to be a 
reasonable change however.

Egbert Eich (2):
  DIX/Xi: Pass correct client to CheckDeviceGrabAndHintWindow()
  DIX/Xi: Don't grab device buttons if no grab is registered

 dix/events.c | 20 +++-
 1 file changed, 11 insertions(+), 9 deletions(-)

-- 
1.8.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 2/2] DIX/Xi: Don't grab device buttons if no grab is registered

2013-08-15 Thread Egbert Eich
Core events implicietely grab buttons on button press events, for
Xi (ie. device) button press events this is not specified.
The test clause we are removing however applied the core event
behavior also to Xi events causing button release events being
delivered only to a single client even if no client explicitely
belongs to the DeviceButtonPressGrabClass.
Note: while this behavior is reasonable there is nothing in the
Xi specs that guarantees the delivery of a ButtonRelease event
for every ButtonPress event if the client hasn't specifically
registered for the DeviceButtonPressGrab class.
In other words this patch removes the 'implicite dragging' from
Xi extension button events.

Signed-off-by: Egbert Eich e...@freedesktop.org
---
 dix/events.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/dix/events.c b/dix/events.c
index 36708bf..11dafa9 100644
--- a/dix/events.c
+++ b/dix/events.c
@@ -2034,8 +2034,6 @@ ActivateImplicitGrab(DeviceIntPtr dev, ClientPtr client, 
WindowPtr win,
 
 if (type == ButtonPress)
 grabtype = CORE;
-else if (type == DeviceButtonPress)
-grabtype = XI;
 else if ((type = xi2_get_type(event)) == XI_ButtonPress)
 grabtype = XI2;
 else
-- 
1.8.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 1/2] DIX/Xi: Pass correct client to CheckDeviceGrabAndHintWindow()

2013-08-15 Thread Egbert Eich
If we have a client which has registered for a DeviceButton grab
be sure to pass this to CheckDeviceGrabAndHintWindow(). Since the
order of clients is arbitrary there is no guarantee that the last
client in the list is the one that belongs to this class.

Signed-off-by: Egbert Eich e...@freedesktop.org
---
 dix/events.c | 18 +++---
 1 file changed, 11 insertions(+), 7 deletions(-)

diff --git a/dix/events.c b/dix/events.c
index 40673ce..36708bf 100644
--- a/dix/events.c
+++ b/dix/events.c
@@ -2149,6 +2149,7 @@ DeliverEventToInputClients(DeviceIntPtr dev, InputClients 
* inputclients,
 {
 int attempt;
 enum EventDeliveryState rc = EVENT_NOT_DELIVERED;
+Bool HaveDeviceButtonGrabClassClient = FALSE;
 
 for (; inputclients; inputclients = inputclients-next) {
 Mask mask;
@@ -2168,13 +2169,16 @@ DeliverEventToInputClients(DeviceIntPtr dev, 
InputClients * inputclients,
 events, count,
 mask, filter, grab))) {
 if (attempt  0) {
-rc = EVENT_DELIVERED;
-*client_return = client;
-*mask_return = mask;
-/* Success overrides non-success, so if we've been
- * successful on one client, return that */
-}
-else if (rc == EVENT_NOT_DELIVERED)
+if (!HaveDeviceButtonGrabClassClient) {
+rc = EVENT_DELIVERED;
+*client_return = client;
+*mask_return = mask;
+/* Success overrides non-success, so if we've been
+ * successful on one client, return that */
+if (mask  DeviceButtonGrabMask)
+HaveDeviceButtonGrabClassClient = TRUE;
+}
+} else if (rc == EVENT_NOT_DELIVERED)
 rc = EVENT_REJECTED;
 }
 }
-- 
1.8.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 V2] DDX/DPMS: Call dixSaveScreens() also when screen is turned on

2013-08-14 Thread Egbert Eich
DMPS calls dixSaveScreens() when turned off but not when turned
on. In most cases this is irrelevant as DPMS is done when a
key is hit in which case dixSaveScreens() will be called to
unblank anyhow. This isn't the case if we use xset (or the
DPMS extension directly) to unblank.
Check screenIsSaved to make sure the state needs to be changed
before calling dixSaveScreens().

Signed-off-by: Egbert Eich e...@freedesktop.org
---
v2: Add check if the screen saving states requires changing before calling 
dixSaveScreens().

 hw/xfree86/common/xf86DPMS.c | 9 -
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/hw/xfree86/common/xf86DPMS.c b/hw/xfree86/common/xf86DPMS.c
index 3f1e142..881cb27 100644
--- a/hw/xfree86/common/xf86DPMS.c
+++ b/hw/xfree86/common/xf86DPMS.c
@@ -36,6 +36,7 @@
 #include X11/X.h
 #include os.h
 #include globals.h
+#include windowstr.h
 #include xf86.h
 #include xf86Priv.h
 #ifdef DPMSExtension
@@ -159,7 +160,13 @@ DPMSSet(ClientPtr client, int level)
 return Success;
 
 if (level != DPMSModeOn) {
-rc = dixSaveScreens(client, SCREEN_SAVER_FORCER, ScreenSaverActive);
+if (xf86IsUnblank(screenIsSaved)) {
+rc = dixSaveScreens(client, SCREEN_SAVER_FORCER, 
ScreenSaverActive);
+if (rc != Success)
+return rc;
+}
+} else if (!xf86IsUnblank(screenIsSaved)) {
+rc = dixSaveScreens(client, SCREEN_SAVER_FORCER, ScreenSaverReset);
 if (rc != Success)
 return rc;
 }
-- 
1.8.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


Re: [PATCH] loader: Use RTLD_DEEPBIND if available to prefer local symbols

2013-08-14 Thread Egbert Eich
On Wed, Aug 14, 2013 at 10:51:27AM +0200, Michel Dänzer wrote:
 On Mon, 2013-08-12 at 18:25 +0200, Egbert Eich wrote:
  If there are namespace clashes among different drivers it would be
  preferrable if each driver used its local symbols. Use the
  RTLD_DEEPBIND if available to achive this.
 
 Makes sense to me, FWIW.
 
 Should this be extended to the other dlopen() calls as well, in
 particular in glx/glxdricommon.c? I wonder if that might help for
 https://bugs.freedesktop.org/show_bug.cgi?id=68085 e.g.

With the autoconf infrastructure in place now we might just as well 
- unless it is possible to enfore a strict namespace regime.
On the downside of course we will push the problem to platforms
that don't support RTLD_DEEPBIND.

Cheers,
Egbert.
___
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 V2 driver/vesa] Use default refresh by default

2013-08-14 Thread Egbert Eich
This seems to be a feature that isn't tested well.
Too many VBE 3.0  BIOSes are incorrectly implemented.

Signed-off-by: Egbert Eich e...@freedesktop.org
---
v2: Fixed spelling.

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

diff --git a/src/vesa.c b/src/vesa.c
index b73d104..931341a 100644
--- a/src/vesa.c
+++ b/src/vesa.c
@@ -841,8 +841,12 @@ VESAPreInit(ScrnInfoPtr pScrn, int flags)
 if (xf86ReturnOptValBool(pVesa-Options, OPTION_SHADOW_FB, TRUE)) 
pVesa-shadowFB = TRUE;
 
-if (xf86ReturnOptValBool(pVesa-Options, OPTION_DFLT_REFRESH, FALSE))
-   pVesa-defaultRefresh = TRUE;
+/*
+ * Use default refresh by default. Too many VBE 3.0
+ * BIOSes are incorrectly implemented.
+ */
+pVesa-defaultRefresh = xf86ReturnOptValBool(pVesa-Options,
+OPTION_DFLT_REFRESH, TRUE);
 
 pVesa-ModeSetClearScreen = FALSE;
 if (xf86ReturnOptValBool(pVesa-Options, OPTION_MODESET_CLEAR_SCREEN, 
-- 
1.8.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 driver/vesa] Make bool option parsing clearer and more consistent

2013-08-14 Thread Egbert Eich
When there's no need to know whether the user has set the value
of a configurable option (for logging for instance) the return
of xf86ReturnOptValBool() can be assigned directly.

Signed-off-by: Egbert Eich e...@freedesktop.org
---
 src/vesa.c | 11 +--
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/src/vesa.c b/src/vesa.c
index 931341a..dbe4ba6 100644
--- a/src/vesa.c
+++ b/src/vesa.c
@@ -838,8 +838,8 @@ VESAPreInit(ScrnInfoPtr pScrn, int flags)
 xf86ProcessOptions(pScrn-scrnIndex, pScrn-options, pVesa-Options);
 
 /* Use shadow by default */
-if (xf86ReturnOptValBool(pVesa-Options, OPTION_SHADOW_FB, TRUE)) 
-   pVesa-shadowFB = TRUE;
+pVesa-shadowFB = xf86ReturnOptValBool(pVesa-Options, OPTION_SHADOW_FB,
+  TRUE);
 
 /*
  * Use default refresh by default. Too many VBE 3.0
@@ -848,10 +848,9 @@ VESAPreInit(ScrnInfoPtr pScrn, int flags)
 pVesa-defaultRefresh = xf86ReturnOptValBool(pVesa-Options,
 OPTION_DFLT_REFRESH, TRUE);
 
-pVesa-ModeSetClearScreen = FALSE;
-if (xf86ReturnOptValBool(pVesa-Options, OPTION_MODESET_CLEAR_SCREEN, 
-FALSE))
-   pVesa-ModeSetClearScreen = TRUE;
+pVesa-ModeSetClearScreen =
+   xf86ReturnOptValBool(pVesa-Options,
+OPTION_MODESET_CLEAR_SCREEN, FALSE);
 
 if (!pVesa-defaultRefresh  !pVesa-strict_validation)
VBESetModeParameters(pScrn, pVesa-pVbe);
-- 
1.8.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


[REPOST PATCH xauth] Make matching algorithm mimic XauGet*AuthByAddr

2013-08-14 Thread Egbert Eich
Xlib (xcb) uses XauGetBestAuthByAddr() when looking for an
authorization. 'xauth [n]list $DISPLAY' used a slightly
stricter algorithm which doesn't find a possible authorization
for cases where either the family is set to FamilyWild or
address the address length is 0.

Signed-off-by: Egbert Eich e...@freedesktop.org
---
 process.c | 12 +++-
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/process.c b/process.c
index a9466a7..0e12a56 100644
--- a/process.c
+++ b/process.c
@@ -1064,11 +1064,13 @@ eq_auth(Xauth *a, Xauth *b)
 static int
 match_auth_dpy(register Xauth *a, register Xauth *b)
 {
-return ((a-family == b-family 
-a-address_length == b-address_length 
-a-number_length == b-number_length 
-memcmp(a-address, b-address, a-address_length) == 0 
-memcmp(a-number, b-number, a-number_length) == 0) ? 1 : 0);
+return (((a-family == FamilyWild || b-family == FamilyWild ||
+(a-family == b-family 
+ a-address_length == b-address_length 
+ memcmp(a-address, b-address, a-address_length) == 0)) 
+   (a-number_length == 0 || b-number_length == 0 ||
+(a-number_length == b-number_length 
+ memcmp(a-number, b-number, a-number_length) == 0))) ? 1 : 0);
 }
 
 /* return non-zero iff display and authorization type are the same */
-- 
1.8.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


Re: [PATCH] loader: Use RTLD_DEEPBIND if available to prefer local symbols

2013-08-14 Thread Egbert Eich
On Wed, Aug 14, 2013 at 04:08:06PM +0200, Mark Kettenis wrote:
 
 That's indeed a concern I have.  I think RTLD_DEEPBIND is only
 available with glibc.  So basically, this would sweep some fundamental
 design problems in Mesa under the carpet on the dominant platform,
 leaving everybody else out in the cold.
 
 The person who added the feature thinks highly of the people who think
 they need this: it:
 
   http://sourceware.org/ml/libc-hacker/2004-09/msg00083.html

Of course I agree with you there. 
There's another side to this, though: 

We had this set at SUSE for quite some time now. 

There was a support case where a customer needed to use two drivers 
one of which had code copied from the other.
It took quite a while until we realized this and found out that one 
driver was actually using code from the other (which had divereged
and thus caused a crash).
In the end our findings were irrelevant for upstream as the code 
there had been scheduled for removal already.

If you work for a vendor who ships products with a long term support 
commitment you would like to make sure your environment is 'robust' 
to spare your customer of any avoidable disruption and yourself of 
additional support burdeon. Thus added this feature.

I went ahead and posted this patch as I thought it might be useful 
to others who are in a similar situation.
 
We could make this feature configurable - and leave off by default.


Cheers,
Egbert.
___
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] DDX/PCI: Check harder for primary PCI device

2013-08-14 Thread Egbert Eich
Primary PCI devices are identified by checking for an 'PCIINFOCLASSES'
device which is VGA and has access to the memory bars enabled.
If there should be more than one device for which this is true
redo the check and also check if IO resoures are also enabled,
if this still doesn't turn up a unique result also check for
the presence of a BIOS rom.

Signed-off-by: Egbert Eich e...@freedesktop.org
---
 hw/xfree86/common/xf86pciBus.c | 47 +++---
 1 file changed, 44 insertions(+), 3 deletions(-)

diff --git a/hw/xfree86/common/xf86pciBus.c b/hw/xfree86/common/xf86pciBus.c
index 258988a..2303f90 100644
--- a/hw/xfree86/common/xf86pciBus.c
+++ b/hw/xfree86/common/xf86pciBus.c
@@ -134,9 +134,50 @@ xf86PciProbe(void)
 primaryBus.id.pci = info;
 }
 else {
-xf86Msg(X_NOTICE,
-More than one possible primary device found\n);
-primaryBus.type ^= (BusType) (-1);
+/*
+ * Ok, we found more than one possible primary device
+ * with this heuristic. Now also check if IO is enabled.
+ */
+int j;
+
+primaryBus.type = BUS_NONE;
+for (j = 0; j  num; j++) {
+info = xf86PciVideoInfo[j];
+pci_device_cfg_read_u16(info,  command, 4);
+
+if ((command  PCI_CMD_MEM_ENABLE)
+ (command  PCI_CMD_IO_ENABLE)
+ (IS_VGA(info-device_class))) {
+if (primaryBus.type == BUS_NONE) {
+primaryBus.type = BUS_PCI;
+primaryBus.id.pci = info;
+} else {
+primaryBus.type = BUS_NONE;
+for (j = 0; j  num; j++) {
+info = xf86PciVideoInfo[j];
+pci_device_cfg_read_u16(info, command, 4);
+
+if ((command  PCI_CMD_MEM_ENABLE)
+ (command  PCI_CMD_IO_ENABLE)
+ (IS_VGA(info-device_class))
+ info-rom_size) {
+if (primaryBus.type == BUS_NONE) {
+primaryBus.type = BUS_PCI;
+primaryBus.id.pci = info;
+} else {
+xf86Msg(X_NOTICE,
+More than one possible 
+primary device found\n);
+primaryBus.type ^= (BusType)(-1);
+break;
+}
+}
+}
+break;
+}
+}
+}
+break;
 }
 }
 }
-- 
1.8.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] DIX/ConfineTo: Improve algorithm to jump to the nearest point inside

2013-08-14 Thread Egbert Eich
ConfineToShape does not work well: The cursor often times doesn't jump
to the point closest to the current cursor position outside the shape.
This patch fixes this.

Signed-off-by: Egbert Eich e...@freedesktop.org
---
 dix/events.c | 84 +---
 1 file changed, 64 insertions(+), 20 deletions(-)

diff --git a/dix/events.c b/dix/events.c
index ed3138d..40673ce 100644
--- a/dix/events.c
+++ b/dix/events.c
@@ -672,32 +672,76 @@ ConfineToShape(DeviceIntPtr pDev, RegionPtr shape, int 
*px, int *py)
 {
 BoxRec box;
 int x = *px, y = *py;
-int incx = 1, incy = 1;
+int nbox;
+BoxPtr  pbox;
+intd, min = (~0U  1), dx2, dy2, x_r, y_r;
 
 if (RegionContainsPoint(shape, x, y, box))
 return;
-box = *RegionExtents(shape);
-/* this is rather crude */
-do {
-x += incx;
-if (x = box.x2) {
-incx = -1;
-x = *px - 1;
+
+for (nbox = RegionNumRects(shape),
+ pbox = RegionRects(shape);
+ nbox--;
+ pbox++) {
+if (pbox-x1  x  pbox-x2  x) {
+d = pbox-y1 - y;
+if (d = 0) {
+d *= d;
+if (d  min) {
+*px = x;
+*py = pbox-y1 + 1;
+min = d;
+}
+} else {
+d = pbox-y2 - y; d *= d;
+if (d  min) {
+*px = x;
+*py = pbox-y2 - 1;
+min = d;
+}
+}
 }
-else if (x  box.x1) {
-incx = 1;
-x = *px;
-y += incy;
-if (y = box.y2) {
-incy = -1;
-y = *py - 1;
+else if (pbox-y1  y  pbox-y2  y) {
+d = pbox-x1 - x;
+if (d = 0) {
+d *= d;
+if (d  min) {
+*px = pbox-x1 + 1;
+*py = y;
+min = d;
+}
+} else {
+d = pbox-x2 - x; d *= d;
+if (d  min) {
+*px = pbox-x2 - 1;
+*py = y;
+min = d;
+}
+}
+} else {
+dx2 = pbox-x1 - x;
+if (dx2 = 0) {
+dx2 *= dx2;
+x_r = pbox-x1 + 1;
+} else {
+dx2 = pbox-x2 - x; dx2 *= dx2;
+x_r = pbox-x2 - 1;
+}
+dy2 = pbox-y1 - y;
+if (dy2 = 0) {
+dy2 *= dy2;
+y_r = pbox-y1 + 1;
+} else {
+dy2 = pbox-y2 - y; dy2 *= dy2;
+y_r = pbox-y2 - 1;
+}
+if ((d = dx2 + dy2)  min) {
+*px = x_r;
+*py = y_r;
+min = d;
 }
-else if (y  box.y1)
-return; /* should never get here! */
 }
-} while (!RegionContainsPoint(shape, x, y, box));
-*px = x;
-*py = y;
+}
 }
 
 static void
-- 
1.8.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] XDMCP: For IPv6 add IPv6 link local addresses to the end of the list

2013-08-14 Thread Egbert Eich
From: Reinhard Max m...@suse.de

For IPv6 add a link local addresses to the end of the list passed to
the XDMCP servers.
Reason: for link local addresses the XDMCP server would need to either
know the interface thru a scope identifier or try all available interfaces.
If they don't this address will fail in which case the XDMCP server
could still try the other addresses passed - however some only try
the first address and then give up.
Even if this seems to be the wrong place to fix this it seems to be
easier than fixing all display servers.

Signed-off-by: Egbert Eich e...@freedesktop.org
---
 os/access.c | 45 +
 1 file changed, 45 insertions(+)

diff --git a/os/access.c b/os/access.c
index 88a44d9..2767fe3 100644
--- a/os/access.c
+++ b/os/access.c
@@ -505,6 +505,12 @@ DefineSelf(int fd)
 unsigned char *addr;
 int family;
 register HOST *host;
+struct ipv6_locallink {
+unsigned char *addr;
+int len;
+} *linklocal_list = NULL;
+int num_linklocals = 0;
+int i;
 
 #ifndef HAVE_GETIFADDRS
 
@@ -602,6 +608,20 @@ DefineSelf(int fd)
 else if (family == FamilyInternet6 
  IN6_IS_ADDR_LOOPBACK((struct in6_addr *) addr))
 continue;
+/* Register IPv6 link local addresses (fe80::/10) at the end,
+ * because they need a scope identifier, which we have no way
+ * of telling to the other end.
+ */
+
+if (family == FamilyInternet6 
+IN6_IS_ADDR_LINKLOCAL((struct in6_addr *)addr)) {
+linklocal_list = realloc(linklocal_list,
+ sizeof(struct ipv6_locallink)
+ * ++num_linklocals);
+linklocal_list[num_linklocals - 1].len = len;
+linklocal_list[num_linklocals - 1].addr = addr;
+continue;
+}
 #endif
 
 /*
@@ -667,6 +687,11 @@ DefineSelf(int fd)
 }
 #endif  /* XDMCP */
 }
+for (i = 0; i  num_linklocals; i++)
+XdmcpRegisterConnection (FamilyInternet6,
+ (char *)linklocal_list[i].addr,
+ linklocal_list[i].len);
+
 if (bufptr != buf)
 free(bufptr);
 #else   /* HAVE_GETIFADDRS */
@@ -735,6 +760,19 @@ DefineSelf(int fd)
 else if (family == FamilyInternet6 
  IN6_IS_ADDR_LOOPBACK((struct in6_addr *) addr))
 continue;
+/* Register IPv6 link local addresses (fe80::/10) at the end,
+ * because they need a scope identifier, which we have no way
+ * of telling to the other end.
+ */
+if (family == FamilyInternet6 
++IN6_IS_ADDR_LINKLOCAL((struct in6_addr *)addr)) {
+linklocal_list = realloc(linklocal_list,
+ sizeof(struct ipv6_locallink)
+ * ++num_linklocals);
+linklocal_list[num_linklocals - 1].len = len;
+linklocal_list[num_linklocals - 1].addr = addr;
+continue;
+}
 #endif
 XdmcpRegisterConnection(family, (char *) addr, len);
 #if defined(IPv6)  defined(AF_INET6)
@@ -752,9 +790,16 @@ DefineSelf(int fd)
 #endif  /* XDMCP */
 
 }   /* for */
+
+for (i = 0; i  num_linklocals; i++)
+XdmcpRegisterConnection (FamilyInternet6,
+ (char *)linklocal_list[i].addr,
+ linklocal_list[i].len);
 freeifaddrs(ifap);
 #endif  /* HAVE_GETIFADDRS */
 
+free(linklocal_list);
+
 /*
  * add something of FamilyLocalHost
  */
-- 
1.8.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] config/APM: Add option to disable building of APM support on Linux

2013-08-14 Thread Egbert Eich
APM support in the Xserver was used to restore the console mode
prior to a power management event. This was to ensure the mode
upon suspend/resume was one that the system firmware or kernel
could deal with.
APM support is now largely obsolete, KMS drivers don't require a
mode restoration anyhow. Therefore it should be possible to disable
this feature.

Signed-off-by: Egbert Eich e...@freedesktop.org
---
 configure.ac | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/configure.ac b/configure.ac
index 715840d..2ad1af5 100644
--- a/configure.ac
+++ b/configure.ac
@@ -228,10 +228,6 @@ dnl AGPGART headers
 AC_CHECK_HEADERS([linux/agpgart.h sys/agpio.h sys/agpgart.h], AGP=yes)
 AM_CONDITIONAL(AGP, [test x$AGP = xyes])
 
-dnl APM header
-AC_CHECK_HEADERS([linux/apm_bios.h], LNXAPM=yes)
-AM_CONDITIONAL(LNXAPM, [test x$LNXAPM = xyes])
-
 dnl fbdev header
 AC_CHECK_HEADERS([linux/fb.h], FBDEV=yes)
 AM_CONDITIONAL(FBDEVHW, [test x$FBDEV = xyes])
@@ -636,6 +632,7 @@ AC_ARG_ENABLE(libdrm, 
AS_HELP_STRING([--enable-libdrm], [Build Xorg with
 AC_ARG_ENABLE(clientids,  AS_HELP_STRING([--disable-clientids], [Build 
Xorg with client ID tracking (default: enabled)]), [CLIENTIDS=$enableval], 
[CLIENTIDS=yes])
 AC_ARG_ENABLE(pciaccess, AS_HELP_STRING([--enable-pciaccess], [Build Xorg with 
pciaccess library (default: enabled)]), [PCI=$enableval], [PCI=yes])
 AC_ARG_ENABLE(linux_acpi, AC_HELP_STRING([--disable-linux-acpi], [Disable 
building ACPI support on Linux (if available).]), 
[enable_linux_acpi=$enableval], [enable_linux_acpi=yes])
+AC_ARG_ENABLE(linux_apm, AC_HELP_STRING([--disable-linux-apm], [Disable 
building APM support on Linux (if available).]), [enable_linux_apm=$enableval], 
[enable_linux_apm=yes])
 
 dnl DDXes.
 AC_ARG_ENABLE(xorg,  AS_HELP_STRING([--enable-xorg], [Build 
Xorg server (default: auto)]), [XORG=$enableval], [XORG=auto])
@@ -1718,6 +1715,8 @@ if test x$XORG = xyes; then
  *)
;;
esac
+   dnl APM header
+   AC_CHECK_HEADERS([linux/apm_bios.h], 
[linux_apm=$enable_linux_apm])
;;
  freebsd* | kfreebsd*-gnu | dragonfly*)
XORG_OS_SUBDIR=bsd
@@ -1880,6 +1879,7 @@ AM_CONDITIONAL([XORG_BUS_BSDPCI], [test 
x$xorg_bus_bsdpci = xyes])
 AM_CONDITIONAL([XORG_BUS_SPARC], [test x$xorg_bus_sparc = xyes])
 AM_CONDITIONAL([LINUX_ALPHA], [test x$linux_alpha = xyes])
 AM_CONDITIONAL([LNXACPI], [test x$linux_acpi = xyes])
+AM_CONDITIONAL(LNXAPM, [test x$linux_apm = xyes])
 AM_CONDITIONAL([SOLARIS_ASM_INLINE], [test x$solaris_asm_inline = xyes])
 AM_CONDITIONAL([SOLARIS_VT], [test x$solaris_vt = xyes])
 AM_CONDITIONAL([DGA], [test x$DGA = xyes])
-- 
1.8.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] OS/ACPI: Make socket to acpid is non-blocking

2013-08-14 Thread Egbert Eich
If a connect to the acpid socket is delayed connect will
hang stalling the Xserver.  To avoid this this create a
non-blocking socket.
If connect returns EINPROGRESS use select() and getsockopt()
to check for completion of the connect request.
Use a different timeout to select() wether we connect for
the first time or reconnect.

Signed-off-by: Egbert Eich e...@freedesktop.org
---
 hw/xfree86/os-support/linux/lnx_acpi.c | 34 +-
 1 file changed, 29 insertions(+), 5 deletions(-)

diff --git a/hw/xfree86/os-support/linux/lnx_acpi.c 
b/hw/xfree86/os-support/linux/lnx_acpi.c
index 52cc708..364c12b 100644
--- a/hw/xfree86/os-support/linux/lnx_acpi.c
+++ b/hw/xfree86/os-support/linux/lnx_acpi.c
@@ -32,7 +32,7 @@
 #define ACPI_VIDEO_HEAD_INVALID(~0u - 1)
 #define ACPI_VIDEO_HEAD_END(~0u)
 
-static PMClose doLnxACPIOpen(void);
+static PMClose doLnxACPIOpen(struct timeval *);
 static void lnxCloseACPI(void);
 static pointer ACPIihPtr = NULL;
 static OsTimerPtr acpiTimer = NULL;
@@ -58,8 +58,9 @@ lnxACPIReopen(OsTimerPtr timer, CARD32 time, pointer arg)
 static CARD32
 lnxACPICheckTimer(OsTimerPtr timer, CARD32 now, pointer arg)
 {
+struct timeval timeval = { 0, 0 };
 DebugF(ACPI: trying to reopen\n);
-if (doLnxACPIOpen()) {
+if (doLnxACPIOpen(timeval)) {
 DebugF(ACPI: successfully reopened\n);
 acpiTimer = NULL;
 return 0;
@@ -146,7 +147,7 @@ lnxACPIConfirmEventToOs(int fd, pmEvent event)
 }
 
 static PMClose
-doLnxACPIOpen(void)
+doLnxACPIOpen(struct timeval *tv_p)
 {
 int fd = -1;
 struct sockaddr_un addr;
@@ -157,13 +158,34 @@ doLnxACPIOpen(void)
 return NULL;
 
 DebugF(ACPI: Opening device\n);
-fd = socket(AF_UNIX, SOCK_STREAM, 0);
+fd = socket(AF_UNIX, SOCK_STREAM | SOCK_NONBLOCK, 0);
 if (fd  -1) {
 memset(addr, 0, sizeof(addr));
 addr.sun_family = AF_UNIX;
 strcpy(addr.sun_path, ACPI_SOCKET);
 r = connect(fd, (struct sockaddr*)addr, sizeof(addr));
 if (r == -1) {
+int sock_errno = errno;
+if (sock_errno == EINPROGRESS) {
+fd_set fds;
+int result;
+do {
+FD_ZERO(fds);
+FD_SET(fd, fds);
+result = select(fd + 1, NULL, fds, NULL, tv_p);
+}  while (result  0  errno == EINTR);
+if (result  0)
+sock_errno = errno;
+else if (result  0) {
+int sock_errno;
+socklen_t size = sizeof(sock_errno);
+if (0  getsockopt(fd, SOL_SOCKET, SO_ERROR, sock_errno,
+   size))
+sock_errno = errno;
+if (!sock_errno)
+goto success;
+}
+}
 if (errno != warned)
 xf86MsgVerb(X_WARNING,3,Open ACPI failed (%s) (%s)\n,
 ACPI_SOCKET, strerror(errno));
@@ -175,6 +197,7 @@ doLnxACPIOpen(void)
 } else
 return NULL;
 
+ success:
 xf86PMGetEventFromOs = lnxACPIGetEventFromOs;
 xf86PMConfirmEventToOs = lnxACPIConfirmEventToOs;
 ACPIihPtr = xf86AddGeneralHandler(fd, xf86HandlePMEvents, NULL);
@@ -195,8 +218,9 @@ PMClose
 lnxACPIOpen(void)
 {
 PMClose ret;
+struct timeval timeval = { 0, 3 };
 DebugF(ACPI: OSPMOpen called\n);
-ret = doLnxACPIOpen();
+ret = doLnxACPIOpen(timeval);
 
 return ret;
 }
-- 
1.8.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


Re: [PATCH] DDX/PCI: Check harder for primary PCI device

2013-08-14 Thread Egbert Eich
On Wed, Aug 14, 2013 at 07:50:50PM +0200, Mark Kettenis wrote:
  From: Egbert Eich e...@freedesktop.org
  Date: Wed, 14 Aug 2013 18:17:02 +0200
  
  Primary PCI devices are identified by checking for an 'PCIINFOCLASSES'
  device which is VGA and has access to the memory bars enabled.
  If there should be more than one device for which this is true
  redo the check and also check if IO resoures are also enabled,
  if this still doesn't turn up a unique result also check for
  the presence of a BIOS rom.
 
 Assuming this is a patch carried by SuSE, I'm a little bit surprised
 this is needed.  These days the primary VGA device should be detected
 by libpciaccess through the pci_device_is_boot_vga() call, and I
 believe the detection code in xf86pciBus.c should only be hit if that
 method isn't implemented in libpciaccess.  But for Linux
 pci_device_is_boot_vga() is implemented.
 

Like the two patches for ACPI support I've sent today, it is not
needed for the Xserver we ship today. However for an enterprise
product with long term support this patch was needed and still is
to fix a real problem that has been observed out in the field.

Since the code that's being fixed still exists I believe there
is still some value in integrating this - unless we decide to 
drop this code entirely. (Same is true for the ACPI support fixes).

I know - this should have done a long time ago but I don't always 
find the time to clean up fixes we have and port them to current 
upstream.

I know it would be even better to check the heuristics used by
libpciaccess and see if it already covers the case which this 
patch is trying to fix - but hey.

Cheers,
Egbert.


  Signed-off-by: Egbert Eich e...@freedesktop.org
  ---
   hw/xfree86/common/xf86pciBus.c | 47 
  +++---
   1 file changed, 44 insertions(+), 3 deletions(-)
  
  diff --git a/hw/xfree86/common/xf86pciBus.c b/hw/xfree86/common/xf86pciBus.c
  index 258988a..2303f90 100644
  --- a/hw/xfree86/common/xf86pciBus.c
  +++ b/hw/xfree86/common/xf86pciBus.c
  @@ -134,9 +134,50 @@ xf86PciProbe(void)
   primaryBus.id.pci = info;
   }
   else {
  -xf86Msg(X_NOTICE,
  -More than one possible primary device 
  found\n);
  -primaryBus.type ^= (BusType) (-1);
  +/*
  + * Ok, we found more than one possible primary device
  + * with this heuristic. Now also check if IO is 
  enabled.
  + */
  +int j;
  +
  +primaryBus.type = BUS_NONE;
  +for (j = 0; j  num; j++) {
  +info = xf86PciVideoInfo[j];
  +pci_device_cfg_read_u16(info,  command, 4);
  +
  +if ((command  PCI_CMD_MEM_ENABLE)
  + (command  PCI_CMD_IO_ENABLE)
  + (IS_VGA(info-device_class))) {
  +if (primaryBus.type == BUS_NONE) {
  +primaryBus.type = BUS_PCI;
  +primaryBus.id.pci = info;
  +} else {
  +primaryBus.type = BUS_NONE;
  +for (j = 0; j  num; j++) {
  +info = xf86PciVideoInfo[j];
  +pci_device_cfg_read_u16(info, 
  command, 4);
  +
  +if ((command  PCI_CMD_MEM_ENABLE)
  + (command  PCI_CMD_IO_ENABLE)
  + (IS_VGA(info-device_class))
  + info-rom_size) {
  +if (primaryBus.type == BUS_NONE) {
  +primaryBus.type = BUS_PCI;
  +primaryBus.id.pci = info;
  +} else {
  +xf86Msg(X_NOTICE,
  +More than one 
  possible 
  +primary device 
  found\n);
  +primaryBus.type ^= 
  (BusType)(-1);
  +break;
  +}
  +}
  +}
  +break;
  +}
  +}
  +}
  +break;
   }
   }
   }
  -- 
  1.8.1.4
  
  ___
  xorg-devel@lists.x.org: X.Org development
  Archives: http://lists.x.org/archives/xorg-devel
  Info: http

[PATCH V2 xauth] Make matching algorithm mimic XauGet*AuthByAddr

2013-08-14 Thread Egbert Eich
Xlib (xcb) uses XauGetBestAuthByAddr() when looking for an
authorization. 'xauth [n]list $DISPLAY' used a slightly
stricter algorithm which doesn't find a possible authorization
for cases where either the family is set to FamilyWild or
address the address length is 0.

Signed-off-by: Egbert Eich e...@freedesktop.org
---
v2: Tried to make condition more readable as suggested 
by walter harms wha...@bfs.de.

 process.c | 14 +-
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/process.c b/process.c
index a9466a7..7ae5f21 100644
--- a/process.c
+++ b/process.c
@@ -1064,11 +1064,15 @@ eq_auth(Xauth *a, Xauth *b)
 static int
 match_auth_dpy(register Xauth *a, register Xauth *b)
 {
-return ((a-family == b-family 
-a-address_length == b-address_length 
-a-number_length == b-number_length 
-memcmp(a-address, b-address, a-address_length) == 0 
-memcmp(a-number, b-number, a-number_length) == 0) ? 1 : 0);
+if (a-family != FamilyWild  b-family != FamilyWild 
+(a-family != b-family || a-address_length != b-address_length ||
+ memcmp(a-address, b-address, a-address_length) != 0))
+return 0;
+if (a-number_length != 0  b-number_length != 0 
+  (a-number_length != b-number_length ||
+   memcmp(a-number, b-number, a-number_length) != 0))
+return 0;
+return 1;
 }
 
 /* return non-zero iff display and authorization type are the same */
-- 
1.8.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 V2] xnest: Ignore GetImage() error in xnestGetImage()

2013-08-13 Thread Egbert Eich
From: Radek Doulik r...@novell.com

When an Xnest instance is not viewable it will crash when a client in
that instance calls GetImage. This is because the Xnest server will
itself receives a BadMatch error.
This patch ignores the error. The application which has requested the
image will receive garbage - this however is fully legal according
to the specs as obscured areas will always contain garbage if there
isn't some sort of backing store as discussed in
https://bugs.freedesktop.org/show_bug.cgi?id=9488
The applied patch is a version from Dadek Doulik.

v2: Call XSync() before changing error handlers as suggested by
Daniel Stone dan...@fooishbar.org.

Signed-off-by: Egbert Eich e...@freedesktop.org
---
 hw/xnest/GCOps.c | 14 ++
 1 file changed, 14 insertions(+)

diff --git a/hw/xnest/GCOps.c b/hw/xnest/GCOps.c
index e26a136..7b1956d 100644
--- a/hw/xnest/GCOps.c
+++ b/hw/xnest/GCOps.c
@@ -94,15 +94,29 @@ xnestPutImage(DrawablePtr pDrawable, GCPtr pGC, int depth, 
int x, int y,
 }
 }
 
+static int
+xnestIgnoreErrorHandler (Display *display,
+ XErrorEvent *event)
+{
+return False; /* return value is ignored */
+}
+
 void
 xnestGetImage(DrawablePtr pDrawable, int x, int y, int w, int h,
   unsigned int format, unsigned long planeMask, char *pImage)
 {
 XImage *ximage;
 int length;
+int (*old_handler)(Display*, XErrorEvent*);
+
+/* we may get BadMatch error when xnest window is minimized */
+XSync(xnestDisplay, False);
+old_handler = XSetErrorHandler (xnestIgnoreErrorHandler);
 
 ximage = XGetImage(xnestDisplay, xnestDrawable(pDrawable),
x, y, w, h, planeMask, format);
+XSync(xnestDisplay, False);
+XSetErrorHandler(old_handler);
 
 if (ximage) {
 length = ximage-bytes_per_line * ximage-height;
-- 
1.8.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


Re: [PATCH] DDX/fbdevhw: Make error message on failed FBIOBLANK less noisy and scarey

2013-08-13 Thread Egbert Eich
On Tue, Aug 13, 2013 at 09:14:25AM +0200, walter harms wrote:
 
 I do not get the point, do you expect ioctl to modify the errno ?

Right, darn.

After thinking about it I believe I found a better idea how to deal
with the issue.

Cheers,
Egbert.
___
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 replace] DDX/fbdevhw: Disable FBIOBLANK ioctl if not supported

2013-08-13 Thread Egbert Eich
Some ioctls may not be supported by the kernel however their failure
is non-fatal to the driver. Unfortunately we only know once we try
to execute the ioctl however the sematics of the fbdev driver API
doesn't allow upper layers to disable the call.
Instead of changing the fbdevHW driver API just disable the call to
this ioctl on the module level when detecting such a case.

Signed-off-by: Egbert Eich e...@freedesktop.org
---
 hw/xfree86/fbdevhw/fbdevhw.c | 45 +++-
 1 file changed, 40 insertions(+), 5 deletions(-)

diff --git a/hw/xfree86/fbdevhw/fbdevhw.c b/hw/xfree86/fbdevhw/fbdevhw.c
index cbb4093..e56391b 100644
--- a/hw/xfree86/fbdevhw/fbdevhw.c
+++ b/hw/xfree86/fbdevhw/fbdevhw.c
@@ -76,8 +76,14 @@ typedef struct {
 /* buildin video mode */
 DisplayModeRec buildin;
 
+/* disable non-fatal unsupported ioctls */
+CARD32 unsupported_ioctls;
 } fbdevHWRec, *fbdevHWPtr;
 
+enum {
+FBIOBLANK_UNSUPPORTED = 0,
+};
+
 Bool
 fbdevHWGetRec(ScrnInfoPtr pScrn)
 {
@@ -833,6 +839,9 @@ fbdevHWDPMSSet(ScrnInfoPtr pScrn, int mode, int flags)
 if (!pScrn-vtSema)
 return;
 
+if (fPtr-unsupported_ioctls  (1  FBIOBLANK_UNSUPPORTED))
+return;
+
 switch (mode) {
 case DPMSModeOn:
 fbmode = 0;
@@ -850,9 +859,21 @@ fbdevHWDPMSSet(ScrnInfoPtr pScrn, int mode, int flags)
 return;
 }
 
-if (-1 == ioctl(fPtr-fd, FBIOBLANK, (void *) fbmode))
-xf86DrvMsg(pScrn-scrnIndex, X_ERROR,
-   FBIOBLANK: %s\n, strerror(errno));
+if (-1 == ioctl(fPtr-fd, FBIOBLANK, (void *) fbmode)) {
+switch (errno) {
+case EAGAIN:
+case EINTR:
+case ERESTART:
+xf86DrvMsg(pScrn-scrnIndex, X_INFO,
+   FBIOBLANK: %s\n, strerror(errno));
+break;
+default:
+fPtr-unsupported_ioctls |= (1  FBIOBLANK_UNSUPPORTED);
+xf86DrvMsg(pScrn-scrnIndex, X_INFO,
+   FBIOBLANK: %s (Screen blanking not supported 
+   by kernel - disabling)\n, strerror(errno));
+}
+}
 }
 
 Bool
@@ -865,11 +886,25 @@ fbdevHWSaveScreen(ScreenPtr pScreen, int mode)
 if (!pScrn-vtSema)
 return TRUE;
 
+if (fPtr-unsupported_ioctls  (1  FBIOBLANK_UNSUPPORTED))
+return FALSE;
+
 unblank = xf86IsUnblank(mode);
 
 if (-1 == ioctl(fPtr-fd, FBIOBLANK, (void *) (1 - unblank))) {
-xf86DrvMsg(pScrn-scrnIndex, X_ERROR,
-   FBIOBLANK: %s\n, strerror(errno));
+switch (errno) {
+case EAGAIN:
+case EINTR:
+case ERESTART:
+xf86DrvMsg(pScrn-scrnIndex, X_INFO,
+   FBIOBLANK: %s\n, strerror(errno));
+break;
+default:
+fPtr-unsupported_ioctls |= (1  FBIOBLANK_UNSUPPORTED);
+xf86DrvMsg(pScrn-scrnIndex, X_INFO,
+   FBIOBLANK: %s (Screen blanking not supported 
+   by kernel - disabling)\n, strerror(errno));
+}
 return FALSE;
 }
 
-- 
1.8.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


  1   2   3   >