Remove CVS keywords.
[mesa.git] / src / mesa / drivers / dri / common / vblank.h
1 /* -*- mode: c; c-basic-offset: 3 -*- */
2 /*
3 * (c) Copyright IBM Corporation 2002
4 * All Rights Reserved.
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * copy of this software and associated documentation files (the "Software"),
8 * to deal in the Software without restriction, including without limitation
9 * on the rights to use, copy, modify, merge, publish, distribute, sub
10 * license, and/or sell copies of the Software, and to permit persons to whom
11 * the Software is furnished to do so, subject to the following conditions:
12 *
13 * The above copyright notice and this permission notice (including the next
14 * paragraph) shall be included in all copies or substantial portions of the
15 * Software.
16 *
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
20 * VA LINUX SYSTEM, IBM AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
21 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
22 * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
23 * USE OR OTHER DEALINGS IN THE SOFTWARE.
24 *
25 * Authors:
26 * Ian Romanick <idr@us.ibm.com>
27 */
28
29 #ifndef DRI_VBLANK_H
30 #define DRI_VBLANK_H
31
32 #include "main/context.h"
33 #include "dri_util.h"
34 #include "xmlconfig.h"
35
36 #define VBLANK_FLAG_INTERVAL (1U << 0) /* Respect the swap_interval setting
37 */
38 #define VBLANK_FLAG_THROTTLE (1U << 1) /* Wait 1 refresh since last call.
39 */
40 #define VBLANK_FLAG_SYNC (1U << 2) /* Sync to the next refresh.
41 */
42 #define VBLANK_FLAG_NO_IRQ (1U << 7) /* DRM has no IRQ to wait on.
43 */
44 #define VBLANK_FLAG_SECONDARY (1U << 8) /* Wait for secondary vblank.
45 */
46
47 extern int driGetMSC32( __DRIscreenPrivate * priv, int64_t * count );
48 extern int driDrawableGetMSC32( __DRIscreenPrivate * priv,
49 __DRIdrawablePrivate * drawablePrivate,
50 int64_t * count);
51 extern int driWaitForMSC32( __DRIdrawablePrivate *priv,
52 int64_t target_msc, int64_t divisor, int64_t remainder, int64_t * msc );
53 extern GLuint driGetDefaultVBlankFlags( const driOptionCache *optionCache );
54 extern void driDrawableInitVBlank ( __DRIdrawablePrivate *priv );
55 extern unsigned driGetVBlankInterval( const __DRIdrawablePrivate *priv );
56 extern void driGetCurrentVBlank( __DRIdrawablePrivate *priv );
57 extern int driWaitForVBlank( __DRIdrawablePrivate *priv,
58 GLboolean * missed_deadline );
59
60 #undef usleep
61 #include <unistd.h> /* for usleep() */
62 #include <sched.h> /* for sched_yield() */
63
64 #ifdef linux
65 #include <sched.h> /* for sched_yield() */
66 #endif
67
68 #define DO_USLEEP(nr) \
69 do { \
70 if (0) fprintf(stderr, "%s: usleep for %u\n", __FUNCTION__, nr ); \
71 if (1) usleep( nr ); \
72 sched_yield(); \
73 } while( 0 )
74
75 #endif /* DRI_VBLANK_H */