Problems installing the panfrost driver on FreeBSD 14.3-STABLE on my RockPro RK3399

From: Mario Marietto <marietto2008_at_gmail.com>
Date: Wed, 28 May 2025 22:37:29 UTC
Hello.

I would like to install the PanFrost driver on FreeBSD 14.3-STABLE that I
have installed on my RockPro RK3399. This is the document that I'm reading :

https://freebsdfoundation.org/wp-content/uploads/2021/08/The-Panfrost-Driver.pdf

First of all,I see that I can / should follow two procedures. I don't know
if I should install the code from both :

1)  What follows is an example for how to build the Panfrost userspace
driver under FreeBSD:

# git clone https://gitlab.freedesktop.org/mesa/mesa
# mkdir build && cd build
# meson .. . -Degl=enabled -Dgles1=enabled -Dgles2=enabled -Ddri-drivers=
-Dvulkan-drivers=-Dgallium-drivers=panfrost,kmsro
ninja

2) drm-subtree & DRMKPI

# git clone https://github.com/evadot/drm-subtree.git
Cloning into 'drm-subtree'...
remote: Enumerating objects: 2189, done.
remote: Counting objects: 100% (286/286), done.
remote: Compressing objects: 100% (57/57), done.
remote: Total 2189 (delta 252), reused 235 (delta 229), pack-reused
1903 (from 1)
Receiving objects: 100% (2189/2189), 1.49 MiB | 3.32 MiB/s, done.
Resolving deltas: 100% (1440/1440), done.
Updating files: 100% (445/445), done.

# cd drm-subtree/
# git checkout -b drm-base-subtree
Switched to a new branch 'drm-base-subtree'

# git remote add drm-subtree https://github.com/evadot/drm-subtree.git

# git subtree add --prefix sys/dev/drm/ drm-subtree master
git fetch drm-subtree master
From https://github.com/evadot/drm-subtree
 * branch            master     -> FETCH_HEAD
 * [new branch]      master     -> drm-subtree/master
Added dir 'sys/dev/drm'

# git am sys/dev/drm/extra_patches/*.patch
Applying: Hook DRM to the build
error: sys/conf/kern.pre.mk: does not exist in index
error: sys/conf/options: does not exist in index
Patch failed at 0001 Hook DRM to the build
hint: Use 'git am --show-current-patch=diff' to see the failed patch
hint: When you have resolved this problem, run "git am --continue".
hint: If you prefer to skip this patch, run "git am --skip" instead.
hint: To restore the original branch and stop patching, run "git am --abort".
hint: Disable this message with "git config set advice.mergeConflict false"


As you can see,it does not work probably because current was 14.x back then
and diffs do not apply

$ git clone https://github.com/freebsd/freebsd-src.git
Cloning into 'freebsd-src'...
remote: Enumerating objects: 5197123, done.
remote: Counting objects: 100% (1819/1819), done.
remote: Compressing objects: 100% (807/807), done.
remote: Total 5197123 (delta 1327), reused 1044 (delta 1011),
pack-reused 5195304 (from 3)
Receiving objects: 100% (5197123/5197123), 3.01 GiB | 30.71 MiB/s, done.
Resolving deltas: 100% (3556376/3556376), done.
Updating files: 100% (103542/103542), done.
$ cd freebsd-src/
$ git checkout -b drm-base-subtree
Switched to a new branch 'drm-base-subtree'
$ git remote add drm-subtree https://github.com/evadot/drm-subtree.git
$ git subtree add --prefix sys/dev/drm/ drm-subtree master
git fetch drm-subtree master
remote: Enumerating objects: 2189, done.
remote: Counting objects: 100% (286/286), done.
remote: Compressing objects: 100% (57/57), done.
remote: Total 2189 (delta 252), reused 235 (delta 229), pack-reused
1903 (from 1)
Receiving objects: 100% (2189/2189), 1.49 MiB | 17.48 MiB/s, done.
Resolving deltas: 100% (1440/1440), done.
From https://github.com/evadot/drm-subtree
 * branch                      master     -> FETCH_HEAD
 * [new branch]                master     -> drm-subtree/master
Added dir 'sys/dev/drm'
$ git am sys/dev/drm/extra_patches/*.patch
Applying: Hook DRM to the build
error: patch failed: sys/conf/kern.pre.mk:309
error: sys/conf/kern.pre.mk: patch does not apply
error: patch failed: sys/conf/options:101
error: sys/conf/options: patch does not apply
Patch failed at 0001 Hook DRM to the build
hint: Use 'git am --show-current-patch=diff' to see the failed patch


I would like to know if,to enable the panfrost driver,is enough to install
code from point 1.

If I need to install code also from point 2) I need to get some help from a
developer because I don't have the skills to upgrade the patches until
FreeBSD 14.3-STABLE that's the version of FreeBSD that I'm running on my
RockPro RK3399 and Radxa Zero 3W.

Can someone help me ?

-- 
Mario.