Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

drm_info: output information about crtcs

Signed-off-by: Dmitry Eremin-Solenikov <dmitry_eremin@mentor.com>
  • Loading branch information...
commit dda3e38303054fd79c2e1bdb8b235a249303f657 1 parent 7b041ea
Dmitry Eremin-Solenikov authored
Showing with 22 additions and 0 deletions.
  1. +22 −0 drm_info.c
View
22 drm_info.c
@@ -97,6 +97,17 @@ static const char device_name[] = "/dev/dri/card0";
/* */
+void crtc_info(drmModeRes *resources, drmModeCrtc *crtc)
+{
+ printf("\ncrtc [id = %u]\n", crtc->crtc_id);
+ printf("\tbuffer [id = %u]\n", crtc->buffer_id);
+ printf("\tposition: %xx%x @ %xx%x\n", crtc->width, crtc->height, crtc->x, crtc->y);
+ if (crtc->mode_valid)
+ printf("\tMode: valid [%s]\n", crtc->mode.name);
+ else
+ printf("\tMode: invalid\n");
+}
+
void connector_info(drmModeRes *resources, drmModeConnector *connector)
{
drmModeModeInfo *mode;
@@ -178,12 +189,14 @@ void encoder_info(drmModeRes *resources, drmModeEncoder *encoder)
printf("\nEncoder [id = %u]\n", encoder->encoder_id);
printf("\ttype [%s]\n", encoder_type_str(encoder->encoder_type));
+ printf("\tCrtc [id = %u]\n", encoder->crtc_id);
return;
}
int main(int argc, char *argv[])
{
+ drmModeCrtc *crtc;
drmModeConnector *connector;
drmModeEncoder *encoder;
drmModeRes *resources;
@@ -227,6 +240,15 @@ int main(int argc, char *argv[])
}
+ for (i = 0; i < resources->count_crtcs; i++) {
+ crtc = drmModeGetCrtc(fd, resources->crtcs[i]);
+ if (crtc == NULL)
+ continue;
+
+ crtc_info(resources, crtc);
+ drmModeFreeCrtc(crtc);
+ }
+
for (i = 0; i < resources->count_connectors; i++) {
connector = drmModeGetConnector(fd, resources->connectors[i]);
if (connector == NULL)
Please sign in to comment.
Something went wrong with that request. Please try again.