[Intel-gfx] [I-G-T][PATCH] Add panning test for primary plane.

2014-05-22 Thread Yi Sun
Get CRCs of a full red and a full blue surface as reference.

Create a big framebuffer that is twice width and twice height as the
current display mode.

Fill the top left quarter with red, bottom right quarter with blue
Check the scanned out image with the CRTC at position (0, 0) of the
framebuffer and it should be the same CRC as the full red fb
Check the scanned out image with the CRTC at position (hdisplay,
vdisplay) and it should be the same CRC as the full blue fb

Signed-off-by: Lei Liu 
Signed-off-by: Yi Sun 

diff --git a/lib/igt_kms.c b/lib/igt_kms.c
index fffad9f..5cdc48b 100644
--- a/lib/igt_kms.c
+++ b/lib/igt_kms.c
@@ -532,6 +532,13 @@ void igt_display_init(igt_display_t *display, int drm_fd)
display->outputs = calloc(display->n_outputs, sizeof(igt_output_t));
igt_assert(display->outputs);
 
+   /*
+* Be default display can scan out from the original position of the 
frame buffer.
+* But we can change this position making display scan out with a 
offset.
+*/
+   display->buffer_x = 0;
+   display->buffer_y = 0;
+
for (i = 0; i < display->n_outputs; i++) {
igt_output_t *output = &display->outputs[i];
 
@@ -830,13 +837,13 @@ static int igt_output_commit(igt_output_t *output)
igt_output_name(output),
pipe_name(output->config.pipe),
fb_id,
-   0, 0,
+   display->buffer_x, display->buffer_y,
mode->hdisplay, mode->vdisplay);
 
ret = drmModeSetCrtc(display->drm_fd,
 crtc_id,
 fb_id,
-0, 0, /* x, y */
+display->buffer_x, 
display->buffer_y, /* x, y */
 &output->id,
 1,
 mode);
@@ -849,7 +856,7 @@ static int igt_output_commit(igt_output_t *output)
ret = drmModeSetCrtc(display->drm_fd,
 crtc_id,
 fb_id,
-0, 0, /* x, y */
+display->buffer_x, 
display->buffer_y, /* x, y */
 NULL, /* connectors */
 0,/* n_connectors */
 NULL  /* mode */);
@@ -987,6 +994,26 @@ void igt_plane_set_fb(igt_plane_t *plane, struct igt_fb 
*fb)
plane->fb_changed = true;
 }
 
