lib/igt_debugfs: Don't setup crc in _new

The problem is that this causes writes to registers, and if the pipe
is off they might go nowhere (e.g. when runtime pm is enabled).
Furthermore we can only really check once the modeset setup is done,
but again most tests set up the CRC structure before calling
igt_commit and friends. We could add crc restore support to the
kernel's rpm code, but that will end up being rather invasive and
fragile hard-to-test code.

Now originally this was needed back when CRC support wasn't available
everywhere. But that's fixed now.

So given all this just drop that sanity check and make sure that we
only touch the debugfs file (and so the hw state) when we know the
pipe is running in the desired configuration.

A complementary kernel patch will try to catch offenders by returning
-EIO if the pipe is off.

v2: Forgot to git add one hunk.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=86092
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
This commit is contained in:
Daniel Vetter 2014-11-24 16:08:32 +01:00
parent d8078911f6
commit 57259d714d
8 changed files with 11 additions and 83 deletions

View File

@ -294,6 +294,9 @@ static bool igt_pipe_crc_do_start(igt_pipe_crc_t *pipe_crc)
{
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;
@ -362,9 +365,9 @@ void igt_require_pipe_crc(void)
*
* 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)
@ -388,14 +391,6 @@ 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;
}

View File

@ -230,7 +230,7 @@ static void test_crc_random(data_t *data)
}
}
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;
@ -267,11 +267,6 @@ static bool prepare_crtc(data_t *data, igt_output_t *output,
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;
@ -289,8 +284,6 @@ static bool prepare_crtc(data_t *data, igt_output_t *output,
/* 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)
@ -325,8 +318,7 @@ static void run_test(data_t *data, void (*testfunc)(data_t *), int cursor_w, int
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++;

View File

@ -359,18 +359,6 @@ static bool prepare_test(data_t *data, enum test_mode test_mode)
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;

View File

@ -247,21 +247,6 @@ test_plane(data_t *data, igt_output_t *output, enum pipe pipe, enum igt_plane pl
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);
@ -410,20 +395,6 @@ test_crtc(data_t *data, igt_output_t *output, enum pipe pipe)
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);

View File

@ -151,9 +151,6 @@ test_read_crc_for_output(data_t *data, int pipe, igt_output_t *output,
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 */

View File

@ -136,11 +136,6 @@ static bool prepare_crtc(data_t *data)
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);

View File

@ -79,7 +79,7 @@ paint_squares(data_t *data, struct igt_fb *fb, drmModeModeInfo *mode,
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;
@ -91,11 +91,6 @@ static bool prepare_crtc(data_t *data, igt_output_t *output, enum pipe pipe,
/* 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);
@ -149,8 +144,6 @@ static bool prepare_crtc(data_t *data, igt_output_t *output, enum pipe pipe,
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)
@ -200,8 +193,8 @@ static void test_plane_rotation(data_t *data, enum igt_plane plane_type)
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 */

View File

@ -62,9 +62,6 @@ functional_test_init(functional_test_t *test, igt_output_t *output, enum pipe pi
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);