From 7983e19ed62ec8db1884f55e07e458a62cc51e37 Mon Sep 17 00:00:00 2001 From: Radhakrishna Sripada Date: Fri, 12 Oct 2018 00:18:46 -0700 Subject: tests/kms_properties: Add functional test for "max bpc" property MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Test the values in the range advertised by the "max bpc" property. Cc: Ville Syrjälä Cc: Daniel Vetter Signed-off-by: Radhakrishna Sripada Reviewed-by: Rodrigo Vivi --- tests/kms_properties.c | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/tests/kms_properties.c b/tests/kms_properties.c index f5a86236..503a5c25 100644 --- a/tests/kms_properties.c +++ b/tests/kms_properties.c @@ -82,7 +82,37 @@ static bool ignore_property(uint32_t obj_type, uint32_t prop_flags, return false; } -static const struct additional_test property_functional_test[] = {}; +static void max_bpc_prop_test(int fd, uint32_t id, uint32_t type, drmModePropertyPtr prop, + uint32_t prop_id, uint64_t prop_value, bool atomic) +{ + drmModeAtomicReqPtr req = NULL; + int i, ret; + + if (atomic) + req = drmModeAtomicAlloc(); + + for ( i = prop->values[0]; i < prop->values[1] ; i++) { + if (!atomic) { + ret = drmModeObjectSetProperty(fd, id, type, prop_id, i); + + igt_assert_eq(ret, 0); + } else { + ret = drmModeAtomicAddProperty(req, id, prop_id, i); + igt_assert(ret >= 0); + + ret = drmModeAtomicCommit(fd, req, DRM_MODE_ATOMIC_TEST_ONLY, NULL); + igt_assert_eq(ret, 0); + } + } + + if (atomic) + drmModeAtomicFree(req); +} + +static const struct additional_test property_functional_test[] = { + {"max bpc", DRM_MODE_OBJECT_CONNECTOR, + max_bpc_prop_test}, + }; static bool has_additional_test_lookup(uint32_t obj_type, const char *name, bool atomic, int *index) -- cgit v1.2.3