gpu: nvgpu: remove usage of nvgpu_fence

Remove the usage of nvgpu_fence splattered across nvgpu,
and replace with a struct defined in common code.
The usage is still inside Linux, but this helps the
subsequent unification efforts, e.g. to unify the submit
path.

VQRM-3465

Change-Id: Ic3737450123dfc5e1c40ca5b6b8d8f6b3070aa0d
Signed-off-by: Sourab Gupta <sourabg@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1691977
Reviewed-by: Konsta Holtta <kholtta@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
Sourab Gupta
2018-04-10 12:05:09 +05:30
committed by mobile promotions
parent f3d22faef8
commit 585e33e408
8 changed files with 37 additions and 15 deletions

View File

@@ -748,7 +748,7 @@ deinit_image:
}
static int gk20a_cde_execute_buffer(struct gk20a_cde_ctx *cde_ctx,
u32 op, struct nvgpu_fence *fence,
u32 op, struct nvgpu_channel_fence *fence,
u32 flags, struct gk20a_fence **fence_out)
{
struct nvgpu_os_linux *l = cde_ctx->l;
@@ -975,7 +975,7 @@ int gk20a_cde_convert(struct nvgpu_os_linux *l,
struct dma_buf *compbits_scatter_buf,
u64 compbits_byte_offset,
u64 scatterbuffer_byte_offset,
struct nvgpu_fence *fence,
struct nvgpu_channel_fence *fence,
u32 __flags, struct gk20a_cde_param *params,
int num_params, struct gk20a_fence **fence_out)
__acquires(&l->cde_app->mutex)
@@ -1482,7 +1482,7 @@ static int gk20a_buffer_convert_gpu_to_cde_v1(
u64 offset, u64 compbits_hoffset, u64 compbits_voffset,
u64 scatterbuffer_offset,
u32 width, u32 height, u32 block_height_log2,
u32 submit_flags, struct nvgpu_fence *fence_in,
u32 submit_flags, struct nvgpu_channel_fence *fence_in,
struct gk20a_buffer_state *state)
{
struct gk20a *g = &l->g;
@@ -1624,7 +1624,7 @@ static int gk20a_buffer_convert_gpu_to_cde(
u64 offset, u64 compbits_hoffset, u64 compbits_voffset,
u64 scatterbuffer_offset,
u32 width, u32 height, u32 block_height_log2,
u32 submit_flags, struct nvgpu_fence *fence_in,
u32 submit_flags, struct nvgpu_channel_fence *fence_in,
struct gk20a_buffer_state *state)
{
struct gk20a *g = &l->g;
@@ -1656,7 +1656,7 @@ int gk20a_prepare_compressible_read(
u64 compbits_hoffset, u64 compbits_voffset,
u64 scatterbuffer_offset,
u32 width, u32 height, u32 block_height_log2,
u32 submit_flags, struct nvgpu_fence *fence,
u32 submit_flags, struct nvgpu_channel_fence *fence,
u32 *valid_compbits, u32 *zbc_color,
struct gk20a_fence **fence_out)
{

View File

@@ -44,7 +44,7 @@ struct device;
struct nvgpu_os_linux;
struct gk20a;
struct gk20a_fence;
struct nvgpu_fence;
struct nvgpu_channel_fence;
struct channel_gk20a;
struct vm_gk20a;
struct nvgpu_gpfifo;
@@ -306,7 +306,7 @@ int gk20a_cde_convert(struct nvgpu_os_linux *l,
struct dma_buf *compbits_buf,
u64 compbits_byte_offset,
u64 scatterbuffer_byte_offset,
struct nvgpu_fence *fence,
struct nvgpu_channel_fence *fence,
u32 __flags, struct gk20a_cde_param *params,
int num_params, struct gk20a_fence **fence_out);
@@ -315,7 +315,7 @@ int gk20a_prepare_compressible_read(
u64 compbits_hoffset, u64 compbits_voffset,
u64 scatterbuffer_offset,
u32 width, u32 height, u32 block_height_log2,
u32 submit_flags, struct nvgpu_fence *fence,
u32 submit_flags, struct nvgpu_channel_fence *fence,
u32 *valid_compbits, u32 *zbc_color,
struct gk20a_fence **fence_out);
int gk20a_mark_compressible_write(

View File

@@ -56,7 +56,7 @@ int gk20a_ce_execute_ops(struct gk20a *g,
u32 cmd_buf_read_offset;
u32 dma_copy_class;
struct nvgpu_gpfifo gpfifo;
struct nvgpu_fence fence = {0,0};
struct nvgpu_channel_fence fence = {0, 0};
struct gk20a_fence *ce_cmd_buf_fence_out = NULL;
if (!ce_app->initialised ||ce_app->app_state != NVGPU_CE_ACTIVE)

View File

@@ -416,7 +416,7 @@ static void trace_write_pushbuffer_range(struct channel_gk20a *c,
* Handle the submit synchronization - pre-fences and post-fences.
*/
static int gk20a_submit_prepare_syncs(struct channel_gk20a *c,
struct nvgpu_fence *fence,
struct nvgpu_channel_fence *fence,
struct channel_gk20a_job *job,
struct priv_cmd_entry **wait_cmd,
struct priv_cmd_entry **incr_cmd,
@@ -663,7 +663,7 @@ int gk20a_submit_channel_gpfifo(struct channel_gk20a *c,
struct nvgpu_submit_gpfifo_args *args,
u32 num_entries,
u32 flags,
struct nvgpu_fence *fence,
struct nvgpu_channel_fence *fence,
struct gk20a_fence **fence_out,
bool force_need_sync_fence,
struct fifo_profile_gk20a *profile)

View File

@@ -24,7 +24,7 @@
struct channel_gk20a;
struct nvgpu_gpfifo;
struct nvgpu_submit_gpfifo_args;
struct nvgpu_fence;
struct nvgpu_channel_fence;
struct gk20a_fence;
struct fifo_profile_gk20a;
struct nvgpu_os_linux;
@@ -75,7 +75,7 @@ int gk20a_submit_channel_gpfifo(struct channel_gk20a *c,
struct nvgpu_submit_gpfifo_args *args,
u32 num_entries,
u32 flags,
struct nvgpu_fence *fence,
struct nvgpu_channel_fence *fence,
struct gk20a_fence **fence_out,
bool force_need_sync_fence,
struct fifo_profile_gk20a *profile);

View File

@@ -614,6 +614,14 @@ static void nvgpu_get_gpfifo_args(
alloc_gpfifo_args->flags);
}
static void nvgpu_get_fence_args(
struct nvgpu_fence *fence_args_in,
struct nvgpu_channel_fence *fence_args_out)
{
fence_args_out->id = fence_args_in->id;
fence_args_out->value = fence_args_in->value;
}
static int gk20a_channel_wait_semaphore(struct channel_gk20a *ch,
ulong id, u32 offset,
u32 payload, u32 timeout)
@@ -760,6 +768,7 @@ static int gk20a_ioctl_channel_submit_gpfifo(
struct channel_gk20a *ch,
struct nvgpu_submit_gpfifo_args *args)
{
struct nvgpu_channel_fence fence;
struct gk20a_fence *fence_out;
struct fifo_profile_gk20a *profile = NULL;
@@ -779,8 +788,9 @@ static int gk20a_ioctl_channel_submit_gpfifo(
!capable(CAP_SYS_NICE))
return -EPERM;
nvgpu_get_fence_args(&args->fence, &fence);
ret = gk20a_submit_channel_gpfifo(ch, NULL, args, args->num_entries,
args->flags, &args->fence,
args->flags, &fence,
&fence_out, false, profile);
if (ret)

View File

@@ -339,7 +339,7 @@ static int gk20a_ctrl_prepare_compressible_read(
#ifdef CONFIG_NVGPU_SUPPORT_CDE
struct nvgpu_os_linux *l = nvgpu_os_linux_from_gk20a(g);
struct nvgpu_fence fence;
struct nvgpu_channel_fence fence;
struct gk20a_fence *fence_out = NULL;
int flags = args->submit_flags;

View File

@@ -47,6 +47,18 @@ struct fifo_profile_gk20a;
#define NVGPU_GPFIFO_FLAGS_REPLAYABLE_FAULTS_ENABLE (1 << 2)
#define NVGPU_GPFIFO_FLAGS_USERMODE_SUPPORT (1 << 3)
/*
* The binary format of 'struct nvgpu_channel_fence' introduced here
* should match that of 'struct nvgpu_fence' defined in uapi header, since
* this struct is intended to be a mirror copy of the uapi struct. This is
* not a hard requirement though because of nvgpu_get_fence_args conversion
* function.
*/
struct nvgpu_channel_fence {
u32 id;
u32 value;
};
struct nvgpu_gpfifo_args {
u32 num_entries;
u32 num_inflight_jobs;