{
char buf[64];
+ /* Stop first just to make sure we don't have lingering state left. */
+ igt_pipe_crc_stop(pipe_crc);
+
sprintf(buf, "pipe %s %s", kmstest_pipe_name(pipe_crc->pipe),
pipe_crc_source_name(pipe_crc->source));
errno = 0;
*
* This sets up a new pipe CRC capture object for the given @pipe and @source.
*
- * Returns: A pipe CRC object if the given @pipe and @source is available, NULL
- * otherwise. Tests can use this to intelligently skip if they require a
- * specific pipe CRC source to function properly.
+ * Returns: A pipe CRC object if the given @pipe and @source. The library
+ * assumes that the source is always available since recent kernels support at
+ * least INTEL_PIPE_CRC_SOURCE_AUTO everywhere.
*/
igt_pipe_crc_t *
igt_pipe_crc_new(enum pipe pipe, enum intel_pipe_crc_source source)
pipe_crc->pipe = pipe;
pipe_crc->source = source;
- /* make sure this source is actually supported */
- if (!igt_pipe_crc_do_start(pipe_crc)) {
- igt_pipe_crc_free(pipe_crc);
- return NULL;
- }
-
- igt_pipe_crc_stop(pipe_crc);
-
return pipe_crc;
}
}
}
-static bool prepare_crtc(data_t *data, igt_output_t *output,
+static void prepare_crtc(data_t *data, igt_output_t *output,
int cursor_w, int cursor_h)
{
drmModeModeInfo *mode;
data->pipe_crc = igt_pipe_crc_new(data->pipe,
INTEL_PIPE_CRC_SOURCE_AUTO);
- if (!data->pipe_crc) {
- igt_info("auto crc not supported on this connector with pipe %i\n",
- data->pipe);
- return false;
- }
/* x/y position where the cursor is still fully visible */
data->left = 0;
/* get reference crc w/o cursor */
igt_pipe_crc_collect_crc(data->pipe_crc, &data->ref_crc);
-
- return true;
}
static void cleanup_crtc(data_t *data, igt_output_t *output)
for_each_pipe(display, p) {
data->pipe = p;
- if (!prepare_crtc(data, output, cursor_w, cursor_h))
- continue;
+ prepare_crtc(data, output, cursor_w, cursor_h);
valid_tests++;
pipe_crc = igt_pipe_crc_new(data->pipe,
INTEL_PIPE_CRC_SOURCE_AUTO);
- if (!pipe_crc) {
- igt_info("auto crc not supported on this connector with crtc %i\n",
- data->pipe);
-
- igt_plane_set_fb(data->primary, NULL);
- igt_output_set_pipe(output, PIPE_ANY);
- igt_display_commit(display);
-
- igt_remove_fb(data->drm_fd, &data->fb[0]);
- igt_remove_fb(data->drm_fd, &data->fb[1]);
- return false;
- }
data->pipe_crc = pipe_crc;
if (data->pipe_crc)
igt_pipe_crc_free(data->pipe_crc);
data->pipe_crc = igt_pipe_crc_new(pipe, INTEL_PIPE_CRC_SOURCE_AUTO);
- if (!data->pipe_crc) {
- igt_info("auto crc not supported on this connector with crtc %i\n",
- pipe);
-
- igt_plane_set_fb(primary, NULL);
- igt_plane_set_fb(sprite, NULL);
- igt_output_set_pipe(output, PIPE_ANY);
- igt_display_commit(&data->display);
-
- igt_remove_fb(data->drm_fd, &red_fb);
- igt_remove_fb(data->drm_fd, &green_fb);
- igt_remove_fb(data->drm_fd, &blue_fb);
-
- return false;
- }
/* set red fb and grab reference crc */
igt_plane_set_fb(primary, &red_fb);
if (data->pipe_crc)
igt_pipe_crc_free(data->pipe_crc);
data->pipe_crc = igt_pipe_crc_new(pipe, INTEL_PIPE_CRC_SOURCE_AUTO);
- if (!data->pipe_crc) {
- igt_info("auto crc not supported on this connector with crtc %i\n",
- pipe);
-
- igt_plane_set_fb(primary, NULL);
- igt_output_set_pipe(output, PIPE_ANY);
- igt_display_commit(&data->display);
-
- igt_remove_fb(data->drm_fd, &red_fb);
- igt_remove_fb(data->drm_fd, &green_fb);
- igt_remove_fb(data->drm_fd, &blue_fb);
-
- return false;
- }
/* set red fb and grab reference crc */
igt_plane_set_fb(primary, &red_fb);
pipe_crc = igt_pipe_crc_new(pipe, INTEL_PIPE_CRC_SOURCE_AUTO);
- if (!pipe_crc)
- return 0;
-
igt_pipe_crc_start(pipe_crc);
/* wait for N_CRCS vblanks and the corresponding N_CRCS CRCs */
data->pipe_crc = igt_pipe_crc_new(data->pipe,
INTEL_PIPE_CRC_SOURCE_AUTO);
- if (!data->pipe_crc) {
- igt_info("auto crc not supported on this connector with pipe %i\n",
- data->pipe);
- return false;
- }
/* get reference crc for the white fb */
igt_pipe_crc_collect_crc(data->pipe_crc, &data->ref_crc);
cairo_destroy(cr);
}
-static bool prepare_crtc(data_t *data, igt_output_t *output, enum pipe pipe,
+static void prepare_crtc(data_t *data, igt_output_t *output, enum pipe pipe,
igt_plane_t *plane)
{
drmModeModeInfo *mode;
/* create the pipe_crc object for this pipe */
igt_pipe_crc_free(data->pipe_crc);
data->pipe_crc = igt_pipe_crc_new(pipe, INTEL_PIPE_CRC_SOURCE_AUTO);
- if (!data->pipe_crc) {
- igt_info("auto crc not supported on this connector with pipe %i\n",
- pipe);
- return false;
- }
mode = igt_output_get_mode(output);
paint_squares(data, &data->fb, mode, IGT_ROTATION_0, plane);
igt_plane_set_fb(plane, &data->fb);
}
-
- return true;
}
static void cleanup_crtc(data_t *data, igt_output_t *output, igt_plane_t *plane)
plane = igt_output_get_plane(output, plane_type);
igt_require(igt_plane_supports_rotation(plane));
- if (!prepare_crtc(data, output, pipe, plane))
- continue;
+ prepare_crtc(data, output, pipe, plane);
+
igt_display_commit2(display, commit);
/* collect unrotated CRC */
drmModeModeInfo *mode;
test->pipe_crc = igt_pipe_crc_new(pipe, INTEL_PIPE_CRC_SOURCE_AUTO);
- igt_skip_on_f(!test->pipe_crc,
- "auto crc not supported on this connector with pipe %i\n", pipe);
-
igt_output_set_pipe(output, pipe);