Lines Matching defs:mode
2 * DRM based mode setting test program
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
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.
78 drmModeModeInfo *mode;
127 } mode;
138 static float mode_vrefresh(drmModeModeInfo *mode)
140 return mode->clock * 1000.00
141 / (mode->htotal * mode->vtotal);
219 static void dump_mode(drmModeModeInfo *mode, int index)
223 mode->name,
224 mode_vrefresh(mode),
225 mode->hdisplay,
226 mode->hsync_start,
227 mode->hsync_end,
228 mode->htotal,
229 mode->vdisplay,
230 mode->vsync_start,
231 mode->vsync_end,
232 mode->vtotal,
233 mode->clock);
236 mode_flag_str(mode->flags);
238 mode_type_str(mode->type);
473 dump_mode(&crtc->mode, 0);
694 res->crtcs[i].mode = &res->crtcs[i].crtc->mode;
799 * requested mode is available.
812 drmModeModeInfo *mode;
840 drmModeModeInfo *mode;
858 mode = &connector->modes[i];
859 if (!strcmp(mode->name, mode_str)) {
861 * then return the first mode that match with the name.
862 * Else, return the mode that match the name and
866 return mode;
867 else if (fabs(mode_vrefresh(mode) - vrefresh) < 0.005)
868 return mode;
924 drmModeModeInfo *mode = NULL;
927 pipe->mode = NULL;
930 mode = connector_find_mode(dev, pipe->con_ids[i],
932 if (mode == NULL) {
935 "failed to find mode "
940 "failed to find mode \"%s\" for connector %s\n",
961 pipe->mode = mode;
962 pipe->crtc->mode = mode;
1216 crtc_x = (crtc->mode->hdisplay - crtc_w) / 2;
1217 crtc_y = (crtc->mode->vdisplay - crtc_h) / 2;
1292 crtc_x = (crtc->mode->hdisplay - crtc_w) / 2;
1293 crtc_y = (crtc->mode->vdisplay - crtc_h) / 2;
1475 /* Return the first mode if no preferred. */
1476 pipe->mode = &con->modes[0];
1482 pipe->mode = current_mode;
1487 sprintf(pipe->mode_str, "%dx%d", pipe->mode->hdisplay, pipe->mode->vdisplay);
1527 printf("failed fetching preferred mode for connector\n");
1577 fprintf(stderr, "can't find any preferred connector/mode.\n");
1587 if (pipe->mode == NULL)
1591 dev->mode.width += pipe->mode->hdisplay;
1592 if (dev->mode.height < pipe->mode->vdisplay)
1593 dev->mode.height = pipe->mode->vdisplay;
1595 /* XXX: Use a clone mode, more like atomic. We could do per
1598 if (dev->mode.width < pipe->mode->hdisplay)
1599 dev->mode.width = pipe->mode->hdisplay;
1600 if (dev->mode.height < pipe->mode->vdisplay)
1601 dev->mode.height = pipe->mode->vdisplay;
1605 if (bo_fb_create(dev->fd, pipes[0].fourcc, dev->mode.width, dev->mode.height,
1606 primary_fill, &dev->mode.bo, &dev->mode.fb_id))
1614 if (pipe->mode == NULL)
1617 printf("setting mode %s-%.2fHz on connectors ",
1618 pipe->mode->name, mode_vrefresh(pipe->mode));
1627 ret = drmModeSetCrtc(dev->fd, pipe->crtc_id, dev->mode.fb_id,
1629 pipe->mode);
1632 drmModeDirtyFB(dev->fd, dev->mode.fb_id, NULL, 0);
1635 x += pipe->mode->hdisplay;
1638 fprintf(stderr, "failed to set mode: %s\n", strerror(errno));
1644 drmModeCreatePropertyBlob(dev->fd, pipe->mode, sizeof(*pipe->mode), &blob_id);
1654 .w = pipe->mode->hdisplay,
1655 .h = pipe->mode->vdisplay,
1675 if (pipe->mode == NULL)
1688 if (dev->mode.fb_id)
1689 drmModeRmFB(dev->fd, dev->mode.fb_id);
1690 if (dev->mode.bo)
1691 bo_destroy(dev->mode.bo);
1731 dev->mode.cursor_bo = bo;
1737 pipe->mode->hdisplay, pipe->mode->vdisplay,
1753 if (dev->mode.cursor_bo)
1754 bo_destroy(dev->mode.cursor_bo);
1765 if (bo_fb_create(dev->fd, pipes[0].fourcc, dev->mode.width, dev->mode.height,
1772 if (pipe->mode == NULL)
1784 pipe->fb_id[0] = dev->mode.fb_id;
2005 fprintf(stderr, "\t-s <connector_id>[,<connector_id>][@<crtc_id>]:[#<mode index>]<mode>[-<vrefresh>][@<format>]\tset a mode\n");
2008 fprintf(stderr, "\t-r\tset the preferred mode for all connectors\n");
2014 fprintf(stderr, "\t-d\tdrop master after mode set\n");
2153 fprintf(stderr, "cannot use -r (preferred) when -s (mode) is set\n");
2229 /* XXX: properly teardown the preferred mode/plane state */