summaryrefslogtreecommitdiffstats
path: root/src/gallium/state_trackers
diff options
context:
space:
mode:
authorChia-I Wu <[email protected]>2010-06-17 23:45:41 +0800
committerChia-I Wu <[email protected]>2010-06-29 17:16:19 +0800
commitea05299ce54ea0463626277907cab8e849884740 (patch)
tree427d55a566a49372dfe259bcdd6de3dabad900ad /src/gallium/state_trackers
parentf66a4e20c19d55005854bbee312947ec16e287e3 (diff)
st/egl: One driver per hardware.
Merge multiple egl_<platform>_<pipe>.so into a single egl_gallium_<pipe>.so. The environment variable EGL_PLATFORM is now used to modify the return value of _eglGetNativePlatform.
Diffstat (limited to 'src/gallium/state_trackers')
-rw-r--r--src/gallium/state_trackers/egl/Makefile49
-rw-r--r--src/gallium/state_trackers/egl/SConscript3
-rw-r--r--src/gallium/state_trackers/egl/common/egl_g3d.c48
-rw-r--r--src/gallium/state_trackers/egl/common/egl_g3d.h2
-rw-r--r--src/gallium/state_trackers/egl/common/native.h11
-rw-r--r--src/gallium/state_trackers/egl/fbdev/native_fbdev.c2
-rw-r--r--src/gallium/state_trackers/egl/gdi/native_gdi.c2
-rw-r--r--src/gallium/state_trackers/egl/kms/native_kms.c2
-rw-r--r--src/gallium/state_trackers/egl/x11/native_x11.c2
9 files changed, 90 insertions, 31 deletions
diff --git a/src/gallium/state_trackers/egl/Makefile b/src/gallium/state_trackers/egl/Makefile
index fec178ffb30..7bb53492b49 100644
--- a/src/gallium/state_trackers/egl/Makefile
+++ b/src/gallium/state_trackers/egl/Makefile
@@ -38,23 +38,30 @@ fbdev_OBJECTS = $(fbdev_SOURCES:.c=.o)
ALL_INCLUDES = $(common_INCLUDES) $(x11_INCLUDES) $(kms_INCLUDES) $(fbdev_INCLUDES)
ALL_SOURCES = $(common_SOURCES) $(x11_SOURCES) $(kms_SOURCES) $(fbdev_SOURCES)
-ALL_OBJECTS = $(common_OBJECTS) $(x11_OBJECTS) $(kms_OBJECTS) $(fbdev_OBJECTS)
-##### TARGETS #####
-
-EGL_PLATFORMS_MODS = $(foreach plat, $(EGL_PLATFORMS), libegl$(plat).a)
-
-default: depend $(EGL_PLATFORMS_MODS)
+EGL_OBJECTS = $(common_OBJECTS)
+EGL_CPPFLAGS = $(common_INCLUDES)
+
+# add backends
+ifneq ($(findstring x11, $(EGL_PLATFORMS)),)
+EGL_OBJECTS += $(x11_OBJECTS)
+EGL_CPPFLAGS += -DHAVE_X11_BACKEND
+endif
+ifneq ($(findstring kms, $(EGL_PLATFORMS)),)
+EGL_OBJECTS += $(kms_OBJECTS)
+EGL_CPPFLAGS += -DHAVE_KMS_BACKEND
+endif
+ifneq ($(findstring fbdev, $(EGL_PLATFORMS)),)
+EGL_OBJECTS += $(fbdev_OBJECTS)
+EGL_CPPFLAGS += -DHAVE_FBDEV_BACKEND
+endif
+##### TARGETS #####
-libeglx11.a: $(x11_OBJECTS) $(common_OBJECTS) Makefile
- $(MKLIB) -o eglx11 -static $(x11_OBJECTS) $(common_OBJECTS)
-
-libeglkms.a: $(kms_OBJECTS) $(common_OBJECTS) Makefile
- $(MKLIB) -o eglkms -static $(kms_OBJECTS) $(common_OBJECTS)
+default: depend libegl.a
-libeglfbdev.a: $(fbdev_OBJECTS) $(common_OBJECTS) Makefile
- $(MKLIB) -o eglfbdev -static $(fbdev_OBJECTS) $(common_OBJECTS)
+libegl.a: $(EGL_OBJECTS) Makefile
+ $(MKLIB) -o egl -static $(EGL_OBJECTS)
depend:
rm -f depend
@@ -62,8 +69,8 @@ depend:
$(MKDEP) $(MKDEP_OPTIONS) $(ALL_INCLUDES) $(ALL_SOURCES) 2> /dev/null
clean:
- rm -f $(ALL_OBJECTS)
- rm -f $(EGL_PLATFORMS_MODS)
+ rm -f libegl.a
+ rm -f $(EGL_OBJECTS)
rm -f depend depend.bak
# Dummy target
@@ -72,16 +79,20 @@ install:
##### RULES #####
+define egl-cc
+$(CC) -c $(common_INCLUDES) $($(1)_INCLUDES) $(DEFINES) $(CFLAGS) $< -o $@
+endef
+
$(common_OBJECTS): %.o: %.c
- $(CC) -c $(common_INCLUDES) $(DEFINES) $(CFLAGS) $< -o $@
+ $(CC) -c $(EGL_CPPFLAGS) $(DEFINES) $(CFLAGS) $< -o $@
$(x11_OBJECTS): %.o: %.c
- $(CC) -c $(common_INCLUDES) $(x11_INCLUDES) $(DEFINES) $(CFLAGS) $< -o $@
+ $(call egl-cc,x11)
$(kms_OBJECTS): %.o: %.c
- $(CC) -c $(common_INCLUDES) $(kms_INCLUDES) $(DEFINES) $(CFLAGS) $< -o $@
+ $(call egl-cc,kms)
$(fbdev_OBJECTS): %.o: %.c
- $(CC) -c $(common_INCLUDES) $(fbdev_INCLUDES) $(DEFINES) $(CFLAGS) $< -o $@
+ $(call egl-cc,fbdev)
sinclude depend
diff --git a/src/gallium/state_trackers/egl/SConscript b/src/gallium/state_trackers/egl/SConscript
index c4d01d6b287..e71aec35b73 100644
--- a/src/gallium/state_trackers/egl/SConscript
+++ b/src/gallium/state_trackers/egl/SConscript
@@ -12,6 +12,9 @@ if 'egl' in env['statetrackers']:
'#/src/gallium/winsys/sw',
'.',
])
+ env.Append(CPPDEFINES = [
+ 'HAVE_GDI_BACKEND',
+ ])
common_sources = [
'common/egl_g3d.c',
diff --git a/src/gallium/state_trackers/egl/common/egl_g3d.c b/src/gallium/state_trackers/egl/common/egl_g3d.c
index 6b54ee365c6..36354dd42ed 100644
--- a/src/gallium/state_trackers/egl/common/egl_g3d.c
+++ b/src/gallium/state_trackers/egl/common/egl_g3d.c
@@ -66,14 +66,50 @@ egl_g3d_init_st(_EGLDriver *drv)
* Get the native platform.
*/
static const struct native_platform *
-egl_g3d_get_platform(_EGLDriver *drv)
+egl_g3d_get_platform(_EGLDriver *drv, _EGLPlatformType plat)
{
struct egl_g3d_driver *gdrv = egl_g3d_driver(drv);
- if (!gdrv->platform)
- gdrv->platform = native_get_platform();
+ if (!gdrv->platforms[plat]) {
+ const char *plat_name = NULL;
+ const struct native_platform *nplat = NULL;
- return gdrv->platform;
+ switch (plat) {
+ case _EGL_PLATFORM_WINDOWS:
+ plat_name = "Windows";
+#ifdef HAVE_GDI_BACKEND
+ nplat = native_get_gdi_platform();
+#endif
+ break;
+ case _EGL_PLATFORM_X11:
+ plat_name = "X11";
+#ifdef HAVE_X11_BACKEND
+ nplat = native_get_x11_platform();
+#endif
+ break;
+ case _EGL_PLATFORM_DRM:
+ plat_name = "DRM";
+#ifdef HAVE_KMS_BACKEND
+ nplat = native_get_kms_platform();
+#endif
+ break;
+ case _EGL_PLATFORM_FBDEV:
+ plat_name = "FBDEV";
+#ifdef HAVE_FBDEV_BACKEND
+ nplat = native_get_fbdev_platform();
+#endif
+ break;
+ default:
+ break;
+ }
+
+ if (!nplat)
+ _eglLog(_EGL_WARNING, "unsupported platform %s", plat_name);
+
+ gdrv->platforms[plat] = nplat;
+ }
+
+ return gdrv->platforms[plat];
}
/**
@@ -88,7 +124,7 @@ egl_g3d_get_probe_result(_EGLDriver *drv, _EGLDisplay *dpy)
struct native_probe *nprobe;
const struct native_platform *nplat;
- nplat = egl_g3d_get_platform(drv);
+ nplat = egl_g3d_get_platform(drv, dpy->Platform);
if (!nplat || !nplat->create_probe)
return NATIVE_PROBE_UNKNOWN;
@@ -484,7 +520,7 @@ egl_g3d_initialize(_EGLDriver *drv, _EGLDisplay *dpy,
/* the probe object is unlikely to be needed again */
egl_g3d_destroy_probe(drv, dpy);
- nplat = egl_g3d_get_platform(drv);
+ nplat = egl_g3d_get_platform(drv, dpy->Platform);
if (!nplat)
return EGL_FALSE;
diff --git a/src/gallium/state_trackers/egl/common/egl_g3d.h b/src/gallium/state_trackers/egl/common/egl_g3d.h
index 26043169ff8..a498dcf6f63 100644
--- a/src/gallium/state_trackers/egl/common/egl_g3d.h
+++ b/src/gallium/state_trackers/egl/common/egl_g3d.h
@@ -47,7 +47,7 @@ struct egl_g3d_driver {
struct st_api *stapis[ST_API_COUNT];
EGLint api_mask;
- const struct native_platform *platform;
+ const struct native_platform *platforms[_EGL_NUM_PLATFORMS];
EGLint probe_key;
};
diff --git a/src/gallium/state_trackers/egl/common/native.h b/src/gallium/state_trackers/egl/common/native.h
index 941adfc03ff..c4d23bf5415 100644
--- a/src/gallium/state_trackers/egl/common/native.h
+++ b/src/gallium/state_trackers/egl/common/native.h
@@ -229,6 +229,15 @@ struct native_platform {
};
const struct native_platform *
-native_get_platform(void);
+native_get_gdi_platform(void);
+
+const struct native_platform *
+native_get_x11_platform(void);
+
+const struct native_platform *
+native_get_kms_platform(void);
+
+const struct native_platform *
+native_get_fbdev_platform(void);
#endif /* _NATIVE_H_ */
diff --git a/src/gallium/state_trackers/egl/fbdev/native_fbdev.c b/src/gallium/state_trackers/egl/fbdev/native_fbdev.c
index ffd32fa46e5..c0bc7b2462d 100644
--- a/src/gallium/state_trackers/egl/fbdev/native_fbdev.c
+++ b/src/gallium/state_trackers/egl/fbdev/native_fbdev.c
@@ -458,7 +458,7 @@ static const struct native_platform fbdev_platform = {
};
const struct native_platform *
-native_get_platform(void)
+native_get_fbdev_platform(void)
{
return &fbdev_platform;
}
diff --git a/src/gallium/state_trackers/egl/gdi/native_gdi.c b/src/gallium/state_trackers/egl/gdi/native_gdi.c
index ba4ddff2320..4ec229a3f2a 100644
--- a/src/gallium/state_trackers/egl/gdi/native_gdi.c
+++ b/src/gallium/state_trackers/egl/gdi/native_gdi.c
@@ -394,7 +394,7 @@ static const struct native_platform gdi_platform = {
};
const struct native_platform *
-native_get_platform(void)
+native_get_gdi_platform(void)
{
return &gdi_platform;
}
diff --git a/src/gallium/state_trackers/egl/kms/native_kms.c b/src/gallium/state_trackers/egl/kms/native_kms.c
index 8ee80996a4f..dd4ea711405 100644
--- a/src/gallium/state_trackers/egl/kms/native_kms.c
+++ b/src/gallium/state_trackers/egl/kms/native_kms.c
@@ -800,7 +800,7 @@ kms_init_platform(struct native_platform *nplat)
static struct native_platform kms_platform;
const struct native_platform *
-native_get_platform(void)
+native_get_kms_platform(void)
{
kms_init_platform(&kms_platform);
return &kms_platform;
diff --git a/src/gallium/state_trackers/egl/x11/native_x11.c b/src/gallium/state_trackers/egl/x11/native_x11.c
index 6c0201c26f9..7eec563bdfe 100644
--- a/src/gallium/state_trackers/egl/x11/native_x11.c
+++ b/src/gallium/state_trackers/egl/x11/native_x11.c
@@ -149,7 +149,7 @@ x11_init_platform(struct native_platform *nplat)
static struct native_platform x11_platform;
const struct native_platform *
-native_get_platform(void)
+native_get_x11_platform(void)
{
x11_init_platform(&x11_platform);
return &x11_platform;