Currently `machine video 7' will always list all available modes just like `machine video' before setting mode 7. Since the screen is reset/cleared when setting the mode, listing them beforehand is hardly ever useful and rather looks like flickering.
This diff avoids the described behaviour and seperates things more strictly/clearly. `machine video 7' won't list anymore but keeps printing the current/new mode *after* resetting the screen now. Otherwise behaviour and functionality stays unchanged. Successfully tested on two different amd64 ThinkPads. Style nit: Lines are kept <73 columns now. Comments? Feedback? Index: efiboot.c =================================================================== RCS file: /cvs/src/sys/arch/amd64/stand/efiboot/efiboot.c,v retrieving revision 1.23 diff -u -p -r1.23 efiboot.c --- efiboot.c 7 Aug 2017 19:34:53 -0000 1.23 +++ efiboot.c 2 Sep 2017 16:35:37 -0000 @@ -844,22 +844,25 @@ int Xvideo_efi(void) { int i, mode = -1; - char *p; - for (i = 0; i < nitems(efi_video) && i < conout->Mode->MaxMode; i++) { - if (efi_video[i].cols > 0) - printf("Mode %d: %d x %d\n", i, - efi_video[i].cols, efi_video[i].rows); - } - if (cmd.argc == 2) { - p = cmd.argv[1]; - mode = strtol(p, &p, 10); - } - printf("\nCurrent Mode = %d\n", conout->Mode->Mode); - if (0 <= mode && mode < i && efi_video[mode].cols > 0) { - EFI_CALL(conout->SetMode, conout, mode); - efi_video_reset(); + if (cmd.argc >= 2) { + mode = strtol(cmd.argv[1], NULL, 10); + if (0 <= mode && mode < nitems(efi_video) && + efi_video[mode].cols > 0) { + EFI_CALL(conout->SetMode, conout, mode); + efi_video_reset(); + } + } else { + for (i = 0; i < nitems(efi_video) && + i < conout->Mode->MaxMode; i++) { + if (efi_video[i].cols > 0) + printf("Mode %d: %d x %d\n", i, + efi_video[i].cols, + efi_video[i].rows); + } + printf("\n"); } + printf("Current Mode = %d\n", conout->Mode->Mode); return (0); }