Skip to contentSkip to conversation

tests/testdisplay: Specify the display.

PATCH In review Yi Sun 2 participants 5 messages Dec 26, 2012 – Dec 27, 2012

lore
Share & tools
lore

Yi Sun

author
#0 lore raw

PATCH v2 1/1 tests/testdisplay: Specify the display.

It can specify the display when use option '-o'.
E.g. command "./testdiplay -o 1,4" means setting number 4 mode line on the number 1 display.

v2. Specify the display by id which can be got from option '-i'

tests/testdisplay.c +6 -3
index 7287487..7aef940 100644
@@ -72,7 +72,7 @@ int dump_info = 0, test_all_modes =0, test_preferred_mode = 0, force_mode = 0,
 int sleep_between_modes = 5;
 uint32_t depth = 24, stride, bpp;
 int qr_code = 0;
-int only_one_mode = 0, specified_mode_num = 0;
+int only_one_mode = 0, specified_mode_num = 0, specified_disp_id = 0;
 
 drmModeModeInfo force_timing;
 
@@ -598,6 +598,9 @@ int update_display(void)
 		/* Find any connected displays */
 		for (c = 0; c < resources->count_connectors; c++) {
 			connectors[c].id = resources->connectors[c];
+			if ( connectors[c].id != specified_disp_id )
+				continue;
+
 			set_mode(&connectors[c]);
 		}
 	}
@@ -618,7 +621,7 @@ static void __attribute__((noreturn)) usage(char *name)
 	fprintf(stderr, "\t-m\ttest the preferred mode\n");
 	fprintf(stderr, "\t-t\tuse a tiled framebuffer\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<number of the mode>\tonly test specified mode\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\t<vdisp>,<vsync-start>,<vsync-end>,<vtotal>\n");
 	fprintf(stderr, "\t\ttest force mode\n");
@@ -715,7 +718,7 @@ int main(int argc, char **argv)
 			break;
 		case 'o':
 			only_one_mode = 1;
-			specified_mode_num = atoi(optarg);
+			sscanf(optarg, "%d,%d", &specified_disp_id, &specified_mode_num);
 			break;
 		default:
 			fprintf(stderr, "unknown option %c\n", c);
Signature · 1 line
1.7.6.4
#1 lore raw
Quoted 4 lines · On Wed, 26 Dec 2012 17:22:57 +0800 Yi Sun <[email protected]> wrote:

It can specify the display when use option '-o'.
E.g. command "./testdiplay -o 1,4" means setting number 4 mode line on the number 1 display.

v2. Specify the display by id which can be got from option '-i'

where?

Quoted 44 lines
tests/testdisplay.c +6 -3
index 7287487..7aef940 100644
@@ -72,7 +72,7 @@ int dump_info = 0, test_all_modes =0, test_preferred_mode = 0, force_mode = 0,
 int sleep_between_modes = 5;
 uint32_t depth = 24, stride, bpp;
 int qr_code = 0;
-int only_one_mode = 0, specified_mode_num = 0;
+int only_one_mode = 0, specified_mode_num = 0, specified_disp_id = 0;
 
 drmModeModeInfo force_timing;
 
@@ -598,6 +598,9 @@ int update_display(void)
 		/* Find any connected displays */
 		for (c = 0; c < resources->count_connectors; c++) {
 			connectors[c].id = resources->connectors[c];
+			if ( connectors[c].id != specified_disp_id )
+				continue;
+
 			set_mode(&connectors[c]);
 		}
 	}
@@ -618,7 +621,7 @@ static void __attribute__((noreturn)) usage(char *name)
 	fprintf(stderr, "\t-m\ttest the preferred mode\n");
 	fprintf(stderr, "\t-t\tuse a tiled framebuffer\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<number of the mode>\tonly test specified mode\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\t<vdisp>,<vsync-start>,<vsync-end>,<vtotal>\n");
 	fprintf(stderr, "\t\ttest force mode\n");
@@ -715,7 +718,7 @@ int main(int argc, char **argv)
 			break;
 		case 'o':
 			only_one_mode = 1;
-			specified_mode_num = atoi(optarg);
+			sscanf(optarg, "%d,%d", &specified_disp_id, &specified_mode_num);
 			break;
 		default:
 			fprintf(stderr, "unknown option %c\n", c);
Signature · 1 line
Ben Widawsky, Intel Open Source Technology Center
author
#2 lore raw

