2 * Copyright © 2013 Keith Packard
4 * Permission to use, copy, modify, distribute, and sell this software and its
5 * documentation for any purpose is hereby granted without fee, provided that
6 * the above copyright notice appear in all copies and that both that copyright
7 * notice and this permission notice appear in supporting documentation, and
8 * that the name of the copyright holders not be used in advertising or
9 * publicity pertaining to distribution of the software without specific,
10 * written prior permission. The copyright holders make no representations
11 * about the suitability of this software for any purpose. It is provided "as
12 * is" without express or implied warranty.
14 * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
15 * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
16 * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
17 * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
18 * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
19 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
26 #include <X11/extensions/presentproto.h>
28 #include "presentext.h"
30 typedef struct present_vblank present_vblank_rec
, *present_vblank_ptr
;
32 /* Return the current CRTC for 'window'.
34 typedef RRCrtcPtr (*present_get_crtc_ptr
) (WindowPtr window
);
36 /* Return the current ust/msc for 'crtc'
38 typedef int (*present_get_ust_msc_ptr
) (RRCrtcPtr crtc
, uint64_t *ust
, uint64_t *msc
);
40 /* Queue callback on 'crtc' for time 'msc'. Call present_event_notify with 'event_id'
41 * at or after 'msc'. Return false if it didn't happen (which might occur if 'crtc'
42 * is not currently generating vblanks).
44 typedef Bool (*present_queue_vblank_ptr
) (RRCrtcPtr crtc
,
48 /* Abort pending vblank. The extension is no longer interested in
49 * 'event_id' which was to be notified at 'msc'. If possible, the
50 * driver is free to de-queue the notification.
52 typedef void (*present_abort_vblank_ptr
) (RRCrtcPtr crtc
, uint64_t event_id
, uint64_t msc
);
54 /* Flush pending drawing on 'window' to the hardware.
56 typedef void (*present_flush_ptr
) (WindowPtr window
);
58 /* Check if 'pixmap' is suitable for flipping to 'window'.
60 typedef Bool (*present_check_flip_ptr
) (RRCrtcPtr crtc
, WindowPtr window
, PixmapPtr pixmap
, Bool sync_flip
);
62 /* Flip pixmap, return false if it didn't happen.
64 * 'crtc' is to be used for any necessary synchronization.
66 * 'sync_flip' requests that the flip be performed at the next
67 * vertical blank interval to avoid tearing artifacts. If false, the
68 * flip should be performed as soon as possible.
70 * present_event_notify should be called with 'event_id' when the flip
73 typedef Bool (*present_flip_ptr
) (RRCrtcPtr crtc
,
79 /* "unflip" back to the regular screen scanout buffer
81 * present_event_notify should be called with 'event_id' when the unflip occurs.
83 typedef void (*present_unflip_ptr
) (ScreenPtr screen
,
86 #define PRESENT_SCREEN_INFO_VERSION 0
88 typedef struct present_screen_info
{
91 present_get_crtc_ptr get_crtc
;
92 present_get_ust_msc_ptr get_ust_msc
;
93 present_queue_vblank_ptr queue_vblank
;
94 present_abort_vblank_ptr abort_vblank
;
95 present_flush_ptr flush
;
96 uint32_t capabilities
;
97 present_check_flip_ptr check_flip
;
98 present_flip_ptr flip
;
99 present_unflip_ptr unflip
;
101 } present_screen_info_rec
, *present_screen_info_ptr
;
104 * Called when 'event_id' occurs. 'ust' and 'msc' indicate when the
105 * event actually happened
107 extern _X_EXPORT
void
108 present_event_notify(uint64_t event_id
, uint64_t ust
, uint64_t msc
);
110 /* 'crtc' has been turned off, so any pending events will never occur.
112 extern _X_EXPORT
void
113 present_event_abandon(RRCrtcPtr crtc
);
115 extern _X_EXPORT Bool
116 present_screen_init(ScreenPtr screen
, present_screen_info_ptr info
);
118 typedef void (*present_complete_notify_proc
)(WindowPtr window
,
124 extern _X_EXPORT
void
125 present_register_complete_notify(present_complete_notify_proc proc
);
127 #endif /* _PRESENT_H_ */