From de8fe0466c61b42dbb5c81ead20894b3cea7f5e3 Mon Sep 17 00:00:00 2001 From: Shrenuj Bansal <shrenujb@codeaurora.org> Date: Wed, 7 May 2014 14:37:42 -0700 Subject: [PATCH] msm: kgsl: Clear the memstore while destroying the context When creating a context, we add the event group much before initializing the memstore for that context. Between these events, its possible that events are registered and retired and the timestamp read in retire_events() gets us the last timestamp of the last destroyed context. This results in the processed timestamp to be greater than the actual retired timestamp in the memstore which is very problematic for us. CRs-Fixed: 640550 Change-Id: I2ace6d99e2ce417ba38f6bbbeeb787478eb4e372 Signed-off-by: Shrenuj Bansal <shrenujb@codeaurora.org> --- drivers/gpu/msm/kgsl.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/gpu/msm/kgsl.c b/drivers/gpu/msm/kgsl.c index cdea8ac1fb88..bb78e9ce8bb3 100644 --- a/drivers/gpu/msm/kgsl.c +++ b/drivers/gpu/msm/kgsl.c @@ -555,6 +555,13 @@ kgsl_context_destroy(struct kref *kref) write_lock(&device->context_lock); if (context->id != KGSL_CONTEXT_INVALID) { + + /* Clear the timestamps in the memstore during destroy */ + kgsl_sharedmem_writel(device, &device->memstore, + KGSL_MEMSTORE_OFFSET(context->id, soptimestamp), 0); + kgsl_sharedmem_writel(device, &device->memstore, + KGSL_MEMSTORE_OFFSET(context->id, eoptimestamp), 0); + idr_remove(&device->context_idr, context->id); context->id = KGSL_CONTEXT_INVALID; } -- GitLab