static struct st_api * egl_st_load_gl(void) { const char module[] = "st_GL"; const char symbol[] = "st_api_create_OpenGL"; struct st_api *stapi; stapi = load_gl(module, symbol); /* try again with libglapi.so loaded */ if (!stapi) { struct util_dl_library *glapi = util_dl_open("libglapi" UTIL_DL_EXT); if (glapi) { _eglLog(_EGL_DEBUG, "retry with libglapi" UTIL_DL_EXT " loaded"); stapi = load_gl(module, symbol); util_dl_close(glapi); } } if (!stapi) _eglLog(_EGL_WARNING, "unable to load %s" UTIL_DL_EXT, module); return stapi; }
static bool load_pipe_module(struct pipe_module *pmod, const char *name) { pmod->name = strdup(name); if (!pmod->name) return FALSE; for_each_in_search_path(dlopen_pipe_module_cb, (void *) pmod); if (pmod->lib) { pmod->drmdd = (const struct drm_driver_descriptor *) util_dl_get_proc_address(pmod->lib, "driver_descriptor"); /* sanity check on the name */ if (pmod->drmdd && strcmp(pmod->drmdd->name, pmod->name) != 0) pmod->drmdd = NULL; /* swrast */ if (pmod->drmdd && !pmod->drmdd->driver_name) { pmod->swrast_create_screen = (struct pipe_screen *(*)(struct sw_winsys *)) util_dl_get_proc_address(pmod->lib, "swrast_create_screen"); if (!pmod->swrast_create_screen) pmod->drmdd = NULL; } if (!pmod->drmdd) { util_dl_close(pmod->lib); pmod->lib = NULL; } } return (pmod->drmdd != NULL); }
void util_format_s3tc_init(void) { static boolean first_time = TRUE; struct util_dl_library *library = NULL; util_dl_proc fetch_2d_texel_rgb_dxt1; util_dl_proc fetch_2d_texel_rgba_dxt1; util_dl_proc fetch_2d_texel_rgba_dxt3; util_dl_proc fetch_2d_texel_rgba_dxt5; util_dl_proc tx_compress_dxtn; if (!first_time) return; first_time = FALSE; if (util_format_s3tc_enabled) return; #if 0 library = util_dl_open(DXTN_LIBNAME); if (!library) { debug_printf("couldn't open " DXTN_LIBNAME ", software DXTn " "compression/decompression unavailable\n"); return; } fetch_2d_texel_rgb_dxt1 = util_dl_get_proc_address(library, "fetch_2d_texel_rgb_dxt1"); fetch_2d_texel_rgba_dxt1 = util_dl_get_proc_address(library, "fetch_2d_texel_rgba_dxt1"); fetch_2d_texel_rgba_dxt3 = util_dl_get_proc_address(library, "fetch_2d_texel_rgba_dxt3"); fetch_2d_texel_rgba_dxt5 = util_dl_get_proc_address(library, "fetch_2d_texel_rgba_dxt5"); tx_compress_dxtn = util_dl_get_proc_address(library, "tx_compress_dxtn"); if (!util_format_dxt1_rgb_fetch || !util_format_dxt1_rgba_fetch || !util_format_dxt3_rgba_fetch || !util_format_dxt5_rgba_fetch || !util_format_dxtn_pack) { debug_printf("couldn't reference all symbols in " DXTN_LIBNAME ", software DXTn compression/decompression " "unavailable\n"); util_dl_close(library); return; } util_format_dxt1_rgb_fetch = (util_format_dxtn_fetch_t)fetch_2d_texel_rgb_dxt1; util_format_dxt1_rgba_fetch = (util_format_dxtn_fetch_t)fetch_2d_texel_rgba_dxt1; util_format_dxt3_rgba_fetch = (util_format_dxtn_fetch_t)fetch_2d_texel_rgba_dxt3; util_format_dxt5_rgba_fetch = (util_format_dxtn_fetch_t)fetch_2d_texel_rgba_dxt5; util_format_dxtn_pack = (util_format_dxtn_pack_t)tx_compress_dxtn; util_format_s3tc_enabled = TRUE; #endif }
static void pipe_loader_sw_release(struct pipe_loader_device **dev) { struct pipe_loader_sw_device *sdev = pipe_loader_sw_device(*dev); if (sdev->lib) util_dl_close(sdev->lib); FREE(sdev); *dev = NULL; }
static void pipe_loader_drm_release(struct pipe_loader_device **dev) { struct pipe_loader_drm_device *ddev = pipe_loader_drm_device(*dev); if (ddev->lib) util_dl_close(ddev->lib); close(ddev->fd); FREE(ddev); *dev = NULL; }
void egl_st_destroy_api(struct st_api *stapi) { #if _EGL_EXTERNAL_GL boolean is_gl = (stapi->api == ST_API_OPENGL); stapi->destroy(stapi); if (is_gl) { util_dl_close(egl_st_gl_lib); egl_st_gl_lib = NULL; } #else stapi->destroy(stapi); #endif }
static struct pipe_screen * pipe_loader_sw_create_screen(struct pipe_loader_device *dev, const char *library_paths) { struct pipe_loader_sw_device *sdev = pipe_loader_sw_device(dev); struct pipe_screen *(*init)(struct sw_winsys *); if (!sdev->lib) sdev->lib = pipe_loader_find_module(dev, library_paths); if (!sdev->lib) return NULL; init = (void *)util_dl_get_proc_address(sdev->lib, "swrast_create_screen"); if (!init){ util_dl_close(sdev->lib); sdev->lib = NULL; return NULL; } return init(sdev->ws); }
static struct st_api * load_gl(const char *name, const char *procname) { struct st_api *(*create_api)(void); struct st_api *stapi = NULL; _eglSearchPathForEach(dlopen_gl_lib_cb, (void *) name); if (!egl_st_gl_lib) return NULL; create_api = (struct st_api *(*)(void)) util_dl_get_proc_address(egl_st_gl_lib, procname); if (create_api) stapi = create_api(); if (!stapi) { util_dl_close(egl_st_gl_lib); egl_st_gl_lib = NULL; } return stapi; }
void util_format_s3tc_init(void) { static boolean first_time = TRUE; struct util_dl_library *library = NULL; util_dl_proc fetch_2d_texel_rgb_dxt1; util_dl_proc fetch_2d_texel_rgba_dxt1; util_dl_proc fetch_2d_texel_rgba_dxt3; util_dl_proc fetch_2d_texel_rgba_dxt5; util_dl_proc tx_compress_dxtn; char *force_s3tc_enable; return; #if 0 if (!first_time) return; first_time = FALSE; if (util_format_s3tc_enabled) return; // library = util_dl_open(DXTN_LIBNAME); if (!library) { if ((force_s3tc_enable = getenv("force_s3tc_enable")) && !strcmp(force_s3tc_enable, "true")) { debug_printf("couldn't open " DXTN_LIBNAME ", enabling DXTn due to " "force_s3tc_enable=true environment variable\n"); util_format_s3tc_enabled = TRUE; } else { debug_printf("couldn't open " DXTN_LIBNAME ", software DXTn " "compression/decompression unavailable\n"); } return; } fetch_2d_texel_rgb_dxt1 = util_dl_get_proc_address(library, "fetch_2d_texel_rgb_dxt1"); fetch_2d_texel_rgba_dxt1 = util_dl_get_proc_address(library, "fetch_2d_texel_rgba_dxt1"); fetch_2d_texel_rgba_dxt3 = util_dl_get_proc_address(library, "fetch_2d_texel_rgba_dxt3"); fetch_2d_texel_rgba_dxt5 = util_dl_get_proc_address(library, "fetch_2d_texel_rgba_dxt5"); tx_compress_dxtn = util_dl_get_proc_address(library, "tx_compress_dxtn"); if (!util_format_dxt1_rgb_fetch || !util_format_dxt1_rgba_fetch || !util_format_dxt3_rgba_fetch || !util_format_dxt5_rgba_fetch || !util_format_dxtn_pack) { debug_printf("couldn't reference all symbols in " DXTN_LIBNAME ", software DXTn compression/decompression " "unavailable\n"); util_dl_close(library); return; } util_format_dxt1_rgb_fetch = (util_format_dxtn_fetch_t)fetch_2d_texel_rgb_dxt1; util_format_dxt1_rgba_fetch = (util_format_dxtn_fetch_t)fetch_2d_texel_rgba_dxt1; util_format_dxt3_rgba_fetch = (util_format_dxtn_fetch_t)fetch_2d_texel_rgba_dxt3; util_format_dxt5_rgba_fetch = (util_format_dxtn_fetch_t)fetch_2d_texel_rgba_dxt5; util_format_dxtn_pack = (util_format_dxtn_pack_t)tx_compress_dxtn; util_format_s3tc_enabled = TRUE; #endif }