From 1acf4f070d84a6a1fe59668479c5723680a661ed Mon Sep 17 00:00:00 2001 From: Pauli Nieminen Date: Tue, 2 Nov 2010 10:40:10 +0200 Subject: [PATCH] gpu: pvr: Expose new display events to user space MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 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 Signed-off-by: Ville Syrjälä Signed-off-by: Imre Deak --- pvr/bridged_sgx_bridge.c | 4 +++- pvr/pvr_events.c | 24 ++++++++++++++++++------ pvr/pvr_events.h | 7 ++++++- pvr/sgx_bridge.h | 1 + 4 files changed, 28 insertions(+), 8 deletions(-) diff --git a/pvr/bridged_sgx_bridge.c b/pvr/bridged_sgx_bridge.c index 30b7a73..b2dae37 100644 --- a/pvr/bridged_sgx_bridge.c +++ b/pvr/bridged_sgx_bridge.c @@ -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; diff --git a/pvr/pvr_events.c b/pvr/pvr_events.c index bb851cb..77d55c7 100644 --- a/pvr/pvr_events.c +++ b/pvr/pvr_events.c @@ -1,6 +1,7 @@ #include "pvr_events.h" #include "servicesint.h" +#include "sgx_bridge.h" #include #include @@ -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; diff --git a/pvr/pvr_events.h b/pvr/pvr_events.h index 5183ed3..faa5b01 100644 --- a/pvr/pvr_events.h +++ b/pvr/pvr_events.h @@ -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); diff --git a/pvr/sgx_bridge.h b/pvr/sgx_bridge.h index 8dfdd56..9b83616 100644 --- a/pvr/sgx_bridge.h +++ b/pvr/sgx_bridge.h @@ -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 { -- 2.39.5