Bug 234

Summary: X fail to start on x86-64 target
Product: [Build System, Metadata & Runtime] Meta-yocto Reporter: Edwin Zhai <edwin.zhai>
Component: meta-yoctoAssignee: Edwin Zhai <edwin.zhai>
Status: VERIFIED FIXED QA Contact:
Severity: major    
Priority: High CC: kevin.tian, poky.bs.watcher, poky.watcher, richard.purdie, sgw
Version: 0.9   
Target Milestone: 0.9 M3   
Hardware: x86   
OS: x86_64   
Whiteboard:
OS type for building Yocto: --- Type of Regression: ---
Verified: Program Management Documentation change: ---

Description Edwin Zhai 2010-08-25 22:25:59 UTC
x86-64 target fail to start Xwindow, while x86 target is okay. Xorg + matchbox-terminal can start, but matchbox desktop fail. There are seg fault from v86d and some demsg from uvesafb. Josh pulled some upstream fixes into v86d and uvesafb, but the root cause is not found yet.
Comment 1 Edwin Zhai 2010-08-27 20:55:00 UTC
Finally found the v86d and uvesafb issue has nothing to do with this bug. After rmmod uvesafb, everything remains same.

Matchbox environment start fail on x86-64 target, while ok on x86 target. Root cause is libmatchbox use "0"(int) as termination indicator when calling XftFontOpen, which in turn called FcPatternVapBuild(in fontconfig). It try to get the "0" as char* and fetch wrong value, as int and char* has different size on x86-64. 

See following source code:
==== libmatchbox ======
  font->font = XftFontOpen (font->dpy, DefaultScreen(font->dpy),
                            XFT_FAMILY, XftTypeString , font->family,
                            XFT_SIZE, XftTypeDouble   , (double)font->pt_size,
                            XFT_WEIGHT, XftTypeInteger, weight,
                            XFT_SLANT, XftTypeInteger , slant,
                            0);

==== fontconfig ====
#define FcPatternVapBuild(result, orig, va)                         \
{                                                                   \
    FcPattern   *__p__ = (orig);                                    \
    const char  *__o__;                                             \
    FcValue     __v__;                                              \
                                                                    \
    for (;;)                                                        \
    {                                                               \
> >        __o__ = va_arg (va, const char *);                       \
> >        if (!__o__)                                              \
> >            break;                                               \
        __v__.type = va_arg (va, FcType);                           \
Comment 2 Edwin Zhai 2010-08-29 23:51:12 UTC
More tests with dongxiao showed that this issue only occur when passing many parameter, which leads passing parameter through stack rather than register. Register can handle the extension well, so you can put 32b value and get 64b same value.
Comment 3 Edwin Zhai 2010-09-02 17:40:22 UTC
Fixed by 0d7bcdf9fd1bfaebfb5f0b99606e85a8e0229bba
Comment 4 Edwin Zhai 2010-09-08 17:33:58 UTC
Verified on 2010-09-04 nightly build with commit 18ea4d2a30cf1cd5e5499bd22d193d8732c2798c

The X window can start successfully.