v3dv: quick guide to build and run some demos

Just today it has published a status update of the Vulkan effort for the Raspberry Pi 4, including that we are moving the development of the driver to an open repository. As it is really likely that some people would be interested on testing it, even if it is not complete at all, here you can find a quick guide to compile it, and get some demos running.

Dependencies

So let’s start installing some dependencies. My personal recipe, that I use every time I configure a new machine to work on mesa is the following one (sorry if some extra unneeded dependencies slipped):

sudo apt-get install libxcb-randr0-dev libxrandr-dev \
        libxcb-xinerama0-dev libxinerama-dev libxcursor-dev \
        libxcb-cursor-dev libxkbcommon-dev xutils-dev \
        xutils-dev libpthread-stubs0-dev libpciaccess-dev \
        libffi-dev x11proto-xext-dev libxcb1-dev libxcb-*dev \
        bison flex libssl-dev libgnutls28-dev x11proto-dri2-dev \
        x11proto-dri3-dev libx11-dev libxcb-glx0-dev \
        libx11-xcb-dev libxext-dev libxdamage-dev libxfixes-dev \
        libva-dev x11proto-randr-dev x11proto-present-dev \
        libclc-dev libelf-dev git build-essential mesa-utils \
        libvulkan-dev ninja-build libvulkan1 python-mako \
        libdrm-dev libxshmfence-dev libxxf86vm-dev \
        python3-mako

Most Raspian libraries are recent enough, but they have been updating some of then during the past months, so just in case, don’t forget to update:

$ sudo apt-get update
$ sudo apt-get upgrade

Additionally, you woud need to install meson. Mesa has just recently bumped up the version needed for meson, so Raspbian version is not enough. There is the option to build meson from the tarball (meson-0.52.0 here), but by far, the easier way to get a recent meson version is using pip3:

$ pip3 install meson

2020-07-04 update

It seems that some people had problems if they have installed meson with apt-get on their system, as when building it would try the older meson version first. For those people, they were able to fix that doing this:

$ sudo apt-get remove meson
$ pip3 install --user meson

Download and build v3dv

This is the simpler recipe to build v3dv:

$ git clone https://gitlab.freedesktop.org/apinheiro/mesa.git mesa
$ cd mesa
$ git checkout wip/igalia/v3dv
$ meson --prefix /home/pi/local-install --libdir lib -Dplatforms=x11,drm -Dvulkan-drivers=broadcom -Ddri-drivers= -Dgallium-drivers=v3d,kmsro,vc4 -Dbuildtype=debug _build
$ ninja -C _build
$ ninja -C _build install

2020-11-25 update

Now v3dv is merged on Mesa upstream, so in order to clone the repository now you just need to do this:

$ git clone https://gitlab.freedesktop.org/mesa/mesa.git

This builds and install a debug version of v3dv on a local directory. You could set a release build, or any other directory. The recipe is also building the OpenGL driver, just in case anyone want to compare, but if you are only interested on the vulkan driver, that is not mandatory.

Run some Vulkan demos

Now, the easiest way to ensure that a vulkan program founds the drivers is setting the following envvar:

export VK_ICD_FILENAMES=/home/pi/local-install/share/vulkan/icd.d/broadcom_icd.armv7l.json

That envvar is used by the Vulkan loader (installed as one of the dependencies listed before) to know which library load. This also means that you don’t need to use LD_PRELOAD, LD_LIBRARY_PATH or similar

So what Vulkan programs are working? For example several of the Sascha Willem Vulkan demos. To make things easier to everybody, here another quick recipe of how to get them build:

$ sudo apt-get install libassimp-dev
$ git clone --recursive https://github.com/SaschaWillems/Vulkan.git  sascha-willems
$ cd sascha-willems
$ mkdir build; cd build
$ cmake -DCMAKE_BUILD_TYPE=Debug  ..
$ make

Update 2020-08-03: When the post was originally written, some demos didn’t need to ask for extra assets. Recently the fonts were moved there, so you would need to gather the assests always:

$ cd ..
$ python3 download_assets.py

So in order to see a really familiar demo:

$ cd build/bin
$ ./gears

And one slightly more complex:

$./scenerendering

As mentioned, not all the demos works. But a list of some that we tested and seem to work:
* distancefieldfonts
* descriptorsets
* dynamicuniformbuffer
* gears
* gltfscene
* imgui
* indirectdraw
* occlusionquery
* parallaxmapping
* pbrbasic
* pbribl
* pbrtexture
* pushconstants
* scenerendering
* shadowmapping
* shadowmappingcascade
* specializationconstants
* sphericalenvmapping
* stencilbuffer
* textoverlay
* texture
* texture3d
* texturecubemap
* triangle
* vulkanscene

