diff --git a/recipes-openharmony/openharmony/openharmony-standard-3.0/xf86drm.c-Add-drmWaitVBlank-hack.patch b/recipes-openharmony/openharmony/openharmony-standard-3.0/xf86drm.c-Add-drmWaitVBlank-hack.patch new file mode 100644 index 0000000000000000000000000000000000000000..f32503729048b85da98813a4d01fb37f12cb4ab2 --- /dev/null +++ b/recipes-openharmony/openharmony/openharmony-standard-3.0/xf86drm.c-Add-drmWaitVBlank-hack.patch @@ -0,0 +1,50 @@ +# SPDX-FileCopyrightText: Huawei Inc. +# +# SPDX-License-Identifier: Apache-2.0 + +xf86drm.c: Add drmWaitVBlank hack + +DRM_IOCTL_WAIT_VBLANK is not supported by the virtio drm driver. This feature +is essential for the inner workings of the OpenHarmony graphic stack, therefore +adding a hack that simulates this behaviour until a proper solution is +provided. + +Signed-off-by: Robert Drab <robert.drab@huawei.com> +Upstream-Status: Inappropriate + +diff --git a/xf86drm.c b/xf86drm.c +index b49d42f..0e2805a 100644 +--- a/xf86drm.c ++++ b/xf86drm.c +@@ -2171,14 +2171,15 @@ drm_public int drmWaitVBlank(int fd, drmVBlankPtr vbl) + fprintf(stderr, "clock_gettime failed: %s\n", strerror(errno)); + goto out; + } +- timeout.tv_sec++; ++ /* HACK: return 0 after 16ms - value observed on the Taurus board */ ++ timeout.tv_nsec += 16000000; + + do { + ret = ioctl(fd, DRM_IOCTL_WAIT_VBLANK, vbl); + vbl->request.type &= ~DRM_VBLANK_RELATIVE; +- if (ret && errno == EINTR) { ++ if (ret && (errno == EINTR || errno == ENOTSUP)) { + clock_gettime(CLOCK_MONOTONIC, &cur); +- /* Timeout after 1s */ ++ /* HACK: return 0 after 16ms - value observed on the Taurus board */ + if (cur.tv_sec > timeout.tv_sec + 1 || + (cur.tv_sec == timeout.tv_sec && cur.tv_nsec >= + timeout.tv_nsec)) { +@@ -2187,9 +2188,11 @@ drm_public int drmWaitVBlank(int fd, drmVBlankPtr vbl) + break; + } + } +- } while (ret && errno == EINTR); ++ } while (ret && (errno == EINTR || errno == ENOTSUP)); + + out: ++ if (errno == EBUSY) ++ return 0; + return ret; + } + diff --git a/recipes-openharmony/openharmony/openharmony-standard_3.0.bb b/recipes-openharmony/openharmony/openharmony-standard_3.0.bb index d5b4141ade905f09ca8a6346c522758d62677401..1c82fdb578cb90cba47be7e7dcbfcdf14a762463 100644 --- a/recipes-openharmony/openharmony/openharmony-standard_3.0.bb +++ b/recipes-openharmony/openharmony/openharmony-standard_3.0.bb @@ -60,6 +60,7 @@ SRC_URI += "file://display-Use-temporary-qemuarm-implementation.patch;patchdir=$ SRC_URI += "file://display_gralloc_gbm.c-Use-card-drm-node.patch;patchdir=${S}/device/hihope" SRC_URI += "file://hihope-gralloc-Backport-to-3.0.patch;patchdir=${S}/device/hihope" SRC_URI += "file://ivi-input-controller.c-Fix-g_ctx-declaration-causing-segfault.patch;patchdir=${S}/third_party/wayland-ivi-extension" +SRC_URI += "file://xf86drm.c-Add-drmWaitVBlank-hack.patch;patchdir=${S}/third_party/libdrm" inherit python3native gn_base ptest