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
23 #ifndef _PRESENT_PRIV_H_
24 #define _PRESENT_PRIV_H_
27 #include "scrnintstr.h"
30 #include "windowstr.h"
31 #include "dixstruct.h"
38 extern int present_request
;
40 extern DevPrivateKeyRec present_screen_private_key
;
42 typedef struct present_fence
*present_fence_ptr
;
44 typedef struct present_notify present_notify_rec
, *present_notify_ptr
;
46 struct present_notify
{
47 struct xorg_list window_list
;
52 struct present_vblank
{
53 struct xorg_list window_list
;
54 struct xorg_list event_queue
;
68 present_fence_ptr idle_fence
;
69 present_fence_ptr wait_fence
;
70 present_notify_ptr notifies
;
72 Bool queued
; /* on present_exec_queue */
73 Bool flip
; /* planning on using flip */
74 Bool sync_flip
; /* do flip synchronous to vblank */
75 Bool abort_flip
; /* aborting this flip */
78 typedef struct present_screen_priv
{
79 CloseScreenProcPtr CloseScreen
;
80 ConfigNotifyProcPtr ConfigNotify
;
81 DestroyWindowProcPtr DestroyWindow
;
82 ClipNotifyProcPtr ClipNotify
;
84 present_vblank_ptr flip_pending
;
85 uint64_t unflip_event_id
;
87 uint32_t fake_interval
;
89 /* Currently active flipped pixmap and fence */
91 WindowPtr flip_window
;
93 PixmapPtr flip_pixmap
;
94 present_fence_ptr flip_idle_fence
;
96 present_screen_info_ptr info
;
97 } present_screen_priv_rec
, *present_screen_priv_ptr
;
99 #define wrap(priv,real,mem,func) {\
100 priv->mem = real->mem; \
104 #define unwrap(priv,real,mem) {\
105 real->mem = priv->mem; \
108 static inline present_screen_priv_ptr
109 present_screen_priv(ScreenPtr screen
)
111 return (present_screen_priv_ptr
)dixLookupPrivate(&(screen
)->devPrivates
, &present_screen_private_key
);
115 * Each window has a list of clients and event masks
117 typedef struct present_event
*present_event_ptr
;
119 typedef struct present_event
{
120 present_event_ptr next
;
127 typedef struct present_window_priv
{
128 present_event_ptr events
;
129 RRCrtcPtr crtc
; /* Last reported CRTC from get_ust_msc */
131 uint64_t msc
; /* Last reported MSC from the current crtc */
132 struct xorg_list vblank
;
133 struct xorg_list notifies
;
134 } present_window_priv_rec
, *present_window_priv_ptr
;
136 extern DevPrivateKeyRec present_window_private_key
;
138 static inline present_window_priv_ptr
139 present_window_priv(WindowPtr window
)
141 return (present_window_priv_ptr
)dixGetPrivate(&(window
)->devPrivates
, &present_window_private_key
);
144 present_window_priv_ptr
145 present_get_window_priv(WindowPtr window
, Bool create
);
147 extern RESTYPE present_event_type
;
153 present_pixmap(WindowPtr window
,
160 RRCrtcPtr target_crtc
,
161 SyncFence
*wait_fence
,
162 SyncFence
*idle_fence
,
167 present_notify_ptr notifies
,
171 present_notify_msc(WindowPtr window
,
178 present_abort_vblank(ScreenPtr screen
, RRCrtcPtr crtc
, uint64_t event_id
, uint64_t msc
);
181 present_vblank_destroy(present_vblank_ptr vblank
);
184 present_flip_destroy(ScreenPtr screen
);
187 present_check_flip_window(WindowPtr window
);
190 present_get_crtc(WindowPtr window
);
193 present_query_capabilities(RRCrtcPtr crtc
);
203 present_free_events(WindowPtr window
);
206 present_send_config_notify(WindowPtr window
, int x
, int y
, int w
, int h
, int bw
, WindowPtr sibling
);
209 present_send_complete_notify(WindowPtr window
, CARD8 kind
, CARD8 mode
, CARD32 serial
, uint64_t ust
, uint64_t msc
);
212 present_send_idle_notify(WindowPtr window
, CARD32 serial
, PixmapPtr pixmap
, present_fence_ptr idle_fence
);
215 present_select_input(ClientPtr client
,
221 present_event_init(void);
227 present_fake_get_ust_msc(ScreenPtr screen
, uint64_t *ust
, uint64_t *msc
);
230 present_fake_queue_vblank(ScreenPtr screen
, uint64_t event_id
, uint64_t msc
);
233 present_fake_abort_vblank(ScreenPtr screen
, uint64_t event_id
, uint64_t msc
);
236 present_fake_screen_init(ScreenPtr screen
);
239 present_fake_queue_init(void);
244 struct present_fence
*
245 present_fence_create(SyncFence
*sync_fence
);
248 present_fence_destroy(struct present_fence
*present_fence
);
251 present_fence_set_triggered(struct present_fence
*present_fence
);
254 present_fence_check_triggered(struct present_fence
*present_fence
);
257 present_fence_set_callback(struct present_fence
*present_fence
,
258 void (*callback
)(void *param
),
262 present_fence_id(struct present_fence
*present_fence
);
268 present_clear_window_notifies(WindowPtr window
);
271 present_free_window_notify(present_notify_ptr notify
);
274 present_add_window_notify(present_notify_ptr notify
);
277 present_create_notifies(ClientPtr client
, int num_notifies
, xPresentNotify
*x_notifies
, present_notify_ptr
*p_notifies
);
280 present_destroy_notifies(present_notify_ptr notifies
, int num_notifies
);
287 present_redirect(ClientPtr client
, WindowPtr target
);
293 proc_present_dispatch(ClientPtr client
);
296 sproc_present_dispatch(ClientPtr client
);
302 #endif /* _PRESENT_PRIV_H_ */