@@ -42,6 +42,8 @@
#include "exynos_drm.h"
#include "exynos_drmif.h"
+#define U642VOID(x) ((void *)(unsigned long)(x))
+
/*
* Create exynos drm device object.
*
@@ -374,3 +376,29 @@ exynos_vidi_connection(struct exynos_device *dev, uint32_t connect,
return 0;
}
+
+static void
+exynos_handle_vendor(int fd, struct drm_event *e, void *custom_data)
+{
+ struct drm_exynos_g2d_event *g2d;
+ struct exynos_event_context *ctx = custom_data;
+
+ switch (e->type) {
+ case DRM_EXYNOS_G2D_EVENT:
+ if (ctx->version < 1 || ctx->g2d_event_handler == NULL)
+ break;
+ g2d = (struct drm_exynos_g2d_event *)e;
+ ctx->g2d_event_handler(fd, g2d->cmdlist_no, g2d->tv_sec,
+ g2d->tv_usec, U642VOID(g2d->user_data));
+ break;
+
+ default:
+ break;
+ }
+}
+
+drm_public int
+exynos_handle_event(struct exynos_device *dev, struct exynos_event_context *ctx)
+{
+ return drmHandleEvent2(dev->fd, &ctx->base, exynos_handle_vendor, ctx);
+}
@@ -157,4 +157,16 @@ struct drm_exynos_g2d_exec {
#define DRM_IOCTL_EXYNOS_G2D_EXEC DRM_IOWR(DRM_COMMAND_BASE + \
DRM_EXYNOS_G2D_EXEC, struct drm_exynos_g2d_exec)
+/* EXYNOS specific events */
+#define DRM_EXYNOS_G2D_EVENT 0x80000000
+
+struct drm_exynos_g2d_event {
+ struct drm_event base;
+ __u64 user_data;
+ __u32 tv_sec;
+ __u32 tv_usec;
+ __u32 cmdlist_no;
+ __u32 reserved;
+};
+
#endif
@@ -54,6 +54,25 @@ struct exynos_bo {
uint32_t name;
};
+#define EXYNOS_EVENT_CONTEXT_VERSION 1
+
+/*
+ * Exynos Event Context structure.
+ *
+ * @base: base context (for core events).
+ * @version: version info similar to the one in 'drmEventContext'.
+ * @g2d_event_handler: handler for G2D events.
+ */
+struct exynos_event_context {
+ drmEventContext base;
+
+ int version;
+
+ void (*g2d_event_handler)(int fd, unsigned int cmdlist_no,
+ unsigned int tv_sec, unsigned int tv_usec,
+ void *user_data);
+};
+
/*
* device related functions:
*/
@@ -83,4 +102,11 @@ int exynos_prime_fd_to_handle(struct exynos_device *dev, int fd,
int exynos_vidi_connection(struct exynos_device *dev, uint32_t connect,
uint32_t ext, void *edid);
+/*
+ * event handling related functions:
+ */
+int exynos_handle_event(struct exynos_device *dev,
+ struct exynos_event_context *ctx);
+
+
#endif /* EXYNOS_DRMIF_H_ */
Used to handle kernel events specific to the Exynos platform. Currently only G2D events are handled. Signed-off-by: Tobias Jakobi <tjakobi@math.uni-bielefeld.de> --- exynos/exynos_drm.c | 28 ++++++++++++++++++++++++++++ exynos/exynos_drm.h | 12 ++++++++++++ exynos/exynos_drmif.h | 26 ++++++++++++++++++++++++++ 3 files changed, 66 insertions(+)