Re: [igt-dev] [PATCH 10/10] tests/kms_plane_multiple/tgl: Set highest mode for PCU messaging test

Kahola, Mika
2019-08-02T10:44:02Z

On Mon, 2019-07-15 at 14:51 -0700, Lucas De Marchi wrote:
> From: Karthik B S <karthik.b.s@intel.com>
>
> Set the highest mode allows for the stress test for PCU messaging, as
> the BW requirement is the highest in this case.
>
> Cc: Mika Kahola <mika.kahola@intel.com>
> Signed-off-by: Karthik B S <karthik.b.s@intel.com>
> Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>

Reviewed-by: Mika Kahola <mika.kahola@intel.com>

> ---
> tests/kms_plane_multiple.c | 68 ++++++++++++++++++++++++++++++++--
> ----
> 1 file changed, 58 insertions(+), 10 deletions(-)
>
> diff --git a/tests/kms_plane_multiple.c b/tests/kms_plane_multiple.c
> index 2c726fda..1bf44005 100644
> --- a/tests/kms_plane_multiple.c
> +++ b/tests/kms_plane_multiple.c
> @@ -285,16 +285,45 @@ prepare_planes(data_t *data, enum pipe pipe_id,
> color_t *color,
> free((void*)suffle);
> }
>
> -/*
> - * Multiple plane position test.
> - * - We start by grabbing a reference CRC of a full blue fb being
> scanned
> - * out on the primary plane
> - * - Then we scannout number of planes:
> - * * the primary plane uses a blue fb with a black rectangle
> holes
> - * * planes, on top of the primary plane, with a blue fb that
> is set-up
> - * to cover the black rectangles of the primary plane
> - * The resulting CRC should be identical to the reference CRC
> - */
> +static drmModeModeInfo
> +get_highest_mode(int drmfd, int connector_id)
> +{
> + drmModeRes *mode_resources = drmModeGetResources(drmfd);
> + drmModeModeInfo highestmode;
> + drmModeConnector *connector;
> + int i;
> + bool highestmodefound = false;
> +
> + igt_require(mode_resources);
> +
> + for (i = 0; i < mode_resources->count_connectors; i++) {
> + connector = drmModeGetConnectorCurrent(drmfd,
> + mode_resources-
> >connectors[i]);
> + if (!connector) {
> + igt_warn("could not get connector %i: %s\n",
> + mode_resources->connectors[i],
> strerror(errno));
> + continue;
> + }
> +
> + if (connector->connector_id != connector_id)
> + continue;
> +
> + if (!connector->count_modes)
> + continue;
> +
> + /* First mode has the highest pixel rate */
> + highestmodefound = true;
> + highestmode = connector->modes[0];
> + break;
> + }
> +
> + if (connector)
> + drmModeFreeConnector(connector);
> + drmModeFreeResources(mode_resources);
> +
> + igt_require(highestmodefound);
> + return highestmode;
> +}
>
> static void
> prepare_planes2(data_t *data, enum pipe pipe_id, color_t *color,
> @@ -366,11 +395,22 @@ prepare_planes2(data_t *data, enum pipe
> pipe_id, color_t *color,
> }
> }
>
> +/*
> + * Multiple plane position test.
> + * - We start by grabbing a reference CRC of a full blue fb being
> scanned
> + * out on the primary plane
> + * - Then we scannout number of planes:
> + * * the primary plane uses a blue fb with a black rectangle
> holes
> + * * planes, on top of the primary plane, with a blue fb that
> is set-up
> + * to cover the black rectangles of the primary plane
> + * The resulting CRC should be identical to the reference CRC
> + */
> static void
> test_plane_position_with_output(data_t *data, enum pipe pipe,
> igt_output_t *output, int n_planes,
> uint64_t tiling)
> {
> + drmModeModeInfo mode_highres;
> color_t blue = { 0.0f, 0.0f, 1.0f };
> igt_crc_t crc;
> igt_plane_t *plane;
> @@ -392,6 +432,11 @@ test_plane_position_with_output(data_t *data,
> enum pipe pipe,
> test_init(data, pipe, n_planes);
>
> if (data->flag == TEST_PCU_ALGO) {
> + mode_highres = get_highest_mode(data->drm_fd, output-
> >id);
> +
> + /* switch to highest resolution */
> + igt_output_override_mode(output, &mode_highres);
> +
> for (i = BW_PRIMARY_LOW; i < BW_INVALID; i++) {
> if (i == BW_PRIMARY_LOW || i ==
> BW_PRIMARY_LOW2)
> get_reference_crc(data, output, pipe,
> &blue,
> @@ -429,6 +474,9 @@ test_plane_position_with_output(data_t *data,
> enum pipe pipe,
>
> igt_assert_crc_equal(&data->ref_crc, &crc);
> }
> +
> + /* switch back to default mode */
> + igt_output_override_mode(output, NULL);
> } else {
> i = 0;
> get_reference_crc(data, output, pipe, &blue, tiling,
> FULL_SCREEN);