[PATCH] Set a flag property on the root window to say if the X server VT is active

2014-03-31 Thread Michael Thayer
An X11 client may need to know whether the X server virtual terminal is
currently the active one.  This change adds a root window property which
provides that information.  Intended interface user: the VirtualBox Guest
Additions.
Signed-off-by: Michael Thayer michael.tha...@oracle.com
---
This is an updated version of a previous patch to address concerns expressed
by Daniel Martin.

Regards,

Michael

 hw/xfree86/common/xf86Events.c  | 28 
 hw/xfree86/common/xf86Init.c| 16 +++-
 hw/xfree86/common/xf86Privstr.h |  4 
 3 files changed, 47 insertions(+), 1 deletion(-)

diff --git a/hw/xfree86/common/xf86Events.c b/hw/xfree86/common/xf86Events.c
index 06af739..35a673d 100644
--- a/hw/xfree86/common/xf86Events.c
+++ b/hw/xfree86/common/xf86Events.c
@@ -56,6 +56,7 @@
 #include X11/X.h
 #include X11/Xpoll.h
 #include X11/Xproto.h
+#include X11/Xatom.h
 #include misc.h
 #include compiler.h
 #include xf86.h
@@ -431,6 +432,29 @@ xf86EnableInputDeviceForVTSwitch(InputInfoPtr pInfo)
 pInfo-flags = ~XI86_DEVICE_DISABLED;
 }
 
+/*
+ * xf86UpdateHasVTProperty --
+ *Update a flag property on the root window to say whether the server VT
+ *is currently the active one as some clients need to know this.
+ */
+static void
+xf86UpdateHasVTProperty(Bool hasVT)
+{
+Atom property_name;
+int32_t value = hasVT ? 1 : 0;
+int i;
+
+property_name = MakeAtom(HAS_VT_ATOM_NAME, sizeof(HAS_VT_ATOM_NAME) - 1,
+ FALSE);
+if (property_name == BAD_RESOURCE)
+FatalError(Failed to retrieve \HAS_VT\ atom\n);
+for (i = 0; i  xf86NumScreens; i++) {
+ChangeWindowProperty(xf86ScrnToScreen(xf86Screens[i])-root,
+ property_name, XA_INTEGER, 32,
+ PropModeReplace, 1, value, TRUE);
+}
+}
+
 void
 xf86VTLeave(void)
 {
@@ -490,6 +514,8 @@ xf86VTLeave(void)
 if (xorgHWAccess)
 xf86DisableIO();
 
+xf86UpdateHasVTProperty(FALSE);
+
 return;
 
 switch_failed:
@@ -574,6 +600,8 @@ xf86VTEnter(void)
 xf86platformVTProbe();
 #endif
 
+xf86UpdateHasVTProperty(TRUE);
+
 OsReleaseSIGIO();
 }
 
diff --git a/hw/xfree86/common/xf86Init.c b/hw/xfree86/common/xf86Init.c
index 4579ff5..5a45004 100644
--- a/hw/xfree86/common/xf86Init.c
+++ b/hw/xfree86/common/xf86Init.c
@@ -387,6 +387,11 @@ InstallSignalHandlers(void)
 }
 }
 
+/* The memory storing the initial value of the XFree86_has_VT root window
+ * property.  This has to remain available until server start-up, so we just
+ * use a global. */
+static CARD32 HasVTValue = 1;
+
 /*
  * InitOutput --
  * Initialize screenInfo for all actually accessible framebuffers.
@@ -731,7 +736,9 @@ InitOutput(ScreenInfo * pScreenInfo, int argc, char **argv)
 if (xf86Info.vtno = 0) {
 #define VT_ATOM_NAME XFree86_VT
 Atom VTAtom = -1;
+Atom HasVTAtom = -1;
 CARD32 *VT = NULL;
+CARD32 *HasVT = HasVTValue;
 int ret;
 
 /* This memory needs to stay available until the screen has been
@@ -744,6 +751,8 @@ InitOutput(ScreenInfo * pScreenInfo, int argc, char **argv)
 *VT = xf86Info.vtno;
 
 VTAtom = MakeAtom(VT_ATOM_NAME, sizeof(VT_ATOM_NAME) - 1, TRUE);
+HasVTAtom = MakeAtom(HAS_VT_ATOM_NAME,
+ sizeof(HAS_VT_ATOM_NAME) - 1, TRUE);
 
 for (i = 0, ret = Success; i  xf86NumScreens  ret == Success;
  i++) {
@@ -751,9 +760,14 @@ InitOutput(ScreenInfo * pScreenInfo, int argc, char **argv)
 xf86RegisterRootWindowProperty(xf86Screens[i]-scrnIndex,
VTAtom, XA_INTEGER, 32, 1,
VT);
+if (ret == Success)
+ret = xf86RegisterRootWindowProperty(xf86Screens[i]
+ -scrnIndex,
+ HasVTAtom, XA_INTEGER,
+ 32, 1, HasVT);
 if (ret != Success)
 xf86DrvMsg(xf86Screens[i]-scrnIndex, X_WARNING,
-   Failed to register VT property\n);
+   Failed to register VT properties\n);
 }
 }
 
diff --git a/hw/xfree86/common/xf86Privstr.h b/hw/xfree86/common/xf86Privstr.h
index f7a9c9f..410ef17 100644
--- a/hw/xfree86/common/xf86Privstr.h
+++ b/hw/xfree86/common/xf86Privstr.h
@@ -163,4 +163,8 @@ typedef struct _RootWinProp {
 #define WSCONS   32
 #endif
 
+/* Root window property to tell clients whether our VT is currently active.
+ * Name chosen to match the XFree86_VT property. */
+#define HAS_VT_ATOM_NAME XFree86_has_VT
+
 #endif  /* _XF86PRIVSTR_H */
