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

Fix hello_xr when running under Linux OpenGL X11 #144

Merged
merged 2 commits into from Nov 21, 2019

Conversation

@SamanthaBowen
Copy link
Contributor

SamanthaBowen commented Nov 14, 2019

This relates to #41, but only fixes it when using Xlib and XCB, not for Wayland. This also fixes a separate issue I had on my own machine with Monado's OpenGL graphics requirements.

@rpavlik rpavlik self-requested a review Nov 21, 2019
Copy link
Contributor

rpavlik left a comment

Thanks for your contribution, this looks good to me! I did have one question, but it can be addressed in a follow-up PR if required.

@@ -186,7 +186,7 @@ Platform headers / declarations
#elif defined(OS_LINUX)

#define OPENGL_VERSION_MAJOR 4
#define OPENGL_VERSION_MINOR 3
#define OPENGL_VERSION_MINOR 5

This comment has been minimized.

Copy link
@rpavlik

rpavlik Nov 21, 2019

Contributor

Did it not work with 4.3? I suspect 4.3 should still work since I've used it locally without it failing.

This comment has been minimized.

Copy link
@SamanthaBowen

SamanthaBowen Nov 21, 2019

Author Contributor

When I change it back to 4.3, this is what I get when I run ./hello_xr -g OpenGL:

[17:36:07.783][Info   ] Press any key to shutdown...
[17:36:07.803][Info   ] Available Layers: (0)
[17:36:07.811][Info   ] Instance RuntimeName=Monado(XRT) by Collabora et al RuntimeVersion=0.1.42
[17:36:07.811][Info   ] Available View Configuration Types: (1)
[17:36:07.811][Info   ] Available Environment Blend Mode count : (1)
[17:36:07.811][Info   ] Environment Blend Mode (XR_ENVIRONMENT_BLEND_MODE_OPAQUE) : (Selected)
[17:36:07.870][Error  ] Runtime does not support desired Graphics API and/or version
    Source: ../../src/tests/hello_xr/graphicsplugin_opengl.cpp:111

The exception thrown in graphicsplugin_opengl.cpp is caused by checking the active OpenGL version against the minimum version given by xrGetOpenGLGraphicsRequirementsKHR. Looking at the Monado source code at https://gitlab.freedesktop.org/monado/monado, oxr_xrGetOpenGLGraphicsRequirementsKHR calls xrt_gfx_gl_get_versions, which hardcodes 4.5 as the minimum version. This is consistent with my testing since 4.4 doesn't work either on my machine.

What version of Monado are you using?

This comment has been minimized.

Copy link
@rpavlik

rpavlik Nov 21, 2019

Contributor

oh, interesting. I'm using something close to master. @Wallbraker - any particular reason we need 4.5? or would 4.3 suffice? (I don't remember if Monado's use of 4.5 was just "pick a number out of thin air")

This comment has been minimized.

Copy link
@rpavlik

rpavlik Nov 21, 2019

Contributor

(does this mean I can't use OpenGL 1.1 or 2.1 with Monado? That would be weird...)

@rpavlik rpavlik merged commit 4454731 into KhronosGroup:master Nov 21, 2019
2 checks passed
2 checks passed
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
license/cla Contributor License Agreement is signed.
Details
@rpavlik

This comment has been minimized.

Copy link
Contributor

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;
                                                       ^

Probably a define issue related to gfxwrapper. I'll dig into it further tomorrow.

@rpavlik rpavlik mentioned this pull request Nov 21, 2019
rpavlik added a commit that referenced this pull request Nov 22, 2019
Patch release for the 1.0 series.

This release includes some fixes, extensions, and a small build system change:
the build system is now configured to use C++14. No code changes in the loader
or layers have yet taken place that require C++14. **Please file an issue** in
OpenXR-SDK-Source if there is some deployment platform where you would be unable
to use a loader making use of C++14 features.

### GitHub Pull Requests

These had been integrated into the public repo incrementally.

- General, Build, Other
  - #141 - Support system libs better (permit system jsoncpp, etc. for easier
    packaging)
- hello_xr
  - #144 - Fix hello_xr when running under Linux OpenGL X11
- Registry
  - Reserve a Monado EGL extension
    <KhronosGroup/OpenXR-Docs#39>

### Internal issues

- General, Build, Other
  - Switch C++ standard version to C++14 (internal MR 1602)
  - Remove unused/unneeded files (internal MR 1609)
- Loader
  - Fix typo in parameter/member names (internal MR 1607, internal issue 1233)
  - Fix deprecated usage of JsonCpp (internal MR 1604, internal issue 1212)
- hello_xr
  - Resolve misleading use of `xrLocateViews` before `xrWaitFrame` in helloXR
    and spec (internal MR 1584, internal issue 1227, public issue
    <#134>)
- Registry
  - Add `XR_EXT_conformance_automation` extension, for use **only** by
    conformance testing (internal MR 1577, 1608)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.