Because of the Thanksgiving holiday in the U.S., TI E2E design support forum responses may be delayed the week of Nov. 21. Thank you for your patience.

This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Graphics_SDK_4_05_00_03: buggy xft implementation?

I download and install Graphics_SDK_4_05_00_03 on my beagleboard.

Build it with xorg support.

And I see that almost every application that uses GTK+/X11 or  Qt/X11 show garbage instead of letters.

So I dig into this, and write simple application that uses xlib and xft (see attachment).

It draws "Hello, World!" with different font sizes.

It takes one argument - font size. And I ran it with paramter:

100 - good

50 - "," - broken other letters ok

30 - almost all letters are  broken.

I run Xorg that I build myself on this board, and with all parameters (100, 50, 30...) it show

"Hello, World!" without any damage.

So question, is it bug? If not, can you provide image of linux system for beagle board, where my example works as expected?

Here are screenshots:

./xft_example2 30

./xft_example2 50

and screenshost with my Xorg + omapfb

./xft_example2 30

./xft_example2 50 (my Xorg + omapfb):

sh gfx_check.sh
WSEGL settings
[default]
WindowSystem=libpvrPVR2D_DRIWSEGL.so
#WindowSystem=libpvrPVR2D_FLIPWSEGL.so
#WindowSystem=libpvrPVR2D_FRONTWSEGL.so
#DisableHWTQMipGen=1
ParamBufferSize=25165824
------
ARM CPU information
Processor    : ARMv7 Processor rev 3 (v7l)
BogoMIPS    : 717.37
Features    : swp half thumb fastmult vfp edsp thumbee neon vfpv3
CPU implementer    : 0x41
CPU architecture: 7
CPU variant    : 0x1
CPU part    : 0xc08
CPU revision    : 3

Hardware    : OMAP3 Beagle Board
Revision    : 0020
Serial        : 0000000000000000
------
SGX driver information
Version 1.6.16.4117 (release) /home/evgeniy/projects/compas/planetable/civil/beagleboard/Graphics_SDK_4_05_00_03/GFX_Linux_KM
System Version String: SGX revision = 1.2.1
------
Framebuffer settings
------
Rotation settings
0
------
Kernel Module information
Module                  Size  Used by
pvrsrvkm              123288  2
drm                   124580  3 pvrsrvkm
omapfb                 23408  1
cfbcopyarea             2608  1 omapfb
cfbimgblt               1688  1 omapfb
cfbfillrect             2632  1 omapfb
panel_generic_dpi       1728  1
omapdss               114072  2 omapfb,panel_generic_dpi
max7359_keypad          2624  0
spidev                  3924  0
autofs4                19628  0
------
Boot settings
console=ttyO2,115200n8 mpurate=720 buddy=unknown camera=lbcm3m1 vram=12M omapfb.mode=dvi:800x480MR-16@60 omapdss.def_disp=dvi root=/dev/mmcblk0p2 rw rootfstype=ext3 rootwait
------
Linux Kernel version
Linux beagleboard 3.0.12+ #46 PREEMPT Thu Mar 22 02:18:34 GMT-4 2012 armv7l GNU/Linux
root@beagleboard:~#

There are some problems with attachments, so here is test code:

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
 
#include <X11/Xlib.h>
#include <X11/Xft/Xft.h>

