From e92e76fef0b17a2bfd7d6a330e413c6981294700 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Ville=20Syrj=C3=A4l=C3=A4?= Date: Fri, 5 Nov 2010 20:45:55 +0200 Subject: [PATCH] gpu: pvr: Snapshot pending write ops during event request MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 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ä Signed-off-by: Imre Deak --- pvr/pvr_events.c | 13 ++++++++----- pvr/pvr_events.h | 1 + 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/pvr/pvr_events.c b/pvr/pvr_events.c index 77d55c7..5447cc5 100644 --- a/pvr/pvr_events.c +++ b/pvr/pvr_events.c @@ -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); diff --git a/pvr/pvr_events.h b/pvr/pvr_events.h index faa5b01..11cfc11 100644 --- a/pvr/pvr_events.h +++ b/pvr/pvr_events.h @@ -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 { -- 2.39.5