]> git.openpandora.org Git - sgx.git/commitdiff
gpu: pvr: get rid of unnecessary hash lookups for the proc object
authorImre Deak <imre.deak@nokia.com>
Fri, 1 Apr 2011 14:59:41 +0000 (17:59 +0300)
committerGrazvydas Ignotas <notasas@gmail.com>
Sun, 20 May 2012 18:43:04 +0000 (21:43 +0300)
We already are passed a pointer to the process specific data, so no
need to do an extra hash lookup just for this purpose.

Note that this lookup overhead was incured in each IOCTL command.

Signed-off-by: Imre Deak <imre.deak@nokia.com>
Reviewed-by: Luc Verhaegen <libv@codethink.co.uk>
pvr/module.c
pvr/private_data.h
pvr/pvr_bridge_k.c

index 75435790e819c9d83be0b33918bd30d251a99f94..da8e94467b28a5b5e182fed671a061435167b32b 100644 (file)
@@ -95,6 +95,7 @@ static int pvr_open(struct inode unref__ * inode, struct file *filp)
 
        priv->ui32OpenPID = pid;
        priv->hBlockAlloc = block_alloc;
+       priv->proc = PVRSRVPerProcessData(pid);
        filp->private_data = priv;
 
        INIT_LIST_HEAD(&priv->event_list);
index b91b838e7fdd19460a0b91612a118ef369328689..209134f1ba8dd5e97197da6c1e6c46d9515a193c 100644 (file)
@@ -33,6 +33,7 @@
 struct PVRSRV_FILE_PRIVATE_DATA {
        u32 ui32OpenPID;
        void *hBlockAlloc;
+       struct PVRSRV_PER_PROCESS_DATA *proc;
 
        wait_queue_head_t event_wait;
        struct list_head event_list;
index 4cbc04167d738e80a0a167f7146565e8263c871c..7489f65e9c615088fa30b90c2465ee8a59532ecd 100644 (file)
@@ -173,6 +173,7 @@ long PVRSRV_BridgeDispatchKM(struct file *filp, unsigned int cmd,
            (struct PVRSRV_BRIDGE_PACKAGE __user *)arg;
        struct PVRSRV_BRIDGE_PACKAGE sBridgePackageKM;
        u32 ui32PID = OSGetCurrentProcessIDKM();
+       struct PVRSRV_FILE_PRIVATE_DATA *priv;
        struct PVRSRV_PER_PROCESS_DATA *psPerProc;
        int err = -EFAULT;
 
@@ -196,21 +197,12 @@ long PVRSRV_BridgeDispatchKM(struct file *filp, unsigned int cmd,
                           sizeof(struct PVRSRV_BRIDGE_PACKAGE)) != PVRSRV_OK)
                goto unlock_and_return;
 
+       priv = filp->private_data;
+       psPerProc = priv->proc;
+       BUG_ON(!psPerProc);
+
        if (ui32BridgeID !=
            PVRSRV_GET_BRIDGE_ID(PVRSRV_BRIDGE_CONNECT_SERVICES)) {
-               enum PVRSRV_ERROR eError;
-
-               eError = PVRSRVLookupHandle(KERNEL_HANDLE_BASE,
-                                           (void **)&psPerProc,
-                                           sBridgePackageKM.hKernelServices,
-                                           PVRSRV_HANDLE_TYPE_PERPROC_DATA);
-               if (eError != PVRSRV_OK) {
-                       PVR_DPF(PVR_DBG_ERROR,
-                                "%s: Invalid kernel services handle (%d)",
-                                __func__, eError);
-                       goto unlock_and_return;
-               }
-
                if (psPerProc->ui32PID != ui32PID) {
                        PVR_DPF(PVR_DBG_ERROR,
                                 "%s: Process %d tried to access data "
@@ -218,13 +210,6 @@ long PVRSRV_BridgeDispatchKM(struct file *filp, unsigned int cmd,
                                 ui32PID, psPerProc->ui32PID);
                        goto unlock_and_return;
                }
-       } else {
-               psPerProc = PVRSRVPerProcessData(ui32PID);
-               if (psPerProc == NULL) {
-                       PVR_DPF(PVR_DBG_ERROR, "PVRSRV_BridgeDispatchKM: "
-                                "Couldn't create per-process data area");
-                       goto unlock_and_return;
-               }
        }
 
        sBridgePackageKM.ui32BridgeID = PVRSRV_GET_BRIDGE_ID(