testdisplay: Allow to specify the dpms level

aka the jbarnes-me-harder mode

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
This commit is contained in:
Daniel Vetter 2014-02-13 19:22:35 +01:00
parent 30cfde5822
commit cef9b31a24

View File

@ -75,7 +75,7 @@ int drm_fd, modes;
int test_all_modes = 0, test_preferred_mode = 0, force_mode = 0, test_plane, int test_all_modes = 0, test_preferred_mode = 0, force_mode = 0, test_plane,
test_stereo_modes, enable_tiling; test_stereo_modes, enable_tiling;
int sleep_between_modes = 5; int sleep_between_modes = 5;
bool do_dpms = false; int do_dpms = 0; /* This aliases to DPMS_ON */
uint32_t depth = 24, stride, bpp; uint32_t depth = 24, stride, bpp;
int qr_code = 0; int qr_code = 0;
int specified_mode_num = -1, specified_disp_id = -1; int specified_mode_num = -1, specified_disp_id = -1;
@ -429,7 +429,7 @@ set_mode(struct connector *c)
sleep(sleep_between_modes); sleep(sleep_between_modes);
if (do_dpms) { if (do_dpms) {
set_connector_dpms(c->connector, DRM_MODE_DPMS_OFF); set_connector_dpms(c->connector, do_dpms);
sleep(sleep_between_modes); sleep(sleep_between_modes);
set_connector_dpms(c->connector, DRM_MODE_DPMS_ON); set_connector_dpms(c->connector, DRM_MODE_DPMS_ON);
} }
@ -696,7 +696,7 @@ int update_display(void)
return 1; return 1;
} }
static char optstr[] = "3hiaf:s:d:p:mrto:j"; static char optstr[] = "3hiaf:s:d:p:mrto:j:";
static void __attribute__((noreturn)) usage(char *name) static void __attribute__((noreturn)) usage(char *name)
{ {
@ -709,7 +709,7 @@ static void __attribute__((noreturn)) usage(char *name)
fprintf(stderr, "\t-m\ttest the preferred mode\n"); fprintf(stderr, "\t-m\ttest the preferred mode\n");
fprintf(stderr, "\t-3\ttest all 3D modes\n"); fprintf(stderr, "\t-3\ttest all 3D modes\n");
fprintf(stderr, "\t-t\tuse a tiled framebuffer\n"); fprintf(stderr, "\t-t\tuse a tiled framebuffer\n");
fprintf(stderr, "\t-j\tdo dpms off\n"); fprintf(stderr, "\t-j\tdo dpms off, optional arg to select dpms leve (1-3)\n");
fprintf(stderr, "\t-r\tprint a QR code on the screen whose content is \"pass\" for the automatic test\n"); fprintf(stderr, "\t-r\tprint a QR code on the screen whose content is \"pass\" for the automatic test\n");
fprintf(stderr, "\t-o\t<id of the display>,<number of the mode>\tonly test specified mode on the specified display\n"); fprintf(stderr, "\t-o\t<id of the display>,<number of the mode>\tonly test specified mode on the specified display\n");
fprintf(stderr, "\t-f\t<clock MHz>,<hdisp>,<hsync-start>,<hsync-end>,<htotal>,\n"); fprintf(stderr, "\t-f\t<clock MHz>,<hdisp>,<hsync-start>,<hsync-end>,<htotal>,\n");
@ -792,7 +792,9 @@ int main(int argc, char **argv)
sleep_between_modes = atoi(optarg); sleep_between_modes = atoi(optarg);
break; break;
case 'j': case 'j':
do_dpms = true; do_dpms = atoi(optarg);
if (do_dpms == 0)
do_dpms = DRM_MODE_DPMS_OFF;
break; break;
case 'd': case 'd':
depth = atoi(optarg); depth = atoi(optarg);