* DSPBRIDGE: Reclaim all pending buffer on resource cleanup
@ 2010-02-08 22:20 Guzman Lugo, Fernando
2010-02-16 18:12 ` Omar Ramirez Luna
0 siblings, 1 reply; 3+ messages in thread
From: Guzman Lugo, Fernando @ 2010-02-08 22:20 UTC (permalink / raw)
To: linux-omap; +Cc: Hiroshi Doyu, Ameya Palande, Felipe Contreras
>From 727c83cd8b7e4aca51b214412eaa1b95cde6e4ea Mon Sep 17 00:00:00 2001
From: Fernando Guzman Lugo <x0095840@ti.com>
Date: Tue, 2 Feb 2010 20:38:10 -0600
Subject: [PATCH] DSPBRIDGE: Reclaim all pending buffer on resource cleanup
Before in case of pending buffer while we try to close
a stream, it was doing only one reclaim, in the case there
were more pending buffer the second STRM_Close would also
fail, now all the pending buffers are reclaim.
Signed-off-by: Fernando Guzman Lugo <x0095840@ti.com>
---
drivers/dsp/bridge/rmgr/drv.c | 37 ++++++++++++++++---------------------
1 files changed, 16 insertions(+), 21 deletions(-)
diff --git a/drivers/dsp/bridge/rmgr/drv.c b/drivers/dsp/bridge/rmgr/drv.c
index edd8e97..660f375 100644
--- a/drivers/dsp/bridge/rmgr/drv.c
+++ b/drivers/dsp/bridge/rmgr/drv.c
@@ -458,40 +458,35 @@ static DSP_STATUS DRV_ProcFreeSTRMRes(HANDLE hPCtxt)
{
struct PROCESS_CONTEXT *pCtxt = (struct PROCESS_CONTEXT *)hPCtxt;
DSP_STATUS status = DSP_SOK;
- DSP_STATUS status1 = DSP_SOK;
u8 **apBuffer = NULL;
- struct STRM_RES_OBJECT *pSTRMList = NULL;
struct STRM_RES_OBJECT *pSTRMRes = NULL;
+ struct STRM_INFO strm_info;
+ struct DSP_STREAMINFO user;
u8 *pBufPtr;
u32 ulBytes;
u32 dwArg;
s32 ulBufSize;
- pSTRMList = pCtxt->pSTRMList;
- while (pSTRMList != NULL) {
- pSTRMRes = pSTRMList;
- pSTRMList = pSTRMList->next;
- if (pSTRMRes->uNumBufs != 0) {
- apBuffer = MEM_Alloc((pSTRMRes->uNumBufs *
- sizeof(u8 *)), MEM_NONPAGED);
+ pSTRMRes = pCtxt->pSTRMList;
+ while (pSTRMRes) {
+ if (pSTRMRes->uNumBufs) {
+ apBuffer = MEM_Alloc(pSTRMRes->uNumBufs *
+ sizeof(u8 *), MEM_NONPAGED);
+ if (!apBuffer)
+ return DSP_EMEMORY;
status = STRM_FreeBuffer(pSTRMRes->hStream, apBuffer,
pSTRMRes->uNumBufs, pCtxt);
MEM_Free(apBuffer);
}
- status = STRM_Close(pSTRMRes->hStream, pCtxt);
- if (DSP_FAILED(status)) {
- if (status == DSP_EPENDING) {
- status = STRM_Reclaim(pSTRMRes->hStream,
- &pBufPtr, &ulBytes,
- (u32 *)&ulBufSize, &dwArg);
- if (DSP_SUCCEEDED(status))
- status = STRM_Close(pSTRMRes->hStream,
- pCtxt);
+ strm_info.pUser = &user;
+ user.uNumberBufsInStream = 0;
+ STRM_GetInfo(pSTRMRes->hStream, &strm_info, sizeof(strm_info));
+ while (strm_info.pUser->uNumberBufsInStream--)
+ STRM_Reclaim(pSTRMRes->hStream, &pBufPtr, &ulBytes,
+ (u32 *)&ulBufSize, &dwArg);
- }
- }
}
- return status1;
+ return status;
}
/* Release all Stream resources and its context
--
1.6.0.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: DSPBRIDGE: Reclaim all pending buffer on resource cleanup
2010-02-08 22:20 DSPBRIDGE: Reclaim all pending buffer on resource cleanup Guzman Lugo, Fernando
@ 2010-02-16 18:12 ` Omar Ramirez Luna
2010-02-16 19:57 ` Guzman Lugo, Fernando
0 siblings, 1 reply; 3+ messages in thread
From: Omar Ramirez Luna @ 2010-02-16 18:12 UTC (permalink / raw)
To: Guzman Lugo, Fernando
Cc: linux-omap, Hiroshi Doyu, Ameya Palande, Felipe Contreras
Hi,
On 2/8/2010 4:20 PM, Guzman Lugo, Fernando wrote:
> From 727c83cd8b7e4aca51b214412eaa1b95cde6e4ea Mon Sep 17 00:00:00 2001
> From: Fernando Guzman Lugo<x0095840@ti.com>
> Date: Tue, 2 Feb 2010 20:38:10 -0600
> Subject: [PATCH] DSPBRIDGE: Reclaim all pending buffer on resource cleanup
>
> Before in case of pending buffer while we try to close
> a stream, it was doing only one reclaim, in the case there
> were more pending buffer the second STRM_Close would also
> fail, now all the pending buffers are reclaim.
>
> Signed-off-by: Fernando Guzman Lugo<x0095840@ti.com>
> ---
Shouldn't this be like?
Patch 1: Fix
Patch 2: code enhancement
that said, isn't this missing a STRM_Close? (look below)
> drivers/dsp/bridge/rmgr/drv.c | 37 ++++++++++++++++---------------------
> 1 files changed, 16 insertions(+), 21 deletions(-)
>
> diff --git a/drivers/dsp/bridge/rmgr/drv.c b/drivers/dsp/bridge/rmgr/drv.c
> index edd8e97..660f375 100644
> --- a/drivers/dsp/bridge/rmgr/drv.c
> +++ b/drivers/dsp/bridge/rmgr/drv.c
> @@ -458,40 +458,35 @@ static DSP_STATUS DRV_ProcFreeSTRMRes(HANDLE hPCtxt)
> {
> struct PROCESS_CONTEXT *pCtxt = (struct PROCESS_CONTEXT *)hPCtxt;
> DSP_STATUS status = DSP_SOK;
> - DSP_STATUS status1 = DSP_SOK;
> u8 **apBuffer = NULL;
> - struct STRM_RES_OBJECT *pSTRMList = NULL;
> struct STRM_RES_OBJECT *pSTRMRes = NULL;
> + struct STRM_INFO strm_info;
> + struct DSP_STREAMINFO user;
> u8 *pBufPtr;
> u32 ulBytes;
> u32 dwArg;
> s32 ulBufSize;
>
> - pSTRMList = pCtxt->pSTRMList;
> - while (pSTRMList != NULL) {
> - pSTRMRes = pSTRMList;
> - pSTRMList = pSTRMList->next;
> - if (pSTRMRes->uNumBufs != 0) {
> - apBuffer = MEM_Alloc((pSTRMRes->uNumBufs *
> - sizeof(u8 *)), MEM_NONPAGED);
> + pSTRMRes = pCtxt->pSTRMList;
> + while (pSTRMRes) {
> + if (pSTRMRes->uNumBufs) {
> + apBuffer = MEM_Alloc(pSTRMRes->uNumBufs *
> + sizeof(u8 *), MEM_NONPAGED);
> + if (!apBuffer)
> + return DSP_EMEMORY;
> status = STRM_FreeBuffer(pSTRMRes->hStream, apBuffer,
> pSTRMRes->uNumBufs, pCtxt);
> MEM_Free(apBuffer);
> }
> - status = STRM_Close(pSTRMRes->hStream, pCtxt);
> - if (DSP_FAILED(status)) {
> - if (status == DSP_EPENDING) {
> - status = STRM_Reclaim(pSTRMRes->hStream,
> - &pBufPtr,&ulBytes,
> - (u32 *)&ulBufSize,&dwArg);
> - if (DSP_SUCCEEDED(status))
> - status = STRM_Close(pSTRMRes->hStream,
> - pCtxt);
> + strm_info.pUser =&user;
> + user.uNumberBufsInStream = 0;
> + STRM_GetInfo(pSTRMRes->hStream,&strm_info, sizeof(strm_info));
> + while (strm_info.pUser->uNumberBufsInStream--)
> + STRM_Reclaim(pSTRMRes->hStream,&pBufPtr,&ulBytes,
> + (u32 *)&ulBufSize,&dwArg);
>
Here.
> - }
> - }
> }
> - return status1;
> + return status;
> }
>
> /* Release all Stream resources and its context
- omar
^ permalink raw reply [flat|nested] 3+ messages in thread
* RE: DSPBRIDGE: Reclaim all pending buffer on resource cleanup
2010-02-16 18:12 ` Omar Ramirez Luna
@ 2010-02-16 19:57 ` Guzman Lugo, Fernando
0 siblings, 0 replies; 3+ messages in thread
From: Guzman Lugo, Fernando @ 2010-02-16 19:57 UTC (permalink / raw)
To: Ramirez Luna, Omar
Cc: linux-omap, Hiroshi Doyu, Ameya Palande, Felipe Contreras
>-----Original Message-----
>From: Ramirez Luna, Omar
>Sent: Tuesday, February 16, 2010 12:13 PM
>To: Guzman Lugo, Fernando
>Cc: linux-omap; Hiroshi Doyu; Ameya Palande; Felipe Contreras
>Subject: Re: DSPBRIDGE: Reclaim all pending buffer on resource cleanup
>
>Hi,
>
>On 2/8/2010 4:20 PM, Guzman Lugo, Fernando wrote:
>> From 727c83cd8b7e4aca51b214412eaa1b95cde6e4ea Mon Sep 17 00:00:00 2001
>> From: Fernando Guzman Lugo<x0095840@ti.com>
>> Date: Tue, 2 Feb 2010 20:38:10 -0600
>> Subject: [PATCH] DSPBRIDGE: Reclaim all pending buffer on resource
>cleanup
>>
>> Before in case of pending buffer while we try to close
>> a stream, it was doing only one reclaim, in the case there
>> were more pending buffer the second STRM_Close would also
>> fail, now all the pending buffers are reclaim.
>>
>> Signed-off-by: Fernando Guzman Lugo<x0095840@ti.com>
>> ---
>
>Shouldn't this be like?
>Patch 1: Fix
>Patch 2: code enhancement
>
>that said, isn't this missing a STRM_Close? (look below)
Yes, you re right, that is a mistake. I will send it again.
Regards,
Fernando.
>
>> drivers/dsp/bridge/rmgr/drv.c | 37 ++++++++++++++++------------------
>---
>> 1 files changed, 16 insertions(+), 21 deletions(-)
>>
>> diff --git a/drivers/dsp/bridge/rmgr/drv.c
>b/drivers/dsp/bridge/rmgr/drv.c
>> index edd8e97..660f375 100644
>> --- a/drivers/dsp/bridge/rmgr/drv.c
>> +++ b/drivers/dsp/bridge/rmgr/drv.c
>> @@ -458,40 +458,35 @@ static DSP_STATUS DRV_ProcFreeSTRMRes(HANDLE
>hPCtxt)
>> {
>> struct PROCESS_CONTEXT *pCtxt = (struct PROCESS_CONTEXT *)hPCtxt;
>> DSP_STATUS status = DSP_SOK;
>> - DSP_STATUS status1 = DSP_SOK;
>> u8 **apBuffer = NULL;
>> - struct STRM_RES_OBJECT *pSTRMList = NULL;
>> struct STRM_RES_OBJECT *pSTRMRes = NULL;
>> + struct STRM_INFO strm_info;
>> + struct DSP_STREAMINFO user;
>> u8 *pBufPtr;
>> u32 ulBytes;
>> u32 dwArg;
>> s32 ulBufSize;
>>
>> - pSTRMList = pCtxt->pSTRMList;
>> - while (pSTRMList != NULL) {
>> - pSTRMRes = pSTRMList;
>> - pSTRMList = pSTRMList->next;
>> - if (pSTRMRes->uNumBufs != 0) {
>> - apBuffer = MEM_Alloc((pSTRMRes->uNumBufs *
>> - sizeof(u8 *)), MEM_NONPAGED);
>> + pSTRMRes = pCtxt->pSTRMList;
>> + while (pSTRMRes) {
>> + if (pSTRMRes->uNumBufs) {
>> + apBuffer = MEM_Alloc(pSTRMRes->uNumBufs *
>> + sizeof(u8 *), MEM_NONPAGED);
>> + if (!apBuffer)
>> + return DSP_EMEMORY;
>> status = STRM_FreeBuffer(pSTRMRes->hStream, apBuffer,
>> pSTRMRes->uNumBufs, pCtxt);
>> MEM_Free(apBuffer);
>> }
>> - status = STRM_Close(pSTRMRes->hStream, pCtxt);
>> - if (DSP_FAILED(status)) {
>> - if (status == DSP_EPENDING) {
>> - status = STRM_Reclaim(pSTRMRes->hStream,
>> - &pBufPtr,&ulBytes,
>> - (u32 *)&ulBufSize,&dwArg);
>> - if (DSP_SUCCEEDED(status))
>> - status = STRM_Close(pSTRMRes->hStream,
>> - pCtxt);
>> + strm_info.pUser =&user;
>> + user.uNumberBufsInStream = 0;
>> + STRM_GetInfo(pSTRMRes->hStream,&strm_info, sizeof(strm_info));
>> + while (strm_info.pUser->uNumberBufsInStream--)
>> + STRM_Reclaim(pSTRMRes->hStream,&pBufPtr,&ulBytes,
>> + (u32 *)&ulBufSize,&dwArg);
>>
>
>Here.
>
>> - }
>> - }
>> }
>> - return status1;
>> + return status;
>> }
>>
>> /* Release all Stream resources and its context
>
>- omar
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2010-02-16 19:57 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-02-08 22:20 DSPBRIDGE: Reclaim all pending buffer on resource cleanup Guzman Lugo, Fernando
2010-02-16 18:12 ` Omar Ramirez Luna
2010-02-16 19:57 ` Guzman Lugo, Fernando
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).