--
ORACLE Deutschland B.V.  Co. KG   Michael Thayer

[PATCH xf86-input-mouse] Do not drop the result of protocol detection

2014-03-31 Thread Michael Thayer
In MousePickProtocol() with protocol PROT_AUTO we probe for the protocol to
use but drop the result in most cases.  This was causing DEVICE_INIT and
DEVICE_ON to fail to be called with the VUID protocol.  Git history suggests
that this code was originally meant to cover both PS/2 auto-detection and OS-
specific detection, but that only the first case was implemented at the time.
Now that only the second is needed dropping the result to keep the protocol
as PROT_AUTO is presumably no longer useful and seems to actively breaking
things.
Signed-off-by: Michael Thayer michael.tha...@oracle.com
---
 src/mouse.c |7 ++-
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/src/mouse.c b/src/mouse.c
index 2da2b4d..ff8d799 100644
--- a/src/mouse.c
+++ b/src/mouse.c
@@ -843,11 +843,8 @@ MousePickProtocol(InputInfoPtr pInfo, const char* device,
 {
 const char *osProt;
 if (osInfo-SetupAuto  (osProt = osInfo-SetupAuto(pInfo,NULL))) {
-MouseProtocolID id = ProtocolNameToID(osProt);
-if (id == PROT_UNKNOWN || id == PROT_UNSUP) {
-protocolID = id;
-protocol = osProt;
-}
+protocolID = ProtocolNameToID(osProt);
+protocol = osProt;
 }
 }
 
-- 
ORACLE Deutschland B.V.  Co. KG   Michael Thayer
Werkstrasse 24 VirtualBox engineering
71384 Weinstadt, Germany   mailto:michael.tha...@oracle.com

Hauptverwaltung: Riesstr. 25, D-80992 München
Registergericht: Amtsgericht München, HRA 95603

Geschäftsführer: Jürgen Kunz 
Komplementärin: ORACLE Deutschland Verwaltung B.V.
Hertogswetering 163/167, 3543 AS Utrecht, Niederlande
Handelsregister der Handelskammer Midden-Niederlande, Nr. 30143697
Geschäftsführer: Alexander van der Ven, Astrid Kepper, Val Maher

___
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] Add a return value to load_cursor_argb() to allow it to report failure

2014-03-31 Thread Michael Thayer
load_cursor_argb() may need to be able to fail and have the server fall back
to a software cursor in at least the following circumstances.
1) The hardware can only support some ARGB cursors and this does not just
depend on cursor size.
2) Virtual hardware may not wish to pass through a cursor to the host at a
particular time but may wish to accept the same cursor at another time.
This patch adds a return value to the API and makes the server do the
software fall-back on failure.

Signed-off-by: Michael Thayer michael.tha...@oracle.com
---
I would also be interested in having set_cursor_position() able to fail and
trigger a software fall-back.  VirtualBox can use the host cursor as a
hardware cursor for a guest system, but it can't change its position, so if
the guest wants the cursor anywhere except where the host put it (e.g.
another device controlling it, or the cursor confined to a screen region)
it needs to draw it itself.  Of course, set_cursor_position() should still be
called even after it has failed once so that we could switch back if the
positions matched again.

 hw/xfree86/common/xf86Module.h |  2 +-
 hw/xfree86/modes/xf86Crtc.h|  4 ++--
 hw/xfree86/modes/xf86Cursors.c | 35 ++-
 hw/xfree86/ramdac/IBM.c|  6 --
 hw/xfree86/ramdac/TI.c |  3 ++-
 hw/xfree86/ramdac/xf86Cursor.c | 11 ++-
 hw/xfree86/ramdac/xf86Cursor.h |  4 ++--
 hw/xfree86/ramdac/xf86CursorPriv.h |  2 +-
 hw/xfree86/ramdac/xf86HWCurs.c | 15 +--
 9 files changed, 49 insertions(+), 33 deletions(-)

