Lines Matching refs:pipe
875 static struct crtc *pipe_find_crtc(struct device *dev, struct pipe_arg *pipe)
883 for (i = 0; i < pipe->num_cons; ++i) {
889 connector = get_connector_by_id(dev, pipe->con_ids[i]);
922 static int pipe_find_crtc_and_mode(struct device *dev, struct pipe_arg *pipe)
927 pipe->mode = NULL;
929 for (i = 0; i < (int)pipe->num_cons; i++) {
930 mode = connector_find_mode(dev, pipe->con_ids[i],
931 pipe->mode_str, pipe->vrefresh);
933 if (pipe->vrefresh)
937 pipe->mode_str, pipe->vrefresh, pipe->cons[i]);
941 pipe->mode_str, pipe->cons[i]);
949 if (pipe->crtc_id != (uint32_t)-1) {
950 pipe->crtc = get_crtc_by_id(dev, pipe->crtc_id);
952 pipe->crtc = pipe_find_crtc(dev, pipe);
953 pipe->crtc_id = pipe->crtc->crtc->crtc_id;
956 if (!pipe->crtc) {
957 fprintf(stderr, "failed to find CRTC for pipe\n");
961 pipe->mode = mode;
962 pipe->crtc->mode = mode;
1056 struct pipe_arg *pipe;
1061 pipe = data;
1062 if (pipe->current_fb_id == pipe->fb_id[0])
1063 new_fb_id = pipe->fb_id[1];
1065 new_fb_id = pipe->fb_id[0];
1067 drmModePageFlip(fd, pipe->crtc_id, new_fb_id,
1068 DRM_MODE_PAGE_FLIP_EVENT, pipe);
1069 pipe->current_fb_id = new_fb_id;
1070 pipe->swap_count++;
1071 if (pipe->swap_count == 60) {
1074 (pipe->start.tv_sec + pipe->start.tv_usec * 1e-6);
1075 fprintf(stderr, "freq: %.02fHz\n", pipe->swap_count / t);
1076 pipe->swap_count = 0;
1077 pipe->start = end;
1420 static int pipe_resolve_connectors(struct device *dev, struct pipe_arg *pipe)
1427 for (i = 0; i < pipe->num_cons; i++) {
1428 id = strtoul(pipe->cons[i], &endp, 10);
1429 if (endp == pipe->cons[i]) {
1430 connector = get_connector_by_name(dev, pipe->cons[i]);
1433 pipe->cons[i]);
1440 pipe->con_ids[i] = id;
1447 struct pipe_arg *pipe)
1457 strcpy(pipe->format_str, "XR24");
1458 pipe->fourcc = util_format_fourcc(pipe->format_str);
1459 pipe->num_cons = 1;
1460 pipe->con_ids = calloc(1, sizeof(*pipe->con_ids));
1461 pipe->cons = calloc(1, sizeof(*pipe->cons));
1463 if (!pipe->con_ids || !pipe->cons)
1466 pipe->con_ids[0] = con->connector_id;
1467 pipe->cons[0] = (const char*)con_str;
1469 pipe->crtc = pipe_find_crtc(dev, pipe);
1470 if (!pipe->crtc)
1473 pipe->crtc_id = pipe->crtc->crtc->crtc_id;
1476 pipe->mode = &con->modes[0];
1482 pipe->mode = current_mode;
1487 sprintf(pipe->mode_str, "%dx%d", pipe->mode->hdisplay, pipe->mode->vdisplay);
1492 free(pipe->cons);
1493 free(pipe->con_ids);
1562 struct pipe_arg *pipe = &pipes[i];
1564 ret = pipe_resolve_connectors(dev, pipe);
1568 ret = pipe_find_crtc_and_mode(dev, pipe);
1585 struct pipe_arg *pipe = &pipes[i];
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;
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;
1611 struct pipe_arg *pipe = &pipes[i];
1614 if (pipe->mode == NULL)
1618 pipe->mode->name, mode_vrefresh(pipe->mode));
1619 for (j = 0; j < pipe->num_cons; ++j) {
1620 printf("%s, ", pipe->cons[j]);
1622 add_property(dev, pipe->con_ids[j], "CRTC_ID", pipe->crtc_id);
1624 printf("crtc %d\n", pipe->crtc_id);
1627 ret = drmModeSetCrtc(dev->fd, pipe->crtc_id, dev->mode.fb_id,
1628 x, 0, pipe->con_ids, pipe->num_cons,
1629 pipe->mode);
1635 x += pipe->mode->hdisplay;
1642 set_gamma(dev, pipe->crtc_id, pipe->fourcc);
1644 drmModeCreatePropertyBlob(dev->fd, pipe->mode, sizeof(*pipe->mode), &blob_id);
1645 add_property(dev, pipe->crtc_id, "MODE_ID", blob_id);
1646 add_property(dev, pipe->crtc_id, "ACTIVE", 1);
1650 struct plane *plane = get_primary_plane_by_crtc(dev, pipe->crtc);
1653 .crtc_id = pipe->crtc_id,
1654 .w = pipe->mode->hdisplay,
1655 .h = pipe->mode->vdisplay,
1658 .fourcc = util_format_fourcc(pipe->format_str),
1673 struct pipe_arg *pipe = &pipes[i];
1675 if (pipe->mode == NULL)
1678 for (j = 0; j < pipe->num_cons; ++j)
1679 add_property(dev, pipe->con_ids[j], "CRTC_ID",0);
1681 add_property(dev, pipe->crtc_id, "MODE_ID", 0);
1682 add_property(dev, pipe->crtc_id, "ACTIVE", 0);
1734 struct pipe_arg *pipe = &pipes[i];
1736 pipe->crtc_id,
1737 pipe->mode->hdisplay, pipe->mode->vdisplay,
1741 pipe->crtc_id);
1770 struct pipe_arg *pipe = &pipes[i];
1772 if (pipe->mode == NULL)
1775 ret = drmModePageFlip(dev->fd, pipe->crtc_id,
1777 pipe);
1782 gettimeofday(&pipe->start, NULL);
1783 pipe->swap_count = 0;
1784 pipe->fb_id[0] = dev->mode.fb_id;
1785 pipe->fb_id[1] = other_fb_id;
1786 pipe->current_fb_id = other_fb_id;
1838 static int parse_connector(struct pipe_arg *pipe, const char *arg)
1845 pipe->vrefresh = 0;
1846 pipe->crtc_id = (uint32_t)-1;
1847 strcpy(pipe->format_str, "XR24");
1850 pipe->num_cons = 1;
1853 pipe->num_cons++;
1856 pipe->con_ids = calloc(pipe->num_cons, sizeof(*pipe->con_ids));
1857 pipe->cons = calloc(pipe->num_cons, sizeof(*pipe->cons));
1858 if (pipe->con_ids == NULL || pipe->cons == NULL)
1862 for (i = 0, p = arg; i < pipe->num_cons; ++i, p = endp + 1) {
1867 pipe->cons[i] = strndup(p, endp - p);
1873 if (i != pipe->num_cons - 1)
1881 pipe->crtc_id = strtoul(arg, &endp, 10);
1892 len = min(sizeof pipe->mode_str - 1, (unsigned int)(p - arg));
1893 strncpy(pipe->mode_str, arg, len);
1894 pipe->mode_str[len] = '\0';
1897 pipe->vrefresh = strtof(p + 1, &endp);
1902 strncpy(pipe->format_str, p + 1, 4);
1903 pipe->format_str[4] = '\0';
1906 pipe->fourcc = util_format_fourcc(pipe->format_str);
1907 if (pipe->fourcc == 0) {
1908 fprintf(stderr, "unknown format %s\n", pipe->format_str);