From: Imre Deak Date: Tue, 30 Mar 2010 12:36:24 +0000 (+0300) Subject: gpu: pvr: add helpers to look up resource context and proc info X-Git-Url: http://git.openpandora.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3514c016130b18e20a57c150944dfeffe5812f70;p=sgx.git gpu: pvr: add helpers to look up resource context and proc info These are needed by an upcoming patch showing process info. Signed-off-by: Imre Deak --- diff --git a/pvr/resman.c b/pvr/resman.c index f2b9f4b..ccb1664 100644 --- a/pvr/resman.c +++ b/pvr/resman.c @@ -476,6 +476,26 @@ static struct RESMAN_ITEM *find_res_by_crit(struct RESMAN_CONTEXT *res_ctx, return item; } +struct RESMAN_CONTEXT *pvr_get_resman_ctx(void *resource) +{ + struct RESMAN_CONTEXT *ctx; + + for (ctx = gpsResList->psContextList; ctx; ctx = ctx->psNext) { + struct RESMAN_ITEM *item; + + item = find_res_by_crit(ctx, RESMAN_CRITERIA_PVOID_PARAM, + 0, resource, 0); + if (item) + return ctx; + } + return NULL; +} + +struct PVRSRV_PER_PROCESS_DATA *pvr_get_proc_by_ctx(struct RESMAN_CONTEXT *ctx) +{ + return ctx->psPerProc; +} + static int FreeResourceByCriteria(struct RESMAN_CONTEXT *psResManContext, u32 ui32SearchCriteria, u32 ui32ResType, void *pvParam, u32 ui32Param, diff --git a/pvr/resman.h b/pvr/resman.h index 60c2a3b..f9a28f3 100644 --- a/pvr/resman.h +++ b/pvr/resman.h @@ -83,6 +83,9 @@ enum PVRSRV_ERROR ResManDissociateRes(struct RESMAN_ITEM *psResItem, enum PVRSRV_ERROR ResManFindResourceByPtr(struct RESMAN_CONTEXT *hResManContext, struct RESMAN_ITEM *psItem); +struct RESMAN_CONTEXT *pvr_get_resman_ctx(void *resource); +struct PVRSRV_PER_PROCESS_DATA *pvr_get_proc_by_ctx(struct RESMAN_CONTEXT *ctx); + enum PVRSRV_ERROR PVRSRVResManConnect(void *hPerProc, struct RESMAN_CONTEXT **phResManContext);