[Intel-gfx] [PATCH] test/testdisplay:add cursor test

2011-10-22 Thread Hai Lan
Signed-off-by: Hai Lan hai@intel.com
---
 tests/testdisplay.c |   32 +---
 1 files changed, 25 insertions(+), 7 deletions(-)

diff --git a/tests/testdisplay.c b/tests/testdisplay.c
index 01f31dc..174d5c7 100644
--- a/tests/testdisplay.c
+++ b/tests/testdisplay.c
@@ -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;i64*64*4;i++)
+   *(cursor_buff+i)=0xff;
+
+   drmModeSetCursor(fd,c-crtc,cursor_handle,64,64);
+   for(int i=0;i10;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\tduration\tsleep between each mode test\n);
@@ -959,6 +973,7 @@ static void usage(char *name)
fprintf(stderr, \t-f\tclock 
MHz,hdisp,hsync-start,hsync-end,htotal,\n);
fprintf(stderr, \t\tvdisp,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++) {
-- 
1.7.0.1

___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PATCH] test/testdisplay:add cursor test

2011-10-22 Thread Paul Menzel
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?

 Signed-off-by: Hai Lan hai@intel.com
 ---
  tests/testdisplay.c |   32 +---
  1 files changed, 25 insertions(+), 7 deletions(-)
 
 diff --git a/tests/testdisplay.c b/tests/testdisplay.c
 index 01f31dc..174d5c7 100644
 --- a/tests/testdisplay.c
 +++ b/tests/testdisplay.c
 @@ -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;

Missing space?

   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;i64*64*4;i++)
 + *(cursor_buff+i)=0xff;
 +
 + drmModeSetCursor(fd,c-crtc,cursor_handle,64,64);
 + for(int i=0;i10;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\tduration\tsleep between each mode test\n);
 @@ -959,6 +973,7 @@ static void usage(char *name)
   fprintf(stderr, \t-f\tclock 
 MHz,hdisp,hsync-start,hsync-end,htotal,\n);
   fprintf(stderr, \t\tvdisp,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++) {


Thanks,

Paul


signature.asc
Description: This is a digitally signed message part
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PATCH] test/testdisplay:add cursor test

2011-10-22 Thread Lan, Hai
 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
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PATCH] test/testdisplay:add cursor test

2011-10-22 Thread Eugeni Dodonov
On Oct 22, 2011 10:13 AM, Hai Lan hai@intel.com wrote:

 Signed-off-by: Hai Lan hai@intel.com

I like this one, simple and functional.

Reviewed-by: Eugeni Dodonov eugeni.dodo...@intel.com
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx