From b0dee2f26c6d7d398a07c3af8c410a337b7825a4 Mon Sep 17 00:00:00 2001 From: Konsta Holtta Date: Mon, 6 Nov 2017 15:20:50 +0200 Subject: gpu: nvgpu: don't run cde shader for 0 ctaglines If the associated buffer is not compressed, it would be invalid to call the cde swizzler shader with zero lines. The fences in PREPARE_COMPRESSIBLE_READ still need to be managed, so just do a dummy submit with zero entries when lines is zero for the buffer. Bug 1856088 Change-Id: Ia68c2ffff21e5e8077d5c550b0ca44090f88bf80 Signed-off-by: Konsta Holtta Reviewed-on: https://git-master.nvidia.com/r/1590055 Reviewed-by: mobile promotions Tested-by: mobile promotions --- drivers/gpu/nvgpu/common/linux/cde.c | 35 +++++++++++++++++++++++++++-------- drivers/gpu/nvgpu/common/linux/cde.h | 3 ++- 2 files changed, 29 insertions(+), 9 deletions(-) (limited to 'drivers/gpu/nvgpu/common') diff --git a/drivers/gpu/nvgpu/common/linux/cde.c b/drivers/gpu/nvgpu/common/linux/cde.c index c4f678b6..b48c498d 100644 --- a/drivers/gpu/nvgpu/common/linux/cde.c +++ b/drivers/gpu/nvgpu/common/linux/cde.c @@ -759,12 +759,16 @@ static int gk20a_cde_execute_buffer(struct gk20a_cde_ctx *cde_ctx, } else if (op == TYPE_BUF_COMMAND_CONVERT) { gpfifo = cde_ctx->convert_cmd; num_entries = cde_ctx->convert_cmd_num_entries; + } else if (op == TYPE_BUF_COMMAND_NOOP) { + /* Any non-null gpfifo will suffice with 0 num_entries */ + gpfifo = cde_ctx->init_convert_cmd; + num_entries = 0; } else { nvgpu_warn(g, "cde: unknown buffer"); return -EINVAL; } - if (gpfifo == NULL || num_entries == 0) { + if (gpfifo == NULL) { nvgpu_warn(g, "cde: buffer not available"); return -ENOSYS; } @@ -990,6 +994,7 @@ __releases(&l->cde_app->mutex) u32 flags; int err, i; const s16 compbits_kind = 0; + u32 submit_op; gk20a_dbg(gpu_dbg_cde, "compbits_byte_offset=%llu scatterbuffer_byte_offset=%llu", compbits_byte_offset, scatterbuffer_byte_offset); @@ -1162,15 +1167,29 @@ __releases(&l->cde_app->mutex) /* gk20a_cde_execute_buffer() will grab a power reference of it's own */ gk20a_idle(g); - /* execute the conversion buffer, combined with init first if it's the - * first time */ - err = gk20a_cde_execute_buffer(cde_ctx, - cde_ctx->init_cmd_executed - ? TYPE_BUF_COMMAND_CONVERT - : TYPE_BUF_COMMAND_INIT, + if (comptags.lines == 0) { + /* + * Nothing to do on the buffer, but do a null kickoff for + * managing the pre and post fences. + */ + submit_op = TYPE_BUF_COMMAND_NOOP; + } else if (!cde_ctx->init_cmd_executed) { + /* + * First time, so include the init pushbuf too in addition to + * the conversion code. + */ + submit_op = TYPE_BUF_COMMAND_INIT; + } else { + /* + * The usual condition: execute just the conversion. + */ + submit_op = TYPE_BUF_COMMAND_CONVERT; + } + err = gk20a_cde_execute_buffer(cde_ctx, submit_op, fence, flags, fence_out); - cde_ctx->init_cmd_executed = true; + if (comptags.lines != 0 && !err) + cde_ctx->init_cmd_executed = true; /* unmap the buffers - channel holds references to them now */ nvgpu_vm_unmap(cde_ctx->vm, map_vaddr, NULL); diff --git a/drivers/gpu/nvgpu/common/linux/cde.h b/drivers/gpu/nvgpu/common/linux/cde.h index 5dd15c37..fe206401 100644 --- a/drivers/gpu/nvgpu/common/linux/cde.h +++ b/drivers/gpu/nvgpu/common/linux/cde.h @@ -160,7 +160,8 @@ struct gk20a_cde_hdr_command { enum { TYPE_BUF_COMMAND_INIT = 0, - TYPE_BUF_COMMAND_CONVERT + TYPE_BUF_COMMAND_CONVERT, + TYPE_BUF_COMMAND_NOOP }; /* -- cgit v1.2.2