platform/upstream/xorg-server.git
10 years agoglamor: Explain the weird EGL_NO_CONTEXT code.
Eric Anholt [Fri, 4 Apr 2014 06:03:31 +0000 (07:03 +0100)]
glamor: Explain the weird EGL_NO_CONTEXT code.

Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
10 years agoglamor: Replace glamor_get/put_context() with just glamor_make_current().
Eric Anholt [Sat, 15 Mar 2014 00:31:18 +0000 (17:31 -0700)]
glamor: Replace glamor_get/put_context() with just glamor_make_current().

Now that we have the DIX global state for the current context, we
don't need to track nesting to try to reduce MakeCurrent overhead.

v2: Fix a mistaken replacement of a put_context with make_current in
    glamor_fill_spans_gl() (caught by keithp).

Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com> (v1)
Reviewed-by: Adam Jackson <ajax@redhat.com> (v1)
10 years agoglamor: Stop unsetting the EGL context in put_context().
Eric Anholt [Sat, 15 Mar 2014 00:29:31 +0000 (17:29 -0700)]
glamor: Stop unsetting the EGL context in put_context().

This matches the Xephyr behavior.  Now that we know when to reset the
context in the presence of GLX, we don't need to try to keep our stuff
from being smashed by GLX.

Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
10 years agoglamor: Use lastGLContext to coordinate the context with GLX.
Eric Anholt [Sat, 15 Mar 2014 00:20:12 +0000 (17:20 -0700)]
glamor: Use lastGLContext to coordinate the context with GLX.

This gets us some more context changes that are needed to make sure
the two sides render to the right drawables and manipulate the right
objects.

Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
10 years agoglx: Make sure that DRI2/swrast calls haven't changed the GL context.
Eric Anholt [Wed, 9 Apr 2014 17:23:01 +0000 (10:23 -0700)]
glx: Make sure that DRI2/swrast calls haven't changed the GL context.

These functions are called from the GL driver, in some series of GL
calls by GLX.  If some server component (like glamor CreatePixmap for
GetBuffers()) changes the GL context on us, we need to set it back or
the later GL calls will land in the glamor context instead of the GLX
context.

Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
10 years agoglx: Refactor DRI2CopyRegion calls.
Eric Anholt [Wed, 9 Apr 2014 18:25:32 +0000 (11:25 -0700)]
glx: Refactor DRI2CopyRegion calls.

I needed to add some code to each one, so it's a good time to make a
helper func.

Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
10 years agoglx: Unconditionally clear lastGLContext on loseCurrent().
Eric Anholt [Fri, 18 Apr 2014 01:28:54 +0000 (18:28 -0700)]
glx: Unconditionally clear lastGLContext on loseCurrent().

This hook calls unbindContext in the DRI driver interface, which
unsets the dispatch table, regardless of whether the context argument
was the current one or not.

Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
10 years agoglx: Move GLX MakeCurrent lastGLContext updates next to makeCurrent().
Eric Anholt [Fri, 18 Apr 2014 01:23:51 +0000 (18:23 -0700)]
glx: Move GLX MakeCurrent lastGLContext updates next to makeCurrent().

We want to make sure that lastGLContext is set correctly during
makeCurrent, because we may have recursive GL context changes in the
DRI2 interfaces due to glamor.

Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
10 years agoglx: Move the GLX variable caching what GL context is current to dix.
Eric Anholt [Fri, 18 Apr 2014 01:18:49 +0000 (18:18 -0700)]
glx: Move the GLX variable caching what GL context is current to dix.

GLX is trying to track whether the context it wants is current, to
avoid the glFlush() (and the rest of the overhead) that occurs on all
MakeCurrent calls.  However, its cache can be incorrect now that
glamor exists.  This is a step toward getting glamor to coordinate
with GLX.

Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
10 years agoglamor: Fix a missing set of the GL context.
Eric Anholt [Wed, 16 Apr 2014 23:16:21 +0000 (16:16 -0700)]
glamor: Fix a missing set of the GL context.

Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
10 years agoglamor: Fix accelerated rendering of GTK's ARGB vs xBGR composites.
Eric Anholt [Mon, 21 Apr 2014 17:56:38 +0000 (10:56 -0700)]
glamor: Fix accelerated rendering of GTK's ARGB vs xBGR composites.

There is some complicated code to support tweaking the format as we
upload from a SHM pixmap (aka the GTK icon cache), but if we weren't
sourcing from a SHM pixmap we just forgot to check that the formats
matched at all.

We could potentially be a little more discerning here (xRGB source and
ARGB mask would be fine, for example), but this will all change with
texture views anyway, so just get the rendering working for 1.16
release.

Fixes the new rendercheck gtk_argb_xbgr test.

v2: Squash in keithp's fix for checking that we have a non-NULL
    pixmap, and reword the comment even more.

Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
10 years agoMake glamor build with --enable-debug.
Jamey Sharp [Fri, 18 Apr 2014 16:31:09 +0000 (09:31 -0700)]
Make glamor build with --enable-debug.

Bad anholt, no biscuit. Broken in commit
4c9a20072552c52b3763bd73e7a7e9b9cb8b4993.

