summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSangjin Lee <lsj119@samsung.com>2015-09-24 06:41:51 +0900
committerSooChan Lim <sc1.lim@samsung.com>2015-11-24 11:15:08 +0900
commit71a5d2fe628c269874b6455d2a667a25cff937c0 (patch)
tree73fefb9353632bbe07b27888b8fab6239c836c6d
parent6e97f25af63a9511ddd3b195a0b844671b8d1a5d (diff)
downloadlibdrm-71a5d2fe628c269874b6455d2a667a25cff937c0.tar.gz
libdrm-71a5d2fe628c269874b6455d2a667a25cff937c0.tar.bz2
libdrm-71a5d2fe628c269874b6455d2a667a25cff937c0.zip
[SPRD] Add drmIotclHook
Change-Id: I562fc0004fe16cc2e49014a5c5fcc5331c8449e0
-rwxr-xr-x[-rw-r--r--]xf86drm.c17
-rwxr-xr-x[-rw-r--r--]xf86drm.h2
2 files changed, 17 insertions, 2 deletions
diff --git a/xf86drm.c b/xf86drm.c
index d900b4bd..c70b823f 100644..100755
--- a/xf86drm.c
+++ b/xf86drm.c
@@ -162,17 +162,30 @@ void drmFree(void *pt)
/**
* Call ioctl, restarting if it is interupted
*/
+static ioctl_hook fp_ioctl_hook;
+
int
drmIoctl(int fd, unsigned long request, void *arg)
{
int ret;
+ if (fp_ioctl_hook){
+ return fp_ioctl_hook(fd, request, arg);
+ }
+
do {
- ret = ioctl(fd, request, arg);
+ ret = ioctl(fd, request, arg);
} while (ret == -1 && (errno == EINTR || errno == EAGAIN));
return ret;
}
+int
+drmIoctlSetHook(ioctl_hook hook)
+{
+ fp_ioctl_hook = hook;
+ return 0;
+}
+
static unsigned long drmGetKeyFromFd(int fd)
{
stat_t st;
@@ -1950,7 +1963,7 @@ int drmWaitVBlank(int fd, drmVBlankPtr vbl)
timeout.tv_sec++;
do {
- ret = ioctl(fd, DRM_IOCTL_WAIT_VBLANK, vbl);
+ ret = drmIoctl(fd, DRM_IOCTL_WAIT_VBLANK, vbl);
vbl->request.type &= ~DRM_VBLANK_RELATIVE;
if (ret && errno == EINTR) {
clock_gettime(CLOCK_MONOTONIC, &cur);
diff --git a/xf86drm.h b/xf86drm.h
index c024cc44..3dd782f2 100644..100755
--- a/xf86drm.h
+++ b/xf86drm.h
@@ -114,6 +114,8 @@ extern int drmIoctl(int fd, unsigned long request, void *arg);
extern void *drmGetHashTable(void);
extern drmHashEntry *drmGetEntry(int fd);
+typedef int (*ioctl_hook)(int fd, unsigned long request, void *arg);
+extern int drmIoctlSetHook(ioctl_hook hook);
/**
* Driver version information.
*