~thopiekar/xorg-server/+git/xorg-xserver:server-1.15-branch

Last commit made on 2014-06-27
Get this branch:
git clone -b server-1.15-branch https://git.launchpad.net/~thopiekar/xorg-server/+git/xorg-xserver

Branch merges

Branch information

Name:
server-1.15-branch
Repository:
lp:~thopiekar/xorg-server/+git/xorg-xserver

Recent commits

a0e938b... by Peter Hutterer

Bump version to 1.15.2

Signed-off-by: Peter Hutterer <email address hidden>

2abbf56... by Steven McDonald

Xi: block SIGIOs while copying device classes around

I've been seeing sporadic (anywhere from once every few days to 3-4
times a day) crashes and freezes in X. The problematic behaviour isn't
always the same, but I chose a particular incident to debug, and found
that X was segfaulting in updateMotionHistory, on line 575 of
dix/getevents.c.

After some further investigation, I found that the bug was being
triggered when a SIGIO was received in DeepCopyPointerClasses, between
the AllocValuatorClass call (line 540) and updating the to->valuator
pointer (line 545). AllocValuatorClass calls realloc() on to->valuator,
so between these lines, it's not guaranteed to point to allocated
memory.

It seems the SIGIO handler is calling updateMotionHistory, which is
reading the memory pointed to by to->valuator and getting a wrong value
for last_motion, which updates buff to point to wildly the wrong place
and thus generates a segfault when a memcpy() is done into buff.

I am attaching a patch which I've been running on that machine for the
past three days, and haven't yet observed any more crashing or freezing
behaviour. The patch simply calls OsBlockSIGIO while
DeepCopyDeviceClasses is in progress, as the state of the X server's
device data structures is not guaranteed to be in a consistent state
during that time.

Debian bug#744303 <https://bugs.debian.org/744303>

Signed-off-by: Julien Cristau <email address hidden>
Reviewed-by: Peter Hutterer <email address hidden>
Signed-off-by: Peter Hutterer <email address hidden>
(cherry picked from commit d7a2df0a7499864cb005b098b79c1bdf884f6600)

2ceb448... by Robert Ancell

Fix overflow checking extension versions

The easiest way to check for the version of an extension is to send the maximum
possible version numbers in the QueryVersion request. The X server overflows on
these as it assumes you will send a reasonable version number.

Signed-off-by: Peter Hutterer <email address hidden>
Reviewed-by: Keith Packard <email address hidden>
(cherry picked from commit 548fc937b22d4dfe7f96e0bd77522261603a2c2f)

416ea95... by Peter Hutterer

