[PATCH RFC 4/4] x11 backend: add option to use pixman renderer

Vasily Khoruzhick anarsoul at gmail.com
Sun Jan 6 03:38:34 PST 2013


On Sun, Jan 6, 2013 at 1:39 PM, Uli Schlachter <psychon at znc.in> wrote:
> Hi,
>
> On 06.01.2013 10:12, Vasily Khoruzhick wrote:
>> +     /* Check if SHM is available */
>> +     version = xcb_shm_query_version_reply(c->conn, xcb_shm_query_version(c->conn), 0);
>> +     if (!version)
>> +             /* SHM is missing */
>> +             return -ENOENT;
>> +     weston_log("Found SHM extension version: %d.%d\n", version->major_version, version->minor_version);
>> +     free(version);
>
> Welcome to the extension-weirdness. This won't work (if the SHM extension is
> absent).
>
> The SHMQueryVersion request is just there to check if the X server has the
> required version of the SHM extension, because the X11 protocol doesn't have
> version numbers on extension. Before you can use this request, you first have to
> check if the SHM extension is present.
>
> However, since you don't actually need to check any version, just the following
> should be enough:
>
> const xcb_query_extension_reply_t *ext =
>          xcb_get_extension_data(c->conn, &xcb_shm_id);
> if (ext == NULL || !ext->present)
>      return -ENOENT;
> /* Do *NOT* free(ext) */
>
> If you try to send a SHMQueryVersion request when the X11 server does not have
> the SHM extension, the xcb connection will break and go into an error state.
> This doesn't make any difference for this patch, since weston will die with an
> error message anyway, but it's still nicer to do the proper extension check.

Thanks!  Your code indeed works (tested with Xnest, which lacks
MIT-SHM extension), found one more bug
(wrong renderer destroyed in error path). I'll wait for more comments
for a while and then
will resend patch.

Regards
Vasily

> Cheers,
> Uli
> --
> "Why make things difficult, when it is possible to make them cryptic
> and totally illogical, with just a little bit more effort?" -- A. P. J.


More information about the wayland-devel mailing list