mesa-drm/tests/util
Marijn Suijten 887fec2c28
tests/util: Call drmGetDevices2() instead of drmOpen()ing all modules
Whenever `util_open()` is called to open a device for the first matching
module, it will skip devices for the `nvidia_drm` kernel module which
is not in the list.  We could add this module for now, but keeping this
list of DRM modules up to date is cumbersome.

At the same time walking a list of modules and calling `drmOpen()` for
each of them is incredibly expensive (when the user doesn't explicitly
specify one with `-M`), as each each call opens every DRM node just
to see if they are associated to the requested module.  And for no
good reason: all we want is the first `DRM_NODE_PRIMARY` (which is what
`drmOpen()` also returns) to use by default.

For example on the `"msm"` driver, which used to be the 9th in the
modules list, all nodes are opened for the 9th time before e.g.
`modetest` returns a useful result, which takes ages unless the user
painstakingly provides the module for the currently known device on
the cmdline.

This is very simply solved by calling `drmGetDevices(2)()`, which
iterates through all DRM nodes only once and allows us to immediately
find + `open()` the first device that has a PRIMARY node.  A random
search for the error shows that this was also attempted in (a fork of?)
kmscube:
https://git.ti.com/cgit/glsdk/kmscube/commit/?id=456cabc661caac5c60729751d45efd668faa8e97

Finally we add a `drmIsKMS()` check to make sure we only include primary
nodes that actually support rendering, and also print the values from
`drmGetVersion()` on success to make it easier to identify the device.

In the future we could extrapolate this feature by letting query
commands like `modetest -c` list connectors for every device/module, not
just the first PRIMARY node that we found.
2024-09-03 13:30:41 +02:00
..
Android.bp Convert to Android.bp 2024-07-29 14:47:30 -04:00
Android.sources.bp Convert to Android.bp 2024-07-29 14:47:30 -04:00
common.h tests: Split helpers into library 2015-12-18 17:43:40 +00:00
format.c util: add missing big-endian RGB16 frame buffer formats 2023-10-31 13:24:32 +00:00
format.h util: store number of colors for indexed formats 2023-10-24 09:44:21 +02:00
kms.c tests/util: Call drmGetDevices2() instead of drmOpen()ing all modules 2024-09-03 13:30:41 +02:00
kms.h tests: use drmModeGetConnectorTypeName 2022-07-02 20:13:29 +00:00
meson.build Add meson build system 2018-01-12 09:40:48 -08:00
pattern.c util: add pwetty support for big-endian RGB565 2023-10-31 13:24:32 +00:00
pattern.h util: factor out and optimize C8 SMPTE color LUT 2023-10-24 09:44:04 +02:00