gpu: pvr: add helpers to look up resource context and proc info
authorImre Deak <imre.deak@nokia.com>
Tue, 30 Mar 2010 12:36:24 +0000 (15:36 +0300)
committerGrazvydas Ignotas <notasas@gmail.com>
Sun, 20 May 2012 18:09:40 +0000 (21:09 +0300)
These are needed by an upcoming patch showing process info.

Signed-off-by: Imre Deak <imre.deak@nokia.com>
pvr/resman.c
pvr/resman.h

index f2b9f4b..ccb1664 100644 (file)
@@ -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,
index 60c2a3b..f9a28f3 100644 (file)
@@ -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);