man: drop specific mention of DontZap in -retro (#71113)

DontZap off is the default anyway, don't mention it specifically to avoid
confusion

X.Org Bug 71113 <http://bugs.freedesktop.org/show_bug.cgi?id=71113>

Signed-off-by: Peter Hutterer <email address hidden>
(cherry picked from commit cfaf2abbac3f01e57d00845d8908bf01559263f9)

18f3471... by Peter Hutterer

xfree86: fix wrong DontZap documentation (#71113)

X.Org Bug 71113 <http://bugs.freedesktop.org/show_bug.cgi?id=71113>

Signed-off-by: Peter Hutterer <email address hidden>
(cherry picked from commit e48a132b6d187f355abd7021be47edde972e7091)

57a0426... by Matt Dew <email address hidden>

Bump version # to 1.15.1.901

268eb96... by Jeremy Sequoia

XQuartz: Update logic to account for title bar on every display in Mavericks

<rdar://problem/14205847>
http://xquartz.macosforge.org/trac/ticket/832

Signed-off-by: Jeremy Huddleston Sequoia <email address hidden>
(cherry picked from commit 1c10b37380d228b35db8a8616a6312ac54f5e59b)

6244617... by Jeremy Sequoia

XQuartz: Dead code removal (ENABLE_DEBUG_LOG)

Signed-off-by: Jeremy Huddleston Sequoia <email address hidden>
(cherry picked from commit ad0ff649c68b18c4b95b078c2d1d1e7de71a7c6f)

77ab9ca... by Jeremy Sequoia

XQuartz: Bump to 2.7.7

Signed-off-by: Jeremy Huddleston Sequoia <email address hidden>
(cherry picked from commit e281288d5afedb154f52c31f70a350a013ecfb06)

6e31a3e... by Peter Harris <email address hidden>

fb: Fix origin of source picture in fbGlyphs

If a source picture doesn't repeat and a mask format is specified, the
incorrect calulation of the origin of the glyphs caused the glyphs to
not be drawn at all.

Noticed when running gtk-demo from RHEL 6.5 and selecting "Rotated
Text".

Signed-off-by: Peter Harris <email address hidden>
Reviewed-by: Keith Packard <email address hidden>
Signed-off-by: Keith Packard <email address hidden>

/* Test for this bug

cc -std=c99 -o glyph glyph.c `pkg-config --cflags --libs xcb-render`

*/

// 16 x 16 pictfmt_a8 "glyph"
static const char glyph[] = {
    0xff, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0xff,
    0, 0xff, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0xff, 0,
    0, 0, 0xff, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0xff, 0, 0,
    0, 0, 0, 0xff, 0, 0, 0, 0, 0, 0, 0, 0, 0xff, 0, 0, 0,
    0, 0, 0, 0, 0xff, 0, 0, 0, 0, 0, 0, 0xff, 0, 0, 0, 0,
    0, 0, 0, 0, 0, 0xff, 0, 0, 0, 0, 0xff, 0, 0, 0, 0, 0,
    0, 0, 0, 0, 0, 0, 0xff, 0, 0, 0xff, 0, 0, 0, 0, 0, 0,
    0, 0, 0, 0, 0, 0, 0, 0xff, 0xff, 0, 0, 0, 0, 0, 0, 0,
    0, 0, 0, 0, 0, 0, 0, 0xff, 0xff, 0, 0, 0, 0, 0, 0, 0,
    0, 0, 0, 0, 0, 0, 0xff, 0, 0, 0xff, 0, 0, 0, 0, 0, 0,
    0, 0, 0, 0, 0, 0xff, 0, 0, 0, 0, 0xff, 0, 0, 0, 0, 0,
    0, 0, 0, 0, 0xff, 0, 0, 0, 0, 0, 0, 0xff, 0, 0, 0, 0,
    0, 0, 0, 0xff, 0, 0, 0, 0, 0, 0, 0, 0, 0xff, 0, 0, 0,
    0, 0, 0xff, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0xff, 0, 0,
    0, 0xff, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0xff, 0,
    0xff, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0xff,
};

static struct {
    uint8_t len;
    uint8_t pad[3];
    uint16_t deltax, deltay;
    uint8_t glyph;
    uint8_t pad2[3];
} elt = { len:1, glyph:1, deltax:WIN_SIZE/2 - GLYPH_SIZE/2, deltay:WIN_SIZE/2 - GLYPH_SIZE/2 };

int main(int argc, char *argv[])
{
    int screen;
    xcb_connection_t *c = xcb_connect(NULL, &screen);
    if (!c || xcb_connection_has_error(c)) {
 fprintf(stderr, "Cannot open default display \"%s\"\n", getenv("DISPLAY"));
 return EXIT_FAILURE;
    }

    // Find root window and depth
    const xcb_setup_t *setup = xcb_get_setup(c);
    if (screen >= setup->roots_len)
 screen = 0;
    xcb_screen_iterator_t si = xcb_setup_roots_iterator(setup);
    for (int i=0; i < screen; i++)
 xcb_screen_next(&si);
    xcb_window_t root = si.data->root;
    uint8_t depth = si.data->root_depth;
    xcb_visualid_t visual = si.data->root_visual;

    // Find picture formats
    xcb_render_query_pict_formats_reply_t *qpf;
    qpf = xcb_render_query_pict_formats_reply(c, xcb_render_query_pict_formats(c), NULL);
    if (!qpf) {
 fprintf(stderr, "Cannot query RENDER picture formats\n");
 return EXIT_FAILURE;
    }
    xcb_render_pictformat_t fmt_a8 = 0;
    xcb_render_pictforminfo_iterator_t pfi =
        xcb_render_query_pict_formats_formats_iterator(qpf);
    for (int i = 0; i < xcb_render_query_pict_formats_formats_length(qpf); i++) {

        if (pfi.data->depth == 8 &&
                pfi.data->type == XCB_RENDER_PICT_TYPE_DIRECT &&
                pfi.data->direct.alpha_mask == 0xFF) {
            fmt_a8 = pfi.data->id;
            break;
        }
        xcb_render_pictforminfo_next(&pfi);
    }
    if (!fmt_a8) {
 fprintf(stderr, "Cannot find a8 RENDER picture format\n");
 return EXIT_FAILURE;
    }

    xcb_render_pictformat_t fmt_visual = 0;
    xcb_render_pictscreen_iterator_t psi =
        xcb_render_query_pict_formats_screens_iterator(qpf);
    for (int i = 0; i < xcb_render_query_pict_formats_screens_length(qpf); i++) {
        xcb_render_pictdepth_iterator_t pdi =
            xcb_render_pictscreen_depths_iterator(psi.data);
        for (int j = 0; i < xcb_render_pictscreen_depths_length(psi.data); i++) {
            xcb_render_pictvisual_iterator_t pvi =
                xcb_render_pictdepth_visuals_iterator(pdi.data);
            for (int k = 0; k < xcb_render_pictdepth_visuals_length(pdi.data); i++) {
                if (pvi.data->visual == visual) {
                    fmt_visual = pvi.data->format;
                    goto found_visual;
                }
                xcb_render_pictvisual_next(&pvi);
            }
            xcb_render_pictdepth_next(&pdi);
        }
        xcb_render_pictscreen_next(&psi);
    }
found_visual:
    if (!fmt_visual) {
 fprintf(stderr, "Cannot find visual RENDER picture format\n");
 return EXIT_FAILURE;
    }

    xcb_render_glyphset_t glyphset = xcb_generate_id(c);
    xcb_render_create_glyph_set(c, glyphset, fmt_a8);
    uint32_t glyph_ids[] = {1};
    xcb_render_add_glyphs(c, glyphset, 1, glyph_ids,
            &(xcb_render_glyphinfo_t){width:GLYPH_SIZE, height:GLYPH_SIZE}, sizeof(glyph), glyph);

    // Create window, pixmap, and gc
    xcb_window_t window = xcb_generate_id(c);
    uint32_t list[] = { si.data->black_pixel, XCB_EVENT_MASK_EXPOSURE };
    xcb_create_window(c, XCB_COPY_FROM_PARENT, window, root, 0, 0, WIN_SIZE, WIN_SIZE,
     0, XCB_WINDOW_CLASS_INPUT_OUTPUT, XCB_COPY_FROM_PARENT,
     XCB_CW_BACK_PIXEL | XCB_CW_EVENT_MASK, list);
    xcb_map_window(c, window);
    xcb_render_picture_t winpic = xcb_generate_id(c);
    xcb_render_create_picture(c, winpic, window, fmt_visual, 0, NULL);

    xcb_pixmap_t pixmap = xcb_generate_id(c);
    xcb_create_pixmap(c, depth, pixmap, window, GLYPH_SIZE, GLYPH_SIZE);
    xcb_render_picture_t pixpic = xcb_generate_id(c);
    xcb_render_create_picture(c, pixpic, pixmap, fmt_visual, 0, NULL);
    xcb_render_fill_rectangles(c, XCB_RENDER_PICT_OP_SRC, pixpic,
            (xcb_render_color_t){green:0xFFFF, alpha:0xFFFF}, 1,
            &(xcb_rectangle_t){width:GLYPH_SIZE, height:GLYPH_SIZE} );

    xcb_flush(c);
    for (xcb_generic_event_t *ev = xcb_wait_for_event(c); ev; ev = xcb_wait_for_event(c)) {
 int type = ev->response_type;
 free(ev);
 if (type == XCB_EXPOSE) {
            xcb_clear_area(c, 0, window, 0, 0, 0, 0);
            xcb_render_composite_glyphs_8(c, XCB_RENDER_PICT_OP_SRC, pixpic, winpic, fmt_a8,
                    glyphset, 0, 0, sizeof(elt), (uint8_t *)&elt);
            xcb_flush(c);
        }
    }

    return EXIT_SUCCESS;
}

(cherry picked from commit 983e30361f49a67252d0b5d82630e70724d69dbf)