Add "sun4i-drm_dri.so" to libg1-mesa-dri and fix compilation on riscv64

Bug #1995137 reported by Isaac True
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
mesa (Ubuntu)
Fix Released
Undecided
Unassigned
Jammy
Fix Released
Undecided
Unassigned
Kinetic
Fix Released
Undecided
Unassigned

Bug Description

[Impact]

lima driver is missing from riscv64, but in order to enable it we need to disable anything that uses JIT on riscv64: swrast for vulkan, and draw-use-llvm for gallium.

JIT for riscv64 is buggy and should be fixed in a future llvm release.

[Test case]

Check that sun4i-drm_dri.so is in libgl1-mesa-dri deb for riscv64, and that it works.

[Where things could go wrong]

This is a new driver for the architecture, so there's little chance of breakage.

--

"sun4i-drm_dri.so" is needed for some RISC-V platforms such as the Allwinner D1. This file is missing from the riscv64 packages, but present on others. This affects (at least) 20.04 and 22.04.

itrue@lxc-focal ~/tmp> dpkg -c libgl1-mesa-dri_21.2.6-0ubuntu0.1~20.04.2_arm64.deb | grep _dri.so
*snip*
hrw-r--r-- root/root 0 2022-03-08 16:37 ./usr/lib/aarch64-linux-gnu/dri/sun4i-drm_dri.so link to ./usr/lib/aarch64-linux-gnu/dri/armada-drm_dri.so
*snip*

itrue@lxc-focal ~/tmp> dpkg -c libgl1-mesa-dri_21.2.6-0ubuntu0.1~20.04.2_riscv64.deb | grep _dri.so
-rw-r--r-- root/root 16498024 2022-03-08 16:37 ./usr/lib/riscv64-linux-gnu/dri/kms_swrast_dri.so
hrw-r--r-- root/root 0 2022-03-08 16:37 ./usr/lib/riscv64-linux-gnu/dri/nouveau_dri.so link to ./usr/lib/riscv64-linux-gnu/dri/kms_swrast_dri.so
-rw-r--r-- root/root 4692400 2022-03-08 16:37 ./usr/lib/riscv64-linux-gnu/dri/nouveau_vieux_dri.so
hrw-r--r-- root/root 0 2022-03-08 16:37 ./usr/lib/riscv64-linux-gnu/dri/r200_dri.so link to ./usr/lib/riscv64-linux-gnu/dri/nouveau_vieux_dri.so
hrw-r--r-- root/root 0 2022-03-08 16:37 ./usr/lib/riscv64-linux-gnu/dri/r300_dri.so link to ./usr/lib/riscv64-linux-gnu/dri/kms_swrast_dri.so
hrw-r--r-- root/root 0 2022-03-08 16:37 ./usr/lib/riscv64-linux-gnu/dri/r600_dri.so link to ./usr/lib/riscv64-linux-gnu/dri/kms_swrast_dri.so
hrw-r--r-- root/root 0 2022-03-08 16:37 ./usr/lib/riscv64-linux-gnu/dri/radeon_dri.so link to ./usr/lib/riscv64-linux-gnu/dri/nouveau_vieux_dri.so
hrw-r--r-- root/root 0 2022-03-08 16:37 ./usr/lib/riscv64-linux-gnu/dri/radeonsi_dri.so link to ./usr/lib/riscv64-linux-gnu/dri/kms_swrast_dri.so
hrw-r--r-- root/root 0 2022-03-08 16:37 ./usr/lib/riscv64-linux-gnu/dri/swrast_dri.so link to ./usr/lib/riscv64-linux-gnu/dri/kms_swrast_dri.so
hrw-r--r-- root/root 0 2022-03-08 16:37 ./usr/lib/riscv64-linux-gnu/dri/virtio_gpu_dri.so link to ./usr/lib/riscv64-linux-gnu/dri/kms_swrast_dri.so
hrw-r--r-- root/root 0 2022-03-08 16:37 ./usr/lib/riscv64-linux-gnu/dri/zink_dri.so link to ./usr/lib/riscv64-linux-gnu/dri/kms_swrast_dri.so

Isaac True (itrue)
description: updated
Revision history for this message
Isaac True (itrue) wrote :

The attached debdiff enables building the lima driver on riscv64. This drivers provides sun4i-drm_dri.so.

I'm currently testing this locally and waiting on riscv64 to be enabled for my PPA to build a package on LP.

Revision history for this message
Ubuntu Foundations Team Bug Bot (crichton) wrote :

The attachment "mesa-build-lima-on-riscv64.debdiff" seems to be a debdiff. The ubuntu-sponsors team has been subscribed to the bug report so that they can review and hopefully sponsor the debdiff. If the attachment isn't a patch, please remove the "patch" flag from the attachment, remove the "patch" tag, and if you are member of the ~ubuntu-sponsors, unsubscribe the team.

[This is an automated message performed by a Launchpad user owned by ~brian-murray, for any issue please contact him.]

tags: added: patch
Revision history for this message
Isaac True (itrue) wrote (last edit ):

Using this library results in the following error:

'generic' is not a recognized processor for this target (ignoring processor)
'generic' is not a recognized processor for this target (ignoring processor)
WARNING: This target JIT is not designed for the host you are running. If bad things happen, please choose a different -march switch.
'generic' is not a recognized processor for this target (ignoring processor)
'generic' is not a recognized processor for this target (ignoring processor)
'generic' is not a recognized processor for this target (ignoring processor)
'generic' is not a recognized processor for this target (ignoring processor)
'generic' is not a recognized processor for this target (ignoring processor)
'generic' is not a recognized processor for this target (ignoring processor)
'generic' is not a recognized processor for this target (ignoring processor)
'generic' is not a recognized processor for this target (ignoring processor)
LLVM ERROR: Cannot select: 0x3fa81e7fa8: ch = store<(store 4 into %ir.mask_ptr1 + 12, basealign 16), trunc to i32> 0x3fa81eadd0, 0x3fa81eea00, 0x3fa81b3358, undef:i64
  0x3fa81eea00: i64 = sub Constant:i64<0>, 0x3fa81e7c68
    0x3fa81b59a8: i64 = Constant<0>
    0x3fa81e7c68: i64 = and 0x3fa81e7ed8, Constant:i64<1>
      0x3fa81e7ed8: i64 = srl 0x3fa81e9430, Constant:i64<7>
        0x3fa81e9430: i64,ch = load<(load 2 from %fixed-stack.5, align 8), zext from i16> 0x3fa80c34b8, FrameIndex:i64<-2>, undef:i64
          0x3fa81b2e78: i64 = FrameIndex<-2>
          0x3fa81b2da8: i64 = undef
        0x3fa81e7e70: i64 = Constant<7>
      0x3fa81b5a78: i64 = Constant<1>
  0x3fa81b3358: i64 = add FrameIndex:i64<6>, Constant:i64<28>
    0x3fa81b34f8: i64 = FrameIndex<6>
    0x3fa8217440: i64 = Constant<28>
  0x3fa81b2da8: i64 = undef
In function: fs_variant_partial
!!! Fatal signal received. Attempting cleanup, but deadlock may occur
pure virtual method called
terminate called without an active exception
!!! Fatal signal received. Attempting cleanup, but deadlock may occur
Mir fatal error: Unsupported attempt to continue after a fatal signal: SIGABRT

Matches this bug from Debian: https://<email address hidden>/msg139710.html

Revision history for this message
Isaac True (itrue) wrote :

The attached patch disables usage of LLVM JIT on riscv64, which was causing the error I reported in comment #3.

I obtained this patch from the following Debian bug report: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1004039

This patch, combined with the previous one, seems to work well on the Sipeed Lichee RV board. I have tested this with ubuntu-frame and a custom-built mesa-core20 snap containing the drivers built using these patches.

Isaac True (itrue)
summary: - "sun4i-drm_dri.so" is missing from libg1-mesa-dri on riscv64
+ Add "sun4i-drm_dri.so" and fix compilation of libg1-mesa-dri on riscv64
summary: - Add "sun4i-drm_dri.so" and fix compilation of libg1-mesa-dri on riscv64
+ Add "sun4i-drm_dri.so" to libg1-mesa-dri and fix compilation on riscv64
Revision history for this message
Isaac True (itrue) wrote :

Prebuilt packages for riscv64 are available in this PPA: https://launchpad.net/~itrue/+archive/ubuntu/mesa-riscv64

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package mesa - 22.2.4-1ubuntu1

---------------
mesa (22.2.4-1ubuntu1) lunar; urgency=medium

  * Merge from Debian.

 -- Timo Aaltonen <email address hidden> Tue, 29 Nov 2022 10:59:31 +0200

Changed in mesa (Ubuntu):
status: New → Fix Released
Timo Aaltonen (tjaalton)
description: updated
Timo Aaltonen (tjaalton)
description: updated
Revision history for this message
Łukasz Zemczak (sil2100) wrote : Please test proposed package

Hello Isaac, or anyone else affected,

Accepted mesa into kinetic-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/mesa/22.2.5-0ubuntu0.1 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation on how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested, what testing has been performed on the package and change the tag from verification-needed-kinetic to verification-done-kinetic. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed-kinetic. In either case, without details of your testing we will not be able to proceed.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance for helping!

N.B. The updated package will be released to -updates after the bug(s) fixed by this package have been verified and the package has been in -proposed for a minimum of 7 days.

Changed in mesa (Ubuntu Kinetic):
status: New → Fix Committed
tags: added: verification-needed verification-needed-kinetic
Revision history for this message
Ubuntu SRU Bot (ubuntu-sru-bot) wrote : Autopkgtest regression report (mesa/22.2.5-0ubuntu0.1)

All autopkgtests for the newly accepted mesa (22.2.5-0ubuntu0.1) for kinetic have finished running.
The following regressions have been reported in tests triggered by the package:

mutter/43.0-1ubuntu4 (amd64)

Please visit the excuses page listed below and investigate the failures, proceeding afterwards as per the StableReleaseUpdates policy regarding autopkgtest regressions [1].

https://people.canonical.com/~ubuntu-archive/proposed-migration/kinetic/update_excuses.html#mesa

[1] https://wiki.ubuntu.com/StableReleaseUpdates#Autopkgtest_Regressions

Thank you!

Revision history for this message
Timo Aaltonen (tjaalton) wrote :

Isaac, care to test kinetic that everything is in place now? This is blocking the mesa update.

Revision history for this message
Timo Aaltonen (tjaalton) wrote :

hrw-r--r-- root/root 0 2022-12-11 19:06 ./usr/lib/aarch64-linux-gnu/dri/sun4i-drm_dri.so link to ./usr/lib/aarch64-linux-gnu/dri/armada-drm_dri.so

nevermind, the driver is there

tags: added: verification-done verification-done-kinetic
removed: verification-needed verification-needed-kinetic
Revision history for this message
Timo Aaltonen (tjaalton) wrote :

whoops, wrong arch:

hrw-r--r-- root/root 0 2022-12-11 19:06 ./usr/lib/riscv64-linux-gnu/dri/sun4i-drm_dri.so link to ./usr/lib/riscv64-linux-gnu/dri/armada-drm_dri.so

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package mesa - 22.2.5-0ubuntu0.1

---------------
mesa (22.2.5-0ubuntu0.1) kinetic; urgency=medium

  * New upstream release. (LP: #1999336)
  * rules: Enable building lima drivers on riscv64 and disable vulkan
    swrast and draw-use-llvm. (LP: #1995137)
  * patches: Refreshed.

 -- Timo Aaltonen <email address hidden> Sun, 11 Dec 2022 21:06:42 +0200

Changed in mesa (Ubuntu Kinetic):
status: Fix Committed → Fix Released
Revision history for this message
Łukasz Zemczak (sil2100) wrote : Update Released

The verification of the Stable Release Update for mesa has completed successfully and the package is now being released to -updates. Subsequently, the Ubuntu Stable Release Updates Team is being unsubscribed and will not receive messages about this bug report. In the event that you encounter a regression using the package from -updates please report a new bug using ubuntu-bug and tag the bug report regression-update so we can easily find any regressions.

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package mesa - 22.2.5-0ubuntu0.1~22.04.1

---------------
mesa (22.2.5-0ubuntu0.1~22.04.1) jammy; urgency=medium

  * Backport to jammy. (LP: #1991761)

 -- Timo Aaltonen <email address hidden> Thu, 15 Dec 2022 16:35:13 +0200

Changed in mesa (Ubuntu Jammy):
status: New → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.