From: Simon Ser <simon.ser@intel.com>
To: igt-dev@lists.freedesktop.org
Cc: martin.peres@intel.com
Subject: [igt-dev] [PATCH i-g-t 2/3] lib/igt_chamelium: add chamelium_supports_get_video_params
Date: Wed, 3 Jul 2019 10:57:30 +0300 [thread overview]
Message-ID: <20190703075731.7785-2-simon.ser@intel.com> (raw)
In-Reply-To: <20190703075731.7785-1-simon.ser@intel.com>
This allows to skip video params tests on Chamelium boards which aren't recent
enough.
Signed-off-by: Simon Ser <simon.ser@intel.com>
---
lib/igt_chamelium.c | 48 ++++++++++++++++++++++++++-------------------
lib/igt_chamelium.h | 1 +
2 files changed, 29 insertions(+), 20 deletions(-)
diff --git a/lib/igt_chamelium.c b/lib/igt_chamelium.c
index c332291ef305..3803a90e4250 100644
--- a/lib/igt_chamelium.c
+++ b/lib/igt_chamelium.c
@@ -658,6 +658,33 @@ void chamelium_port_get_resolution(struct chamelium *chamelium,
xmlrpc_DECREF(res);
}
+/** chamelium_supports_method: checks if the Chamelium board supports a method.
+ *
+ * Note: this actually tries to call the method.
+ *
+ * See https://crbug.com/977995 for a discussion about a better solution.
+ */
+static bool chamelium_supports_method(struct chamelium *chamelium,
+ const char *name)
+{
+ xmlrpc_value *res;
+
+ res = __chamelium_rpc(chamelium, NULL, name, "()");
+ if (res)
+ xmlrpc_DECREF(res);
+
+ /* XML-RPC has a special code for unsupported methods
+ * (XMLRPC_NO_SUCH_METHOD_ERROR) however the Chamelium implementation
+ * doesn't return it. */
+ return (!chamelium->env.fault_occurred ||
+ strstr(chamelium->env.fault_string, "not supported") == NULL);
+}
+
+bool chamelium_supports_get_video_params(struct chamelium *chamelium)
+{
+ return chamelium_supports_method(chamelium, "GetVideoParams");
+}
+
static void read_int_from_xml_struct(struct chamelium *chamelium,
xmlrpc_value *struct_val, const char *key,
int *dst)
@@ -1018,32 +1045,13 @@ int chamelium_get_captured_frame_count(struct chamelium *chamelium)
return ret;
}
-/**
- * chamelium_supports_get_audio_format: check the Chamelium device supports
- * retrieving the capture audio format.
- */
-static bool chamelium_supports_get_audio_format(struct chamelium *chamelium)
-{
- xmlrpc_value *res;
-
- res = __chamelium_rpc(chamelium, NULL, "GetAudioFormat", "(i)", 3);
- if (res)
- xmlrpc_DECREF(res);
-
- /* XML-RPC has a special code for unsupported methods
- * (XMLRPC_NO_SUCH_METHOD_ERROR) however the Chamelium implementation
- * doesn't return it. */
- return (!chamelium->env.fault_occurred ||
- strstr(chamelium->env.fault_string, "not supported") == NULL);
-}
-
bool chamelium_has_audio_support(struct chamelium *chamelium,
struct chamelium_port *port)
{
xmlrpc_value *res;
xmlrpc_bool has_support;
- if (!chamelium_supports_get_audio_format(chamelium)) {
+ if (!chamelium_supports_method(chamelium, "GetAudioFormat")) {
igt_debug("The Chamelium device doesn't support GetAudioFormat\n");
return false;
}
diff --git a/lib/igt_chamelium.h b/lib/igt_chamelium.h
index cd5813821fb4..8b4fc3344c64 100644
--- a/lib/igt_chamelium.h
+++ b/lib/igt_chamelium.h
@@ -119,6 +119,7 @@ void chamelium_port_set_ddc_state(struct chamelium *chamelium,
void chamelium_port_get_resolution(struct chamelium *chamelium,
struct chamelium_port *port,
int *x, int *y);
+bool chamelium_supports_get_video_params(struct chamelium *chamelium);
void chamelium_port_get_video_params(struct chamelium *chamelium,
struct chamelium_port *port,
struct chamelium_video_params *params);
--
2.22.0
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev
next prev parent reply other threads:[~2019-07-03 7:57 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-07-03 7:57 [igt-dev] [PATCH i-g-t 1/3] lib/igt_chamelium: add chamelium_port_get_video_params Simon Ser
2019-07-03 7:57 ` Simon Ser [this message]
2019-07-03 7:57 ` [igt-dev] [PATCH i-g-t 3/3] tests/kms_chamelium: add a test checking modes Simon Ser
2019-07-03 14:14 ` Peres, Martin
2019-07-04 7:25 ` Ser, Simon
2019-07-17 13:26 ` Martin Peres
2019-07-17 14:36 ` Ser, Simon
2019-07-03 8:32 ` [igt-dev] ✓ Fi.CI.BAT: success for series starting with [i-g-t,1/3] lib/igt_chamelium: add chamelium_port_get_video_params Patchwork
2019-07-04 1:36 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
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=20190703075731.7785-2-simon.ser@intel.com \
--to=simon.ser@intel.com \
--cc=igt-dev@lists.freedesktop.org \
--cc=martin.peres@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