gpu: pvr: enable render complete events
authorTopi Pohjolainen <topi.pohjolainen@nokia.com>
Tue, 27 Apr 2010 11:14:20 +0000 (13:14 +0200)
committerGrazvydas Ignotas <notasas@gmail.com>
Sun, 20 May 2012 18:09:41 +0000 (21:09 +0300)
In DRM style events are associated with the driver private
part of the driver file descriptor. In order for the poll
and read methods to access the event list one needs to pass
the file private through the IOCTL stack.

Signed-off-by: Topi Pohjolainen <topi.pohjolainen@nokia.com>
Signed-off-by: Imre Deak <imre.deak@nokia.com>
pvr/Makefile
pvr/bridged_pvr_bridge.c
pvr/bridged_pvr_bridge.h
pvr/bridged_sgx_bridge.c
pvr/bridged_sgx_bridge.h
pvr/module.c
pvr/pvr_bridge_k.c
pvr/pvrsrv.c
pvr/sgx_bridge.h

index 81db9be..48e37d0 100644 (file)
@@ -10,7 +10,8 @@ pvrsrvkm-objs         := osfunc.o mmap.o module.o pdump.o proc.o         \
                           sgxinit.o sgxreset.o sgxutils.o sgxkick.o       \
                           sgxtransfer.o mmu.o pb.o perproc.o sysconfig.o  \
                           sysutils.o osperproc.o bridged_support.o        \
-                          bridged_sgx_bridge.o sgxpower.o pdump_common.o
+                          bridged_sgx_bridge.o sgxpower.o pdump_common.o  \
+                          pvr_events.o
 
 pvrsrvkm-objs-$(CONFIG_PVR_DEBUG) += pvr_debug.o
 pvrsrvkm-objs-$(CONFIG_PVR_TIMING) += pvr_debug.o
index 2f20554..573aba0 100644 (file)
@@ -2919,7 +2919,7 @@ static int bridged_check_cmd(u32 cmd_id)
        return 0;
 }
 