diff --git a/hw/xfree86/common/xf86Module.h b/hw/xfree86/common/xf86Module.h
index e8c24f2..62ac95d 100644
--- a/hw/xfree86/common/xf86Module.h
+++ b/hw/xfree86/common/xf86Module.h
@@ -80,7 +80,7 @@ typedef enum {
  * mask is 0x.
  */
 #define ABI_ANSIC_VERSION  SET_ABI_VERSION(0, 4)
-#define ABI_VIDEODRV_VERSION   SET_ABI_VERSION(16, 0)
+#define ABI_VIDEODRV_VERSION   SET_ABI_VERSION(17, 0)
 #define ABI_XINPUT_VERSION SET_ABI_VERSION(21, 0)
 #define ABI_EXTENSION_VERSION  SET_ABI_VERSION(8, 0)
 #define ABI_FONT_VERSION   SET_ABI_VERSION(0, 6)
diff --git a/hw/xfree86/modes/xf86Crtc.h b/hw/xfree86/modes/xf86Crtc.h
index c127d78..5407deb 100644
--- a/hw/xfree86/modes/xf86Crtc.h
+++ b/hw/xfree86/modes/xf86Crtc.h
@@ -186,13 +186,13 @@ typedef struct _xf86CrtcFuncs {
 /**
  * Load monochrome image
  */
-void
+Bool
  (*load_cursor_image) (xf86CrtcPtr crtc, CARD8 *image);
 
 /**
  * Load ARGB image
  */
-void
+Bool
  (*load_cursor_argb) (xf86CrtcPtr crtc, CARD32 *image);
 
 /**
diff --git a/hw/xfree86/modes/xf86Cursors.c b/hw/xfree86/modes/xf86Cursors.c
index 2b0db34..10ef6f6 100644
--- a/hw/xfree86/modes/xf86Cursors.c
+++ b/hw/xfree86/modes/xf86Cursors.c
@@ -211,7 +211,7 @@ set_bit(CARD8 *image, xf86CursorInfoPtr cursor_info, int x, 
int y, Bool mask)
 /*
  * Load a two color cursor into a driver that supports only ARGB cursors
  */
-static void
+static Bool
 xf86_crtc_convert_cursor_to_argb(xf86CrtcPtr crtc, unsigned char *src)
 {
 ScrnInfoPtr scrn = crtc-scrn;
@@ -244,7 +244,7 @@ xf86_crtc_convert_cursor_to_argb(xf86CrtcPtr crtc, unsigned 
char *src)
 bits = 0;
 cursor_image[y * cursor_info-MaxWidth + x] = bits;
 }
-crtc-funcs-load_cursor_argb(crtc, cursor_image);
+return crtc-funcs-load_cursor_argb(crtc, cursor_image);
 }
 
 /*
@@ -415,7 +415,7 @@ xf86_set_cursor_position(ScrnInfoPtr scrn, int x, int y)
 /*
  * Load a two-color cursor into a crtc, performing rotation as needed
  */
-static void
+static Bool
 xf86_crtc_load_cursor_image(xf86CrtcPtr crtc, CARD8 *src)
 {
 ScrnInfoPtr scrn = crtc-scrn;
@@ -450,13 +450,13 @@ xf86_crtc_load_cursor_image(xf86CrtcPtr crtc, CARD8 *src)
 set_bit(cursor_image, cursor_info, x, y, TRUE);
 }
 }
-crtc-funcs-load_cursor_image(crtc, cursor_image);
+return crtc-funcs-load_cursor_image(crtc, cursor_image);
 }
 
 /*
  * Load a cursor image into all active CRTCs
  */
-static void
+static Bool
 xf86_load_cursor_image(ScrnInfoPtr scrn, unsigned char *src)
 {
 xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
@@ -466,12 +466,17 @@ xf86_load_cursor_image(ScrnInfoPtr scrn, unsigned char 
*src)
 xf86CrtcPtr crtc = xf86_config-crtc[c];
 
 if (crtc-enabled) {
-if (crtc-funcs-load_cursor_image)
-xf86_crtc_load_cursor_image(crtc, src);
-else if (crtc-funcs-load_cursor_argb)
-xf86_crtc_convert_cursor_to_argb(crtc, src);
+if (crtc-funcs-load_cursor_image) {
+if (!xf86_crtc_load_cursor_image(crtc, src))
+return FALSE;
+} else if (crtc-funcs-load_cursor_argb) {
+if (!xf86_crtc_convert_cursor_to_argb(crtc, src))
+return FALSE;
+} else
+return FALSE;
  

Re: [PATCH libxtrans] Increase UNIX socket buffer size

2014-03-31 Thread Hans de Goede
Hi,

On 03/29/2014 11:51 PM, Mark Kettenis wrote:
 From: Mark Kettenis kette...@openbsd.org
 
 Some systems provide a really small default buffer size for UNIX sockets.
 Bump it up to 64k if necessary such that large transfers (such as
 XGetImage() on a 8-megapixel image) don't take tens of seconds.

Thanks,

I've pushed this to the libxtrans git repo, and it will be included
in the 1.3.4 release I'm about to do.

Regards,

Hans

 ---
  Xtranssock.c | 21 +
  1 file changed, 21 insertions(+)
 
 diff --git a/Xtranssock.c b/Xtranssock.c
 index fdf1dd7..6cde146 100644
 --- a/Xtranssock.c
 +++ b/Xtranssock.c
 @@ -445,6 +445,27 @@ TRANS(SocketOpen) (int i, int type)
  }
  #endif
  
 +/*
 + * Some systems provide a really small default buffer size for
 + * UNIX sockets.  Bump it up a bit such that large transfers don't
 + * proceed at glacial speed.
 + */
 +#ifdef SO_SNDBUF
 +if (Sockettrans2devtab[i].family == AF_UNIX)
 +{
 + SOCKLEN_T len = sizeof (int);
 + int val;
 +
 + if (getsockopt (ciptr-fd, SOL_SOCKET, SO_SNDBUF,
 + (char *) val, len) == 0  val  64 * 1024)
 + {
 + val = 64 * 1024;
 + setsockopt (ciptr-fd, SOL_SOCKET, SO_SNDBUF,
 + (char *) val, sizeof (int));
 + }
 +}
 +#endif
 +
  return ciptr;
  }
  
 
