summaryrefslogtreecommitdiff
path: root/tests/mode
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2007-11-27 14:31:02 +1000
committerDave Airlie <airlied@redhat.com>2007-11-27 14:31:02 +1000
commitb3af2b59a77a6916ea7151236d3da9bde6a537fc (patch)
tree5d376ad9c6c4727dd7c8fdca4277c56b7d33cb85 /tests/mode
parentf9ac54b0319b273de83a004d6cfdf46a3b9d6ced (diff)
drm/modesetting: add initial gettable properites code.
This allow the user to retrieve a list of properties for an output. Properties can either be 32-bit values or an enum with an associated name. Range properties are to be supported. This API is probably not all correct, I may make properties part of the general resource get when I think about it some more. So basically you can create properties and attached them to whatever outputs you want, so it should be possible to create some generics and just attach them to every output.
Diffstat (limited to 'tests/mode')
-rw-r--r--tests/mode/modetest.c34
1 files changed, 33 insertions, 1 deletions
diff --git a/tests/mode/modetest.c b/tests/mode/modetest.c
index 8f151758..50271af9 100644
--- a/tests/mode/modetest.c
+++ b/tests/mode/modetest.c
@@ -57,8 +57,10 @@ int printMode(struct drm_mode_modeinfo *mode)
int printOutput(int fd, drmModeResPtr res, drmModeOutputPtr output, uint32_t id)
{
- int i = 0;
+ int i = 0, j;
struct drm_mode_modeinfo *mode = NULL;
+ drmModePropertyPtr props;
+ unsigned char *name = NULL;
printf("Output: %s\n", output->name);
printf("\tid : %i\n", id);
@@ -70,6 +72,36 @@ int printOutput(int fd, drmModeResPtr res, drmModeOutputPtr output, uint32_t id)
printf("\tcount_clones : %i\n", output->count_clones);
printf("\tclones : %i\n", output->clones);
printf("\tcount_modes : %i\n", output->count_modes);
+ printf("\tcount_props : %i\n", output->count_props);
+
+ for (i = 0; i < output->count_props; i++) {
+ props = drmModeGetProperty(fd, output->props[i]);
+ name = NULL;
+ if (props) {
+ printf("Property: %s\n", props->name);
+ printf("\tid: %i\n", props->prop_id);
+ printf("\tflags: %i\n", props->flags);
+ printf("\tvalues %d: ", props->count_values);
+ for (j = 0; j < props->count_values; j++)
+ printf("%d ", props->values[j]);
+
+ printf("\n\tenums %d: \n", props->count_enums);
+
+ for (j = 0; j < props->count_enums; j++) {
+ if (output->prop_values[i] == props->enums[j].value)
+ name = props->enums[j].name;
+ printf("\t\t%d = %s\n", props->enums[j].value, props->enums[j].name);
+ }
+
+ if (props->count_enums && name) {
+ printf("\toutput property name %s %s\n", props->name, name);
+ } else {
+ printf("\toutput property id %s %i\n", props->name, output->prop_values[i]);
+ }
+
+ drmModeFreeProperty(props);
+ }
+ }
for (i = 0; i < output->count_modes; i++) {
mode = findMode(res, output->modes[i]);