From bcf60a22c3e8671468517d34aa37548272455c1f Mon Sep 17 00:00:00 2001 From: Lauri Peltonen Date: Fri, 18 Jul 2014 02:21:34 +0300 Subject: gpu: nvgpu: Add gk20a_fence type When moving compression state tracking and compbit management ops to kernel, we need to attach a fence to dma-buf metadata, along with the compbit state. To make in-kernel fence management easier, introduce a new gk20a_fence abstraction. A gk20a_fence may be backed by a semaphore or a syncpoint (id, value) pair. If the kernel is configured with CONFIG_SYNC, it will also contain a sync_fence. The gk20a_fence can easily be converted back to a syncpoint (id, value) parir or sync FD when we need to return it to user space. Change gk20a_submit_channel_gpfifo to return a gk20a_fence instead of nvhost_fence. This is to facilitate work submission initiated from kernel. Bug 1509620 Change-Id: I6154764a279dba83f5e91ba9e0cb5e227ca08e1b Signed-off-by: Lauri Peltonen Reviewed-on: http://git-master/r/439846 Reviewed-by: Automatic_Commit_Validation_User Reviewed-by: Terje Bergstrom Tested-by: Terje Bergstrom --- drivers/gpu/nvgpu/gk20a/channel_gk20a.h | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (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 161d2b83..2ea3eccb 100644 --- a/drivers/gpu/nvgpu/gk20a/channel_gk20a.h +++ b/drivers/gpu/nvgpu/gk20a/channel_gk20a.h @@ -29,6 +29,7 @@ struct gk20a; struct gr_gk20a; struct dbg_session_gk20a; +struct gk20a_fence; #include "channel_sync_gk20a.h" @@ -68,8 +69,8 @@ struct channel_ctx_gk20a { struct channel_gk20a_job { struct mapped_buffer_node **mapped_buffers; int num_mapped_buffers; - struct gk20a_channel_fence pre_fence; - struct gk20a_channel_fence post_fence; + struct gk20a_fence *pre_fence; + struct gk20a_fence *post_fence; struct list_head list; }; @@ -117,8 +118,9 @@ struct channel_gk20a { bool cmds_pending; struct { - struct gk20a_channel_fence pre_fence; - struct gk20a_channel_fence post_fence; + /* These fences should be accessed with submit_lock held. */ + struct gk20a_fence *pre_fence; + struct gk20a_fence *post_fence; } last_submit; void (*remove_support)(struct channel_gk20a *); @@ -184,8 +186,9 @@ void channel_gk20a_unbind(struct channel_gk20a *ch_gk20a); int gk20a_submit_channel_gpfifo(struct channel_gk20a *c, struct nvhost_gpfifo *gpfifo, u32 num_entries, + u32 flags, struct nvhost_fence *fence, - u32 flags); + struct gk20a_fence **fence_out); int gk20a_alloc_channel_gpfifo(struct channel_gk20a *c, struct nvhost_alloc_gpfifo_args *args); -- cgit v1.2.2