___
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


[ANNOUNCE] xtrans 1.3.4

2014-03-31 Thread Hans de Goede
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Hi All,

I'm happy to announce xtrans-1.3.4

Hans de Goede (2):
  configure: Also add -D_DEFAULT_SOURCE to .pc cflags to shut up glibc 
warnings
  xtrans 1.3.4

Mark Kettenis (1):
  Increase UNIX socket buffer size

Thomas Klausner (2):
  Cast ctype(3) function arguments to unsigned char.
  Add missing headers for free() and strlen().

git tag: xtrans-1.3.4

http://xorg.freedesktop.org/archive/individual/lib/xtrans-1.3.4.tar.bz2
MD5:  a615e17d9fee6f097fc3b716eacb3dca  xtrans-1.3.4.tar.bz2
SHA1: beb2cecc4ceb8fab0557a8c37e2d41e63cbaa5ed  xtrans-1.3.4.tar.bz2
SHA256: 054d4ee3efd52508c753e9f7bc655ef185a29bd2850dd9e2fc2ccc33544f583a  
xtrans-1.3.4.tar.bz2

http://xorg.freedesktop.org/archive/individual/lib/xtrans-1.3.4.tar.gz
MD5:  1c1046061bbe0a7dbef55d38e25c724d  xtrans-1.3.4.tar.gz
SHA1: 20179cc5e0a3779df397100682eaed32a3fe2ed1  xtrans-1.3.4.tar.gz
SHA256: 13b908cccb79eadd667c6722df6d1d933586477b16bd8815aa85195c2de8ca08  
xtrans-1.3.4.tar.gz

Regards,

Hans

-BEGIN PGP SIGNATURE-
Version: GnuPG v1
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iEYEARECAAYFAlM5R+kACgkQF3VEtJrzE/sdLwCeJyt0lOf7KU5CugHU8jGMPHB0
2RQAnAmgzq+T2ynfhP0dnr2YUej/tm1a
=WIO/
-END PGP SIGNATURE-
___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel


[PATCH] Add pScreen-NameWindowPixmap hook

2014-03-31 Thread Daniel Stone
This hook allows drivers to be notified when a pixmap gains a new ID.

(ABI break.)

Signed-off-by: Daniel Stone dani...@collabora.com
---
 composite/compext.c  | 6 ++
 include/scrnintstr.h | 3 +++
 2 files changed, 9 insertions(+)

Is this in time for the ABI break? It's for quite a niche usecase
(virtualising X11 on top of another window system), where we need to know
all IDs that will be used for a given pixmap.

Round-tripping in eglCreateImageKHR would work too, but is much more
expensive by comparison.

However, I hope it's small enough to be pretty much harmless.

diff --git a/composite/compext.c b/composite/compext.c
index a945f72..b770fe2 100644
--- a/composite/compext.c
+++ b/composite/compext.c
@@ -270,6 +270,12 @@ ProcCompositeNameWindowPixmap(ClientPtr client)
 if (!AddResource(stuff-pixmap, RT_PIXMAP, (void *) pPixmap))
 return BadAlloc;
 
+if (pScreen-NameWindowPixmap 
+!pScreen-NameWindowPixmap(pWin, pPixmap, stuff-pixmap)) {
+pScreen-DestroyPixmap(pPixmap);
+   return BadAlloc;
+}
+
 return Success;
 }
 
diff --git a/include/scrnintstr.h b/include/scrnintstr.h
index 86da789..b09fbd9 100644
--- a/include/scrnintstr.h
+++ b/include/scrnintstr.h
@@ -353,6 +353,8 @@ typedef Bool (*StopPixmapTrackingProcPtr)(PixmapPtr, 
PixmapPtr);
 
 typedef Bool (*ReplaceScanoutPixmapProcPtr)(DrawablePtr, PixmapPtr, Bool);
 
