diff options
Diffstat (limited to 'tests/mode')
-rw-r--r-- | tests/mode/modetest.c | 90 |
1 files changed, 45 insertions, 45 deletions
diff --git a/tests/mode/modetest.c b/tests/mode/modetest.c index eba072ee..3ff78f96 100644 --- a/tests/mode/modetest.c +++ b/tests/mode/modetest.c @@ -47,7 +47,7 @@ int printMode(struct drm_mode_modeinfo *mode) return 0; } -int printOutput(int fd, drmModeResPtr res, drmModeOutputPtr output, uint32_t id) +int printConnector(int fd, drmModeResPtr res, drmModeConnectorPtr connector, uint32_t id) { int i = 0, j; struct drm_mode_modeinfo *mode = NULL; @@ -55,28 +55,28 @@ int printOutput(int fd, drmModeResPtr res, drmModeOutputPtr output, uint32_t id) drmModeEncoderPtr enc; unsigned char *name = NULL; - printf("Output: %d-%d\n", output->output_type, output->output_type_id); + printf("Connector: %d-%d\n", connector->connector_type, connector->connector_type_id); printf("\tid : %i\n", id); - printf("\tcrtc id : %i\n", output->crtc); - printf("\tconn : %s\n", getConnectionText(output->connection)); - printf("\tsize : %ix%i (mm)\n", output->mmWidth, output->mmHeight); - printf("\tcount_crtcs : %i\n", output->count_crtcs); - printf("\tcrtcs : %i\n", output->crtcs); - 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); - printf("\tcount_encs : %i\n", output->count_encoders); - - for (i = 0; i < output->count_encoders; i++) { - enc = drmModeGetEncoder(fd, output->encoders[i]); + printf("\tcrtc id : %i\n", connector->crtc); + printf("\tconn : %s\n", getConnectionText(connector->connection)); + printf("\tsize : %ix%i (mm)\n", connector->mmWidth, connector->mmHeight); + printf("\tcount_crtcs : %i\n", connector->count_crtcs); + printf("\tcrtcs : %i\n", connector->crtcs); + printf("\tcount_clones : %i\n", connector->count_clones); + printf("\tclones : %i\n", connector->clones); + printf("\tcount_modes : %i\n", connector->count_modes); + printf("\tcount_props : %i\n", connector->count_props); + printf("\tcount_encs : %i\n", connector->count_encoders); + + for (i = 0; i < connector->count_encoders; i++) { + enc = drmModeGetEncoder(fd, connector->encoders[i]); if (enc) { printf("Encoder: %d %d %d %d\n", enc->encoder_id, enc->encoder_type, enc->crtcs, enc->clones); } } - for (i = 0; i < output->count_props; i++) { - props = drmModeGetProperty(fd, output->props[i]); + for (i = 0; i < connector->count_props; i++) { + props = drmModeGetProperty(fd, connector->props[i]); name = NULL; if (props) { printf("Property: %s\n", props->name); @@ -91,7 +91,7 @@ int printOutput(int fd, drmModeResPtr res, drmModeOutputPtr output, uint32_t id) if (props->flags & DRM_MODE_PROP_BLOB) { drmModePropertyBlobPtr blob; - blob = drmModeGetPropertyBlob(fd, output->prop_values[i]); + blob = drmModeGetPropertyBlob(fd, connector->prop_values[i]); if (blob) { printf("blob is %d length, %08X\n", blob->length, *(uint32_t *)blob->data); drmModeFreePropertyBlob(blob); @@ -103,15 +103,15 @@ int printOutput(int fd, drmModeResPtr res, drmModeOutputPtr output, uint32_t id) for (j = 0; j < props->count_enums; j++) { printf("\t\t%lld = %s\n", props->enums[j].value, props->enums[j].name); - if (output->prop_values[i] == props->enums[j].value) + if (connector->prop_values[i] == props->enums[j].value) name = props->enums[j].name; } if (props->count_enums && name) { - printf("\toutput property name %s %s\n", props->name, name); + printf("\tconnector property name %s %s\n", props->name, name); } else { - printf("\toutput property id %s %lli\n", props->name, output->prop_values[i]); + printf("\tconnector property id %s %lli\n", props->name, connector->prop_values[i]); } } @@ -119,12 +119,12 @@ int printOutput(int fd, drmModeResPtr res, drmModeOutputPtr output, uint32_t id) } } - for (i = 0; i < output->count_modes; i++) { - mode = &output->modes[i]; + for (i = 0; i < connector->count_modes; i++) { + mode = &connector->modes[i]; if (mode) printMode(mode); else - printf("\t\tmode: Invalid mode %p\n", &output->modes[i]); + printf("\t\tmode: Invalid mode %p\n", &connector->modes[i]); } return 0; @@ -149,8 +149,8 @@ int printCrtc(int fd, drmModeResPtr res, drmModeCrtcPtr crtc, uint32_t id) printf("\twidth : %i\n", crtc->width); printf("\theight : %i\n", crtc->height); printf("\tmode : %p\n", &crtc->mode); - printf("\tnum outputs : %i\n", crtc->count_outputs); - printf("\toutputs : %i\n", crtc->outputs); + printf("\tnum connectors : %i\n", crtc->count_connectors); + printf("\tconnectors : %i\n", crtc->connectors); printf("\tnum possible : %i\n", crtc->count_possibles); printf("\tpossibles : %i\n", crtc->possibles); @@ -174,19 +174,19 @@ int printFrameBuffer(int fd, drmModeResPtr res, drmModeFBPtr fb) int printRes(int fd, drmModeResPtr res) { int i; - drmModeOutputPtr output; + drmModeConnectorPtr connector; drmModeCrtcPtr crtc; drmModeFBPtr fb; drmModeEncoderPtr encoder; - for (i = 0; i < res->count_outputs; i++) { - output = drmModeGetOutput(fd, res->outputs[i]); + for (i = 0; i < res->count_connectors; i++) { + connector = drmModeGetConnector(fd, res->connectors[i]); - if (!output) - printf("Could not get output %i\n", i); + if (!connector) + printf("Could not get connector %i\n", i); else { - printOutput(fd, res, output, res->outputs[i]); - drmModeFreeOutput(output); + printConnector(fd, res, connector, res->connectors[i]); + drmModeFreeConnector(connector); } } @@ -246,24 +246,24 @@ static struct drm_mode_modeinfo mode = { int testMode(int fd, drmModeResPtr res) { - uint32_t output = res->outputs[0]; + uint32_t connector = res->connectors[0]; uint32_t newMode = 0; int ret = 0; int error = 0; - printf("Test: adding mode to output %i\n", output); + printf("Test: adding mode to connector %i\n", connector); /* printMode(&mode); */ - printf("\tAttaching mode %i to output %i\n", newMode, output); + printf("\tAttaching mode %i to connector %i\n", newMode, connector); - ret = drmModeAttachMode(fd, output, &mode); + ret = drmModeAttachMode(fd, connector, &mode); if (ret) goto err_mode; - printf("\tDetaching mode %i from output %i\n", newMode, output); - ret = drmModeDetachMode(fd, output, &mode); + printf("\tDetaching mode %i from connector %i\n", newMode, connector); + ret = drmModeDetachMode(fd, connector, &mode); if (ret) goto err_mode; @@ -362,15 +362,15 @@ err: int testDPMS(int fd, drmModeResPtr res) { - int output_id; + int connector_id; int i; - for (i = 0; i < res->count_outputs; i++) { - output_id = res->outputs[i]; - /* turn output off */ - drmModeOutputSetProperty(fd, output_id, dpms_prop_id, 3); + for (i = 0; i < res->count_connectors; i++) { + connector_id = res->connectors[i]; + /* turn connector off */ + drmModeConnectorSetProperty(fd, connector_id, dpms_prop_id, 3); sleep(2); - drmModeOutputSetProperty(fd, output_id, dpms_prop_id, 0); + drmModeConnectorSetProperty(fd, connector_id, dpms_prop_id, 0); } return 1; |