Skip to content

Conversation

@robert-ancell
Copy link
Contributor

Previously we were using GdkGLContext from GtkGLArea. This would not work if we wanted to start a Flutter engine without a view, as we can't created a GdkGLContext without a GdkWindow.

Flutter now renders into its own context(s), and then we access these in the GtkGLArea using EGLImage. It is expected that EGLImage is widely available in all drivers.

We also now composite and copy the framebuffer received from Flutter, as GTK will not present it until it is ready. This adds an additional copy, but should have probably always been done in case Flutter wrote to this framebuffer before GTK had used it.

@github-actions github-actions bot added engine flutter/engine related. See also e: labels. platform-linux Building on or for Linux specifically a: desktop Running on desktop labels Jun 5, 2025
@robert-ancell robert-ancell marked this pull request as draft June 5, 2025 04:16
Previously we were using GdkGLContext from GtkGLArea. This would not work if we
wanted to start a Flutter engine without a view, as we can't created a
GdkGLContext without a GdkWindow.

Flutter now renders into its own context(s), and then we access these in the
GtkGLArea using EGLImage. It is expected that EGLImage is widely available in
all drivers.

We also now composite and copy the framebuffer received from Flutter, as GTK
will not present it until it is ready. This adds an additional copy, but
should have probably always been done in case Flutter wrote to this
framebuffer before GTK had used it.
@robert-ancell robert-ancell force-pushed the linux-egl-no-window branch from d9585d2 to 656eb56 Compare June 5, 2025 04:17
@robert-ancell
Copy link
Contributor Author

This is crashing in the driver when running under X11 currently... It otherwise is working on Wayland.

@robert-ancell
Copy link
Contributor Author

The crash on X11 is due to it using GLX instead of EGL, so EGLImage is not available. Trying to work out alternative ways to get this to work on X11 or if we limit X11 to single window.

@RossComputerGuy
Copy link
Contributor

Trying to work out alternative ways to get this to work on X11 or if we limit X11 to single window.

Would glXCreateGLXPixmap do the job?

@robert-ancell
Copy link
Contributor Author

Trying to work out alternative ways to get this to work on X11 or if we limit X11 to single window.

Would glXCreateGLXPixmap do the job?

I don't think so, as the pixmap would be in the GLX context and not accessible from the EGL context.

@RossComputerGuy
Copy link
Contributor

Ok then you'll want to create a new context and look at EGL_KHR_platform_x11

github-merge-queue bot pushed a commit that referenced this pull request Jul 9, 2025
…added (#171409)

Software rendering was added in
a79827a.
It accidentally removed the different GL initialization for secondary
views (which need to copy the contents from the primary view). This is
not a heavily used feature yet, as multi-window support is still in
progress. This secondary codepath is in the process of being removed by
#170045
mboetger pushed a commit to mboetger/flutter that referenced this pull request Jul 9, 2025
…added (flutter#171409)

Software rendering was added in
a79827a.
It accidentally removed the different GL initialization for secondary
views (which need to copy the contents from the primary view). This is
not a heavily used feature yet, as multi-window support is still in
progress. This secondary codepath is in the process of being removed by
flutter#170045
@robert-ancell
Copy link
Contributor Author

#172090 contains the use of EGLImage, which is part of what this PR was doing. I'll refactor this PR to build on that when it lands.

@robert-ancell
Copy link
Contributor Author

Replaced by #172330

mboetger pushed a commit to mboetger/flutter that referenced this pull request Jul 21, 2025
…added (flutter#171409)

Software rendering was added in
a79827a.
It accidentally removed the different GL initialization for secondary
views (which need to copy the contents from the primary view). This is
not a heavily used feature yet, as multi-window support is still in
progress. This secondary codepath is in the process of being removed by
flutter#170045
@robert-ancell robert-ancell deleted the linux-egl-no-window branch July 22, 2025 02:53
azatech pushed a commit to azatech/flutter that referenced this pull request Jul 28, 2025
…added (flutter#171409)

Software rendering was added in
a79827a.
It accidentally removed the different GL initialization for secondary
views (which need to copy the contents from the primary view). This is
not a heavily used feature yet, as multi-window support is still in
progress. This secondary codepath is in the process of being removed by
flutter#170045
ksokolovskyi pushed a commit to ksokolovskyi/flutter that referenced this pull request Aug 19, 2025
…added (flutter#171409)

Software rendering was added in
a79827a.
It accidentally removed the different GL initialization for secondary
views (which need to copy the contents from the primary view). This is
not a heavily used feature yet, as multi-window support is still in
progress. This secondary codepath is in the process of being removed by
flutter#170045
lucaantonelli pushed a commit to lucaantonelli/flutter that referenced this pull request Nov 21, 2025
…added (flutter#171409)

Software rendering was added in
a79827a.
It accidentally removed the different GL initialization for secondary
views (which need to copy the contents from the primary view). This is
not a heavily used feature yet, as multi-window support is still in
progress. This secondary codepath is in the process of being removed by
flutter#170045
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

a: desktop Running on desktop engine flutter/engine related. See also e: labels. platform-linux Building on or for Linux specifically

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants