Skip to content
Permalink
Branch: master
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
1563 lines (1080 sloc) 66.3 KB
original_url created_at updated_at closed_at status type resolution reporter owner priority milestone component version keywords cc
2011-11-09 10:21:37 -0800
2015-09-01 01:40:04 -0700
2013-11-02 11:07:12 -0700
closed
usability
Fixed
jruhym@…
jeremyhu@…
Important
2.7.5
xserver
2.7.0 (xserver-1.11.2)
regression
jruhym@…

not all text displayed until interacted with

I have just installed the latest XQuartz (2.7.0 xorg-server 1.11.2). When I launch MOE (a molecular viewer from the Chemical Computing Group) some of the text is not apparent until I interact with it. For example the file menu is not labeled (although the space for it exits, that is all of the apparent menues are in their correct places). Once I hover the mouse over the place where the file menu should be, it appears. Note that in MOE hovering the mouse over a menu highlights it so it is probably the act of highlighting that makes it appear not merely hovering the mouse. There are other cases where the text must be clicked on for it to be seen. I don't know what MOE uses to render GUI windows etc. but this effect does not seem to be present in programs like GIMP. A downgrade to XQuartz 2.6.3 (xorg-server 1.10.3) fixes the issue.


jruhym@… commented on Nov 9, 2011

  • Cc jruhym@… added

jeremyhu@… commented on Nov 9, 2011

Can you narrow down what the issue might be? Can you please try the 2.7.0 betas and rc.


jeremyhu@… commented on Nov 9, 2011

  • Keywords regression added
  • Priority changed from Not Set to Important
  • Component changed from x11-apps to xserver
  • Milestone set to 2.7.1

jeremyhu@… commented on Nov 9, 2011

Also, try removing this file (and relaunching) to see if it is the cause:

sudo rm /opt/X11/lib/X11/fontconfig/conf.d/10-autohint.conf

To put it back, just do:

sudo ln -s ../conf.avail/10-autohint.conf /opt/X11/lib/X11/fontconfig/conf.d/10-autohint.conf


jruhym@… commented on Nov 11, 2011

Screen shot of MOE's compute menu missing two items and a button on the rhs missing its label as well.


jruhym@… commented on Nov 11, 2011

I tried all of the betas and the rc and all have the same issue. I also deleted /opt/X11/lib/X11/fontconfig/conf.d/10-autohint.conf and restarted X but still have the same issue.


jeremyhu@… commented on Dec 17, 2011

  • Status changed from new to closed
  • Resolution changed from to insufficient information

Ok, there's not really enough for me to go on here. I need a reduced test case if I'm going to have any shot at fixing this issue.

Please work with the developer of that application to come up with a fix, provide me with a reduced test case, or bisect this bug yourself and point me at the problem.

I'm sorry, but there's just nothing here, and nobody else has reported this problem.


mkeil@… commented on Feb 6, 2012

  • Status changed from closed to reopened
  • Resolution insufficient information deleted

Hi, i am one of the application developers. We can can see the problem as well. Not just some text is missing. Also other parts of drawings are missing. It looks as if somehow the drawing order is jumbled, a double buffering scheme is flipping the drawing buffer before our drawing routine finished. XQuartz <= 2.6.3 work, XQuartz >= 2.7.0 beta 1 fail. Are there any more in-between versions i can test. Unfortunately i could not strip it down into an easy example. I can ask, if I can get you a temporary test version of our software, if that would help.


jeremyhu@… commented on Feb 6, 2012

  • Milestone changed from 2.7.1 to 2.7.2

Your best bet is to install 2.6.3, then backup X11.bin. Install 2.7.0 and then replace X11.bin with one from 2.6.3. If that works, then it confirms that the issue came from a change in the server and not elsewhere. From there, you should bisect xorg/xserver git master to figure out what commit introduced the problem. You can find instructions for building the server in DeveloperInfo or you can ask me if you have questions.

Please let me know what you find.


mkeil@… commented on Feb 7, 2012

I can confirm that X11.bin (from 2.6.3) in a 2.7.0 installation does NOT show the problem. I will see if i can do the exploratory builds as you suggest.


mkeil@… commented on Feb 7, 2012

I tried to follow the Build instructions. Downloaded pkg-config and compiled and installed it. Then i tried to get the server sources using git and run into a problem:

git clone git://anongit.freedesktop.org/~jeremyhu/xserver Cloning into xserver... fatal: The remote end hung up unexpectedly


mkeil@… commented on Feb 7, 2012

Did a "git clone git://anongit.freedesktop.org/xserver", that succeeded then tried to start building and hit another problem.

autoreconf -fvi

