Codebase list kmscube / e888ea1
texturator: add command-line selection of video mode Extend also to texturator the command line flag to select the video mode. Signed-off-by: Antonio Borneo <antonio.borneo@st.com> Reviewed-by: Emil Velikov <emil.velikov@collabora.com> Antonio Borneo authored 4 years ago Antonio Borneo committed 4 years ago
1 changed file(s) with 23 addition(s) and 3 deletion(s). Raw diff Collapse all Expand all
794794 printf("FS:\n%s\n", get_fs());
795795 }
796796
797 static const char *shortopts = "D:e:fsz";
797 static const char *shortopts = "D:e:fsv:z";
798798
799799 static const struct option longopts[] = {
800800 {"device", required_argument, 0, 'D'},
801801 {"errors", required_argument, 0, 'e'},
802802 {"full", no_argument, 0, 'f'},
803803 {"stop", no_argument, 0, 's'},
804 {"vmode", required_argument, 0, 'v'},
804805 {"zoom", no_argument, 0, 'z'},
805806 #ifdef HAVE_LIBPNG
806807 {"png", no_argument, 0, 'p'},
810811
811812 static void usage(const char *name)
812813 {
813 printf("Usage: %1$s [-Dz] <target> <format> <minsize> [<maxsize>]\n"
814 printf("Usage: %1$s [-Dvz] <target> <format> <minsize> [<maxsize>]\n"
814815 "\n"
815816 "options:\n"
816817 " -D, --device=DEVICE use the given device\n"
817818 " -e, --errors=N stop after N frames with errors (default 5)\n"
818819 " -f, --full check all pixels (do not stop after first faulty pixel)\n"
819820 " -s, --stop exit after testing all sizes\n"
821 " -v, --vmode=VMODE specify the video mode in the format\n"
822 " <mode>[-<vrefresh>]\n"
820823 " -z, --zoom increase zoom (can be specified multiple times)\n"
821824 #ifdef HAVE_LIBPNG
822825 " -p, --png capture the screen to a png image\n"
852855 int main(int argc, char *argv[])
853856 {
854857 const char *device = "/dev/dri/card0";
858 char mode_str[DRM_DISPLAY_MODE_LEN] = "";
859 char *p;
855860 int ret, opt;
861 unsigned int len;
862 unsigned int vrefresh = 0;
856863
857864 while ((opt = getopt_long_only(argc, argv, shortopts, longopts, NULL)) != -1) {
858865 switch (opt) {
868875 case 's':
869876 stop = true;
870877 break;
878 case 'v':
879 p = strchr(optarg, '-');
880 if (p == NULL) {
881 len = strlen(optarg);
882 } else {
883 vrefresh = strtoul(p + 1, NULL, 0);
884 len = p - optarg;
885 }
886 if (len > sizeof(mode_str) - 1)
887 len = sizeof(mode_str) - 1;
888 strncpy(mode_str, optarg, len);
889 mode_str[len] = '\0';
890 break;
871891 case 'z':
872892 zoom++;
873893 break;
927947 print_summary();
928948
929949 /* no real need for atomic here: */
930 drm = init_drm_legacy(device, NULL, 0);
950 drm = init_drm_legacy(device, mode_str, vrefresh);
931951 if (!drm) {
932952 printf("failed to initialize DRM\n");
933953 return -1;