mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-08 09:08:10 +02:00
gbm: link directly with libgallium
Acked-by: Daniel Stone <daniels@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/29771>
This commit is contained in:
parent
69c772e4ea
commit
93511c1c5c
5 changed files with 23 additions and 32 deletions
|
|
@ -204,9 +204,6 @@ endif
|
||||||
if with_dri
|
if with_dri
|
||||||
subdir('frontends/dri')
|
subdir('frontends/dri')
|
||||||
subdir('targets/dri')
|
subdir('targets/dri')
|
||||||
if with_glx == 'dri' or with_platform_x11 or with_platform_xcb
|
|
||||||
subdir('targets/dril')
|
|
||||||
endif
|
|
||||||
endif
|
endif
|
||||||
if with_osmesa
|
if with_osmesa
|
||||||
subdir('frontends/osmesa')
|
subdir('frontends/osmesa')
|
||||||
|
|
|
||||||
|
|
@ -248,8 +248,11 @@ static struct dri_extension_match gbm_swrast_device_extensions[] = {
|
||||||
{ __DRI_KOPPER, 1, offsetof(struct gbm_dri_device, kopper), true },
|
{ __DRI_KOPPER, 1, offsetof(struct gbm_dri_device, kopper), true },
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const __DRIextension **
|
||||||
|
dri_loader_get_extensions(const char *driver_name);
|
||||||
|
|
||||||
static const __DRIextension **
|
static const __DRIextension **
|
||||||
dri_open_driver(struct gbm_dri_device *dri, bool driver_name_is_inferred)
|
dri_open_driver(struct gbm_dri_device *dri)
|
||||||
{
|
{
|
||||||
/* Temporarily work around dri driver libs that need symbols in libglapi
|
/* Temporarily work around dri driver libs that need symbols in libglapi
|
||||||
* but don't automatically link it in.
|
* but don't automatically link it in.
|
||||||
|
|
@ -259,19 +262,7 @@ dri_open_driver(struct gbm_dri_device *dri, bool driver_name_is_inferred)
|
||||||
*/
|
*/
|
||||||
dlopen("libglapi.so.0", RTLD_LAZY | RTLD_GLOBAL);
|
dlopen("libglapi.so.0", RTLD_LAZY | RTLD_GLOBAL);
|
||||||
|
|
||||||
static const char *search_path_vars[] = {
|
return dri_loader_get_extensions(dri->driver_name);
|
||||||
/* Read GBM_DRIVERS_PATH first for compatibility, but LIBGL_DRIVERS_PATH
|
|
||||||
* is recommended over GBM_DRIVERS_PATH.
|
|
||||||
*/
|
|
||||||
"GBM_DRIVERS_PATH",
|
|
||||||
/* Read LIBGL_DRIVERS_PATH if GBM_DRIVERS_PATH was not set.
|
|
||||||
* LIBGL_DRIVERS_PATH is recommended over GBM_DRIVERS_PATH.
|
|
||||||
*/
|
|
||||||
"LIBGL_DRIVERS_PATH",
|
|
||||||
NULL
|
|
||||||
};
|
|
||||||
return loader_open_driver(dri->driver_name, &dri->driver, search_path_vars,
|
|
||||||
driver_name_is_inferred);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
|
@ -281,9 +272,12 @@ dri_screen_create_for_driver(struct gbm_dri_device *dri, char *driver_name, bool
|
||||||
|
|
||||||
dri->driver_name = swrast ? strdup("swrast") : driver_name;
|
dri->driver_name = swrast ? strdup("swrast") : driver_name;
|
||||||
|
|
||||||
const __DRIextension **extensions = dri_open_driver(dri, driver_name_is_inferred);
|
const __DRIextension **extensions = dri_open_driver(dri);
|
||||||
if (!extensions)
|
if (!extensions) {
|
||||||
|
if (driver_name_is_inferred)
|
||||||
|
fprintf(stderr, "MESA-LOADER: failed to open %s: driver not built!)\n", dri->driver_name);
|
||||||
goto fail;
|
goto fail;
|
||||||
|
}
|
||||||
|
|
||||||
bool bind_ok;
|
bool bind_ok;
|
||||||
if (!swrast) {
|
if (!swrast) {
|
||||||
|
|
@ -298,7 +292,7 @@ dri_screen_create_for_driver(struct gbm_dri_device *dri, char *driver_name, bool
|
||||||
|
|
||||||
if (!bind_ok) {
|
if (!bind_ok) {
|
||||||
fprintf(stderr, "failed to bind extensions\n");
|
fprintf(stderr, "failed to bind extensions\n");
|
||||||
goto close_driver;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
dri->driver_extensions = extensions;
|
dri->driver_extensions = extensions;
|
||||||
|
|
@ -308,7 +302,7 @@ dri_screen_create_for_driver(struct gbm_dri_device *dri, char *driver_name, bool
|
||||||
dri->driver_extensions,
|
dri->driver_extensions,
|
||||||
&dri->driver_configs, driver_name_is_inferred, dri);
|
&dri->driver_configs, driver_name_is_inferred, dri);
|
||||||
if (dri->screen == NULL)
|
if (dri->screen == NULL)
|
||||||
goto close_driver;
|
goto fail;
|
||||||
|
|
||||||
if (!swrast) {
|
if (!swrast) {
|
||||||
extensions = dri->core->getExtensions(dri->screen);
|
extensions = dri->core->getExtensions(dri->screen);
|
||||||
|
|
@ -326,9 +320,6 @@ dri_screen_create_for_driver(struct gbm_dri_device *dri, char *driver_name, bool
|
||||||
free_screen:
|
free_screen:
|
||||||
dri->core->destroyScreen(dri->screen);
|
dri->core->destroyScreen(dri->screen);
|
||||||
|
|
||||||
close_driver:
|
|
||||||
dlclose(dri->driver);
|
|
||||||
|
|
||||||
fail:
|
fail:
|
||||||
free(dri->driver_name);
|
free(dri->driver_name);
|
||||||
return -1;
|
return -1;
|
||||||
|
|
@ -1220,7 +1211,6 @@ dri_destroy(struct gbm_device *gbm)
|
||||||
for (i = 0; dri->driver_configs[i]; i++)
|
for (i = 0; dri->driver_configs[i]; i++)
|
||||||
free((__DRIconfig *) dri->driver_configs[i]);
|
free((__DRIconfig *) dri->driver_configs[i]);
|
||||||
free(dri->driver_configs);
|
free(dri->driver_configs);
|
||||||
dlclose(dri->driver);
|
|
||||||
free(dri->driver_name);
|
free(dri->driver_name);
|
||||||
|
|
||||||
free(dri);
|
free(dri);
|
||||||
|
|
|
||||||
|
|
@ -49,7 +49,6 @@ struct gbm_dri_visual {
|
||||||
struct gbm_dri_device {
|
struct gbm_dri_device {
|
||||||
struct gbm_device base;
|
struct gbm_device base;
|
||||||
|
|
||||||
void *driver;
|
|
||||||
char *driver_name; /* Name of the DRI module, without the _dri suffix */
|
char *driver_name; /* Name of the DRI module, without the _dri suffix */
|
||||||
bool software; /* A software driver was loaded */
|
bool software; /* A software driver was loaded */
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -40,7 +40,7 @@ libgbm = shared_library(
|
||||||
include_directories : incs_gbm,
|
include_directories : incs_gbm,
|
||||||
c_args : [args_gbm],
|
c_args : [args_gbm],
|
||||||
link_args : [ld_args_gc_sections],
|
link_args : [ld_args_gc_sections],
|
||||||
link_with : libloader,
|
link_with : [libloader, libgallium_dri],
|
||||||
dependencies : [deps_gbm, dep_dl, dep_thread, idep_mesautil, idep_xmlconfig],
|
dependencies : [deps_gbm, dep_dl, dep_thread, idep_mesautil, idep_xmlconfig],
|
||||||
gnu_symbol_visibility : 'hidden',
|
gnu_symbol_visibility : 'hidden',
|
||||||
version : '1.0.0',
|
version : '1.0.0',
|
||||||
|
|
|
||||||
|
|
@ -101,11 +101,6 @@ endif
|
||||||
if with_gallium_asahi or with_tools.contains('asahi')
|
if with_gallium_asahi or with_tools.contains('asahi')
|
||||||
subdir('asahi')
|
subdir('asahi')
|
||||||
endif
|
endif
|
||||||
if with_gbm
|
|
||||||
subdir('gbm')
|
|
||||||
else
|
|
||||||
inc_gbm = []
|
|
||||||
endif
|
|
||||||
if with_gallium
|
if with_gallium
|
||||||
subdir('mesa')
|
subdir('mesa')
|
||||||
subdir('gallium')
|
subdir('gallium')
|
||||||
|
|
@ -121,9 +116,19 @@ if with_gallium
|
||||||
subdir('mesa/state_tracker/tests')
|
subdir('mesa/state_tracker/tests')
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
if with_gbm
|
||||||
|
subdir('gbm')
|
||||||
|
else
|
||||||
|
inc_gbm = []
|
||||||
|
endif
|
||||||
if with_egl
|
if with_egl
|
||||||
subdir('egl')
|
subdir('egl')
|
||||||
endif
|
endif
|
||||||
|
if with_gallium and with_gbm
|
||||||
|
if with_glx == 'dri' or with_platform_x11 or with_platform_xcb
|
||||||
|
subdir('gallium/targets/dril')
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
# This must be after at least mesa, glx, and gallium, since libgl will be
|
# This must be after at least mesa, glx, and gallium, since libgl will be
|
||||||
# defined in one of those subdirs depending on the glx provider.
|
# defined in one of those subdirs depending on the glx provider.
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue