mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-25 02:10:11 +01:00
targets/egl: removed
Not used.
This commit is contained in:
parent
b8f097f7a0
commit
875a1f8960
12 changed files with 0 additions and 949 deletions
|
|
@ -1,242 +0,0 @@
|
|||
# src/gallium/targets/egl/Makefile
|
||||
#
|
||||
# This is the Makefile for EGL Gallium driver package. The package consists of
|
||||
#
|
||||
# egl_gallium.so - EGL driver
|
||||
# pipe_<HW>.so - pipe drivers
|
||||
# st_<API>.so - client API state trackers
|
||||
#
|
||||
# The following variables are examined
|
||||
#
|
||||
# EGL_PLATFORMS - platforms to support
|
||||
# GALLIUM_WINSYS_DIRS - pipe drivers to support
|
||||
# EGL_CLIENT_APIS - state trackers to support
|
||||
#
|
||||
|
||||
TOP = ../../../..
|
||||
include $(TOP)/configs/current
|
||||
|
||||
ST_PREFIX := st_
|
||||
PIPE_PREFIX := pipe_
|
||||
|
||||
common_CPPFLAGS := \
|
||||
-I$(TOP)/include \
|
||||
-I$(TOP)/src/gallium/auxiliary \
|
||||
-I$(TOP)/src/gallium/drivers \
|
||||
-I$(TOP)/src/gallium/include \
|
||||
-I$(TOP)/src/gallium/winsys \
|
||||
$(LIBDRM_CFLAGS)
|
||||
|
||||
common_SYS :=
|
||||
common_LIBS := \
|
||||
$(TOP)/src/gallium/drivers/identity/libidentity.a \
|
||||
$(TOP)/src/gallium/drivers/trace/libtrace.a \
|
||||
$(TOP)/src/gallium/drivers/rbug/librbug.a \
|
||||
$(GALLIUM_AUXILIARIES)
|
||||
|
||||
# EGL driver
|
||||
egl_CPPFLAGS := \
|
||||
-I$(TOP)/src/gallium/state_trackers/egl \
|
||||
-I$(TOP)/src/egl/main \
|
||||
-DPIPE_PREFIX=\"$(PIPE_PREFIX)\" -DST_PREFIX=\"$(ST_PREFIX)\"
|
||||
egl_SYS := -lm $(DLOPEN_LIBS) -lEGL
|
||||
egl_LIBS := $(TOP)/src/gallium/state_trackers/egl/libegl.a
|
||||
|
||||
ifneq ($(findstring x11, $(EGL_PLATFORMS)),)
|
||||
egl_SYS += -lX11 -lXext -lXfixes $(LIBDRM_LIB)
|
||||
egl_LIBS += $(TOP)/src/gallium/winsys/sw/xlib/libws_xlib.a
|
||||
endif
|
||||
ifneq ($(findstring wayland, $(EGL_PLATFORMS)),)
|
||||
egl_SYS += $(WAYLAND_LIBS) $(LIBDRM_LIB)
|
||||
egl_LIBS += $(TOP)/src/gallium/winsys/sw/wayland/libws_wayland.a
|
||||
egl_LIBS += $(TOP)/src/egl/wayland/wayland-drm/libwayland-drm.a
|
||||
endif
|
||||
ifneq ($(findstring drm, $(EGL_PLATFORMS)),)
|
||||
egl_SYS += $(LIBUDEV_LIBS) $(LIBDRM_LIB) -lgbm
|
||||
endif
|
||||
ifneq ($(findstring fbdev, $(EGL_PLATFORMS)),)
|
||||
egl_LIBS += $(TOP)/src/gallium/winsys/sw/fbdev/libfbdev.a
|
||||
endif
|
||||
|
||||
# EGL_RENDERABLE_TYPE is a compile time attribute
|
||||
ifneq ($(filter $(GL_LIB), $(EGL_CLIENT_APIS)),)
|
||||
egl_CPPFLAGS += $(API_DEFINES)
|
||||
endif
|
||||
ifneq ($(filter $(VG_LIB), $(EGL_CLIENT_APIS)),)
|
||||
egl_CPPFLAGS += -DFEATURE_VG=1
|
||||
endif
|
||||
egl_CPPFLAGS := $(sort $(egl_CPPFLAGS))
|
||||
|
||||
# i915 pipe driver
|
||||
i915_CPPFLAGS :=
|
||||
i915_SYS := -ldrm_intel
|
||||
i915_LIBS := \
|
||||
$(TOP)/src/gallium/winsys/i915/drm/libi915drm.a \
|
||||
$(TOP)/src/gallium/drivers/i915/libi915.a
|
||||
|
||||
# i965 pipe driver
|
||||
i965_CPPFLAGS :=
|
||||
i965_SYS := -ldrm_intel
|
||||
i965_LIBS := \
|
||||
$(TOP)/src/gallium/winsys/i965/drm/libi965drm.a \
|
||||
$(TOP)/src/gallium/drivers/i965/libi965.a \
|
||||
$(TOP)/src/gallium/winsys/sw/wrapper/libwsw.a
|
||||
|
||||
# nouveau pipe driver
|
||||
nouveau_CPPFLAGS :=
|
||||
nouveau_SYS := -ldrm_nouveau
|
||||
nouveau_LIBS := \
|
||||
$(TOP)/src/gallium/winsys/nouveau/drm/libnouveaudrm.a \
|
||||
$(TOP)/src/gallium/drivers/nvfx/libnvfx.a \
|
||||
$(TOP)/src/gallium/drivers/nv50/libnv50.a \
|
||||
$(TOP)/src/gallium/drivers/nvc0/libnvc0.a \
|
||||
$(TOP)/src/gallium/drivers/nouveau/libnouveau.a
|
||||
|
||||
# r300 pipe driver
|
||||
r300_CPPFLAGS :=
|
||||
r300_SYS := -ldrm
|
||||
r300_LIBS := \
|
||||
$(TOP)/src/gallium/winsys/radeon/drm/libradeonwinsys.a \
|
||||
$(TOP)/src/gallium/drivers/r300/libr300.a
|
||||
|
||||
# r600 pipe driver
|
||||
r600_CPPFLAGS :=
|
||||
r600_SYS := -ldrm -ldrm_radeon
|
||||
r600_LIBS := \
|
||||
$(TOP)/src/gallium/winsys/r600/drm/libr600winsys.a \
|
||||
$(TOP)/src/gallium/drivers/r600/libr600.a
|
||||
|
||||
# vmwgfx pipe driver
|
||||
vmwgfx_CPPFLAGS :=
|
||||
vmwgfx_SYS :=
|
||||
vmwgfx_LIBS := \
|
||||
$(TOP)/src/gallium/winsys/svga/drm/libsvgadrm.a \
|
||||
$(TOP)/src/gallium/drivers/svga/libsvga.a
|
||||
|
||||
# swrast (pseudo) pipe driver
|
||||
swrast_CPPFLAGS := -DGALLIUM_SOFTPIPE -DGALLIUM_RBUG -DGALLIUM_TRACE
|
||||
swrast_SYS := -lm
|
||||
swrast_LIBS := $(TOP)/src/gallium/drivers/softpipe/libsoftpipe.a
|
||||
|
||||
# LLVM
|
||||
ifeq ($(MESA_LLVM),1)
|
||||
common_SYS += $(LLVM_LIBS)
|
||||
swrast_CPPFLAGS += -DGALLIUM_LLVMPIPE
|
||||
swrast_LIBS += $(TOP)/src/gallium/drivers/llvmpipe/libllvmpipe.a
|
||||
LDFLAGS += $(LLVM_LDFLAGS)
|
||||
endif
|
||||
|
||||
# OpenGL state tracker
|
||||
GL_CPPFLAGS := -I$(TOP)/src/mesa $(API_DEFINES)
|
||||
ifeq ($(SHARED_GLAPI),1)
|
||||
GL_SYS := $(DRI_LIB_DEPS) -l$(GLAPI_LIB)
|
||||
else
|
||||
# cannot link to $(GL_LIB) as the app might want GL or GLES
|
||||
GL_SYS := $(DRI_LIB_DEPS)
|
||||
endif
|
||||
GL_LIBS := $(TOP)/src/mesa/libmesagallium.a
|
||||
|
||||
# OpenVG state tracker
|
||||
OpenVG_CPPFLAGS := -I$(TOP)/src/gallium/state_trackers/vega
|
||||
OpenVG_SYS := -lm -l$(VG_LIB)
|
||||
OpenVG_LIBS := $(TOP)/src/gallium/state_trackers/vega/libvega.a
|
||||
|
||||
|
||||
OUTPUT_PATH := $(TOP)/$(LIB_DIR)/egl
|
||||
|
||||
# determine the outputs
|
||||
ifneq ($(findstring i915/drm,$(GALLIUM_WINSYS_DIRS)),)
|
||||
OUTPUTS += i915
|
||||
endif
|
||||
ifneq ($(findstring i965/drm,$(GALLIUM_WINSYS_DIRS)),)
|
||||
OUTPUTS += i965
|
||||
endif
|
||||
ifneq ($(findstring nouveau/drm,$(GALLIUM_WINSYS_DIRS)),)
|
||||
OUTPUTS += nouveau
|
||||
endif
|
||||
ifneq ($(findstring radeon/drm,$(GALLIUM_WINSYS_DIRS)),)
|
||||
OUTPUTS += r300
|
||||
endif
|
||||
ifneq ($(findstring r600/drm,$(GALLIUM_WINSYS_DIRS)),)
|
||||
OUTPUTS += r600
|
||||
endif
|
||||
ifneq ($(findstring svga/drm,$(GALLIUM_WINSYS_DIRS)),)
|
||||
OUTPUTS += vmwgfx
|
||||
endif
|
||||
OUTPUTS += swrast
|
||||
OUTPUTS := $(addprefix $(PIPE_PREFIX), $(OUTPUTS))
|
||||
|
||||
# EGL driver and state trackers
|
||||
OUTPUTS += egl_gallium $(addprefix $(ST_PREFIX), $(EGL_CLIENT_APIS))
|
||||
|
||||
OUTPUTS := $(addsuffix .so, $(OUTPUTS))
|
||||
OUTPUTS := $(addprefix $(OUTPUT_PATH)/, $(OUTPUTS))
|
||||
|
||||
default: $(OUTPUTS)
|
||||
|
||||
define mklib
|
||||
$(MKLIB) -o $(notdir $@) -noprefix -linker '$(CC)' \
|
||||
-L$(TOP)/$(LIB_DIR) -ldflags '$(LDFLAGS)' \
|
||||
-install $(OUTPUT_PATH) $(MKLIB_OPTIONS) $< \
|
||||
-Wl,--start-group $(common_LIBS) $($(1)_LIBS) -Wl,--end-group \
|
||||
$(common_SYS) $($(1)_SYS)
|
||||
endef
|
||||
|
||||
define mklib-cxx
|
||||
$(MKLIB) -o $(notdir $@) -noprefix -linker '$(CXX)' \
|
||||
-L$(TOP)/$(LIB_DIR) -ldflags '$(LDFLAGS)' \
|
||||
-cplusplus -install $(OUTPUT_PATH) $(MKLIB_OPTIONS) $< \
|
||||
-Wl,--start-group $(common_LIBS) $($(1)_LIBS) -Wl,--end-group \
|
||||
$(common_SYS) $($(1)_SYS)
|
||||
endef
|
||||
|
||||
# EGL driver
|
||||
$(OUTPUT_PATH)/egl_gallium.so: egl.o $(egl_LIBS)
|
||||
$(call mklib,egl)
|
||||
|
||||
# pipe drivers
|
||||
$(OUTPUT_PATH)/$(PIPE_PREFIX)i915.so: pipe_i915.o $(i915_LIBS)
|
||||
$(call mklib,i915)
|
||||
|
||||
$(OUTPUT_PATH)/$(PIPE_PREFIX)i965.so: pipe_i965.o $(i965_LIBS)
|
||||
$(call mklib,i965)
|
||||
|
||||
$(OUTPUT_PATH)/$(PIPE_PREFIX)nouveau.so: pipe_nouveau.o $(nouveau_LIBS)
|
||||
$(call mklib,nouveau)
|
||||
|
||||
$(OUTPUT_PATH)/$(PIPE_PREFIX)r300.so: pipe_r300.o $(r300_LIBS)
|
||||
$(call mklib,r300)
|
||||
|
||||
$(OUTPUT_PATH)/$(PIPE_PREFIX)r600.so: pipe_r600.o $(r600_LIBS)
|
||||
$(call mklib,r600)
|
||||
|
||||
$(OUTPUT_PATH)/$(PIPE_PREFIX)vmwgfx.so: pipe_vmwgfx.o $(vmwgfx_LIBS)
|
||||
$(call mklib,vmwgfx)
|
||||
|
||||
$(OUTPUT_PATH)/$(PIPE_PREFIX)swrast.so: pipe_swrast.o $(swrast_LIBS)
|
||||
$(call mklib,swrast)
|
||||
|
||||
# state trackers
|
||||
$(OUTPUT_PATH)/$(ST_PREFIX)$(GL_LIB).so: st_GL.o $(GL_LIBS)
|
||||
$(call mklib-cxx,GL)
|
||||
|
||||
$(OUTPUT_PATH)/$(ST_PREFIX)$(VG_LIB).so: st_OpenVG.o $(OpenVG_LIBS)
|
||||
$(call mklib,OpenVG)
|
||||
|
||||
egl.o: egl.c
|
||||
$(CC) -c -o $@ $< $(common_CPPFLAGS) $(egl_CPPFLAGS) $(DEFINES) $(CFLAGS)
|
||||
|
||||
pipe_%.o: pipe_%.c
|
||||
$(CC) -c -o $@ $< $(common_CPPFLAGS) $($*_CPPFLAGS) $(DEFINES) $(CFLAGS)
|
||||
|
||||
st_%.o: st_%.c
|
||||
$(CC) -c -o $@ $< $(common_CPPFLAGS) $($*_CPPFLAGS) $(DEFINES) $(CFLAGS)
|
||||
|
||||
install: $(OUTPUTS)
|
||||
$(INSTALL) -d $(DESTDIR)$(EGL_DRIVER_INSTALL_DIR)
|
||||
for out in $(OUTPUTS); do \
|
||||
$(MINSTALL) -m 755 "$$out" $(DESTDIR)$(EGL_DRIVER_INSTALL_DIR); \
|
||||
done
|
||||
|
||||
clean:
|
||||
rm -f *.o
|
||||
|
|
@ -1,466 +0,0 @@
|
|||
/*
|
||||
* Mesa 3-D graphics library
|
||||
* Version: 7.9
|
||||
*
|
||||
* Copyright (C) 2010 LunarG Inc.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included
|
||||
* in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* Authors:
|
||||
* Chia-I Wu <olv@lunarg.com>
|
||||
*/
|
||||
|
||||
#include "util/u_debug.h"
|
||||
#include "util/u_string.h"
|
||||
#include "util/u_memory.h"
|
||||
#include "util/u_dl.h"
|
||||
#include "egldriver.h"
|
||||
#include "egllog.h"
|
||||
|
||||
#include "state_tracker/st_api.h"
|
||||
#include "state_tracker/drm_driver.h"
|
||||
#include "common/egl_g3d_loader.h"
|
||||
|
||||
#ifdef HAVE_LIBUDEV
|
||||
#include <libudev.h>
|
||||
#define DRIVER_MAP_GALLIUM_ONLY
|
||||
#include "pci_ids/pci_id_driver_map.h"
|
||||
#endif
|
||||
|
||||
#include "egl.h"
|
||||
|
||||
struct egl_g3d_loader egl_g3d_loader;
|
||||
|
||||
static struct st_module {
|
||||
boolean initialized;
|
||||
char *name;
|
||||
struct util_dl_library *lib;
|
||||
struct st_api *stapi;
|
||||
} st_modules[ST_API_COUNT];
|
||||
|
||||
static struct pipe_module {
|
||||
boolean initialized;
|
||||
char *name;
|
||||
struct util_dl_library *lib;
|
||||
const struct drm_driver_descriptor *drmdd;
|
||||
struct pipe_screen *(*swrast_create_screen)(struct sw_winsys *);
|
||||
} pipe_modules[16];
|
||||
|
||||
static char *
|
||||
loader_strdup(const char *s)
|
||||
{
|
||||
size_t len = (s) ? strlen(s) : 0;
|
||||
char *t = MALLOC(len + 1);
|
||||
if (t) {
|
||||
memcpy(t, s, len);
|
||||
t[len] = '\0';
|
||||
}
|
||||
return t;
|
||||
}
|
||||
|
||||
static EGLBoolean
|
||||
dlopen_st_module_cb(const char *dir, size_t len, void *callback_data)
|
||||
{
|
||||
struct st_module *stmod =
|
||||
(struct st_module *) callback_data;
|
||||
char path[1024];
|
||||
int ret;
|
||||
|
||||
if (len) {
|
||||
ret = util_snprintf(path, sizeof(path),
|
||||
"%.*s/" ST_PREFIX "%s" UTIL_DL_EXT, len, dir, stmod->name);
|
||||
}
|
||||
else {
|
||||
ret = util_snprintf(path, sizeof(path),
|
||||
ST_PREFIX "%s" UTIL_DL_EXT, stmod->name);
|
||||
}
|
||||
|
||||
if (ret > 0 && ret < sizeof(path)) {
|
||||
stmod->lib = util_dl_open(path);
|
||||
if (stmod->lib)
|
||||
_eglLog(_EGL_DEBUG, "loaded %s", path);
|
||||
}
|
||||
|
||||
return !(stmod->lib);
|
||||
}
|
||||
|
||||
static boolean
|
||||
load_st_module(struct st_module *stmod,
|
||||
const char *name, const char *procname)
|
||||
{
|
||||
struct st_api *(*create_api)(void);
|
||||
|
||||
if (name) {
|
||||
_eglLog(_EGL_DEBUG, "searching for st module %s", name);
|
||||
stmod->name = loader_strdup(name);
|
||||
}
|
||||
else {
|
||||
stmod->name = NULL;
|
||||
}
|
||||
|
||||
if (stmod->name)
|
||||
_eglSearchPathForEach(dlopen_st_module_cb, (void *) stmod);
|
||||
else
|
||||
stmod->lib = util_dl_open(NULL);
|
||||
|
||||
if (stmod->lib) {
|
||||
create_api = (struct st_api *(*)(void))
|
||||
util_dl_get_proc_address(stmod->lib, procname);
|
||||
if (create_api)
|
||||
stmod->stapi = create_api();
|
||||
|
||||
if (!stmod->stapi) {
|
||||
util_dl_close(stmod->lib);
|
||||
stmod->lib = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
if (!stmod->stapi) {
|
||||
FREE(stmod->name);
|
||||
stmod->name = NULL;
|
||||
}
|
||||
|
||||
return (stmod->stapi != NULL);
|
||||
}
|
||||
|
||||
static EGLBoolean
|
||||
dlopen_pipe_module_cb(const char *dir, size_t len, void *callback_data)
|
||||
{
|
||||
struct pipe_module *pmod = (struct pipe_module *) callback_data;
|
||||
char path[1024];
|
||||
int ret;
|
||||
|
||||
if (len) {
|
||||
ret = util_snprintf(path, sizeof(path),
|
||||
"%.*s/" PIPE_PREFIX "%s" UTIL_DL_EXT, len, dir, pmod->name);
|
||||
}
|
||||
else {
|
||||
ret = util_snprintf(path, sizeof(path),
|
||||
PIPE_PREFIX "%s" UTIL_DL_EXT, pmod->name);
|
||||
}
|
||||
if (ret > 0 && ret < sizeof(path)) {
|
||||
pmod->lib = util_dl_open(path);
|
||||
if (pmod->lib)
|
||||
_eglLog(_EGL_DEBUG, "loaded %s", path);
|
||||
}
|
||||
|
||||
return !(pmod->lib);
|
||||
}
|
||||
|
||||
static boolean
|
||||
load_pipe_module(struct pipe_module *pmod, const char *name)
|
||||
{
|
||||
pmod->name = loader_strdup(name);
|
||||
if (!pmod->name)
|
||||
return FALSE;
|
||||
|
||||
_eglLog(_EGL_DEBUG, "searching for pipe module %s", pmod->name);
|
||||
_eglSearchPathForEach(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);
|
||||
}
|
||||
|
||||
static struct st_api *
|
||||
get_st_api(enum st_api_type api)
|
||||
{
|
||||
struct st_module *stmod = &st_modules[api];
|
||||
const char *names[8], *symbol;
|
||||
int i, count = 0;
|
||||
|
||||
if (stmod->initialized)
|
||||
return stmod->stapi;
|
||||
|
||||
switch (api) {
|
||||
case ST_API_OPENGL:
|
||||
symbol = ST_CREATE_OPENGL_SYMBOL;
|
||||
names[count++] = "GL";
|
||||
break;
|
||||
case ST_API_OPENVG:
|
||||
symbol = ST_CREATE_OPENVG_SYMBOL;
|
||||
names[count++] = "OpenVG";
|
||||
break;
|
||||
default:
|
||||
symbol = NULL;
|
||||
assert(!"Unknown API Type\n");
|
||||
break;
|
||||
}
|
||||
|
||||
/* NULL means the process itself */
|
||||
names[count++] = NULL;
|
||||
|
||||
for (i = 0; i < count; i++) {
|
||||
if (load_st_module(stmod, names[i], symbol))
|
||||
break;
|
||||
}
|
||||
|
||||
/* try again with libGL.so loaded */
|
||||
if (!stmod->stapi && api == ST_API_OPENGL) {
|
||||
struct util_dl_library *glapi = util_dl_open("libGL" UTIL_DL_EXT);
|
||||
|
||||
if (glapi) {
|
||||
_eglLog(_EGL_DEBUG, "retry with libGL" UTIL_DL_EXT " loaded");
|
||||
/* skip the last name (which is NULL) */
|
||||
for (i = 0; i < count - 1; i++) {
|
||||
if (load_st_module(stmod, names[i], symbol))
|
||||
break;
|
||||
}
|
||||
util_dl_close(glapi);
|
||||
}
|
||||
}
|
||||
|
||||
if (!stmod->stapi) {
|
||||
EGLint level = (egl_g3d_loader.profile_masks[api]) ?
|
||||
_EGL_WARNING : _EGL_DEBUG;
|
||||
_eglLog(level, "unable to load " ST_PREFIX "%s" UTIL_DL_EXT, names[0]);
|
||||
}
|
||||
|
||||
stmod->initialized = TRUE;
|
||||
|
||||
return stmod->stapi;
|
||||
}
|
||||
|
||||
static struct pipe_module *
|
||||
get_pipe_module(const char *name)
|
||||
{
|
||||
struct pipe_module *pmod = NULL;
|
||||
int i;
|
||||
|
||||
if (!name)
|
||||
return NULL;
|
||||
|
||||
for (i = 0; i < Elements(pipe_modules); i++) {
|
||||
if (!pipe_modules[i].initialized ||
|
||||
strcmp(pipe_modules[i].name, name) == 0) {
|
||||
pmod = &pipe_modules[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!pmod)
|
||||
return NULL;
|
||||
|
||||
if (!pmod->initialized) {
|
||||
load_pipe_module(pmod, name);
|
||||
pmod->initialized = TRUE;
|
||||
}
|
||||
|
||||
return pmod;
|
||||
}
|
||||
|
||||
static char *
|
||||
drm_fd_get_screen_name(int fd)
|
||||
{
|
||||
char *driver = NULL;
|
||||
#ifdef HAVE_LIBUDEV
|
||||
struct udev *udev;
|
||||
struct udev_device *device, *parent;
|
||||
struct stat buf;
|
||||
const char *pci_id;
|
||||
int vendor_id, chip_id, i, j;
|
||||
|
||||
udev = udev_new();
|
||||
if (fstat(fd, &buf) < 0) {
|
||||
_eglLog(_EGL_WARNING, "failed to stat fd %d", fd);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
device = udev_device_new_from_devnum(udev, 'c', buf.st_rdev);
|
||||
if (device == NULL) {
|
||||
_eglLog(_EGL_WARNING,
|
||||
"could not create udev device for fd %d", fd);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
parent = udev_device_get_parent(device);
|
||||
if (parent == NULL) {
|
||||
_eglLog(_EGL_WARNING, "could not get parent device");
|
||||
goto out;
|
||||
}
|
||||
|
||||
pci_id = udev_device_get_property_value(parent, "PCI_ID");
|
||||
if (pci_id == NULL ||
|
||||
sscanf(pci_id, "%x:%x", &vendor_id, &chip_id) != 2) {
|
||||
_eglLog(_EGL_WARNING, "malformed or no PCI ID");
|
||||
goto out;
|
||||
}
|
||||
|
||||
for (i = 0; driver_map[i].driver; i++) {
|
||||
if (vendor_id != driver_map[i].vendor_id)
|
||||
continue;
|
||||
if (driver_map[i].num_chips_ids == -1) {
|
||||
driver = strdup(driver_map[i].driver);
|
||||
_eglLog(_EGL_WARNING,
|
||||
"pci id for %d: %04x:%04x, driver %s",
|
||||
fd, vendor_id, chip_id, driver);
|
||||
goto out;
|
||||
}
|
||||
|
||||
for (j = 0; j < driver_map[i].num_chips_ids; j++)
|
||||
if (driver_map[i].chip_ids[j] == chip_id) {
|
||||
driver = strdup(driver_map[i].driver);
|
||||
_eglLog(_EGL_WARNING,
|
||||
"pci id for %d: %04x:%04x, driver %s",
|
||||
fd, vendor_id, chip_id, driver);
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
|
||||
out:
|
||||
udev_device_unref(device);
|
||||
udev_unref(udev);
|
||||
|
||||
#endif
|
||||
return driver;
|
||||
}
|
||||
|
||||
static struct pipe_screen *
|
||||
create_drm_screen(const char *name, int fd)
|
||||
{
|
||||
struct pipe_module *pmod;
|
||||
const char *screen_name = name;
|
||||
|
||||
if (screen_name == NULL)
|
||||
if ((screen_name = drm_fd_get_screen_name(fd)) == NULL)
|
||||
return NULL;
|
||||
pmod = get_pipe_module(screen_name);
|
||||
|
||||
return (pmod && pmod->drmdd && pmod->drmdd->create_screen) ?
|
||||
pmod->drmdd->create_screen(fd) : NULL;
|
||||
}
|
||||
|
||||
static struct pipe_screen *
|
||||
create_sw_screen(struct sw_winsys *ws)
|
||||
{
|
||||
struct pipe_module *pmod = get_pipe_module("swrast");
|
||||
return (pmod && pmod->swrast_create_screen) ?
|
||||
pmod->swrast_create_screen(ws) : NULL;
|
||||
}
|
||||
|
||||
static const struct egl_g3d_loader *
|
||||
loader_init(void)
|
||||
{
|
||||
/* TODO detect at runtime? */
|
||||
#if FEATURE_GL
|
||||
egl_g3d_loader.profile_masks[ST_API_OPENGL] |= ST_PROFILE_DEFAULT_MASK;
|
||||
#endif
|
||||
#if FEATURE_ES1
|
||||
egl_g3d_loader.profile_masks[ST_API_OPENGL] |= ST_PROFILE_OPENGL_ES1_MASK;
|
||||
#endif
|
||||
#if FEATURE_ES2
|
||||
egl_g3d_loader.profile_masks[ST_API_OPENGL] |= ST_PROFILE_OPENGL_ES2_MASK;
|
||||
#endif
|
||||
#if FEATURE_VG
|
||||
egl_g3d_loader.profile_masks[ST_API_OPENVG] |= ST_PROFILE_DEFAULT_MASK;
|
||||
#endif
|
||||
|
||||
egl_g3d_loader.get_st_api = get_st_api;
|
||||
egl_g3d_loader.create_drm_screen = create_drm_screen;
|
||||
egl_g3d_loader.create_sw_screen = create_sw_screen;
|
||||
|
||||
return &egl_g3d_loader;
|
||||
}
|
||||
|
||||
static void
|
||||
loader_fini(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < ST_API_COUNT; i++) {
|
||||
struct st_module *stmod = &st_modules[i];
|
||||
|
||||
if (stmod->stapi) {
|
||||
stmod->stapi->destroy(stmod->stapi);
|
||||
stmod->stapi = NULL;
|
||||
}
|
||||
if (stmod->lib) {
|
||||
util_dl_close(stmod->lib);
|
||||
stmod->lib = NULL;
|
||||
}
|
||||
if (stmod->name) {
|
||||
FREE(stmod->name);
|
||||
stmod->name = NULL;
|
||||
}
|
||||
stmod->initialized = FALSE;
|
||||
}
|
||||
for (i = 0; i < Elements(pipe_modules); i++) {
|
||||
struct pipe_module *pmod = &pipe_modules[i];
|
||||
|
||||
if (!pmod->initialized)
|
||||
break;
|
||||
|
||||
pmod->drmdd = NULL;
|
||||
pmod->swrast_create_screen = NULL;
|
||||
if (pmod->lib) {
|
||||
util_dl_close(pmod->lib);
|
||||
pmod->lib = NULL;
|
||||
}
|
||||
if (pmod->name) {
|
||||
FREE(pmod->name);
|
||||
pmod->name = NULL;
|
||||
}
|
||||
pmod->initialized = FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
egl_g3d_unload(_EGLDriver *drv)
|
||||
{
|
||||
egl_g3d_destroy_driver(drv);
|
||||
loader_fini();
|
||||
}
|
||||
|
||||
_EGLDriver *
|
||||
_eglMain(const char *args)
|
||||
{
|
||||
const struct egl_g3d_loader *loader;
|
||||
_EGLDriver *drv;
|
||||
|
||||
loader = loader_init();
|
||||
drv = egl_g3d_create_driver(loader);
|
||||
if (!drv) {
|
||||
loader_fini();
|
||||
return NULL;
|
||||
}
|
||||
|
||||
drv->Name = "Gallium";
|
||||
drv->Unload = egl_g3d_unload;
|
||||
|
||||
return drv;
|
||||
}
|
||||
|
|
@ -1,44 +0,0 @@
|
|||
/*
|
||||
* Mesa 3-D graphics library
|
||||
* Version: 7.9
|
||||
*
|
||||
* Copyright (C) 2010 LunarG Inc.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included
|
||||
* in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* Authors:
|
||||
* Chia-I Wu <olv@lunarg.com>
|
||||
*/
|
||||
|
||||
#ifndef _EGL_H_
|
||||
#define _EGL_H_
|
||||
|
||||
#include "pipe/p_compiler.h"
|
||||
#include "state_tracker/st_api.h"
|
||||
|
||||
#define ST_CREATE_OPENGL_SYMBOL "st_api_create_OpenGL"
|
||||
#define ST_CREATE_OPENVG_SYMBOL "st_api_create_OpenVG"
|
||||
|
||||
PUBLIC struct st_api *
|
||||
st_api_create_OpenGL(void);
|
||||
|
||||
PUBLIC struct st_api *
|
||||
st_api_create_OpenVG(void);
|
||||
|
||||
#endif /* _EGL_H_ */
|
||||
|
|
@ -1,27 +0,0 @@
|
|||
|
||||
#include "target-helpers/inline_debug_helper.h"
|
||||
#include "state_tracker/drm_driver.h"
|
||||
#include "i915/drm/i915_drm_public.h"
|
||||
#include "i915/i915_public.h"
|
||||
|
||||
static struct pipe_screen *
|
||||
create_screen(int fd)
|
||||
{
|
||||
struct i915_winsys *iws;
|
||||
struct pipe_screen *screen;
|
||||
|
||||
iws = i915_drm_winsys_create(fd);
|
||||
if (!iws)
|
||||
return NULL;
|
||||
|
||||
screen = i915_screen_create(iws);
|
||||
if (!screen)
|
||||
return NULL;
|
||||
|
||||
screen = debug_screen_wrap(screen);
|
||||
|
||||
return screen;
|
||||
}
|
||||
|
||||
PUBLIC
|
||||
DRM_DRIVER_DESCRIPTOR("i915", "i915", create_screen)
|
||||
|
|
@ -1,30 +0,0 @@
|
|||
|
||||
#include "target-helpers/inline_debug_helper.h"
|
||||
#include "target-helpers/inline_wrapper_sw_helper.h"
|
||||
#include "state_tracker/drm_driver.h"
|
||||
#include "i965/drm/i965_drm_public.h"
|
||||
#include "i965/brw_public.h"
|
||||
|
||||
static struct pipe_screen *
|
||||
create_screen(int fd)
|
||||
{
|
||||
struct brw_winsys_screen *bws;
|
||||
struct pipe_screen *screen;
|
||||
|
||||
bws = i965_drm_winsys_screen_create(fd);
|
||||
if (!bws)
|
||||
return NULL;
|
||||
|
||||
screen = brw_screen_create(bws);
|
||||
if (!screen)
|
||||
return NULL;
|
||||
|
||||
screen = sw_screen_wrap(screen);
|
||||
|
||||
screen = debug_screen_wrap(screen);
|
||||
|
||||
return screen;
|
||||
}
|
||||
|
||||
PUBLIC
|
||||
DRM_DRIVER_DESCRIPTOR("i965", "i965", create_screen)
|
||||
|
|
@ -1,21 +0,0 @@
|
|||
|
||||
#include "target-helpers/inline_debug_helper.h"
|
||||
#include "state_tracker/drm_driver.h"
|
||||
#include "nouveau/drm/nouveau_drm_public.h"
|
||||
|
||||
static struct pipe_screen *
|
||||
create_screen(int fd)
|
||||
{
|
||||
struct pipe_screen *screen;
|
||||
|
||||
screen = nouveau_drm_screen_create(fd);
|
||||
if (!screen)
|
||||
return NULL;
|
||||
|
||||
screen = debug_screen_wrap(screen);
|
||||
|
||||
return screen;
|
||||
}
|
||||
|
||||
PUBLIC
|
||||
DRM_DRIVER_DESCRIPTOR("nouveau", "nouveau", create_screen)
|
||||
|
|
@ -1,27 +0,0 @@
|
|||
|
||||
#include "target-helpers/inline_debug_helper.h"
|
||||
#include "state_tracker/drm_driver.h"
|
||||
#include "radeon/drm/radeon_drm_public.h"
|
||||
#include "r300/r300_public.h"
|
||||
|
||||
static struct pipe_screen *
|
||||
create_screen(int fd)
|
||||
{
|
||||
struct radeon_winsys *sws;
|
||||
struct pipe_screen *screen;
|
||||
|
||||
sws = radeon_drm_winsys_create(fd);
|
||||
if (!sws)
|
||||
return NULL;
|
||||
|
||||
screen = r300_screen_create(sws);
|
||||
if (!screen)
|
||||
return NULL;
|
||||
|
||||
screen = debug_screen_wrap(screen);
|
||||
|
||||
return screen;
|
||||
}
|
||||
|
||||
PUBLIC
|
||||
DRM_DRIVER_DESCRIPTOR("r300", "radeon", create_screen)
|
||||
|
|
@ -1,27 +0,0 @@
|
|||
|
||||
#include "state_tracker/drm_driver.h"
|
||||
#include "target-helpers/inline_debug_helper.h"
|
||||
#include "r600/drm/r600_drm_public.h"
|
||||
#include "r600/r600_public.h"
|
||||
|
||||
static struct pipe_screen *
|
||||
create_screen(int fd)
|
||||
{
|
||||
struct radeon *rw;
|
||||
struct pipe_screen *screen;
|
||||
|
||||
rw = r600_drm_winsys_create(fd);
|
||||
if (!rw)
|
||||
return NULL;
|
||||
|
||||
screen = r600_screen_create(rw);
|
||||
if (!screen)
|
||||
return NULL;
|
||||
|
||||
screen = debug_screen_wrap(screen);
|
||||
|
||||
return screen;
|
||||
}
|
||||
|
||||
PUBLIC
|
||||
DRM_DRIVER_DESCRIPTOR("r600", "radeon", create_screen)
|
||||
|
|
@ -1,22 +0,0 @@
|
|||
|
||||
#include "target-helpers/inline_sw_helper.h"
|
||||
#include "target-helpers/inline_debug_helper.h"
|
||||
#include "state_tracker/drm_driver.h"
|
||||
|
||||
PUBLIC struct pipe_screen *
|
||||
swrast_create_screen(struct sw_winsys *ws);
|
||||
|
||||
PUBLIC
|
||||
DRM_DRIVER_DESCRIPTOR("swrast", NULL, NULL)
|
||||
|
||||
struct pipe_screen *
|
||||
swrast_create_screen(struct sw_winsys *ws)
|
||||
{
|
||||
struct pipe_screen *screen;
|
||||
|
||||
screen = sw_screen_create(ws);
|
||||
if (screen)
|
||||
screen = debug_screen_wrap(screen);
|
||||
|
||||
return screen;
|
||||
}
|
||||
|
|
@ -1,27 +0,0 @@
|
|||
|
||||
#include "target-helpers/inline_debug_helper.h"
|
||||
#include "state_tracker/drm_driver.h"
|
||||
#include "svga/drm/svga_drm_public.h"
|
||||
#include "svga/svga_public.h"
|
||||
|
||||
static struct pipe_screen *
|
||||
create_screen(int fd)
|
||||
{
|
||||
struct svga_winsys_screen *sws;
|
||||
struct pipe_screen *screen;
|
||||
|
||||
sws = svga_drm_winsys_screen_create(fd);
|
||||
if (!sws)
|
||||
return NULL;
|
||||
|
||||
screen = svga_screen_create(sws);
|
||||
if (!screen)
|
||||
return NULL;
|
||||
|
||||
screen = debug_screen_wrap(screen);
|
||||
|
||||
return screen;
|
||||
}
|
||||
|
||||
PUBLIC
|
||||
DRM_DRIVER_DESCRIPTOR("vmwgfx", "vmwgfx", create_screen)
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
#include "state_tracker/st_gl_api.h"
|
||||
#include "egl.h"
|
||||
|
||||
PUBLIC struct st_api *
|
||||
st_api_create_OpenGL(void)
|
||||
{
|
||||
return st_gl_api_create();
|
||||
}
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
#include "vg_api.h"
|
||||
#include "egl.h"
|
||||
|
||||
PUBLIC struct st_api *
|
||||
st_api_create_OpenVG(void)
|
||||
{
|
||||
return (struct st_api *) vg_api_get();
|
||||
}
|
||||
Loading…
Add table
Reference in a new issue