summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSooChan Lim <sc1.lim@samsung.com>2015-11-23 21:31:10 +0900
committerSooChan Lim <sc1.lim@samsung.com>2015-11-24 16:43:53 +0900
commitcf3887b4f080727d9d399352c77e54f966b183c0 (patch)
tree33b00d92573258e2f313c39d2b54526c856a5feb
parent6f043773edd412fd91eb7425668229fbeaa2d546 (diff)
downloadlibdrm-cf3887b4f080727d9d399352c77e54f966b183c0.tar.gz
libdrm-cf3887b4f080727d9d399352c77e54f966b183c0.tar.bz2
libdrm-cf3887b4f080727d9d399352c77e54f966b183c0.zip
[SPRD] add feature HAVE_SPRD
Change-Id: I43add1f488177e926da8e50d47bae912e9e3137c
-rw-r--r--tests/modeprint/modeprint.c2
-rwxr-xr-xxf86drm.c8
-rw-r--r--xf86drm.h2
-rw-r--r--xf86drmMode.c5
4 files changed, 16 insertions, 1 deletions
diff --git a/tests/modeprint/modeprint.c b/tests/modeprint/modeprint.c
index c1fc0798..d3acb22d 100644
--- a/tests/modeprint/modeprint.c
+++ b/tests/modeprint/modeprint.c
@@ -412,8 +412,10 @@ int main(int argc, char **argv)
return 1;
}
+#ifdef HAVE_SPRD
if (strcmp(module_name,"sprd") == 0)
sprd_device_create(fd);
+#endif
res = drmModeGetResources(fd);
if (res == 0) {
diff --git a/xf86drm.c b/xf86drm.c
index c70b823f..832b3cd3 100755
--- a/xf86drm.c
+++ b/xf86drm.c
@@ -162,29 +162,35 @@ void drmFree(void *pt)
/**
* Call ioctl, restarting if it is interupted
*/
+
+#ifdef HAVE_SPRD
static ioctl_hook fp_ioctl_hook;
+#endif
int
drmIoctl(int fd, unsigned long request, void *arg)
{
int ret;
+#ifdef HAVE_SPRD
if (fp_ioctl_hook){
return fp_ioctl_hook(fd, request, arg);
}
-
+#endif
do {
ret = ioctl(fd, request, arg);
} while (ret == -1 && (errno == EINTR || errno == EAGAIN));
return ret;
}
+#ifdef HAVE_SPRD
int
drmIoctlSetHook(ioctl_hook hook)
{
fp_ioctl_hook = hook;
return 0;
}
+#endif
static unsigned long drmGetKeyFromFd(int fd)
{
diff --git a/xf86drm.h b/xf86drm.h
index 50feec5d..ce6faf4c 100644
--- a/xf86drm.h
+++ b/xf86drm.h
@@ -740,8 +740,10 @@ extern char *drmGetDeviceNameFromFd(int fd);
extern int drmPrimeHandleToFD(int fd, uint32_t handle, uint32_t flags, int *prime_fd);
extern int drmPrimeFDToHandle(int fd, int prime_fd, uint32_t *handle);
+//#define HAVE_SPRD
typedef int (*handle_event_hook)(int fd, drmEventContextPtr evctx);
extern int drmHandleEventSetHook(handle_event_hook hook);
+//#endif
#if defined(__cplusplus) || defined(c_plusplus)
}
diff --git a/xf86drmMode.c b/xf86drmMode.c
index d63f41dd..4ec48d3f 100644
--- a/xf86drmMode.c
+++ b/xf86drmMode.c
@@ -841,6 +841,7 @@ int drmModeCrtcSetGamma(int fd, uint32_t crtc_id, uint32_t size,
return DRM_IOCTL(fd, DRM_IOCTL_MODE_SETGAMMA, &l);
}
+#ifdef HAVE_SPRD
static handle_event_hook handleEventHook = NULL;
int drmHandleEventSetHook(handle_event_hook hook)
@@ -848,6 +849,7 @@ int drmHandleEventSetHook(handle_event_hook hook)
handleEventHook = hook;
return 0;
}
+#endif
int drmHandleEvent(int fd, drmEventContextPtr evctx)
{
@@ -858,10 +860,13 @@ int drmHandleEvent(int fd, drmEventContextPtr evctx)
/* The DRM read semantics guarantees that we always get only
* complete events. */
+
+#ifdef HAVE_SPRD
if(handleEventHook) {
if (handleEventHook(fd, evctx) == 0)
return 0;
}
+#endif
len = read(fd, buffer, sizeof buffer);
if (len == 0)