msm: kgsl: Try to replay commands from bad context in recovery
Replay the all the commands that have not been executed by the GPU
in recovery with preamble turned on for the first command to see
if that succeeds. If it does then we have recovered all contexts.
If that fails then replay commands only from contexts that are
in a good state.
Change-Id: Ia2a5c9b0de5556c5182cfab3bd6ae576d15b53eb
Signed-off-by: Shubhraprakash Das <sadas@codeaurora.org>
diff --git a/drivers/gpu/msm/adreno_ringbuffer.c b/drivers/gpu/msm/adreno_ringbuffer.c
index 9eca367..192a4d2 100644
--- a/drivers/gpu/msm/adreno_ringbuffer.c
+++ b/drivers/gpu/msm/adreno_ringbuffer.c
@@ -942,8 +942,13 @@
*/
adreno_idle(device, KGSL_TIMEOUT_DEFAULT);
#endif
+ /* If context hung and recovered then return error so that the
+ * application may handle it */
+ if (drawctxt->flags & CTXT_FLAGS_GPU_HANG_RECOVERED)
+ return -EDEADLK;
+ else
+ return 0;
- return 0;
}
static int _find_start_of_cmd_seq(struct adreno_ringbuffer *rb,
@@ -1042,6 +1047,9 @@
temp_rb_rptr / sizeof(unsigned int));
}
}
+ if (status)
+ KGSL_DRV_ERR(rb->device,
+ "Failed to find the command sequence after eop timestamp\n");
return status;
}
@@ -1251,6 +1259,8 @@
goto copy_rb_contents;
}
_turn_preamble_on_for_ib_seq(rb, rb_rptr);
+ } else {
+ status = -EINVAL;
}
}
@@ -1261,11 +1271,15 @@
&rec_data->bad_rb_size,
&rec_data->last_valid_ctx_id);
/* If we failed to get the hanging IB sequence then we cannot execute
- * commands from the bad context */
+ * commands from the bad context or preambles not supported */
if (status) {
rec_data->bad_rb_size = 0;
status = 0;
}
+ /* If there is no context then that means there are no commands for
+ * good case */
+ if (!context)
+ rec_data->rb_size = 0;
done:
return status;
}