5 #include "servicesext.h"
6 #include "private_data.h"
7 #include <linux/list.h>
8 #include <linux/file.h>
9 #include <linux/poll.h>
12 * Header for events written back to userspace on the drm fd. The
13 * type defines the type of event, the length specifies the total
14 * length of the event (including the header), and user_data is
15 * typically a 64 bit value passed with the ioctl that triggered the
16 * event. A read on the drm fd will always only return complete
17 * events, that is, if for example the read buffer is 100 bytes, and
18 * there are two 64 byte events pending, only one will be returned.
25 #define PVR_EVENT_SYNC 0x01
26 #define PVR_EVENT_FLIP 0x02
27 #define PVR_EVENT_UPDATE 0x03 /* also uses struct pvr_event_flip */
30 * Every buffer used as a render target has a 'PVRSRV_KERNEL_SYNC_INFO'
31 * associated with it. This structure simply contains four counters, number of
32 * pending and completed read and write operations. Counters for pending
33 * operations are modified (incremented) by the kernel driver while the
34 * counters for completed operations are directly updated by the SGX micro
35 * kernel. Once both the read counters and the write counters mutually match,
36 * one has completed a full frame.
38 * Micro kernel issues interrupts whenever TA or 3D phases are completed. These
39 * interrupts, however, as such do not tell if any particular frame is
40 * completed. It is the responsibility of the kerner driver to determine this.
41 * Hence the core interrupt handler calls 'pvr_handle_sync_events' to check if
42 * one of the monitored render operations are finished. This is accomplished by
43 * examining the before-mentioned counters designated by the pending events.
45 struct pvr_event_sync {
46 struct pvr_event base;
47 const struct PVRSRV_KERNEL_SYNC_INFO *sync_info;
53 struct pvr_event_flip {
54 struct pvr_event base;
61 /* Event queued up for userspace to read */
62 struct pvr_pending_event {
63 struct pvr_event *event;
64 struct list_head link;
65 struct PVRSRV_FILE_PRIVATE_DATA *file_priv;
66 void (*destroy)(struct pvr_pending_event *event);
67 u32 write_ops_pending;
70 struct pvr_pending_sync_event {
71 struct pvr_pending_event base;
72 struct pvr_event_sync event;
75 struct pvr_pending_flip_event {
76 struct pvr_pending_event base;
77 struct pvr_event_flip event;
78 unsigned int dss_event;
81 enum pvr_sync_wait_seq_type;
83 void pvr_init_events(void);
84 void pvr_exit_events(void);
86 int pvr_sync_event_req(struct PVRSRV_FILE_PRIVATE_DATA *priv,
87 const struct PVRSRV_KERNEL_SYNC_INFO *sync_info,
89 int pvr_flip_event_req(struct PVRSRV_FILE_PRIVATE_DATA *priv,
91 enum pvr_sync_wait_seq_type type, u64 user_data);
92 ssize_t pvr_read(struct file *filp, char __user *buf, size_t count,
94 unsigned int pvr_poll(struct file *filp, struct poll_table_struct *wait);
95 void pvr_release_events(struct PVRSRV_FILE_PRIVATE_DATA *priv);
97 void pvr_handle_sync_events(void);
99 #endif /* PVR_EVENTS_H */