summaryrefslogtreecommitdiffstats
path: root/src/gallium/targets/egl
diff options
context:
space:
mode:
authorChia-I Wu <[email protected]>2010-06-29 14:04:27 +0800
committerChia-I Wu <[email protected]>2010-06-29 17:16:20 +0800
commitd8e0e114567ec19fd59f974080a418dc959cc9b6 (patch)
treee4e435f5ad82ac3c521fc595bc51895ad4dfcc1b /src/gallium/targets/egl
parentea05299ce54ea0463626277907cab8e849884740 (diff)
st/egl: Reorganize targets.
Merge all targets into targets/egl/. The target produces egl_gallium_<HW>.so for each pipe driver and st_<API>.so for each client APIs. This enables us to further merge egl_gallium_<HW>.so into egl_gallium.so later.
Diffstat (limited to 'src/gallium/targets/egl')
-rw-r--r--src/gallium/targets/egl/Makefile208
-rw-r--r--src/gallium/targets/egl/SConscript46
-rw-r--r--src/gallium/targets/egl/pipe_i965.c34
-rw-r--r--src/gallium/targets/egl/pipe_nouveau.c24
-rw-r--r--src/gallium/targets/egl/pipe_radeon.c30
-rw-r--r--src/gallium/targets/egl/pipe_swrast.c8
-rw-r--r--src/gallium/targets/egl/pipe_vmwgfx.c30
-rw-r--r--src/gallium/targets/egl/st_GL.c25
-rw-r--r--src/gallium/targets/egl/st_GLESv1_CM.c7
-rw-r--r--src/gallium/targets/egl/st_GLESv2.c7
-rw-r--r--src/gallium/targets/egl/st_OpenVG.c8
11 files changed, 427 insertions, 0 deletions
diff --git a/src/gallium/targets/egl/Makefile b/src/gallium/targets/egl/Makefile
new file mode 100644
index 00000000000..364a31dc450
--- /dev/null
+++ b/src/gallium/targets/egl/Makefile
@@ -0,0 +1,208 @@
+# src/gallium/targets/egl/Makefile
+#
+# This is the Makefile for EGL Gallium driver package. The package consists of
+#
+# egl_gallium_<HW>.so - EGL 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
+
+common_CPPFLAGS := \
+ -I$(TOP)/src/gallium/auxiliary \
+ -I$(TOP)/src/gallium/drivers \
+ -I$(TOP)/src/gallium/include \
+ -I$(TOP)/src/gallium/winsys
+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
+egl_SYS := -lm -ldl -lEGL
+egl_LIBS := \
+ $(TOP)/src/gallium/state_trackers/egl/libegl.a \
+ $(TOP)/src/gallium/drivers/softpipe/libsoftpipe.a
+
+ifneq ($(findstring x11, $(EGL_PLATFORMS)),)
+egl_SYS += -lX11 -lXext -lXfixes
+egl_LIBS += $(TOP)/src/gallium/winsys/sw/xlib/libws_xlib.a
+endif
+ifneq ($(findstring kms, $(EGL_PLATFORMS)),)
+egl_SYS += -ldrm
+endif
+ifneq ($(findstring fbdev, $(EGL_PLATFORMS)),)
+egl_LIBS += $(TOP)/src/gallium/winsys/sw/fbdev/libfbdev.a
+endif
+
+# LLVM
+ifeq ($(MESA_LLVM),1)
+common_SYS += $(LLVM_LIBS)
+egl_LIBS += $(TOP)/src/gallium/drivers/llvmpipe/libllvmpipe.a
+LDFLAGS += $(LLVM_LDFLAGS)
+endif
+
+# 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
+
+# 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/nouveau/libnouveau.a
+
+# radeon pipe driver
+radeon_CPPFLAGS :=
+radeon_SYS := -ldrm -ldrm_radeon
+radeon_LIBS := \
+ $(TOP)/src/gallium/winsys/radeon/drm/libradeonwinsys.a \
+ $(TOP)/src/gallium/drivers/r300/libr300.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 :=
+swrast_SYS :=
+swrast_LIBS :=
+
+# OpenGL state tracker
+GL_CPPFLAGS := -I$(TOP)/src/mesa $(API_DEFINES)
+GL_SYS := -lpthread -lm -L$(TOP)/$(LIB_DIR) -l$(GL_LIB)
+GL_LIBS := $(TOP)/src/mesa/libmesagallium.a
+
+# OpenGL ES 1.x state tracker
+GLESv1_CM_CPPFLAGS := -I$(TOP)/src/mesa
+GLESv1_CM_SYS := -lpthread -lm -L$(TOP)/$(LIB_DIR) -l$(GLESv1_CM_LIB)
+GLESv1_CM_LIBS := $(TOP)/src/mesa/libes1gallium.a
+
+# OpenGL ES 2.x state tracker
+GLESv2_CPPFLAGS := -I$(TOP)/src/mesa
+GLESv2_SYS := -lpthread -lm -L$(TOP)/$(LIB_DIR) -l$(GLESv2_LIB)
+GLESv2_LIBS := $(TOP)/src/mesa/libes2gallium.a
+
+# OpenVG state tracker
+OpenVG_CPPFLAGS := -I$(TOP)/src/gallium/state_trackers/vega
+OpenVG_SYS := -lm -L$(TOP)/$(LIB_DIR) -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,$(GALLIUM_WINSYS_DIRS)),)
+OUTPUTS += i915
+endif
+ifneq ($(findstring i965,$(GALLIUM_WINSYS_DIRS)),)
+OUTPUTS += i965
+endif
+ifneq ($(findstring nouveau,$(GALLIUM_WINSYS_DIRS)),)
+OUTPUTS += nouveau
+endif
+ifneq ($(findstring r300,$(GALLIUM_WINSYS_DIRS)),)
+OUTPUTS += radeon
+endif
+ifneq ($(findstring svga,$(GALLIUM_WINSYS_DIRS)),)
+OUTPUTS += vmwgfx
+endif
+OUTPUTS += swrast
+OUTPUTS := $(addprefix egl_gallium_, $(OUTPUTS))
+
+# state trackers
+OUTPUTS += $(addprefix st_, $(EGL_CLIENT_APIS))
+
+OUTPUTS := $(addsuffix .so, $(OUTPUTS))
+OUTPUTS := $(addprefix $(OUTPUT_PATH)/, $(OUTPUTS))
+
+default: $(OUTPUTS)
+
+define mklib-egl
+$(MKLIB) -o $(notdir $@) -noprefix -linker '$(CC)' -ldflags '$(LDFLAGS)' \
+ -install $(OUTPUT_PATH) $(MKLIB_OPTIONS) $< \
+ -Wl,--start-group $(common_LIBS) $(egl_LIBS) $($(1)_LIBS) -Wl,--end-group \
+ $(common_SYS) $(egl_SYS) $($(1)_SYS)
+endef
+
+define mklib
+$(MKLIB) -o $(notdir $@) -noprefix -linker '$(CC)' -ldflags '$(LDFLAGS)' \
+ -install $(OUTPUT_PATH) $(MKLIB_OPTIONS) $< \
+ -Wl,--start-group $(common_LIBS) $($(1)_LIBS) -Wl,--end-group \
+ $(common_SYS) $($(1)_SYS)
+endef
+
+# EGL drivers
+$(OUTPUT_PATH)/egl_gallium_i915.so: pipe_i915.o $(egl_LIBS) $(i915_LIBS)
+ $(call mklib-egl,i915)
+
+$(OUTPUT_PATH)/egl_gallium_i965.so: pipe_i965.o $(egl_LIBS) $(i965_LIBS)
+ $(call mklib-egl,i965)
+
+$(OUTPUT_PATH)/egl_gallium_nouveau.so: pipe_nouveau.o $(egl_LIBS) $(nouveau_LIBS)
+ $(call mklib-egl,nouveau)
+
+$(OUTPUT_PATH)/egl_gallium_radeon.so: pipe_radeon.o $(egl_LIBS) $(radeon_LIBS)
+ $(call mklib-egl,radeon)
+
+$(OUTPUT_PATH)/egl_gallium_vmwgfx.so: pipe_vmwgfx.o $(egl_LIBS) $(vmwgfx_LIBS)
+ $(call mklib-egl,vmwgfx)
+
+$(OUTPUT_PATH)/egl_gallium_swrast.so: pipe_swrast.o $(egl_LIBS) $(swrast_LIBS)
+ $(call mklib-egl,swrast)
+
+# state trackers
+$(OUTPUT_PATH)/st_$(GL_LIB).so: st_GL.o $(GL_LIBS)
+ $(call mklib,GL)
+
+$(OUTPUT_PATH)/st_$(GLESv1_CM_LIB).so: st_GLESv1_CM.o $(GLESv1_CM_LIBS)
+ $(call mklib,GLESv1_CM)
+
+$(OUTPUT_PATH)/st_$(GLESv2_LIB).so: st_GLESv2.o $(GLESv2_LIBS)
+ $(call mklib,GLESv2)
+
+$(OUTPUT_PATH)/st_$(VG_LIB).so: st_OpenVG.o $(OpenVG_LIBS)
+ $(call mklib,OpenVG)
+
+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
diff --git a/src/gallium/targets/egl/SConscript b/src/gallium/targets/egl/SConscript
new file mode 100644
index 00000000000..c743c26cf6f
--- /dev/null
+++ b/src/gallium/targets/egl/SConscript
@@ -0,0 +1,46 @@
+#######################################################################
+# SConscript for egl-apis target
+
+Import('*')
+
+if env['platform'] == 'windows':
+
+ env = env.Clone()
+
+ env.Append(CPPPATH = [
+ '#/src/gallium/state_trackers/vega',
+ ])
+
+ env.Append(LIBS = [
+ 'gdi32',
+ 'user32',
+ 'kernel32',
+ 'ws2_32',
+ ])
+
+ env['no_import_lib'] = 1
+
+ drivers = [softpipe]
+ if env['llvm']:
+ drivers += [llvmpipe]
+ drivers += [identity, trace, rbug]
+
+ egl_gallium_swrast = env.SharedLibrary(
+ target ='egl_gallium_swrast',
+ source = 'pipe_swrast.c',
+ LIBS = st_egl_gdi + ws_gdi + drivers + gallium + egl + env['LIBS'],
+ )
+
+ env.InstallSharedLibrary(egl_gallium_swrast)
+
+ api_libs = {
+ 'OpenVG': vgapi + st_vega,
+ }
+
+ for name in api_libs.keys():
+ api = env.SharedLibrary(
+ target = 'st_' + name,
+ source = ['st_' + name + '.c'],
+ LIBS = api_libs[name] + gallium + env['LIBS'],
+ )
+ env.InstallSharedLibrary(api)
diff --git a/src/gallium/targets/egl/pipe_i965.c b/src/gallium/targets/egl/pipe_i965.c
new file mode 100644
index 00000000000..d19c83a47d3
--- /dev/null
+++ b/src/gallium/targets/egl/pipe_i965.c
@@ -0,0 +1,34 @@
+
+#include "target-helpers/inline_wrapper_sw_helper.h"
+#include "target-helpers/inline_debug_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;
+
+ if (debug_get_bool_option("BRW_SOFTPIPE", FALSE))
+ screen = sw_screen_wrap(screen);
+
+ screen = debug_screen_wrap(screen);
+
+ return screen;
+}
+
+DRM_DRIVER_DESCRIPTOR("i965", "i965", create_screen)
+
+/* A poor man's --whole-archive for EGL drivers */
+void *_eglMain(void *);
+void *_eglWholeArchive = (void *) _eglMain;
diff --git a/src/gallium/targets/egl/pipe_nouveau.c b/src/gallium/targets/egl/pipe_nouveau.c
new file mode 100644
index 00000000000..cf569ea62c8
--- /dev/null
+++ b/src/gallium/targets/egl/pipe_nouveau.c
@@ -0,0 +1,24 @@
+
+#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;
+}
+
+DRM_DRIVER_DESCRIPTOR("nouveau", "nouveau", create_screen)
+
+/* A poor man's --whole-archive for EGL drivers */
+void *_eglMain(void *);
+void *_eglWholeArchive = (void *) _eglMain;
diff --git a/src/gallium/targets/egl/pipe_radeon.c b/src/gallium/targets/egl/pipe_radeon.c
new file mode 100644
index 00000000000..ce07327b8fc
--- /dev/null
+++ b/src/gallium/targets/egl/pipe_radeon.c
@@ -0,0 +1,30 @@
+
+#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 r300_winsys_screen *sws;
+ struct pipe_screen *screen;
+
+ sws = r300_drm_winsys_screen_create(fd);
+ if (!sws)
+ return NULL;
+
+ screen = r300_screen_create(sws);
+ if (!screen)
+ return NULL;
+
+ screen = debug_screen_wrap(screen);
+
+ return screen;
+}
+
+DRM_DRIVER_DESCRIPTOR("radeon", "radeon", create_screen)
+
+/* A poor man's --whole-archive for EGL drivers */
+void *_eglMain(void *);
+void *_eglWholeArchive = (void *) _eglMain;
diff --git a/src/gallium/targets/egl/pipe_swrast.c b/src/gallium/targets/egl/pipe_swrast.c
new file mode 100644
index 00000000000..d8205c158e6
--- /dev/null
+++ b/src/gallium/targets/egl/pipe_swrast.c
@@ -0,0 +1,8 @@
+
+#include "state_tracker/drm_driver.h"
+
+DRM_DRIVER_DESCRIPTOR("swrast", NULL, NULL)
+
+/* A poor man's --whole-archive for EGL drivers */
+void *_eglMain(void *);
+void *_eglWholeArchive = (void *) _eglMain;
diff --git a/src/gallium/targets/egl/pipe_vmwgfx.c b/src/gallium/targets/egl/pipe_vmwgfx.c
new file mode 100644
index 00000000000..4e9f51c5dc4
--- /dev/null
+++ b/src/gallium/targets/egl/pipe_vmwgfx.c
@@ -0,0 +1,30 @@
+
+#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;
+}
+
+DRM_DRIVER_DESCRIPTOR("vmwgfx", "vmwgfx", create_screen)
+
+/* A poor man's --whole-archive for EGL drivers */
+void *_eglMain(void *);
+void *_eglWholeArchive = (void *) _eglMain;
diff --git a/src/gallium/targets/egl/st_GL.c b/src/gallium/targets/egl/st_GL.c
new file mode 100644
index 00000000000..676300b0cc1
--- /dev/null
+++ b/src/gallium/targets/egl/st_GL.c
@@ -0,0 +1,25 @@
+#include "state_tracker/st_gl_api.h"
+
+#if FEATURE_GL
+PUBLIC struct st_api *
+st_api_create_OpenGL(void)
+{
+ return st_gl_api_create();
+}
+#endif
+
+#if FEATURE_ES1
+PUBLIC struct st_api *
+st_api_create_OpenGL_ES1(void)
+{
+ return st_gl_api_create_es1();
+}
+#endif
+
+#if FEATURE_ES2
+PUBLIC struct st_api *
+st_api_create_OpenGL_ES2(void)
+{
+ return st_gl_api_create_es2();
+}
+#endif
diff --git a/src/gallium/targets/egl/st_GLESv1_CM.c b/src/gallium/targets/egl/st_GLESv1_CM.c
new file mode 100644
index 00000000000..0c8de8992f3
--- /dev/null
+++ b/src/gallium/targets/egl/st_GLESv1_CM.c
@@ -0,0 +1,7 @@
+#include "state_tracker/st_gl_api.h"
+
+PUBLIC struct st_api *
+st_api_create_OpenGL_ES1(void)
+{
+ return st_gl_api_create_es1();
+}
diff --git a/src/gallium/targets/egl/st_GLESv2.c b/src/gallium/targets/egl/st_GLESv2.c
new file mode 100644
index 00000000000..87b3e65e239
--- /dev/null
+++ b/src/gallium/targets/egl/st_GLESv2.c
@@ -0,0 +1,7 @@
+#include "state_tracker/st_gl_api.h"
+
+PUBLIC struct st_api *
+st_api_create_OpenGL_ES2(void)
+{
+ return st_gl_api_create_es2();
+}
diff --git a/src/gallium/targets/egl/st_OpenVG.c b/src/gallium/targets/egl/st_OpenVG.c
new file mode 100644
index 00000000000..e29a2374792
--- /dev/null
+++ b/src/gallium/targets/egl/st_OpenVG.c
@@ -0,0 +1,8 @@
+#include "state_tracker/st_api.h"
+#include "vg_api.h"
+
+PUBLIC struct st_api *
+st_api_create_OpenVG(void)
+{
+ return (struct st_api *) vg_api_get();
+}