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

WIP: Mesa/drm/dri fixes #19641

Draft
wants to merge 10 commits into
base: oi/hipster
Choose a base branch
from
Draft

Conversation

xmhd
Copy link

@xmhd xmhd commented Nov 17, 2024

Obsoletes #19640

As per title. This pull request serves as the beginning of fixing the currently broken state of Mesa / DRM / DRI in OpenIndiana, which has been broken since 7defdf1

The problems which I have identified thus far:

  • Mesa currently tries to enable gallium swrast , which can't work as gallium swrast has a dependency on llvm (16 specifically), which we neither have nor enable in the Makefile
  • No classic (DRI) drivers explicitly enabled, left entirely to auto detect magic
  • No working gallium drivers enabled
  • I think Mesa 21.x defaults to dri2, explicitly enable dri3
  • xorg-server does not explicitly enable libdrm

With the above in context, starting from a fresh install of OpenIndiana Hipster and updating to the latest available packages, only Vesa (not related to Mesa for the uninformed) is enabled. In this state neither glxinfo nor glxgears are available.

With the changes in this pull request I haven't quite gotten things working to the state that they were previously i.e. accelerated Intel graphics on a Thinkpad X230, but glxinfo and glxgears are now working. I've spent quite a few hours on this problem over the weekend and I have been discussing it with @Toasterson throughout. I will not have any more time to work on this until next weekend at the earliest. Please contribute and we can get this working again before continuing on to further improving the graphical desktop experience with things such as libva, Vulkan and more in Mesa.

Note:

  • I haven't generated any new manifests for these changes as of yet
  • xorg-server currently does not build due to a missing header, specifically <GL/internal/dri_interface.h>. Our previous Mesa v13.x correctly installed this header, whereas our new Mesa v21.3.9 installs this header to <mesa/internal/dri_interface.h>. I didn't bother to patch this just yet - I symlinked it on my test system.

Add an array DRI_DRIVERS to the Makefile:

- This array can be expanded in future with examples as listed
- Take caution with the example list: some e.g. i965 are removed beginning in Mesa v22.x
- Gallium drivers are the most supported in the newest versions of Mesa
Add an array GALLIUM_DRIVERS to the Makefile:

- This array can be expanded in future with examples as listed
- Take caution when adding support for e.g. swrast as it will split into softpipe and llvmpipe in future
- swrast is currently disabled due to it's dependency on llvm v16
- r600 temporarily disabled
Add an array VULKAN_DRIVERS to the Makefile:

- This array can be expanded in future with examples as listed
- Take caution when adding support for e.g. swrast as it will split into softpipe and llvmpipe in future
- nothing is enabled as there is some pre-requisite work to be done first
This becomes unconditionally enabled upstreamed [1] in Mesa 24.3, or Mesa 25.

As highlighted in the referenced merge request:
- This existed for historical reasons, now possible to build Mesa with DRI3 always enabled
- In reference to the above, e.g. classic drivers removed from Mesa 22.x onwards
- This check was often used as a substitute for having drm functionality
- Prevents users from footgunning themselves

[1] https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30952
This enable option has existed since at least Mesa 18.
The classic swrast driver was removed upstream (Dec 2020) in commit 435de835cd63
@xmhd xmhd marked this pull request as draft November 19, 2024 10:53
@iigs
Copy link
Contributor

iigs commented Nov 22, 2024

Please find package x11/library/glslang version 14.3.0 is now available.

@AndWac AndWac mentioned this pull request Nov 22, 2024
@Toasterson
Copy link
Contributor

Hi @xmhd good to see someone coming into OpenIndiana packaging. And thanks for the work!

Usually what we do while reviewing, is we try to compile this on a set of machines to coax out some hidden things that auto-magic is detecting so we can make this reproducible. I found some things during that process.

Apparently, only one type of i915 driver can be enabled at the same time. I get

meson.build:318:2: ERROR: Problem encountered: Only one i915 provider can be built

When commenting out either DRI_DRIVERS='i915' or GALLIUM_DRIVERS='i915' i get further but then get stuck on

Found CMake: /usr/bin/cmake (3.31.1)
Run-time dependency libunwind found: NO (tried pkgconfig and cmake)

meson.build:1985:4: ERROR: Problem encountered: OSMesa gallium requires gallium softpipe or llvmpipe.

It could be that we also need libunwind https://github.com/libunwind/libunwind which seems to be straight forward or that some option is requiring llvm now we have already started to provide llvm16 again on the system to support this effort here.

lastly we will need to split each component into it's own PR so that we can make sure the build system builds them in the right order. We still have to do this manually. We can keep it in this PR for now to make sharing code easier during development phase.

Loving the work so far. Let's get this over the finish line.

@xmhd
Copy link
Author

xmhd commented Nov 23, 2024

@Toasterson Thanks for initial review - I realise that I missed submitting a few changes hence why you hit issues. And yeah no worries re: splitting this into multiple PRs etc afterwards, this can just serve as the staging ground for getting this working again.

I'll pick it up this weekend and see if I can get it over the finish line.

@@ -32,6 +33,16 @@ include $(WS_MAKE_RULES)/common.mk

PATCH_LEVEL= 0

# Mesa 21.x requires 2.4.100 - 2.4.109
# Mesa 22.x requires 2.4.9 - 2.4.110
Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't this read 2.4.109 instead of 2.4.9 ?

Copy link
Author

Choose a reason for hiding this comment

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

Yes indeed, good catch. I'll fix this tonight.

@iigs
Copy link
Contributor

iigs commented Nov 25, 2024

Please find LLVM 16 in packages developer/clang-16 and runtime/clang-16 .

I looked at libunwind--it doesn't have enough Solaris/illumos support to be useful. Adding this to the mesa Makefile will ensure libunwind does not get used:
CONFIGURE_OPTIONS += -Dlibunwind=disabled

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.

4 participants