+void igt_plane_set_fb_offset(igt_plane_t *plane, struct igt_fb *fb, int x, int 
y)
+{
+   igt_pipe_t *pipe = plane->pipe;
+   igt_display_t *display = pipe->display;
+
+   (*display).buffer_x = x;
+   (*display).buffer_y = y;
+
+   LOG(display, "%c.%d: plane_set_fb(%d)\n", pipe_name(pipe->pipe),
+   plane->index, fb ? fb->fb_id : 0);
+
+   plane->fb = fb;
+
+   if (plane->is_primary)
+   pipe->need_set_crtc = true;
+   else if (plane->is_cursor)
+   pipe->need_set_cursor = true;
+
+   plane->fb_changed = true;
+}
 void igt_plane_set_position(igt_plane_t *plane, int x, int y)
 {
igt_pipe_t *pipe = plane->pipe;
diff --git a/lib/igt_kms.h b/lib/igt_kms.h
index 439a634..cb9370e 100644
--- a/lib/igt_kms.h
+++ b/lib/igt_kms.h
@@ -139,6 +139,8 @@ struct igt_display {
int log_shift;
int n_pipes;
int n_outputs;
+   int buffer_x;
+   int buffer_y;
unsigned long pipes_in_use;
igt_output_t *outputs;
igt_pipe_t pipes[I915_MAX_PIPES];
diff --git a/tests/kms_plane.c b/tests/kms_plane.c
index 6bdbca3..6fcdadb 100644
--- a/tests/kms_plane.c
+++ b/tests/kms_plane.c
@@ -34,6 +34,12 @@
 #include "igt_kms.h"
 
 typedef struct {
+   float red;
+   float green;
+   float blue;
+} colour_t;
+
+typedef struct {
int drm_fd;
igt_display_t display;
 } data_t;
@@ -55,12 +61,19 @@ typedef struct {
igt_crc_t reference_crc;
 } test_position_t;
 
+//colour_t colour;
+
+enum {
+   TEST_POSITION_FULLY_COVERED = 1 << 0,
+   TEST_POSITION_BUFFER_ORIGINAL,
+};
+
 /*
  * create a green fb with a black rectangle at (rect_x,rect_y) and of size
  * (rect_w,rect_h)
  */
 static void
-create_fb_for_mode__position(data_t *data, drmModeModeInfo *mode,
+create_fb_for_mode_position(data_t *data, drmModeModeInfo *mode,
 double rect_x, double rect_y,
 double rect_w, double rect_h,
 struct igt_fb *fb /* out */)
@@ -84,13 +97

[Intel-gfx] [I-G-T][PATCH] Add panning test for primary plane.

2014-05-15 Thread Yi Sun
Get CRCs of a full red and a full blue surface as reference.

Create a big framebuffer that is twice width and twice height as the
current display mode.

Fill the top left quarter with red, bottom right quarter with blue
Check the scanned out image with the CRTC at position (0, 0) of the
framebuffer and it should be the same CRC as the full red fb
Check the scanned out image with the CRTC at position (hdisplay,
vdisplay) and it should be the same CRC as the full blue fb

Signed-off-by: Lei Liu 
Signed-off-by: Yi Sun 

diff --git a/lib/igt_kms.c b/lib/igt_kms.c
index fffad9f..5cdc48b 100644
--- a/lib/igt_kms.c
+++ b/lib/igt_kms.c
@@ -532,6 +532,13 @@ void igt_display_init(igt_display_t *display, int drm_fd)
display->outputs = calloc(display->n_outputs, sizeof(igt_output_t));
igt_assert(display->outputs);
 
+   /*
+* Be default display can scan out from the original position of the 
frame buffer.
+* But we can change this position making display scan out with a 
offset.
+*/
+   display->buffer_x = 0;
+   display->buffer_y = 0;
+
for (i = 0; i < display->n_outputs; i++) {
igt_output_t *output = &display->outputs[i];
 
@@ -830,13 +837,13 @@ static int igt_output_commit(igt_output_t *output)
igt_output_name(output),
pipe_name(output->config.pipe),
fb_id,
-   0, 0,
+   display->buffer_x, display->buffer_y,
mode->hdisplay, mode->vdisplay);
 
ret = drmModeSetCrtc(display->drm_fd,
 crtc_id,
 fb_id,
-0, 0, /* x, y */
+display->buffer_x, 
display->buffer_y, /* x, y */
 &output->id,
 1,
 mode);
@@ -849,7 +856,7 @@ static int igt_output_commit(igt_output_t *output)
ret = drmModeSetCrtc(display->drm_fd,
 crtc_id,
 fb_id,
-0, 0, /* x, y */
+display->buffer_x, 
display->buffer_y, /* x, y */
 NULL, /* connectors */
 0,/* n_connectors */
 NULL  /* mode */);
@@ -987,6 +994,26 @@ void igt_plane_set_fb(igt_plane_t *plane, struct igt_fb 
*fb)
plane->fb_changed = true;
 }
 
+void igt_plane_set_fb_offset(igt_plane_t *plane, struct igt_fb *fb, int x, int 
y)
+{
+   igt_pipe_t *pipe = plane->pipe;
+   igt_display_t *display = pipe->display;
+
+   (*display).buffer_x = x;
+   (*display).buffer_y = y;
+
+   LOG(display, "%c.%d: plane_set_fb(%d)\n", pipe_name(pipe->pipe),
+   plane->index, fb ? fb->fb_id : 0);
+
+   plane->fb = fb;
+
+   if (plane->is_primary)
+   pipe->need_set_crtc = true;
+   else if (plane->is_cursor)
+   pipe->need_set_cursor = true;
+
+   plane->fb_changed = true;
+}
 void igt_plane_set_position(igt_plane_t *plane, int x, int y)
 {
igt_pipe_t *pipe = plane->pipe;
diff --git a/lib/igt_kms.h b/lib/igt_kms.h
index 439a634..cb9370e 100644
--- a/lib/igt_kms.h
+++ b/lib/igt_kms.h
@@ -139,6 +139,8 @@ struct igt_display {
int log_shift;
int n_pipes;
int n_outputs;
+   int buffer_x;
+   int buffer_y;
unsigned long pipes_in_use;
igt_output_t *outputs;
igt_pipe_t pipes[I915_MAX_PIPES];
diff --git a/tests/kms_plane.c b/tests/kms_plane.c
index 6bdbca3..6fcdadb 100644
--- a/tests/kms_plane.c
+++ b/tests/kms_plane.c
@@ -34,6 +34,12 @@
 #include "igt_kms.h"
 
 typedef struct {
+   float red;
+   float green;
+   float blue;
+} colour_t;
+
+typedef struct {
int drm_fd;
igt_display_t display;
 } data_t;
@@ -55,12 +61,19 @@ typedef struct {
igt_crc_t reference_crc;
 } test_position_t;
 
+//colour_t colour;
+
+enum {
+   TEST_POSITION_FULLY_COVERED = 1 << 0,
+   TEST_POSITION_BUFFER_ORIGINAL,
+};
+
 /*
  * create a green fb with a black rectangle at (rect_x,rect_y) and of size
  * (rect_w,rect_h)
  */
 static void
-create_fb_for_mode__position(data_t *data, drmModeModeInfo *mode,
+create_fb_for_mode_position(data_t *data, drmModeModeInfo *mode,
 double rect_x, double rect_y,
 double rect_w, double rect_h,
 struct igt_fb *fb /* out */)
@@ -84,13 +97

[Intel-gfx] [PATCH] tests/testdisplay.c: Remove the variable only_one_mode.

2013-01-31 Thread Yi Sun
That variable is useless, instead the variables specified_mode_num and 
specified_disp_id can cover all the situation.
For parameter -o, all three instances should work:

./testdisplay -o 21,4 only test the 4th mode on the connector with id 21.
./testdisplay -o 21   test all the mode lines on the connector wiht id 21.
./testdisplay -o ,4   the -o is ignored, just like -a.

Signed-off-by: Yi Sun 

diff --git a/tests/testdisplay.c b/tests/testdisplay.c
index f2711ae..4d29ddb 100644
--- a/tests/testdisplay.c
+++ b/tests/testdisplay.c
@@ -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, specified_disp_id = 0;
+int specified_mode_num = -1, specified_disp_id = -1;
 
 drmModeModeInfo force_timing;
 
@@ -278,7 +278,7 @@ static void connector_find_preferred_mode(struct connector 
*c)
}
}
 
-   if ( only_one_mode ){
+   if ( specified_mode_num != -1 ){
c->mode = connector->modes[specified_mode_num];
if (c->mode.type & DRM_MODE_TYPE_PREFERRED)
c->mode_valid = 1;
@@ -327,7 +327,7 @@ static void connector_find_preferred_mode(struct connector 
*c)
c->crtc = resources->crtcs[i];
c->pipe = i;
 
-   if(test_preferred_mode || force_mode || only_one_mode)
+   if(test_preferred_mode || force_mode || specified_mode_num != -1)
resources->crtcs[i] = 0;
 
c->connector = connector;
@@ -594,11 +594,11 @@ int update_display(void)
dump_crtcs_fd(drm_fd);
}
 
-   if (test_preferred_mode || test_all_modes || force_mode || 
only_one_mode) {
+   if (test_preferred_mode || test_all_modes || force_mode || 
specified_disp_id != -1) {
/* Find any connected displays */
for (c = 0; c < resources->count_connectors; c++) {
connectors[c].id = resources->connectors[c];
-   if ( only_one_mode == 1 && connectors[c].id != 
specified_disp_id )
+   if ( specified_disp_id != -1 && connectors[c].id != 
specified_disp_id )
continue;
 
set_mode(&connectors[c]);
@@ -717,7 +717,6 @@ int main(int argc, char **argv)
qr_code = 1;
break;
case 'o':
-   only_one_mode = 1;
sscanf(optarg, "%d,%d", &specified_disp_id, 
&specified_mode_num);
break;
default:
@@ -729,7 +728,7 @@ int main(int argc, char **argv)
}
}
if (!test_all_modes && !force_mode && !dump_info &&
-   !test_preferred_mode && !only_one_mode)
+   !test_preferred_mode && specified_mode_num == -1)
test_all_modes = 1;
 
drm_fd = drm_open_any();
-- 
1.7.10.1

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


[Intel-gfx] [PATCH] tests/testdisplay.c: Fix the issue which don't display anything until '-o' given.

2013-01-12 Thread Yi Sun
Signed-off-by: Yi Sun 

diff --git a/tests/testdisplay.c b/tests/testdisplay.c
index 7aef940..f2711ae 100644
--- a/tests/testdisplay.c
+++ b/tests/testdisplay.c
@@ -598,7 +598,7 @@ 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 )
+   if ( only_one_mode == 1 && connectors[c].id != 
specified_disp_id )
continue;
 
set_mode(&connectors[c]);
-- 
1.7.6.4

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


[Intel-gfx] [PATCH v2] tests/testdisplay: Specify the display.

2012-12-26 Thread Yi Sun
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'

Signed-off-by: Yi Sun 

diff --git a/tests/testdisplay.c b/tests/testdisplay.c
index 7287487..7aef940 100644
--- a/tests/testdisplay.c
+++ b/tests/testdisplay.c
@@ -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\tonly test specified 
mode\n");
+   fprintf(stderr, "\t-o\t,\tonly 
test specified mode on the specified display\n");
fprintf(stderr, "\t-f\t,\n");
fprintf(stderr, "\t\t,,,\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);
-- 
1.7.6.4

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


[Intel-gfx] [PATCH] tests/testdisplay: Specify the display.

2012-12-25 Thread Yi Sun
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.

Signed-off-by: Yi Sun 

diff --git a/tests/testdisplay.c b/tests/testdisplay.c
index 7287487..dda4eaa 100644
--- a/tests/testdisplay.c
+++ b/tests/testdisplay.c
@@ -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_num = 0;
 
 drmModeModeInfo force_timing;
 
@@ -597,6 +597,8 @@ int update_display(void)
if (test_preferred_mode || test_all_modes || force_mode || 
only_one_mode) {
/* Find any connected displays */
for (c = 0; c < resources->count_connectors; c++) {
+   if ( c != specified_disp_num ) continue;
+
connectors[c].id = resources->connectors[c];
set_mode(&connectors[c]);
}
@@ -618,7 +620,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\tonly test specified 
mode\n");
+   fprintf(stderr, "\t-o\t,\tonly test specified mode on the specified display\n");
fprintf(stderr, "\t-f\t,\n");
fprintf(stderr, "\t\t,,,\n");
fprintf(stderr, "\t\ttest force mode\n");
@@ -715,7 +717,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_num, 
&specified_mode_num);
break;
default:
fprintf(stderr, "unknown option %c\n", c);
-- 
1.7.5.1

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


[Intel-gfx] [PATCH] Add option -o , which can test only one specified mode.

2012-09-25 Thread Yi Sun
Each mode line has a number just like '[i]'. So we can only test the specified 
mode with giving the number of mode to '-o' parameter.

Signed-off-by: Yi Sun 

diff --git a/tests/testdisplay.c b/tests/testdisplay.c
index c52bb2f..39c4265 100644
--- a/tests/testdisplay.c
+++ b/tests/testdisplay.c
@@ -72,6 +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;
 
 drmModeModeInfo force_timing;
 
@@ -193,8 +194,10 @@ static void dump_connectors_fd(int drmfd)
printf("  modes:\n");
printf("  name refresh (Hz) hdisp hss hse htot vdisp "
   "vss vse vtot flags type clock\n");
-   for (j = 0; j < connector->count_modes; j++)
+   for (j = 0; j < connector->count_modes; j++){
+   fprintf(stdout, "[%d]", j );
kmstest_dump_mode(&connector->modes[j]);
+   }
 
drmModeFreeConnector(connector);
}
@@ -275,6 +278,12 @@ static void connector_find_preferred_mode(struct connector 
*c)
}
}
 
+   if ( only_one_mode ){
+   c->mode = connector->modes[specified_mode_num];
+   if (c->mode.type & DRM_MODE_TYPE_PREFERRED)
+   c->mode_valid = 1;
+   }
+
if (!c->mode_valid) {
if (connector->count_modes > 0) {
/* use the first mode as test mode */
@@ -318,7 +327,7 @@ static void connector_find_preferred_mode(struct connector 
*c)
c->crtc = resources->crtcs[i];
c->pipe = i;
 
-   if(test_preferred_mode || force_mode)
+   if(test_preferred_mode || force_mode || only_one_mode)
resources->crtcs[i] = 0;
 
c->connector = connector;
@@ -525,7 +534,7 @@ set_mode(struct connector *c)
 
gem_close(drm_fd, fb_info.gem_handle);
 
-   fprintf(stdout, "CRTS(%u):",c->crtc);
+   fprintf(stdout, "CRTS(%u):[%d]",c->crtc, j);
kmstest_dump_mode(&c->mode);
if (drmModeSetCrtc(drm_fd, c->crtc, fb_id, 0, 0,
   &c->id, 1, &c->mode)) {
@@ -585,7 +594,7 @@ int update_display(void)
dump_crtcs_fd(drm_fd);
}
 
-   if (test_preferred_mode || test_all_modes || force_mode) {
+   if (test_preferred_mode || test_all_modes || force_mode || 
only_one_mode) {
/* Find any connected displays */
for (c = 0; c < resources->count_connectors; c++) {
connectors[c].id = resources->connectors[c];
@@ -596,7 +605,7 @@ int update_display(void)
return 1;
 }
 
-static char optstr[] = "hiaf:s:d:p:mrt";
+static char optstr[] = "hiaf:s:d:p:mrto:";
 
 static void __attribute__((noreturn)) usage(char *name)
 {
@@ -609,6 +618,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\tonly test specified 
mode\n");
fprintf(stderr, "\t-f\t,\n");
fprintf(stderr, "\t\t,,,\n");
fprintf(stderr, "\t\ttest force mode\n");
@@ -701,6 +711,10 @@ int main(int argc, char **argv)
case 'r':
qr_code = 1;
break;
+   case 'o':
+   only_one_mode = 1;
+   specified_mode_num = atoi(optarg);
+   break;
default:
fprintf(stderr, "unknown option %c\n", c);
/* fall through */
@@ -710,7 +724,7 @@ int main(int argc, char **argv)
}
}
if (!test_all_modes && !force_mode && !dump_info &&
-   !test_preferred_mode)
+   !test_preferred_mode && !only_one_mode)
test_all_modes = 1;
 
drm_fd = drm_open_any();
-- 
1.7.6.4

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


[Intel-gfx] [PATCH v2] Update the image file pass.png with higher correction level

2012-08-08 Thread Yi Sun
Signed-off-by: Yi Sun 

diff --git a/tests/pass.png b/tests/pass.png
index 
5928d5ca109b7db33640851ceb352f9da742ff7b..36a5236be785ef4b2c1da634560c42d508d211bb
 100644
GIT binary patch
literal 569
zcmV-90>=G`P)q$gGRCt{2+_8~^Fc5{|^;~eFOK>SJ4N7wG7YT;5
zZ-j94zf49S*^a~_ETKJu#bU8oEEbE!?zRu9@|A~|aFZc~pEyjp*E7yoEVj3`p-xtt
zFQ4q^yIg(71B=BTVYNb6Hs&ecW=F4XEEapT)#0G^t3xan`%xR>J~jr6#eT|K^x<)e
zv#vT!IsbnTjKyM`Y!zQaQ^78l)HzrzwzFNO>|=vJOKt^=#rCthXy$^Is)1A8%J#7v
z^^3(~_gY;;^VQSbM74g-Ghe&JpT_cNiN#{OT21vrf68E3KTF!JuvqLNwyID)W0O;w
zsN-tWi^XDlSzklrSfm_m8$z|M&3Uo@VzJnEn-xJGZe?4G#bP^K@7M${
z*vZbhSvgO>q++qyLu~1(%4r_veva6!Z0Ow{EEe0;8>BFcyp5Zx@rjy%WlJPbt+3i^XEQ+j}lvE7&=H
z#zy?AY}GFoi|uMXqZ>c|{Z~H+i^X=eTEEw2d&gR=@4p?!VzEuuvgp|O|3NL@Exz6Z
zW3kvKTcv!1KbE7X;`N*IsuzUCVjFB*uvjb>i^XEG*gf_a_Lf0-E8BSr0NkvXX
Hu0mjfwks0m

literal 376
zcmV-;0f+vHP)K&qlmd8Y?m?=S>V};d!&JC-@c%hEGI?~i|G%bw#%`yn#2zFYS
z+0-7gg|{O}1!wgI00c~fPDf?c;Hvckz~B`9IOHyYm1SA#|bqn!+nJepLch5kgVzT3%I
zOA6OV+pcX-Uvy+}b(EP0H?%ow8?F&4v@mQk8p>PG2rCR<_!R9VEK^wF&vD>^r0@l&
W)>)U}2&Hxahttp://lists.freedesktop.org/mailman/listinfo/intel-gfx


[Intel-gfx] [PATCH v2] tests/testdisplay.c Remove an uncomfortable error output

2012-08-08 Thread Yi Sun
Signed-off-by: Yi Sun 

diff --git a/tests/testdisplay.c b/tests/testdisplay.c
index 4430d07..14d7da3 100644
--- a/tests/testdisplay.c
+++ b/tests/testdisplay.c
@@ -358,9 +358,6 @@ static void paint_image(cairo_t *cr, const char *file)
 
cairo_translate(cr, img_x, img_y);
 
-   fprintf(stderr, "drew %dx%d image at %d,%d\n", img_w, img_h,
-   img_x, img_y);
-
img_w_scale = (double)img_w / (double)img_w_o;
img_h_scale = (double)img_h / (double)img_h_o;
cairo_scale(cr, img_w_scale, img_h_scale);
-- 
1.7.6.4

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


[Intel-gfx] [PATCH] tests/testdisplay.c: Remove an uncomfortable error output.

2012-08-01 Thread Yi Sun
Update the image file paas.png with higher correction level.

Signed-off-by: Yi Sun 

diff --git a/tests/pass.png b/tests/pass.png
index 
5928d5ca109b7db33640851ceb352f9da742ff7b..36a5236be785ef4b2c1da634560c42d508d211bb
 100644
GIT binary patch
literal 569
zcmV-90>=G`P)q$gGRCt{2+_8~^Fc5{|^;~eFOK>SJ4N7wG7YT;5
zZ-j94zf49S*^a~_ETKJu#bU8oEEbE!?zRu9@|A~|aFZc~pEyjp*E7yoEVj3`p-xtt
zFQ4q^yIg(71B=BTVYNb6Hs&ecW=F4XEEapT)#0G^t3xan`%xR>J~jr6#eT|K^x<)e
zv#vT!IsbnTjKyM`Y!zQaQ^78l)HzrzwzFNO>|=vJOKt^=#rCthXy$^Is)1A8%J#7v
z^^3(~_gY;;^VQSbM74g-Ghe&JpT_cNiN#{OT21vrf68E3KTF!JuvqLNwyID)W0O;w
zsN-tWi^XDlSzklrSfm_m8$z|M&3Uo@VzJnEn-xJGZe?4G#bP^K@7M${
z*vZbhSvgO>q++qyLu~1(%4r_veva6!Z0Ow{EEe0;8>BFcyp5Zx@rjy%WlJPbt+3i^XEQ+j}lvE7&=H
z#zy?AY}GFoi|uMXqZ>c|{Z~H+i^X=eTEEw2d&gR=@4p?!VzEuuvgp|O|3NL@Exz6Z
zW3kvKTcv!1KbE7X;`N*IsuzUCVjFB*uvjb>i^XEG*gf_a_Lf0-E8BSr0NkvXX
Hu0mjfwks0m

literal 376
zcmV-;0f+vHP)K&qlmd8Y?m?=S>V};d!&JC-@c%hEGI?~i|G%bw#%`yn#2zFYS
z+0-7gg|{O}1!wgI00c~fPDf?c;Hvckz~B`9IOHyYm1SA#|bqn!+nJepLch5kgVzT3%I
zOA6OV+pcX-Uvy+}b(EP0H?%ow8?F&4v@mQk8p>PG2rCR<_!R9VEK^wF&vD>^r0@l&
W)>)U}2&Hxahttp://lists.freedesktop.org/mailman/listinfo/intel-gfx


[Intel-gfx] [PATCH] tests/testdisplay.c: Add a option '-g' to save images which intended to paint on screen during each mode setting.

2012-07-31 Thread Yi Sun
That option will save all the images which are created and intended to paint on 
screen.
The images will be saved in folder "saveimages" with PNG format.

Signed-off-by: Yi Sun 

diff --git a/tests/testdisplay.c b/tests/testdisplay.c
index 4430d07..2d1fdb0 100644
--- a/tests/testdisplay.c
+++ b/tests/testdisplay.c
@@ -64,6 +64,7 @@
 
 #include 
 #include 
+#include 
 
 drmModeRes *resources;
 int drm_fd, modes;
@@ -72,6 +73,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 save_image = 0;
 
 drmModeModeInfo force_timing;
 
@@ -379,6 +381,8 @@ paint_output_info(cairo_t *cr, int l_width, int l_height, 
void *priv)
cairo_text_extents_t name_extents, mode_extents;
char name_buf[128], mode_buf[128];
int i, x, y, modes_x, modes_y;
+   static int count = 0;
+   count++;
 
/* Get text extents for each string */
snprintf(name_buf, sizeof name_buf, "%s",
@@ -460,6 +464,25 @@ paint_output_info(cairo_t *cr, int l_width, int l_height, 
void *priv)
 
if (qr_code)
paint_image(cr, "./pass.png");
+
+   if (save_image){
+   char pngname[256];
+   char *pos;
+
+   readlink("/proc/self/exe", pngname, sizeof(pngname));
+   pos = strrchr(pngname, '/');
+   *(pos + 1) = '\0';
+
+   strcat(pngname, "saveimages");
+
+   //judge whether folder mkdir existed, if not create it.
+   if(access(pngname,0) == -1)
+   if (mkdir( pngname,0777))
+   fprintf (stderr, "error %d, %s\n", errno, 
strerror (errno));
+
+   sprintf(pngname, "%s/%d_%s@%d.png", pngname, count, 
c->mode.name, c->mode.vrefresh);
+   cairo_surface_write_to_png( cairo_get_target(cr), pngname );
+   }
 }
 
 static void sighandler(int signo)
@@ -599,7 +622,7 @@ int update_display(void)
return 1;
 }
 
-static char optstr[] = "hiaf:s:d:p:mrt";
+static char optstr[] = "hiaf:s:d:p:mrtg";
 
 static void usage(char *name)
 {
@@ -612,6 +635,7 @@ static void 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-g\tsave images which is intended to paint on the 
screen as png files in folder \"saveimages\"\n");
fprintf(stderr, "\t-f\t,\n");
fprintf(stderr, "\t\t,,,\n");
fprintf(stderr, "\t\ttest force mode\n");
@@ -704,6 +728,9 @@ int main(int argc, char **argv)
case 'r':
qr_code = 1;
break;
+   case 'g':
+   save_image = 1;
+   break;
default:
fprintf(stderr, "unknown option %c\n", c);
/* fall through */
-- 
1.7.6.4

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


[Intel-gfx] [PATCH] tests/testdisplay.c: Add a option '-r'.

2012-07-26 Thread Yi Sun
With the option '-r', the testdisplay could paint a 2-D bar code(QR bar code) 
on the screen. The word "pass" is hiden in the bar code image.
Further more, with this option, testdisplay will wait until a system signal 
'SIGUSR1' coming after each mode setting. This function is for another program 
to control testdisplay.

Signed-off-by: Yi Sun 

diff --git a/lib/drmtest.c b/lib/drmtest.c
index 34db126..2101f6a 100644
--- a/lib/drmtest.c
+++ b/lib/drmtest.c
@@ -774,5 +774,6 @@ void kmstest_dump_mode(drmModeModeInfo *mode)
   mode->flags,
   mode->type,
   mode->clock);
+   fflush(stdout);
 }
 
diff --git a/tests/pass.png b/tests/pass.png
new file mode 100644
index 
..5928d5ca109b7db33640851ceb352f9da742ff7b
GIT binary patch
literal 376
zcmV-;0f+vHP)K&qlmd8Y?m?=S>V};d!&JC-@c%hEGI?~i|G%bw#%`yn#2zFYS
z+0-7gg|{O}1!wgI00c~fPDf?c;Hvckz~B`9IOHyYm1SA#|bqn!+nJepLch5kgVzT3%I
zOA6OV+pcX-Uvy+}b(EP0H?%ow8?F&4v@mQk8p>PG2rCR<_!R9VEK^wF&vD>^r0@l&
W)>)U}2&Hxa
+#include 
+
 drmModeRes *resources;
 int drm_fd, modes;
 int dump_info = 0, test_all_modes =0, test_preferred_mode = 0, force_mode = 0,
test_plane, enable_tiling;
 int sleep_between_modes = 5;
 uint32_t depth = 24, stride, bpp;
+int qr_code = 0;
 
 drmModeModeInfo force_timing;
 
@@ -334,6 +338,40 @@ paint_color_key(void)
}
 }
 
+static void paint_image(cairo_t *cr, const char *file)
+{
+   int img_x, img_y, img_w, img_h, img_w_o, img_h_o;
+   double img_w_scale, img_h_scale;
+
+   cairo_surface_t *image;
+
+   img_y = height * (0.10 );
+   img_h = height * 0.08 * 4;
+   img_w = img_h;
+
+   img_x = (width / 2) - (img_w / 2);
+
+   image = cairo_image_surface_create_from_png(file);
+
+   img_w_o = cairo_image_surface_get_width(image);
+   img_h_o = cairo_image_surface_get_height(image);
+
+   cairo_translate(cr, img_x, img_y);
+
+   fprintf(stderr, "drew %dx%d image at %d,%d\n", img_w, img_h,
+   img_x, img_y);
+
+   img_w_scale = (double)img_w / (double)img_w_o;
+   img_h_scale = (double)img_h / (double)img_h_o;
+   cairo_scale(cr, img_w_scale, img_h_scale);
+
+   cairo_set_source_surface(cr, image, 0, 0);
+   cairo_scale(cr, 1, 1);
+
+   cairo_paint(cr);
+   cairo_surface_destroy(image);
+}
+
 static void
 paint_output_info(cairo_t *cr, int l_width, int l_height, void *priv)
 {
@@ -419,6 +457,26 @@ paint_output_info(cairo_t *cr, int l_width, int l_height, 
void *priv)
cairo_set_source_rgb(cr, 1, 1, 1);
cairo_fill(cr);
}
+
+   if (qr_code)
+   paint_image(cr, "./pass.png");
+}
+
+static void sighandler(int signo)
+{
+   return;
+}
+
+static void set_single(void)
+{
+   int sigs[] = { SIGUSR1 };
+   struct sigaction sa;
+   sa.sa_handler = sighandler;
+
+   sigemptyset(&sa.sa_mask);
+
+   if (sigaction(sigs[0], &sa, NULL) == -1)
+   perror("Could not set signal handler");
 }
 
 static void
@@ -480,9 +538,14 @@ set_mode(struct connector *c)
continue;
}
 
-   if (sleep_between_modes && test_all_modes)
+   if (sleep_between_modes && test_all_modes && !qr_code)
sleep(sleep_between_modes);
 
+   if (qr_code){
+   set_single();
+   pause();
+   }
+
}
 
if(test_all_modes){
@@ -536,7 +599,7 @@ int update_display(void)
return 1;
 }
 
-static char optstr[] = "hiaf:s:d:p:mt";
+static char optstr[] = "hiaf:s:d:p:mrt";
 
 static void usage(char *name)
 {
@@ -548,6 +611,7 @@ static void usage(char *name)
fprintf(stderr, "\t-p\t,, test overlay 
plane\n");
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-f\t,\n");
fprintf(stderr, "\t\t,,,\n");
fprintf(stderr, "\t\ttest force mode\n");
@@ -558,7 +622,7 @@ static void usage(char *name)
 #define dump_resource(res) if (res) dump_##res()
 
 static gboolean input_event(GIOChannel *source, GIOCondition condition,
-   gpointer data)
+   gpointer data)
 {
gchar buf[2];
gsize count;
@@ -571,6 +635,24 @@ static gboolean input_event(GIOChannel *source, 
GIOCondition condition,
return TRUE;
 }
 
+void enter_exec_path( char **argv )
+{
+   char *exec_path = NULL;
+   char *pos = NULL;
+   short len_path = 0;
+
+   len_pa

[Intel-gfx] [PATCH] tests/testdisplay.c: make the 3th pipe finish all the mode setting.

2011-12-01 Thread Yi Sun
If test all modes rather than preferred mode, remove framebuffer and set CRTC 
to zero after each connector mode setting.

Signed-off-by: Sun Yi 
---
 tests/testdisplay.c |   12 +++-
 1 files changed, 11 insertions(+), 1 deletions(-)

diff --git a/tests/testdisplay.c b/tests/testdisplay.c
index 3c9741c..7e25296 100644
--- a/tests/testdisplay.c
+++ b/tests/testdisplay.c
@@ -373,7 +373,10 @@ static void connector_find_preferred_mode(struct connector 
*c)
}
c->crtc = resources->crtcs[i];
c->pipe = i;
-   resources->crtcs[i] = 0;
+
+   if(test_preferred_mode)
+   resources->crtcs[i] = 0;
+
c->connector = connector;
 }
 
@@ -941,6 +944,7 @@ set_mode(struct connector *c)
continue;
}
 
+   fprintf(stdout, "CRTS(%u):",c->crtc);
dump_mode(&c->mode);
if (drmModeSetCrtc(fd, c->crtc, fb_id, 0, 0,
   &c->id, 1, &c->mode)) {
@@ -955,6 +959,12 @@ set_mode(struct connector *c)
 
if (sleep_between_modes && test_all_modes)
sleep(sleep_between_modes);
+
+   }
+
+   if(!test_preferred_mode){
+   drmModeRmFB(fd,fb_id);
+   drmModeSetCrtc(fd, c->crtc, fb_id, 0, 0,  &c->id, 1, 0);
}
 
drmModeFreeEncoder(c->encoder);
-- 
1.7.5.1

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


[Intel-gfx] [PATCH] Print the pixel clock of each mode.

2011-05-30 Thread yi . sun
From: Sun Yi 

---
 tests/testdisplay.c |7 ---
 1 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/tests/testdisplay.c b/tests/testdisplay.c
index 41a5753..1efc6e5 100644
--- a/tests/testdisplay.c
+++ b/tests/testdisplay.c
@@ -157,7 +157,7 @@ struct connector {
 
 static void dump_mode(drmModeModeInfo *mode)
 {
-   printf("  %s %d %d %d %d %d %d %d %d %d 0x%x 0x%x\n",
+   printf("  %s %d %d %d %d %d %d %d %d %d 0x%x 0x%x %d\n",
   mode->name,
   mode->vrefresh,
   mode->hdisplay,
@@ -169,7 +169,8 @@ static void dump_mode(drmModeModeInfo *mode)
   mode->vsync_end,
   mode->vtotal,
   mode->flags,
-  mode->type);
+  mode->type,
+  mode->clock);
 }
 
 static void dump_connectors(void)
@@ -201,7 +202,7 @@ static void dump_connectors(void)
 
printf("  modes:\n");
printf("  name refresh (Hz) hdisp hss hse htot vdisp "
-  "vss vse vtot flags type\n");
+  "vss vse vtot flags type clock\n");
for (j = 0; j < connector->count_modes; j++)
dump_mode(&connector->modes[j]);
 
-- 
1.7.5.1

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