From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: Chris Wilson <chris@chris-wilson.co.uk>
Cc: intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH igt 2/2] lib: Override the connector status using the sysfs status attribute
Date: Thu, 26 May 2016 17:39:32 +0300 [thread overview]
Message-ID: <20160526143932.GU4329@intel.com> (raw)
In-Reply-To: <1464272070-23893-2-git-send-email-chris@chris-wilson.co.uk>
On Thu, May 26, 2016 at 03:14:30PM +0100, Chris Wilson wrote:
> There are two paths to force enable a connector, via debugfs and via
> sysfs. sysfs has the advantage of being a stable interface and of
> updating the connector after application (allowing us to not force a
> reprobe from userspace).
>
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
> ---
> lib/igt_kms.c | 27 +++++++++------------------
> 1 file changed, 9 insertions(+), 18 deletions(-)
>
> diff --git a/lib/igt_kms.c b/lib/igt_kms.c
> index 4da645a..5678248 100644
> --- a/lib/igt_kms.c
> +++ b/lib/igt_kms.c
> @@ -48,6 +48,7 @@
> #include "igt_aux.h"
> #include "intel_chipset.h"
> #include "igt_debugfs.h"
> +#include "igt_sysfs.h"
>
> /* list of connectors that need resetting on exit */
> #define MAX_CONNECTORS 32
> @@ -596,9 +597,9 @@ bool kmstest_force_connector(int drm_fd, drmModeConnector *connector,
> {
> char *path, **tmp;
> const char *value;
> - int debugfs_fd, ret, len;
> drmModeConnector *temp;
> uint32_t devid;
> + int len;
>
> devid = intel_get_drm_devid(drm_fd);
>
> @@ -615,7 +616,7 @@ bool kmstest_force_connector(int drm_fd, drmModeConnector *connector,
> value = "on";
> break;
> case FORCE_CONNECTOR_DIGITAL:
> - value = "digital";
> + value = "on-digital";
> break;
> case FORCE_CONNECTOR_OFF:
> value = "off";
> @@ -623,20 +624,14 @@ bool kmstest_force_connector(int drm_fd, drmModeConnector *connector,
>
> default:
> case FORCE_CONNECTOR_UNSPECIFIED:
> - value = "unspecified";
> + value = "detect";
> break;
> }
>
> - igt_assert_neq(asprintf(&path, "%s-%d/force", kmstest_connector_type_str(connector->connector_type), connector->connector_type_id),
> + igt_assert_neq(asprintf(&path, "%s-%d/status", kmstest_connector_type_str(connector->connector_type), connector->connector_type_id),
That'll need a cardN- prefix. Rather annoying.
> -1);
> - debugfs_fd = igt_debugfs_open(path, O_WRONLY | O_TRUNC);
> -
> - if (debugfs_fd == -1) {
> + if (!igt_sysfs_set(path, value))
> return false;
> - }
> -
> - ret = write(debugfs_fd, value, strlen(value));
> - close(debugfs_fd);
>
> for (len = 0, tmp = forced_connectors; *tmp; tmp++) {
> /* check the connector is not already present */
> @@ -669,8 +664,7 @@ bool kmstest_force_connector(int drm_fd, drmModeConnector *connector,
> temp = drmModeGetConnector(drm_fd, connector->connector_id);
> drmModeFreeConnector(temp);
>
> - igt_assert(ret != -1);
> - return (ret == -1) ? false : true;
> + return true;
> }
>
> /**
> @@ -2548,9 +2542,6 @@ void igt_reset_connectors(void)
> /* reset the connectors stored in forced_connectors, avoiding any
> * functions that are not safe to call in signal handlers */
>
> - for (tmp = forced_connectors; *tmp; tmp++) {
> - int fd = igt_debugfs_open(*tmp, O_WRONLY | O_TRUNC);
> - igt_assert(write(fd, "unspecified", 11) == 11);
> - close(fd);
> - }
> + for (tmp = forced_connectors; *tmp; tmp++)
> + igt_sysfs_set(*tmp, "detect");
> }
> --
> 2.8.1
--
Ville Syrjälä
Intel OTC
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
next prev parent reply other threads:[~2016-05-26 14:39 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-05-26 14:14 [PATCH igt 1/2] lib: Add simple sysfs accessors Chris Wilson
2016-05-26 14:14 ` [PATCH igt 2/2] lib: Override the connector status using the sysfs status attribute Chris Wilson
2016-05-26 14:39 ` Ville Syrjälä [this message]
2016-05-26 14:55 ` Chris Wilson
2016-05-26 14:36 ` [PATCH igt 1/2] lib: Add simple sysfs accessors Ville Syrjälä
2016-05-26 14:50 ` Chris Wilson
2016-05-26 15:07 ` [PATCH igt v2 " Chris Wilson
2016-05-26 15:07 ` [PATCH igt v2 2/2] lib: Override the connector status using the sysfs status attribute Chris Wilson
2016-05-26 16:19 ` [PATCH igt v3] lib: Add simple sysfs accessors Chris Wilson
2016-05-27 17:46 ` Ville Syrjälä
2016-05-27 18:07 ` Chris Wilson
2016-05-30 14:45 ` Ville Syrjälä
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=20160526143932.GU4329@intel.com \
--to=ville.syrjala@linux.intel.com \
--cc=chris@chris-wilson.co.uk \
--cc=intel-gfx@lists.freedesktop.org \
/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