gpu: pvr: Expose new display events to user space
authorPauli Nieminen <ext-pauli.nieminen@nokia.com>
Tue, 2 Nov 2010 08:40:10 +0000 (10:40 +0200)
committerGrazvydas Ignotas <notasas@gmail.com>
Sun, 20 May 2012 18:09:42 +0000 (21:09 +0300)
This exposes the new dss event that can be used for more fine grained
synchronization with display updates.

This change is backward compatible with old user space.

Signed-off-by: Pauli Nieminen <ext-pauli.nieminen@nokia.com>
Signed-off-by: Ville Syrjälä <ville.syrjala@nokia.com>
Signed-off-by: Imre Deak <imre.deak@nokia.com>
pvr/bridged_sgx_bridge.c
pvr/pvr_events.c
pvr/pvr_events.h
pvr/sgx_bridge.h

index 30b7a73..b2dae37 100644 (file)
@@ -1053,10 +1053,12 @@ int SGX2DQueryBlitsCompleteBW(struct file *filp, u32 ui32BridgeID,
        if (psRetOUT->eError != PVRSRV_OK)
                return 0;
 
-       if (ps2DQueryBltsCompleteIN->type == _PVR_SYNC_WAIT_FLIP) {
+       if (ps2DQueryBltsCompleteIN->type == _PVR_SYNC_WAIT_FLIP ||
+           ps2DQueryBltsCompleteIN->type == _PVR_SYNC_WAIT_UPDATE) {
                if (pvr_flip_event_req(priv,
                                       (long)ps2DQueryBltsCompleteIN->
                                                       hKernSyncInfo,
+                                      ps2DQueryBltsCompleteIN->type,
                                       ps2DQueryBltsCompleteIN->user_data))
                        psRetOUT->eError = PVRSRV_ERROR_OUT_OF_MEMORY;
 
index bb851cb..77d55c7 100644 (file)
@@ -1,6 +1,7 @@
 
 #include "pvr_events.h"
 #include "servicesint.h"
+#include "sgx_bridge.h"
 
 #include <linux/wait.h>
 #include <linux/sched.h>
@@ -86,7 +87,8 @@ static void pvr_signal_flip_event(struct pvr_pending_flip_event *e,
 }
 
 int pvr_flip_event_req(struct PVRSRV_FILE_PRIVATE_DATA *priv,
-                        unsigned int overlay, u64 user_data)
+                        unsigned int overlay,
+                        enum pvr_sync_wait_seq_type type, u64 user_data)
 {
        struct pvr_pending_flip_event *e;
        struct timeval now;
@@ -96,7 +98,18 @@ int pvr_flip_event_req(struct PVRSRV_FILE_PRIVATE_DATA *priv,
        if (e == NULL)
                return -ENOMEM;
 
-       e->event.base.type = PVR_EVENT_FLIP;
+       switch (type) {
+       case _PVR_SYNC_WAIT_FLIP:
+               e->event.base.type = PVR_EVENT_FLIP;
+               e->dss_event = OMAP_DSS_NOTIFY_GO_OVL;
+               break;
+       case _PVR_SYNC_WAIT_UPDATE:
+               e->event.base.type = PVR_EVENT_UPDATE;
+               e->dss_event = OMAP_DSS_NOTIFY_UPDATE_OVL;
+               break;
+       default:
+               BUG();
+       }
        e->event.base.length = sizeof(e->event);
        e->base.event = &e->event.base;
        e->event.overlay = overlay;
@@ -119,7 +132,7 @@ int pvr_flip_event_req(struct PVRSRV_FILE_PRIVATE_DATA *priv,
 
        spin_unlock_irqrestore(&event_lock, flags);
 
-       return omap_dss_request_notify(OMAP_DSS_NOTIFY_GO_OVL, overlay);
+       return omap_dss_request_notify(e->dss_event, overlay);
 }
 
 static bool pvr_dequeue_event(struct PVRSRV_FILE_PRIVATE_DATA *priv,
@@ -220,14 +233,13 @@ static int dss_notifier_callback(struct notifier_block *nb,
        unsigned long flags;
        long overlay = (long) data;
 
-       if (event != OMAP_DSS_NOTIFY_GO_OVL)
-               return 0;
-
        do_gettimeofday(&now);
 
        spin_lock_irqsave(&event_lock, flags);
 
        list_for_each_entry_safe(e, t, &flip_wait_list, base.link) {
+               if (!(e->dss_event & event))
+                       continue;
                if (e->event.overlay != overlay)
                        continue;
 
index 5183ed3..faa5b01 100644 (file)
@@ -24,6 +24,7 @@ struct pvr_event {
 
 #define PVR_EVENT_SYNC 0x01
 #define PVR_EVENT_FLIP 0x02
+#define PVR_EVENT_UPDATE 0x03 /* also uses struct pvr_event_flip */
 
 /*
  * Every buffer used as a render target has a 'PVRSRV_KERNEL_SYNC_INFO'
@@ -73,8 +74,11 @@ struct pvr_pending_sync_event {
 struct pvr_pending_flip_event {
        struct pvr_pending_event base;
        struct pvr_event_flip event;
+       unsigned int dss_event;
 };
 
+enum pvr_sync_wait_seq_type;
+
 void pvr_init_events(void);
 void pvr_exit_events(void);
 
@@ -82,7 +86,8 @@ int pvr_sync_event_req(struct PVRSRV_FILE_PRIVATE_DATA *priv,
                        const struct PVRSRV_KERNEL_SYNC_INFO *sync_info,
                        u64 user_data);
 int pvr_flip_event_req(struct PVRSRV_FILE_PRIVATE_DATA *priv,
-                        unsigned int overlay, u64 user_data);
+                        unsigned int overlay,
+                        enum pvr_sync_wait_seq_type type, u64 user_data);
 ssize_t pvr_read(struct file *filp, char __user *buf, size_t count,
                loff_t *off);
 unsigned int pvr_poll(struct file *filp, struct poll_table_struct *wait);
index 8dfdd56..9b83616 100644 (file)
@@ -221,6 +221,7 @@ enum pvr_sync_wait_seq_type {
        _PVR_SYNC_WAIT_NONBLOCK,
        _PVR_SYNC_WAIT_EVENT,
        _PVR_SYNC_WAIT_FLIP,
+       _PVR_SYNC_WAIT_UPDATE,
 };
 
 struct PVRSRV_BRIDGE_IN_2DQUERYBLTSCOMPLETE {