+typedef Bool (*NameWindowPixmapProcPtr)(WindowPtr, PixmapPtr, CARD32);
+
 typedef struct _Screen {
 int myNum;  /* index of this instance in Screens[] */
 ATOM id;
@@ -463,6 +465,7 @@ typedef struct _Screen {
 SetWindowPixmapProcPtr SetWindowPixmap;
 GetScreenPixmapProcPtr GetScreenPixmap;
 SetScreenPixmapProcPtr SetScreenPixmap;
+NameWindowPixmapProcPtr NameWindowPixmap;
 
 PixmapPtr pScratchPixmap;   /* scratch pixmap pool */
 
-- 
1.9.0

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


Re: [PATCH] config by seat

2014-03-31 Thread Laércio de Sousa
2014-03-28 15:41 GMT-03:00 Laércio de Sousa lbsous...@gmail.com:

 You'll need to take care with ServerLayout section. I've detected a small
 problem with your patch in a very particular situation:

 Consider a machine with two seats, seat0 and seat1. Suppose you only have
 a file /etc/X11/xorg.conf.d/90-seat.conf with the following structure:

 Section Device
 Identifier device0
 (...)
 MatchSeat seat1
 EndSection

 Section Screen
 Identifier screen0
 Device device0
 (...)
 MatchSeat seat1
 EndSection

 Section ServerLayout
 Identifier layout0
 Screen screen0
 (...)
 MatchSeat seat1
 EndSection

 In this situation, the seat0 X server will fail to find the default layout
 and will crash. If you remove the ServerLayout section from file, this
 problem disappears.


I've made a small change in your patch that seems to solve this problem:
just moved the

+XF86ConfLayoutPtr layout;
+
+FIND_SUITABLE(XF86ConfLayoutPtr, xf86configptr-conf_layout_lst,
layout);

part outside the if-clause. The changed hunk looks like this:

@@ -2429,14 +2443,19 @@ xf86HandleConfigFile(Bool autoconfig)
  */

 /* First check if a layout section is present, and if it is valid. */
+XF86ConfLayoutPtr layout;
+
+FIND_SUITABLE(XF86ConfLayoutPtr, xf86configptr-conf_layout_lst,
layout);
+if (layout == NULL || xf86ScreenName != NULL) {
+XF86ConfScreenPtr screen;

-if (xf86configptr-conf_layout_lst == NULL || xf86ScreenName != NULL) {
 if (xf86ScreenName == NULL) {
 xf86Msg(X_DEFAULT,
 No Layout section.  Using the first Screen
section.\n);
 }
+FIND_SUITABLE (XF86ConfScreenPtr, xf86configptr-conf_screen_lst,
screen);
 if (!configImpliedLayout(xf86ConfigLayout,
- xf86configptr-conf_screen_lst,
+ screen,
  xf86configptr)) {
 xf86Msg(X_ERROR, Unable to
determine the screen layout\n);
 return CONFIG_PARSE_ERROR;

CANTATE DOMINO CANTICUM NOVUM
QUIA MIRABILIA FECIT

Laércio
___
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 xinit v3 3/3] startx: Under Linux start X on the current VT

2014-03-31 Thread Hans de Goede
When we let X allocate a new VT, systemd-logind will not recognize any
processes running on this VT as belonging to a valid session (since there
was no pam session opened on that tty).

This causes problems like PolicyKit denials for these processes.

ConsoleKit under Linux has been deprecated for a few years now and is no
longer being maintained, so simply make this the default under Linux.

Note we do not pass in the vt if the user has specified an alternative server
to start, as the vtX argument is only valid for the Xorg server, likewise we
omit it if the user has specified any other server arguments.

Fixes:
https://bugzilla.redhat.com/show_bug.cgi?id=806491

Signed-off-by: Hans de Goede hdego...@redhat.com
---
 startx.cpp | 11 +++
 1 file changed, 11 insertions(+)

diff --git a/startx.cpp b/startx.cpp
index b7a29f9..f4a0283 100644
--- a/startx.cpp
+++ b/startx.cpp
@@ -187,6 +187,17 @@ XCOMM process server arguments
 if [ x$server = x ]; then
 server=$defaultserver
 
+#ifdef __linux__
+XCOMM When starting the defaultserver start X on the current tty to avoid
+XCOMM the startx session being seen as inactive:
+XCOMM https://bugzilla.redhat.com/show_bug.cgi?id=806491
+tty=$(tty)
+if expr match $tty '^/dev/tty[0-9]\+$'  /dev/null; then
+tty_num=$(echo $tty | grep -oE '[0-9]+$')
+defaultserverargs=${defaultserverargs} vt${tty_num}
+fi
+#endif
+
 XCOMM For compatibility reasons, only use xserverrc if there were no 
server command line arguments
 if [ x$serverargs = x -a x$display = x ]; then
if [ -f $userserverrc ]; then
-- 
1.9.0

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


[PATCH xinit v3 1/3] Bump required util-macros version to 1.19

2014-03-31 Thread Hans de Goede
Signed-off-by: Hans de Goede hdego...@redhat.com
---
 configure.ac | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/configure.ac b/configure.ac
index 3d5ea79..37eabfa 100644
--- a/configure.ac
+++ b/configure.ac
@@ -31,10 +31,10 @@ AC_CONFIG_HEADERS([config.h])
 AM_INIT_AUTOMAKE([foreign dist-bzip2])
 AM_MAINTAINER_MODE
 
-# Require X.Org macros 1.8 or later for AC_PROG_SED in XORG_DEFAULT_OPTIONS
+# Require X.Org macros 1.19 or later for TRADITIONALCPPFLAGS
 m4_ifndef([XORG_MACROS_VERSION],
-  [m4_fatal([must install xorg-macros 1.8 or later before running 
autoconf/autogen])])
-XORG_MACROS_VERSION(1.8)
+  [m4_fatal([must install xorg-macros 1.19 or later before running 
autoconf/autogen])])
+XORG_MACROS_VERSION(1.19)
 XORG_DEFAULT_OPTIONS
 
 XORG_PROG_RAWCPP
-- 
1.9.0

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


[PATCH xinit v3 2/3] Drop Replace $RAWCPPFLAGS with $TRADITIONALCPPFLAGS when processing cpp files

2014-03-31 Thread Hans de Goede
Various .cpp files containt things like #ifdef __APPLE__ and #ifdef __linux__
these have been broken (all #ifdef-s always seen as false) since:
http://cgit.freedesktop.org/xorg/util/macros/commit/?id=d690e4a9febd07988d149a967791c5629c17b258

This commit makes these work again.

Signed-off-by: Hans de Goede hdego...@redhat.com
---
 cpprules.in | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/cpprules.in b/cpprules.in
index 0931bee..870efde 100644
--- a/cpprules.in
+++ b/cpprules.in
@@ -15,4 +15,4 @@ CPP_SED_MAGIC = $(SED) -e '/^\#  *[0-9][0-9]*  *.*$$/d' \
 SUFFIXES = .cpp
 
 .cpp:
-   $(AM_V_GEN)$(RAWCPP) $(RAWCPPFLAGS) $(CPP_FILES_FLAGS) $ | 
$(CPP_SED_MAGIC)  $@
+   $(AM_V_GEN)$(RAWCPP) $(TRADITIONALCPPFLAGS) $(CPP_FILES_FLAGS) $ | 
$(CPP_SED_MAGIC)  $@
-- 
1.9.0

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


[PATCH xinit v3 0/3] startx: Under Linux start X on the current VT

2014-03-31 Thread Hans de Goede
Hi All,

Here is v3 of my patchset to make startx start X on the current VT under
Linux. New in v3 is a patch to require version 1.19 of util-macros.

If there are no objections I'll push this in a couple of days.

Changelog:

v2:
-Use new $TRADITIONALCPPFLAGS to replace $RAWCPPFLAGS

v3:
-Drop: Remove unixware / sco support (already pushed)
-Add: Bump required util-macros version to 1.19 patch

Regards,

Hans
___
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] Xephyr: restore initial window resize lost in xcb conversion

2014-03-31 Thread Julien Cristau
On Wed, Mar 26, 2014 at 22:37:04 -0700, Keith Packard wrote:

 Julien Cristau jcris...@debian.org writes:
 
  The XResizeWindow call wasn't replaced by the xcb equivalent, so we
  were no longer setting the initial window size, only wm size hints.
 
  Regression from commit a2b73da Xephyr: start converting hostx.c over to
  xcb
 
  Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=74849
 
  Signed-off-by: Julien Cristau jcris...@debian.org
  Reported-by: Laércio de Sousa lbsous...@gmail.com
  Tested-by: Jon TURNEY jon.tur...@dronecode.org.uk
  Reviewed-by: Jon TURNEY jon.tur...@dronecode.org.uk
 
 Merged.
1b5d7e7..7b2a517  master - master
 
Matt, please consider that commit (7b2a517) as a candidate for 1.15.x.

Cheers,
Julien
___
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/dispatch: DoGetImage: Use a single buffer

2014-03-31 Thread Adam Jackson
On Sat, 2014-03-29 at 17:53 +0800, Daniel Kurtz wrote:

 Since we are now allocating from the heap, there should no longer be
 necessary, or desirable to chop up the DoGetImage() buffer.

Maybe not necessary, but probably still desirable.

In the PutImage direction we have a similar phenomenon: libX11 doesn't
generate bigreqs for PutImage, so things get chunked up at around the
256k smallreq size.  You can make it use bigreqs [1], but if you do,
large puts are actually slower, at least as measured by x11perf
-putimage500.  I didn't investigate far enough to get a graph of
throughput versus write size, but I would expect to see knees in the
curve corresponding to a) unix socket buffer size b) dcache sizes and
associativity.  I would also expect to see different curves for dumb
framebuffers compared to drivers that can finish the request with DMA,
since they'd exert different pressure on the dcache.  So there probably
is an optimal size for performance, and it probably does vary across
systems, and the optimal size is probably not ever the whole image in
one shot.

Even if it were, I'd be uncomfortable with trying only one allocation
and BadAlloc'ing if it fails, purely from a QOI perspective that's
pretty lame.

[1] - http://ajax.fedorapeople.org/libX11-bigreqify-putimage.patch

- ajax

___
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/dispatch: DoGetImage: Use a single buffer

2014-03-31 Thread Aaron Plattner

On 03/29/14 02:53, Daniel Kurtz wrote:

DoGetImage chops up an image into IMAGE_BUFSIZE strips.
This predates commit [0] (a pull from XFree86 to X.Org), at which time
IMAGE_BUFSIZE was 8k.  Back then the immediate buffers were
allocated with ALLOCATE_LOCAL(), so it made sense to try to keep them
small since at least on some systems, these buffers were allocated on the
stack.

[0] commit ded6147bfb5d75ff1e67c858040a628b61bc17d1
Author: Kaleb Keithley ka...@freedesktop.org
Date:   Fri Nov 14 15:54:54 2003 +

 R6.6 is the Xorg base-line

8k would fetch an 1024x864 monochrome screen w/ 32-bit word in just 14
buffers.  But, this was soon deemed too small, and the buffer size was
increased to 64 kB in commit [1], although it was still using
ALLOCATE_LOCAL().

[1] commit d568221710959cf7d783e6ff0fb80fb43a231124
Author: Kaleb Keithley ka...@freedesktop.org
Date:   Fri Nov 14 16:49:22 2003 +

 XFree86 4.3.0.1

Eventually people realized that alloca() had no error detection, and could
overrun the stack, so and ALLOCATE_LOCAL was killed, replaced by a
succession of heap allocators starting with commit [2]:
   xalloc() - xcalloc - calloc().

[2] commit 6e4f5cf83f35ffebb51633ab30b1826e63e37223
Author: Ben Byer bbyer@bbyer.local
Date:   Mon Nov 5 05:53:34 2007 -0800

 changing ALLOCATE_LOCAL to xalloc to prevent stack overflow

Since we are now allocating from the heap, there should no longer be
necessary, or desirable to chop up the DoGetImage() buffer.

In theory, we *could* still chop it up as a fallback if the big buffer
allocation fails.  But, if the system is that close to running out of heap
space, it is might be best to just fail quickly.


Can't the max image size be multiple gigabytes?  That seems a little 
large to describe as close to running out of heap space.


-- Aaron


When copying from a EXA pixmap, this can save a bit of overhead from multiple
EXA prepare/finish access calls.

Signed-off-by: Daniel Kurtz djku...@chromium.org
---
  dix/dispatch.c | 109 +
  include/servermd.h |   8 
  2 files changed, 35 insertions(+), 82 deletions(-)

diff --git a/dix/dispatch.c b/dix/dispatch.c
index 4f830f7..a0b1bc0 100644
--- a/dix/dispatch.c
+++ b/dix/dispatch.c
@@ -1977,8 +1977,7 @@ DoGetImage(ClientPtr client, int format, Drawable 
drawable,
 Mask planemask)
  {
  DrawablePtr pDraw, pBoundingDraw;
-int nlines, linesPerBuf, rc;
-int linesDone;
+int rc;

  /* coordinates relative to the bounding drawable */
  int relx, rely;
@@ -2072,31 +2071,7 @@ DoGetImage(ClientPtr client, int format, Drawable 
drawable,

  }

-xgi.length = length;
-
-xgi.length = bytes_to_int32(xgi.length);
-if (widthBytesLine == 0 || height == 0)
-linesPerBuf = 0;
-else if (widthBytesLine = IMAGE_BUFSIZE)
-linesPerBuf = 1;
-else {
-linesPerBuf = IMAGE_BUFSIZE / widthBytesLine;
-if (linesPerBuf  height)
-linesPerBuf = height;
-}
-length = linesPerBuf * widthBytesLine;
-if (linesPerBuf  height) {
-/* we have to make sure intermediate buffers don't need padding */
-while ((linesPerBuf  1) 
-   (length  ((1L  LOG2_BYTES_PER_SCANLINE_PAD) - 1))) {
-linesPerBuf--;
-length -= widthBytesLine;
-}
-while (length  ((1L  LOG2_BYTES_PER_SCANLINE_PAD) - 1)) {
-linesPerBuf++;
-length += widthBytesLine;
-}
-}
+xgi.length = bytes_to_int32(length);
  if (!(pBuf = calloc(1, length)))
  return BadAlloc;
  WriteReplyToClient(client, sizeof(xGetImageReply), xgi);
@@ -2108,60 +2083,46 @@ DoGetImage(ClientPtr client, int format, Drawable 
drawable,
  }
  }

-if (linesPerBuf == 0) {
+if (length == 0) {
  /* nothing to do */
  }
  else if (format == ZPixmap) {
-linesDone = 0;
-while (height - linesDone  0) {
-nlines = min(linesPerBuf, height - linesDone);
-(*pDraw-pScreen-GetImage) (pDraw,
- x,
- y + linesDone,
- width,
- nlines,
- format, planemask, (void *) pBuf);
-if (pVisibleRegion)
-XaceCensorImage(client, pVisibleRegion, widthBytesLine,
-pDraw, x, y + linesDone, width,
-nlines, format, pBuf);
-
-/* Note that this is NOT a call to WriteSwappedDataToClient,
-   as we do NOT byte swap */
-ReformatImage(pBuf, (int) (nlines * widthBytesLine),
-  BitsPerPixel(pDraw-depth), ClientOrder(client));
-
-WriteToClient(client, (int) (nlines * widthBytesLine), pBuf);
-linesDone += nlines;
-}
+

[PATCH] dri3: Allow asynchronous implementation for dri3_open

2014-03-31 Thread Kristian Høgsberg
By passing the client pointer to the dri3_open implementation, we allow
the clients to implement the open callback asynchronously.  If the
client ignore count is positive after returning from dri3_open, we
assume that authentication is in progress and doesn't send the reply.
The code to send the reply is moved into a helper function, which the
implementation can call upon receiving its authenticaion reply.

Signed-off-by: Kristian Høgsberg k...@bitplanet.net
---
 dri3/dri3.h |  6 +-
 dri3/dri3_request.c | 38 --
 dri3/dri3_screen.c  |  2 +-
 3 files changed, 30 insertions(+), 16 deletions(-)

diff --git a/dri3/dri3.h b/dri3/dri3.h
index 7c0c330..1c04cbd 100644
--- a/dri3/dri3.h
+++ b/dri3/dri3.h
@@ -32,7 +32,8 @@
 
 #define DRI3_SCREEN_INFO_VERSION0
 
-typedef int (*dri3_open_proc)(ScreenPtr screen,
+typedef int (*dri3_open_proc)(ClientPtr client,
+  ScreenPtr screen,
   RRProviderPtr provider,
   int *fd);
 
@@ -60,6 +61,9 @@ typedef struct dri3_screen_info {
 extern _X_EXPORT Bool
 dri3_screen_init(ScreenPtr screen, dri3_screen_info_ptr info);
 
+extern _X_EXPORT int
+dri3_send_open_reply(ClientPtr client, int fd);
+
 #endif
 
 #endif /* _DRI3_H_ */
diff --git a/dri3/dri3_request.c b/dri3/dri3_request.c
index 31dce83..fe45620 100644
--- a/dri3/dri3_request.c
+++ b/dri3/dri3_request.c
@@ -55,16 +55,35 @@ proc_dri3_query_version(ClientPtr client)
 return Success;
 }
 
-static int
-proc_dri3_open(ClientPtr client)
+int
+dri3_send_open_reply(ClientPtr client, int fd)
 {
-REQUEST(xDRI3OpenReq);
 xDRI3OpenReply rep = {
 .type = X_Reply,
 .nfd = 1,
 .sequenceNumber = client-sequence,
 .length = 0,
 };
+
+if (client-swapped) {
+swaps(rep.sequenceNumber);
+swapl(rep.length);
+}
+
+if (WriteFdToClient(client, fd, TRUE)  0) {
+close(fd);
+return BadAlloc;
+}
+
+WriteToClient(client, sizeof (rep), rep);
+
+return Success;
+}
+
+static int
+proc_dri3_open(ClientPtr client)
+{
+REQUEST(xDRI3OpenReq);
 RRProviderPtr provider;
 DrawablePtr drawable;
 ScreenPtr screen;
@@ -92,17 +111,8 @@ proc_dri3_open(ClientPtr client)
 if (status != Success)
 return status;
 
-if (client-swapped) {
-swaps(rep.sequenceNumber);
-swapl(rep.length);
-}
-
-if (WriteFdToClient(client, fd, TRUE)  0) {
-close(fd);
-return BadAlloc;
-}
-
-WriteToClient(client, sizeof (rep), rep);
+if (client-ignoreCount == 0)
+return dri3_send_open_reply(client, fd);
 
 return Success;
 }
diff --git a/dri3/dri3_screen.c b/dri3/dri3_screen.c
index c880296..bbf1d05 100644
--- a/dri3/dri3_screen.c
+++ b/dri3/dri3_screen.c
@@ -40,7 +40,7 @@ dri3_open(ClientPtr client, ScreenPtr screen, RRProviderPtr 
provider, int *fd)
 if (!info || !info-open)
 return BadMatch;
 
-rc = (*info-open) (screen, provider, fd);
+rc = (*info-open) (client, screen, provider, fd);
 if (rc != Success)
 return rc;
 
-- 
1.9.0

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

Re: [PATCH] dix/dispatch: DoGetImage: Use a single buffer

2014-03-31 Thread Keith Packard
Aaron Plattner aplatt...@nvidia.com writes:

 Can't the max image size be multiple gigabytes?  That seems a little 
 large to describe as close to running out of heap space.

The problem is that we're going to buffer that in memory anyway, down in
the OS layer. The only alternative is to block down there waiting for
the client to drain the image data.

So, the chunking in DIX is not helping reduce memory usage, it's just
making the OS layer shuffle data around a lot.

-- 
keith.pack...@intel.com


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