summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKonsta Holtta <kholtta@nvidia.com>2017-11-06 08:20:50 -0500
committermobile promotions <svcmobile_promotions@nvidia.com>2017-11-22 12:49:30 -0500
commitb0dee2f26c6d7d398a07c3af8c410a337b7825a4 (patch)
treebec62f190ef01c36580c3048e568ce496011e052
parent8fe633449f92d35b60a60de647a4e8fc1b5c8936 (diff)
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 <kholtta@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/1590055 Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com> Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
-rw-r--r--drivers/gpu/nvgpu/common/linux/cde.c35
-rw-r--r--drivers/gpu/nvgpu/common/linux/cde.h3
2 files changed, 29 insertions, 9 deletions
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,
759 } else if (op == TYPE_BUF_COMMAND_CONVERT) { 759 } else if (op == TYPE_BUF_COMMAND_CONVERT) {
760 gpfifo = cde_ctx->convert_cmd; 760 gpfifo = cde_ctx->convert_cmd;
761 num_entries = cde_ctx->convert_cmd_num_entries; 761 num_entries = cde_ctx->convert_cmd_num_entries;
762 } else if (op == TYPE_BUF_COMMAND_NOOP) {
763 /* Any non-null gpfifo will suffice with 0 num_entries */
764 gpfifo = cde_ctx->init_convert_cmd;
765 num_entries = 0;
762 } else { 766 } else {
763 nvgpu_warn(g, "cde: unknown buffer"); 767 nvgpu_warn(g, "cde: unknown buffer");
764 return -EINVAL; 768 return -EINVAL;
765 } 769 }
766 770
767 if (gpfifo == NULL || num_entries == 0) { 771 if (gpfifo == NULL) {
768 nvgpu_warn(g, "cde: buffer not available"); 772 nvgpu_warn(g, "cde: buffer not available");
769 return -ENOSYS; 773 return -ENOSYS;
770 } 774 }
@@ -990,6 +994,7 @@ __releases(&l->cde_app->mutex)
990 u32 flags; 994 u32 flags;
991 int err, i; 995 int err, i;
992 const s16 compbits_kind = 0; 996 const s16 compbits_kind = 0;
997 u32 submit_op;
993 998
994 gk20a_dbg(gpu_dbg_cde, "compbits_byte_offset=%llu scatterbuffer_byte_offset=%llu", 999 gk20a_dbg(gpu_dbg_cde, "compbits_byte_offset=%llu scatterbuffer_byte_offset=%llu",
995 compbits_byte_offset, scatterbuffer_byte_offset); 1000 compbits_byte_offset, scatterbuffer_byte_offset);
@@ -1162,15 +1167,29 @@ __releases(&l->cde_app->mutex)
1162 /* gk20a_cde_execute_buffer() will grab a power reference of it's own */ 1167 /* gk20a_cde_execute_buffer() will grab a power reference of it's own */
1163 gk20a_idle(g); 1168 gk20a_idle(g);
1164 1169
1165 /* execute the conversion buffer, combined with init first if it's the 1170 if (comptags.lines == 0) {
1166 * first time */ 1171 /*
1167 err = gk20a_cde_execute_buffer(cde_ctx, 1172 * Nothing to do on the buffer, but do a null kickoff for
1168 cde_ctx->init_cmd_executed 1173 * managing the pre and post fences.
1169 ? TYPE_BUF_COMMAND_CONVERT 1174 */
1170 : TYPE_BUF_COMMAND_INIT, 1175 submit_op = TYPE_BUF_COMMAND_NOOP;
1176 } else if (!cde_ctx->init_cmd_executed) {
1177 /*
1178 * First time, so include the init pushbuf too in addition to
1179 * the conversion code.
1180 */
1181 submit_op = TYPE_BUF_COMMAND_INIT;
1182 } else {
1183 /*
1184 * The usual condition: execute just the conversion.
1185 */
1186 submit_op = TYPE_BUF_COMMAND_CONVERT;
1187 }
1188 err = gk20a_cde_execute_buffer(cde_ctx, submit_op,
1171 fence, flags, fence_out); 1189 fence, flags, fence_out);
1172 1190
1173 cde_ctx->init_cmd_executed = true; 1191 if (comptags.lines != 0 && !err)
1192 cde_ctx->init_cmd_executed = true;
1174 1193
1175 /* unmap the buffers - channel holds references to them now */ 1194 /* unmap the buffers - channel holds references to them now */
1176 nvgpu_vm_unmap(cde_ctx->vm, map_vaddr, NULL); 1195 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 {
160 160
161enum { 161enum {
162 TYPE_BUF_COMMAND_INIT = 0, 162 TYPE_BUF_COMMAND_INIT = 0,
163 TYPE_BUF_COMMAND_CONVERT 163 TYPE_BUF_COMMAND_CONVERT,
164 TYPE_BUF_COMMAND_NOOP
164}; 165};
165 166
166/* 167/*