gpu: pvr: add tracing for PVR events
authorImre Deak <imre.deak@nokia.com>
Fri, 1 Apr 2011 15:17:42 +0000 (18:17 +0300)
committerGrazvydas Ignotas <notasas@gmail.com>
Sun, 20 May 2012 18:43:05 +0000 (21:43 +0300)
Signed-off-by: Imre Deak <imre.deak@nokia.com>
Reviewed-by: Luc Verhaegen <libv@codethink.co.uk>
pvr/pvr_events.c

index 0e3715b..e5a7b1c 100644 (file)
@@ -2,6 +2,9 @@
 #include "pvr_events.h"
 #include "servicesint.h"
 #include "sgx_bridge.h"
+#include "perproc.h"
+#include "pvr_bridge_km.h"
+#include "pvr_trace_cmd.h"
 
 #include <linux/wait.h>
 #include <linux/sched.h>
@@ -166,6 +169,40 @@ err:
        return ret;
 }
 
+static void trace_pvr_event(struct pvr_pending_event *e)
+{
+       struct PVRSRV_PER_PROCESS_DATA *proc;
+
+       proc = e->file_priv->proc;
+       pvr_trcmd_lock();
+
+       switch (e->event->type) {
+       case PVR_EVENT_SYNC:
+       {
+               struct pvr_event_sync *evsync;
+               struct pvr_trcmd_syn *ts;
+
+               evsync = (struct pvr_event_sync *)e->event;
+               ts = pvr_trcmd_alloc(PVR_TRCMD_SGX_QBLT_SYNCOMP,
+                                    proc->ui32PID, proc->name, sizeof(*ts));
+               pvr_trcmd_set_syn(ts, evsync->sync_info);
+               break;
+       }
+       case PVR_EVENT_FLIP:
+               pvr_trcmd_alloc(PVR_TRCMD_SGX_QBLT_FLPCOMP,
+                               proc->ui32PID, proc->name, 0);
+               break;
+       case PVR_EVENT_UPDATE:
+               pvr_trcmd_alloc(PVR_TRCMD_SGX_QBLT_UPDCOMP,
+                               proc->ui32PID, proc->name, 0);
+               break;
+       default:
+               __WARN();
+       }
+
+       pvr_trcmd_unlock();
+}
+
 ssize_t pvr_read(struct file *filp, char __user *buf, size_t count, loff_t *off)
 {
        struct PVRSRV_FILE_PRIVATE_DATA *priv = filp->private_data;
@@ -186,6 +223,8 @@ ssize_t pvr_read(struct file *filp, char __user *buf, size_t count, loff_t *off)
                        break;
                }
 
+               trace_pvr_event(e);
+
                total += e->event->length;
                e->destroy(e);
        }