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

platforms/renderer-generic-egl: Support CPUAddressableDisplayProvider #3095

Merged
merged 11 commits into from
Oct 27, 2023

Conversation

RAOF
Copy link
Contributor

@RAOF RAOF commented Oct 25, 2023

Fixes: #3092

@RAOF
Copy link
Contributor Author

RAOF commented Oct 25, 2023

(Don't yet know if it actually fixes that; putting up a PR so that I can get a snap to test 😉 )

@RAOF RAOF marked this pull request as draft October 25, 2023 04:38
@RAOF
Copy link
Contributor Author

RAOF commented Oct 25, 2023

Hm, no, doesn't fix it, because eglGeyDisplay(EGL_DEFAULT_DISPLAY) only tries X11 (on mesa).

Time to pull out EGL_MESA_platform_surfaceless

@mattkae
Copy link
Contributor

mattkae commented Oct 25, 2023

Hm, no, doesn't fix it, because eglGeyDisplay(EGL_DEFAULT_DISPLAY) only tries X11 (on mesa).

Time to pull out EGL_MESA_platform_surfaceless

The following makes us not fail right away:

auto dpy = eglGetPlatformDisplay(EGL_PLATFORM_SURFACELESS_MESA, EGL_DEFAULT_DISPLAY, NULL);

But you'll start getting some funny errors like:
image

Maybe you know something I don't know there :) This post had some good info

Update
If you change the egl config dance to the following in both rendering_platform.cpp and buffer_allocator.cpp, it works:

if (eglChooseConfig(dpy, config_attr, &cfg, 1, &num_configs) != EGL_TRUE)
{
    BOOST_THROW_EXCEPTION((mg::egl_error("Failed to find any matching EGL config")));
}

auto ctx = eglCreateContext(dpy, EGL_NO_CONFIG_KHR, share_context.value_or(EGL_NO_CONTEXT), context_attr);
if (ctx == EGL_NO_CONTEXT)
{
    BOOST_THROW_EXCEPTION(mg::egl_error("Failed to create EGL context"));
}

@RAOF Kwin checks if the num_configs is zero and if it is, it uses EGL_NO_CONFIG_KHR and instead of cfg. That looks to be the answer? I will push a commit, but feel free to revert if it looks wrong 😉

@mattkae mattkae force-pushed the allow-llvmpipe-rendering branch from b126c08 to 679cca8 Compare October 25, 2023 21:58
@codecov
Copy link

codecov bot commented Oct 25, 2023

Codecov Report

Merging #3095 (898dab5) into main (4a57bc6) will decrease coverage by 0.12%.
Report is 36 commits behind head on main.
The diff coverage is 36.20%.

@@            Coverage Diff             @@
##             main    #3095      +/-   ##
==========================================
- Coverage   78.43%   78.31%   -0.12%     
==========================================
  Files        1073     1074       +1     
  Lines       74717    74779      +62     
==========================================
- Hits        58602    58564      -38     
- Misses      16115    16215     +100     
Files Coverage Δ
include/platform/mir/graphics/egl_extensions.h 90.90% <ø> (ø)
src/platforms/virtual/platform.cpp 61.70% <ø> (+4.98%) ⬆️
...sts/unit-tests/platforms/virtual/test_platform.cpp 100.00% <ø> (ø)
...latforms/renderer-generic-egl/buffer_allocator.cpp 61.49% <50.00%> (-0.15%) ⬇️
src/platform/graphics/egl_extensions.cpp 45.08% <63.63%> (+1.83%) ⬆️
...tforms/renderer-generic-egl/rendering_platform.cpp 71.11% <44.44%> (-9.18%) ⬇️
...latforms/renderer-generic-egl/platform_symbols.cpp 54.05% <0.00%> (-41.19%) ⬇️

... and 29 files with indirect coverage changes

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

RAOF added 3 commits October 26, 2023 18:04
…ported” function.

Because we have this code *everywhere*.
… them

Also, use the `EGL_EXT_platform_base` extension rather than implicitly relying
upon EGL 1.5 entry points. There's at least one EGL driver we want to support that
doesn't support EGL 1.5.
@RAOF RAOF marked this pull request as ready for review October 26, 2023 07:15
@RAOF
Copy link
Contributor Author

RAOF commented Oct 26, 2023

There we go, that should be good to go. I just:

  • Fixed up the eglGetPlatformDisplay usage - we need to go through the extension, not through the EGL 1.5 entrypoint (because at least one driver we want to support does not provide EGL 1.5 entrypoints)
  • Added a bunch of extension checks, to validate that what we're doing is right.

Dunno why this links locally fine, but we do indeed need to resolve those!
Copy link
Collaborator

@AlanGriffiths AlanGriffiths left a comment

Choose a reason for hiding this comment

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

Looks like a good approach, but there are a few bits to tidy up

include/platform/mir/graphics/egl_extensions.h Outdated Show resolved Hide resolved
src/platform/graphics/egl_extensions.cpp Outdated Show resolved Hide resolved
src/platform/graphics/egl_extensions.cpp Outdated Show resolved Hide resolved
@Saviq
Copy link
Collaborator

Saviq commented Oct 26, 2023

So this isn't yet stable:

$ MIR_SERVER_PLATFORM_DISPLAY_LIBS=mir:virtual MIR_SERVER_PLATFORM_RENDERING_LIBS=mir:egl-generic MIR_SERVER_VIRTUAL_OUTPUT=1280x1024 ./bin/mir_performance_tests

I'm getting this on the CompositorPerformance test:

[ RUN      ] CompositorPerformance.regression_test_1563287
Saving server logs to: /tmp/CompositorPerformance_regression_test_1563287_server.log
/home/michal/dev/MirServer/mir/tests/performance-tests/test_compositor.cpp:102: Failure
Expected: (compositor_fps) >= (0), actual: -1 vs 0
/home/michal/dev/MirServer/mir/tests/performance-tests/test_compositor.cpp:103: Failure
Expected: (compositor_render_time) > (0), actual: -1 vs 0
[  FAILED  ] CompositorPerformance.regression_test_1563287 (14611 ms)

And this, once…

[ RUN      ] HostedGLMark2Wayland.windowed                                                                                         
Saving host output to: /tmp/HostedGLMark2Wayland_windowed_host.log
Saving server logs to: /tmp/HostedGLMark2Wayland_windowed_server.log
Mir fatal error: Critical error in Wayland platform: /home/michal/dev/MirServer/mir/src/platforms/wayland/display.cpp(250): Throw in function void mir::graphics::wayland::Display::run()
Dynamic exception type: boost::wrapexcept<std::system_error>
std::exception::what: Failed to read Wayland events: Broken pipe

Neither are a blocker, FWIW.

@AlanGriffiths
Copy link
Collaborator

Expected: (compositor_render_time) > (0), actual: -1 vs 0

This is because we don't get any output from -compositor-report=log: #3101

Copy link
Collaborator

@Saviq Saviq left a comment

Choose a reason for hiding this comment

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

Neither are a blocker, FWIW.

I've confirmed both on main, so good with me!

@AlanGriffiths
Copy link
Collaborator

Expected: (compositor_render_time) > (0), actual: -1 vs 0

This is because we don't get any output from -compositor-report=log: #3101

But now I do:

$ grep compositor: /tmp/CompositorPerformance_regression_test_1563287_server.log
[2023-10-26 14:00:36.827435] <information> compositor: Started
[2023-10-26 14:00:48.289107] <information> compositor: Stopped

Was I mad then? Or am I mad now?

@sergio-costas

This comment was marked as off-topic.

@sergio-costas

This comment was marked as off-topic.

…r-from-virtual-platform

[mir:virtual] drop GenericEGLDisplayProvider
@Saviq Saviq disabled auto-merge October 26, 2023 18:32
@Saviq Saviq enabled auto-merge October 26, 2023 18:33
@Saviq Saviq disabled auto-merge October 27, 2023 05:34
@Saviq Saviq merged commit a558e9c into main Oct 27, 2023
20 of 22 checks passed
@Saviq Saviq deleted the allow-llvmpipe-rendering branch October 27, 2023 05:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Can't render on llvmpipe
5 participants