msm: kgsl: Locate index of recovery during initialization

When a hang happens locate the index in ringbuffer from where replay
of recovery needs to be re-tried during initialization of recevery.
If the hang detection is false then hang reported by postmortem and
snapshot may be different, but recovery will always start from the
index obtained during initialization. Also, this allows us to capture
data into the snapshot that is in line with the point from where
recovery occurred.

Change-Id: Ie3877f0c81dad2ede888db7cb7d3ff13e2761763
Signed-off-by: Shubhraprakash Das <sadas@codeaurora.org>
Signed-off-by: Tarun Karra <tkarra@codeaurora.org>
diff --git a/drivers/gpu/msm/adreno.h b/drivers/gpu/msm/adreno.h
index f7a924a..514c86c 100644
--- a/drivers/gpu/msm/adreno.h
+++ b/drivers/gpu/msm/adreno.h
@@ -142,6 +142,10 @@
  * @last_valid_ctx_id - The last context from which commands were placed in
  * ringbuffer before the GPU hung
  * @fault - Indicates whether the hang was caused due to a pagefault
+ * @start_of_replay_cmds - Offset in ringbuffer from where commands can be
+ * replayed during recovery
+ * @replay_for_snapshot - Offset in ringbuffer where IB's can be saved for
+ * replaying with snapshot
  */
 struct adreno_recovery_data {
 	unsigned int ib1;
@@ -153,6 +157,8 @@
 	unsigned int bad_rb_size;
 	unsigned int last_valid_ctx_id;
 	int fault;
+	unsigned int start_of_replay_cmds;
+	unsigned int replay_for_snapshot;
 };
 
 extern struct adreno_gpudev adreno_a2xx_gpudev;