2 * Mesa 3-D graphics library
4 * Copyright (C) 2010-2011 LunarG Inc.
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 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10 * and/or sell copies of the Software, and to permit persons to whom the
11 * Software is furnished to do so, subject to the following conditions:
13 * The above copyright notice and this permission notice shall be included
14 * in all copies or substantial portions of the Software.
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22 * DEALINGS IN THE SOFTWARE.
25 * Chia-I Wu <olv@lunarg.com>
28 #include "common/egl_g3d_loader.h"
29 #include "egldriver.h"
35 #include "target-helpers/inline_drm_helper.h"
37 static struct egl_g3d_loader egl_g3d_loader
;
39 static struct st_module
{
42 } st_modules
[ST_API_COUNT
];
44 static struct st_api
*
45 get_st_api(enum st_api_type api
)
47 struct st_module
*stmod
= &st_modules
[api
];
49 if (!stmod
->initialized
) {
50 stmod
->stapi
= egl_st_create_api(api
);
51 stmod
->initialized
= TRUE
;
58 static struct pipe_screen
*
59 create_drm_screen(const char *constname
, int fd
)
61 return dd_create_screen(fd
);
64 static struct pipe_screen
*
65 create_sw_screen(struct sw_winsys
*ws
)
67 return egl_pipe_create_swrast_screen(ws
);
70 static const struct egl_g3d_loader
*
73 egl_g3d_loader
.get_st_api
= get_st_api
;
74 egl_g3d_loader
.create_drm_screen
= create_drm_screen
;
75 egl_g3d_loader
.create_sw_screen
= create_sw_screen
;
77 loader_set_logger(_eglLog
);
79 return &egl_g3d_loader
;
87 for (i
= 0; i
< ST_API_COUNT
; i
++) {
88 struct st_module
*stmod
= &st_modules
[i
];
91 egl_st_destroy_api(stmod
->stapi
);
94 stmod
->initialized
= FALSE
;
99 egl_g3d_unload(_EGLDriver
*drv
)
101 egl_g3d_destroy_driver(drv
);
106 _EGL_MAIN(const char *args
)
108 const struct egl_g3d_loader
*loader
;
111 loader
= loader_init();
112 drv
= egl_g3d_create_driver(loader
);
118 drv
->Name
= "Gallium";
119 drv
->Unload
= egl_g3d_unload
;