Thanks

    --Sun, Yi
Quoted 10 lines

-----Original Message-----
From: Ben Widawsky [mailto:[email protected]]
Sent: Thursday, December 27, 2012 2:56 AM
To: Sun, Yi
Cc: [email protected]
Subject: Re: [Intel-gfx] [PATCH v2] tests/testdisplay: Specify the display.

On Wed, 26 Dec 2012 17:22:57 +0800
Yi Sun <[email protected]> wrote:

Quoted 7 lines
Quoted 2 lines

It can specify the display when use option '-o'.
E.g. command "./testdiplay -o 1,4" means setting number 4 mode line on the

number 1 display.

Quoted 2 lines

v2. Specify the display by id which can be got from option '-i'

where?

[Sun, Yi] Run ./testdisplay -i , we can got following:
Connectors:

id      encoder status          type    size (mm)       modes
7       0       disconnected    VGA     0x0             0
10      0       disconnected    HDMI-A  0x0             0
13      0       disconnected    DisplayPort     0x0             0
16      0       disconnected    HDMI-A  0x0             0
18      17      connected       HDMI-A  480x270         31

modes:
name refresh (Hz) hdisp hss hse htot vdisp vss vse vtot flags type clock
......

I meant we can specify a display by the connector id which list as the first column.

Thanks

	--Sun, Yi
Quoted 54 lines

tests/testdisplay.c static void __attribute__((noreturn)) usage(char

Quoted 27 lines
tests/testdisplay.c index renamed from tests/testdisplay.c +0 -0

7287487..7aef940 100644

tests/testdisplay.c +0 -0
@@ -72,7 +72,7 @@ int dump_info = 0, test_all_modes =0,
 test_preferred_mode = 0, force_mode = 0,  int sleep_between_modes = 5;

uint32_t depth = 24, stride, bpp; int qr_code = 0; -int only_one_mode = 0, specified_mode_num = 0;

tests/testdisplay.c +4 -0
+int only_one_mode = 0, specified_mode_num = 0, specified_disp_id = 0;
 
 drmModeModeInfo force_timing;
@@ -598,6 +598,9 @@ int update_display(void)
 		/* Find any connected displays */
 		for (c = 0; c < resources->count_connectors; c++) {
 			connectors[c].id = resources->connectors[c];
+			if ( connectors[c].id != specified_disp_id )
+				continue;
+
 			set_mode(&connectors[c]);
 		}
 	}
@@ -618,7 +621,7 @@ static void __attribute__((noreturn)) usage(char

*name)

tests/testdisplay.c static void __attribute__((noreturn)) usage(char *name)

Quoted 3 lines
tests/testdisplay.c +0 -0
 	fprintf(stderr, "\t-m\ttest the preferred mode\n");
 	fprintf(stderr, "\t-t\tuse a tiled framebuffer\n");
 	fprintf(stderr, "\t-r\tprint a QR code on the screen whose content is

\"pass\" for the automatic test\n");

