From: Hyungwon Hwang <human.hwang@samsung.com>
To: dri-devel@lists.freedesktop.org, ppaalanen@gmail.com,
emil.l.velikov@gmail.com
Subject: [PATCH v3 1/3] modetest: introduce get_prop_info() for getting property id and type
Date: Wed, 23 Sep 2015 11:45:12 +0900 [thread overview]
Message-ID: <1442976314-5792-1-git-send-email-human.hwang@samsung.com> (raw)
Modetest gets the property name from user to set it. So the name must be
converted to its id. Until now, this is done in the set_property(). But to
support atomic modeset in modetest, this logic should be separated from the
fuction, because atomic modeset and legacy modeset use different IOCTLs.
Signed-off-by: Hyungwon Hwang <human.hwang@samsung.com>
---
tests/modetest/modetest.c | 29 ++++++++++++++++++++---------
1 file changed, 20 insertions(+), 9 deletions(-)
diff --git a/tests/modetest/modetest.c b/tests/modetest/modetest.c
index 3b01918..08ecf58 100644
--- a/tests/modetest/modetest.c
+++ b/tests/modetest/modetest.c
@@ -894,12 +894,11 @@ struct property_arg {
uint64_t value;
};
-static void set_property(struct device *dev, struct property_arg *p)
+static int get_prop_info(struct resources *resources, struct property_arg *p,
+ const char *obj_type)
{
drmModeObjectProperties *props = NULL;
drmModePropertyRes **props_info = NULL;
- const char *obj_type;
- int ret;
int i;
p->obj_type = 0;
@@ -918,21 +917,21 @@ static void set_property(struct device *dev, struct property_arg *p)
} \
} while(0) \
- find_object(dev->resources, res, crtc, CRTC);
+ find_object(resources, res, crtc, CRTC);
if (p->obj_type == 0)
- find_object(dev->resources, res, connector, CONNECTOR);
+ find_object(resources, res, connector, CONNECTOR);
if (p->obj_type == 0)
- find_object(dev->resources, plane_res, plane, PLANE);
+ find_object(resources, plane_res, plane, PLANE);
if (p->obj_type == 0) {
fprintf(stderr, "Object %i not found, can't set property\n",
p->obj_id);
- return;
+ return -1;
}
if (!props) {
fprintf(stderr, "%s %i has no properties\n",
obj_type, p->obj_id);
- return;
+ return -1;
}
for (i = 0; i < (int)props->count_props; ++i) {
@@ -945,11 +944,23 @@ static void set_property(struct device *dev, struct property_arg *p)
if (i == (int)props->count_props) {
fprintf(stderr, "%s %i has no %s property\n",
obj_type, p->obj_id, p->name);
- return;
+ return -1;
}
p->prop_id = props->props[i];
+ return 0;
+}
+
+static void set_property(struct device *dev, struct property_arg *p)
+{
+ int ret;
+ const char *obj_type = NULL;
+
+ ret = get_prop_info(dev->resources, p, obj_type);
+ if (ret < 0)
+ return;
+
ret = drmModeObjectSetProperty(dev->fd, p->obj_id, p->obj_type,
p->prop_id, p->value);
if (ret < 0)
--
2.4.3
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel
next reply other threads:[~2015-09-23 2:45 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-09-23 2:45 Hyungwon Hwang [this message]
2015-09-23 2:45 ` [PATCH v3 2/3] modetest: add atomic modeset support Hyungwon Hwang
2015-11-26 23:42 ` Emil Velikov
2015-09-23 2:45 ` [PATCH v3 3/3] modetest: add atomic page flip support Hyungwon Hwang
2015-11-26 23:57 ` Emil Velikov
2015-11-26 16:42 ` [PATCH v3 1/3] modetest: introduce get_prop_info() for getting property id and type Emil Velikov
2015-11-27 2:37 ` Hyungwon Hwang
2015-12-07 16:37 ` Thierry Reding
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=1442976314-5792-1-git-send-email-human.hwang@samsung.com \
--to=human.hwang@samsung.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=emil.l.velikov@gmail.com \
--cc=ppaalanen@gmail.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