Coming soon - Get a detailed view of why an account is flagged as spam!
view details

This post has been de-listed

It is no longer included in search results and normal feeds (front page, hot posts, subreddit posts, etc). It remains visible only via the author's post history.

2
A very ugly mesa hack for "Error: [Context] Unable to obtain x11 visual from context"
Author Summary
haagch is in context
Post Body

So I looked at the workaround here: https://forums.oculus.com/viewtopic.php?uid=119403&f=34&t=16664&start=0#p252973

But I wanted to run janus vr, a closed source program that statically links the rift sdk. (I think LD_PRELOAD doesn't work for some reason).

And then I looked closer and thought, it doesn't actually do any work here, it just chooses some configuration. So... why not hardcode it?

Of course we don't want that in our system mesa, so we can just build it somewhere else and export:

export LD_LIBRARY_PATH=/mesa-build/usr/lib/
export LIBGL_DRIVERS_PATH=/mesa-build/usr/lib/xorg/modules/dri/

and tadaa - janus vr works. The hack is really just the simplest copy&paste from the workaround in the oculus forms I could do:

diff --git a/src/glx/glxcmds.c b/src/glx/glxcmds.c
index f4f476e..c5b4ea0 100644
--- a/src/glx/glxcmds.c
    b/src/glx/glxcmds.c
@@ -1539,9  1539,18 @@ glXImportContextEXT(Display *dpy, GLXContextID contextID)
 _X_EXPORT int
 glXQueryContext(Display * dpy, GLXContext ctx_user, int attribute, int *value)
 {
 static int attributs[] =     {
         GLX_RENDER_TYPE, GLX_RGBA_BIT,
         GLX_DRAWABLE_TYPE, GLX_WINDOW_BIT,
         GLX_DOUBLEBUFFER, true,
         GLX_RED_SIZE, 1,
         GLX_GREEN_SIZE, 1,
         GLX_BLUE_SIZE, 1,
         None
     };
    struct glx_context *ctx = (struct glx_context *) ctx_user;

-   switch (attribute) {
    switch (*attributs) {
       case GLX_SHARE_CONTEXT_EXT:
       *value = ctx->share_xid;
       break;
@@ -1604,6  1613,18 @@ _X_EXPORT GLXFBConfig *
 glXChooseFBConfig(Display * dpy, int screen,
                   const int *attribList, int *nitems)
 {
 
     static int attribs[] =
     {
         GLX_RENDER_TYPE, GLX_RGBA_BIT,
         GLX_DRAWABLE_TYPE, GLX_WINDOW_BIT,
         GLX_DOUBLEBUFFER, true,
         GLX_RED_SIZE, 1,
         GLX_GREEN_SIZE, 1,
         GLX_BLUE_SIZE, 1,
         None
     };
 
    struct glx_config **config_list;
    int list_size;

@@ -1611,8  1632,8 @@ glXChooseFBConfig(Display * dpy, int screen,
    config_list = (struct glx_config **)
       glXGetFBConfigs(dpy, screen, &list_size);

-   if ((config_list != NULL) && (list_size > 0) && (attribList != NULL)) {
-      list_size = choose_visual(config_list, list_size, attribList, GL_TRUE);
    if ((config_list != NULL) && (list_size > 0) && (attribs != NULL)) {
       list_size = choose_visual(config_list, list_size, attribs, GL_TRUE);
       if (list_size == 0) {
          free(config_list);
          config_list = NULL;

A slightly more advanced version would be to make a library that only implements those two functions and then to LD_PRELOAD them...

Author
Account Strength
100%
Account Age
11 years
Verified Email
Yes
Verified Flair
No
Total Karma
12,255
Link Karma
1,066
Comment Karma
11,189
Profile updated: 5 days ago
Posts updated: 8 months ago

Subreddit

Post Details

Location
We try to extract some basic information from the post title. This is not always successful or accurate, please use your best judgement and compare these values to the post title and body for confirmation.
Posted
9 years ago