tests/testdisplay.c static void __attribute__((noreturn)) usage(char · line 626

Quoted 4 lines
tests/testdisplay.c +2 -1
-	fprintf(stderr, "\t-o\t<number of the mode>\tonly test specified mode\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");

tests/testdisplay.c int main(int argc, char **argv)

Quoted 8 lines
tests/testdisplay.c +0 -0
 	fprintf(stderr, "\t\t<vdisp>,<vsync-start>,<vsync-end>,<vtotal>\n");
 	fprintf(stderr, "\t\ttest force mode\n"); @@ -715,7 +718,7 @@ int

main(int argc, char **argv)

tests/testdisplay.c +1 -1
 			break;
 		case 'o':
 			only_one_mode = 1;
-			specified_mode_num = atoi(optarg);
+			sscanf(optarg, "%d,%d", &specified_disp_id,

&specified_mode_num);

tests/testdisplay.c int main(int argc, char **argv) · line 724

Quoted 3 lines
tests/testdisplay.c +0 -0
 			break;
 		default:
 			fprintf(stderr, "unknown option %c\n", c);

--
Ben Widawsky, Intel Open Source Technology Center

#3 lore raw
Quoted 4 lines · Yi

Thanks

    --Sun, Yi

Ah, misunderstood the commit message. It looks good to me. Do you have push access?

Quoted 99 lines
Quoted 12 lines

-----Original Message-----
From: Ben Widawsky [mailto:[email protected]]
Sent: Thursday, December 27, 2012 2:56 AM
To: Sun, Yi
Cc: [email protected]
Subject: Re: [Intel-gfx] [PATCH v2] tests/testdisplay: Specify the display.

On Wed, 26 Dec 2012 17:22:57 +0800
Yi Sun <[email protected]> wrote:

Quoted 8 lines
Quoted 3 lines

It can specify the display when use option '-o'. E.g. command "./testdiplay -o 1,4" means setting number 4 mode line on the

number 1 display.

Quoted 2 lines

v2. Specify the display by id which can be got from option '-i'

where?

[Sun, Yi] Run ./testdisplay -i , we can got following:
Connectors:

id      encoder status          type    size (mm)       modes
7       0       disconnected    VGA     0x0             0
10      0       disconnected    HDMI-A  0x0             0
13      0       disconnected    DisplayPort     0x0             0
16      0       disconnected    HDMI-A  0x0             0
18      17      connected       HDMI-A  480x270         31

modes:
name refresh (Hz) hdisp hss hse htot vdisp vss vse vtot flags type
clock ......

I meant we can specify a display by the connector id which list as the first column.

Thanks

	--Sun, Yi
Quoted 61 lines
Quoted 29 lines
tests/testdisplay.c index renamed from tests/testdisplay.c +0 -0

7287487..7aef940 100644

tests/testdisplay.c +0 -0
@@ -72,7 +72,7 @@ int dump_info = 0, test_all_modes =0,

test_preferred_mode = 0, force_mode = 0, int sleep_between_modes = 5; uint32_t depth = 24, stride, bpp; int qr_code = 0; -int only_one_mode = 0, specified_mode_num = 0;
+int only_one_mode = 0, specified_mode_num = 0, specified_disp_id = 0;

drmModeModeInfo force_timing;

tests/testdisplay.c +3 -0
@@ -598,6 +598,9 @@ int update_display(void)
 		/* Find any connected displays */
 		for (c = 0; c < resources->count_connectors;
 c++) { connectors[c].id = resources->connectors[c];
+			if ( connectors[c].id !=
 specified_disp_id )
+				continue;
+
 			set_mode(&connectors[c]);
 		}
tests/testdisplay.c +0 -0
 	}
@@ -618,7 +621,7 @@ static void __attribute__((noreturn))
Quoted 1 line

usage(char

*name)

Quoted 4 lines
tests/testdisplay.c +0 -0
 	fprintf(stderr, "\t-m\ttest the preferred mode\n");
 	fprintf(stderr, "\t-t\tuse a tiled framebuffer\n");
 	fprintf(stderr, "\t-r\tprint a QR code on the screen

whose content is

\"pass\" for the automatic test\n");

tests/testdisplay.c

Quoted 5 lines
tests/testdisplay.c +0 -1
-	fprintf(stderr, "\t-o\t<number of the mode>\tonly test

specified mode\n");

tests/testdisplay.c +2 -0
+	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");

Quoted 9 lines

fprintf(stderr,
"\t\t<vdisp>,<vsync-start>,<vsync-end>,<vtotal>\n"); fprintf(stderr, "\t\ttest force mode\n"); @@ -715,7 +718,7 @@ int main(int argc, char **argv) break;

tests/testdisplay.c +1 -1
 		case 'o':
 			only_one_mode = 1;
-			specified_mode_num = atoi(optarg);
+			sscanf(optarg, "%d,%d",

&specified_disp_id,

&specified_mode_num);

Quoted 4 lines
tests/testdisplay.c +0 -0
 			break;
 		default:
 			fprintf(stderr, "unknown option %c\n",

c);

--
Ben Widawsky, Intel Open Source Technology Center

author
#4 lore raw
Quoted 12 lines

-----Original Message-----
From: Ben Widawsky [mailto:[email protected]]
Sent: Thursday, December 27, 2012 11:04 AM
To: Sun, Yi
Cc: [email protected]
Subject: Re: [Intel-gfx] [PATCH v2] tests/testdisplay: Specify the display.

Quoted 2 lines · Yi
Quoted 6 lines
Quoted 2 lines

Thanks

    --Sun, Yi

Ah, misunderstood the commit message. It looks good to me. Do you have push access?

[Sun, Yi] Ok, pushed. My first patch pushing. :) Thank Ben for your review.

Thanks

	--Sun, Yi