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

Implement offscreen rendering in Wayland in OSGLContext #765

Merged
merged 1 commit into from
Jul 17, 2022

Conversation

YakoYakoYokuYoku
Copy link
Member

@YakoYakoYokuYoku YakoYakoYokuYoku commented Feb 1, 2022

PR Description

What type of PR is this? (Check one of the boxes below)

  • New feature (non-breaking change which adds functionality)

What does this pull request do?

This PR adds support for Wayland offscreen rendering through EGL and OpenGL. Due to the OpenGL API is only bindable in EGL versions 1.4 and onwards, the context creation will only admit those versions. And because of the Qt Wayland plugin being introduced in Qt 5 only that version and subsequent ones are supported. An OSGLContext_xdg class was implemented as an interface for both X11 and Wayland OpenGL context handling. In case users may want to force X11 in Natron they'll have to set the QT_QPA_PLATFORM environment variable to xcb and set the NATRON_DISABLE_WAYLAND to any value.

Show a few screenshots (if this is a visual change)

See #764.

Have you tested your changes (if applicable)? If so, how?

By building and running Natron and NatronRenderer (with NatronRenderer --opengl enabled) on a project that uses the Shadertoy plugin.

Futher details of this pull request

With #764 Wayland is now supported by Natron.

@devernay
Copy link
Member

Interesting!
Does this mean also headless rendering with NatronRenderer using EGL? Did you test that (with a Shadertoy node, for example)

@YakoYakoYokuYoku
Copy link
Member Author

Could check rendering with OCIOLogConvert in NatronRenderer although Shadertoy is not working at the moment, either with Wayland nor X11.

@devernay
Copy link
Member

Shadertoy is not working

Can you be more specific about this?

  • Is it not working in RB-2.4?
  • RB-2.5?
  • this PR?
  • Using the GUI?
  • Using NatronRenderer with display?
  • Using NatronRenderer headless?

Shadertoy being widely used and a supported plugin, this should be considered a serious issue.

@YakoYakoYokuYoku
Copy link
Member Author

Speaking in the context of offscreen rendering in Natron RB-2.5 with a display (either an X11 or a Wayland session), Shadertoy does not work because of an argument named args.openGLEnabled (openfx-misc/Shadertoy/Shadertoy.cpp:1312) is false at the time of the ShadertoyPlugin::render call. I haven't investigated it further yet on why is not being set to true.

@devernay
Copy link
Member

Speaking in the context of offscreen rendering in Natron RB-2.5 with a display (either an X11 or a Wayland session), Shadertoy does not work because of an argument named args.openGLEnabled (openfx-misc/Shadertoy/Shadertoy.cpp:1312) is false at the time of the ShadertoyPlugin::render call. I haven't investigated it further yet on why is not being set to true.

Do you see anything in the console output that says OpenGL was disabled for some reason?

I would like to understand more precisely which configurations are broken. Is the execution with the Natron GUI always using hardware-accelerated OpenGL rendering, whether it's 2.4 or 2.5 or 2.5+this_PR? Is NatronRenderer always failing, or only in some configurations?

Do you get the "Available OpenGL renderers" message in the console?
Do you get the "Failed to load OpenGL" message?

@YakoYakoYokuYoku
Copy link
Member Author

Do you see anything in the console output that says OpenGL was disabled for some reason?

I would like to understand more precisely which configurations are broken. Is the execution with the Natron GUI always using hardware-accelerated OpenGL rendering, whether it's 2.4 or 2.5 or 2.5+this_PR?
Is NatronRenderer always failing, or only in some configurations?

My console output doesn't display any mention of OpenGL being disabled, in fact it finds a proper renderer

Found OpenGL Renderer: AMD Radeon R7 200 Series (BONAIRE, DRM 3.44.0, 5.16.10-arch1-1, LLVM 13.0.1) , Vendor: AMD , OpenGL Version: 4.6 (Compatibility Profile) Mesa 21.3.7 , Max. Texture Size 16384 ,Max GPU Memory: "1.91 GiB"

In the GUI it was for sure using OpenGL rendering, which was confirmed by checking the OpenGL settings in Preferences, running Shadertoy and monitoring GPU usage. Shadertoy works under GUI (in X11 with and without this PR) but surprisingly not in Renderer (in X11 with and without this PR).

Is NatronRenderer always failing, or only in some configurations?

As of NatronRenderer it always fails, though I don't know what you may be referring to with configurations.

Although this makes me think that we should defer this conversation under a new issue either in openfx-misc or openfx.

@devernay
Copy link
Member

devernay commented Apr 5, 2022

blocked by #779

@YakoYakoYokuYoku
Copy link
Member Author

See #779 as I've found out that it was due to a misconfiguration in the engine and not by this PR itself.

@YakoYakoYokuYoku
Copy link
Member Author

@devernay or @rodlie if you cannot test this PR but you could review this or at least approve it please let me know.

Copy link
Member

@devernay devernay left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks OK to me, I don't have time to test and I'm just wondering if the build was tested on systems that don't support wayland.
I'll approve and let you merge

App/App.pro Outdated Show resolved Hide resolved
Engine/AppManagerPrivate.cpp Show resolved Hide resolved
Engine/AppManagerPrivate.cpp Show resolved Hide resolved
Engine/Engine.pro Outdated Show resolved Hide resolved
@YakoYakoYokuYoku
Copy link
Member Author

Thanks so much for approving, I'm very grateful 🙏 🙌 👏

@YakoYakoYokuYoku YakoYakoYokuYoku deleted the wayland-offscreen branch July 17, 2022 03:38
@devernay
Copy link
Member

It seems like this broke the CI builds (undefined symbol when linking NatronRenderer) - can you please take a look at it?

@YakoYakoYokuYoku
Copy link
Member Author

YakoYakoYokuYoku commented Jul 23, 2022

Yeah, because I've forgot about including OSGLContext_Wayland.cpp in Engine/Engine.pro 🤧, but #829 includes a fix for it, though it could be committed directly if desired.

@devernay
Copy link
Member

Can you commit just that line without a PR? I'm not sure about #829

@YakoYakoYokuYoku
Copy link
Member Author

Happens that I cannot commit directly to protected branches as of now so that's why I need somebody else with that kind of permissions.

@devernay
Copy link
Member

Ok I changed your role. You should be able to do it now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants