diff options
| author | Sunil Khatri <sunilkh@codeaurora.org> | 2016-04-29 09:28:51 -0600 |
|---|---|---|
| committer | Jeevan Shriram <jshriram@codeaurora.org> | 2016-05-11 17:44:07 -0700 |
| commit | cb8b43b46c07951241611d96491e505e2edb953a (patch) | |
| tree | fcae1b62b7e4944c06908632cb123bf7a8fbadd4 /drivers/gpu/msm | |
| parent | 8cdea23e0363e5edc074b5031cbd94e772efd9c9 (diff) | |
msm: kgsl: Do not allocate memory for profiling and sync commands
Do not allocate memory for IB descriptors for commands
of types profiling buffers, sync and markers.
This fixes the memory leak due to allocation of
memory for such commands and these were never freed.
CRs-Fixed: 996651
Change-Id: Ib168d60ad89e0fd55cd1f10b773b7cdaa7400ace
Signed-off-by: Sunil Khatri <sunilkh@codeaurora.org>
Diffstat (limited to 'drivers/gpu/msm')
| -rw-r--r-- | drivers/gpu/msm/kgsl_cmdbatch.c | 39 |
1 files changed, 19 insertions, 20 deletions
diff --git a/drivers/gpu/msm/kgsl_cmdbatch.c b/drivers/gpu/msm/kgsl_cmdbatch.c index f0d674161036..ceca8b1e1522 100644 --- a/drivers/gpu/msm/kgsl_cmdbatch.c +++ b/drivers/gpu/msm/kgsl_cmdbatch.c @@ -539,42 +539,41 @@ static void add_profiling_buffer(struct kgsl_device *device, int kgsl_cmdbatch_add_ibdesc(struct kgsl_device *device, struct kgsl_cmdbatch *cmdbatch, struct kgsl_ibdesc *ibdesc) { + uint64_t gpuaddr = (uint64_t) ibdesc->gpuaddr; + uint64_t size = (uint64_t) ibdesc->sizedwords << 2; struct kgsl_memobj_node *mem; + /* sanitize the ibdesc ctrl flags */ + ibdesc->ctrl &= KGSL_IBDESC_MEMLIST | KGSL_IBDESC_PROFILING_BUFFER; + + if (cmdbatch->flags & KGSL_CMDBATCH_MEMLIST && + ibdesc->ctrl & KGSL_IBDESC_MEMLIST) { + if (ibdesc->ctrl & KGSL_IBDESC_PROFILING_BUFFER) { + add_profiling_buffer(device, cmdbatch, + gpuaddr, size, 0, 0); + return 0; + } + } + + if (cmdbatch->flags & (KGSL_CMDBATCH_SYNC | KGSL_CMDBATCH_MARKER)) + return 0; + mem = kmem_cache_alloc(memobjs_cache, GFP_KERNEL); if (mem == NULL) return -ENOMEM; - mem->gpuaddr = (uint64_t) ibdesc->gpuaddr; - mem->size = (uint64_t) ibdesc->sizedwords << 2; + mem->gpuaddr = gpuaddr; + mem->size = size; mem->priv = 0; mem->id = 0; mem->offset = 0; mem->flags = 0; - /* sanitize the ibdesc ctrl flags */ - ibdesc->ctrl &= KGSL_IBDESC_MEMLIST | KGSL_IBDESC_PROFILING_BUFFER; - if (cmdbatch->flags & KGSL_CMDBATCH_MEMLIST && ibdesc->ctrl & KGSL_IBDESC_MEMLIST) { - if (ibdesc->ctrl & KGSL_IBDESC_PROFILING_BUFFER) { - add_profiling_buffer(device, cmdbatch, mem->gpuaddr, - mem->size, 0, 0); - return 0; - } - /* add to the memlist */ list_add_tail(&mem->node, &cmdbatch->memlist); - - if (ibdesc->ctrl & KGSL_IBDESC_PROFILING_BUFFER) - add_profiling_buffer(device, cmdbatch, mem->gpuaddr, - mem->size, 0, 0); } else { - /* Ignore if SYNC or MARKER is specified */ - if (cmdbatch->flags & - (KGSL_CMDBATCH_SYNC | KGSL_CMDBATCH_MARKER)) - return 0; - /* set the preamble flag if directed to */ if (cmdbatch->context->flags & KGSL_CONTEXT_PREAMBLE && list_empty(&cmdbatch->cmdlist)) |
