}
static drmModeCrtc *
-find_crtc_for_connector (int fd, drmModeRes * res, drmModeConnector * conn)
+find_crtc_for_connector (int fd, drmModeRes * res, drmModeConnector * conn,
+ guint * pipe)
{
int i;
int crtc_id;
for (i = 0; i < res->count_crtcs; i++) {
crtc = drmModeGetCrtc (fd, res->crtcs[i]);
if (crtc) {
- if (crtc_id == crtc->crtc_id)
+ if (crtc_id == crtc->crtc_id) {
+ if (pipe)
+ *pipe = i;
return crtc;
+ }
drmModeFreeCrtc (crtc);
}
}
drmModeCrtc *crtc;
result = FALSE;
- crtc = find_crtc_for_connector (fd, res, conn);
+ crtc = find_crtc_for_connector (fd, res, conn, NULL);
if (crtc) {
result = crtc->buffer_id != 0;
drmModeFreeCrtc (crtc);
if (!conn)
goto connector_failed;
- crtc = find_crtc_for_connector (self->fd, res, conn);
+ crtc = find_crtc_for_connector (self->fd, res, conn, &self->pipe);
if (!crtc)
goto crtc_failed;
},
};
+ if (self->pipe == 1)
+ vbl.request.type |= DRM_VBLANK_SECONDARY;
+ else if (self->pipe > 1)
+ vbl.request.type |= self->pipe << DRM_VBLANK_HIGH_CRTC_SHIFT;
+
waiting = TRUE;
if (!self->has_async_page_flip) {
ret = drmWaitVBlank (self->fd, &vbl);