pipe-loader: make get_driver_descriptor() return NULL for unknown driver

Currently for unknown drivers names, get_driver_descriptor() will never
return NULL, but the driver descriptor of kmsro will be returned.
However, kmsro is meaningless when the input FD isn't a KMS-capable one.

Add the kmsro descriptor to the descriptor list, and stop to return it
for unknown names (it will still be returned for "kmsro", which the
fallback codepath in pipe_loader_drm_probe_fd_nodup() will use).

Signed-off-by: Icenowy Zheng <uwu@icenowy.me>
Reviewed-By: Daniel Stone <daniels@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38810>
This commit is contained in:
Icenowy Zheng 2025-12-17 22:04:50 +08:00 committed by Marge Bot
parent 547d7f254d
commit 2c62256ca9

View file

@ -89,6 +89,7 @@ static const struct drm_driver_descriptor *driver_descriptors[] = {
&tegra_driver_descriptor,
&lima_driver_descriptor,
&zink_driver_descriptor,
&kmsro_driver_descriptor,
};
static const struct drm_driver_descriptor *
@ -98,7 +99,7 @@ get_driver_descriptor(const char *driver_name)
if (strcmp(driver_descriptors[i]->driver_name, driver_name) == 0)
return driver_descriptors[i];
}
return &kmsro_driver_descriptor;
return NULL;
}
static int