Page MenuHomeFreeBSD

graphics/mesa-libs: enable libglvnd support

Authored by jbeich on May 27 2020, 7:44 AM.
Referenced Files
F81677443: D25020.id72297.diff
Fri, Apr 19, 7:24 PM
Unknown Object (File)
Thu, Apr 18, 1:04 PM
Unknown Object (File)
Wed, Apr 17, 7:15 AM
Unknown Object (File)
Tue, Apr 16, 9:04 AM
Unknown Object (File)
Sun, Apr 14, 8:02 AM
Unknown Object (File)
Sat, Apr 13, 6:16 PM
Unknown Object (File)
Mar 2 2024, 8:28 AM
Unknown Object (File)
Feb 24 2024, 8:42 AM



See architecture

  • mesa-dri can be used together with nvidia-driver
  • Consumers can depend on the latest GLX/EGL headers
  • Less rebuilds due to changes in dependencies
Test Plan
  • i915kms on Skylake GT2 (0x1912)
  • Firefox (on 11.3 i386) works fine with Sway+Xwayland (on 13.0 amd64)
  • nvidia-driver doesn't break Wayland via GBM
  • exp-run progress is in bug 246767

Diff Detail

R11 FreeBSD ports repository
Lint Not Applicable
Tests Not Applicable

Event Timeline

There are a very large number of changes, so older changes are hidden. Show Older Changes
zeising requested changes to this revision.May 28 2020, 2:00 PM
zeising added a subscriber: zeising.

This review requires some work to get going, and in our opinion we must get it right, since breaking this will break the whole graphics stack.

Apart from the comments inline in the review, we also need to figure out how to handle mesa. Currently, the patch adds a build dependency in mesa-libs on libglvnd, and other ports depend on libglvnd through Uses/ However, libglvnd will need mesa (or another OpenGL provider) to be installed. With the suggested patch this is only pulled in by accident by the dependency on in a few ports. This means that simple installs might not have all the packages needed to work. This needs to be fixed, most likely by an explicit runtime dependency on mesa in libglvnd, or through Uses/ This will mean that users of nVidia drivers will have two OpenGL implementations, but that is already the case today. If/when the ports tree gains a requires/provides, this can be revisited.

Over all, there are several things that need to be fixed in order for this to be accepted, and it has to be thoroughly tested as well, since it is a very large change to how the graphics stack is working.


Since libglvnd will be an integral part to the graphics stack, we feel that it should be maintained by x11@. This ensures that updates and releases can be coordinated to try to avoid breakage. This also ensures that any issues and PRs will be easily noticed since they are also sent to the mailing list.


What is the reason behind using a git commit hash instead of a release tarball for libglvnd?


Can you explain what is happening with the various libraries in mesa? I can see that libEGL is renamed to libEGL_mesa, but for instance libGLESv2 and libGL seems to be removed completely from the port. Are they simply replaced by libGLX_mesa, and libglvnd understands this, or is this an oversight?

This revision now requires changes to proceed.May 28 2020, 2:00 PM

libglvnd will need mesa (or another OpenGL provider) to be installed.

No difference from mesa-libs. xorg-server and wlroots still depend on mesa-dri and mesa-dri depends on mesa-libs (via libglapi).

Why one would want mesa-libs but not mesa-dri?

This will mean that users of nVidia drivers will have two OpenGL implementations

Assuming NVIDIA users don't want mesa-dri is a mistake. Barring bugs in kernel drivers it should be possible to use Intel/AMD and NVIDIA at the same time e.g., with multiple displays or one display connected to multiple GPUs.

Over all, there are several things that need to be fixed in order for this to be accepted,

What are these? I agree with maintainership, the rest is misunderstanding.


Sure., do you object?


GL_COMMIT is currently mandatory for USE_GITLAB ports.
See also


I don't care who maintains ports, happy when it's not me :)


libGLESv2 libGL etc. are provided by glvnd. They *are* glvnd when it's used. glvnd finds them via share/glvnd/egl_vendor.d/50_mesa.json


(finds the _mesa ones)

jbeich marked an inline comment as done.
jbeich edited the summary of this revision. (Show Details)
  • graphics/libglvnd: change maintainer to x11@
  • x11-servers/xwayland-devel: document a quirk: still better than before when one had to override libmap.conf
  • Reword comment as only X11 server and libglvnd itself use GLX_EXT_libglvnd
jbeich added inline comments.

GLX and EGL dispatch are a bit different. I've linked libglvnd architecture in the summary. libGLX_indirect is documented as code comment instead.

libGL is a wrapper library to libGLdispatch and libGLX which is provided for backwards-compatibility with applications which link against the old ABI.

jbeich edited the summary of this revision. (Show Details)
  • x11-servers/xwayland-devel: drop pkg-message in favor of rP536952

After discussing this on the Graphics Team meeting today we all agreed that since this is a big update, and we are getting close to both the 11.4 release and the new quarterly ports branch, this has to wait until after the ports tree branch.
This does not mean this is an approval to commit this after the branch, but gives you a timeline of when at the earliest it can go in.

since this is a big update

Based on the amount of QA required, big would be Xorg update, medium would be Mesa update and small are libglvnd, libX11, libwayland, etc. libglvnd offloads updates risk due to API changes away from Mesa. For example, Mesa has Intel/AMD, X11/Wayland/Vulkan and drm-kmod (legacy, 4.1[16], 5.*) but in Xorg has CSM/UEFI, UMS/KMS, non-x86, many DDX, nvidia-driver versions, legacy/devd/libinput, slave/consumer ports.

In short, as you go up the graphics stack the implicit QA via consumers diminishes.

getting close to both the 11.4 release

11.4 packages use rP536699 instead of /quarterly but updates use /quarterly which is a moving target (i.e., can be fixed/reverted).

and the new quarterly ports branch

Makes sense given only 1 month is left while exp-run hasn't even started (antoine@ doesn't scale).

This does not mean this is an approval to commit this after the branch, but gives you a timeline of when at the earliest it can go in.

Review/test in advance then (EDIT: during the waiting period). I can't respect maintainer which doesn't respect me.
/quarterly only spans 3 months, so dragging the first one or two would repeat the situation.

  • Add DEFAULT_VERSIONS support
  • Rebase after rP538571
  • Restore PORTREVISION bump in graphics/mesa-libs

@zeising Is this review approved for an exp-run or not?

Reupload via arc diff to restore context and commit message.

So, is there any chance of this being done before one year anniversary of the patch? Libglvnd is a prerequisite for (real) Optimus support, among other things.

I'm burnt out rebasing: no time to fix after 2ee6acf85a98.

kbowling added a subscriber: kbowling.

Yeah I agree with @jbeich this is a straight forward patch in the grand scheme of this software stack, so I'll merge it with maintainer timeout to fortify the secondary driver work mentioned above.

@jbeich this should have gone in first, I was just doing the needful because portmgr had blessed the secondary driver work and it was still sitting unhandled. I am in progress on my own QA on the combination of this on top of that at the moment.

This revision was not accepted when it landed; it landed in state Needs Review.Jun 17 2021, 4:26 AM
This revision was automatically updated to reflect the committed changes.