Permalink
Browse files

Merge pull request #2 from lumag/master

CRTCs information
  • Loading branch information...
2 parents 21d5060 + dda3e38 commit 482a65ac39860df9ee12daaa53dd628b4c26c14d @geomatsi geomatsi committed Nov 2, 2012
Showing with 22 additions and 0 deletions.
  1. +22 −0 drm_info.c
View
@@ -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)

0 comments on commit 482a65a

Please sign in to comment.