From be939ca2703d5b099a5dce5c62f2df99870fbeeb Mon Sep 17 00:00:00 2001 From: qtpl456 Date: Tue, 29 Mar 2022 16:10:27 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=98=BE=E7=A4=BA=E5=8A=9F?= =?UTF-8?q?=E8=83=BD=E9=80=82=E9=85=8D=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: qtpl456 --- libweston/backend-drm/drm-internal.h | 1 + libweston/backend-drm/drm.c | 17 +++++++++++++++-- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/libweston/backend-drm/drm-internal.h b/libweston/backend-drm/drm-internal.h index 22b5fa35..affea5cf 100755 --- a/libweston/backend-drm/drm-internal.h +++ b/libweston/backend-drm/drm-internal.h @@ -307,6 +307,7 @@ struct drm_backend { bool use_tde; // OHOS fix pthread_t vsync_thread; // OHOS vsync module bool vsync_thread_running; // OHOS vsync module + int pipe; // OHOS vsync module }; struct drm_mode { diff --git a/libweston/backend-drm/drm.c b/libweston/backend-drm/drm.c index 0eaf2a9f..cf14f714 100755 --- a/libweston/backend-drm/drm.c +++ b/libweston/backend-drm/drm.c @@ -524,6 +524,17 @@ drm_waitvblank_pipe(struct drm_output *output) return 0; } +static unsigned int +drm_waitvblank_pipe_vsync(int pipe) +{ + if (pipe > 1) + return (pipe << DRM_VBLANK_HIGH_CRTC_SHIFT) & + DRM_VBLANK_HIGH_CRTC_MASK; + else if (pipe > 0) + return DRM_VBLANK_SECONDARY; + else + return 0; +} static int drm_output_start_repaint_loop(struct weston_output *output_base) { @@ -1644,6 +1655,7 @@ drm_output_init_crtc(struct drm_output *output, drmModeRes *resources) output->crtc_id = resources->crtcs[i]; output->pipe = i; + b->pipe = i; props = drmModeObjectGetProperties(b->drm.fd, output->crtc_id, DRM_MODE_OBJECT_CRTC); @@ -2859,13 +2871,14 @@ ohos_drm_vsync_thread_main(void *backend) while (b->vsync_thread_running) { drmVBlank vbl = { .request = { - .type = DRM_VBLANK_RELATIVE, + .type = DRM_VBLANK_RELATIVE | drm_waitvblank_pipe_vsync(b->pipe), .sequence = 1, }, }; if (drmWaitVBlank(b->drm.fd, &vbl) != 0) { - weston_log("Failed to drmWaitVBlank (the first vblank event), because %{public}d", errno); + //weston_log("Failed to drmWaitVBlank (the first vblank event), because %{public}d", errno); sleep(0); + VsyncModuleTrigger(); } else { VsyncModuleTrigger(); } -- Gitee