# Linux Kernel Module Cheat

#### 17.18.1. kmscube

    ./build-buildroot --config-fragment buildroot_config/kmscube

Outcome: a colored spinning cube coded in OpenGL + EGL takes over your display and spins forever: https://www.youtube.com/watch?v=CqgJMgfxjsk

It is a bit amusing to see OpenGL running outside of a window manager window like that: https://stackoverflow.com/questions/3804065/using-opengl-without-a-window-manager-in-linux/50669152#50669152

TODO: it is very slow, about 1FPS. I tried Buildroot master ad684c20d146b220dd04a85dbf2533c69ec8ee52 with:

    make qemu_x86_64_defconfig
    printf "
    BR2_CCACHE=y
    BR2_PACKAGE_HOST_QEMU=y
    BR2_PACKAGE_HOST_QEMU_LINUX_USER_MODE=n
    BR2_PACKAGE_HOST_QEMU_SYSTEM_MODE=y
    BR2_PACKAGE_HOST_QEMU_VDE2=y
    BR2_PACKAGE_KMSCUBE=y
    BR2_PACKAGE_MESA3D=y
    BR2_PACKAGE_MESA3D_DRI_DRIVER_SWRAST=y
    BR2_PACKAGE_MESA3D_OPENGL_EGL=y
    BR2_PACKAGE_MESA3D_OPENGL_ES=y
    BR2_TOOLCHAIN_BUILDROOT_CXX=y
    " >> .config

and the FPS was much better, I estimate something like 15FPS.

On Ubuntu 18.04 with NVIDIA proprietary drivers:

    sudo apt-get instll kmscube
    kmscube

fails with:

    drmModeGetResources failed: Invalid argument
    failed to initialize legacy DRM

See also:

- https://github.com/robclark/kmscube/issues/12 and:

- https://stackoverflow.com/questions/26920835/can-egl-application-run-in-console-mode/26921287#26921287

- https://stackoverflow.com/questions/3804065/how-to-use-opengl-without-a-window-manager-in-linux/50669152#50669152

Tested on: 2903771275372ccfecc2b025edbb0d04c4016930