main: use --fbdev options to switch between DRM/fbdev
The new --fbdev option allows runtime switching between the two backends. That is, we only use fbdev devices when --fbdev is given. Otherwise, DRM is used. Technically, it would also be possible to use both. However, almost every DRM device does also register an fbdev device for backwards compatibility. Therefore, we must avoid using both, the DRM and fbdev device of the same display at the same time. As this would also mean dealing with failures in one backend and then switching to the other, we avoid this for complexity reasons. Who needs fbdev and drm simultaneously, anyway? Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
This commit is contained in:
parent
2d84eaad38
commit
4fb2f85f67
@ -67,6 +67,9 @@ static void print_help()
|
||||
"\t-t, --term <TERM> Value of the TERM environment variable\n"
|
||||
"\t for the child process\n"
|
||||
"\n"
|
||||
"Video Options:\n"
|
||||
"\t --fbdev Use fbdev instead of DRM\n"
|
||||
"\n"
|
||||
"Input Device Options:\n"
|
||||
"\t --xkb-layout <layout> Set XkbLayout for input devices\n"
|
||||
"\t --xkb-variant <variant> Set XkbVariant for input devices\n"
|
||||
@ -84,6 +87,7 @@ int conf_parse_argv(int argc, char **argv)
|
||||
{ "debug", no_argument, &conf_global.debug, 1 },
|
||||
{ "silent", no_argument, &conf_global.silent, 1 },
|
||||
{ "switchvt", no_argument, NULL, 's' },
|
||||
{ "fbdev", no_argument, &conf_global.use_fbdev, 1 },
|
||||
{ "xkb-layout", required_argument, NULL, 1001 },
|
||||
{ "xkb-variant", required_argument, NULL, 1002 },
|
||||
{ "xkb-options", required_argument, NULL, 1003 },
|
||||
|
@ -53,6 +53,8 @@ struct conf_obj {
|
||||
int silent;
|
||||
/* enter new VT directly */
|
||||
int switchvt;
|
||||
/* use framebuffers instead of DRM */
|
||||
int use_fbdev;
|
||||
|
||||
/* input KBD layout */
|
||||
const char *xkb_layout;
|
||||
|
21
src/main.c
21
src/main.c
@ -151,15 +151,23 @@ static void seat_free(struct kmscon_seat *seat)
|
||||
|
||||
static void seat_add_video(struct kmscon_seat *seat,
|
||||
struct uterm_monitor_dev *dev,
|
||||
unsigned int type,
|
||||
const char *node)
|
||||
{
|
||||
int ret;
|
||||
unsigned int mode;
|
||||
|
||||
if (seat->video)
|
||||
return;
|
||||
if ((type == UTERM_MONITOR_FBDEV) != !!conf_global.use_fbdev)
|
||||
return;
|
||||
|
||||
ret = uterm_video_new(&seat->video, seat->app->eloop, UTERM_VIDEO_DRM,
|
||||
node);
|
||||
if (conf_global.use_fbdev)
|
||||
mode = UTERM_VIDEO_FBDEV;
|
||||
else
|
||||
mode = UTERM_VIDEO_DRM;
|
||||
|
||||
ret = uterm_video_new(&seat->video, seat->app->eloop, mode, node);
|
||||
if (ret)
|
||||
return;
|
||||
|
||||
@ -211,8 +219,10 @@ static void monitor_event(struct uterm_monitor *mon,
|
||||
seat = ev->seat_data;
|
||||
if (!seat)
|
||||
break;
|
||||
if (ev->dev_type == UTERM_MONITOR_DRM)
|
||||
seat_add_video(seat, ev->dev, ev->dev_node);
|
||||
if (ev->dev_type == UTERM_MONITOR_DRM ||
|
||||
ev->dev_type == UTERM_MONITOR_FBDEV)
|
||||
seat_add_video(seat, ev->dev, ev->dev_type,
|
||||
ev->dev_node);
|
||||
else if (ev->dev_type == UTERM_MONITOR_INPUT)
|
||||
uterm_input_add_dev(seat->input, ev->dev_node);
|
||||
break;
|
||||
@ -220,7 +230,8 @@ static void monitor_event(struct uterm_monitor *mon,
|
||||
seat = ev->seat_data;
|
||||
if (!seat)
|
||||
break;
|
||||
if (ev->dev_type == UTERM_MONITOR_DRM)
|
||||
if (ev->dev_type == UTERM_MONITOR_DRM ||
|
||||
ev->dev_type == UTERM_MONITOR_FBDEV)
|
||||
seat_rm_video(seat, ev->dev);
|
||||
else if (ev->dev_type == UTERM_MONITOR_INPUT)
|
||||
uterm_input_remove_dev(seat->input, ev->dev_node);
|
||||
|
Loading…
x
Reference in New Issue
Block a user