The open source OpenXR runtime
1// Copyright 2019, Collabora, Ltd.
2// SPDX-License-Identifier: BSL-1.0
3/*!
4 * @file
5 * @brief OpenGL on Xlib client side glue to compositor header.
6 * @author Jakob Bornecrantz <jakob@collabora.com>
7 * @ingroup comp_client
8 */
9
10#pragma once
11
12#include "xrt/xrt_gfx_xlib.h"
13#include "client/comp_gl_client.h"
14
15#ifdef __cplusplus
16extern "C" {
17#endif
18
19struct client_gl_context
20{
21 Display *dpy;
22 GLXContext ctx;
23 GLXDrawable read;
24 GLXDrawable draw;
25};
26
27/*!
28 * @class client_gl_xlib_compositor
29 * A client facing xlib OpenGL base compositor.
30 *
31 * @ingroup comp_client
32 * @extends client_gl_compositor
33 */
34struct client_gl_xlib_compositor
35{
36 //! OpenGL compositor wrapper base.
37 struct client_gl_compositor base;
38
39 /*!
40 * Temporary storage for "current" OpenGL context while app_context is
41 * made current using context_begin/context_end. We only need one because
42 * app_context can only be made current in one thread at a time too.
43 */
44 struct client_gl_context temp_context;
45
46 //! GL context provided in graphics binding.
47 struct client_gl_context app_context;
48};
49
50/*!
51 * Create a new client_gl_xlib_compositor.
52 *
53 * @public @memberof client_gl_xlib_compositor
54 * @see xrt_compositor_native
55 */
56struct client_gl_xlib_compositor *
57client_gl_xlib_compositor_create(struct xrt_compositor_native *xcn,
58 Display *xDisplay,
59 uint32_t visualid,
60 GLXFBConfig glxFBConfig,
61 GLXDrawable glxDrawable,
62 GLXContext glxContext);
63
64
65#ifdef __cplusplus
66}
67#endif