From 447aab482a68be70cece649da88c656919d155d1 Mon Sep 17 00:00:00 2001 From: Arto Merilainen Date: Thu, 31 Jul 2014 15:11:45 +0300 Subject: gpu: nvgpu: cde: Re-use context Currently cde reinitialises the context each time before submitting work to the channel. This was done to ensure that we are able to get clean context for the shader during development phase. However, as the shader has been tested to work w/o reinitialising the context, we can remove the reinitialisation to gain better performance. Change-Id: If0b0e03133058528da943faaeb72ca500d3ddb14 Signed-off-by: Arto Merilainen Reviewed-on: http://git-master/r/486673 Reviewed-by: Jussi Rasanen Tested-by: Jussi Rasanen Reviewed-by: Automatic_Commit_Validation_User Reviewed-by: Lauri Peltonen --- drivers/gpu/nvgpu/gk20a/cde_gk20a.c | 29 +++++++++-------------------- drivers/gpu/nvgpu/gk20a/cde_gk20a.h | 2 ++ 2 files changed, 11 insertions(+), 20 deletions(-) (limited to 'drivers/gpu') diff --git a/drivers/gpu/nvgpu/gk20a/cde_gk20a.c b/drivers/gpu/nvgpu/gk20a/cde_gk20a.c index 4c115e5f..57707f54 100644 --- a/drivers/gpu/nvgpu/gk20a/cde_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/cde_gk20a.c @@ -78,6 +78,7 @@ static void gk20a_deinit_cde_img(struct gk20a_cde_ctx *cde_ctx) cde_ctx->num_params = 0; cde_ctx->init_cmd_num_entries = 0; cde_ctx->convert_cmd_num_entries = 0; + cde_ctx->init_cmd_executed = false; } static int gk20a_cde_remove(struct gk20a_cde_ctx *cde_ctx) @@ -681,22 +682,6 @@ int gk20a_cde_convert(struct gk20a *g, struct dma_buf *src, goto exit_unlock; } - /* disable the channel */ - gk20a_writel(g, ccsr_channel_r(cde_ctx->ch->hw_chid), - gk20a_readl(g, ccsr_channel_r(cde_ctx->ch->hw_chid)) | - ccsr_channel_enable_clr_true_f()); - gk20a_fifo_preempt_channel(g, cde_ctx->ch->hw_chid); - channel_gk20a_unbind(&g->fifo.channel[cde_ctx->ch->hw_chid]); - - /* reinitialise the graphics context of the channel */ - gr_gk20a_load_golden_ctx_image(g, cde_ctx->ch); - - /* re-enable the channel */ - g->ops.fifo.bind_channel(&g->fifo.channel[cde_ctx->ch->hw_chid]); - gk20a_writel(g, ccsr_channel_r(cde_ctx->ch->hw_chid), - gk20a_readl(g, ccsr_channel_r(cde_ctx->ch->hw_chid)) | - ccsr_channel_enable_set_true_f()); - /* store source buffer compression tags */ gk20a_get_comptags(&g->dev->dev, src, &comptags); cde_ctx->src_vaddr = src_vaddr; @@ -738,10 +723,14 @@ int gk20a_cde_convert(struct gk20a *g, struct dma_buf *src, gk20a_cde_dump(cde_ctx); /* execute the init push buffer */ - err = gk20a_cde_execute_buffer(cde_ctx, TYPE_BUF_COMMAND_INIT, - NULL, 0, NULL); - if (err) - goto exit_unlock; + if (!cde_ctx->init_cmd_executed) { + err = gk20a_cde_execute_buffer(cde_ctx, TYPE_BUF_COMMAND_INIT, + NULL, 0, NULL); + if (err) + goto exit_unlock; + + cde_ctx->init_cmd_executed = true; + } /* take always the postfence as it is needed for protecting the * cde context */ diff --git a/drivers/gpu/nvgpu/gk20a/cde_gk20a.h b/drivers/gpu/nvgpu/gk20a/cde_gk20a.h index 9569f436..4e6a8ec9 100644 --- a/drivers/gpu/nvgpu/gk20a/cde_gk20a.h +++ b/drivers/gpu/nvgpu/gk20a/cde_gk20a.h @@ -232,6 +232,8 @@ struct gk20a_cde_ctx { int convert_cmd_num_entries; struct kobj_attribute attr; + + bool init_cmd_executed; }; struct gk20a_cde_app { -- cgit v1.2.2