From eb81d7d7e1d4a34ecd5968b13636f2c0e7a0dce1 Mon Sep 17 00:00:00 2001 From: Konsta Holtta Date: Fri, 10 Jul 2015 14:15:48 +0300 Subject: gpu: nvgpu: optimize map calls in patch smpc Copy the necessary ctx patching prologues and epilogues from patch_write to gr_gk20a_exec_ctx_ops next to mapping of gr ctx, around a loop that applies patches multiple times, in order to optimize the number of maps/unmaps on the channel's patch context. Bug 200075565 Change-Id: I7125be5c778192d639f0bbed1731bb900c7015da Signed-off-by: Konsta Holtta (cherry picked from commit TODO-FILL-THIS-WHEN-MERGED) Reviewed-on: http://git-master/r/839203 Reviewed-by: Terje Bergstrom Tested-by: Terje Bergstrom --- drivers/gpu/nvgpu/gk20a/gr_gk20a.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'drivers/gpu/nvgpu/gk20a/gr_gk20a.c') diff --git a/drivers/gpu/nvgpu/gk20a/gr_gk20a.c b/drivers/gpu/nvgpu/gk20a/gr_gk20a.c index adb4b276..34ad1771 100644 --- a/drivers/gpu/nvgpu/gk20a/gr_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/gr_gk20a.c @@ -648,7 +648,6 @@ int gr_gk20a_ctx_patch_write(struct gk20a *g, if (!ch_ctx->patch_ctx.mem.cpu_va) { int err; gk20a_dbg_info("per-write ctx patch begin?"); - /* yes, gr_gk20a_ctx_patch_smpc causes this one */ err = gr_gk20a_ctx_patch_write_begin(g, ch_ctx); if (err) return err; @@ -6759,6 +6758,9 @@ int gr_gk20a_exec_ctx_ops(struct channel_gk20a *ch, err = -ENOMEM; goto cleanup; } + err = gr_gk20a_ctx_patch_write_begin(g, ch_ctx); + if (err) + goto cleanup; g->ops.mm.l2_flush(g, true); @@ -6863,6 +6865,9 @@ int gr_gk20a_exec_ctx_ops(struct channel_gk20a *ch, if (offsets) kfree(offsets); + if (ch_ctx->patch_ctx.mem.cpu_va) + gr_gk20a_ctx_patch_write_end(g, ch_ctx); + if (ctx_ptr) vunmap(ctx_ptr); -- cgit v1.2.2