Running the Vulkan Samples

Direct-to-display WSI, Wayland, and X11/XCB are the supported backends for the Vulkan samples.

When running the Vulkan samples, you might need to temporarily disable other window systems. For example, with X11 installations, run these commands:

sudo service gdm3 stop       
<run sample>
sudo service gdm3 start

There are two Vulkan sample applications, vkfish and vkcube, which must be compiled in the host and copied to the target. For compilation steps, see Building and Running Samples.

The sample path for vkfish:

$PDK_TOP/drive-linux/samples/vulkan/vkfish
The sample path for vkcube:
$PDK_TOP/drive-linux/samples/vulkan/vkcube

Running vkfish

The vkfish application is a modified version of the NVIDIA threaded rendering Vulkan sample. It has been modified to use the direct-to-display WSI and Wayland platforms, and the interface has been stripped for simplification.

To run vkfish with direct-to-display:

  1. Disable other window systems.
  2. Run the following commands:
    cd $SAMPLE_APP/vkfish/direct-to-display
    ./vkfish

    $SAMPLE_APP represents the application directory path of the target.

  3. Restart window systems, if necessary.
To run vkfish with Wayland:
  1. Disable other window systems.
  2. Install the driver module as follows:
    sudo insmod /lib/modules/$(uname -r)/extra/opensrc-disp/nvidia-drm.ko modeset=1
  3. Start Weston Wayland:
    mkdir /tmp/xdg
    chmod 700 /tmp/xdg
    export XDG_RUNTIME_DIR=/tmp/xdg
    weston-launch& 
  4. Run the following commands:
    cd $SAMPLE_APP/vkfish/wayland
    ./vkfish
    vkfish does not support command-line arguments and runs forever by default.

To run vkfish with X11:

  1. Disable other window systems.
  2. Start X11 as follows:
    export DISPLAY=:0.0
    sudo -b X -ac -noreset -nolisten tcp
  3. Run the following commands:
    cd $SAMPLE_APP/vkfish/x11 
    ./vkfish

    The sample might be run with --c <framecount> to render a certain number of frames. If started without arguments, the app will run forever.

Running vkcube

The vkcube application is a modified version of the LunarG Vulkan cube demonstration available at:

https://github.com/KhronosGroup/Vulkan-LoaderAndValidationLayers/tree/master/demos

It has been modified to use the direct-to-display WSI and Wayland platforms.

To run vkcube with direct-to-display:

  1. Disable other window systems.
  2. Run the following commands:
    cd $SAMPLE_APP/vkcube/direct-to-display
    ./vkcube

    $SAMPLE_APP represents the application directory path of the target.

  3. Restart window systems, if necessary.

    The sample might be run with --c <framecount> to render a certain number of frames. If started without arguments, the app will run forever.

To run vkcube with Wayland:

  1. Disable other window systems.
  2. Install the driver module as follows:
    sudo insmod /lib/modules/$(uname -r)/extra/opensrc-disp/nvidia-drm.ko modeset=1
  3. Start Weston Wayland:
    mkdir /tmp/xdg
    chmod 700 /tmp/xdg
    export XDG_RUNTIME_DIR=/tmp/xdg
    weston-launch&
  4. Run the following commands:
    cd $SAMPLE_APP/vkcube/wayland
    ./vkcube

    The sample might be run with --c <framecount> to render a certain number of frames. If started without arguments, the app will run forever.

To run vkcube with X11:

  1. Disable other window systems.
  2. Start X11 as follows:
    export DISPLAY=:0.0
    sudo -b X -ac -noreset -nolisten tcp
  3. Run the following commands:
    cd $SAMPLE_APP/vkcube/x11 
    ./vkcube

    The sample might be run with --c <framecount> to render a certain number of frames. If started without arguments, the app will run forever.