From: "Kahola, Mika" <mika.kahola@intel.com>
To: "igt-dev@lists.freedesktop.org" <igt-dev@lists.freedesktop.org>,
"Souza, Jose" <jose.souza@intel.com>
Subject: Re: [igt-dev] [PATCH i-g-t 2/3] lib: Share the 1024x768 mode among tests
Date: Mon, 1 Apr 2019 13:21:10 +0000 [thread overview]
Message-ID: <5034bc2411e11e78adc6bd2ddbf6d64473477643.camel@intel.com> (raw)
In-Reply-To: <20190330010328.28054-2-jose.souza@intel.com>
On Fri, 2019-03-29 at 18:03 -0700, José Roberto de Souza wrote:
> Three test were duplicating this 1024x768 mode so lets move it to lib
> and share it.
>
> Signed-off-by: José Roberto de Souza <jose.souza@intel.com>
Reviewed-by: Mika Kahola <mika.kahola@intel.com>
> ---
> lib/igt_kms.c | 25 ++++++++++++++++++++++++-
> lib/igt_kms.h | 3 ++-
> tests/kms_concurrent.c | 28 +++++-----------------------
> tests/kms_frontbuffer_tracking.c | 32 +++++++-----------------------
> --
> tests/kms_plane_lowres.c | 19 +------------------
> 5 files changed, 39 insertions(+), 68 deletions(-)
>
> diff --git a/lib/igt_kms.c b/lib/igt_kms.c
> index 43f45997..ce9fe152 100644
> --- a/lib/igt_kms.c
> +++ b/lib/igt_kms.c
> @@ -2155,6 +2155,29 @@ igt_output_t
> *igt_output_from_connector(igt_display_t *display,
> return found;
> }
>
> +const drmModeModeInfo *igt_std_1024_mode_get(void)
> +{
> + static const drmModeModeInfo std_1024_mode = {
> + .clock = 65000,
> + .hdisplay = 1024,
> + .hsync_start = 1048,
> + .hsync_end = 1184,
> + .htotal = 1344,
> + .hskew = 0,
> + .vdisplay = 768,
> + .vsync_start = 771,
> + .vsync_end = 777,
> + .vtotal = 806,
> + .vscan = 0,
> + .vrefresh = 60,
> + .flags = 0xA,
> + .type = 0x40,
> + .name = "Custom 1024x768",
> + };
> +
> + return &std_1024_mode;
> +}
> +
> static void igt_pipe_fini(igt_pipe_t *pipe)
> {
> free(pipe->planes);
> @@ -3627,7 +3650,7 @@ drmModeModeInfo
> *igt_output_get_mode(igt_output_t *output)
> * mode obtained with get connectors. Note that the mode is used
> without
> * checking if the output supports it, so this might lead to
> unexpected results.
> */
> -void igt_output_override_mode(igt_output_t *output, drmModeModeInfo
> *mode)
> +void igt_output_override_mode(igt_output_t *output, const
> drmModeModeInfo *mode)
> {
> igt_pipe_t *pipe = igt_output_get_driving_pipe(output);
>
> diff --git a/lib/igt_kms.h b/lib/igt_kms.h
> index 407f3d64..e392e0ef 100644
> --- a/lib/igt_kms.h
> +++ b/lib/igt_kms.h
> @@ -403,7 +403,7 @@ void
> igt_display_require_output_on_pipe(igt_display_t *display, enum pipe
> pipe);
>
> const char *igt_output_name(igt_output_t *output);
> drmModeModeInfo *igt_output_get_mode(igt_output_t *output);
> -void igt_output_override_mode(igt_output_t *output, drmModeModeInfo
> *mode);
> +void igt_output_override_mode(igt_output_t *output, const
> drmModeModeInfo *mode);
> void igt_output_set_pipe(igt_output_t *output, enum pipe pipe);
> igt_plane_t *igt_output_get_plane(igt_output_t *output, int
> plane_idx);
> igt_plane_t *igt_output_get_plane_type(igt_output_t *output, int
> plane_type);
> @@ -412,6 +412,7 @@ igt_plane_t
> *igt_output_get_plane_type_index(igt_output_t *output,
> int plane_type, int
> index);
> igt_output_t *igt_output_from_connector(igt_display_t *display,
> drmModeConnector *connector);
> +const drmModeModeInfo *igt_std_1024_mode_get(void);
>
> igt_plane_t *igt_pipe_get_plane_type(igt_pipe_t *pipe, int
> plane_type);
> int igt_pipe_count_plane_type(igt_pipe_t *pipe, int plane_type);
> diff --git a/tests/kms_concurrent.c b/tests/kms_concurrent.c
> index af8ca70c..117016dc 100644
> --- a/tests/kms_concurrent.c
> +++ b/tests/kms_concurrent.c
> @@ -236,29 +236,11 @@ test_plane_position_with_output(data_t *data,
> enum pipe pipe, igt_output_t *outp
> }
> }
>
> -static drmModeModeInfo std_1024_mode = {
> - .clock = 65000,
> - .hdisplay = 1024,
> - .hsync_start = 1048,
> - .hsync_end = 1184,
> - .htotal = 1344,
> - .hskew = 0,
> - .vdisplay = 768,
> - .vsync_start = 771,
> - .vsync_end = 777,
> - .vtotal = 806,
> - .vscan = 0,
> - .vrefresh = 60,
> - .flags = 0xA,
> - .type = 0x40,
> - .name = "Custom 1024x768",
> -};
> -
> -static drmModeModeInfo *
> -get_lowres_mode(data_t *data, drmModeModeInfo *mode_default,
> +static const drmModeModeInfo *
> +get_lowres_mode(data_t *data, const drmModeModeInfo *mode_default,
> igt_output_t *output)
> {
> - drmModeModeInfo *mode = &std_1024_mode;
> + const drmModeModeInfo *mode = igt_std_1024_mode_get();
> drmModeConnector *connector = output->config.connector;
> int limit = mode_default->vdisplay - SIZE_PLANE;
> bool found;
> @@ -277,7 +259,7 @@ get_lowres_mode(data_t *data, drmModeModeInfo
> *mode_default,
> }
>
> if (!found)
> - mode = &std_1024_mode;
> + mode = igt_std_1024_mode_get();
>
> return mode;
> }
> @@ -285,7 +267,7 @@ get_lowres_mode(data_t *data, drmModeModeInfo
> *mode_default,
> static void
> test_resolution_with_output(data_t *data, enum pipe pipe,
> igt_output_t *output)
> {
> - drmModeModeInfo *mode_hi, *mode_lo;
> + const drmModeModeInfo *mode_hi, *mode_lo;
> int iterations = opt.iterations < 1 ? 1 : opt.iterations;
> bool loop_forever = opt.iterations == LOOP_FOREVER ? true :
> false;
> int i;
> diff --git a/tests/kms_frontbuffer_tracking.c
> b/tests/kms_frontbuffer_tracking.c
> index 4d15ce1c..89586326 100644
> --- a/tests/kms_frontbuffer_tracking.c
> +++ b/tests/kms_frontbuffer_tracking.c
> @@ -295,28 +295,10 @@ struct {
> .stop = true,
> };
>
> -drmModeModeInfo std_1024_mode = {
> - .clock = 65000,
> - .hdisplay = 1024,
> - .hsync_start = 1048,
> - .hsync_end = 1184,
> - .htotal = 1344,
> - .hskew = 0,
> - .vdisplay = 768,
> - .vsync_start = 771,
> - .vsync_end = 777,
> - .vtotal = 806,
> - .vscan = 0,
> - .vrefresh = 60,
> - .flags = 0xA,
> - .type = 0x40,
> - .name = "Custom 1024x768",
> -};
> -
> -static drmModeModeInfo *get_connector_smallest_mode(igt_output_t
> *output)
> +static const drmModeModeInfo
> *get_connector_smallest_mode(igt_output_t *output)
> {
> drmModeConnector *c = output->config.connector;
> - drmModeModeInfo *smallest = NULL;
> + const drmModeModeInfo *smallest = NULL;
> int i;
>
> for (i = 0; i < c->count_modes; i++) {
> @@ -331,14 +313,14 @@ static drmModeModeInfo
> *get_connector_smallest_mode(igt_output_t *output)
> }
>
> if (c->connector_type == DRM_MODE_CONNECTOR_eDP)
> - smallest = &std_1024_mode;
> + smallest = igt_std_1024_mode_get();
>
> return smallest;
> }
>
> -static drmModeModeInfo *connector_get_mode(igt_output_t *output)
> +static const drmModeModeInfo *connector_get_mode(igt_output_t
> *output)
> {
> - drmModeModeInfo *mode = NULL;
> + const drmModeModeInfo *mode = NULL;
>
> if (opt.small_modes)
> mode = get_connector_smallest_mode(output);
> @@ -349,7 +331,7 @@ static drmModeModeInfo
> *connector_get_mode(igt_output_t *output)
> * bugged. */
> if (IS_HASWELL(intel_get_drm_devid(drm.fd)) &&
> output->config.connector->connector_type ==
> DRM_MODE_CONNECTOR_eDP)
> - mode = &std_1024_mode;
> + mode = igt_std_1024_mode_get();
>
> return mode;
> }
> @@ -357,7 +339,7 @@ static drmModeModeInfo
> *connector_get_mode(igt_output_t *output)
> static void init_mode_params(struct modeset_params *params,
> igt_output_t *output, enum pipe pipe)
> {
> - drmModeModeInfo *mode;
> + const drmModeModeInfo *mode;
>
> igt_output_override_mode(output, NULL);
> mode = connector_get_mode(output);
> diff --git a/tests/kms_plane_lowres.c b/tests/kms_plane_lowres.c
> index f7739b11..51bb7cd8 100644
> --- a/tests/kms_plane_lowres.c
> +++ b/tests/kms_plane_lowres.c
> @@ -46,23 +46,6 @@ static drmModeModeInfo
> get_lowres_mode(int drmfd, igt_output_t *output, drmModeModeInfo
> *mode_default)
> {
> drmModeModeInfo mode;
> - drmModeModeInfo std_1024_mode = {
> - .clock = 65000,
> - .hdisplay = 1024,
> - .hsync_start = 1048,
> - .hsync_end = 1184,
> - .htotal = 1344,
> - .hskew = 0,
> - .vdisplay = 768,
> - .vsync_start = 771,
> - .vsync_end = 777,
> - .vtotal = 806,
> - .vscan = 0,
> - .vrefresh = 60,
> - .flags = 0xA,
> - .type = 0x40,
> - .name = "Custom 1024x768",
> - };
> bool found = false;
> int limit = mode_default->vdisplay - SIZE;
> int j;
> @@ -76,7 +59,7 @@ get_lowres_mode(int drmfd, igt_output_t *output,
> drmModeModeInfo *mode_default)
> }
>
> if (!found)
> - return std_1024_mode;
> + return *igt_std_1024_mode_get();
>
> return mode;
> }
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev
next prev parent reply other threads:[~2019-04-01 13:21 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-03-30 1:03 [igt-dev] [PATCH i-g-t 1/3] tests/kms_plane_lowres: Search for modes of the connector being tested José Roberto de Souza
2019-03-30 1:03 ` [igt-dev] [PATCH i-g-t 2/3] lib: Share the 1024x768 mode among tests José Roberto de Souza
2019-04-01 13:21 ` Kahola, Mika [this message]
2019-03-30 1:03 ` [igt-dev] [PATCH i-g-t 3/3] tests/plane_lowres: Test each plane individually José Roberto de Souza
2019-04-01 13:18 ` Kahola, Mika
2019-04-01 19:47 ` Souza, Jose
2019-03-30 1:43 ` [igt-dev] ✓ Fi.CI.BAT: success for series starting with [i-g-t,1/3] tests/kms_plane_lowres: Search for modes of the connector being tested Patchwork
2019-03-30 5:03 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
2019-04-01 13:10 ` [igt-dev] [PATCH i-g-t 1/3] " Kahola, Mika
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5034bc2411e11e78adc6bd2ddbf6d64473477643.camel@intel.com \
--to=mika.kahola@intel.com \
--cc=igt-dev@lists.freedesktop.org \
--cc=jose.souza@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox