Skip to content

Commit

Permalink
kmscon: add --primary-gpu-only and --all-gpus options
Browse files Browse the repository at this point in the history
By default, kmscon now only uses primary und auxiliary displays. All
uncategorized displays are ignored. This fixes problems with dual-GPU
systems.

--primary-gpu-only makes kmscon not use any auxiliary displays. --all-gpus
makes kmscon also use uncategorized displays.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
  • Loading branch information
David Herrmann committed Oct 27, 2012
1 parent dbd5fa7 commit 5be8972
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/kmscon_conf.c
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,8 @@ static void print_help()
"\t --fbdev [off] Use fbdev instead of DRM\n"
"\t --dumb [off] Use dumb DRM instead of hardware-\n"
"\t accelerated DRM devices\n"
"\t --primary-gpu-only [off] Use primary GPU only\n"
"\t --all-gpus [off] Use all GPUs unconditionally\n"
"\t --fps [50] Limit frame-rate\n"
"\t --render-engine <eng> [-] Console renderer\n"
"\t --render-timing [off] Print renderer timing information\n"
Expand Down Expand Up @@ -480,6 +482,8 @@ int kmscon_conf_new(struct conf_ctx **out)
/* Video Options */
CONF_OPTION_BOOL(0, "fbdev", &conf->fbdev, false),
CONF_OPTION_BOOL(0, "dumb", &conf->dumb, false),
CONF_OPTION_BOOL(0, "primary-gpu-only", &conf->primary_gpu_only, false),
CONF_OPTION_BOOL(0, "all-gpus", &conf->all_gpus, false),
CONF_OPTION_UINT(0, "fps", &conf->fps, 50),
CONF_OPTION_STRING(0, "render-engine", &conf->render_engine, NULL),
CONF_OPTION_BOOL(0, "render-timing", &conf->render_timing, false),
Expand Down
4 changes: 4 additions & 0 deletions src/kmscon_conf.h
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,10 @@ struct kmscon_conf_t {
bool fbdev;
/* use dumb DRM devices */
bool dumb;
/* use only primary GPU */
bool primary_gpu_only;
/* use all GPUs unconditionally */
bool all_gpus;
/* frame-rate limit */
unsigned int fps;
/* render engine */
Expand Down
13 changes: 13 additions & 0 deletions src/kmscon_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,19 @@ static int app_seat_add_video(struct app_seat *seat,
}
}

if (!seat->conf->all_gpus) {
if (seat->conf->primary_gpu_only && !(flags & UTERM_MONITOR_PRIMARY)) {
log_info("ignoring video device %s on seat %s as it is no primary GPU",
node, seat->name);
return -ERANGE;
}
if (!(flags & (UTERM_MONITOR_PRIMARY | UTERM_MONITOR_AUX))) {
log_info("ignoring video device %s on seat %s as it is neither a primary nor auxiliary GPU",
node, seat->name);
return -ERANGE;
}
}

log_debug("new video device %s on seat %s", node, seat->name);

vid = malloc(sizeof(*vid));
Expand Down

0 comments on commit 5be8972

Please sign in to comment.