-static int bridged_ioctl(u32 cmd, void *in, void *out,
+static int bridged_ioctl(struct file *filp, u32 cmd, void *in, void *out,
                         struct PVRSRV_PER_PROCESS_DATA *per_proc)
 {
        int err = -EFAULT;
@@ -3208,7 +3208,7 @@ static int bridged_ioctl(u32 cmd, void *in, void *out,
                break;
 
        case PVRSRV_BRIDGE_SGX_2DQUERYBLTSCOMPLETE:
-               err = SGX2DQueryBlitsCompleteBW(cmd, in, out, per_proc);
+               err = SGX2DQueryBlitsCompleteBW(filp, cmd, in, out, per_proc);
                break;
 
        case PVRSRV_BRIDGE_SGX_GETMMUPDADDR:
@@ -3290,7 +3290,7 @@ static int bridged_ioctl(u32 cmd, void *in, void *out,
        return err;
 }
 
-int BridgedDispatchKM(struct PVRSRV_PER_PROCESS_DATA *pd,
+int BridgedDispatchKM(struct file *filp, struct PVRSRV_PER_PROCESS_DATA *pd,
                      struct PVRSRV_BRIDGE_PACKAGE *pkg)
 {
 
@@ -3325,7 +3325,7 @@ int BridgedDispatchKM(struct PVRSRV_PER_PROCESS_DATA *pd,
                goto return_fault;
        }
 
-       err = bridged_ioctl(bid, in, out, pd);
+       err = bridged_ioctl(filp, bid, in, out, pd);
 
        if (err < 0)
                goto return_fault;
index 1e35ff4..188fded 100644 (file)
@@ -151,7 +151,8 @@ extern struct PVRSRV_BRIDGE_GLOBAL_STATS g_BridgeGlobalStats;
 
 enum PVRSRV_ERROR CommonBridgeInit(void);
 
-int BridgedDispatchKM(struct PVRSRV_PER_PROCESS_DATA *psPerProc,
-                     struct PVRSRV_BRIDGE_PACKAGE *psBridgePackageKM);
+int BridgedDispatchKM(struct file *filp,
+                       struct PVRSRV_PER_PROCESS_DATA *psPerProc,
+                       struct PVRSRV_BRIDGE_PACKAGE *psBridgePackageKM);
 
 #endif
index 634fd26..d32d2aa 100644 (file)
@@ -42,6 +42,7 @@
 #include "bridged_sgx_bridge.h"
 #include "sgxutils.h"
 #include "pdump_km.h"
+#include "pvr_events.h"
 
 int SGXGetClientInfoBW(u32 ui32BridgeID,
              struct PVRSRV_BRIDGE_IN_GETCLIENTINFO *psGetClientInfoIN,
@@ -996,7 +997,7 @@ int SGXFlushHWRenderTargetBW(u32 ui32BridgeID,
        return 0;
 }
 
-int SGX2DQueryBlitsCompleteBW(u32 ui32BridgeID,
+int SGX2DQueryBlitsCompleteBW(struct file *filp, u32 ui32BridgeID,
      struct PVRSRV_BRIDGE_IN_2DQUERYBLTSCOMPLETE *ps2DQueryBltsCompleteIN,
      struct PVRSRV_BRIDGE_RETURN *psRetOUT,
      struct PVRSRV_PER_PROCESS_DATA *psPerProc)
@@ -1026,6 +1027,16 @@ int SGX2DQueryBlitsCompleteBW(u32 ui32BridgeID,
            (struct PVRSRV_SGXDEV_INFO *)((struct PVRSRV_DEVICE_NODE *)
                                          hDevCookieInt)->pvDevice;
 
+       if (ps2DQueryBltsCompleteIN->type == _PVR_SYNC_WAIT_EVENT) {
+               struct PVRSRV_FILE_PRIVATE_DATA *priv = filp->private_data;
+
+               if (pvr_sync_event_req(priv,
+                               (struct PVRSRV_KERNEL_SYNC_INFO *)pvSyncInfo))
+                       psRetOUT->eError = PVRSRV_ERROR_OUT_OF_MEMORY;
+
+               return 0;
+       }
+
        psRetOUT->eError =
            SGX2DQueryBlitsCompleteKM(psDevInfo,
                                      (struct PVRSRV_KERNEL_SYNC_INFO *)
index 3867dc4..aa1e7dc 100644 (file)
@@ -112,7 +112,7 @@ int SGXFlushHWRenderTargetBW(u32 ui32BridgeID,
        struct PVRSRV_BRIDGE_RETURN *psRetOUT,
        struct PVRSRV_PER_PROCESS_DATA *psPerProc);
 
-int SGX2DQueryBlitsCompleteBW(u32 ui32BridgeID,
+int SGX2DQueryBlitsCompleteBW(struct file *filp, u32 ui32BridgeID,
        struct PVRSRV_BRIDGE_IN_2DQUERYBLTSCOMPLETE *ps2DQueryBltsCompleteIN,
        struct PVRSRV_BRIDGE_RETURN *psRetOUT,
        struct PVRSRV_PER_PROCESS_DATA *psPerProc);
index c79b0d9..8357fcd 100644 (file)
@@ -52,6 +52,7 @@
 #include "proc.h"
 #include "pvrmodule.h"
 #include "private_data.h"
+#include "pvr_events.h"
 
 #define DRVNAME                "pvrsrvkm"
 
@@ -106,6 +107,8 @@ static int pvr_release(struct inode unref__ * inode, struct file *filp)
 
        priv = filp->private_data;
 
+       pvr_release_events(priv);
+
        PVRSRVProcessDisconnect(priv->ui32OpenPID);
 
        OSFreeMem(PVRSRV_OS_NON_PAGEABLE_HEAP,
@@ -123,6 +126,8 @@ static const struct file_operations pvr_fops = {
        .open           = pvr_open,
        .release        = pvr_release,
        .mmap           = PVRMMap,
+       .poll           = pvr_poll,
+       .read           = pvr_read,
 };
 
 static void pvr_shutdown(struct platform_device *pdev)
@@ -243,6 +248,8 @@ static int __init pvr_init(void)
        if (error < 0)
                goto err4;
 
+       pvr_init_events();
+
        return 0;
 
 err4:
index 7099647..eade118 100644 (file)
@@ -123,7 +123,7 @@ unlock_and_return:
 }
 #endif
 
-long PVRSRV_BridgeDispatchKM(struct file *file, unsigned int cmd,
+long PVRSRV_BridgeDispatchKM(struct file *filp, unsigned int cmd,
                             unsigned long arg)
 {
        u32 ui32BridgeID = PVRSRV_GET_BRIDGE_ID(cmd);
@@ -183,7 +183,7 @@ long PVRSRV_BridgeDispatchKM(struct file *file, unsigned int cmd,
        sBridgePackageKM.ui32BridgeID = PVRSRV_GET_BRIDGE_ID(
                                                sBridgePackageKM.ui32BridgeID);
 
-       err = BridgedDispatchKM(psPerProc, &sBridgePackageKM);
+       err = BridgedDispatchKM(filp, psPerProc, &sBridgePackageKM);
        if (err != PVRSRV_OK)
                goto unlock_and_return;
 
index 178f3bc..53d09a9 100644 (file)
@@ -33,6 +33,7 @@
 #include "perproc.h"
 #include "pdump_km.h"
 #include "ra.h"
+#include "pvr_events.h"
 
 #include "pvrversion.h"
 enum PVRSRV_ERROR AllocateDeviceID(struct SYS_DATA *psSysData, u32 *pui32DevID)
@@ -804,6 +805,8 @@ void PVRSRVMISR(void *pvSysData)
                        OSEventObjectSignal(hOSEventKM);
        }
 
+       pvr_handle_sync_events();
+
        pvr_unlock();
 }
 
index 86811be..512843d 100644 (file)
@@ -219,6 +219,7 @@ struct PVRSRV_BRIDGE_IN_SGXDEVINITPART2 {
 enum pvr_sync_wait_seq_type {
        _PVR_SYNC_WAIT_BLOCK,
        _PVR_SYNC_WAIT_NONBLOCK,
+       _PVR_SYNC_WAIT_EVENT,
 };
 
 struct PVRSRV_BRIDGE_IN_2DQUERYBLTSCOMPLETE {