gpu: pvr: Snapshot pending write ops during event request
authorVille Syrjälä <ville.syrjala@nokia.com>
Fri, 5 Nov 2010 18:45:55 +0000 (20:45 +0200)
committerGrazvydas Ignotas <notasas@gmail.com>
Sun, 20 May 2012 18:09:42 +0000 (21:09 +0300)
The render sync event should only wait until write operations
that are pending when the event is requested have completed.
New operations started after requesting the event should not
delay the event delivery, nor should any read operations.

Signed-off-by: Ville Syrjälä <ville.syrjala@nokia.com>
Signed-off-by: Imre Deak <imre.deak@nokia.com>
pvr/pvr_events.c
pvr/pvr_events.h

index 77d55c7..5447cc5 100644 (file)
@@ -18,10 +18,10 @@ static struct list_head sync_wait_list;
 static struct list_head flip_wait_list;
 static struct notifier_block dss_nb;
 
-static inline bool is_render_complete(const struct PVRSRV_SYNC_DATA *sync)
+static inline bool is_render_complete(const struct PVRSRV_SYNC_DATA *sync,
+                                     u32 write_ops_pending)
 {
-       return sync->ui32ReadOpsComplete == sync->ui32ReadOpsPending &&
-               sync->ui32WriteOpsComplete == sync->ui32WriteOpsPending;
+       return (int)sync->ui32WriteOpsComplete - (int)write_ops_pending >= 0;
 }
 
 static void pvr_signal_sync_event(struct pvr_pending_sync_event *e,
@@ -54,6 +54,7 @@ int pvr_sync_event_req(struct PVRSRV_FILE_PRIVATE_DATA *priv,
        e->base.event = &e->event.base;
        e->base.file_priv = priv;
        e->base.destroy = (void (*)(struct pvr_pending_event *))kfree;
+       e->base.write_ops_pending = sync_info->psSyncData->ui32WriteOpsPending;
 
        do_gettimeofday(&now);
        spin_lock_irqsave(&event_lock, flags);
@@ -67,7 +68,8 @@ int pvr_sync_event_req(struct PVRSRV_FILE_PRIVATE_DATA *priv,
        priv->event_space -= sizeof(e->event);
 
        list_add_tail(&e->base.link, &sync_wait_list);
-       if (is_render_complete(sync_info->psSyncData))
+       if (is_render_complete(sync_info->psSyncData,
+                              e->base.write_ops_pending))
                pvr_signal_sync_event(e, &now);
 
        spin_unlock_irqrestore(&event_lock, flags);
@@ -215,7 +217,8 @@ void pvr_handle_sync_events(void)
        spin_lock_irqsave(&event_lock, flags);
 
        list_for_each_entry_safe(e, t, &sync_wait_list, base.link) {
-               if (!is_render_complete(e->event.sync_info->psSyncData))
+               if (!is_render_complete(e->event.sync_info->psSyncData,
+                                       e->base.write_ops_pending))
                        continue;
 
                pvr_signal_sync_event(e, &now);
index faa5b01..11cfc11 100644 (file)
@@ -64,6 +64,7 @@ struct pvr_pending_event {
        struct list_head link;
        struct PVRSRV_FILE_PRIVATE_DATA *file_priv;
        void (*destroy)(struct pvr_pending_event *event);
+       u32 write_ops_pending;
 };
 
 struct pvr_pending_sync_event {