autoreconf: Entering directory `.'

autoreconf: configure.ac: not using Gettext

autoreconf: running: aclocal --force -I m4

configure.ac:37: error: must install xorg-macros 1.14 or later before running autoconf/autogen

configure.ac:37: the top level

autom4te: /usr/bin/gm4 failed with exit status: 1

aclocal: /usr/bin/autom4te failed with exit status: 1

autoreconf: aclocal failed with exit status: 1

So it looks like i need some more detailed step by step instructions to get going.


jeremyhu@… commented on Feb 8, 2012

Yeah, I think freedesktop.org git had some hiccpus recently...

Using the master git rather than my ~jeremyhu clone should be fine. You'll just miss out on some extra patches, but that shouldn't affect bisecting this bug.

You need to set PKG_CONFIG_PATH and ACLOCAL environment variables before running autoreconf -fvi:

export ACLOCAL="aclocal -I /opt/X11/share/aclocal -I /usr/local/share/aclocal"
export PKG_CONFIG_PATH="/opt/X11/share/pkgconfig:/opt/X11/lib/pkgconfig"
export CFLAGS="-Wall -O0 -ggdb3 -arch i386 -arch x86_64 -pipe"
export OBJCFLAGS=$CFLAGS
export LDFLAGS=$CFLAGS

autoreconf -fvi
./configure --prefix=/opt/X11 --disable-dependency-tracking --enable-maintainer-mode --with-apple-application-name=XQuartz --with-bundle-id-prefix=org.macosforge.xquartz
make
sudo make install

mkeil@… commented on Feb 8, 2012

I was able to clone your git by using git://people.freedesktop.org instead of git://anongit.freedesktop.org (anongit was not working at all today for me). After that i followed your instructions and got further but got stuck in the configure:

configure: error: Package requirements (fixesproto >= 5.0 damageproto >= 1.1 xcmiscproto >= 1.2.0 xtrans >= 1.2.2 bigreqsproto >= 1.1.0 xproto >= 7.0.22 randrproto >= 1.2.99.3 renderproto >= 0.11 xextproto >= 7.1.99 inputproto >= 2.1.99.5 kbproto >= 1.0.3 fontsproto pixman-1 >= 0.21.8 videoproto recordproto >= 1.13.99.1 scrnsaverproto >= 1.1 resourceproto xineramaproto xkbfile  pixman-1 >= 0.21.8 xfont >= 1.4.2 xau xdmcp) were not met:

Requested 'inputproto >= 2.1.99.5' but version of InputProto is 2.1

Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.

Alternatively, you may set the environment variables XSERVERCFLAGS_CFLAGS
and XSERVERCFLAGS_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.

I still seem to miss something.


jeremyhu@… commented on Feb 8, 2012

That looks like you're building master, but the problem is likely somewhere between xorg-server-1.10.0 and xorg-server-1.11.0, so build each of those tags first to confirm that 1.10.0 is good and 1.11.0 is bad, then bisect from there using 'git bisect'.


mkeil@… commented on Feb 9, 2012

Will do. How do clone these tags. I never used git before.


jeremyhu@… commented on Feb 9, 2012

You can use 'git checkout -f <tag/branch/commit hash>' to checkout that particular version

Use 'git bisect good' to mark your working commit as good.

Use 'git bisect bad' to mark it bad.

Use 'git bisect skip' if your working commit is bad for a different reason and you're unable to determine it's good/bad status (ie, compile failure).


mkeil@… commented on Feb 9, 2012

Got a bit farther, but have problems compiling pbproxy when trying to bisect:

Making all in pbproxy
/bin/sh ../../../libtool   --mode=compile gcc -std=gnu99 -DHAVE_CONFIG_H -I. -I../../../include  -F/System/Library/Frameworks/ApplicationServices.framework/Frameworks -DLAUNCHD_ID_PREFIX=\"org.x\"    -Wall -O0 -ggdb3 -arch i386 -arch x86_64 -pipe -DROOTLESS_WORKAROUND -DROOTLESS_SAFEALPHA -DNO_ALLOCA -c -o main.lo main.m
libtool: compile:  gcc -std=gnu99 -DHAVE_CONFIG_H -I. -I../../../include -F/System/Library/Frameworks/ApplicationServices.framework/Frameworks -DLAUNCHD_ID_PREFIX=\"org.x\" -Wall -O0 -ggdb3 -arch i386 -arch x86_64 -pipe -DROOTLESS_WORKAROUND -DROOTLESS_SAFEALPHA -DNO_ALLOCA -c main.m  -fno-common -DPIC -o .libs/main.o
In file included from main.m:30:
pbproxy.h:48:22: error: X11/Xlib.h: No such file or directory
pbproxy.h:49:34: error: X11/extensions/shape.h: No such file or directory

I tried to skip over these, but after 20 times skipping i think something is wrong with my setup or git usage. I trying all this on a freshly installed OSX 10.7.3 with Xcode 4.2.1. XQuartz 2.7.0 is installed. I also tried to compile when XQuartz 2.6.3 was installed, but then it always complained about the wrong pixmap library version during configure. It could certainly be that i did something wrong with the git clone, git checkout, etc. If you could give me explicit steps how to setup the code with git (e.g. how i would set the checkout to the equivalent of 2.6.3, i assumed git checkout -f xorg-server-1.10.3, but that did not compile either) that would be most appreciated. Is there something, with what i can check that i did the correct git clone?

Thanks


mkeil@… commented on Feb 9, 2012

Just to be very specific of what I did; i started anew, and get the same pbproxy compile error from above:

git clone git://anongit.freedesktop.org/xorg/xserver
cd server
git checkout -f xorg-server-1.10.3
export ACLOCAL="aclocal -I /opt/X11/share/aclocal -I /usr/local/share/aclocal"
export PKG_CONFIG_PATH="/opt/X11/share/pkgconfig:/opt/X11/lib/pkgconfig"
export CFLAGS="-Wall -O0 -ggdb3 -arch i386 -arch x86_64 -pipe"
export OBJCFLAGS=$CFLAGS
export LDFLAGS=$CFLAGS
autoreconf -fvi
./configure --prefix=/opt/X11 --disable-dependency-tracking --enable-maintainer-mode --with-apple-application-name=XQuartz --with-bundle-id-prefix=org.macosforge.xquartz

jeremyhu@… commented on Feb 9, 2012

Yeah, I think there was a bug in the Makefile.am for pbproxy at one point. Try also setting:

export CPPFLAGS=-I/opt/X11/include


mkeil@… commented on Feb 9, 2012

Ahh. Just read your comment. I got desperate and added -I/opt/X11/include to CFLAGS. That "seemed" at first also to work. I was able to compile then 1.11.0 and 1.10.3. But both show now very weird drawing artefacts with out application (only the left half of the window is drawn). I will revert the CFLAGS and use your CPPFLAGS instead. Just to confirm. It is OK to compile on Lion, and with XQuartz 2.7.0 installed. After the compile i do a sudo make install. Or should i only copy over X11.bin (As i did the for the first test). I will try that. Reinstall XQuartz 2.7.0 and just put X11.bin from the compile.


mkeil@… commented on Feb 9, 2012

Set CPPFLAGS, reverted other flags, reinstalled 2.7.0, recompiled xorg-server-1.10.3. Just replaced X11.bin in Quartz.app with file from hw/xquartz/mach/startup/X11.bin. I still have the weird drawing artefacts. Now also in e.g. xeyes. The X11.bin i compiled is double the size of the one from the XQuartz dmg. I assume something in my system is still wrong...


mkeil@… commented on Feb 9, 2012

I found an easy way for you to reproduce the problem in XQuartz 2.7.0. (1.11.2) (I removed XQuartz again, and reinstalled cleanly). Just start eyes from a terminal and move the pupils of the eyes. You should see that they are sometimes cut (see attachment). With the Apple X11 server from Lion 10.7.3 (1.10.3) eyes are fine.


mkeil@… commented on Feb 9, 2012

xeyes with XQuartz 2.7.0 (notice the cut pupils)


jeremyhu@… commented on Feb 9, 2012

Hmm... I see that. It looks like some damage isn't getting propagated. If you can help bisect the issue, that will help a lot. I won't be able to get to this until mid March at the earliest


mkeil@… commented on Feb 10, 2012

I will be glad to help. But i still have the problem, that something goes wrong with my builds, The executables i produce do not match the releases (e.g. the 1.10.3 i compile has the problem as well, and even worse). It boils down to the question above, can I compile the server on Mac OSX 10.7.3 with Xcode 4.2.1 and the XQuartz 2.7.0 libraries. If not, what is needed?


jeremyhu@… commented on Feb 10, 2012

Yes, you should be able to compile in that environment. It's what I do.

Your additional issues may be related to the two patches that are not in mainline, so I would test that first. Try building with the extra patches from my branch:

http://cgit.freedesktop.org/~jeremyhu/xserver/commit/?id=85cecd981191f9c3dab0fb13310d91eff643d423

http://cgit.freedesktop.org/~jeremyhu/xserver/commit/?id=47b457541b33f00807fd495f5b0b24d5f143bf84

If (as I susppect) those impact your application, then you should just ignore those bugs and bisect to find your issue. Alternatively, you could cherry pick those two in at each bisect point to fix those issues using 'git cherry-pick <hash id>' where <hash id> is 85cecd981191f9c3dab0fb13310d91eff643d423 and 47b457541b33f00807fd495f5b0b24d5f143bf84


mkeil@… commented on Feb 10, 2012

Ahh, i see.

Sorry to be a pest. But i really have problems understanding the git workflow in detail (i never worked with it before, and my experience with distributed projects is very limited). Can you give me the step by step complete git commands (starting at git clone) to set up a directory to build one good (1.10.3) and one bad version (1.11.2) with these patches.


jeremyhu@… commented on Feb 10, 2012

git clone git://anongit.freedesktop.org/xorg/xserver
cd xserver
git remote add jeremyhu  git://people.freedesktop.org/~jeremyhu/xserver
git checkout -f xorg-server-1.10.0
./compile.sh
# Test XQuartz.app is good
git checkout -f xorg-server-1.11.0
./compile.sh
# Test XQuartz.app is bad
git bisect start xorg-server-1.11.0 xorg-server-1.10.0
./compile.sh
# Test XQuartz.app
git bisect [good|bad]

As mentioned earlier though, you may beed to apply the 85cecd981191f9c3dab0fb13310d91eff643d423 and 47b457541b33f00807fd495f5b0b24d5f143bf84 patches, so if you do that, you would do this for each step:

git cherry-pick 85cecd981191f9c3dab0fb13310d91eff643d423
git cherry-pick 47b457541b33f00807fd495f5b0b24d5f143bf84
./compile.sh
git bisect [good|bad] HEAD^^

You do the HEAD because you need to mark the commit 2 previous as the good/bad one (because you just applied 2 patches on top of it to fix your other issues).


mkeil@… commented on Feb 10, 2012

Thanks i would have never figured that out. I did the bisecting. I did not apply for most part the cherry-picks, git was accepting them in the older versions. Most of the versions git presented me during bisecting did either not configure (randr version mismatch) or build (xpbproxy, some problem with header file). Also all executables i finally produced had some drawing problems (only the upper left part of our application rendered). But using xeyes and looking only at the pupils i think i could define which ones were "good" and "bad". This is the result of the bisecting:

There are only 'skip'ped commits left to test.
The first bad commit could be any of:
8e4c3ce55b0f186bc6ba4039e30629669b6087b7
dae24abcd44f3bb1966faa88222f851c784b37dc
296561506a91742cc150a0fb6fc0df5dbe98c780
7dff79e39564b403c3afbc5e7bacffa0df190a23
1e933665bef26c74196bb7c59910e6a78bcacf0e
566f1931ee2916269e164e114bffaf2da1d039d1
671b2a1823a1c90d0b6254e2e2af8865151fff8c
788ccb9a8bcf6a4fb4054c507111eec3338fb969
197df069a4037d6faa2723c31ffba09c95d71166
2b364bf970b2ce6829af656990c33afd0d365f3c
3f41f4adea4bbb90d4bda4dab600595b655e3ed8
0bc95d5b06dcea65a1aa193ea907b50f7dd168b5
We cannot bisect more!

Some of the in-between version had even worse drawing artefacts. So i think it was not a clean change from one to another. I had the impression, that rendering was suddenly completely broken (funnily only for eyes and our application, not xterm or e.g. xlogo) then slowly fixed up again, but not completely. I hope this helps.

Thanks


jeremyhu@… commented on Feb 10, 2012

Ah. Interesting. trapezoids.

Does upgrading to pixman-0.24.4 fix this for you?


jeremyhu@… commented on Feb 10, 2012

FWIW, I'm building 2.7.1_rc3 now, and it contains pixman-0.24.4, so you can sit tight and wait for it ;)


jeremyhu@… commented on Feb 10, 2012

Also, it's very suspicious that the very first commit after 1.10 is showing up as bad for you. I really see no reason that xorg-server-1.10.0 should build and work for you without issues but 8e4c3ce55b0f186bc6ba4039e30629669b6087b7 would cause problems. These were the only changes in that first merge, and they have nothing to do with rendering:

$ git diff xorg-server-1.10.0 8e4c3ce55b0f186bc6ba4039e30629669b6087b7
diff --git a/Xext/xselinux_hooks.c b/Xext/xselinux_hooks.c
index 560e1e9..f1d8e5d 100644
--- a/Xext/xselinux_hooks.c
+++ b/Xext/xselinux_hooks.c
@@ -40,6 +40,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 #include "propertyst.h"
 #include "extnsionst.h"
 #include "xacestr.h"
+#include "client.h"
 #include "../os/osdep.h"
 #define _XSELINUX_NEED_FLASK_MAP
 #include "xselinuxint.h"
@@ -129,26 +130,25 @@ SELinuxLabelClient(ClientPtr client)
 
     /* For local clients, try and determine the executable name */
     if (XaceIsLocal(client)) {
-   struct ucred creds;
-   socklen_t len = sizeof(creds);
-   char path[PATH_MAX + 1];
-   size_t bytes;
-
-   memset(&creds, 0, sizeof(creds));
-   if (getsockopt(fd, SOL_SOCKET, SO_PEERCRED, &creds, &len) < 0)
-       goto finish;
+   /* Get cached command name if CLIENTIDS is enabled. */
+   const char *cmdname = GetClientCmdName(client);
+   Bool cached = (cmdname != NULL);
+   /* If CLIENTIDS is disabled, figure out the command name from
+    * scratch. */
+   if (!cmdname)
+   {
+       pid_t pid = DetermineClientPid(client);
+       if (pid != -1)
+       DetermineClientCmd(pid, &cmdname, NULL);
+   }
 
-   snprintf(path, PATH_MAX + 1, "/proc/%d/cmdline", creds.pid);
-   fd = open(path, O_RDONLY);
-   if (fd < 0)
+   if (!cmdname)
        goto finish;
 
-   bytes = read(fd, path, PATH_MAX + 1);
-   close(fd);
-   if (bytes <= 0)
-       goto finish;
+   strncpy(subj->command, cmdname, COMMAND_LEN - 1);
 
-   strncpy(subj->command, path, COMMAND_LEN - 1);
+   if (!cached)
+       free((void *) cmdname); /* const char * */
     }
 
 finish:
diff --git a/configure.ac b/configure.ac
index 85d5c98..7f15fe0 100644
--- a/configure.ac
+++ b/configure.ac
@@ -312,19 +312,6 @@ AC_CHECK_HEADER([execinfo.h],[
     ])]
 )
 
-dnl ARM needs additional compiler flags for proper backtraces if GCC is
-dnl used. Compile a dummy program with the -mapcs-frame option. If it
-dnl succeeds, we know that we are building for ARM with GCC.
-old_CFLAGS="$CFLAGS"
-CFLAGS="-mapcs-frame"
-AC_COMPILE_IFELSE(
-        AC_LANG_PROGRAM([[ ]]),
-        ARM_BACKTRACE_CFLAGS="$CFLAGS",
-        ARM_BACKTRACE_CFLAGS=""
-)
-CFLAGS="$old_CFLAGS"
-AC_SUBST(ARM_BACKTRACE_CFLAGS)
-
 dnl ---------------------------------------------------------------------------
 dnl Bus options and CPU capabilities.  Replaces logic in
 dnl hw/xfree86/os-support/bus/Makefile.am, among others.
@@ -641,6 +628,7 @@ AC_ARG_ENABLE(vbe,            AS_HELP_STRING([--enable-vbe], [Build Xorg with VB
 AC_ARG_ENABLE(int10-module,     AS_HELP_STRING([--enable-int10-module], [Build Xorg with int10 module (default: enabled)]), [INT10MODULE=$enableval], [INT10MODULE=yes])
 AC_ARG_ENABLE(windowswm,      AS_HELP_STRING([--enable-windowswm], [Build XWin with WindowsWM extension (default: no)]), [WINDOWSWM=$enableval], [WINDOWSWM=no])
 AC_ARG_ENABLE(libdrm,         AS_HELP_STRING([--enable-libdrm], [Build Xorg with libdrm support (default: enabled)]), [DRM=$enableval],[DRM=yes])
+AC_ARG_ENABLE(clientids,      AS_HELP_STRING([--disable-clientids], [Build Xorg with client ID tracking (default: enabled)]), [CLIENTIDS=$enableval], [CLIENTIDS=yes])
 
 dnl DDXes.
 AC_ARG_ENABLE(xorg,              AS_HELP_STRING([--enable-xorg], [Build Xorg server (default: auto)]), [XORG=$enableval], [XORG=auto])
@@ -994,6 +982,18 @@ if test "x$RES" = xyes; then
    REQUIRED_MODULES="$REQUIRED_MODULES $RESOURCEPROTO"
 fi
 
+# The XRes extension may support client ID tracking only if it has
+# been specifically enabled. Client ID tracking is implicitly not
+# supported if XRes extension is disabled.
+AC_MSG_CHECKING([whether to track client ids])
+if test "x$RES" = xyes && test "x$CLIENTIDS" = xyes; then
+   AC_DEFINE(CLIENTIDS, 1, [Support client ID tracking])
+else
+   CLIENTIDS=no
+fi
+AC_MSG_RESULT([$CLIENTIDS])
+AM_CONDITIONAL(CLIENTIDS, [test "x$CLIENTIDS" = xyes])
+
 if test "x$GLX" = xyes; then
    PKG_CHECK_MODULES([XLIB], [x11])
    PKG_CHECK_MODULES([GL], $GLPROTO $LIBGL)
@@ -1525,7 +1525,7 @@ if test "x$XNEST" = xyes; then
    if test "x$have_xnest" = xno; then
        AC_MSG_ERROR([Xnest build explicitly requested, but required modules not found.])
    fi
-   XNEST_LIBS="$FB_LIB $FIXES_LIB $MI_LIB $XEXT_LIB $DBE_LIB $RECORD_LIB $GLX_LIBS $RANDR_LIB $RENDER_LIB $DAMAGE_LIB $MIEXT_SYNC_LIB $MIEXT_DAMAGE_LIB $MIEXT_SHADOW_LIB $XI_LIB $XKB_LIB $XKB_STUB_LIB $COMPOSITE_LIB $DIX_LIB $MAIN_LIB $OS_LIB"
+   XNEST_LIBS="$FB_LIB $FIXES_LIB $MI_LIB $XEXT_LIB $DBE_LIB $RECORD_LIB $GLX_LIBS $RANDR_LIB $RENDER_LIB $DAMAGE_LIB $MIEXT_SYNC_LIB $MIEXT_DAMAGE_LIB $MIEXT_SHADOW_LIB $XI_LIB $XKB_LIB $XKB_STUB_LIB $COMPOSITE_LIB $MAIN_LIB $DIX_LIB $OS_LIB"
    XNEST_SYS_LIBS="$XNESTMODULES_LIBS $GLX_SYS_LIBS"
    AC_SUBST([XNEST_LIBS])
    AC_SUBST([XNEST_SYS_LIBS])
diff --git a/dix/dispatch.c b/dix/dispatch.c
index 7b2132d..601b14a 100644
--- a/dix/dispatch.c
+++ b/dix/dispatch.c
@@ -130,6 +130,7 @@ int ProcInitialConnection();
 #include "inputstr.h"
 #include "xkbsrv.h"
 #include "site.h"
+#include "client.h"
 
 #ifdef XSERVER_DTRACE
 #include "registry.h"
@@ -3459,6 +3460,9 @@ CloseDownClient(ClientPtr client)
        CallCallbacks((&ClientStateCallback), (pointer)&clientinfo);
    }       
    FreeClientResources(client);
+   /* Disable client ID tracking. This must be done after
+    * ClientStateCallback. */
+   ReleaseClientIds(client);
 #ifdef XSERVER_DTRACE
    XSERVER_CLIENT_DISCONNECT(client->index);
 #endif 
@@ -3496,6 +3500,7 @@ void InitClient(ClientPtr client, int i, pointer ospriv)
     client->smart_start_tick = SmartScheduleTime;
     client->smart_stop_tick = SmartScheduleTime;
     client->smart_check_tick = SmartScheduleTime;
+    client->clientIds = NULL;
 }
 
 /************************
@@ -3535,6 +3540,11 @@ ClientPtr NextAvailableClient(pointer ospriv)
    currentMaxClients++;
     while ((nextFreeClientID < MAXCLIENTS) && clients[nextFreeClientID])
    nextFreeClientID++;
+
+    /* Enable client ID tracking. This must be done before
+     * ClientStateCallback. */
+    ReserveClientIds(client);
+
     if (ClientStateCallback)
     {
    NewClientInfoRec clientinfo;
diff --git a/dix/main.c b/dix/main.c
index 692bec1..31e2d48 100644
--- a/dix/main.c
+++ b/dix/main.c
@@ -104,6 +104,7 @@ Equipment Corporation.
 #include "extnsionst.h"
 #include "privates.h"
 #include "registry.h"
+#include "client.h"
 #ifdef PANORAMIX
 #include "panoramiXsrv.h"
 #else
@@ -258,6 +259,7 @@ int main(int argc, char *argv[], char *envp[])
         InitCoreDevices();
    InitInput(argc, argv);
    InitAndStartDevices();
+   ReserveClientIds(serverClient);
 
    dixSaveScreens(serverClient, SCREEN_SAVER_FORCER, ScreenSaverReset);
 
@@ -323,6 +325,7 @@ int main(int argc, char *argv[], char *envp[])
        screenInfo.numScreens = i;
    }
 
+   ReleaseClientIds(serverClient);
    dixFreePrivates(serverClient->devPrivates, PRIVATE_CLIENT);
    serverClient->devPrivates = NULL;
 
diff --git a/hw/xfree86/loader/sdksyms.sh b/hw/xfree86/loader/sdksyms.sh
index f60b8ed..18bb735 100755
--- a/hw/xfree86/loader/sdksyms.sh
+++ b/hw/xfree86/loader/sdksyms.sh
@@ -259,6 +259,7 @@ cat > sdksyms.c << EOF
 #include "colormap.h"
 #include "colormapst.h"
 #include "hotplug.h"
+#include "client.h"
 #include "cursor.h"
 #include "cursorstr.h"
 #include "dix.h"
diff --git a/include/Makefile.am b/include/Makefile.am
index 42f0082..6f63c76 100644
--- a/include/Makefile.am
+++ b/include/Makefile.am
@@ -3,6 +3,7 @@ sdk_HEADERS =       \
    XIstubs.h   \
    Xprintf.h   \
    callback.h  \
+   client.h    \
    closestr.h  \
    closure.h   \
    colormap.h  \
diff --git a/include/client.h b/include/client.h
new file mode 100644
index 0000000..aaafc7d
--- /dev/null
+++ b/include/client.h
@@ -0,0 +1,59 @@
+/*
+ * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). All
+ * rights reserved.
+ *
+ * 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.
+ */
+
+/* Author: Rami Ylimäki <rami.ylimaki@vincit.fi> */
+
+#ifndef CLIENT_H
+#define CLIENT_H
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif /* HAVE_DIX_CONFIG_H */
+#include <X11/Xfuncproto.h>
+#include <sys/types.h>
+
+/* Client IDs. Use GetClientPid, GetClientCmdName and GetClientCmdArgs
+ * instead of accessing the fields directly. */
+typedef struct {
+    pid_t pid;           /* process ID, -1 if not available */
+    const char *cmdname; /* process name, NULL if not available */
+    const char *cmdargs; /* process arguments, NULL if not available */
+} ClientIdRec, *ClientIdPtr;
+
+struct _Client;
+
+/* Initialize and clean up. */
+void ReserveClientIds(struct _Client *client);
+void ReleaseClientIds(struct _Client *client);
+
+/* Determine client IDs for caching. Exported on purpose for
+ * extensions such as SELinux. */
+extern _X_EXPORT pid_t DetermineClientPid(struct _Client *client);
+extern _X_EXPORT void DetermineClientCmd(pid_t, const char **cmdname, const char **cmdargs);
+
+/* Query cached client IDs. Exported on purpose for drivers. */
+extern _X_EXPORT pid_t GetClientPid(struct _Client *client);
+extern _X_EXPORT const char *GetClientCmdName(struct _Client *client);
+extern _X_EXPORT const char *GetClientCmdArgs(struct _Client *client);
+
+#endif /* CLIENT_H */
diff --git a/include/dix-config.h.in b/include/dix-config.h.in
index 5622766..fc93f3e 100644
--- a/include/dix-config.h.in
+++ b/include/dix-config.h.in
@@ -279,6 +279,9 @@
 /* Support X resource extension */
 #undef RES
 
+/* Support client ID tracking in X resource extension */
+#undef CLIENTIDS
+
 /* Support MIT-SCREEN-SAVER extension */
 #undef SCREENSAVER
 
diff --git a/include/dixstruct.h b/include/dixstruct.h
index 8547b16..443e8b0 100644
--- a/include/dixstruct.h
+++ b/include/dixstruct.h
@@ -24,6 +24,7 @@ SOFTWARE.
 #ifndef DIXSTRUCT_H
 #define DIXSTRUCT_H
 
+#include "client.h"
 #include "dix.h"
 #include "resource.h"
 #include "cursor.h"
@@ -121,6 +122,7 @@ typedef struct _Client {
     long    smart_check_tick;
     
     DeviceIntPtr clientPtr;
+    ClientIdPtr  clientIds;
 }           ClientRec;
 
 /*
diff --git a/os/Makefile.am b/os/Makefile.am
index 3e4f2c5..91ca110 100644
--- a/os/Makefile.am
+++ b/os/Makefile.am
@@ -1,25 +1,18 @@
-noinst_LTLIBRARIES = libos.la liblog.la
+noinst_LTLIBRARIES = libos.la
 
 AM_CFLAGS = $(DIX_CFLAGS) $(SHA1_CFLAGS)
 
 SECURERPC_SRCS = rpcauth.c
 XDMCP_SRCS = xdmcp.c
 STRLCAT_SRCS = strlcat.c strlcpy.c
-
-# Build a convenience library liblog.la that will be added into
-# libos.la. The split is done so that log.c can be built with
-# different compiler options.
-liblog_la_SOURCES = log.c
-# Add flags needed for proper backtraces of functions marked with GCC
-# __attribute__((noreturn)). Currently those flags are needed for
-# FatalError and AbortServer in log.c.
-liblog_la_CFLAGS = $(AM_CFLAGS) $(ARM_BACKTRACE_CFLAGS)
+XORG_SRCS = log.c
 
 libos_la_SOURCES =     \
    WaitFor.c   \
    access.c    \
    auth.c      \
    backtrace.c \
+   client.c    \
    connection.c    \
    io.c        \
    mitauth.c   \
@@ -32,8 +25,9 @@ libos_la_SOURCES =    \
    xdmauth.c   \
    xsha1.c     \
    xstrans.c   \
-   xprintf.c
-libos_la_LIBADD = @SHA1_LIBS@ $(DLOPEN_LIBS) liblog.la
+   xprintf.c   \
+   $(XORG_SRCS)
+libos_la_LIBADD = @SHA1_LIBS@ $(DLOPEN_LIBS)
 
 if SECURE_RPC
 libos_la_SOURCES += $(SECURERPC_SRCS)
diff --git a/os/client.c b/os/client.c
new file mode 100644
index 0000000..1311855
--- /dev/null
+++ b/os/client.c
@@ -0,0 +1,310 @@
+/*
+ * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). All
+ * rights reserved.
+ * Copyright (c) 1993, 2010, Oracle and/or its affiliates. All rights reserved.
+ *
+ * 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.
+ */
+
+/**
+ * @file
+ *
+ * This file contains functionality for identifying clients by various
+ * means. The primary purpose of identification is to simply aid in
+ * finding out which clients are using X server and how they are using
+ * it. For example, it's often necessary to monitor what requests
+ * clients are executing (to spot bad behaviour) and how they are
+ * allocating resources in X server (to spot excessive resource
+ * usage).
+ *
+ * This framework automatically allocates information, that can be
+ * used for client identification, when a client connects to the
+ * server. The information is freed when the client disconnects. The
+ * allocated information is just a collection of various IDs, such as
+ * PID and process name for local clients, that are likely to be
+ * useful in analyzing X server usage.
+ *
+ * Users of the framework can query ID information about clients at
+ * any time. To avoid repeated polling of IDs the users can also
+ * subscribe for notifications about the availability of ID
+ * information. IDs have been allocated before ClientStateCallback is
+ * called with ClientStateInitial state. Similarly the IDs will be
+ * released after ClientStateCallback is called with ClientStateGone
+ * state.
+ *
+ * Author: Rami Ylimäki <rami.ylimaki@vincit.fi>
+ */
+
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <unistd.h>
+
+#include "client.h"
+#include "os.h"
+#include "dixstruct.h"
+
+/**
+ * Try to determine a PID for a client from its connection
+ * information. This should be called only once when new client has
+ * connected, use GetClientPid to determine the PID at other times.
+ *
+ * @param[in] client Connection linked to some process.
+ *
+ * @return PID of the client. Error (-1) if PID can't be determined
+ *         for the client.
+ *
+ * @see GetClientPid
+ */
+pid_t DetermineClientPid(struct _Client *client)
+{
+    LocalClientCredRec *lcc = NULL;
+    pid_t pid = -1;
+
+    if (client == NullClient)
+        return pid;
+
+    if (client == serverClient)
+        return getpid();
+
+    if (GetLocalClientCreds(client, &lcc) != -1)
+    {
+        if (lcc->fieldsSet & LCC_PID_SET)
+            pid = lcc->pid;
+        FreeLocalClientCreds(lcc);
+    }
+
+    return pid;
+}
+
+/**
+ * Try to determine a command line string for a client based on its
+ * PID. Note that mapping PID to a command hasn't been implemented for
+ * some operating systems. This should be called only once when a new
+ * client has connected, use GetClientCmdName/Args to determine the
+ * string at other times.
+ *
+ * @param[in]  pid     Process ID of a client.
+
+ * @param[out] cmdname Client process name without arguments. You must
+ *                     release this by calling free. On error NULL is
+ *                     returned. Pass NULL if you aren't interested in
+ *                     this value.
+ * @param[out] cmdargs Arguments to client process. Useful for
+ *                     identifying a client that is executed from a
+ *                     launcher program. You must release this by
+ *                     calling free. On error NULL is returned. Pass
+ *                     NULL if you aren't interested in this value.
+ *
+ * @see GetClientCmdName/Args
+ */
+void DetermineClientCmd(pid_t pid, const char **cmdname, const char **cmdargs)
+{
+    char path[PATH_MAX + 1];
+    int totsize = 0;
+    int cmdsize = 0;
+    int argsize = 0;
+    int fd = 0;
+
+    if (cmdname)
+        *cmdname = NULL;
+    if (cmdargs)
+        *cmdargs = NULL;
+
+    if (pid == -1)
+        return;
+
+    /* Check if /proc/pid/cmdline exists. It's not supported on all
+     * operating systems. */
+    if (snprintf(path, sizeof(path), "/proc/%d/cmdline", pid) < 0)
+        return;
+    fd = open(path, O_RDONLY);
+    if (fd < 0)
+        return;
+
+    /* Read the contents of /proc/pid/cmdline. It should contain the
+     * process name and arguments. */
+    totsize = read(fd, path, sizeof(path));
+    if (totsize <= 0)
+        return;
+    if (close(fd) < 0)
+        return;
+    path[totsize - 1] = '\0';
+
+    /* Contruct the process name without arguments. */
+    cmdsize = strlen(path) + 1;
+    if (cmdname)
+    {
+        char *name = malloc(cmdsize);
+        if (name)
+        {
+            strncpy(name, path, cmdsize);
+            name[cmdsize - 1] = '\0';
+            *cmdname = name;
+        }
+    }
+
+    /* Construct the arguments for client process. */
+    argsize = totsize - cmdsize;
+    if (cmdargs && (argsize > 0))
+    {
+        char *args = malloc(argsize);
+        if (args)
+        {
+            int i = 0;
+            for (i = 0; i < (argsize - 1); ++i)
+            {
+                const char c = path[cmdsize + i];
+                args[i] = (c == '\0') ? ' ' : c;
+            }
+            args[argsize - 1] = '\0';
+            *cmdargs = args;
+        }
+    }
+}
+
+/**
+ * Called when a new client connects. Allocates client ID information.
+ *
+ * @param[in] client Recently connected client.
+ */
+void ReserveClientIds(struct _Client *client)
+{
+#ifdef CLIENTIDS
+    if (client == NullClient)
+        return;
+
+    assert(!client->clientIds);
+    client->clientIds = calloc(1, sizeof(ClientIdRec));
+    if (!client->clientIds)
+        return;
+
+    client->clientIds->pid = DetermineClientPid(client);
+    if (client->clientIds->pid != -1)
+        DetermineClientCmd(client->clientIds->pid, &client->clientIds->cmdname, &client->clientIds->cmdargs);
+
+    DebugF("client(%lx): Reserved pid(%d).\n",
+           client->clientAsMask, client->clientIds->pid);
+    DebugF("client(%lx): Reserved cmdname(%s) and cmdargs(%s).\n",
+           client->clientAsMask,
+           client->clientIds->cmdname ? client->clientIds->cmdname : "NULL",
+           client->clientIds->cmdargs ? client->clientIds->cmdargs : "NULL");
+#endif /* CLIENTIDS */
+}
+
+/**
+ * Called when an existing client disconnects. Frees client ID
+ * information.
+ *
+ * @param[in] client Recently disconnected client.
+ */
+void ReleaseClientIds(struct _Client *client)
+{
+#ifdef CLIENTIDS
+    if (client == NullClient)
+        return;
+
+    if (!client->clientIds)
+        return;
+
+    DebugF("client(%lx): Released pid(%d).\n",
+           client->clientAsMask, client->clientIds->pid);
+    DebugF("client(%lx): Released cmdline(%s) and cmdargs(%s).\n",
+           client->clientAsMask,
+           client->clientIds->cmdname ? client->clientIds->cmdname : "NULL",
+           client->clientIds->cmdargs ? client->clientIds->cmdargs : "NULL");
+
+    free((void *) client->clientIds->cmdname); /* const char * */
+    free((void *) client->clientIds->cmdargs); /* const char * */
+    free(client->clientIds);
+    client->clientIds = NULL;
+#endif /* CLIENTIDS */
+}
+
+/**
+ * Get cached PID of a client.
+ *
+ * param[in] client Client whose PID has been already cached.
+ *
+ * @return Cached client PID. Error (-1) if called:
+ *         - before ClientStateInitial client state notification
+ *         - after ClientStateGone client state notification
+ *         - for remote clients
+ *
+ * @see DetermineClientPid
+ */
+pid_t GetClientPid(struct _Client *client)
+{
+    if (client == NullClient)
+        return -1;
+
+    if (!client->clientIds)
+        return -1;
+
+    return client->clientIds->pid;
+}
+
+/**
+ * Get cached command name string of a client.
+ *
+ * param[in] client Client whose command line string has been already
+ *                  cached.
+ *
+ * @return Cached client command name. Error (NULL) if called:
+ *         - before ClientStateInitial client state notification
+ *         - after ClientStateGone client state notification
+ *         - for remote clients
+ *         - on OS that doesn't support mapping of PID to command line
+ *
+ * @see DetermineClientCmd
+ */
+const char *GetClientCmdName(struct _Client *client)
+{
+    if (client == NullClient)
+        return NULL;
+
+    if (!client->clientIds)
+        return NULL;
+
+    return client->clientIds->cmdname;
+}
+
+/**
+ * Get cached command arguments string of a client.
+ *
+ * param[in] client Client whose command line string has been already
+ *                  cached.
+ *
+ * @return Cached client command arguments. Error (NULL) if called:
+ *         - before ClientStateInitial client state notification
+ *         - after ClientStateGone client state notification
+ *         - for remote clients
+ *         - on OS that doesn't support mapping of PID to command line
+ *
+ * @see DetermineClientCmd
+ */
+const char *GetClientCmdArgs(struct _Client *client)
+{
+    if (client == NullClient)
+        return NULL;
+
+    if (!client->clientIds)
+        return NULL;
+
+    return client->clientIds->cmdargs;
+}

mkeil@… commented on Feb 11, 2012

I bisect skipped all the once listed above, because they did not configure or build. I just retried. I did the following

git checkout -f 8e4c3ce55b0f186bc6ba4039e30629669b6087b7 make clean; make

/bin/sh ../../../libtool   --mode=compile gcc -std=gnu99 -DHAVE_CONFIG_H -I. -I../../../include  -F/System/Library/Frameworks/ApplicationServices.framework/Frameworks -DLAUNCHD_ID_PREFIX=\"org.x\"  -I/opt/X11/include  -Wall -O0 -ggdb3 -arch i386 -arch x86_64 -pipe -DROOTLESS_SAFEALPHA -DNO_ALLOCA -c -o main.lo main.m
libtool: compile:  gcc -std=gnu99 -DHAVE_CONFIG_H -I. -I../../../include -F/System/Library/Frameworks/ApplicationServices.framework/Frameworks -DLAUNCHD_ID_PREFIX=\"org.x\" -I/opt/X11/include -Wall -O0 -ggdb3 -arch i386 -arch x86_64 -pipe -DROOTLESS_SAFEALPHA -DNO_ALLOCA -c main.m  -fno-common -DPIC -o .libs/main.o
In file included from x-selection.h:36,
                 from main.m:31:
/opt/X11/include/X11/extensions/Xfixes.h:220: error: expected declaration specifiers or '...' before 'Cursor'
...

I remember that this build problem was fixed very much later. Can one fixed that by cherry picking that fix (i would also need to know the number for it). Then i can build step by step the once above and tell you when it really broke.


mkeil@… commented on Feb 11, 2012

ok. Interesting. just to be sure i fred to build after:

git checkout -f xorg-server-1.10.0

and it also failed, at the same spot. I could have sworn it build and worked yesterday. Did i mess up somehow my tree?


jeremyhu@… commented on Feb 11, 2012

You said you are doing:

git checkout -f <hash>
make clean
make

You are missing an 'autoreconf -fvi' and './configure ...' in there after the checkout. To be safe, you need to do that each time you change configure.ac or Makefile.am (I just do it on every build).

Regarding the build failure for pbproxy, yes, you can just cherry-pick that commit in. It's probably this one:

commit 69a9171dbbafd6a7db702d48770d28fb54717545
Author: Jeremy Huddleston <jeremyhu@apple.com>
Date:   Tue Mar 1 20:02:46 2011 -0800

    XQuartz: pbproxy: Protect against possible collision between Cocoa and X11 Cursor types
    
    Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>

diff --git a/hw/xquartz/pbproxy/x-selection.h b/hw/xquartz/pbproxy/x-selection.h
index 614c8b0..d4a39e5 100644
--- a/hw/xquartz/pbproxy/x-selection.h
+++ b/hw/xquartz/pbproxy/x-selection.h
@@ -33,7 +33,9 @@
 
 #include "pbproxy.h"
 
+#define  Cursor X_Cursor
 #include <X11/extensions/Xfixes.h>
+#undef Cursor
 
 #include <AppKit/NSPasteboard.h>

mkeil@… commented on Feb 11, 2012

pups sorry. I always to the autoreconf -fvi and ./configure before each build. Forgot to mention that. I will try again with the cherry pick right away.


mkeil@… commented on Feb 11, 2012

With the cherry-pick, i was able to compile 1.10.0 and test it. It is fine. Later tonight i will go through the list above, and see where it breaks. Thanks.


mkeil@… commented on Feb 11, 2012

8e4c3ce55b0f186bc6ba4039e30629669b6087b7   xeyes good
dae24abcd44f3bb1966faa88222f851c784b37dc   xeyes very broken - no pupils at all, black instead of white, looks partially translated
296561506a91742cc150a0fb6fc0df5dbe98c780   randrproto version mismatch - can not configure
7dff79e39564b403c3afbc5e7bacffa0df190a23   xeyes very broken - no pupils at all, black instead of white, looks partially translated

As i mentioned in one earlier note the xeyes behaviour changed not from good to broken. More good to completely broken, somewhat broken. The effect of the second commit here is not the same as seen in 1.11.2 (pupils only miss some parts). The commit basically destroys xeye rendering completely.


mkeil@… commented on Feb 11, 2012

Updated to 2.7.1_rc4 and tested xeyes. Still has the pupil problem. I started playing with the xeyes command line options:

xeyes               bad pupils
xeyes -shape   crashes X11 when resizing xeyes
xeyes +shape  bad pupils, resizing will hide the eye outline
xeyes +render correct pupils, but outline seems to be moved by a pixel or two (put onto of a non-white background!)

Looks like xeyes shows some interesting X11 behaviours.

Our application also shows with 2.7.1_rc4 the same problems as with 2.7.0


jeremyhu@… commented on Mar 12, 2012

Can you test something for me? Open up os/utils.c and search for noRenderExtension. Set it to TRUE and rebuild. That will remove RENDER which I suspect is part of the issue...


jeremyhu@… commented on Mar 13, 2012

  • Status changed from reopened to new

jeremyhu@… commented on Mar 13, 2012

  • Status changed from new to assigned

mkeil@… commented on Mar 13, 2012

I will try that tonight (os/utils). Can i do that with the newest version (i currently run the 2.7.2 beta) or should i downgrade?


jeremyhu@… commented on Mar 13, 2012

Sticking with the latest versions is good.


mkeil@… commented on Mar 14, 2012

noRenderExtension = TRUE, "seems" to fix the problem for xeyes. But it "worsens" it for our application. Instead of missing text and other graphics elements, now i get corrupted drawing. But with that output i was now able to establish a pattern. The problem occurs when we draw multiple cairo drawing primitives (we use xlib cairo for most of our drawing) after each other onto the drawable. It does not happen if these cairo primitives (e.g. text, line path, ...) are grouped together with cairo_push_group/cairo_pop_group_to_source/cairo_paint. It also does not happen if the calls would not cause antialiasing compositing to be needed (i.e. a straight horizontal pixel size line on top of the text does not cause it, but a skew or 1.5 pixel line does). It looks like as if the non-grouped drawing has problems getting the contents of the drawable for compositing (or problem when putting it back???).

Another thing/problem i see now (with noRenderExtension) that drawing of some primitives (cairo_arc) is getting very very slow if not grouped.

I realize, that this now sounds very much like, that either our code or cairo is broken, but we have not switched cairo library and our code for years, and it worked on a multitude of platforms/x-servers.

I will try to create a simple cairo example with that new knowledge.


jeremyhu@… commented on Mar 14, 2012

Are you using your own cairo, or cairo from XQuartz? Can you please use the cairo from /opt/X11 to test your example as that is what I will use as well, so it will eliminate one possible variable.

Also, you've mentioned that a 2.6.3 X11.bin in a 2.7.0 install fixes the problem, so I'm still inclined to think that this is a server bug (or at least has a server solution).

The performance hit when not using render is expected.


mkeil@… commented on Mar 14, 2012

We are using our own cairo + pixman (compiled unmodified cairo + pixman). We are slightly outdated (cairo-1.8.6 + pixman-0.15.2). I will replace with the cairo + pixman from /opt/X11 and retest our application. I have not yet created a test example.

The RenderExtension - is this part of the server? with it, xeyes is still broken. Or do you think this is something unrelated?


jeremyhu@… commented on Mar 14, 2012

XSERVER is an extension in the server which allows for some optimized rendering paths. We've had some issues with RENDER in the past, and I wanted to eliminate it as a variable here. Seeing as how xeyes works with RENDER disabled but your application doesn't, I think we should consider xeyes a separate issue.


mkeil@… commented on Mar 14, 2012

Well...

I started with using the noRenderExtension xserver. I replaced our cairo library (and pixman) with the one from /opt/X11/lib. This causes in our application a core dump in the cairo library. So i thought, it would need a recompile, which i could not do right away. So i started with one of my really simple X11/cairo examples, compiled them against libcairo etc in /opt/X11/lib. These were then either producing X Errors or crashing in libcairo as well. I stripped them down to the bare minimum, and got some half working program done (X Errors when resizing, but not always, just sometimes). Sometimes also cairo gets unhappy and throws status errors on resizing. Additionally It was not redrawing unless i used cairo_surface_flush (which i do not need in our application). This test program did not exhibit any rendering problems (as mentioned yesterday in our big application) besides crashing. When i then tried to use cairo_push_group/cairo_pop_group_to_src it went downhill. It then always crashes in libcairo; however simple the example is. So i finally got the idea, it had something todo with the noRenderExtension server and switched back to the 2.7.2 beta. And all the crashes and Xerrors were gone!!! I conclude the current libcairo can not function properly without RenderExtension (if it should, i will upload the example source code).

With the RenderExtension server I also was able to replace our old libcairo and libpixman-1 with our application, and it ran without crash; but still shows the rendering issues (missing primitives) as before. Unfortunately i was not yet able to create a simple program to show the missing primitives with RenderExtension.

I can - if that helps you - try tomorrow to create simple program using the old libcairo which shows the render artifacts on compositing on a noRenderExtension server. But i fear that is not a valid test, since libcairo seems to not work properly without RenderExtension (at least new libcairo, so i assume the old one also acts strangely; but does not crash though).


jeremyhu@… commented on Mar 15, 2012

It would be nice to have you stripped down case of it crashing when the server doesn't support render, because cairo *should* be able to handle that. If you could file that bug in cairo's bugzilla, that would be great. Please let me know the ticket number, so I can track that issue.

As for our case, that seems to throw a wrench in our ability to test that particular case. hrm...


mkeil@… commented on Apr 2, 2012

I finally had some time to get back to this one. Before filing the bug with cairo i wanted to be sure that it was still happening with cairo 1.12.0. Since i was not able to compile it myself and you incorporated it into beta4, i could now try it.

I installed beta4, git cloned xserver, set noRenderExtension=TRUE in os/utils and compiled the server, and copied X11.bin into the beta4 XQuartz.app/Contents/MacOS directory, (The last time i might have done a make install, i am not sure).

Here are some results of running this Xserver:

  1. xeyes is broken (do i need to do a make install to get rid of the render extension???).
  1. My cairo test program does not crash, but finally shows the problem of our application (not rendering everything at time if cairo_push_group is not used).

So i attached the source code of the test program, the program itself and the X11.bin i created so that you can check it out. The not-rendering-bug is subtle. If you start test_cairo2 you will see a couple of lines (which use antialiasing) overlaying some text. And sometimes (e.g. right after program start) only the parts of lines which do not overlay the text are drawn. Once you start moving the lines/text with the mouse they are mostly redrawn correctly, but resizing the window often then "restores" bug (not all lines being visible/drawn). If you run test_cairo2 with the option -push_group (using then cairo_push_group to group rendering of lines and text), the lines are always visible.


mkeil@… commented on Apr 2, 2012

Makefile for test_cairo2


mkeil@… commented on Apr 2, 2012

source code of test program


mkeil@… commented on Apr 2, 2012


mkeil@… commented on Apr 2, 2012

  • Attachment X11.bin (7.9 MB) added

server with noRenderExtension = TRUE


mkeil@… commented on Apr 2, 2012

I just switched back to X11.bin of beta4 and tried out test_cairo2. It still shows the render bug on startup and sometimes after resize. So i hope that gives you a possibility to debug it.


jeremyhu@… commented on Apr 29, 2012

  • Milestone changed from 2.7.2 to 2.7.3

I'm not terribly familiar with cairo, and without a reduced test case, this will be to difficult to debug. I will give your test app a try in an attempt to bisect the regression, but since this is an issue with 2.7.0, it isn't going to block 2.7.2. Punting to 2.7.3


jeremyhu@… commented on Apr 29, 2012

Possibly related: https://bugs.freedesktop.org/show_bug.cgi?id=47266


jeremyhu@… commented on Jul 8, 2012

  • Milestone changed from 2.7.3 to 2.8.0

martinjotte@… commented on Jan 25, 2013

This bug also hits another program that I use which also does cairo for rendering. I found that it is one of the very first patches of the 1.11 server branch, "Move miTrapezoids() into fb as fbTrapezoids()", committed on 2011-02-26 by Søren Sandmann Pedersen, which causes this problem. An un-modified 1.10.0 server works fine with both my program and test_cairo2, but applying this single commit patch to the working 1.10.0 causes the problems for me. I don't know if the problem is in the pixman routines used in this change, or if it is even possible to revert this change in the latest servers.


brownrig@… commented on Feb 13, 2013

This is actually a rather serious problem for us: we draw a plot to the window, and close the window once a user clicks on it. With XQuartz 2.7.4 and multiple versions of cairo (the one distributed with XQuartz and any of the 1.12.x series releases), the plot is incompletely drawn. It varies substantially from run-to-run. I've tried putting in cairo_flush() calls, and XSync() calls to no avail. An analysis of the X protocol stream from client to server revealed no substantial differences in the last set of packets received on a Linux box versus the XQuartz 2.7.4 host.

The "fix" is surround all drawing with cairo_push()/cairo_pop_to_source() calls. This is not always desirable.

Attached is a small program (cairoHelloWorld.c) that demonstrates this. It is composed from a canonical "open an X Window" hello-world example from literateprograms.org, where I replaced their drawing-code with a small bit of cairo code from cairo's samples site (Example "text" from http://cairographics.org/samples/). Run the program normally to see the problem; run it with an argument of "1" to see it with the fix in action.


brownrig@… commented on Feb 13, 2013

Cairo/X11 hello-world example from literateprograms.org (modified slightly).


martinjotte@… commented on Feb 14, 2013

Using cairo for X11 rendering is definitely broken on recent versions of Xquartz. To demonstrate that the problem is with the very first changes to the 1.11 branch that moved trapezoid and triangle rendering into fb, I created a patch that puts back the old trapezoid and triangle rendering. With this change, cairo seems to render fine again, and the xeyes clipping problem is gone. I will attach this patch in case it is helpful.


martinjotte@… commented on Feb 14, 2013

Patch to 1.13.2 kernel to use old trapezoid and triangle rendering


jeremyhu@… commented on Feb 14, 2013

  • Milestone changed from 2.8.0 to 2.7.5

jeremyhu@… commented on Feb 14, 2013

Ok, I'll do that for 2.7.5, thanks.


brownrig@… commented on Nov 2, 2013

Replying to jeremyhu@…:

Ok, I'll do that for 2.7.5, thanks.

Hi -- Is this still on track for the 2.7.5 release? I downloaded the recent 2.7.5_rc3 update, and it seemingly does not contain the fix.

Thanks


jeremyhu@… commented on Nov 2, 2013

Pushed to xquartz git


jeremyhu@… commented on Nov 2, 2013

  • Status changed from assigned to closed
  • Resolution set to fixed

Please verify fixed in rc4 when it's out.


brownrig@… commented on Nov 5, 2013

Replying to jeremyhu@…:

Please verify fixed in rc4 when it's out.

Yes, rc4 does indeed seem to take care of the problem. Thanks very much for the fix!

You can’t perform that action at this time.