Skip to content
Snippets Groups Projects
Commit 753da76d authored by Robert Drab's avatar Robert Drab
Browse files

openharmony-standard-3.0: Add drmWaitVBlank hack patch


Signed-off-by: default avatarRobert Drab <robert.drab@huawei.com>
parent fceacc2a
No related branches found
No related tags found
1 merge request!25Graphic stack bringup
Pipeline #5810 passed
# 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;
}
...@@ -60,6 +60,7 @@ SRC_URI += "file://display-Use-temporary-qemuarm-implementation.patch;patchdir=$ ...@@ -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://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://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://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 inherit python3native gn_base ptest
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment