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 const 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 static 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 static 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, "DP" },
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, "eDP" },
116 static type_name_fn(connector_type)
118 #define bit_name_fn(res) \
119 const 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]); \
131 static const char *mode_type_names[] = {
141 static bit_name_fn(mode_type)
143 static const char *mode_flag_names[] = {
160 static bit_name_fn(mode_flag)
162 static void dump_encoders(void)
164 drmModeEncoder *encoder;
167 printf("Encoders:\n");
168 printf("id\tcrtc\ttype\tpossible crtcs\tpossible clones\t\n");
169 for (i = 0; i < resources->count_encoders; i++) {
170 encoder = drmModeGetEncoder(fd, resources->encoders[i]);
173 fprintf(stderr, "could not get encoder %i: %s\n",
174 resources->encoders[i], strerror(errno));
177 printf("%d\t%d\t%s\t0x%08x\t0x%08x\n",
180 encoder_type_str(encoder->encoder_type),
181 encoder->possible_crtcs,
182 encoder->possible_clones);
183 drmModeFreeEncoder(encoder);
188 static void dump_mode(drmModeModeInfo *mode)
190 printf(" %s %d %d %d %d %d %d %d %d %d",
203 mode_flag_str(mode->flags);
205 mode_type_str(mode->type);
210 dump_blob(uint32_t blob_id)
213 unsigned char *blob_data;
214 drmModePropertyBlobPtr blob;
216 blob = drmModeGetPropertyBlob(fd, blob_id);
220 blob_data = blob->data;
222 for (i = 0; i < blob->length; i++) {
225 printf("%.2hhx", blob_data[i]);
229 drmModeFreePropertyBlob(blob);
233 dump_prop(uint32_t prop_id, uint64_t value)
236 drmModePropertyPtr prop;
238 prop = drmModeGetProperty(fd, prop_id);
240 printf("\t%d", prop_id);
246 printf(" %s:\n", prop->name);
248 printf("\t\tflags:");
249 if (prop->flags & DRM_MODE_PROP_PENDING)
251 if (prop->flags & DRM_MODE_PROP_RANGE)
253 if (prop->flags & DRM_MODE_PROP_IMMUTABLE)
254 printf(" immutable");
255 if (prop->flags & DRM_MODE_PROP_ENUM)
257 if (prop->flags & DRM_MODE_PROP_BITMASK)
259 if (prop->flags & DRM_MODE_PROP_BLOB)
263 if (prop->flags & DRM_MODE_PROP_RANGE) {
264 printf("\t\tvalues:");
265 for (i = 0; i < prop->count_values; i++)
266 printf(" %"PRIu64, prop->values[i]);
270 if (prop->flags & DRM_MODE_PROP_ENUM) {
271 printf("\t\tenums:");
272 for (i = 0; i < prop->count_enums; i++)
273 printf(" %s=%llu", prop->enums[i].name,
274 prop->enums[i].value);
276 } else if (prop->flags & DRM_MODE_PROP_BITMASK) {
277 printf("\t\tvalues:");
278 for (i = 0; i < prop->count_enums; i++)
279 printf(" %s=0x%llx", prop->enums[i].name,
280 (1LL << prop->enums[i].value));
283 assert(prop->count_enums == 0);
286 if (prop->flags & DRM_MODE_PROP_BLOB) {
287 printf("\t\tblobs:\n");
288 for (i = 0; i < prop->count_blobs; i++)
289 dump_blob(prop->blob_ids[i]);
292 assert(prop->count_blobs == 0);
295 printf("\t\tvalue:");
296 if (prop->flags & DRM_MODE_PROP_BLOB)
299 printf(" %"PRIu64"\n", value);
301 drmModeFreeProperty(prop);
304 static void dump_connectors(void)
306 drmModeConnector *connector;
309 printf("Connectors:\n");
310 printf("id\tencoder\tstatus\t\ttype\tsize (mm)\tmodes\tencoders\n");
311 for (i = 0; i < resources->count_connectors; i++) {
312 connector = drmModeGetConnector(fd, resources->connectors[i]);
315 fprintf(stderr, "could not get connector %i: %s\n",
316 resources->connectors[i], strerror(errno));
320 printf("%d\t%d\t%s\t%s\t%dx%d\t\t%d\t",
321 connector->connector_id,
322 connector->encoder_id,
323 connector_status_str(connector->connection),
324 connector_type_str(connector->connector_type),
325 connector->mmWidth, connector->mmHeight,
326 connector->count_modes);
328 for (j = 0; j < connector->count_encoders; j++)
329 printf("%s%d", j > 0 ? ", " : "", connector->encoders[j]);
332 if (connector->count_modes) {
334 printf("\tname refresh (Hz) hdisp hss hse htot vdisp "
336 for (j = 0; j < connector->count_modes; j++)
337 dump_mode(&connector->modes[j]);
340 for (j = 0; j < connector->count_props; j++)
341 dump_prop(connector->props[j],
342 connector->prop_values[j]);
345 drmModeFreeConnector(connector);
350 static void dump_crtcs(void)
353 drmModeObjectPropertiesPtr props;
358 printf("id\tfb\tpos\tsize\n");
359 for (i = 0; i < resources->count_crtcs; i++) {
360 crtc = drmModeGetCrtc(fd, resources->crtcs[i]);
363 fprintf(stderr, "could not get crtc %i: %s\n",
364 resources->crtcs[i], strerror(errno));
367 printf("%d\t%d\t(%d,%d)\t(%dx%d)\n",
371 crtc->width, crtc->height);
372 dump_mode(&crtc->mode);
375 props = drmModeObjectGetProperties(fd, crtc->crtc_id,
376 DRM_MODE_OBJECT_CRTC);
378 for (j = 0; j < props->count_props; j++)
379 dump_prop(props->props[j],
380 props->prop_values[j]);
381 drmModeFreeObjectProperties(props);
383 printf("\tcould not get crtc properties: %s\n",
387 drmModeFreeCrtc(crtc);
392 static void dump_framebuffers(void)
397 printf("Frame buffers:\n");
398 printf("id\tsize\tpitch\n");
399 for (i = 0; i < resources->count_fbs; i++) {
400 fb = drmModeGetFB(fd, resources->fbs[i]);
403 fprintf(stderr, "could not get fb %i: %s\n",
404 resources->fbs[i], strerror(errno));
407 printf("%u\t(%ux%u)\t%u\n",
409 fb->width, fb->height,
417 static void dump_planes(void)
419 drmModeObjectPropertiesPtr props;
420 drmModePlaneRes *plane_resources;
424 plane_resources = drmModeGetPlaneResources(fd);
425 if (!plane_resources) {
426 fprintf(stderr, "drmModeGetPlaneResources failed: %s\n",
432 printf("id\tcrtc\tfb\tCRTC x,y\tx,y\tgamma size\tpossible crtcs\n");
433 for (i = 0; i < plane_resources->count_planes; i++) {
434 ovr = drmModeGetPlane(fd, plane_resources->planes[i]);
436 fprintf(stderr, "drmModeGetPlane failed: %s\n",
441 printf("%d\t%d\t%d\t%d,%d\t\t%d,%d\t%-8d\t0x%08x\n",
442 ovr->plane_id, ovr->crtc_id, ovr->fb_id,
443 ovr->crtc_x, ovr->crtc_y, ovr->x, ovr->y,
444 ovr->gamma_size, ovr->possible_crtcs);
446 if (!ovr->count_formats)
450 for (j = 0; j < ovr->count_formats; j++)
451 printf(" %4.4s", (char *)&ovr->formats[j]);
455 props = drmModeObjectGetProperties(fd, ovr->plane_id,
456 DRM_MODE_OBJECT_PLANE);
458 for (j = 0; j < props->count_props; j++)
459 dump_prop(props->props[j],
460 props->prop_values[j]);
461 drmModeFreeObjectProperties(props);
463 printf("\tcould not get plane properties: %s\n",
467 drmModeFreePlane(ovr);
471 drmModeFreePlaneResources(plane_resources);
475 /* -----------------------------------------------------------------------------
476 * Connectors and planes
480 * Mode setting with the kernel interfaces is a bit of a chore.
481 * First you have to find the connector in question and make sure the
482 * requested mode is available.
483 * Then you need to find the encoder attached to that connector so you
484 * can bind it with a free crtc.
491 drmModeModeInfo *mode;
492 drmModeEncoder *encoder;
495 unsigned int fb_id[2], current_fb_id;
496 struct timeval start;
502 uint32_t con_id; /* the id of connector to bind to */
505 char format_str[5]; /* need to leave room for terminating \0 */
510 connector_find_mode(struct connector *c)
512 drmModeConnector *connector;
515 /* First, find the connector & mode */
517 for (i = 0; i < resources->count_connectors; i++) {
518 connector = drmModeGetConnector(fd, resources->connectors[i]);
521 fprintf(stderr, "could not get connector %i: %s\n",
522 resources->connectors[i], strerror(errno));
523 drmModeFreeConnector(connector);
527 if (!connector->count_modes) {
528 drmModeFreeConnector(connector);
532 if (connector->connector_id != c->id) {
533 drmModeFreeConnector(connector);
537 for (j = 0; j < connector->count_modes; j++) {
538 c->mode = &connector->modes[j];
539 if (!strcmp(c->mode->name, c->mode_str))
543 /* Found it, break out */
547 drmModeFreeConnector(connector);
551 fprintf(stderr, "failed to find mode \"%s\"\n", c->mode_str);
555 /* Now get the encoder */
556 for (i = 0; i < resources->count_encoders; i++) {
557 c->encoder = drmModeGetEncoder(fd, resources->encoders[i]);
560 fprintf(stderr, "could not get encoder %i: %s\n",
561 resources->encoders[i], strerror(errno));
562 drmModeFreeEncoder(c->encoder);
566 if (c->encoder->encoder_id == connector->encoder_id)
569 drmModeFreeEncoder(c->encoder);
573 c->crtc = c->encoder->crtc_id;
575 /* and figure out which crtc index it is: */
576 for (i = 0; i < resources->count_crtcs; i++) {
577 if (c->crtc == (int)resources->crtcs[i]) {
585 /* -------------------------------------------------------------------------- */
588 page_flip_handler(int fd, unsigned int frame,
589 unsigned int sec, unsigned int usec, void *data)
592 unsigned int new_fb_id;
597 if (c->current_fb_id == c->fb_id[0])
598 new_fb_id = c->fb_id[1];
600 new_fb_id = c->fb_id[0];
602 drmModePageFlip(fd, c->crtc, new_fb_id,
603 DRM_MODE_PAGE_FLIP_EVENT, c);
604 c->current_fb_id = new_fb_id;
606 if (c->swap_count == 60) {
607 gettimeofday(&end, NULL);
608 t = end.tv_sec + end.tv_usec * 1e-6 -
609 (c->start.tv_sec + c->start.tv_usec * 1e-6);
610 fprintf(stderr, "freq: %.02fHz\n", c->swap_count / t);
617 set_plane(struct kms_driver *kms, struct connector *c, struct plane *p)
619 drmModePlaneRes *plane_resources;
621 uint32_t handles[4], pitches[4], offsets[4] = {0}; /* we only use [0] */
622 uint32_t plane_id = 0;
623 struct kms_bo *plane_bo;
624 uint32_t plane_flags = 0;
625 int crtc_x, crtc_y, crtc_w, crtc_h;
628 /* find an unused plane which can be connected to our crtc */
629 plane_resources = drmModeGetPlaneResources(fd);
630 if (!plane_resources) {
631 fprintf(stderr, "drmModeGetPlaneResources failed: %s\n",
636 for (i = 0; i < plane_resources->count_planes && !plane_id; i++) {
637 ovr = drmModeGetPlane(fd, plane_resources->planes[i]);
639 fprintf(stderr, "drmModeGetPlane failed: %s\n",
644 if ((ovr->possible_crtcs & (1 << c->pipe)) && !ovr->crtc_id)
645 plane_id = ovr->plane_id;
647 drmModeFreePlane(ovr);
650 fprintf(stderr, "testing %dx%d@%s overlay plane\n",
651 p->w, p->h, p->format_str);
654 fprintf(stderr, "failed to find plane!\n");
658 plane_bo = create_test_buffer(kms, p->fourcc, p->w, p->h, handles,
659 pitches, offsets, PATTERN_TILES);
660 if (plane_bo == NULL)
663 /* just use single plane format for now.. */
664 if (drmModeAddFB2(fd, p->w, p->h, p->fourcc,
665 handles, pitches, offsets, &p->fb_id, plane_flags)) {
666 fprintf(stderr, "failed to add fb: %s\n", strerror(errno));
670 /* ok, boring.. but for now put in middle of screen: */
671 crtc_x = c->mode->hdisplay / 3;
672 crtc_y = c->mode->vdisplay / 3;
676 /* note src coords (last 4 args) are in Q16 format */
677 if (drmModeSetPlane(fd, plane_id, c->crtc, p->fb_id,
678 plane_flags, crtc_x, crtc_y, crtc_w, crtc_h,
679 0, 0, p->w << 16, p->h << 16)) {
680 fprintf(stderr, "failed to enable plane: %s\n",
689 set_mode(struct connector *c, int count, struct plane *p, int plane_count,
692 struct kms_driver *kms;
693 struct kms_bo *bo, *other_bo;
694 unsigned int fb_id, other_fb_id;
695 int i, j, ret, width, height, x;
696 uint32_t handles[4], pitches[4], offsets[4] = {0}; /* we only use [0] */
697 drmEventContext evctx;
701 for (i = 0; i < count; i++) {
702 connector_find_mode(&c[i]);
703 if (c[i].mode == NULL)
705 width += c[i].mode->hdisplay;
706 if (height < c[i].mode->vdisplay)
707 height = c[i].mode->vdisplay;
710 ret = kms_create(fd, &kms);
712 fprintf(stderr, "failed to create kms driver: %s\n",
717 bo = create_test_buffer(kms, c->fourcc, width, height, handles,
718 pitches, offsets, PATTERN_SMPTE);
722 ret = drmModeAddFB2(fd, width, height, c->fourcc,
723 handles, pitches, offsets, &fb_id, 0);
725 fprintf(stderr, "failed to add fb (%ux%u): %s\n",
726 width, height, strerror(errno));
731 for (i = 0; i < count; i++) {
732 if (c[i].mode == NULL)
735 printf("setting mode %s@%s on connector %d, crtc %d\n",
736 c[i].mode_str, c[i].format_str, c[i].id, c[i].crtc);
738 ret = drmModeSetCrtc(fd, c[i].crtc, fb_id, x, 0,
739 &c[i].id, 1, c[i].mode);
741 /* XXX: Actually check if this is needed */
742 drmModeDirtyFB(fd, fb_id, NULL, 0);
744 x += c[i].mode->hdisplay;
747 fprintf(stderr, "failed to set mode: %s\n", strerror(errno));
751 /* if we have a plane/overlay to show, set that up now: */
752 for (j = 0; j < plane_count; j++)
753 if (p[j].con_id == c[i].id)
754 if (set_plane(kms, &c[i], &p[j]))
761 other_bo = create_test_buffer(kms, c->fourcc, width, height, handles,
762 pitches, offsets, PATTERN_PLAIN);
763 if (other_bo == NULL)
766 ret = drmModeAddFB2(fd, width, height, c->fourcc, handles, pitches, offsets,
769 fprintf(stderr, "failed to add fb: %s\n", strerror(errno));
773 for (i = 0; i < count; i++) {
774 if (c[i].mode == NULL)
777 ret = drmModePageFlip(fd, c[i].crtc, other_fb_id,
778 DRM_MODE_PAGE_FLIP_EVENT, &c[i]);
780 fprintf(stderr, "failed to page flip: %s\n", strerror(errno));
783 gettimeofday(&c[i].start, NULL);
785 c[i].fb_id[0] = fb_id;
786 c[i].fb_id[1] = other_fb_id;
787 c[i].current_fb_id = other_fb_id;
790 memset(&evctx, 0, sizeof evctx);
791 evctx.version = DRM_EVENT_CONTEXT_VERSION;
792 evctx.vblank_handler = NULL;
793 evctx.page_flip_handler = page_flip_handler;
797 struct pollfd pfd[2];
800 pfd[0].events = POLLIN;
802 pfd[1].events = POLLIN;
804 if (poll(pfd, 2, -1) < 0) {
805 fprintf(stderr, "poll error\n");
812 struct timeval timeout = { .tv_sec = 3, .tv_usec = 0 };
819 ret = select(fd + 1, &fds, NULL, NULL, &timeout);
822 fprintf(stderr, "select timed out or error (ret %d)\n",
825 } else if (FD_ISSET(0, &fds)) {
830 drmHandleEvent(fd, &evctx);
834 kms_bo_destroy(&other_bo);
839 extern int optind, opterr, optopt;
840 static char optstr[] = "ecpmfs:P:v";
842 #define min(a, b) ((a) < (b) ? (a) : (b))
844 static int parse_connector(struct connector *c, const char *arg)
851 strcpy(c->format_str, "XR24");
853 c->id = strtoul(arg, &endp, 10);
856 c->crtc = strtoul(arg, &endp, 10);
863 p = strchrnul(arg, '@');
864 len = min(sizeof c->mode_str - 1, (unsigned int)(p - arg));
865 strncpy(c->mode_str, arg, len);
866 c->mode_str[len] = '\0';
869 strncpy(c->format_str, p + 1, 4);
870 c->format_str[4] = '\0';
873 c->fourcc = format_fourcc(c->format_str);
874 if (c->fourcc == 0) {
875 fprintf(stderr, "unknown format %s\n", c->format_str);
882 static int parse_plane(struct plane *p, const char *arg)
884 strcpy(p->format_str, "XR24");
886 if (sscanf(arg, "%d:%dx%d@%4s", &p->con_id, &p->w, &p->h, p->format_str) != 4 &&
887 sscanf(arg, "%d:%dx%d", &p->con_id, &p->w, &p->h) != 3)
890 p->fourcc = format_fourcc(p->format_str);
891 if (p->fourcc == 0) {
892 fprintf(stderr, "unknown format %s\n", p->format_str);
899 static void usage(char *name)
901 fprintf(stderr, "usage: %s [-ecpmf]\n", name);
902 fprintf(stderr, "\t-e\tlist encoders\n");
903 fprintf(stderr, "\t-c\tlist connectors\n");
904 fprintf(stderr, "\t-p\tlist CRTCs and planes (pipes)\n");
905 fprintf(stderr, "\t-m\tlist modes\n");
906 fprintf(stderr, "\t-f\tlist framebuffers\n");
907 fprintf(stderr, "\t-v\ttest vsynced page flipping\n");
908 fprintf(stderr, "\t-s <connector_id>[@<crtc_id>]:<mode>[@<format>]\tset a mode\n");
909 fprintf(stderr, "\t-P <connector_id>:<w>x<h>[@<format>]\tset a plane\n");
910 fprintf(stderr, "\n\tDefault is to dump all info.\n");
914 #define dump_resource(res) if (res) dump_##res()
916 static int page_flipping_supported(void)
918 /*FIXME: generic ioctl needed? */
922 struct drm_i915_getparam gp;
924 gp.param = I915_PARAM_HAS_PAGEFLIPPING;
927 ret = drmCommandWriteRead(fd, DRM_I915_GETPARAM, &gp, sizeof(gp));
929 fprintf(stderr, "drm_i915_getparam: %m\n");
937 int main(int argc, char **argv)
940 int encoders = 0, connectors = 0, crtcs = 0, planes = 0, framebuffers = 0;
942 const char *modules[] = { "i915", "radeon", "nouveau", "vmwgfx", "omapdrm", "exynos", "tilcdc" };
944 int count = 0, plane_count = 0;
945 struct connector con_args[2];
946 struct plane plane_args[2] = { { 0, }, };
949 while ((c = getopt(argc, argv, optstr)) != -1) {
971 if (parse_connector(&con_args[count], optarg) < 0)
976 if (parse_plane(&plane_args[plane_count], optarg) < 0)
987 encoders = connectors = crtcs = planes = modes = framebuffers = 1;
989 for (i = 0; i < ARRAY_SIZE(modules); i++) {
990 printf("trying to load module %s...", modules[i]);
991 fd = drmOpen(modules[i], NULL);
995 printf("success.\n");
1000 if (test_vsync && !page_flipping_supported()) {
1001 fprintf(stderr, "page flipping not supported by drm.\n");
1005 if (i == ARRAY_SIZE(modules)) {
1006 fprintf(stderr, "failed to load any modules, aborting.\n");
1010 resources = drmModeGetResources(fd);
1012 fprintf(stderr, "drmModeGetResources failed: %s\n",
1018 dump_resource(encoders);
1019 dump_resource(connectors);
1020 dump_resource(crtcs);
1021 dump_resource(planes);
1022 dump_resource(framebuffers);
1025 set_mode(con_args, count, plane_args, plane_count, test_vsync);
1029 drmModeFreeResources(resources);