wait vblanks according to the pipe. 46/148446/2
authorSooChan Lim <sc1.lim@samsung.com>
Fri, 8 Sep 2017 02:21:21 +0000 (11:21 +0900)
committerSooChan Lim <sc1.lim@samsung.com>
Fri, 8 Sep 2017 03:11:40 +0000 (12:11 +0900)
Change-Id: I3560c2108cf1cef0fb85120b0c7c766434de3bc5

src/tdm_vc4_display.c

index 53e98da..6e90214 100644 (file)
@@ -146,8 +146,10 @@ _tdm_vc4_display_get_cur_msc (int fd, int pipe, uint *msc)
        drmVBlank vbl;
 
        vbl.request.type = DRM_VBLANK_RELATIVE;
-       if (pipe > 0)
+       if (pipe == 1)
                vbl.request.type |= DRM_VBLANK_SECONDARY;
+       else if (pipe > 1)
+               vbl.request.type |= pipe << DRM_VBLANK_HIGH_CRTC_SHIFT;
 
        vbl.request.sequence = 0;
        if (drmWaitVBlank(fd, &vbl)) {
@@ -167,15 +169,17 @@ _tdm_vc4_display_wait_vblank(int fd, int pipe, uint *target_msc, void *data)
        drmVBlank vbl;
 
        vbl.request.type =  DRM_VBLANK_ABSOLUTE | DRM_VBLANK_EVENT;
-       if (pipe > 0)
+       if (pipe == 1)
                vbl.request.type |= DRM_VBLANK_SECONDARY;
+       else if (pipe > 1)
+               vbl.request.type |= pipe << DRM_VBLANK_HIGH_CRTC_SHIFT;
 
        vbl.request.sequence = *target_msc;
        vbl.request.signal = (unsigned long)(uintptr_t)data;
 
        if (drmWaitVBlank(fd, &vbl)) {
-               *target_msc = 0;
                TDM_ERR("wait vblank failed: %m");
+               *target_msc = 0;
                return TDM_ERROR_OPERATION_FAILED;
        }