2
* Copyright © 2011 NVIDIA Corporation
4
* Permission to use, copy, modify, distribute, and sell this software
5
* and its documentation for any purpose is hereby granted without
6
* fee, provided that the above copyright notice appear in all copies
7
* and that both that copyright notice and this permission notice
8
* appear in supporting documentation, and that the name of
9
* NVIDIA Corporation not be used in advertising or publicity pertaining to
10
* distribution of the software without specific, written prior permission.
11
* NVIDIA Corporation makes no representations about the suitability of this
12
* software for any purpose. It is provided "as is" without express or
15
* NVIDIA CORPORATION DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
16
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
17
* NO EVENT SHALL NVIDIA CORPORATION BE LIABLE FOR ANY SPECIAL, INDIRECT OR
18
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
19
* OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
20
* NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
21
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
23
* Authors: James Jones <jajones@nvidia.com>
26
#ifndef _GLXTOGLSYNC_H
27
#define _GLXTOGLSYNC_H
29
#include <composite/composite.h>
30
#include <opengl/opengl.h>
31
#include <X11/extensions/sync.h>
33
#include "opengl/opengl.h"
36
* Class that manages an XFenceSync wrapped in a GLsync object.
38
* Can be used to synchronize operations in the GL command stream
39
* with operations in the X command stream.
46
XSyncAlarm alarm (void) const { return a; }
47
bool isReady (void) const { return state == XTOGLS_READY; }
50
* Sends the trigger request to the server. The fence will be signaled
51
* after all rendering has completed.
56
* Calls glWaitSync. Any OpenGL commands after this will wait for the
57
* fence to be signaled.
59
void insertWait (void);
62
* Blocks until the fence is signaled, or until a timeout expires.
64
* \param The maximum time to wait, in nanoseconds.
65
* \return One of \c GL_ALREADY_SIGNALED, \c GL_CONDITION_SATISFIED,
66
* \c GL_TIMEOUT_EXPIRED, or \c GL_WAIT_FAILED.
68
GLenum checkUpdateFinished (GLuint64 timeout);
74
void handleEvent (XSyncAlarmNotifyEvent *ev);
82
XSyncValue nextCounterValue;
92
static bool syncValuesInitialized;
93
static XSyncValue zero;
94
static XSyncValue one;
96
static Bool alarmEventPredicate (Display *dpy, XEvent *ev, XPointer arg);