From ad178917259b30330e8432e2cd33d50c03e9602b Mon Sep 17 00:00:00 2001 From: Konsta Holtta Date: Wed, 10 Sep 2014 17:23:31 +0300 Subject: gpu: nvgpu: implement poll() for semaphores Add poll interface and control ioctls for waiting for GPU job completion via semaphores. Poll on a gk20a channel file waits for events from pending semaphore interrupts (stalling) of that channel. New ioctls enable and disable the events, and clear a single interrupt event so that next poll doesn't wake up for it again. Bug 1528781 Change-Id: I5c6238966b5d0900c8ab263c6a7f8f2611901f33 Signed-off-by: Konsta Holtta Reviewed-on: http://git-master/r/497750 Reviewed-by: Terje Bergstrom Tested-by: Terje Bergstrom --- drivers/gpu/nvgpu/gk20a/channel_gk20a.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'drivers/gpu/nvgpu/gk20a/channel_gk20a.h') diff --git a/drivers/gpu/nvgpu/gk20a/channel_gk20a.h b/drivers/gpu/nvgpu/gk20a/channel_gk20a.h index 37ca8244..bb9f314c 100644 --- a/drivers/gpu/nvgpu/gk20a/channel_gk20a.h +++ b/drivers/gpu/nvgpu/gk20a/channel_gk20a.h @@ -26,6 +26,8 @@ #include #include #include +#include + struct gk20a; struct gr_gk20a; struct dbg_session_gk20a; @@ -74,6 +76,12 @@ struct channel_gk20a_job { struct list_head list; }; +struct channel_gk20a_poll_events { + struct mutex lock; + bool events_enabled; + int num_pending_events; +}; + /* this is the priv element of struct nvhost_channel */ struct channel_gk20a { struct gk20a *g; @@ -148,6 +156,9 @@ struct channel_gk20a { #ifdef CONFIG_TEGRA_GR_VIRTUALIZATION u64 virt_ctx; #endif + + /* event support */ + struct channel_gk20a_poll_events poll_events; }; static inline bool gk20a_channel_as_bound(struct channel_gk20a *ch) @@ -180,6 +191,8 @@ long gk20a_channel_ioctl(struct file *filp, int gk20a_channel_release(struct inode *inode, struct file *filp); struct channel_gk20a *gk20a_get_channel_from_file(int fd); void gk20a_channel_update(struct channel_gk20a *c, int nr_completed); +unsigned int gk20a_channel_poll(struct file *filep, poll_table *wait); +void gk20a_channel_event(struct channel_gk20a *ch); void gk20a_init_channel(struct gpu_ops *gops); -- cgit v1.2.2