kms_pipe_crc_basic: Cycle between 2 differently colored buffer

Instead of just testing if the CRCs are stable, we also test 2 different
fbs to make sure that the CRC is actually changing.

Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
This commit is contained in:
Damien Lespiau 2014-05-28 17:40:05 +01:00
parent dbb80a63b4
commit f18700b304

View File

@ -39,6 +39,14 @@ typedef struct {
struct igt_fb fb;
} data_t;
static struct {
double r, g, b;
igt_crc_t crc;
} colors[2] = {
{ .r = 0.0, .g = 1.0, .b = 0.0 },
{ .r = 0.0, .g = 1.0, .b = 1.0 },
};
static uint64_t submit_batch(int fd, unsigned ring_id)
{
const uint32_t batch[] = { MI_NOOP,
@ -114,7 +122,9 @@ test_read_crc_for_output(data_t *data, int pipe, igt_output_t *output,
drmModeModeInfo *mode;
igt_pipe_crc_t *pipe_crc;
igt_crc_t *crcs = NULL;
int c, j;
for (c = 0; c < ARRAY_SIZE(colors); c++) {
igt_output_set_pipe(output, pipe);
mode = igt_output_get_mode(output);
@ -122,7 +132,9 @@ test_read_crc_for_output(data_t *data, int pipe, igt_output_t *output,
mode->hdisplay, mode->vdisplay,
DRM_FORMAT_XRGB8888,
false, /* tiled */
0.0, 1.0, 0.0,
colors[c].r,
colors[c].g,
colors[c].b,
&data->fb);
primary = igt_output_get_plane(output, 0);
@ -142,6 +154,20 @@ test_read_crc_for_output(data_t *data, int pipe, igt_output_t *output,
igt_pipe_crc_stop(pipe_crc);
/*
* save the CRC in colors so it can be compared to the CRC of
* other fbs
*/
colors[c].crc = crcs[0];
/*
* make sure the CRC of this fb is different from the ones of
* previous fbs
*/
for (j = 0; j < c; j++)
igt_assert(!igt_crc_equal(&colors[j].crc,
&colors[c].crc));
/* ensure the CRCs are not all 0s */
igt_assert(!igt_crc_is_null(&crcs[0]));
igt_assert(!igt_crc_is_null(&crcs[1]));
@ -162,6 +188,7 @@ test_read_crc_for_output(data_t *data, int pipe, igt_output_t *output,
igt_plane_set_fb(primary, NULL);
igt_output_set_pipe(output, PIPE_ANY);
}
return 1;
}