Update : rpiMike on the comments, and some people privately, have pointed some errors on the post. Thanks! And sorry for the inconvenience.

Update 2 : Mike Hooper pointed more issues on gitlab

78 thoughts on “v3dv: quick guide to build and run some demos”

      1. I get to the local install part and it say I must specify at least one directory I’m a basic coder at best could you help me

        1. Could you share the full command and full output? I think that I’m missing some of the context, and not understanding the problem. If you think that it is too big for a blog comment, please use any of the available pastebin webpages available.

          PS: as a general rule, when you have an error, it is better to share the full command/error, instead of just summarizing/explaining the error.

  1. Changed 1st clone to:
    git clone https://gitlab.freedesktop.org/apinheiro/mesa.git mesa

    Changed meson install to, so ‘meson’ worked:
    sudo pip3 install meson

    Now getting:
    meson –prefix /home/pi/local-install –libdir lib -Dplatforms=x11,drm -Dvulkan-drivers=broadcom -Ddri-drivers= -Dgallium-drivers=v3d,kmsro,vc4 -Dbuildtype=debug _build
    The Meson build system
    Version: 0.54.2
    Source dir: /home/pi/mesa
    Build dir: /home/pi/mesa/_build
    Build type: native build
    Program python found: YES (/usr/bin/python)

    meson.build:21:0: ERROR: Options “broadcom” are not in allowed choices: “, auto, amd, intel”

    A full log can be found at /home/pi/mesa/_build/meson-logs/meson-log.txt

    1. Yes, once you get the proper repository cloned, you need to move to the correct branch:
      $ git branch wip/igalia/v3dv

      I have just updated the post. Thanks for reporting, and sorry for the inconvenience.

  2. was interested in trying this on archlinux in my case I tried on manjaro 64bit and I got an error while compiling.

    https://www.pastiebin.com/5ee3c5f20b6bd

    it was pretty far along (977 of 1155 or something)
    hopefully it just means I cloned the git at a bad time?

    hoping to test dolphin emu under vulkan vs gles and compare ๐Ÿ™‚

    1. > hopefully it just means I cloned the git at a bad time?

      As I just explained to other developer testing 64bit, for now we are focusing on 32-bit. We would revisit that as the driver gets more mature.

      Having said so, note that the build is failing on gallium utilities that the vulkan driver is using, and not exactly on the main source code of the driver. So I suspect that perhaps you would need some extra options when calling meson.

      > hoping to test dolphin emu under vulkan vs gles and compare

      We have advanced a lot on the past months, but the driver is still on the early stages. In fact I have just skimmed the dolphin code here:

      https://github.com/dolphin-emu/dolphin.git dolphin-emu

      and it uses Vulkan features like compute shaders and texel buffers that v3dv still doesn’t support. So sorry, but such comparison is still not possible.

  3. Hello, thanks for your work!
    Following your instructions, I was able to successfully run everything on OS 32bit.
    In OS 64bit Beta almost everything worked (only one file in share/vulkan/icd.d that generated as aarch64.json instead of armv7l.json), but when trying to run the demos it raises an error VkResult is “ERROR_INITIALIZATION_FAILED” (res == VK_SUCCESS failed) .

    1. Hi, thanks for testing on both 32 and 64 bit. Unfourtunately, the failure on 64 bit is expected. Right now we are focused on getting the vulkan driver working on the 32-bit Raspbian first. We didn’t even start to test on the 64bit Beta. When we got a conformant, or almost 1.0 conformant driver working on 32-bit, we would need to evaluate the priorities about the next thing to work on (there are plenty of options, 64-bit support, work on performance, 1.1, etc)

        1. Update, as instructed in the thread from a later comment below, I reset the environment variable which was set by the command,

          export VK_ICD_FILENAMES=/home/pi/local-install/share/vulkan/icd.d/broadcom_icd.armv7l.json

          in the tutorial with the following command:

          export VK_ICD_FILENAMES=/home/pi/local-install/share/vulkan/icd.d/broadcom_icd.aarch64.json

          That’s all it took and now the Willems Vulkan demos are running on my Ubuntu Mate 64-bit Raspberry Pi4! GREAT tutorial and a huge boon in reducing the time I need to run my big, noisy tower machine. ๐Ÿ˜‰

  4. Git branch doesn’t switch to a branch unless creating a new one. If anybody have problems with switching to a proper branch try typing:
    git switch wip/igalia/v3dv

    1. I just noticed that git that is on my system is a lot more recent that the one available in buster Raspberry Pi OS repository. I discovered that when I tried to build the driver under a fresh install of 32-bit Raspberry Pi OS Lite. “git switch” is available since git 2.23, and the one in the repo at the time of writing is 2.20.1. So if you want to switch to a branch you should type:
      git checkout wip/igalia/v3dv
      When typing “git branch wip/igalia/v3dv” you will create a new local branch and not change the branch to the branch that resides on remote origin, which is what you want.
      Sorry if I confused anybody with my initial comment as this worked because I was at testing suite of RPi repo

  5. Also you may also need to run this as they are dependencies that may not be on your system:
    pip3 install meso
    apt install libxshmfence-dev

  6. Dear Raspberry Pi Team,
    This is wonderful! Please keep up the good work.

    A few comments:

    1) I also had to use
    git clone โ€“single-branch โ€“branch wip/igalia/v3dv https://gitlab.freedesktop.org/apinheiro/mesa.git
    as gaara suggested above. The method in post did not work.

    2) I had to install a few other development packages:
    python3-mako, libdrm-dev, libxshmfence-dev, libxxf86vm-dev, libassimp-dev, and cmake, of course.
    There were a few others, but I cannot remember if they were for something I am writing or just for purposes of this guide.

    Otherwise, beautiful – indeed many Willems tests run.

      1. Note that the people that suggested that option is writing that with double ‘-‘, so:

        $git clone โ€“-single-branch โ€“-branch wip/igalia/v3dv https://gitlab.freedesktop.org/apinheiro/mesa.git

        Having said so, since people pointed me out that my initial recipe has some errors (sorry and thanks!), I have updated the recipe, so C&P from the current state of the post:

        $ git clone https://gitlab.freedesktop.org/apinheiro/mesa.git mesa
        $ cd mesa
        $ git checkout wip/igalia/v3dv

        1. Still not working. ๐Ÿ™

          pi@raspberrypi:~/mesa $ meson –prefix /home/pi/local-install –libdir lib -Dplatforms=x11,drm -Dvulkan-drivers=broadcom -Ddri-drivers= -Dgallium-drivers=v3d,kmsro,vc4 -Dbuildtype=debug _build
          The Meson build system
          Version: 0.54.3
          Source dir: /home/pi/mesa
          Build dir: /home/pi/mesa/_build
          Build type: native build
          Program python found: YES (/usr/bin/python)
          Project name: mesa
          Project version: 20.2.0-devel
          C compiler for the host machine: cc (gcc 8.3.0 “cc (Raspbian 8.3.0-6+rpi1) 8.3.0”)
          C linker for the host machine: cc ld.bfd 2.31.1
          C++ compiler for the host machine: c++ (gcc 8.3.0 “c++ (Raspbian 8.3.0-6+rpi1) 8.3.0”)
          C++ linker for the host machine: c++ ld.bfd 2.31.1
          Host machine cpu family: arm
          Host machine cpu: armv7l
          Program python3 found: YES (/usr/bin/python3)

          meson.build:877:2: ERROR: Problem encountered: Python (3.x) mako module >= 0.8.0 required to build mesa.

          A full log can be found at /home/pi/mesa/_build/meson-logs/meson-log.txt

          1. Try to install python3-mako :
            $ sudo apt-get install python3-mako

            Some people before pointed that package is also needed. I have just updated the recipe.

        2. After $ sudo apt-get install python3-mako things worked fine, but when I closed the terminal and tried to run demos later, this error appeared:

          Could not create Vulkan instance :
          ERROR_EXTENSION_NOT_PRESENT

          1. When you opened a new terminal to run the demos, did you remember to export the envvar with the location of the ICD?:

            export VK_ICD_FILENAMES=/home/pi/local-install/share/vulkan/icd.d/broadcom_icd.armv7l.json

  7. Thanks Raspberry Pi Team for this amazing work!

    I sucessfully installed the Vulkan drivers and run most examples. I’m wondering if readless operation will be supported in the future? The `renderheadless` example did not work without a X11 server.

    1. Thanks for the feedback. That is a interesting comment, as I assumed that the renderheadless demo just worked. Didn’t realize that it needed a X11 server. Having said so, we are still missing several 1.0 core features. Our main focus right now is getting Vulkan 1.0 core supported (so getting vk-gl-cts for 1.0 passing). I hope that to be enough to get that test working without X11 server.

  8. I have this issue ๐Ÿ™

    meson –prefix /home/pi/local-install –libdir lib -Dplatforms=x11,drm -Dvulkan-drivers=broadcom -Ddri-drivers= -Dgallium-drivers=v3d,kmsro,vc4 -Dbuildtype=debug _build
    The Meson build system
    Version: 0.49.2
    Source dir: /home/pi/src/mesa
    Build dir: /home/pi/src/mesa/_build
    Build type: native build
    Program python found: YES (/usr/bin/python)

    meson.build:21:0: ERROR: Meson version is 0.49.2 but project requires >= 0.52.

    Machine infos: Raspberrypi 4 4GB Ram

    uname -a
    Linux raspberrypi 5.4.47-v7l+ #1322 SMP Wed Jun 17 17:58:52 BST 2020 armv7l GNU/Linux

    cat /etc/os-release
    PRETTY_NAME=”Raspbian GNU/Linux 10 (buster)”
    NAME=”Raspbian GNU/Linux”
    VERSION_ID=”10″
    VERSION=”10 (buster)”
    VERSION_CODENAME=buster
    ID=raspbian
    ID_LIKE=debian
    HOME_URL=”http://www.raspbian.org/”
    SUPPORT_URL=”http://www.raspbian.org/RaspbianForums”
    BUG_REPORT_URL=”http://www.raspbian.org/RaspbianBugs”

    1. “meson.build:21:0: ERROR: Meson version is 0.49.2 but project requires >= 0.52.”

      Please re-read the guide. It clearly points that Mesa recently bumped meson requirement, and that you need to install a newer version of meson.

      1. you true i forgot to mention

        sudo pip3 install meson
        Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
        Requirement already satisfied: meson in /usr/lib/python3/dist-packages (0.49.2)

        i download the meson last sources and

        python3 -m pip install meson
        Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
        Requirement already satisfied: meson in /home/pi/meson-0.52.0 (0.52.0)

        after :
        meson –prefix /home/pi/local-install –libdir lib -Dplatforms=x11,drm -Dvulkan-drivers=broadcom -Ddri-drivers= -Dgallium-drivers=v3d,kmsro,vc4 -Dbuildtype=debug _build
        The Meson build system
        Version: 0.49.2
        Source dir: /home/pi/src/mesa
        Build dir: /home/pi/src/mesa/_build
        Build type: native build
        Program python found: YES (/usr/bin/python)

        meson.build:21:0: ERROR: Meson version is 0.49.2 but project requires >= 0.52.

        A full log can be found at /home/pi/src/mesa/_build/meson-logs/meson-log.txt

        dho!!

        1. FIXED!
          please add this in your guide for other ppl ๐Ÿ™‚

          first is need to
          sudo apt remove meson

          after is need to

          pip3 install –user meson
          Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
          Collecting meson
          Downloading https://www.piwheels.org/simple/meson/meson-0.54.3-py3-none-any.whl (643kB)
          100% |โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆ| 645kB 658kB/s
          Installing collected packages: meson
          Successfully installed meson-0.54.3

          tadaaaaa

          meson –version
          0.54.3

          1. > please add this in your guide for other ppl

            Just added a note. Thanks for the feedback.

  9. Can you add vkmark to future posts ( it works with default settings but produces artifacts running vkmark -s 1920×1080)

    1. Thanks. Interesting, I didn’t know about that project. Looking a little seems a project inspired on glmark2. And one good thing is that it has a list of scenes, so we could triage/measure performance using different scenes.

      Out of curiosity, those artifacts happens with all the scenes, or with just some in particular?

      1. It happens with most, i think it’s a tile like pattern, but it could also be vertical lines. It looks like it appears with the scenes with models

    1. Only if your computer has 8 cores, that btw, rpi4 doesn’t have. In fact, taking into account that the rpi4 has 4 cores, it is really likely that “make -j8” is worse that “make -j4”.

      In any case, note that this is a quick guide. The idea is providing the quicker and simpler guide to get those build and running.

  10. I did test this on 64bit raspberry os with sid repos and on gears I got the following output:

    pi@raspberrypi:~/sascha-willems/build/bin $ ./gears
    vk: error: v3dv_GetPhysicalDeviceProperties2: ignored VkStructureType 1000212000:VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PCI_BUS_INFO_PROPERTIES_EXT

    WARNING: v3dv is neither a complete nor a conformant Vulkan implementation. Testing use only.
    vk: error: v3dv_AllocateMemory: ignored VkStructureType 1000127001:VK_STRUCTURE_TYPE_MEMORY_DEDICATED_ALLOCATE_INFO

    vk: error: v3dv_AllocateMemory: ignored VkStructureType 1000072002:VK_STRUCTURE_TYPE_EXPORT_MEMORY_ALLOCATE_INFO

    vk: error: v3dv_AllocateMemory: ignored VkStructureType 1000127001:VK_STRUCTURE_TYPE_MEMORY_DEDICATED_ALLOCATE_INFO

    vk: error: v3dv_AllocateMemory: ignored VkStructureType 1000072002:VK_STRUCTURE_TYPE_EXPORT_MEMORY_ALLOCATE_INFO

    vk: error: v3dv_AllocateMemory: ignored VkStructureType 1000127001:VK_STRUCTURE_TYPE_MEMORY_DEDICATED_ALLOCATE_INFO

    vk: error: v3dv_AllocateMemory: ignored VkStructureType 1000072002:VK_STRUCTURE_TYPE_EXPORT_MEMORY_ALLOCATE_INFO

    vk: error: v3dv_AllocateMemory: ignored VkStructureType 1000127001:VK_STRUCTURE_TYPE_MEMORY_DEDICATED_ALLOCATE_INFO

    vk: error: v3dv_AllocateMemory: ignored VkStructureType 1000072002:VK_STRUCTURE_TYPE_EXPORT_MEMORY_ALLOCATE_INFO

    vk: error: v3dv_AllocateMemory: ignored VkStructureType 1000127001:VK_STRUCTURE_TYPE_MEMORY_DEDICATED_ALLOCATE_INFO

    vk: error: v3dv_AllocateMemory: ignored VkStructureType 1000072002:VK_STRUCTURE_TYPE_EXPORT_MEMORY_ALLOCATE_INFO

    gears: /home/pi/sascha-willems/external/imgui/imgui_draw.cpp:1573: ImFont* ImFontAtlas::AddFontFromFileTTF(const char*, float, const ImFontConfig*, const ImWchar*): Assertion `0′ failed.
    Aborted

    I know 64bit is not your priority, but maybe it helps to improve the driver. ๐Ÿ™‚

    1. Hi,

      That error is not coming from the driver. I have just checked, and it seems that recently fonts have moved to assets, so you need to gather them always, not just for some demos. I have just updated the blog post to mention that.

      Thanks for the feedback.

      1. Thanks for your quick help. Now I can confirm your driver does work on 64bit. Its running the gears demo atleast. I will do more testing now. ๐Ÿ™‚

  11. Installed and everything works. Demo’s run well. Tried to build my game engine that uses Vulkan and it’s looking for libOpenVG.so. This file is no where to be found on Raspbian. Not sure if it’s a bit soon to be trying this with my game engine.

    1. Hi, thanks for testing it. But as far as I remember Mesa doesn’t implement OpenVG in general, and we don’t have short term plans to implement it neither.

      In any case Vulkan and OpenVG are two different standards. Vulkan doesn’t depend on OpenVG so unless your game engine is using both Vulkan and OpenVG that shouldn’t be a problem.

      1. My mistake. Had some old link statements in one of my CMakeLists.txt files that went back to the OpenGL version of the engine when these libraries were part of Raspbian.

        My Vulkan game engine runs on Raspbian! Awesome! I’ve been waiting for the day I could do my game development on my Raspberry Pi! Thank you so much!

  12. You don’t need to uninstall meson, just

    $ export PATH=$HOME/.local/bin:$PATH

    To give more priority to the meson installed through pip.

    Anyway, awesome work!

  13. Thought I’d show the information displayed from my game engine running Vulkan on Raspberry Pi.
    What’s interesting is the minimum swap chain image count is 3, max is 0 but vkGetSwapchainImagesKHR returns 5. Not sure why it needs so many swap chain images.

    Physical Device Extension(s)…
    VK_KHR_swapchain

    Instance Extension(s)…
    VK_KHR_surface
    VK_KHR_xlib_surface
    VK_EXT_debug_report
    VK_KHR_get_physical_device_properties2

    Application Info…
    Structure Type: 0
    App Name: Template Game
    App Version: 1
    Engine Name: Waffles Game Engine
    Engine Version: 1
    API Version: 4194304

    vk: error: v3dv_GetPhysicalDeviceProperties2: ignored VkStructureType 1000212000:VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PCI_BUS_INFO_PROPERTIES_EXT

    WARNING: v3dv is neither a complete nor a conformant Vulkan implementation. Testing use only.
    Physical Device Properties (0)…
    GPU Name: V3D 4.2
    GPU Type: Integrated GPU
    GPU Driver Version: 83894371
    GPU Vender Id: 5348
    GPU Device Id: 0
    Max Image 1D: 4096
    Max Image 2D: 4096
    Max Image 3D: 4096
    Max Viewports: 1

    Queue Family Properties (0)…
    Queue Flags: b00000000000000000000000000000111
    Queue Count: 1
    Timestamp Valid Bits: 0x0000
    Min Image Transfer Granularity: 1 x 1 x 1
    Graphics Bit: true
    Compute Bit: true
    Transfer Bit: true
    Sparse Binding Bit: false
    Protected Bit: false

    SELECTED Physical Device Index: 0
    SELECTED Graphics Queue Family Index: 0
    UNAVAILABLE Transfer Queue Family Index: 4294967295
    UNAVAILABLE Presentation Queue Family Index: 4294967295

    Surface Capabilities…
    Min Image Count: 3
    Max Image Count: 0
    Current Extent: 636 x 1130
    Min Image Extent: 636 x 1130
    Max Image Extent: 636 x 1130
    Max Image Array Layers: 1
    Supported Transform Flags: b00000000000000000000000000000001
    Current Transform Flags: 0x00000000000000000000000000000001
    Supported Composite Alpha Flags: b00000000000000000000000000001001
    Supported Usage Flags: b00000000000000000000000000011011

    Surface Format(s)…

    Format: 50
    Color Space: 0

    SELECTED
    Format: 44
    Color Space: 0

    Swapchain Create Info…
    sType: 1000001000
    flags: b00000000000000000000000000000000
    Min Image Count: 3
    Image Extent: 636 x 1130
    Image Array Layers: 1
    Image Sharing Mode: 0x0000
    Pretransform: 0x0001
    Composite Alpha: 0x0001
    Present Mode: b00000000000000000000000000000001
    Clipped: true

    vk: error: v3dv_AllocateMemory: ignored VkStructureType 1000127001:VK_STRUCTURE_TYPE_MEMORY_DEDICATED_ALLOCATE_INFO

    vk: error: v3dv_AllocateMemory: ignored VkStructureType 1000072002:VK_STRUCTURE_TYPE_EXPORT_MEMORY_ALLOCATE_INFO

    vk: error: v3dv_AllocateMemory: ignored VkStructureType 1000127001:VK_STRUCTURE_TYPE_MEMORY_DEDICATED_ALLOCATE_INFO

    vk: error: v3dv_AllocateMemory: ignored VkStructureType 1000072002:VK_STRUCTURE_TYPE_EXPORT_MEMORY_ALLOCATE_INFO

    vk: error: v3dv_AllocateMemory: ignored VkStructureType 1000127001:VK_STRUCTURE_TYPE_MEMORY_DEDICATED_ALLOCATE_INFO

    vk: error: v3dv_AllocateMemory: ignored VkStructureType 1000072002:VK_STRUCTURE_TYPE_EXPORT_MEMORY_ALLOCATE_INFO

    vk: error: v3dv_AllocateMemory: ignored VkStructureType 1000127001:VK_STRUCTURE_TYPE_MEMORY_DEDICATED_ALLOCATE_INFO

    vk: error: v3dv_AllocateMemory: ignored VkStructureType 1000072002:VK_STRUCTURE_TYPE_EXPORT_MEMORY_ALLOCATE_INFO

    vk: error: v3dv_AllocateMemory: ignored VkStructureType 1000127001:VK_STRUCTURE_TYPE_MEMORY_DEDICATED_ALLOCATE_INFO

    vk: error: v3dv_AllocateMemory: ignored VkStructureType 1000072002:VK_STRUCTURE_TYPE_EXPORT_MEMORY_ALLOCATE_INFO

    Swap chain image count doesn’t match! (3 / 5)

    1. > Whatโ€™s interesting is the minimum swap chain image count is 3, max is 0 but vkGetSwapchainImagesKHR returns 5. Not sure why it needs so many swap chain images.

      After a quick skim, 3 and 0 are just the min and maximum (0 for as many as memory allows), and 5 seems just the number returned by default. Having said so…

      > Swap chain image count doesnโ€™t match! (3 / 5)

      … this seems a message from your engine. Does that mean that you specifically asked for the minimum, and you still got 5?

      1. > โ€ฆ this seems a message from your engine. Does that mean that you specifically asked for the minimum, and you still got 5?

        Yes. By default I set the VkSwapchainCreateInfoKHR minImageCount to the minimum but I get 5 back.
        m_swapchainInfo.minImageCount = surfCapabilities.minImageCount;

        Running my engine on my gaming PC (and other PCs) will return the same swap chain image count as the minimum. I see a similar behavior when running my engine on Android. It will have a minimum of 2 but return 3. It’s that difference that inspired me to add the check.

        1. Hi, this is interesting. In any case, I guess that this is allowed by spec, for some reason, because if not, I found really strange to not have detected by one of the vk-gl-cts tests. Unfourtunately Im somewhat busy to check that (we are on the process to try to upstream the driver) right now. To not forget, and make easier to ask other people working on the driver, I created this issue:

          https://gitlab.freedesktop.org/apinheiro/mesa/-/issues/9

          Thanks for the feedback.

          [1] https://lists.freedesktop.org/archives/mesa-dev/2020-September/224619.html

  14. Got a curiosity:
    is it going to change the steps on how to install the driver from the repo now that you guys merged with the mesa branch?

    1. No, I think that would be strange. The main reason for that post was to write a custom guide, for a custom way to build the driver. Now v3dv should be compiled as any other Mesa driver. Also, in hindsight, writing that recipe on a blog post was not the best idea, as blog posts are not intended to be updated constantly.

      Thanks for your interest.

  15. Sadly I can’t get this to work.
    I get an error when using the git checkout command:
    git checkout wip/igalia/v3dv
    error: pathspec ‘wip/igalia/v3dv’ did not match any file(s) known to git

    Thinking I may have some done something wrong I found a script to do the installation for me “install_v3dv.sh”, but this gives me a similar error message.
    warning: Could not find remote branch wip/igalia/v3dv to clone.
    fatal: Remote branch wip/igalia/v3dv not found in upstream origin

    Is this project still active? / Can anyone help me to get this to work?

      1. Thanks for the quick reply, but I can’t get this to work. Tried it first without sudo and then with, but the result is the same.

        pi@raspberrypi:~/mesa $ sudo git clone git@gitlab.freedesktop.org:mesa/mesa.git
        Cloning into ‘mesa’…
        The authenticity of host ‘gitlab.freedesktop.org (35.227.58.183)’ can’t be established.
        ECDSA key fingerprint is SHA256:AT9DBe0VcxCtOqrAPXto5UTiVWD+OuQPvcBVKHnbJUc.
        Are you sure you want to continue connecting (yes/no)? yes
        Warning: Permanently added ‘gitlab.freedesktop.org,35.227.58.183’ (ECDSA) to the list of known hosts.
        git@gitlab.freedesktop.org: Permission denied (publickey,keyboard-interactive).
        fatal: Could not read from remote repository.

        Please make sure you have the correct access rights
        and the repository exists.

        1. Yes, you need to have ssh configured to clone using that command, that is the usual with Mesa developers. I have changed it to https that would work for everyone (you included as far as I can see).

      2. I think I found a solution for the git error message
        and that is to use the command
        git clone https://gitlab.freedesktop.org/mesa/mesa.git

        I then have a mesa directory in the mesa directory. When I go into that directory and give the meson command it gives me an error message:

        meson.build:21:0: ERROR: Options “drm” are not in allowed choices: “auto, x11, wayland, haiku, android, windows”

        Do the files of the following command have to be combined?:
        git clone https://gitlab.freedesktop.org/apinheiro/mesa.git mesa

        because I chose a different folder name for that one and it gives me another error message when trying to use the meson command:
        meson.build:21:0: ERROR: Options “broadcom” are not in allowed choices: “, auto, amd, intel”

        1. > meson.build:21:0: ERROR: Options โ€œdrmโ€ are not in allowed choices: โ€œauto, x11, wayland, haiku, android, windowsโ€

          There were some changes on mesa upstream. Just remove drm from the options, and use just x11.

          > Do the files of the following command have to be combined?:

          No, just using mesa master should be working.

  16. Awesome project! Got it running on a ARM64 installation without problems.

    I noticed that VK_FORMAT_BC3_UNORM_BLOCK and VK_FORMAT_BC1_UNORM_BLOCK aren’t supported yet. Are they in the roadmap?

    1. Hi. Thanks for the nice words. As mentioned on other blog posts, our first objective was getting Vulkan 1.0 core, focusing on just the mandatory features (with some optional on top). That is done, so then we started to move to some optional features, but also several performance improvements. We don’t have those two formats explicitly on our TODO list, but we could say that it is included on the more general “keep adding popular/common optional features”.

      Having said so, after a quick check, the equivalent of those formats for the OpenGL driver are supported, so it seems that it would be feasible to support them. Perhaps you could create a mesa gitlab issue so we don’t forget (and feel the interest on the feature)?

      Again, thanks for the nice words.

      1. Thanks for your reply! They are indeed supported by the hardware. I was able to implement both Pixel Formats successfully. Thanks for the insight! I opened an issue at the Mesa repository and wrote a blogpost better explaining my project. I was able to run the Vulkan engine of GZDOOM and possibly RBDOOM-3-BFG. I couldn’t test the latter because my 2GB model runs out of memory before loading all the assets, but it stopped crashing whenever trying to load compressed textures.

        My blogpost: https://luigi.ltd/2020-12-02/trying-to-run-doom-with-the-raspberry-pi4-vulkan-driver/
        Mesa issue: https://gitlab.freedesktop.org/mesa/mesa/-/issues/3915

        Thanks again for your prompt reply!

  17. hi, I’m trying to run vulkan app on weston compositor via wayland, I found that, there is macro ‘using_v3d_simulator’, if this macro is not enabled, v3dv_EnumeratePhysicalDevices will always return 0 for pPhysicalDeviceCount, can I know why? and which lib contains dependency for v3dv3?
    Thanks

    1. > hi, Iโ€™m trying to run vulkan app on weston compositor via wayland, I found that, there is macro โ€˜using_v3d_simulatorโ€™, if this macro is not enabled, v3dv_EnumeratePhysicalDevices will always return 0 for pPhysicalDeviceCount

      The v3d simulator is only to be used with a desktop PC, and if v3dv3 is available. Setting to true on the rpi4 would not work, and in fact, in relation to your specific problem, it would not properly initialize the physical device, as it would try to initialize a simulated physical device.

      Just in case, have you tried the most recent mesa master? There were some recent wayland related improvements.

      > and which lib contains dependency for v3dv3?

      Unfourtunately v3dv3 is not openly available. Having said so, it is mostly a debugging utility, and can only handle small tests with a reasonable performance.

  18. Many thanks for your efforts, unfortunately I dont get it: everything seems fine, I now have 3 folders in local-install.
    But glxinfo still shows Mesa 19.3…how to ‘install’ Mesa now, so that glxinfo shows Mesa 21-devel?
    Has this build here any effect to “standard Raspbian’s” v3d/vc4-driver at all (were there any updates?) – or is getting Vulkan the only purpose for this?

    1. Hi, thanks for trying. You are right on your last guess. This guide is only about the last version of the Vulkan driver. glxinfo is still about the OpenGL driver, and in order to use it you would need to modify other envvars. I would recommend you to google a little how to do that, but a good starting point would be the Mesa envvar list:

      https://docs.mesa3d.org/envvars.html

      1. I tried this
        `export VK_ICD_FILENAMES=/usr/share/vulkan/icd.d/broadcom_icd.armv7l.json`
        no luck, still reports 19.3.2 instead 21.1.0
        any further tips please?

        1. Unless I’m wrong /usr/share is for files coming from the packages. So if there is a ICD file, it would be likely the one coming from the distribution package.

          You should one the one from the mesa that you build locally. The guide itself points that:

          “export VK_ICD_FILENAMES=/home/pi/local-install/share/vulkan/icd.d/broadcom_icd.armv7l.json”

          You should adapt it to the local directory you used to build mesa. But again, /usr/share is not usually intended for local buids.

  19. Thanks for this work! I had to run `sudo rpi-update` to be able to use the driver from a vanilla Raspbian. Maybe you can add it to the guide!

  20. Hi to all. Igalia driver initial guide as above has Dplatforms=x11,drm
    This is present in your git but this not on official mesa .
    If added manually in meson options it will pass otherwise not.
    Are we supposed to do this or just compile without drm platform?

    After install, glxinfo still shows mesa 19.3.2
    Tried 20 and 21 branches and prefix local or not and still 19.3.2
    Any tip are welcome

    1. This post was written months ago, so yes, it is obsolete now. It was intended as a guide of how to compile the driver at that moment, not to be updated constantly. In any case, going to your questions, drm is not anymore an option. So as you are saying, just don’t use drm.

Leave a Reply to Luigi Cruz Cancel reply

Your email address will not be published. Required fields are marked *