kmscon: add --video-devices option

If all the auto-detection logic of kmscon still does something you don't
want, you can now use this list to override all this logic with a
statically configured white-list.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
This commit is contained in:
David Herrmann 2012-10-28 16:02:28 +01:00
parent fb2006fe9a
commit a9c61f7644
3 changed files with 21 additions and 0 deletions

View File

@ -120,6 +120,9 @@ static void print_help()
"\t Create new terminal session\n"
"\n"
"Video Options:\n"
"\t --video-devices <d1,d2> [all] List of video devices to be used\n"
"\t by kmscon. This can be a list of\n"
"\t paths to /dev/* or \"all\"\n"
"\t --drm [on] Use DRM if available\n"
"\t --hwaccel [off] Use 3D hardware-acceleration if\n"
"\t available\n"
@ -400,6 +403,8 @@ static int aftercheck_drm(struct conf_option *opt, int argc, char **argv,
static char *def_seats[] = { "seat0", NULL };
static char *def_video_devices[] = { "all", NULL };
static struct conf_grab def_grab_scroll_up =
CONF_SINGLE_GRAB(SHL_SHIFT_MASK, XKB_KEY_Up);
@ -478,6 +483,7 @@ int kmscon_conf_new(struct conf_ctx **out)
CONF_OPTION_GRAB(0, "grab-terminal-new", &conf->grab_terminal_new, &def_grab_terminal_new),
/* Video Options */
CONF_OPTION_STRING_LIST(0, "video-devices", &conf->video_devices, def_video_devices),
CONF_OPTION_BOOL_FULL(0, "drm", aftercheck_drm, NULL, NULL, &conf->drm, true),
CONF_OPTION_BOOL(0, "hwaccel", &conf->hwaccel, false),
CONF_OPTION_BOOL(0, "primary-gpu-only", &conf->primary_gpu_only, false),

View File

@ -107,6 +107,8 @@ struct kmscon_conf_t {
struct conf_grab *grab_terminal_new;
/* Video Options */
/* whitelist of usable video devices or "all" */
char **video_devices;
/* use DRM if available */
bool drm;
/* use 3D hardware-acceleration if available */

View File

@ -207,6 +207,19 @@ static bool app_seat_is_ignored(struct app_seat *seat,
bool aux,
const char *node)
{
unsigned int i;
if (!shl_string_list_is(seat->conf->video_devices, "all")) {
for (i = 0; seat->conf->video_devices[i]; ++i) {
if (!strcmp(seat->conf->video_devices[i], node))
return false;
}
log_info("ignoring video device %s on seat %s as it is not in the whitelist",
node, seat->name);
return true;
}
switch (type) {
case UTERM_MONITOR_FBDEV:
if (seat->conf->drm) {