Skip to content
This repository was archived by the owner on Aug 8, 2023. It is now read-only.
This repository was archived by the owner on Aug 8, 2023. It is now read-only.

Add Linux OSMesa support to HeadlessView #4498

Closed

Activity

  1. changed the title [-]Add Linux Wayland/EGL support to HeadlessView[/-] [+]Add Linux OSMesa support to HeadlessView[/+] on Mar 28, 2016
  2. self-assigned this
    on Mar 28, 2016
  3. mikemorris commented on Mar 29, 2016

    @mikemorris
    ContributorAuthor

    Is building GLFW from source with Wayland/EGL support necessary too?

    No, this was a red herring related to the linuxapp build.

  4. mikemorris commented on Apr 7, 2016

    @mikemorris
    ContributorAuthor

    OMG I think I'm hitting https://bugs.chromium.org/p/chromium/issues/detail?id=482787, I can't get OSMesaMakeCurrent to release a context successfully...

  5. mikemorris commented on Apr 7, 2016

    @mikemorris
    ContributorAuthor

    This is fun.

    OSMesaMakeCurrent( OSMesaContext osmesa, void *buffer, GLenum type,
                       GLsizei width, GLsizei height )
    {
    
       if (!osmesa || !buffer ||
           width < 1 || height < 1 ||
           width > SWRAST_MAX_WIDTH || height > SWRAST_MAX_HEIGHT) {
          return GL_FALSE;
       }
    
  6. added
    Node.js
    on Apr 7, 2016
  7. removed their assignment
    on Oct 19, 2016
  8. self-assigned this
    on Nov 3, 2016
  9. brunoabinader commented on Nov 3, 2016

    @brunoabinader
    Contributor

    I believe I found a way to fix our anti-aliasing issues (#1555) by using OSMesa + post processing.

    Replacing GLX with EGL

    My efforts towards EGL usage (based on #5843) were unsuccessful - the EGL swrast driver works in non-VM environments, but not otherwise - it fails to find a suitable display, and EGL_DEFAULT_DISPLAY cannot be used in those cases.

    Using mesa 12.0.3 or 13.0.0 with GLX (LLVMpipe) also produces the very same render test results as previous mesa versions, and I think I understood why: The software renderer must explicitly enable post-processing effects such as MLAA. However, post-processing is only available when using Gallium drivers. Gallium support for GLX library only comes with gallium-xlib, which involves using X and thus not desirable for headless support.

    Enter OSMesa

    I took liberty of rebasing/updating @mikemorris PR in #4638. I've also re-arranged the mason scripts for mesa 13.0.0 to produce a minimal binary, enabling Gallium implementation of the OSMesa library. Being OSMesa a headless, simple layer on top of OpenGL and by using Gallium to provide post-processing effects such as MLAA, I was then able to obtain 42 passing render tests that are currently ignored (same number as in macOS).

    Post-processing can be enabled by calling e.g. OSMesaPostprocess(glContext, "pp_jimenezmlaa", 8); right after creating the context - this enables Jimenez' MLAA filter to be applied.

    In sum:

    • OSMesa is truly headless - no extra dependencies besides LLVM 3.8 (available via apt-get on Travis)
    • Enabling morphological anti-aliasing filter and floating point textures enables us to obtain the same results as in Bitrise macOS

    However, there are still a few drawbacks I must deal with:

    • debug/overdraw is failing: that is either related to [linux] Overdraw debug is broken #6799 or a faulty implementation from OSMesa. In any case, I think it is forgivable to skip this test in favor of antialias support
    • OSMesa is very rudimentary - I'm obtaining a few runtime throws via MBGL_CHECK_ERROR when running the render tests. Though results are passing, we might need to skip running this in debug mode. I'm still investigating whether we have an actual issue or if it is just OSMesa being faulty.

    Related branches:

    /cc @mikemorris @kkaefer

  10. brunoabinader commented on Nov 3, 2016

    @brunoabinader
    Contributor

    Errata:

    • We don 't really need post-processing, OSMesa is already rendering stuff correctly when compared to GLX+LLVMpipe 🎉
    • Fixed debug/overdraw
    • Fixed issue with context destruction - we just need to make sure the context to be destroyed is active
  11. jfirebaugh commented on Nov 3, 2016

    @jfirebaugh
    Contributor

    Great work, this seems really promising!

    Interesting that OSMesa+llvmpipe gives different (correct) results compared to GLX+llvmpipe. I would have expected the rendering issues we have been seeing in the test-suite to be entirely due to the software renderer, rather than the interface. Any theories as to why that's not the case?

    Is there a performance delta between test-suite on GLX+llvmpipe and on OSMesa+llvmpipe?

  12. brunoabinader commented on Nov 3, 2016

    @brunoabinader
    Contributor

    Interesting that OSMesa+llvmpipe gives different (correct) results compared to GLX+llvmpipe. I would have expected the rendering issues we have been seeing in the test-suite to be entirely due to the software renderer, rather than the interface. Any theories as to why that's not the case?

    I agree - though I couldn't properly find a reason why GLX produces rendering artifacts, besides the fact its rendering pipeline is more complex due to X indirections than OSMesa.

    Is there a performance delta between test-suite on GLX+llvmpipe and on OSMesa+llvmpipe?

    Both implementations eventually uses LLVMpipe, so it seems unlikely e.g. duration for node4-clang35-debug is ~8min for both.

  13. brunoabinader commented on Nov 4, 2016

    @brunoabinader
    Contributor

    Fixed in #6899.

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

Metadata

Metadata

Assignees

Labels

Node.js

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions