Enable v3d for Raspberry Pi graphic in AlmaLinux (Resolves: https://github.com/AlmaLinux/raspberry-pi/issues/32)

This commit is contained in:
Koichiro Iwao 2025-03-24 19:28:12 +00:00 committed by root
commit 0091c6ab2c
3 changed files with 80 additions and 5 deletions

View File

@ -0,0 +1,37 @@
From f7434d7576032cf97e3c74ef09912f59617a4bad Mon Sep 17 00:00:00 2001
From: Dave Airlie <airlied@redhat.com>
Date: Fri, 14 Jun 2024 12:22:58 +1000
Subject: [PATCH] nouveau/nvc0: increase overallocation on shader bo to 2K
I've been seeing a bunch of read page faults at the end of the
shader allocation, nvk uses a full page at the end to overallocate
so align with that and see if it goes away.
ahulliet and skeggsb both said 2k was used.
Cc: mesa-stable
Reviewed-by: Arthur Huillet <ahuillet@nvidia.com>
Reviewed-by: Karol Herbst <kherbst@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/29722>
---
src/gallium/drivers/nouveau/nvc0/nvc0_screen.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff -up mesa-23.1.4/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c.dma mesa-23.1.4/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c
--- mesa-23.1.4/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c.dma 2023-07-21 22:42:42.000000000 +1000
+++ mesa-23.1.4/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c 2024-08-16 12:49:13.532998512 +1000
@@ -886,10 +886,11 @@ nvc0_screen_resize_text_area(struct nvc0
nouveau_heap_free(&screen->lib_code);
nouveau_heap_destroy(&screen->text_heap);
- /* XXX: getting a page fault at the end of the code buffer every few
- * launches, don't use the last 256 bytes to work around them - prefetch ?
+ /*
+ * Shader storage needs a 2K (from NVIDIA) overallocations at the end
+ * to avoid prefetch bugs.
*/
- nouveau_heap_init(&screen->text_heap, 0, size - 0x100);
+ nouveau_heap_init(&screen->text_heap, 0, size - 0x800);
/* update the code segment setup */
if (screen->eng3d->oclass < GV100_3D_CLASS) {

View File

@ -0,0 +1,30 @@
diff -up mesa-23.1.4/src/gallium/drivers/nouveau/nvc0/nvc0_state_validate.c.da mesa-23.1.4/src/gallium/drivers/nouveau/nvc0/nvc0_state_validate.c
--- mesa-23.1.4/src/gallium/drivers/nouveau/nvc0/nvc0_state_validate.c.da 2025-01-10 13:14:31.119630821 +1000
+++ mesa-23.1.4/src/gallium/drivers/nouveau/nvc0/nvc0_state_validate.c 2025-01-10 13:15:11.917433170 +1000
@@ -149,6 +149,7 @@ nvc0_validate_fb(struct nvc0_context *nv
unsigned ms_mode = NVC0_3D_MULTISAMPLE_MODE_MS1;
unsigned nr_cbufs = fb->nr_cbufs;
bool serialize = false;
+ bool cbuf_is_linear = false;
nouveau_bufctx_reset(nvc0->bufctx_3d, NVC0_BIND_3D_FB);
@@ -203,8 +204,7 @@ nvc0_validate_fb(struct nvc0_context *nv
PUSH_DATA(push, 0);
nvc0_resource_fence(nvc0, res, NOUVEAU_BO_WR);
-
- assert(!fb->zsbuf);
+ cbuf_is_linear = true;
}
if (res->status & NOUVEAU_BUFFER_STATUS_GPU_READING)
@@ -216,7 +216,7 @@ nvc0_validate_fb(struct nvc0_context *nv
BCTX_REFN(nvc0->bufctx_3d, 3D_FB, res, WR);
}
- if (fb->zsbuf) {
+ if (fb->zsbuf && !cbuf_is_linear) {
struct nv50_miptree *mt = nv50_miptree(fb->zsbuf->texture);
struct nv50_surface *sf = nv50_surface(fb->zsbuf);
int unk = mt->base.base.target == PIPE_TEXTURE_2D;

View File

@ -43,7 +43,7 @@
Name: mesa
Summary: Mesa graphics libraries
Version: 23.1.4
Release: 3%{?rctag:.%{rctag}}%{?dist}.alma.1
Release: 4%{?rctag:.%{rctag}}%{?dist}.alma.1
License: MIT
URL: http://www.mesa3d.org
@ -74,6 +74,10 @@ Patch14: 0001-clover-llvm-move-to-modern-pass-manager.patch
# https://issues.redhat.com/browse/RHEL-40566
Patch15: 0001-mesa-fix-off-by-one-for-newblock-allocation-in-dlist.patch
# two nouveau fixes to avoid kernel crashes with multiple cards
Patch20: 0001-nouveau-nvc0-increase-overallocation-on-shader-bo-to.patch
Patch21: nouveau-work-around-linear-zs-issue.patch
BuildRequires: gcc
BuildRequires: gcc-c++
@ -97,7 +101,7 @@ BuildRequires: elfutils
BuildRequires: python3-devel
BuildRequires: gettext
BuildRequires: glslang
BuildRequires: %{llvm_pkg_prefix}llvm-devel >= 3.4-7
BuildRequires: %{llvm_pkg_prefix}llvm-compat-devel >= 3.4-7
%if 0%{?with_opencl}
BuildRequires: %{llvm_pkg_prefix}clang-devel >= 3.0
%endif
@ -351,6 +355,7 @@ cd -
export ASFLAGS="--generate-missing-build-notes=yes"
%global __meson %{buildroot}/usr/bin/meson
export PYTHONPATH=/usr/lib/python3.6/site-packages/:%{buildroot}/usr/lib/python3.6/site-packages/
export PATH=%{_libdir}/llvm17/bin:$PATH
%meson -Dcpp_std=gnu++17 \
-Db_ndebug=true \
-Dplatforms=x11,wayland \
@ -625,9 +630,12 @@ done
%endif
%changelog
* Wed Aug 14 2024 Koichiro Iwao <meta@almalinux.org> - 23.1.4-3.alma.1
- Enable v3d for Raspberry Pi graphic in AlmaLinux
Resolves: https://github.com/AlmaLinux/raspberry-pi/issues/32
* Mon Mar 24 2025 Koichiro Iwao <meta@almalinux.org> - 23.1.4-4.alma.1
- Enable v3d for Raspberry Pi graphic in AlmaLinux (Resolves:
https://github.com/AlmaLinux/raspberry-pi/issues/32)
* Mon Mar 17 2025 Dave Airlie <airlied@redhat.com> - 23.1.4-4
- Fix two nouveau bugs for customer (RHEL-54452)
* Thu Jun 20 2024 José Expósito <jexposit@redhat.com> - 23.1.4-3
- Fix off-by-one error for newblock allocation in dlist_alloc