2 * DRM based mode setting test program
3 * Copyright 2008 Tungsten Graphics
4 * Jakob Bornecrantz <jakob@tungstengraphics.com>
5 * Copyright 2008 Intel Corporation
6 * Jesse Barnes <jesse.barnes@intel.com>
8 * Permission is hereby granted, free of charge, to any person obtaining a
9 * copy of this software and associated documentation files (the "Software"),
10 * to deal in the Software without restriction, including without limitation
11 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
12 * and/or sell copies of the Software, and to permit persons to whom the
13 * Software is furnished to do so, subject to the following conditions:
15 * The above copyright notice and this permission notice shall be included in
16 * all copies or substantial portions of the Software.
18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
23 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
28 * This fairly simple test program dumps output in a similar format to the
29 * "xrandr" tool everyone knows & loves. It's necessarily slightly different
30 * since the kernel separates outputs into encoder and connector structures,
31 * each with their own unique ID. The program also allows test testing of the
32 * memory management and mode setting APIs by allowing the user to specify a
33 * connector and mode to use for mode setting. If all works as expected, a
34 * blue background should be painted on the monitor attached to the specified
35 * connector after the selected mode is set.
37 * TODO: use cairo to write the mode info on the selected output once
38 * the mode has been programmed, along with possible test patterns.
54 #include "xf86drmMode.h"
55 #include "drm_fourcc.h"
60 drmModeRes *resources;
63 #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))
70 #define type_name_fn(res) \
71 char * res##_str(int type) { \
73 for (i = 0; i < ARRAY_SIZE(res##_names); i++) { \
74 if (res##_names[i].type == type) \
75 return res##_names[i].name; \
80 struct type_name encoder_type_names[] = {
81 { DRM_MODE_ENCODER_NONE, "none" },
82 { DRM_MODE_ENCODER_DAC, "DAC" },
83 { DRM_MODE_ENCODER_TMDS, "TMDS" },
84 { DRM_MODE_ENCODER_LVDS, "LVDS" },
85 { DRM_MODE_ENCODER_TVDAC, "TVDAC" },
88 type_name_fn(encoder_type)
90 struct type_name connector_status_names[] = {
91 { DRM_MODE_CONNECTED, "connected" },
92 { DRM_MODE_DISCONNECTED, "disconnected" },
93 { DRM_MODE_UNKNOWNCONNECTION, "unknown" },
96 type_name_fn(connector_status)
98 struct type_name connector_type_names[] = {
99 { DRM_MODE_CONNECTOR_Unknown, "unknown" },
100 { DRM_MODE_CONNECTOR_VGA, "VGA" },
101 { DRM_MODE_CONNECTOR_DVII, "DVI-I" },
102 { DRM_MODE_CONNECTOR_DVID, "DVI-D" },
103 { DRM_MODE_CONNECTOR_DVIA, "DVI-A" },
104 { DRM_MODE_CONNECTOR_Composite, "composite" },
105 { DRM_MODE_CONNECTOR_SVIDEO, "s-video" },
106 { DRM_MODE_CONNECTOR_LVDS, "LVDS" },
107 { DRM_MODE_CONNECTOR_Component, "component" },
108 { DRM_MODE_CONNECTOR_9PinDIN, "9-pin DIN" },
109 { DRM_MODE_CONNECTOR_DisplayPort, "displayport" },
110 { DRM_MODE_CONNECTOR_HDMIA, "HDMI-A" },
111 { DRM_MODE_CONNECTOR_HDMIB, "HDMI-B" },
112 { DRM_MODE_CONNECTOR_TV, "TV" },
113 { DRM_MODE_CONNECTOR_eDP, "embedded displayport" },
116 type_name_fn(connector_type)
118 #define bit_name_fn(res) \
119 char * res##_str(int type) { \
121 const char *sep = ""; \
122 for (i = 0; i < ARRAY_SIZE(res##_names); i++) { \
123 if (type & (1 << i)) { \
124 printf("%s%s", sep, res##_names[i]); \
130 static const char *mode_type_names[] = {
140 bit_name_fn(mode_type)
142 static const char *mode_flag_names[] = {
159 bit_name_fn(mode_flag)
161 void dump_encoders(void)
163 drmModeEncoder *encoder;
166 printf("Encoders:\n");
167 printf("id\tcrtc\ttype\tpossible crtcs\tpossible clones\t\n");
168 for (i = 0; i < resources->count_encoders; i++) {
169 encoder = drmModeGetEncoder(fd, resources->encoders[i]);
172 fprintf(stderr, "could not get encoder %i: %s\n",
173 resources->encoders[i], strerror(errno));
176 printf("%d\t%d\t%s\t0x%08x\t0x%08x\n",
179 encoder_type_str(encoder->encoder_type),
180 encoder->possible_crtcs,
181 encoder->possible_clones);
182 drmModeFreeEncoder(encoder);
187 void dump_mode(drmModeModeInfo *mode)
189 printf(" %s %d %d %d %d %d %d %d %d %d",
202 mode_flag_str(mode->flags);
204 mode_type_str(mode->type);
209 dump_blob(uint32_t blob_id)
212 unsigned char *blob_data;
213 drmModePropertyBlobPtr blob;
215 blob = drmModeGetPropertyBlob(fd, blob_id);
219 blob_data = blob->data;
221 for (i = 0; i < blob->length; i++) {
224 printf("%.2hhx", blob_data[i]);
228 drmModeFreePropertyBlob(blob);
232 dump_prop(uint32_t prop_id, uint64_t value)
235 drmModePropertyPtr prop;
237 prop = drmModeGetProperty(fd, prop_id);
239 printf("\t%d", prop_id);
245 printf(" %s:\n", prop->name);
247 printf("\t\tflags:");
248 if (prop->flags & DRM_MODE_PROP_PENDING)
250 if (prop->flags & DRM_MODE_PROP_RANGE)
252 if (prop->flags & DRM_MODE_PROP_IMMUTABLE)
253 printf(" immutable");
254 if (prop->flags & DRM_MODE_PROP_ENUM)
256 if (prop->flags & DRM_MODE_PROP_BITMASK)
258 if (prop->flags & DRM_MODE_PROP_BLOB)
262 if (prop->flags & DRM_MODE_PROP_RANGE) {
263 printf("\t\tvalues:");
264 for (i = 0; i < prop->count_values; i++)
265 printf(" %"PRIu64, prop->values[i]);
269 if (prop->flags & DRM_MODE_PROP_ENUM) {
270 printf("\t\tenums:");
271 for (i = 0; i < prop->count_enums; i++)
272 printf(" %s=%llu", prop->enums[i].name,
273 prop->enums[i].value);
275 } else if (prop->flags & DRM_MODE_PROP_BITMASK) {
276 printf("\t\tvalues:");
277 for (i = 0; i < prop->count_enums; i++)
278 printf(" %s=0x%llx", prop->enums[i].name,
279 (1LL << prop->enums[i].value));
282 assert(prop->count_enums == 0);
285 if (prop->flags & DRM_MODE_PROP_BLOB) {
286 printf("\t\tblobs:\n");
287 for (i = 0; i < prop->count_blobs; i++)
288 dump_blob(prop->blob_ids[i]);
291 assert(prop->count_blobs == 0);
294 printf("\t\tvalue:");
295 if (prop->flags & DRM_MODE_PROP_BLOB)
298 printf(" %"PRIu64"\n", value);
300 drmModeFreeProperty(prop);
303 void dump_connectors(void)
305 drmModeConnector *connector;
308 printf("Connectors:\n");
309 printf("id\tencoder\tstatus\t\ttype\tsize (mm)\tmodes\tencoders\n");
310 for (i = 0; i < resources->count_connectors; i++) {
311 connector = drmModeGetConnector(fd, resources->connectors[i]);
314 fprintf(stderr, "could not get connector %i: %s\n",
315 resources->connectors[i], strerror(errno));
319 printf("%d\t%d\t%s\t%s\t%dx%d\t\t%d\t",
320 connector->connector_id,
321 connector->encoder_id,
322 connector_status_str(connector->connection),
323 connector_type_str(connector->connector_type),
324 connector->mmWidth, connector->mmHeight,
325 connector->count_modes);
327 for (j = 0; j < connector->count_encoders; j++)
328 printf("%s%d", j > 0 ? ", " : "", connector->encoders[j]);
331 if (connector->count_modes) {
333 printf("\tname refresh (Hz) hdisp hss hse htot vdisp "
335 for (j = 0; j < connector->count_modes; j++)
336 dump_mode(&connector->modes[j]);
339 for (j = 0; j < connector->count_props; j++)
340 dump_prop(connector->props[j],
341 connector->prop_values[j]);
344 drmModeFreeConnector(connector);
349 void dump_crtcs(void)
352 drmModeObjectPropertiesPtr props;
357 printf("id\tfb\tpos\tsize\n");
358 for (i = 0; i < resources->count_crtcs; i++) {
359 crtc = drmModeGetCrtc(fd, resources->crtcs[i]);
362 fprintf(stderr, "could not get crtc %i: %s\n",
363 resources->crtcs[i], strerror(errno));
366 printf("%d\t%d\t(%d,%d)\t(%dx%d)\n",
370 crtc->width, crtc->height);
371 dump_mode(&crtc->mode);
374 props = drmModeObjectGetProperties(fd, crtc->crtc_id,
375 DRM_MODE_OBJECT_CRTC);
377 for (j = 0; j < props->count_props; j++)
378 dump_prop(props->props[j],
379 props->prop_values[j]);
380 drmModeFreeObjectProperties(props);
382 printf("\tcould not get crtc properties: %s\n",
386 drmModeFreeCrtc(crtc);
391 void dump_framebuffers(void)
396 printf("Frame buffers:\n");
397 printf("id\tsize\tpitch\n");
398 for (i = 0; i < resources->count_fbs; i++) {
399 fb = drmModeGetFB(fd, resources->fbs[i]);
402 fprintf(stderr, "could not get fb %i: %s\n",
403 resources->fbs[i], strerror(errno));
406 printf("%u\t(%ux%u)\t%u\n",
408 fb->width, fb->height,
416 static void dump_planes(void)
418 drmModeObjectPropertiesPtr props;
419 drmModePlaneRes *plane_resources;
423 plane_resources = drmModeGetPlaneResources(fd);
424 if (!plane_resources) {
425 fprintf(stderr, "drmModeGetPlaneResources failed: %s\n",
431 printf("id\tcrtc\tfb\tCRTC x,y\tx,y\tgamma size\n");
432 for (i = 0; i < plane_resources->count_planes; i++) {
433 ovr = drmModeGetPlane(fd, plane_resources->planes[i]);
435 fprintf(stderr, "drmModeGetPlane failed: %s\n",
440 printf("%d\t%d\t%d\t%d,%d\t\t%d,%d\t%d\n",
441 ovr->plane_id, ovr->crtc_id, ovr->fb_id,
442 ovr->crtc_x, ovr->crtc_y, ovr->x, ovr->y,
445 if (!ovr->count_formats)
449 for (j = 0; j < ovr->count_formats; j++)
450 printf(" %4.4s", (char *)&ovr->formats[j]);
454 props = drmModeObjectGetProperties(fd, ovr->plane_id,
455 DRM_MODE_OBJECT_PLANE);
457 for (j = 0; j < props->count_props; j++)
458 dump_prop(props->props[j],
459 props->prop_values[j]);
460 drmModeFreeObjectProperties(props);
462 printf("\tcould not get plane properties: %s\n",
466 drmModeFreePlane(ovr);
470 drmModeFreePlaneResources(plane_resources);
474 /* -----------------------------------------------------------------------------
475 * Connectors and planes
479 * Mode setting with the kernel interfaces is a bit of a chore.
480 * First you have to find the connector in question and make sure the
481 * requested mode is available.
482 * Then you need to find the encoder attached to that connector so you
483 * can bind it with a free crtc.
490 drmModeModeInfo *mode;
491 drmModeEncoder *encoder;
494 unsigned int fb_id[2], current_fb_id;
495 struct timeval start;
501 uint32_t con_id; /* the id of connector to bind to */
504 char format_str[5]; /* need to leave room for terminating \0 */
509 connector_find_mode(struct connector *c)
511 drmModeConnector *connector;
514 /* First, find the connector & mode */
516 for (i = 0; i < resources->count_connectors; i++) {
517 connector = drmModeGetConnector(fd, resources->connectors[i]);
520 fprintf(stderr, "could not get connector %i: %s\n",
521 resources->connectors[i], strerror(errno));
522 drmModeFreeConnector(connector);
526 if (!connector->count_modes) {
527 drmModeFreeConnector(connector);
531 if (connector->connector_id != c->id) {
532 drmModeFreeConnector(connector);
536 for (j = 0; j < connector->count_modes; j++) {
537 c->mode = &connector->modes[j];
538 if (!strcmp(c->mode->name, c->mode_str))
542 /* Found it, break out */
546 drmModeFreeConnector(connector);
550 fprintf(stderr, "failed to find mode \"%s\"\n", c->mode_str);
554 /* Now get the encoder */
555 for (i = 0; i < resources->count_encoders; i++) {
556 c->encoder = drmModeGetEncoder(fd, resources->encoders[i]);
559 fprintf(stderr, "could not get encoder %i: %s\n",
560 resources->encoders[i], strerror(errno));
561 drmModeFreeEncoder(c->encoder);
565 if (c->encoder->encoder_id == connector->encoder_id)
568 drmModeFreeEncoder(c->encoder);
572 c->crtc = c->encoder->crtc_id;
574 /* and figure out which crtc index it is: */
575 for (i = 0; i < resources->count_crtcs; i++) {
576 if (c->crtc == resources->crtcs[i]) {
584 /* -------------------------------------------------------------------------- */
587 page_flip_handler(int fd, unsigned int frame,
588 unsigned int sec, unsigned int usec, void *data)
591 unsigned int new_fb_id;
596 if (c->current_fb_id == c->fb_id[0])
597 new_fb_id = c->fb_id[1];
599 new_fb_id = c->fb_id[0];
601 drmModePageFlip(fd, c->crtc, new_fb_id,
602 DRM_MODE_PAGE_FLIP_EVENT, c);
603 c->current_fb_id = new_fb_id;
605 if (c->swap_count == 60) {
606 gettimeofday(&end, NULL);
607 t = end.tv_sec + end.tv_usec * 1e-6 -
608 (c->start.tv_sec + c->start.tv_usec * 1e-6);
609 fprintf(stderr, "freq: %.02fHz\n", c->swap_count / t);
616 set_plane(struct kms_driver *kms, struct connector *c, struct plane *p)
618 drmModePlaneRes *plane_resources;
620 uint32_t handles[4], pitches[4], offsets[4] = {0}; /* we only use [0] */
621 uint32_t plane_id = 0;
622 struct kms_bo *plane_bo;
623 uint32_t plane_flags = 0;
624 int ret, crtc_x, crtc_y, crtc_w, crtc_h;
627 /* find an unused plane which can be connected to our crtc */
628 plane_resources = drmModeGetPlaneResources(fd);
629 if (!plane_resources) {
630 fprintf(stderr, "drmModeGetPlaneResources failed: %s\n",
635 for (i = 0; i < plane_resources->count_planes && !plane_id; i++) {
636 ovr = drmModeGetPlane(fd, plane_resources->planes[i]);
638 fprintf(stderr, "drmModeGetPlane failed: %s\n",
643 if ((ovr->possible_crtcs & (1 << c->pipe)) && !ovr->crtc_id)
644 plane_id = ovr->plane_id;
646 drmModeFreePlane(ovr);
649 fprintf(stderr, "testing %dx%d@%s overlay plane\n",
650 p->w, p->h, p->format_str);
653 fprintf(stderr, "failed to find plane!\n");
657 plane_bo = create_test_buffer(kms, p->fourcc, p->w, p->h, handles,
658 pitches, offsets, PATTERN_TILES);
659 if (plane_bo == NULL)
662 /* just use single plane format for now.. */
663 if (drmModeAddFB2(fd, p->w, p->h, p->fourcc,
664 handles, pitches, offsets, &p->fb_id, plane_flags)) {
665 fprintf(stderr, "failed to add fb: %s\n", strerror(errno));
669 /* ok, boring.. but for now put in middle of screen: */
670 crtc_x = c->mode->hdisplay / 3;
671 crtc_y = c->mode->vdisplay / 3;
675 /* note src coords (last 4 args) are in Q16 format */
676 if (drmModeSetPlane(fd, plane_id, c->crtc, p->fb_id,
677 plane_flags, crtc_x, crtc_y, crtc_w, crtc_h,
678 0, 0, p->w << 16, p->h << 16)) {
679 fprintf(stderr, "failed to enable plane: %s\n",
688 set_mode(struct connector *c, int count, struct plane *p, int plane_count,
691 struct kms_driver *kms;
692 struct kms_bo *bo, *other_bo;
693 unsigned int fb_id, other_fb_id;
694 int i, j, ret, width, height, x;
695 uint32_t handles[4], pitches[4], offsets[4] = {0}; /* we only use [0] */
696 drmEventContext evctx;
700 for (i = 0; i < count; i++) {
701 connector_find_mode(&c[i]);
702 if (c[i].mode == NULL)
704 width += c[i].mode->hdisplay;
705 if (height < c[i].mode->vdisplay)
706 height = c[i].mode->vdisplay;
709 ret = kms_create(fd, &kms);
711 fprintf(stderr, "failed to create kms driver: %s\n",
716 bo = create_test_buffer(kms, c->fourcc, width, height, handles,
717 pitches, offsets, PATTERN_SMPTE);
721 ret = drmModeAddFB2(fd, width, height, c->fourcc,
722 handles, pitches, offsets, &fb_id, 0);
724 fprintf(stderr, "failed to add fb (%ux%u): %s\n",
725 width, height, strerror(errno));
730 for (i = 0; i < count; i++) {
731 if (c[i].mode == NULL)
734 printf("setting mode %s@%s on connector %d, crtc %d\n",
735 c[i].mode_str, c[i].format_str, c[i].id, c[i].crtc);
737 ret = drmModeSetCrtc(fd, c[i].crtc, fb_id, x, 0,
738 &c[i].id, 1, c[i].mode);
740 /* XXX: Actually check if this is needed */
741 drmModeDirtyFB(fd, fb_id, NULL, 0);
743 x += c[i].mode->hdisplay;
746 fprintf(stderr, "failed to set mode: %s\n", strerror(errno));
750 /* if we have a plane/overlay to show, set that up now: */
751 for (j = 0; j < plane_count; j++)
752 if (p[j].con_id == c[i].id)
753 if (set_plane(kms, &c[i], &p[j]))
760 other_bo = create_test_buffer(kms, c->fourcc, width, height, handles,
761 pitches, offsets, PATTERN_PLAIN);
762 if (other_bo == NULL)
765 ret = drmModeAddFB2(fd, width, height, c->fourcc, handles, pitches, offsets,
768 fprintf(stderr, "failed to add fb: %s\n", strerror(errno));
772 for (i = 0; i < count; i++) {
773 if (c[i].mode == NULL)
776 ret = drmModePageFlip(fd, c[i].crtc, other_fb_id,
777 DRM_MODE_PAGE_FLIP_EVENT, &c[i]);
779 fprintf(stderr, "failed to page flip: %s\n", strerror(errno));
782 gettimeofday(&c[i].start, NULL);
784 c[i].fb_id[0] = fb_id;
785 c[i].fb_id[1] = other_fb_id;
786 c[i].current_fb_id = other_fb_id;
789 memset(&evctx, 0, sizeof evctx);
790 evctx.version = DRM_EVENT_CONTEXT_VERSION;
791 evctx.vblank_handler = NULL;
792 evctx.page_flip_handler = page_flip_handler;
796 struct pollfd pfd[2];
799 pfd[0].events = POLLIN;
801 pfd[1].events = POLLIN;
803 if (poll(pfd, 2, -1) < 0) {
804 fprintf(stderr, "poll error\n");
811 struct timeval timeout = { .tv_sec = 3, .tv_usec = 0 };
818 ret = select(fd + 1, &fds, NULL, NULL, &timeout);
821 fprintf(stderr, "select timed out or error (ret %d)\n",
824 } else if (FD_ISSET(0, &fds)) {
829 drmHandleEvent(fd, &evctx);
833 kms_bo_destroy(&other_bo);
838 extern int optind, opterr, optopt;
839 static char optstr[] = "ecpmfs:P:v";
841 #define min(a, b) ((a) < (b) ? (a) : (b))
843 static int parse_connector(struct connector *c, const char *arg)
850 strcpy(c->format_str, "XR24");
852 c->id = strtoul(arg, &endp, 10);
855 c->crtc = strtoul(arg, &endp, 10);
862 p = strchrnul(arg, '@');
863 len = min(sizeof c->mode_str - 1, p - arg);
864 strncpy(c->mode_str, arg, len);
865 c->mode_str[len] = '\0';
868 strncpy(c->format_str, p + 1, 4);
869 c->format_str[4] = '\0';
871 c->fourcc = format_fourcc(p + 1);
872 if (c->fourcc == 0) {
873 fprintf(stderr, "unknown format %s\n", c->format_str);
881 static int parse_plane(struct plane *p, const char *arg)
883 strcpy(p->format_str, "XR24");
885 if (sscanf(arg, "%d:%dx%d@%4s", &p->con_id, &p->w, &p->h, &p->format_str) != 4 &&
886 sscanf(arg, "%d:%dx%d", &p->con_id, &p->w, &p->h) != 3)
889 p->fourcc = format_fourcc(p->format_str);
890 if (p->fourcc == 0) {
891 fprintf(stderr, "unknown format %s\n", p->format_str);
898 void usage(char *name)
900 fprintf(stderr, "usage: %s [-ecpmf]\n", name);
901 fprintf(stderr, "\t-e\tlist encoders\n");
902 fprintf(stderr, "\t-c\tlist connectors\n");
903 fprintf(stderr, "\t-p\tlist CRTCs and planes (pipes)\n");
904 fprintf(stderr, "\t-m\tlist modes\n");
905 fprintf(stderr, "\t-f\tlist framebuffers\n");
906 fprintf(stderr, "\t-v\ttest vsynced page flipping\n");
907 fprintf(stderr, "\t-s <connector_id>[@<crtc_id>]:<mode>[@<format>]\tset a mode\n");
908 fprintf(stderr, "\t-P <connector_id>:<w>x<h>[@<format>]\tset a plane\n");
909 fprintf(stderr, "\n\tDefault is to dump all info.\n");
913 #define dump_resource(res) if (res) dump_##res()
915 static int page_flipping_supported(void)
917 /*FIXME: generic ioctl needed? */
921 struct drm_i915_getparam gp;
923 gp.param = I915_PARAM_HAS_PAGEFLIPPING;
926 ret = drmCommandWriteRead(fd, DRM_I915_GETPARAM, &gp, sizeof(gp));
928 fprintf(stderr, "drm_i915_getparam: %m\n");
936 int main(int argc, char **argv)
939 int encoders = 0, connectors = 0, crtcs = 0, planes = 0, framebuffers = 0;
941 char *modules[] = { "i915", "radeon", "nouveau", "vmwgfx", "omapdrm", "exynos" };
943 int count = 0, plane_count = 0;
944 struct connector con_args[2];
945 struct plane plane_args[2] = {0};
948 while ((c = getopt(argc, argv, optstr)) != -1) {
970 if (parse_connector(&con_args[count], optarg) < 0)
975 if (parse_plane(&plane_args[plane_count], optarg) < 0)
986 encoders = connectors = crtcs = planes = modes = framebuffers = 1;
988 for (i = 0; i < ARRAY_SIZE(modules); i++) {
989 printf("trying to load module %s...", modules[i]);
990 fd = drmOpen(modules[i], NULL);
994 printf("success.\n");
999 if (test_vsync && !page_flipping_supported()) {
1000 fprintf(stderr, "page flipping not supported by drm.\n");
1004 if (i == ARRAY_SIZE(modules)) {
1005 fprintf(stderr, "failed to load any modules, aborting.\n");
1009 resources = drmModeGetResources(fd);
1011 fprintf(stderr, "drmModeGetResources failed: %s\n",
1017 dump_resource(encoders);
1018 dump_resource(connectors);
1019 dump_resource(crtcs);
1020 dump_resource(planes);
1021 dump_resource(framebuffers);
1024 set_mode(con_args, count, plane_args, plane_count, test_vsync);
1028 drmModeFreeResources(resources);