Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Linux XCB compat #145

Open
rpavlik opened this issue Nov 21, 2019 · 7 comments

Comments

@rpavlik
Copy link
Contributor

@rpavlik rpavlik commented Nov 21, 2019

Hmm. When I pull this into the internal repo with CI, it fails during the xcb-backend build of the exported source. (Don't know why it doesn't fail with the normal source)

FAILED: /usr/bin/c++   -DOPENXR_HAVE_COMMON_CONFIG -DOS_LINUX_XCB_GLX -DXR_OS_LINUX -DXR_USE_GRAPHICS_API_OPENGL -DXR_USE_PLATFORM_XCB -DXR_USE_TIMESPEC -I../src/../include -I../src -Isrc/tests/hello_xr -I../src/common -I../include -Iinclude -I../external/include -fPIE   -Wall -std=gnu++14 -MMD -MT src/tests/hello_xr/CMakeFiles/hello_xr.dir/graphicsplugin_opengl.cpp.o -MF src/tests/hello_xr/CMakeFiles/hello_xr.dir/graphicsplugin_opengl.cpp.o.d -o src/tests/hello_xr/CMakeFiles/hello_xr.dir/graphicsplugin_opengl.cpp.o -c ../src/tests/hello_xr/graphicsplugin_opengl.cpp
In file included from ../src/tests/hello_xr/graphicsplugin_opengl.cpp:9:0:
../src/common/xr_linear.h:24:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
 #pragma clang diagnostic ignored "-Wunused-function"
 ^
../src/tests/hello_xr/graphicsplugin_opengl.cpp: In member function ‘virtual void {anonymous}::OpenGLGraphicsPlugin::InitializeDevice(XrInstance, XrSystemId)’:
../src/tests/hello_xr/graphicsplugin_opengl.cpp:124:55: error: ‘struct ksGpuContext’ has no member named ‘connection’
         m_graphicsBinding.connection = window.context.connection;
                                                       ^
../src/tests/hello_xr/graphicsplugin_opengl.cpp:125:57: error: ‘struct ksGpuContext’ has no member named ‘screenNumber’
         m_graphicsBinding.screenNumber = window.context.screenNumber;
                                                         ^
../src/tests/hello_xr/graphicsplugin_opengl.cpp:126:55: error: ‘struct ksGpuContext’ has no member named ‘fbconfigid’
         m_graphicsBinding.fbconfigid = window.context.fbconfigid;
                                                       ^
../src/tests/hello_xr/graphicsplugin_opengl.cpp:129:55: error: invalid conversion from ‘GLXContext {aka __GLXcontextRec*}’ to ‘xcb_glx_context_t {aka unsigned int}’ [-fpermissive]
         m_graphicsBinding.glxContext = window.context.glxContext;
                                                       ^

I'll dig into it further tomorrow.

Originally posted by @rpavlik in #144 (comment)

@SamanthaBowen

This comment has been minimized.

Copy link
Contributor

@SamanthaBowen SamanthaBowen commented Nov 21, 2019

I looked back at the definition for the 'ksGpuContext' struct in gfxwrapper_opengl.h and noticed the #elif defined(OS_LINUX_XLIB) || defined(OS_LINUX_XCB_GLX) directive that decides if the struct has the XLib fields. Was the || defined(OS_LINUX_XCB_GLX) supposed to go with the #elif defined(OS_LINUX_XCB) block of XCB fields instead? I thought I checked if the code compiled with XCB, but maybe I only checked OS_LINUX_XCB and not OS_LINUX_XCB_GLX.

@rpavlik

This comment has been minimized.

Copy link
Contributor Author

@rpavlik rpavlik commented Nov 22, 2019

Hmm, looks like the build system says:

    # XCB + XCB GLX is limited to OpenGL 2.1
    # add_definitions( -DOS_LINUX_XCB )
    # XCB + Xlib GLX 1.3
    add_definitions( -DOS_LINUX_XCB_GLX )

so it doesn't have all those fields. It does have connection - via window.connection, and the visualid and glxDrawable are still OK, but the other 3 are absent.

@rpavlik

This comment has been minimized.

Copy link
Contributor Author

@rpavlik rpavlik commented Nov 22, 2019

Almost looks like the XCB OpenGL graphics binding is only half of what it needs to be - as in, it's missing a XCB + GLX xlib version. What a mess.

@rpavlik

This comment has been minimized.

Copy link
Contributor Author

@rpavlik rpavlik commented Nov 22, 2019

Oh, interesting. The XCB hello_xr never ran because of a missing "platform adapter". I'll probably just partially revert/comment out the change to fix this for now.

@rpavlik

This comment has been minimized.

Copy link
Contributor Author

@rpavlik rpavlik commented Nov 22, 2019

and monado doesn't support the xcb binding. OK. So I have a partial fix available but for the release I'll just do the partial revert, so you can review the mess I made of the code :)

@rpavlik rpavlik changed the title Linux XCB build failure Linux XCB compat Nov 22, 2019
@rpavlik

This comment has been minimized.

Copy link
Contributor Author

@rpavlik rpavlik commented Nov 22, 2019

OK, the less-than-perfect fix has been released. There may actually be a spec bug here.

@rpavlik-bot

This comment has been minimized.

Copy link
Collaborator

@rpavlik-bot rpavlik-bot commented Dec 5, 2019

An issue (number 1278) has been filed to correspond to this issue in the internal Khronos GitLab.

If you have a Khronos account, you can access that issue at KHR:openxr/openxr#1278.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.