test/testdisplay:add cursor test
PATCH 1/1 test/testdisplay:add cursor test
--- tests/testdisplay.c | 32 +++++++++++++++++++++++++------- 1 files changed, 25 insertions(+), 7 deletions(-)
tests/testdisplay.c +25 -7
@@ -75,7 +75,7 @@ struct udev_monitor *uevent_monitor;drmModeRes *resources;int fd, modes;int dump_info =0 , test_all_modes =0 , test_preferred_mode =0 , force_mode =0 , - test_plane, enable_tiling; + test_plane, enable_tiling, test_cursor;int sleep_between_modes =5 ;uint32_t depth =24 ;
@@ -823,7 +823,7 @@ set_mode(struct connector *c)cairo_surface_t *surface;cairo_status_t status;cairo_t *cr; -uint32_t handle; +uint32_t handle,cursor_handle;if (test_all_modes) c->mode = c->connector->modes[j];
@@ -872,7 +872,6 @@ set_mode(struct connector *c) handle, &fb_id);cairo_surface_destroy (surface);gem_close (fd, handle); -if (ret) {fprintf (stderr,"failed to add fb (%dx%d): %s\n" , width, height,strerror (errno));
@@ -888,6 +887,21 @@ set_mode(struct connector *c)continue ; } +if (test_cursor) { + cursor_handle =gem_create (fd,64 *64 *4 ); +char * cursor_buff =gem_mmap (fd, cursor_handle,64 *64 *4 ,PROT_READ |PROT_WRITE ); +for (int i=0 ;i<64 *64 *4 ;i++) + *(cursor_buff+i)=0xff ; + +drmModeSetCursor (fd,c->crtc,cursor_handle,64 ,64 ); +for (int i=0 ;i<10 ;i++) { +drmModeMoveCursor (fd,c->crtc,i*100 ,0 ); +sleep (1 ); + } +drmModeSetCursor (fd,c->crtc,0 ,64 ,64 ); +gem_close (fd, cursor_handle); + } +if (test_plane)enable_plane (c);
@@ -931,7 +945,7 @@ static int update_display(void)dump_planes (); } -if (test_preferred_mode || test_all_modes || force_mode) { +if (test_preferred_mode || test_all_modes || force_mode || test_cursor) {/* Find any connected displays */ for (c =0 ; c < resources->count_connectors; c++) { connectors[c].id = resources->connectors[c];
@@ -944,11 +958,11 @@ static int update_display(void)extern char *optarg;extern int optind, opterr, optopt; -static char optstr[] ="hiaf:s:d:pmt" ; +static char optstr[] ="hiaf:s:d:pmtc" ;static void usage (char *name) { -fprintf (stderr,"usage: %s [-hiafs]\n" , name); +fprintf (stderr,"usage: %s [-hiaf:s:d:pmtc]\n" , name);fprintf (stderr,"\t-i\tdump info\n" );fprintf (stderr,"\t-a\ttest all modes\n" );fprintf (stderr,"\t-s\t<duration>\tsleep between each mode test\n" );
@@ -959,6 +973,7 @@ static void usage(char *name)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" ); +fprintf (stderr,"\t-c\ttest cursor\n" );fprintf (stderr,"\tDefault is to test all modes.\n" );exit (0 ); }
@@ -1048,6 +1063,9 @@ int main(int argc, char **argv)case 't' : enable_tiling =1 ;break ; +case 'c' : + test_cursor =1 ; +break ;default :fprintf (stderr,"unknown option %c\n" , c);/* fall through */
@@ -1057,7 +1075,7 @@ int main(int argc, char **argv) } }if (!test_all_modes && !force_mode && !dump_info && - !test_preferred_mode) + !test_preferred_mode && !test_cursor) test_all_modes =1 ;for (i =0 ; i <ARRAY_SIZE (modules); i++) {
Signature · 1 line
1.7.0.1
Dear Hai,
Am Samstag, den 22.10.2011, 22:03 -0400 schrieb Hai Lan:
what does this test do? For the unknowledgeable user what is supposed to happen, that means, when is the test successful and when not?
Quoted 19 lines
Signed-off-by Hai Lan <[email protected]>--- tests/testdisplay.c | 32 +++++++++++++++++++++++++------- 1 files changed, 25 insertions(+), 7 deletions(-)tests/testdisplay.c +1
-1@@ -75,7 +75,7 @@ struct udev_monitor *uevent_monitor;drmModeRes *resources;int fd, modes;int dump_info =0 , test_all_modes =0 , test_preferred_mode =0 , force_mode =0 , - test_plane, enable_tiling; + test_plane, enable_tiling, test_cursor;int sleep_between_modes =5 ;uint32_t depth =24 ;
tests/testdisplay.c set_mode(struct connector *c) · line 826
Quoted 5 lines
tests/testdisplay.c +1
-1@@ -823,7 +823,7 @@ set_mode(struct connector *c)cairo_surface_t *surface;cairo_status_t status;cairo_t *cr; -uint32_t handle; +uint32_t handle,cursor_handle;
Missing space?
Quoted 74 lines
tests/testdisplay.c +22
-4if (test_all_modes) c->mode = c->connector->modes[j];@@ -872,7 +872,6 @@ set_mode(struct connector *c) handle, &fb_id);cairo_surface_destroy (surface);gem_close (fd, handle); -if (ret) {fprintf (stderr,"failed to add fb (%dx%d): %s\n" , width, height,strerror (errno));@@ -888,6 +887,21 @@ set_mode(struct connector *c)continue ; } +if (test_cursor) { + cursor_handle =gem_create (fd,64 *64 *4 ); +char * cursor_buff =gem_mmap (fd, cursor_handle,64 *64 *4 ,PROT_READ |PROT_WRITE ); +for (int i=0 ;i<64 *64 *4 ;i++) + *(cursor_buff+i)=0xff ; + +drmModeSetCursor (fd,c->crtc,cursor_handle,64 ,64 ); +for (int i=0 ;i<10 ;i++) { +drmModeMoveCursor (fd,c->crtc,i*100 ,0 ); +sleep (1 ); + } +drmModeSetCursor (fd,c->crtc,0 ,64 ,64 ); +gem_close (fd, cursor_handle); + } +if (test_plane)enable_plane (c);@@ -931,7 +945,7 @@ static int update_display(void)dump_planes (); } -if (test_preferred_mode || test_all_modes || force_mode) { +if (test_preferred_mode || test_all_modes || force_mode || test_cursor) {/* Find any connected displays */ for (c =0 ; c < resources->count_connectors; c++) { connectors[c].id = resources->connectors[c];@@ -944,11 +958,11 @@ static int update_display(void)extern char *optarg;extern int optind, opterr, optopt; -static char optstr[] ="hiaf:s:d:pmt" ; +static char optstr[] ="hiaf:s:d:pmtc" ;static void usage (char *name) { -fprintf (stderr,"usage: %s [-hiafs]\n" , name); +fprintf (stderr,"usage: %s [-hiaf:s:d:pmtc]\n" , name);fprintf (stderr,"\t-i\tdump info\n" );fprintf (stderr,"\t-a\ttest all modes\n" );fprintf (stderr,"\t-s\t<duration>\tsleep between each mode test\n" );@@ -959,6 +973,7 @@ static void usage(char *name)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" ); +fprintf (stderr,"\t-c\ttest cursor\n" );fprintf (stderr,"\tDefault is to test all modes.\n" );exit (0 ); }@@ -1048,6 +1063,9 @@ int main(int argc, char **argv)case 't' : enable_tiling =1 ;break ; +case 'c' : + test_cursor =1 ; +break ;default :fprintf (stderr,"unknown option %c\n" , c);/* fall through */
tests/testdisplay.c int main(int argc, char **argv) · line 1081
Quoted 8 lines
tests/testdisplay.c +1
-1@@ -1057,7 +1075,7 @@ int main(int argc, char **argv) } }if (!test_all_modes && !force_mode && !dump_info && - !test_preferred_mode) + !test_preferred_mode && !test_cursor) test_all_modes =1 ;for (i =0 ; i <ARRAY_SIZE (modules); i++) {
Thanks,
Paul
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 3 lines
what does this test do? For the unknowledgeable user what is supposed to happen, that means, when is the test successful and when not?
I wrote this patch to test whether the cursor can work OK. It needs the tester to watch the screen. If the tester can see the white cursor move from left to right, it can prove that the cursor works OK. If not, the cursor driver is wrong.
Thanks
Hai Lan
Quoted 2 lines · Hai Lan
Signed-off-by Hai Lan <[email protected]>
I like this one, simple and functional.
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx