From: "Ser, Simon" <simon.ser@intel.com>
To: "ville.syrjala@linux.intel.com" <ville.syrjala@linux.intel.com>,
"igt-dev@lists.freedesktop.org" <igt-dev@lists.freedesktop.org>
Subject: Re: [igt-dev] [PATCH i-g-t 2/2] tests/kms_force_connector_basic: Execute with HDMI connectors
Date: Mon, 26 Aug 2019 13:36:11 +0000 [thread overview]
Message-ID: <1f08d7201bd225fa25e2f82c0e76438c97cf2d9e.camel@intel.com> (raw)
In-Reply-To: <20190823183306.24711-2-ville.syrjala@linux.intel.com>
On Fri, 2019-08-23 at 21:33 +0300, Ville Syrjala wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
>
> If we can't find a VGA connector, let's look for a HDMI connector
> instead. We can run all but the load detect subtests with HDMI.
>
> v2: Rebase
>
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
I suppose it's not worth it to try to avoid the few lines of duplicated
code.
Reviewed-by: Simon Ser <simon.ser@intel.com>
> ---
> tests/kms_force_connector_basic.c | 95 +++++++++++++++++++------------
> 1 file changed, 59 insertions(+), 36 deletions(-)
>
> diff --git a/tests/kms_force_connector_basic.c b/tests/kms_force_connector_basic.c
> index f1533e5415c0..ddbd97efd29e 100644
> --- a/tests/kms_force_connector_basic.c
> +++ b/tests/kms_force_connector_basic.c
> @@ -80,43 +80,63 @@ igt_main_args("", long_opts, help_str, opt_handler, NULL)
> /* force the VGA output and test that it worked */
> int drm_fd = 0;
> drmModeRes *res;
> - drmModeConnector *vga_connector = NULL, *temp;
> + drmModeConnector *connector = NULL, *temp;
> int start_n_modes, start_connection;
>
> igt_fixture {
> - unsigned vga_connector_id = 0;
> + unsigned connector_id = 0;
>
> drm_fd = drm_open_driver_master(DRIVER_INTEL);
>
> res = drmModeGetResources(drm_fd);
> igt_require(res);
>
> - /* find the vga connector */
> + /* find a vga connector */
> for (int i = 0; i < res->count_connectors; i++) {
> - vga_connector = drmModeGetConnectorCurrent(drm_fd,
> - res->connectors[i]);
> + connector = drmModeGetConnectorCurrent(drm_fd,
> + res->connectors[i]);
>
> - if (vga_connector->connector_type == DRM_MODE_CONNECTOR_VGA) {
> + if (connector->connector_type == DRM_MODE_CONNECTOR_VGA) {
> /* Ensure that no override was left in place. */
> kmstest_force_connector(drm_fd,
> - vga_connector,
> + connector,
> FORCE_CONNECTOR_UNSPECIFIED);
>
> /* Only use the first VGA connector. */
> - if (!vga_connector_id)
> - vga_connector_id = res->connectors[i];
> + if (!connector_id)
> + connector_id = res->connectors[i];
> }
>
> - drmModeFreeConnector(vga_connector);
> + drmModeFreeConnector(connector);
> }
>
> - igt_require(vga_connector_id);
> + /* find a hdmi connector if we didn't find vga */
> + for (int i = 0; i < res->count_connectors; i++) {
> + connector = drmModeGetConnectorCurrent(drm_fd,
> + res->connectors[i]);
> +
> + if (connector->connector_type == DRM_MODE_CONNECTOR_HDMIA ||
> + connector->connector_type == DRM_MODE_CONNECTOR_HDMIB) {
> + /* Ensure that no override was left in place. */
> + kmstest_force_connector(drm_fd,
> + connector,
> + FORCE_CONNECTOR_UNSPECIFIED);
> +
> + /* Use the the first HDMI connector. */
> + if (!connector_id)
> + connector_id = res->connectors[i];
> + }
> +
> + drmModeFreeConnector(connector);
> + }
> +
> + igt_require(connector_id);
>
> /* Reacquire status after clearing any previous overrides */
> - vga_connector = drmModeGetConnector(drm_fd, vga_connector_id);
> + connector = drmModeGetConnector(drm_fd, connector_id);
>
> - start_n_modes = vga_connector->count_modes;
> - start_connection = vga_connector->connection;
> + start_n_modes = connector->count_modes;
> + start_connection = connector->connection;
> }
>
> igt_subtest("force-load-detect") {
> @@ -124,6 +144,9 @@ igt_main_args("", long_opts, help_str, opt_handler, NULL)
> drmModePlaneRes *plane_resources;
> struct igt_fb xrgb_fb, argb_fb;
>
> + /* no load detect on HDMI */
> + igt_require(connector->connector_type == DRM_MODE_CONNECTOR_VGA);
> +
> igt_create_fb(drm_fd, w, h, DRM_FORMAT_XRGB8888, 0, &xrgb_fb);
> igt_create_fb(drm_fd, w, h, DRM_FORMAT_ARGB8888, 0, &argb_fb);
> igt_assert(drmSetClientCap(drm_fd, DRM_CLIENT_CAP_UNIVERSAL_PLANES, 1) == 0);
> @@ -176,7 +199,7 @@ igt_main_args("", long_opts, help_str, opt_handler, NULL)
> /* This can't use drmModeGetConnectorCurrent
> * because connector probing is the point of this test.
> */
> - temp = drmModeGetConnector(drm_fd, vga_connector->connector_id);
> + temp = drmModeGetConnector(drm_fd, connector->connector_id);
>
> igt_set_module_param_int("load_detect_test", 0);
>
> @@ -206,9 +229,9 @@ igt_main_args("", long_opts, help_str, opt_handler, NULL)
> igt_display_t display;
>
> /* force the connector on and check the reported values */
> - kmstest_force_connector(drm_fd, vga_connector, FORCE_CONNECTOR_ON);
> + kmstest_force_connector(drm_fd, connector, FORCE_CONNECTOR_ON);
> temp = drmModeGetConnectorCurrent(drm_fd,
> - vga_connector->connector_id);
> + connector->connector_id);
> igt_assert_eq(temp->connection, DRM_MODE_CONNECTED);
> igt_assert_lt(0, temp->count_modes);
> drmModeFreeConnector(temp);
> @@ -221,35 +244,35 @@ igt_main_args("", long_opts, help_str, opt_handler, NULL)
>
>
> /* force the connector off */
> - kmstest_force_connector(drm_fd, vga_connector,
> + kmstest_force_connector(drm_fd, connector,
> FORCE_CONNECTOR_OFF);
> temp = drmModeGetConnectorCurrent(drm_fd,
> - vga_connector->connector_id);
> + connector->connector_id);
> igt_assert_eq(temp->connection, DRM_MODE_DISCONNECTED);
> igt_assert_eq(0, temp->count_modes);
> drmModeFreeConnector(temp);
>
> /* check that the previous state is restored */
> - kmstest_force_connector(drm_fd, vga_connector,
> + kmstest_force_connector(drm_fd, connector,
> FORCE_CONNECTOR_UNSPECIFIED);
> temp = drmModeGetConnectorCurrent(drm_fd,
> - vga_connector->connector_id);
> + connector->connector_id);
> igt_assert_eq(temp->connection, start_connection);
> drmModeFreeConnector(temp);
> }
>
> igt_subtest("force-edid") {
> - kmstest_force_connector(drm_fd, vga_connector,
> + kmstest_force_connector(drm_fd, connector,
> FORCE_CONNECTOR_ON);
> temp = drmModeGetConnectorCurrent(drm_fd,
> - vga_connector->connector_id);
> + connector->connector_id);
> drmModeFreeConnector(temp);
>
> /* test edid forcing */
> - kmstest_force_edid(drm_fd, vga_connector,
> + kmstest_force_edid(drm_fd, connector,
> igt_kms_get_base_edid());
> temp = drmModeGetConnectorCurrent(drm_fd,
> - vga_connector->connector_id);
> + connector->connector_id);
>
> igt_debug("num_conn %i\n", temp->count_modes);
>
> @@ -260,11 +283,11 @@ igt_main_args("", long_opts, help_str, opt_handler, NULL)
> drmModeFreeConnector(temp);
>
> /* remove edid */
> - kmstest_force_edid(drm_fd, vga_connector, NULL);
> - kmstest_force_connector(drm_fd, vga_connector,
> + kmstest_force_edid(drm_fd, connector, NULL);
> + kmstest_force_connector(drm_fd, connector,
> FORCE_CONNECTOR_UNSPECIFIED);
> temp = drmModeGetConnectorCurrent(drm_fd,
> - vga_connector->connector_id);
> + connector->connector_id);
> /* the connector should now have the same number of modes that
> * it started with */
> igt_assert_eq(temp->count_modes, start_n_modes);
> @@ -275,14 +298,14 @@ igt_main_args("", long_opts, help_str, opt_handler, NULL)
> igt_subtest("prune-stale-modes") {
> int i;
>
> - kmstest_force_connector(drm_fd, vga_connector,
> + kmstest_force_connector(drm_fd, connector,
> FORCE_CONNECTOR_ON);
>
> /* test pruning of stale modes */
> - kmstest_force_edid(drm_fd, vga_connector,
> + kmstest_force_edid(drm_fd, connector,
> igt_kms_get_alt_edid());
> temp = drmModeGetConnectorCurrent(drm_fd,
> - vga_connector->connector_id);
> + connector->connector_id);
>
> for (i = 0; i < temp->count_modes; i++) {
> if (temp->modes[i].hdisplay == 1400 &&
> @@ -293,10 +316,10 @@ igt_main_args("", long_opts, help_str, opt_handler, NULL)
>
> drmModeFreeConnector(temp);
>
> - kmstest_force_edid(drm_fd, vga_connector,
> + kmstest_force_edid(drm_fd, connector,
> igt_kms_get_base_edid());
> temp = drmModeGetConnectorCurrent(drm_fd,
> - vga_connector->connector_id);
> + connector->connector_id);
>
> for (i = 0; i < temp->count_modes; i++) {
> if (temp->modes[i].hdisplay == 1400 &&
> @@ -307,13 +330,13 @@ igt_main_args("", long_opts, help_str, opt_handler, NULL)
>
> drmModeFreeConnector(temp);
>
> - kmstest_force_edid(drm_fd, vga_connector, NULL);
> - kmstest_force_connector(drm_fd, vga_connector,
> + kmstest_force_edid(drm_fd, connector, NULL);
> + kmstest_force_connector(drm_fd, connector,
> FORCE_CONNECTOR_UNSPECIFIED);
> }
>
> igt_fixture {
> - drmModeFreeConnector(vga_connector);
> + drmModeFreeConnector(connector);
> close(drm_fd);
>
> reset_connectors();
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev
next prev parent reply other threads:[~2019-08-26 13:36 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-08-23 18:33 [igt-dev] [PATCH i-g-t 1/2] lib/igt_kms: Remove stale restrictions for HSW/BDW HDMI connector forcing Ville Syrjala
2019-08-23 18:33 ` [igt-dev] [PATCH i-g-t 2/2] tests/kms_force_connector_basic: Execute with HDMI connectors Ville Syrjala
2019-08-26 13:36 ` Ser, Simon [this message]
2019-08-23 20:07 ` [igt-dev] ✓ Fi.CI.BAT: success for series starting with [i-g-t,1/2] lib/igt_kms: Remove stale restrictions for HSW/BDW HDMI connector forcing Patchwork
2019-08-24 23:16 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
2019-08-26 13:05 ` [igt-dev] [PATCH i-g-t 1/2] " Ser, Simon
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=1f08d7201bd225fa25e2f82c0e76438c97cf2d9e.camel@intel.com \
--to=simon.ser@intel.com \
--cc=igt-dev@lists.freedesktop.org \
--cc=ville.syrjala@linux.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