Commit graph

1 commit

Author SHA1 Message Date
cmitu
f113a80f36 runcommand: add new 'kms' videomode utility
Replaced the `mesa-drm` scriptmodule and the `modetest` utility with a new program, based on the [kmsxx](https://github.com/tomba/kmsxx) project.

1. Added a new scriptmodule to install the new modesetting utilities:

 * kmsblank - blank screen(s)
 * kmstest - set modes and planes and show test pattern on crtcs/planes,
    and test page flips
 * kmsprint(-rp) - print information about DRM objects (connectors, encoders, video modes, crtcs)
 * fbtest - show info about the console framebuffer

It's based on https://github.com/tomba/kmsxx, forked to add a custom `kmsprint-rp` utility which we can use in `runcommand` instead of `modetest`.

Advantages over `modetest`:

 - it's based on a simpler standalone project and not part of Mesa, less code.
 - it's has a modularized C++ API for working with Cards/Encoders/Connectors/CRTCs/etc, modeled after the DRM API entities
 - works with any DRM/KMS card and doesn't have any card specific code like `modetest`
 - it's faster than modetest (both when KMS is enabled or disabled)
 - can print the analog video modes when the 'composite' output is enabled for RPI. I think `modetest` can be modified to support it, but with `kmsxx` is working without any special handling.

 Note that a Debian package of the `kmsxx` upstream project is packaged in Rasberry PI OS (as `kms++-utils`), but it's not part of Debian. Packaging it as part of RetroPie helps with:
   - integration with `runcommand`, since we can run our own custom query utility
   - resolution switching on other KMS platforms

2. Changes to `runcommand`:

  - replaced `modetest` with `kmsprint-rp`. The format for the modeline printing has changed a bit, to make it easier to parse and integrate the result in `runcommand`. In addition to the rounded/integral refresh rate, there's a new column to show a decimal refresh rate; the _[p|n][h|v]sync_ flags have been reformatted as _[h|v]sync[-|+]_.
  - simplified the modeline parsing for KMS, taking advantage of the new format
  - refresh rate (from KMS modeline) is now be a decimal number (.2f), supported by RetroArch
2024-01-23 16:58:31 +00:00