int main(int argc, char *argv[])
{
    Display *dpy;
        Window win;
        Colormap cmap;
        XEvent e;
        XftFont *xfthuge;
        XftColor color, black;
        XftDraw *draw;
        XRenderColor kindofblue = { 0x4c00, 0x7800, 0x9900, 0xffff};
    double font_height = 100.;

    assert(argc > 1);
    sscanf(argv[1], "%lf", &font_height);

        const char *msg = "Hello, World!";
        int scr;
        
        /* open connection with the server */
        dpy = XOpenDisplay(NULL);
        if (dpy == NULL) {
                fprintf(stderr, "Cannot open display\n");
                exit(1);
        }

        scr = DefaultScreen(dpy);
        cmap = DefaultColormap(dpy, scr);
        
        /* create window */
        win = XCreateSimpleWindow(dpy, RootWindow(dpy, scr), 100, 100, 700,
                  300, 1, BlackPixel(dpy, scr), WhitePixel(dpy, scr));

        /* select kind of events we are interested in */
        XSelectInput(dpy, win, ExposureMask | KeyPressMask);

        /* map (show) the window */
        XMapWindow(dpy, win);

        xfthuge = XftFontOpen(dpy, scr,
                  XFT_FAMILY, XftTypeString, "dejavuserifcondensed",
                  XFT_SIZE, XftTypeDouble, font_height,
                  NULL);

        XftColorAllocValue(dpy, DefaultVisual(dpy, scr), cmap,
               &kindofblue, &color);

    XftColorAllocName(dpy,  
              DefaultVisual(dpy, scr),  
              DefaultColormap(dpy, scr),  
              "black",  
              &black);

        draw = XftDrawCreate(dpy, win, DefaultVisual(dpy, scr), cmap);

        /* event loop */
        while (1) {
                XNextEvent(dpy, &e);

                /* draw or redraw the window */
                if (e.type == Expose) {
#if 0
                        XftDrawStringUtf8(draw, &color, xfthuge, 10, 100,
                      (FcChar8*)msg, strlen(msg));
#else
            for (int x = 10, y = 100; *msg != '\0'; ++msg, x += xfthuge->max_advance_width) {
                 XGlyphInfo extent;
                 FT_UInt glyph;
                 if (!XftCharExists(dpy, xfthuge, *msg))  {
                     printf("missed character %c\n", *msg);
                     continue;
                 }  
                 // Get the glyph and its extents.  
                 glyph = XftCharIndex(dpy, xfthuge, *msg);
                 XftGlyphExtents(dpy, xfthuge, &glyph, 1, &extent);
                 // Clear the bounding box and draw the glyph  
                 XftDrawRect(draw, &black, x, y, xfthuge->max_advance_width, xfthuge->height);  
                 XftDrawGlyphs(draw, &color, xfthuge, x, y + xfthuge->ascent, &glyph, 1);
            }
#endif
        }

                /* exit on key press */

                if (e.type == KeyPress)
                        break;
        }

        XftDrawDestroy(draw);

        /* close connection to server */
        XCloseDisplay(dpy);

        return 0;
}


  • After diging into this, I find out that problem in Xrender extension that implement pvr driver (by the way I run

    rendercheck utlity from http://xorg.freedesktop.org/ and it founds many errors, is this expected behaviour?),

    here is test application that I used, something wrong with cooperation of XRenderAddGlyphs and XRenderCompositeString8:

    #include <stdio.h>
    #include <stdlib.h>

    #include <X11/Xlib.h>
    #include <X11/extensions/Xrender.h>

    static const char glyph_data_H[12*16]={
        0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00,
        0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00,
        0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00,
        0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00,
        0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00,
        0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00,
        0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00,
        0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00,
        0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00,
        0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00,
        0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00,
        0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00,
        0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00,
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};

        

    static GlyphSet createGlyphSet(Display *display)
    {
        XRenderPictFormat *fmt_a8 = XRenderFindStandardFormat(display, PictStandardA8);
        GlyphSet gs = XRenderCreateGlyphSet(display, fmt_a8);
        Glyph gid;
        XGlyphInfo ginfo = {.x=0,.y=12,.width=12,.height=16,.xOff=12,.yOff=0};
        
        gid='H';
        XRenderAddGlyphs(display, gs, &gid, &ginfo, 1, glyph_data_H, 12*16);

        return gs;
    }

    static Display *display;
    static int screen;
    static Window root, window;
    static XEvent event;

    static Picture create_pen(int red, int green, int blue, int alpha)
    {
        XRenderColor color={.red=red, .green=green, .blue=blue, .alpha=alpha};
        XRenderPictFormat *fmt=XRenderFindStandardFormat(display, PictStandardARGB32);
        
        Pixmap pm=XCreatePixmap(display, window, 1, 1, 32);
        XRenderPictureAttributes pict_attr;
        pict_attr.repeat=1;
        Picture picture=XRenderCreatePicture(display, pm, fmt, CPRepeat, &pict_attr);
        XRenderFillRectangle(display, PictOpOver, picture, &color, 0, 0, 1, 1);
        return picture;
    }

    int main(int argc, char *argv[])
    {
        display = XOpenDisplay(NULL);

        int render_event_base, render_error_base;
        int render_present = XRenderQueryExtension(display, &render_event_base, &render_error_base);
        if (!render_present) {
            fprintf(stderr, "RENDER extension missing!\n");
            abort();
        }
        
        screen = DefaultScreen(display);
        XRenderPictFormat *fmt = XRenderFindVisualFormat(display, DefaultVisual(display, screen));
        root=DefaultRootWindow(display);
            
        window=XCreateWindow(display, root, 0, 0, 200, 200, 0,
            DefaultDepth(display, screen), InputOutput,
            DefaultVisual(display, screen),
            0, NULL);
        XRenderPictureAttributes pict_attr;
        
        /* set picture attributes for anti-aliased edges; default is sharp edges */
        pict_attr.poly_edge=PolyEdgeSmooth;
        pict_attr.poly_mode=PolyModeImprecise;
        Picture picture=XRenderCreatePicture(display, window, fmt, CPPolyEdge|CPPolyMode, &pict_attr);
        
        XSelectInput(display, window, KeyPressMask|KeyReleaseMask|ExposureMask
            |ButtonPressMask|StructureNotifyMask);
        
        Picture black=create_pen(0,0,0,0xffff);    
        GlyphSet font = createGlyphSet(display);    
        XMapWindow(display, window);
        
        XRenderColor color_white={.red=0xffff, .green=0xffff, .blue=0xffff, .alpha=0xffff};
        
        while(1) {
            XNextEvent(display, &event);
            
            switch(event.type) {
                case Expose:
                    /* no partial repaints */
                    XRenderFillRectangle(display, PictOpOver,
                        picture, &color_white, 0, 0, 640, 480);
                    
                    XRenderCompositeString8(display, PictOpOver,
                        black, picture, 0,
                                font, 0, 0, 40, 40, "H"/*ello World!"*/, 1);
                    break;
                case DestroyNotify:
                    return 0;
            }
        }
        
        return 0;
    }

    The result of this test:

    If you use opera-glasses you can see in white window several black pixels.

    Here screen shot where I run the same TI's Xorg, but with option NoAccel "true":

    Any reply?

  • Also if set Option          "EXANoComposite" "True", which disable usage of driver's Xrender extension,

    and switch to software rendering, all works fine.