msm: kgsl: In recovery search for command stream after global eop

In recovery search for the timestamp of the command stream after
global eop instead of searching for the command stream of the
global eop and then moving the pointer forward till the start of
the command stream following global eop. This is because if the
ringbuffer is full then the global eop timestamp may have been
overwritten, so its more reliable to search for the timestamp
that occurs after global eop.

Change-Id: Ide272fd653bcba411f0c4b92b3dc2ac2fa8326a9
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 192a4d2..d54ce6b 100644
--- a/drivers/gpu/msm/adreno_ringbuffer.c
+++ b/drivers/gpu/msm/adreno_ringbuffer.c
@@ -1036,10 +1036,10 @@
 		if (2 == i)
 			check = true;
 	} while (temp_rb_rptr / sizeof(unsigned int) != rb->wptr);
-	/* temp_rb_rptr points to the global eop, move forward till
-	 * the next command */
+	/* temp_rb_rptr points to the command stream after global eop,
+	 * move backward till the start of command sequence */
 	if (!status) {
-		status = _find_start_of_cmd_seq(rb, &temp_rb_rptr, true);
+		status = _find_start_of_cmd_seq(rb, &temp_rb_rptr, false);
 		if (!status) {
 			*rb_rptr = temp_rb_rptr;
 			KGSL_DRV_ERR(rb->device,
@@ -1243,8 +1243,9 @@
 
 	context = idr_find(&device->context_idr, rec_data->context_id);
 
-	status = _find_cmd_seq_after_eop_ts(rb, &rb_rptr, rec_data->global_eop,
-						false);
+	/* Look for the command stream that is right after the global eop */
+	status = _find_cmd_seq_after_eop_ts(rb, &rb_rptr,
+				rec_data->global_eop + 1, false);
 	if (status)
 		goto done;