1 /*
2  * Copyright © 2022 Google LLC
3  *
4  * Permission is hereby granted, free of charge, to any person obtaining a
5  * copy of this software and associated documentation files (the "Software"),
6  * to deal in the Software without restriction, including without limitation
7  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8  * and/or sell copies of the Software, and to permit persons to whom the
9  * Software is furnished to do so, subject to the following conditions:
10  *
11  * The above copyright notice and this permission notice (including the next
12  * paragraph) shall be included in all copies or substantial portions of the
13  * Software.
14  *
15  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
18  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
21  * IN THE SOFTWARE.
22  */
23 
24 #ifndef MESA_INTERFACE_H
25 #define MESA_INTERFACE_H
26 
27 #include "dri_interface.h"
28 
29 /* Mesa-internal interface between the GLX, GBM, and EGL DRI driver loaders, and
30  * the gallium dri_util.c code.
31  */
32 
33 typedef struct __DRImesaCoreExtensionRec __DRImesaCoreExtension;
34 
35 #define __DRI_MESA "DRI_Mesa"
36 #define __DRI_MESA_VERSION 1
37 
38 struct dri_screen;
39 
40 /**  Core struct that appears alongside __DRI_CORE for Mesa-internal usage.
41  * Implemented in the top-level dri/drisw/kopper extension list.
42  */
43 struct __DRImesaCoreExtensionRec {
44    __DRIextension base;
45 
46    /* Version string for verifying that the DRI driver is from the same build as
47     * the loader.
48     */
49 #define MESA_INTERFACE_VERSION_STRING PACKAGE_VERSION MESA_GIT_SHA1
50    const char *version_string;
51 
52    /* Screen creation function regardless of DRI2, image, or swrast backend.
53     * (Nothing uses the old __DRI_CORE screen create).
54     *
55     * If not associated with a DRM fd (non-swkms swrast), the fd argument should
56     * be -1.
57     */
58    __DRIcreateNewScreen2Func createNewScreen;
59 
60    __DRIcreateContextAttribsFunc createContext;
61 
62    /* driver function for finishing initialization inside createNewScreen(). */
63    const __DRIconfig **(*initScreen)(struct dri_screen *screen);
64 };
65 
66 #endif /* MESA_INTERFACE_H */
67