Skip to content

Commit

Permalink
apply pancsf patches
Browse files Browse the repository at this point in the history
  • Loading branch information
SolDev69 committed Dec 22, 2023
1 parent 32e485c commit 8584ac7
Show file tree
Hide file tree
Showing 123 changed files with 49,782 additions and 145 deletions.
Empty file added .ci-farms-disabled/lima
Empty file.
88 changes: 88 additions & 0 deletions README-CSF.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
Valhall CSF Tests
=================

The ``csf`` branch contains a test program for v10 Valhall GPUs (G710
etc.) which uses the Arm ``kbase`` kernel driver, which is generally
present on vendor kernels but is not in the upstream Linux kernel.

However, the kernel driver source can also be downloaded `from Arm
<https://developer.arm.com/downloads/-/mali-drivers/valhall-kernel>`_,
of which the newer releases should work well enough with a mainline
kernel (though some work may be needed to integrate the vendor
platform).

Making sure that the ``libmali`` blob drivers work before trying this
program is recommended, otherwise you will be trying to debug
userspace and kernel bugs at the same time.

Note that firmware is required for these GPUs, for RK3588 try
downloading the file from the Rockchip `libmali
<https://github.com/JeffyCN/rockchip_mirrors/tree/libmali/firmware/g610>`_
repo, and placing it in ``/lib/firmware/``.

Compiling
---------

.. code-block:: sh
$ mkdir build
$ cd build
$ meson --buildtype=debug -Dgallium-drivers=panfrost -Dvulkan-drivers=
$ ninja src/panfrost/csf_test
Running
-------

.. code-block:: sh
$ src/panfrost/csf_test
will run the tests.

Normally it will start running cleanup steps as soon as one test
fails, though setting the environment variable ``TEST_KEEP_GOING=1``
will change this behaviour.

Test failures
-------------

Gitlab issues can be created against `my repo
<https://gitlab.freedesktop.org/icecream95/mesa/-/issues>`_, though
some problems should be easy to fix (wrong permissions on
``/dev/mali0``?).

Include all output from running the test program. Including logs from
``strace`` might also help.

Command stream test script
--------------------------

``src/panfrost/csf_test/interpret.py`` is a test script for assembling
and executing command streams.

To use it, symlink the ``csf_test`` binary into ``$PATH`` and optionally
also write a ``rebuild-mesa`` script which recompiles ``csf_test``.

Then running ``interpret.py`` will execute the ``cmds`` variable,
which is defined inside the script file.

Example:

.. code-block:: txt
@ comments are started with '@'
@ run on command stream 2
!cs 2
@ allocate some memory
!alloc x 4096
@ allocate event memory, for evstr instructions
!alloc ev 4096 0x8200f
mov x50, $x
@ dump all registers to the memory starting at x50
regdump x50
@ dump the memory region named 'x'
!dump x 0 4096
145 changes: 111 additions & 34 deletions README.rst
Original file line number Diff line number Diff line change
@@ -1,59 +1,136 @@
`Mesa <https://mesa3d.org>`_ - The 3D Graphics Library
======================================================

Valhall v10 "CSF" support branch—for Mali G710/G610.

Note that firmware is required for these GPUs, for RK3588 try
downloading the file from the Rockchip `libmali
<https://github.com/JeffyCN/rockchip_mirrors/tree/libmali/firmware/g610>`_
repo, and placing it in ``/lib/firmware/``.

Windowing system support
------------------------

Panfrost Wayland compositor (wlroots):

#. Panfrost Wayland clients
#. Panfrost X11 clients via Xwayland [1]_
#. Blob X11 clients via Xwayland + dri2to3 [2]_

Panfrost Wayland compositor (non-wlroots):

#. Panfrost Wayland clients
#. Panfrost X11 clients via Xwayland
#. Blob Wayland clients
#. Blob X11 clients via Xwayland + dri2to3 [2]_

Blob Wayland compositor:

#. Panfrost Wayland clients
#. Blob Wayland clients

Panfrost Xorg server: [3]_

#. Panfrost X11 clients
#. Blob X11 clients

Blob Xorg server:

#. Panfrost X11 clients
#. Blob X11 clients

Applications using KMS/DRM will also work.