Signed-off-by: Jamey Sharp <jamey@minilop.net>
Cc: Eric Anholt <eric@anholt.net>
Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Eric Anholt <eric@anholt.net>
10 years agoxfixes: Forbid manipulating clip for source-only pictures (#28968)
Adam Jackson [Thu, 10 Apr 2014 15:34:28 +0000 (11:34 -0400)]
xfixes: Forbid manipulating clip for source-only pictures (#28968)

Just throw BadPicture instead of crashing.  It's not currently a
meaningful thing to do anyway, RenderSetPictureRectangles would error if
you tried (which this patch changes to BadPicture as well for
consistency).  The problem with trying to do it is if the clip is
specified as a pixmap then we try to convert it to a region, and
->BitmapToRegion requires a ScreenPtr, and source-only pictures don't
have one.

I can imagine a use for client clip on source-only pictures, so if we
really wanted to allow this, probably the way forward is to always store
the clip as a region internally, and when setting the clip _from_ a
pixmap, look up BitmapToRegion relative to the pixmap not the picture.
But since clearly nobody can be relying on it working...

Signed-off-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
10 years agoxf86RandR12: use correct gamma size when allocating gamma table
Dominik Behr [Wed, 2 Apr 2014 03:36:13 +0000 (20:36 -0700)]
xf86RandR12: use correct gamma size when allocating gamma table

When setting crtc->gamma_size to randr_crtc->gammaSize we should
use randr_crtc->gammaSize to allocate new gamma table in crtc.
Currently, if randr_crtc->gammaSize > crtc->gammaSize the subsequent
memcpy will overwrite memory beyond the end of gamma table.

Signed-off-by: Dominik Behr <dbehr@chromium.org>
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
Signed-off-by: Keith Packard <keithp@keithp.com>
10 years agoos: Initialize the set of signals to be suppressed during our handler.
Eric Anholt [Fri, 4 Apr 2014 07:38:33 +0000 (08:38 +0100)]
os: Initialize the set of signals to be suppressed during our handler.

Fixes a valgrind complaint:

==8805== Syscall param rt_sigaction(act->sa_mask) points to uninitialised byte(s)
==8805==    at 0x5EB8315: __libc_sigaction (sigaction.c:66)
==8805==    by 0x5B13DA: busfault_init (busfault.c:145)
==8805==    by 0x5A60A2: OsInit (osinit.c:191)
==8805==    by 0x46EBA2: dix_main (main.c:163)

Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
10 years agoFix hw/xfree86/common/compiler.h for mips64
YunQiang Su [Sat, 12 Oct 2013 05:22:35 +0000 (13:22 +0800)]
Fix hw/xfree86/common/compiler.h for mips64

Mark mips64 as 64bit
Use long as PORT_SIZE

Signed-off-by: YunQiang Su <wzssyqa@gmail.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
10 years agoxres: Fix size estimation for <8bpp pixmaps (#69057)
Adam Jackson [Thu, 10 Apr 2014 15:45:37 +0000 (11:45 -0400)]
xres: Fix size estimation for <8bpp pixmaps (#69057)

Just use floats, it's not like this is a performance path.

Signed-off-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Julien Cristau <jcristau@debian.org>
Signed-off-by: Keith Packard <keithp@keithp.com>
10 years agoshadowfb: Fix compilation errors
Keith Packard [Tue, 22 Apr 2014 04:38:28 +0000 (21:38 -0700)]
shadowfb: Fix compilation errors

Ok, that's embarassing -- I didn't even make sure Adam's patch
compiled. These are minimal fixes to make it build.

Signed-off-by: Keith Packard <keithp@keithp.com>
10 years agoshadowfb: Port to miext/damage (#31303, #65547)
Adam Jackson [Thu, 10 Apr 2014 17:42:42 +0000 (13:42 -0400)]
shadowfb: Port to miext/damage (#31303, #65547)

Somewhat shocking how much simpler this is, isn't it?  We no longer need
to wrap the screen or GC or Picture, because damage does it for us,
which is doubly great since the old shadowfb code didn't wrap _enough_
things (border updates and Render glyphs, at least).  The only real
difference now between this and shadow is a) shadow will let you track
arbitrary pixmaps, and b) shadow's update hook runs off the BlockHandler
whereas shadowfb is immediate.

Tested on nouveau.

Signed-off-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
10 years agocomposite: Fix memory leak in compCopyWindow
Peter Harris [Thu, 17 Apr 2014 00:24:34 +0000 (20:24 -0400)]
composite: Fix memory leak in compCopyWindow

Signed-off-by: Peter Harris <pharris@opentext.com>
Reviewed-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
10 years agodmxConfigCanvasUpdate: Delay dereference until after checking for NULL
Alan Coopersmith [Mon, 21 Apr 2014 22:18:45 +0000 (15:18 -0700)]
dmxConfigCanvasUpdate: Delay dereference until after checking for NULL

Flagged by cppcheck 1.64:
[hw/dmx/config/xdmxconfig.c:306] -> [hw/dmx/config/xdmxconfig.c:323]:
 (warning) Possible null pointer dereference: fs - otherwise
           it is redundant to check it against null.

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
10 years agofb: Fix origin of source picture in fbGlyphs
Peter Harris [Fri, 11 Apr 2014 21:44:59 +0000 (17:44 -0400)]
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 <pharris@opentext.com>
Reviewed-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
/* 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;
}

10 years agoglamor: Add remaining header files to SOURCES
Michel Dänzer [Fri, 11 Apr 2014 02:01:51 +0000 (11:01 +0900)]
glamor: Add remaining header files to SOURCES

It wasn't possible to build glamor from tarballs.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=64297#c9
Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
10 years agodixfonts: Turn a missing directory ErrorF into a DebugF
Jasper St. Pierre [Mon, 21 Apr 2014 20:30:49 +0000 (16:30 -0400)]
dixfonts: Turn a missing directory ErrorF into a DebugF

On systems without these directories, we don't need to be complaining
loudly.

Reviewed-by: Kristian Hoegsberg <krh@bitplanet.net>
Signed-off-by: Keith Packard <keithp@keithp.com>
10 years agoMerge remote-tracking branch 'krh/xwayland-for-keithp'
Keith Packard [Mon, 21 Apr 2014 21:59:51 +0000 (14:59 -0700)]
Merge remote-tracking branch 'krh/xwayland-for-keithp'

10 years ago.gitignore: Add new autotools file 'test-driver'
Kristian Høgsberg [Tue, 25 Mar 2014 21:57:12 +0000 (14:57 -0700)]
.gitignore: Add new autotools file 'test-driver'

Automake 1.12 introduces a new parallel test framework that uses a shell
script helper and generates *.log and *.trs files.  Add to .gitignore.

Signed-off-by: Kristian Høgsberg <krh@bitplanet.net>
Reviewed-by: Gaetan Nadon <memsize@videotron.ca>
Signed-off-by: Keith Packard <keithp@keithp.com>
10 years agoconfigure: require xproto 7.0.26 for pointer typedef removal
Julien Cristau [Mon, 14 Apr 2014 13:27:19 +0000 (15:27 +0200)]
configure: require xproto 7.0.26 for pointer typedef removal

Signed-off-by: Julien Cristau <jcristau@debian.org>
Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
10 years agoconfigure: require fontsproto 2.1.3 for pointer typedef removal
Julien Cristau [Mon, 14 Apr 2014 13:27:18 +0000 (15:27 +0200)]
configure: require fontsproto 2.1.3 for pointer typedef removal

Signed-off-by: Julien Cristau <jcristau@debian.org>
Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
10 years agorandr: Implement RandR 1.4 request swapping
Robert Morell [Sat, 19 Apr 2014 01:29:44 +0000 (18:29 -0700)]
randr: Implement RandR 1.4 request swapping

The protocol handlers all have support for swapping variable data and
replies, but the top-level dispatch plumbing was missing.

Signed-off-by: Robert Morell <rmorell@nvidia.com>
Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
10 years agorandr: Fix size checks for SetProvider* reqs
Robert Morell [Sat, 19 Apr 2014 01:29:43 +0000 (18:29 -0700)]
randr: Fix size checks for SetProvider* reqs

Both xRRSetProviderOutputSourceReq and xRRSetProviderOffloadSinkReq are
fixed-size requests, so the length on the wire should match exactly.

Signed-off-by: Robert Morell <rmorell@nvidia.com>
Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
10 years agorandr: Fix crash for NULL swap dispatch procs
Robert Morell [Sat, 19 Apr 2014 01:29:42 +0000 (18:29 -0700)]
randr: Fix crash for NULL swap dispatch procs

The previous code was checking the wrong table for function pointers.

Signed-off-by: Robert Morell <rmorell@nvidia.com>
Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
10 years agoxwayland: Remove left-over ErrorF logging
Kristian Høgsberg [Mon, 21 Apr 2014 18:14:51 +0000 (11:14 -0700)]
xwayland: Remove left-over ErrorF logging

Reviewed-by: Jasper St. Pierre <jstpierre@mecheye.net>
Signed-off-by: Kristian Høgsberg <krh@bitplanet.net>
10 years agoDRI2SwapBuffers: Fix uninitialized target SBC.
Jamey Sharp [Fri, 18 Apr 2014 19:22:19 +0000 (12:22 -0700)]
DRI2SwapBuffers: Fix uninitialized target SBC.

Fixes Piglit test "swapbuffersmsc-return swap_interval 0".

Ensure that *swap_target gets initialized on any 'return Success' path,
even if the swap request can't be completed by the driver and the server
falls back to a simple blit. That path can also be triggered by setting
swap_interval to 0, which disables sync to vertical retrace.

We originally found this bug because for some reason SDL2 automatically
sets swap_interval to 0, when we were trying to test OML_sync_control in
an SDL2 test application. We then discovered that the above-mentioned
Piglit test has been failing for the same reason since it was
introduced.

Signed-off-by: Jamey Sharp <jamey@minilop.net>
Signed-off-by: Theo Hill <Theo0x48@gmail.com>
Reviewed-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Keith Packard <keithp@keithp.com>
10 years agoDRI2SwapBuffers: Don't reuse swap_target variable.
Jamey Sharp [Fri, 18 Apr 2014 19:22:18 +0000 (12:22 -0700)]
DRI2SwapBuffers: Don't reuse swap_target variable.

swap_target is an out-parameter that needs to be set to the value that
SBC will take on after this SwapBuffers request completes.

However, it was also being used as a temporary variable to hold the MSC
at which the SwapBuffers request got scheduled to occur. This confusion
makes it harder to reason about whether swap_target is being set
correctly for its out-parameter usage. (Hint: It isn't.)

For the latter use, it makes more sense to use the existing target_msc
variable, which already has the right value unless target_msc, divisor,
and remainder are all 0, in which case we can set it using swap_interval
as usual.

Signed-off-by: Jamey Sharp <jamey@minilop.net>
Signed-off-by: Theo Hill <Theo0x48@gmail.com>
Reviewed-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Keith Packard <keithp@keithp.com>
10 years agoconfigure.ac: Remove check for WAYLAND_SCANNER_RULES
Kristian Høgsberg [Tue, 8 Apr 2014 16:23:42 +0000 (09:23 -0700)]
configure.ac: Remove check for WAYLAND_SCANNER_RULES

This makes configure fail if the wayland autoconf macros aren't found.
We don't need the scanner for shm-only xwayland so just drop this line for
now.

Reviewed-by: Daniel Stone <daniel@fooishbar.org>
Reviewed-by: Gaetan Nadon <memsize@videotron.ca>
Reviewed-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
Signed-off-by: Kristian Høgsberg <krh@bitplanet.net>
10 years agoxwayland: Build without xshmfence
Kristian Høgsberg [Tue, 8 Apr 2014 16:19:13 +0000 (09:19 -0700)]
xwayland: Build without xshmfence

Reviewed-by: Daniel Stone <daniel@fooishbar.org>
Signed-off-by: Kristian Høgsberg <krh@bitplanet.net>
10 years agoxwayland: Build without GLX extension
Kristian Høgsberg [Tue, 8 Apr 2014 16:17:51 +0000 (09:17 -0700)]
xwayland: Build without GLX extension

Reviewed-by: Daniel Stone <daniel@fooishbar.org>
Signed-off-by: Kristian Høgsberg <krh@bitplanet.net>
10 years agoxkb: Verify reads of compiled keymap header and TOC
Keith Packard [Fri, 18 Apr 2014 22:12:14 +0000 (15:12 -0700)]
xkb: Verify reads of compiled keymap header and TOC

Check the return values from fread to make sure the elements are
actually getting read from the file.

Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Jamey Sharp <jamey@minilop.net>
10 years agoos: Ignore log file write failures
Keith Packard [Fri, 18 Apr 2014 22:09:50 +0000 (15:09 -0700)]
os: Ignore log file write failures

There's no place to log the message if writing to the log file fails,
and we surely don't want to crash in that case, so just ignore errors
and keep going.

Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Jamey Sharp <jamey@minilop.net>
10 years agoos: Make sure that writing our pid to the lock file actually worked
Keith Packard [Fri, 18 Apr 2014 22:05:00 +0000 (15:05 -0700)]
os: Make sure that writing our pid to the lock file actually worked

There's no sense verifying that we can create the lock file and then
ignoring the return value from write.

Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Jamey Sharp <jamey@minilop.net>
10 years agoos: FatalError if -displayfd writes fail
Keith Packard [Fri, 18 Apr 2014 22:00:30 +0000 (15:00 -0700)]
os: FatalError if -displayfd writes fail

When the server is started with the -displayfd option, check to make
sure that the writes succeed and give up running if they don't.

Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Jamey Sharp <jamey@minilop.net>
10 years agoos: Clear the -displayfd option after closing the file
Keith Packard [Fri, 18 Apr 2014 22:00:35 +0000 (15:00 -0700)]
os: Clear the -displayfd option after closing the file

Failing to clear this means that we'll attempt to write the display
number to a random file descriptor on subsequent X server generations.

Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Jamey Sharp <jamey@minilop.net>
10 years agokdrive: Ignore failure to chown console tty to current user
Keith Packard [Fri, 18 Apr 2014 21:54:02 +0000 (14:54 -0700)]
kdrive: Ignore failure to chown console tty to current user

I'm not sure what we'd do in this case anyways, other than fatal
error.

Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Jamey Sharp <jamey@minilop.net>
10 years agokdrive: Explicitly ignore errors from the -switchCmd script
Keith Packard [Fri, 18 Apr 2014 21:50:14 +0000 (14:50 -0700)]
kdrive: Explicitly ignore errors from the -switchCmd script

Make it clear that we intentionally ignore the -switchCmd return
value. This keeps GCC from emitting a warning when the server is
compiled with -D_FORTIFY_SOURCE=2.

Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Jamey Sharp <jamey@minilop.net>
10 years agotest: [v2] Validate server log reading more carefully in signal-logging test
Keith Packard [Fri, 18 Apr 2014 21:47:00 +0000 (14:47 -0700)]
test: [v2] Validate server log reading more carefully in signal-logging test

Check return value from fgets and strchr instead of assuming they
worked.

[v2]

Don't do any necessary work inside the assert call.
Also make sure the return value was long enough.

Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Jamey Sharp <jamey@minilop.net>
10 years agotest: create a link to the generated hw/xfree86/sdksyms.c at build time
Gaetan Nadon [Fri, 4 Apr 2014 18:59:21 +0000 (14:59 -0400)]
test: create a link to the generated hw/xfree86/sdksyms.c at build time

Automake 1.14 gives us warning about source code specified in _SOURCES
that comes from directories other than the current one. It suggests to enable
the subdir-objects feature which only supports code in sub directories.

The test directory needs source from hw/xfree86 which is neither under test
nor under a sub directory of test. In 1.14 we get a warning, in 2.0 it will
break as it will overwrite the object code in xfree86.

The solution in this case is to create a link to hw/xfree86/sdksyms.c at build
time. It's just like any other built source file.

There are no links created in git.

Signed-off-by: Gaetan Nadon <memsize@videotron.ca>
Reviewed-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
10 years agodri1: Don't bother asking the loader about drmGetLibVersion
Adam Jackson [Thu, 17 Apr 2014 14:49:46 +0000 (10:49 -0400)]
dri1: Don't bother asking the loader about drmGetLibVersion

This was added for DRM_IOCTL_SET_VERSION support, which has been around
for over ten years now. Since we require ≥2.3.0 in configure.ac this
would really only protect you if you managed to build against a modern
libdrm but run against one that's more than 7½ years old, which, doctor
it hurts when I do this.

Archaeology: http://cgit.freedesktop.org/~ajax/dri/commit/xc/programs/Xserver/GL/dri/dri.c?id=77d62efca033dced96ab7998b7c62a4e2df907d5
Signed-off-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Keith Packard <keithp@keithp.com>
10 years agoXorg.wrap manpages: use __appmansuffix__ instead of hardcoding 1
Hans de Goede [Fri, 18 Apr 2014 09:30:16 +0000 (11:30 +0200)]
Xorg.wrap manpages: use __appmansuffix__ instead of hardcoding 1

Cc: Gaetan Nadon <memsize@videotron.ca>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Gaetan Nadon <memsize@videotron.ca>
10 years agoman/Makefile.am: Fix Xorg.wrap.man Xwrapper.config.man missing from make dist
Hans de Goede [Fri, 18 Apr 2014 09:26:00 +0000 (11:26 +0200)]
man/Makefile.am: Fix Xorg.wrap.man Xwrapper.config.man missing from make dist

Fix suggested by: Gaetan Nadon <memsize@videotron.ca>

Cc: Gaetan Nadon <memsize@videotron.ca>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Gaetan Nadon <memsize@videotron.ca>
10 years agoXorg.wrap: Make the console check portable
Guillem Jover [Mon, 14 Apr 2014 16:13:25 +0000 (18:13 +0200)]
Xorg.wrap: Make the console check portable

Handle the unported case by issuing a build-time and run-time warning.

And add support for FreeBSD kernel based systems, by using the
VT_GETINDEX ioctl to check if the file descriptor is on a virtual
console.

Signed-off-by: Guillem Jover <guillem@hadrons.org>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
10 years agoXorg.wrap: Clarify error messages
Guillem Jover [Mon, 14 Apr 2014 16:13:24 +0000 (18:13 +0200)]
Xorg.wrap: Clarify error messages

Not printing the program name produces very confusing messages that
might be difficult to attribute while trying to diagnose problems,
let's be explicit about who we are.

Also add a missing "/" between SUID_WRAPPER_DIR and "Xorg.bin".

Signed-off-by: Guillem Jover <guillem@hadrons.org>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
10 years agoXorg.wrap: Use <drm.h> instead of hardcoding libdrm include path
Guillem Jover [Mon, 14 Apr 2014 16:13:23 +0000 (18:13 +0200)]
Xorg.wrap: Use <drm.h> instead of hardcoding libdrm include path

The libdrm.pc file gives us the correct include path, do not try to
hardcode it on the source, as it might vary on the installed system,
for example on Debian-based systems it's under /user/include/libdrm/.

Signed-off-by: Guillem Jover <guillem@hadrons.org>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
10 years agoXorg: Add Xorg.wrap to hw/xfree86/.gitignore
Guillem Jover [Mon, 14 Apr 2014 16:13:22 +0000 (18:13 +0200)]
Xorg: Add Xorg.wrap to hw/xfree86/.gitignore

Signed-off-by: Guillem Jover <guillem@hadrons.org>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
10 years agoconfigure: fix help text for dmx
Julien Cristau [Sun, 13 Apr 2014 17:14:34 +0000 (19:14 +0200)]
configure: fix help text for dmx

As of 93fa64e17d7bd600ebf18ecab85f5b2d17fe30ce it's disabled by default,
so stop saying it's automatically enabled in configure --help.

Signed-off-by: Julien Cristau <jcristau@debian.org>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
10 years agoglamor: Always allocate precisely the requested pixmap size
Keith Packard [Tue, 8 Apr 2014 08:01:28 +0000 (01:01 -0700)]
glamor: Always allocate precisely the requested pixmap size

Using a pixmap as a tile or stipple means that we must have the
underlying FBO match the pixmap geometry exactly. We may want to add
some complexity here to migrate pixmaps into exact sized objects as
necessary, but for now, make the server work correctly by skipping
this optimization.

Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
10 years agoMerge remote-tracking branch 'jeremyhu/master'
Keith Packard [Thu, 10 Apr 2014 04:59:17 +0000 (21:59 -0700)]
Merge remote-tracking branch 'jeremyhu/master'

10 years agoBump to version 1.15.99.902. Closing the 1.16 merge window. upstream/1.15.99.902 xorg-server-1.15.99.902
Keith Packard [Tue, 8 Apr 2014 21:25:18 +0000 (14:25 -0700)]
Bump to version 1.15.99.902. Closing the 1.16 merge window.

Signed-off-by: Keith Packard <keithp@keithp.com>
10 years agodri3: Fix dri3_open API change by adding new dri3_open_client
Keith Packard [Fri, 4 Apr 2014 23:28:43 +0000 (16:28 -0700)]
dri3: Fix dri3_open API change by adding new dri3_open_client

Xwayland will eventually need the current client in dri3_open. Simply
changing that API is not an option though as other drivers that
implement DRI3 will not have a matching function signature and will
crash when called.

Add a new dri3_open_client function pointer and bump
DRI3_SCREEN_INFO_VERSION so that drivers can be aware of the new
function which will be used in preference to the old function when
available.

Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Eric Anhole <eric@anholt.net>
10 years agoXQuartz: Ensure we wait for the server thread to terminate
Jeremy Huddleston Sequoia [Sun, 6 Apr 2014 12:32:00 +0000 (05:32 -0700)]
XQuartz: Ensure we wait for the server thread to terminate

AKA: XQuartz 2.7.5 doesn't delete its /tmp/.X$d-lock

http://xquartz.macosforge.org/trac/ticket/823

Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
10 years agoAdd a return value to load_cursor_argb() to allow it to report failure
Michael Thayer [Mon, 31 Mar 2014 09:21:42 +0000 (11:21 +0200)]
Add a return value to load_cursor_argb() to allow it to report failure

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.thayer@oracle.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
10 years agoSet a flag property on the root window to say if the X server VT is active
Michael Thayer [Mon, 31 Mar 2014 09:19:16 +0000 (11:19 +0200)]
Set a flag property on the root window to say if the X server VT is active

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.thayer@oracle.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
10 years agoAdd pScreen->NameWindowPixmap hook
Daniel Stone [Thu, 3 Apr 2014 17:22:50 +0000 (18:22 +0100)]
Add pScreen->NameWindowPixmap hook

This hook allows drivers to be notified when a pixmap gains a new ID.

(ABI break.)

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
10 years agoMerge remote-tracking branch 'krh/xwayland-for-keithp'
Keith Packard [Thu, 3 Apr 2014 22:35:01 +0000 (15:35 -0700)]
Merge remote-tracking branch 'krh/xwayland-for-keithp'

10 years agoXwayland DDX
Kristian Høgsberg [Tue, 11 Mar 2014 23:11:39 +0000 (16:11 -0700)]
Xwayland DDX

Started out as an Xorg module to be used from Xorg drivers to let
Xorg run under a wayland server.  The idea was to be able to reuse the
2D acceleration from the Xorg driver.  Now with glamor being credible,
a better plan is to just make Xwayland its own DDX, similar to Xwin
and Xquartz.  This is a much better fit, as much of the code in the
original approach had to hack around Xorg doing Xorg things like take
over the VT, probe input devices and read config files.  Another big win
is that Xwayland dosn't need to be setuid root.

The Xwayland support for DRI3, Glamor and render nodes was done by
Axel Davy <axel.davy@ens.fr>, who also did a lot of work on the rebase
to the Xwayland DDX.

Contributions from:

  Christopher James Halse Rogers <christopher.halse.rogers@canonical.com>
  Corentin Chary <corentin.chary@gmail.com>
  Daniel Stone <daniel@fooishbar.org>
  Kristian Høgsberg <krh@bitplanet.net>
  Robert Bragg <robert@linux.intel.com>
  Scott Moreau <oreaus@gmail.com>
  Tiago Vignatti <tiago.vignatti@intel.com>
  Giovanni Campagna <gcampagn@redhat.com>
  Jonas Ådahl <jadahl@gmail.com>
  Ray Strode <rstrode@redhat.com>
  Trevor McCort <tjmccort@gmail.com>
  Rui Matos <tiagomatos@gmail.com>
  Axel Davy <axel.davy@ens.fr>
  Jasper St. Pierre <jstpierre@mecheye.net>

Signed-off-by: Kristian Høgsberg <krh@bitplanet.net>
Reviewed-by: Axel Davy <axel.davy@ens.fr>
10 years agoglamor: Add glamor_program based poly_text and image_text
Keith Packard [Wed, 2 Apr 2014 04:15:48 +0000 (21:15 -0700)]
glamor: Add glamor_program based poly_text and image_text

Accelerates text painting with GPU-based geometry computation and stippling

v2: Simplify get_glyphs, expand single character variable names to
    more descriptive ones. (Markus Wick)
v3: Rebase against the glamor_prepare_* un-renaming (changes by anholt).

Improves x11perf -f8text by 417.908% +/- 11.0144% (n=10)

Signed-off-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Eric Anholt <eric@anholt.net>
10 years agoglamor: Use glamor_program for glamor_glyphblt
Keith Packard [Wed, 2 Apr 2014 04:15:47 +0000 (21:15 -0700)]
glamor: Use glamor_program for glamor_glyphblt

This constructs suitable shaders using the glamor_program
infrastructure for poly glyph blt, and then gets rid of the no-op
wrapper of miImageGlyphBlt.

Improves x11perf -f8text by 11.6221% +/- 1.04585% (n=10)

Signed-off-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Eric Anholt <eric@anholt.net>
10 years agoglamor: Add glamor_program based poly_fill_rect
Keith Packard [Wed, 2 Apr 2014 04:15:46 +0000 (21:15 -0700)]
glamor: Add glamor_program based poly_fill_rect

This accelerates poly_fill_rect using GPU-based geometry computation

Improves x11perf -rect100 by 41.5127% +/- 7.63888% (n=10)
Improves x11perf -rect10 by 3745.72% +/- 94.7503% (n=6)

v2: Rebase on skipping the prepare rewrite for now, and fix the GLSL
    1.20 and GLES2 cases (changes by anholt).

Signed-off-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Eric Anholt <eric@anholt.net>
10 years agoglamor: Add glamor_program based fill/set/get spans
Keith Packard [Wed, 2 Apr 2014 04:15:45 +0000 (21:15 -0700)]
glamor: Add glamor_program based fill/set/get spans

This accelerates spans operations using GPU-based geometry computation

-wellipse500 goes from about 4k/sec before the patch, to ~8k/sec in
the GLES2 fallback loop, to ~100k/sec in desktop mode.

v2: Rebase on skipping the prepare rewrite for now, and fix the GLSL
    1.20 and GLES2 cases (changes by anholt).

Signed-off-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Eric Anholt <eric@anholt.net>
10 years agoglamor: Add simple upload/download functions in glamor_transfer
Keith Packard [Wed, 2 Apr 2014 04:15:43 +0000 (21:15 -0700)]
glamor: Add simple upload/download functions in glamor_transfer

These use glTexSubimage2D for upload and glReadPixels for
download. There are a variety of interfaces to the basic function as
needed by the callers.

Signed-off-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
10 years agoglamor: Use plain GLSL 1.20 features for fill code.
Keith Packard [Wed, 2 Apr 2014 04:15:42 +0000 (21:15 -0700)]
glamor: Use plain GLSL 1.20 features for fill code.

This prevents performance regressions from losing acceleration support
on older hardware as we transition to using glamor_program.c for
acceleration.

Signed-off-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Eric Anholt <eric@anholt.net>
10 years agoglamor: Compute supported GLSL version and save in screen private
Keith Packard [Wed, 2 Apr 2014 04:15:42 +0000 (21:15 -0700)]
glamor: Compute supported GLSL version and save in screen private

This currently computes the GLSL version in a fairly naïve fashion,
and leaves that in the screen private for other users. This will let
us update the version computation in one place later on.

v2: Drop an accidental rebase-squashed hunk (change by anholt).

Signed-off-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Eric Anholt <eric@anholt.net>
10 years agofb: Publish fbGlyphs and fbUnrealizeGlyph
Keith Packard [Wed, 2 Apr 2014 04:15:41 +0000 (21:15 -0700)]
fb: Publish fbGlyphs and fbUnrealizeGlyph

This lets other code jump directly into the fb code for fallbacks

Signed-off-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Eric Anholt <eric@anholt.net>
10 years agoglamor: Bail from composite when pixmap cannot be uploaded
Keith Packard [Wed, 2 Apr 2014 03:54:22 +0000 (20:54 -0700)]
glamor: Bail from composite when pixmap cannot be uploaded

I think the sense of the return value was just flipped here; if you
return TRUE, then the calling code assumes that the pixmap *has* been
uploaded and that an FBO is available. When it tries to use it, it
crashes though. Returning false makes the caller bail back to software.

Signed-off-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Eric Anholt <eric@anholt.net>
10 years agoglamor: Remove warning message when pixmap cannot be stored in a texture
Keith Packard [Wed, 2 Apr 2014 03:54:21 +0000 (20:54 -0700)]
glamor: Remove warning message when pixmap cannot be stored in a texture

This happens when you have 4bpp pixmaps; it's not an error, so stop
flooding the log file when it happens.

Signed-off-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Eric Anholt <eric@anholt.net>
10 years agoglamor: Public polyLines function is glamor_poly_lines_nf
Keith Packard [Wed, 2 Apr 2014 03:54:20 +0000 (20:54 -0700)]
glamor: Public polyLines function is glamor_poly_lines_nf

There was a spurious declaratoin in glamor.h for glamor_poly_line_nf

Signed-off-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
10 years agoglamor: Initialize XV shaders from glamor_xv_init instead of glamor_init
Keith Packard [Wed, 2 Apr 2014 03:54:19 +0000 (20:54 -0700)]
glamor: Initialize XV shaders from glamor_xv_init instead of glamor_init

The glamor_init calls to glamor_init_xv_shader were never getting run
because GLAMOR_XV was never defined. Instead of trying to make that
work, fix glamor_xv_init to make the call instead.

Further, just get rid of the glamor_fini_xv_shader function entirely
as the shader program will be destroyed when the context is destroyed
at server reset time.

Signed-off-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Eric Anholt <eric@anholt.net>
10 years agoglamor: SetWindowPixmap is not related to RENDER
Keith Packard [Wed, 2 Apr 2014 03:54:18 +0000 (20:54 -0700)]
glamor: SetWindowPixmap is not related to RENDER

Move the configuration of screen->SetWindowPixmap out from under it.

Signed-off-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Eric Anholt <eric@anholt.net>
10 years agoglamor: glamor_poly_point_nf cannot fail for non-DDX pixmaps
Keith Packard [Wed, 2 Apr 2014 03:54:15 +0000 (20:54 -0700)]
glamor: glamor_poly_point_nf cannot fail for non-DDX pixmaps

All of the glamor _nf functions must check to see if the DDX can
access the pixmap directly before returning failure back to the
driver; this restructures the point code to split out the _nf checking
from the _gl code.

Signed-off-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Eric Anholt <eric@anholt.net>
10 years agoRevert "glx: Make sure we get an FBConfig the root window's visual."
Eric Anholt [Fri, 21 Mar 2014 20:13:27 +0000 (13:13 -0700)]
Revert "glx: Make sure we get an FBConfig the root window's visual."

This reverts commit b5a61239e2fef167c229154d7919ff862503e3f3.

Not only did I screw up and introduce a warning, it turns out
glXChooseFBConfig() explicitly ignores this attribute.  Thanks, GLX.

Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Julien Cristau <jcristau@debian.org>
10 years agoMerge remote-tracking branch 'whot/for-keith'
Keith Packard [Thu, 3 Apr 2014 17:44:28 +0000 (10:44 -0700)]
Merge remote-tracking branch 'whot/for-keith'

10 years agoRevert "xkb: ProcesssPointerEvent must work on the VCP if it gets the VCP"
Peter Hutterer [Wed, 2 Apr 2014 03:55:10 +0000 (13:55 +1000)]
Revert "xkb: ProcesssPointerEvent must work on the VCP if it gets the VCP"

This was the wrong fix to the problem, and it triggered a change in XKB
behavior: previously a button event would unlock a latched modifier, now it
doesn't anymore.
https://bugs.freedesktop.org/show_bug.cgi?id=73155

Note that the new behavior is is strictly spec compliant but we've had the
other behavior for a long time so we shouldn't break it.

The bug this patch originally fixed was a null-pointer dereference when
releasing button events on server shutdown. This was addressed by the commit
below, so the need for this patch has gone away anyway.

commit 3e4be4033aed78b2bb3a18d51f0963989efd1af3
Author: Peter Hutterer <peter.hutterer@who-t.net>
Date:   Fri Jan 25 11:47:32 2013 +1000

    dix: when shutting down slave devices, shut down xtest devices last

This reverts commit 2decff6393a44b56d80d53570718f95354fde454.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
10 years agoxf86LogInit: log to XDG_DATA_HOME when not running as root
Hans de Goede [Tue, 1 Apr 2014 09:24:17 +0000 (11:24 +0200)]
xf86LogInit: log to XDG_DATA_HOME when not running as root

When no logfile was specified (xf86LogFileFrom == X_DEFAULT) and we're not
running as root log to $XDG_DATA_HOME/xorg/Xorg.#.log as Xorg won't be able to
log to the default /var/log/... when it is not running as root.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
10 years agoglamor: Expose glamor_destroy_pixmap()
Kristian Høgsberg [Tue, 1 Apr 2014 01:04:07 +0000 (18:04 -0700)]
glamor: Expose glamor_destroy_pixmap()

When we create a glamor pixmap by calling glamor_create_pixmap()
directly, we need to call glamor_destroy_pixmap() to destroy it.

Signed-off-by: Kristian Høgsberg <krh@bitplanet.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
10 years agoglamor: Add new GLAMOR_CREATE_PIXMAP_NO_TEXTURE pixmap create flag
Kristian Høgsberg [Tue, 1 Apr 2014 01:00:54 +0000 (18:00 -0700)]
glamor: Add new GLAMOR_CREATE_PIXMAP_NO_TEXTURE pixmap create flag

This flag lets a DDX allocate a glamor pixmap without allocating the
texture that backs it.  The DDX can then allocate the texture itself
and then set it later.

Signed-off-by: Kristian Høgsberg <krh@bitplanet.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
10 years agoglamor: Move glamor_egl_screen_init() prototype to glamor.h
Kristian Høgsberg [Tue, 1 Apr 2014 00:59:18 +0000 (17:59 -0700)]
glamor: Move glamor_egl_screen_init() prototype to glamor.h

A DDX that implements the glamor EGL functions need to pull in this
prototype but shouldn't need to pull in glamor_priv.h

Signed-off-by: Kristian Høgsberg <krh@bitplanet.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
10 years agodri3: Allow asynchronous implementation for dri3_open
Kristian Høgsberg [Fri, 28 Mar 2014 06:47:59 +0000 (23:47 -0700)]
dri3: Allow asynchronous implementation for dri3_open

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 <krh@bitplanet.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
10 years agocomposite: Add exception mechanism for implicit redirection policy
Kristian Høgsberg [Fri, 28 Mar 2014 05:15:28 +0000 (22:15 -0700)]
composite: Add exception mechanism for implicit redirection policy

Normally composite will decide to add implicit redirection when a
window with an alternate visual is a parent of a window with a regular
visual or vice versa.  This uses extra pixmap memory and incurs an extra
copy.  This exception mechanism provides a way for a DDX to override this
if the DDX knows that its acceleration architecture will render correctly.

The relevant case is that of an RGB window reparented into a ARGB parent
frame window.  If the DDX knows that the acceleration architecture in use
will pad the alpha channel to opaque when rendering to the RGB window,
the implicit redirection can be avoided.

This patch adds a new composite function:

  CompositeRegisterImplicitRedirectionException()

which lets a DDX register a pair of parent and child window visuals, that
will not be implicitly redirected even if the normal policy would have
made that choice.

Signed-off-by: Kristian Høgsberg <krh@bitplanet.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
10 years agoMake XYToWindow a screen function
Keith Packard [Tue, 1 Apr 2014 06:55:25 +0000 (23:55 -0700)]
Make XYToWindow a screen function

This allows DDXen to override the window picking to account for
native windows not seen by the X server.  The bulk of the picking logic
is exposed as a new helper function, miSpriteTrace().  This function
completes the sprite trace filled out by the caller, and can be set up
to start the search from a given toplevel window.

v2: Leave existing XYToWindow API in place for API compatibility

Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
10 years agoconfigure: Change DEFAULT_LOGPREFIX to really be a filename prefix
Hans de Goede [Wed, 26 Mar 2014 11:24:49 +0000 (12:24 +0100)]
configure: Change DEFAULT_LOGPREFIX to really be a filename prefix

Rather then a full path prefix, this is a preparation patch for adding
support for logging to another location when not running as root.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
10 years agoMerge remote-tracking branch 'jturney/master'
Keith Packard [Tue, 1 Apr 2014 06:24:56 +0000 (23:24 -0700)]
Merge remote-tracking branch 'jturney/master'

10 years agomi: Hush extension initialization (#75870)
Adam Jackson [Thu, 27 Mar 2014 15:48:39 +0000 (11:48 -0400)]
mi: Hush extension initialization (#75870)

Printing these as ErrorF is fairly obnoxious, since it means the
non-hardware servers now spew stuff to the console for entirely routine
events.  And actually, printing these at all is fairly obnoxious, since
a) we're printing a line for every extension, whether it's enabled or
not, and b) we're not actually initializing the extension at this point.

Signed-off-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Daniel Stone <daniel@fooishbar.org>
Signed-off-by: Keith Packard <keithp@keithp.com>
10 years agofb: fix fast-path blt detection
Keith Packard [Tue, 25 Mar 2014 15:21:16 +0000 (08:21 -0700)]
fb: fix fast-path blt detection

The width parameter is used to disable the blit fast-path (memcpy) when
source and destination rows overlap in memory. This check was added in [0].

Unfortunately, the calculation to determine if source and destination
lines overlapped was incorrect:
  (1) it converts width from pixels to bytes, but width is actually in
      bits, not pixels.
  (2) it adds this byte offset to dst/srcLine, which implicitly converts
      the offset from bytes to sizeof(FbBits).

Fix both of these by converting addresses to byte pointers and width
to bytes and doing comparisons on the resulting byte address.

For example:
A 32-bpp 1366 pixel-wide row will have
  width = 1366 * 32 = 43712 bits
  bpp = 32
  (bpp >> 3) = 4
  width * (bpp >> 3) = 174848 FbBits
  (FbBits *)width => 699392 bytes

So, "careful" was true if the destination line was within 699392 bytes,
instead of just within its 1366 * 4 = 5464 byte row.

This bug causes us to take the slow path for large non-overlapping rows
that are "close" in memory.  As a data point, XGetImage(1366x768) on my
ARM chromebook was taking ~140 ms, but with this fixed, it now takes
about 60 ms.
  XGetImage() -> exaGetImage() -> fbGetImage -> fbBlt()

[0] commit e32cc0b4c85c78cd8743a6e1680dcc79054b57ce
Author: Adam Jackson <ajax@redhat.com>
Date:   Thu Apr 21 16:37:11 2011 -0400

    fb: Fix memcpy abuse

    The memcpy fast path implicitly assumes that the copy walks
    left-to-right.  That's not something memcpy guarantees, and newer glibc
    on some processors will indeed break that assumption.  Since we walk a
    line at a time, check the source and destination against the width of
    the blit to determine whether we can be sloppy enough to allow memcpy.
    (Having done this, we can remove the check for !reverse as well.)

v3: Convert to byte units

This first checks to make sure the blt is byte aligned, converts all
of the data to byte units and then compares for byte address range
overlap between source and dest.

Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Daniel Kurtz <djkurtz@chromium.org>
10 years agoHandle -displayfd and an explicit display number sensibly
Jon TURNEY [Mon, 11 Mar 2013 14:34:32 +0000 (14:34 +0000)]
Handle -displayfd and an explicit display number sensibly

Handle -displayfd and an explicit display number sensibly, e.g. use the
explicitly specified display number, and write it to the displayfd

v2: displayfd might be 0, so use -1 as invalid value
v3: Rebase for addition of NoListenAll flag

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
10 years agoFix build when configured --enable-debug
Jon TURNEY [Mon, 24 Mar 2014 17:32:10 +0000 (17:32 +0000)]
Fix build when configured --enable-debug

Include os.h for ErrorF() to fix implicit-function-declaration warnings when
configured with --enable-debug.

hw/xfree86/parser/DRI.c: In function 'xf86parseDRISection':
hw/xfree86/parser/DRI.c:87:5: error: implicit declaration of function 'ErrorF' [-Werror=implicit-function-declaration]
hw/xfree86/parser/Extensions.c: In function 'xf86parseExtensionsSection':
hw/xfree86/parser/Extensions.c:77:5: error: implicit declaration of function 'ErrorF' [-Werror=implicit-function-declaration]

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
Reviewed-by: Julien Cristau <jcristau@debian.org>
10 years agoFix ephyr build with --disable-glamor
Jon TURNEY [Mon, 24 Mar 2014 17:32:09 +0000 (17:32 +0000)]
Fix ephyr build with --disable-glamor

See http://tinderbox.x.org/builds/2014-03-23-0010/logs/xserver/#build

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
Tested-by: Julien Cristau <jcristau@debian.org>
Reviewed-by: Julien Cristau <jcristau@debian.org>
10 years agoBuild fbcmap_mi.c once, rather than once for each DDX
Jon TURNEY [Mon, 24 Feb 2014 20:45:51 +0000 (20:45 +0000)]
Build fbcmap_mi.c once, rather than once for each DDX

Build fbcmap_mi.c once, rather than once for each DDX, and make it part of libfb
or libwfb convenience library.

Since 84e8de1271bb11b5b4b9747ae4647f47333a8ab7 we don't have fbcmap.c

This is a sort of revert of 17d85387d1e6851d35474b65929e268ca64ef65b

v2: Remove libkdrivestubs.la from configure.ac

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
Reviewed-by: Gaetan Nadon <memsize@videotron.ca>
10 years agoBuild Xi/stubs.c once as a convenience library, rather than once for each DDX which...
Jon TURNEY [Fri, 21 Feb 2014 18:11:33 +0000 (18:11 +0000)]
Build Xi/stubs.c once as a convenience library, rather than once for each DDX which wants to use it

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
Reviewed-by: Gaetan Nadon <memsize@videotron.ca>
10 years agoBuild dpmsstubs.c once as a convenience library, rather than once for each DDX which...
Jon TURNEY [Wed, 7 Sep 2011 11:50:20 +0000 (12:50 +0100)]
Build dpmsstubs.c once as a convenience library, rather than once for each DDX which wants to use it

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
Reviewed-by: Gaetan Nadon <memsize@videotron.ca>
10 years agoXephyr: restore initial window resize lost in xcb conversion
Julien Cristau [Wed, 26 Mar 2014 22:24:20 +0000 (23:24 +0100)]
Xephyr: restore initial window resize lost in xcb conversion

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 <jcristau@debian.org>
Reported-by: Laércio de Sousa <lbsousajr@gmail.com>
Tested-by: Jon TURNEY <jon.turney@dronecode.org.uk>
Reviewed-by: Jon TURNEY <jon.turney@dronecode.org.uk>
Signed-off-by: Keith Packard <keithp@keithp.com>
10 years agoglamor: Add glamor_program PolyPoint implementation
Keith Packard [Wed, 12 Mar 2014 21:35:27 +0000 (14:35 -0700)]
glamor: Add glamor_program PolyPoint implementation

This accelerates poly point when possible by off-loading all geometry
computation to the GPU.

Improves x11perf -dot performance by 28109.5% +/- 1022.01% (n=3)

Signed-off-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Eric Anholt <eric@anholt.net>