xref: /aosp_15_r20/external/mesa3d/src/glx/dri_common.h (revision 6104692788411f58d303aa86923a9ff6ecaded22)
1 /*
2  * Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
3  * Copyright © 2008 Red Hat, Inc.
4  *
5  * Permission is hereby granted, free of charge, to any person obtaining a
6  * copy of this software and associated documentation files (the "Soft-
7  * ware"), to deal in the Software without restriction, including without
8  * limitation the rights to use, copy, modify, merge, publish, distribute,
9  * and/or sell copies of the Software, and to permit persons to whom the
10  * Software is furnished to do so, provided that the above copyright
11  * notice(s) and this permission notice appear in all copies of the Soft-
12  * ware and that both the above copyright notice(s) and this permission
13  * notice appear in supporting documentation.
14  *
15  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
16  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL-
17  * ITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY
18  * RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS INCLUDED IN
19  * THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR CONSE-
20  * QUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
21  * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
22  * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFOR-
23  * MANCE OF THIS SOFTWARE.
24  *
25  * Except as contained in this notice, the name of a copyright holder shall
26  * not be used in advertising or otherwise to promote the sale, use or
27  * other dealings in this Software without prior written authorization of
28  * the copyright holder.
29  *
30  * Authors:
31  *   Kevin E. Martin <[email protected]>
32  *   Brian Paul <[email protected]>
33  *   Kristian Høgsberg ([email protected])
34  */
35 
36 #ifndef _DRI_COMMON_H
37 #define _DRI_COMMON_H
38 
39 #ifdef GLX_DIRECT_RENDERING
40 
41 #include "mesa_interface.h"
42 #include <stdbool.h>
43 #include "loader.h"
44 #include "util/macros.h" /* for PRINTFLIKE */
45 
46 typedef struct __GLXDRIconfigPrivateRec __GLXDRIconfigPrivate;
47 
48 struct __GLXDRIconfigPrivateRec
49 {
50    struct glx_config base;
51    const __DRIconfig *driConfig;
52 };
53 
54 extern struct glx_config *driConvertConfigs(struct glx_config * modes,
55                                            const __DRIconfig ** configs);
56 
57 extern void driDestroyConfigs(const __DRIconfig **configs);
58 
59 extern __GLXDRIdrawable *
60 driFetchDrawable(struct glx_context *gc, GLXDrawable glxDrawable);
61 
62 extern void
63 driReleaseDrawables(struct glx_context *gc);
64 
65 struct dri_ctx_attribs {
66    unsigned major_ver;
67    unsigned minor_ver;
68    uint32_t render_type;
69    uint32_t flags;
70    unsigned api;
71    int reset;
72    int release;
73    int no_error;
74 };
75 
76 extern const struct glx_screen_vtable dri_screen_vtable;
77 
78 extern unsigned
79 dri_context_error_to_glx_error(unsigned error);
80 
81 extern int
82 dri_convert_glx_attribs(unsigned num_attribs, const uint32_t *attribs,
83                         struct dri_ctx_attribs *dca);
84 
85 extern struct glx_context *
86 dri_common_create_context(struct glx_screen *base,
87                           struct glx_config *config_base,
88                           struct glx_context *shareList,
89                           int renderType);
90 
91 extern const __DRIbackgroundCallableExtension driBackgroundCallable;
92 extern const __DRIuseInvalidateExtension dri2UseInvalidate;
93 
94 Bool
95 dri_bind_context(struct glx_context *context, GLXDrawable draw, GLXDrawable read);
96 void
97 dri_unbind_context(struct glx_context *context);
98 void
99 dri_destroy_context(struct glx_context *context);
100 struct glx_context *
101 dri_create_context_attribs(struct glx_screen *base,
102                            struct glx_config *config_base,
103                            struct glx_context *shareList,
104                            unsigned num_attribs,
105                            const uint32_t *attribs,
106                            unsigned *error);
107 _X_HIDDEN int
108 glx_dri_query_renderer_integer(struct glx_screen *base, int attribute,
109                             unsigned int *value);
110 _X_HIDDEN int
111 glx_dri_query_renderer_string(struct glx_screen *base, int attribute,
112                            const char **value);
113 char *
114 dri_get_driver_name(struct glx_screen *glx_screen);
115 void
116 dri_bind_tex_image(__GLXDRIdrawable *base, int buffer, const int *attrib_list);
117 bool
118 dri_screen_init(struct glx_screen *psc, struct glx_display *priv, int screen, int fd, const __DRIextension **loader_extensions, bool driver_name_is_inferred);
119 #endif /* GLX_DIRECT_RENDERING */
120 
121 #endif /* _DRI_COMMON_H */
122