.. [1] Requires ``CONFIG_DRM_IGNORE_IOTCL_PERMIT`` to be disabled in
the kernel configuration. The option is broken and should never
be enabled anyway.
.. [2] See https://gitlab.com/panfork/dri2to3
.. [3] For Radxa Debian/Ubuntu, the ``xserver-xorg-core`` version
installed by default is not compatible with Panfrost. But note
that upstream Xorg does not work will the blob, so Mesa must be
installed so that it is used by default. (see the "Usage"
section below). To switch between the upstream and Rockchip
versions, run:
.. code-block:: sh
$ sudo apt install xserver-xorg-core="$(apt-cache show xserver-xorg-core | grep Version | grep -v "$(dpkg -s xserver-xorg-core | grep Version)" | cut -d" " -f2)"
Broken combinations:

#. Panfrost wlroots + Blob Wayland does not work because wlroots does
not expose the ``mali_buffer_sharing`` protocol. This might be
fixable.
#. Blob Wayland compositor + Panfrost X11 does not work because the
blob does not expose the required protocols for Xwayland
acceleration to work

Source
------

This repository lives at https://gitlab.freedesktop.org/mesa/mesa.
Other repositories are likely forks, and code found there is not supported.
This repository lives at https://gitlab.com/panfork/mesa, and is a
fork, so not supported by upstream.

Upstream source is at https://gitlab.freedesktop.org/mesa/mesa.

Build & install
---------------
Depdendencies
-------------

You can find more information in our documentation (`docs/install.rst
<https://mesa3d.org/install.html>`_), but the recommended way is to use
Meson (`docs/meson.rst <https://mesa3d.org/meson.html>`_):
For Debian-based distributions:

.. code-block:: sh
$ mkdir build
$ cd build
$ meson ..
$ sudo apt install build-essential meson git python3-mako libexpat1-dev bison flex libwayland-egl-backend-dev libxext-dev libxfixes-dev libxcb-glx0-dev libxcb-shm0-dev libxcb-dri2-0-dev libxcb-dri3-dev libxcb-present-dev libxshmfence-dev libxxf86vm-dev libxrandr-dev
Also needed is ``libdrm`` and ``wayland-protocols``, but those
packages are too old in Debian Bullseye, and must be compiled from
source:

.. code-block:: sh
$ git clone https://gitlab.freedesktop.org/mesa/drm
$ mkdir drm/build
$ cd drm/build
$ meson
$ sudo ninja install
.. code-block:: sh
$ git clone https://gitlab.freedesktop.org/wayland/wayland-protocols
$ mkdir wayland-protocols/build
$ cd wayland-protocols/build
$ git checkout 1.24
$ meson
$ sudo ninja install
Build & install
---------------

Support
-------
To install to ``/opt/panfrost``:

Many Mesa devs hang on IRC; if you're not sure which channel is
appropriate, you should ask your question on `OFTC's #dri-devel
<irc://irc.oftc.net/dri-devel>`_, someone will redirect you if
necessary.
Remember that not everyone is in the same timezone as you, so it might
take a while before someone qualified sees your question.
To figure out who you're talking to, or which nick to ping for your
question, check out `Who's Who on IRC
<https://dri.freedesktop.org/wiki/WhosWho/>`_.
.. code-block:: sh
The next best option is to ask your question in an email to the
mailing lists: `mesa-dev\@lists.freedesktop.org
<https://lists.freedesktop.org/mailman/listinfo/mesa-dev>`_
$ mkdir build
$ cd build
$ meson -Dgallium-drivers=panfrost -Dvulkan-drivers= -Dllvm=disabled --prefix=/opt/panfrost
$ sudo ninja install
Usage
-----

Bug reports
-----------
To run an application with Panfrost (note the windowing system support
section above):

If you think something isn't working properly, please file a bug report
(`docs/bugs.rst <https://mesa3d.org/bugs.html>`_).
.. code-block:: sh
$ LD_LIBRARY_PATH=/opt/panfrost/lib/aarch64-linux-gnu glmark2-es2-wayland
Contributing
------------
To use Panfrost by default, add the directory where you installed it
to the library search path:

Contributions are welcome, and step-by-step instructions can be found in our
documentation (`docs/submittingpatches.rst
<https://mesa3d.org/submittingpatches.html>`_).
.. code-block:: sh
Note that Mesa uses gitlab for patches submission, review and discussions.
$ echo /opt/panfrost/lib/aarch64-linux-gnu | sudo tee /etc/ld.so.conf.d/0-panfrost.conf
$ sudo ldconfig
Loading

0 comments on commit 8584ac7

Please sign in to comment.