[Mesa-dev] [PATCH 21/23] targets/egl-static: use inline_drm_helper and Automake.inc helpers

Emil Velikov emil.l.velikov at gmail.com
Sun May 18 00:07:43 PDT 2014


Update all three build systems, and add freedreno to the android
build. Pending future work on the ST we can convert egl-static
to provide either static or dynamic access to the pipe-drivers.

There is no functional change with this patch.

Cc: Chia-I Wu <olv at lunarg.com>
Signed-off-by: Emil Velikov <emil.l.velikov at gmail.com>
---
 configure.ac                               |   1 +
 src/gallium/state_trackers/egl/Makefile.am |  14 +-
 src/gallium/targets/egl-static/Android.mk  |  18 ++-
 src/gallium/targets/egl-static/Makefile.am | 106 +++------------
 src/gallium/targets/egl-static/SConscript  |   3 +-
 src/gallium/targets/egl-static/egl.c       |  21 +--
 src/gallium/targets/egl-static/egl_pipe.c  | 210 -----------------------------
 src/gallium/targets/egl-static/egl_pipe.h  |   3 -
 8 files changed, 47 insertions(+), 329 deletions(-)

diff --git a/configure.ac b/configure.ac
index ec9fcdb8..9e54036 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1247,6 +1247,7 @@ if test "x$enable_gallium_egl" = xyes; then
 
     GALLIUM_STATE_TRACKERS_DIRS="egl $GALLIUM_STATE_TRACKERS_DIRS"
     GALLIUM_TARGET_DIRS="$GALLIUM_TARGET_DIRS egl-static"
+    enable_gallium_loader=yes
 fi
 AM_CONDITIONAL(HAVE_GALLIUM_EGL, test "x$enable_gallium_egl" = xyes)
 
diff --git a/src/gallium/state_trackers/egl/Makefile.am b/src/gallium/state_trackers/egl/Makefile.am
index 26266ed..efe4d20 100644
--- a/src/gallium/state_trackers/egl/Makefile.am
+++ b/src/gallium/state_trackers/egl/Makefile.am
@@ -25,12 +25,20 @@ AUTOMAKE_OPTIONS = subdir-objects
 include Makefile.sources
 include $(top_srcdir)/src/gallium/Automake.inc
 
-AM_CFLAGS = $(GALLIUM_CFLAGS)
+AM_CFLAGS = \
+	$(GALLIUM_CFLAGS) \
+	$(VISIBILITY_CFLAGS)
+
 AM_CPPFLAGS = \
-	$(VISIBILITY_CFLAGS) \
 	-I$(top_srcdir)/src/egl/main \
 	-I$(top_builddir)/src/egl/wayland/wayland-drm/ \
-	-I$(top_srcdir)/include
+	$(GALLIUM_PIPE_LOADER_DEFINES) \
+	-DPIPE_SEARCH_DIR=\"$(libdir)/gallium-pipe\"
+
+if HAVE_GALLIUM_STATIC_TARGETS
+AM_CPPFLAGS += \
+	-DGALLIUM_STATIC_TARGETS=1
+endif
 
 noinst_LTLIBRARIES = libegl.la
 libegl_la_SOURCES = $(common_FILES)
diff --git a/src/gallium/targets/egl-static/Android.mk b/src/gallium/targets/egl-static/Android.mk
index 37244b5..d5acdac 100644
--- a/src/gallium/targets/egl-static/Android.mk
+++ b/src/gallium/targets/egl-static/Android.mk
@@ -33,6 +33,7 @@ LOCAL_SRC_FILES := \
 LOCAL_CFLAGS := \
 	-DFEATURE_ES1=1 \
 	-DFEATURE_ES2=1 \
+	-DGALLIUM_STATIC_TARGETS=1 \
 	-D_EGL_MAIN=_eglBuiltInDriverGALLIUM
 
 LOCAL_C_INCLUDES := \
@@ -53,25 +54,28 @@ LOCAL_C_INCLUDES += \
 endif
 
 ifneq ($(filter i915g, $(MESA_GPU_DRIVERS)),)
-LOCAL_CFLAGS += -D_EGL_PIPE_I915=1
+LOCAL_CFLAGS += -DGALLIUM_I915
 endif
 ifneq ($(filter ilo, $(MESA_GPU_DRIVERS)),)
-LOCAL_CFLAGS += -D_EGL_PIPE_ILO=1
+LOCAL_CFLAGS += -DGALLIUM_ILO
 endif
 ifneq ($(filter nouveau, $(MESA_GPU_DRIVERS)),)
-LOCAL_CFLAGS += -D_EGL_PIPE_NOUVEAU=1
+LOCAL_CFLAGS += -DGALLIUM_NOUVEAU
 endif
 ifneq ($(filter r300g, $(MESA_GPU_DRIVERS)),)
-LOCAL_CFLAGS += -D_EGL_PIPE_R300=1
+LOCAL_CFLAGS += -DGALLIUM_R300
 endif
 ifneq ($(filter r600g, $(MESA_GPU_DRIVERS)),)
-LOCAL_CFLAGS += -D_EGL_PIPE_R600=1
+LOCAL_CFLAGS += -DGALLIUM_R600
 endif
 ifneq ($(filter radeonsi, $(MESA_GPU_DRIVERS)),)
-LOCAL_CFLAGS += -D_EGL_PIPE_RADEONSI=1
+LOCAL_CFLAGS += -DGALLIUM_RADEONSI
 endif
 ifneq ($(filter vmwgfx, $(MESA_GPU_DRIVERS)),)
-LOCAL_CFLAGS += -D_EGL_PIPE_VMWGFX=1
+LOCAL_CFLAGS += -DGALLIUM_VMWGFX
+endif
+ifneq ($(filter freedreno, $(MESA_GPU_DRIVERS)),)
+LOCAL_CFLAGS += -DGALLIUM_FREEDRENO
 endif
 
 LOCAL_MODULE := libmesa_egl_gallium
diff --git a/src/gallium/targets/egl-static/Makefile.am b/src/gallium/targets/egl-static/Makefile.am
index 7a2e555..95300f8 100644
--- a/src/gallium/targets/egl-static/Makefile.am
+++ b/src/gallium/targets/egl-static/Makefile.am
@@ -30,18 +30,14 @@
 #
 include $(top_srcdir)/src/gallium/Automake.inc
 
-AM_CFLAGS = $(PTHREAD_CFLAGS)
+AM_CFLAGS = \
+	$(GALLIUM_TARGET_CFLAGS)
+
 AM_CPPFLAGS = \
-	$(GALLIUM_CFLAGS) \
-	$(VISIBILITY_CFLAGS) \
-	-I$(top_srcdir)/include \
-	-I$(top_srcdir)/src/loader \
-	-I$(top_srcdir)/src/gallium/drivers \
-	-I$(top_srcdir)/src/gallium/winsys \
-	-I$(top_srcdir)/src/gallium/include \
-	-I$(top_srcdir)/src/gallium/auxiliary \
 	-I$(top_srcdir)/src/gallium/state_trackers/egl \
 	-I$(top_srcdir)/src/egl/main \
+	-DGALLIUM_TRACE \
+	-DGALLIUM_RBUG \
 	-D_EGL_MAIN=_eglMain
 
 AM_LDFLAGS = \
@@ -49,6 +45,7 @@ AM_LDFLAGS = \
 	-no-undefined \
 	-avoid-version \
 	-Wl,--version-script=$(top_srcdir)/src/gallium/targets/egl-static/egl.sym \
+	-Wl,--allow-multiple-definition \
 	$(GC_SECTIONS) \
 	$(LD_NO_UNDEFINED)
 
@@ -70,10 +67,6 @@ egl_gallium_la_LIBADD = \
 	$(top_builddir)/src/egl/main/libEGL.la \
 	$(GALLIUM_COMMON_LIB_DEPS)
 
-if HAVE_MESA_LLVM
-AM_LDFLAGS += $(LLVM_LDFLAGS)
-endif
-
 if HAVE_EGL_PLATFORM_X11
 AM_CPPFLAGS += $(LIBDRM_CFLAGS)
 egl_gallium_la_LIBADD += \
@@ -154,90 +147,30 @@ egl_gallium_la_LIBADD += \
 	$(top_builddir)/src/mapi/vgapi/libOpenVG.la
 endif
 
-if HAVE_GALLIUM_I915
-AM_CPPFLAGS += -D_EGL_PIPE_I915=1
-egl_gallium_la_LIBADD += \
-	$(top_builddir)/src/gallium/winsys/i915/drm/libi915drm.la \
-	$(top_builddir)/src/gallium/drivers/i915/libi915.la \
-	$(INTEL_LIBS)
-endif
-
-if HAVE_GALLIUM_ILO
-AM_CPPFLAGS += -D_EGL_PIPE_ILO=1
-egl_gallium_la_LIBADD += \
-	$(top_builddir)/src/gallium/winsys/intel/drm/libintelwinsys.la \
-	$(top_builddir)/src/gallium/drivers/ilo/libilo.la \
-	$(INTEL_LIBS)
-endif
-
-if HAVE_GALLIUM_NOUVEAU
-AM_CPPFLAGS += -D_EGL_PIPE_NOUVEAU=1
-egl_gallium_la_LIBADD += \
-	$(top_builddir)/src/gallium/winsys/nouveau/drm/libnouveaudrm.la \
-	$(top_builddir)/src/gallium/drivers/nouveau/libnouveau.la \
-	$(NOUVEAU_LIBS)
-endif
+#if HAVE_GALLIUM_STATIC_TARGETS
 
-if NEED_RADEON_DRM_WINSYS
-egl_gallium_la_LIBADD += \
-	$(top_builddir)/src/gallium/winsys/radeon/drm/libradeonwinsys.la
-endif
-
-if HAVE_GALLIUM_RADEON_COMMON
-egl_gallium_la_LIBADD += \
-	$(top_builddir)/src/gallium/drivers/radeon/libradeon.la
-endif
+AM_CPPFLAGS += $(STATIC_TARGET_CPPFLAGS)
+egl_gallium_la_LIBADD += $(STATIC_TARGET_LIB_DEPS)
 
 if HAVE_GALLIUM_R300
-AM_CPPFLAGS += -D_EGL_PIPE_R300=1
+if !HAVE_OPENGL
 egl_gallium_la_LIBADD += \
-	$(top_builddir)/src/gallium/drivers/r300/libr300.la \
-	$(RADEON_LIBS)
+	$(top_builddir)/src/gallium/drivers/r300/libr300-helper.la
 endif
-
-if HAVE_GALLIUM_R600
-AM_CPPFLAGS += -D_EGL_PIPE_R600=1
-egl_gallium_la_LIBADD += \
-	$(top_builddir)/src/gallium/drivers/r600/libr600.la \
-	$(RADEON_LIBS)
-endif
-
-if HAVE_GALLIUM_RADEONSI
-AM_CPPFLAGS += -D_EGL_PIPE_RADEONSI=1
-egl_gallium_la_LIBADD += \
-	$(top_builddir)/src/gallium/drivers/radeonsi/libradeonsi.la \
-	$(RADEON_LIBS)
 endif
 
-if HAVE_GALLIUM_SVGA
-AM_CPPFLAGS += -D_EGL_PIPE_VMWGFX=1
-egl_gallium_la_LIBADD += \
-	$(top_builddir)/src/gallium/winsys/svga/drm/libsvgadrm.la \
-	$(top_builddir)/src/gallium/drivers/svga/libsvga.la
-endif
-
-if HAVE_GALLIUM_FREEDRENO
-AM_CPPFLAGS += -D_EGL_PIPE_FREEDRENO=1
-egl_gallium_la_LIBADD += \
-	$(top_builddir)/src/gallium/winsys/freedreno/drm/libfreedrenodrm.la \
-	$(top_builddir)/src/gallium/drivers/freedreno/libfreedreno.la \
-	$(FREEDRENO_LIBS)
-
-endif
+#else
 
-if HAVE_GALLIUM_SOFTPIPE
-AM_CPPFLAGS += -DGALLIUM_SOFTPIPE -DGALLIUM_RBUG -DGALLIUM_TRACE
-egl_gallium_la_LIBADD += \
-	$(top_builddir)/src/gallium/drivers/softpipe/libsoftpipe.la
-endif
+#egl_gallium_la_LIBADD += \
+#	$(top_builddir)/src/gallium/auxiliary/pipe-loader/libpipe_loader.la \
+#	$(GALLIUM_PIPE_LOADER_WINSYS_LIBS) \
+#	$(GALLIUM_PIPE_LOADER_LIBS)
 
-if HAVE_GALLIUM_LLVMPIPE
-AM_CPPFLAGS += -DGALLIUM_LLVMPIPE
-egl_gallium_la_LIBADD += \
-	$(top_builddir)/src/gallium/drivers/llvmpipe/libllvmpipe.la
-endif
+#endif
 
 if HAVE_MESA_LLVM
+
+AM_LDFLAGS += $(LLVM_LDFLAGS)
 egl_gallium_la_LIBADD += $(LLVM_LIBS)
 
 if HAVE_OPENGL
@@ -245,6 +178,7 @@ if !HAVE_SHARED_GLAPI
 st_GL_la_LIBADD += $(LLVM_LIBS)
 endif
 endif
+
 endif
 
 include $(top_srcdir)/install-gallium-links.mk
diff --git a/src/gallium/targets/egl-static/SConscript b/src/gallium/targets/egl-static/SConscript
index afb5c11..ed1c163 100644
--- a/src/gallium/targets/egl-static/SConscript
+++ b/src/gallium/targets/egl-static/SConscript
@@ -23,6 +23,7 @@ env.Append(CPPDEFINES = [
     'GALLIUM_RBUG',
     'GALLIUM_TRACE',
     'GALLIUM_GALAHAD',
+    'GALLIUM_STATIC_TARGETS=1',
     '_EGL_MAIN=_eglBuiltInDriverGALLIUM',
 ])
 
@@ -91,7 +92,7 @@ if env['HAVE_X11']:
 if env['HAVE_DRM']:
     env.PkgUseModules('DRM')
 
-    env.Append(CPPDEFINES = ['_EGL_PIPE_VMWGFX'])
+    env.Append(CPPDEFINES = ['GALLIUM_VMWGFX'])
     env.Prepend(LIBS = [
         svgadrm,
         svga,
diff --git a/src/gallium/targets/egl-static/egl.c b/src/gallium/targets/egl-static/egl.c
index f19f024..b05d35e 100644
--- a/src/gallium/targets/egl-static/egl.c
+++ b/src/gallium/targets/egl-static/egl.c
@@ -32,6 +32,7 @@
 
 #include "egl_pipe.h"
 #include "egl_st.h"
+#include "target-helpers/inline_drm_helper.h"
 
 static struct egl_g3d_loader egl_g3d_loader;
 
@@ -57,25 +58,7 @@ get_st_api(enum st_api_type api)
 static struct pipe_screen *
 create_drm_screen(const char *constname, int fd)
 {
-   struct pipe_screen *screen;
-   char *name = (char *)constname;
-
-   if (!name) {
-      name = loader_get_driver_for_fd(fd, _LOADER_GALLIUM);
-      if (!name)
-         return NULL;
-   }
-
-   screen = egl_pipe_create_drm_screen(name, fd);
-   if (screen)
-      _eglLog(_EGL_INFO, "created a pipe screen for %s", name);
-   else
-      _eglLog(_EGL_WARNING, "failed to create a pipe screen for %s", name);
-
-   if (name != constname)
-      free(name);
-
-   return screen;
+   return dd_create_screen(fd);
 }
 
 static struct pipe_screen *
diff --git a/src/gallium/targets/egl-static/egl_pipe.c b/src/gallium/targets/egl-static/egl_pipe.c
index 4f960a5..c38e4bc 100644
--- a/src/gallium/targets/egl-static/egl_pipe.c
+++ b/src/gallium/targets/egl-static/egl_pipe.c
@@ -28,216 +28,6 @@
 #include "target-helpers/inline_sw_helper.h"
 #include "egl_pipe.h"
 
-/* for i915 */
-#if _EGL_PIPE_I915
-#include "i915/drm/i915_drm_public.h"
-#include "i915/i915_public.h"
-#include "target-helpers/inline_wrapper_sw_helper.h"
-#endif
-/* for ilo */
-#if _EGL_PIPE_ILO
-#include "intel/intel_winsys.h"
-#include "ilo/ilo_public.h"
-#endif
-/* for nouveau */
-#if _EGL_PIPE_NOUVEAU
-#include "nouveau/drm/nouveau_drm_public.h"
-#endif
-/* for r300 */
-#if _EGL_PIPE_R300
-#include "radeon/drm/radeon_winsys.h"
-#include "radeon/drm/radeon_drm_public.h"
-#include "r300/r300_public.h"
-#endif
-/* for r600 */
-#if _EGL_PIPE_R600
-#include "radeon/drm/radeon_winsys.h"
-#include "radeon/drm/radeon_drm_public.h"
-#include "r600/r600_public.h"
-#endif
-/* for radeonsi */
-#if _EGL_PIPE_RADEONSI
-#include "radeon/drm/radeon_winsys.h"
-#include "radeon/drm/radeon_drm_public.h"
-#include "radeonsi/si_public.h"
-#endif
-/* for vmwgfx */
-#if _EGL_PIPE_VMWGFX
-#include "svga/drm/svga_drm_public.h"
-#include "svga/svga_public.h"
-#endif
-/* for freedreno */
-#if _EGL_PIPE_FREEDRENO
-#include "freedreno/drm/freedreno_drm_public.h"
-#endif
-
-static struct pipe_screen *
-pipe_i915_create_screen(int fd)
-{
-#if _EGL_PIPE_I915
-   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;
-#else
-   return NULL;
-#endif
-}
-
-static struct pipe_screen *
-pipe_ilo_create_screen(int fd)
-{
-#if _EGL_PIPE_ILO
-   struct intel_winsys *iws;
-   struct pipe_screen *screen;
-
-   iws = intel_winsys_create_for_fd(fd);
-   if (!iws)
-      return NULL;
-
-   screen = ilo_screen_create(iws);
-   if (!screen)
-      return NULL;
-
-   screen = debug_screen_wrap(screen);
-
-   return screen;
-#else
-   return NULL;
-#endif
-}
-
-static struct pipe_screen *
-pipe_nouveau_create_screen(int fd)
-{
-#if _EGL_PIPE_NOUVEAU
-   struct pipe_screen *screen;
-
-   screen = nouveau_drm_screen_create(fd);
-   if (!screen)
-      return NULL;
-
-   screen = debug_screen_wrap(screen);
-
-   return screen;
-#else
-   return NULL;
-#endif
-}
-
-static struct pipe_screen *
-pipe_r300_create_screen(int fd)
-{
-#if _EGL_PIPE_R300
-   struct radeon_winsys *sws;
-
-   sws = radeon_drm_winsys_create(fd, r300_screen_create);
-   return sws ? debug_screen_wrap(sws->screen) : NULL;
-#else
-   return NULL;
-#endif
-}
-
-static struct pipe_screen *
-pipe_r600_create_screen(int fd)
-{
-#if _EGL_PIPE_R600
-   struct radeon_winsys *rw;
-
-   rw = radeon_drm_winsys_create(fd, r600_screen_create);
-   return rw ? debug_screen_wrap(rw->screen) : NULL;
-#else
-   return NULL;
-#endif
-}
-
-static struct pipe_screen *
-pipe_radeonsi_create_screen(int fd)
-{
-#if _EGL_PIPE_RADEONSI
-   struct radeon_winsys *rw;
-
-   rw = radeon_drm_winsys_create(fd, radeonsi_screen_create);
-   return rw ? debug_screen_wrap(rw->screen) : NULL;
-#else
-   return NULL;
-#endif
-}
-
-static struct pipe_screen *
-pipe_vmwgfx_create_screen(int fd)
-{
-#if _EGL_PIPE_VMWGFX
-   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;
-#else
-   return NULL;
-#endif
-}
-
-static struct pipe_screen *
-pipe_freedreno_create_screen(int fd)
-{
-#if _EGL_PIPE_FREEDRENO
-   struct pipe_screen *screen;
-
-   screen = fd_drm_screen_create(fd);
-   if (!screen)
-      return NULL;
-
-   screen = debug_screen_wrap(screen);
-
-   return screen;
-#else
-   return NULL;
-#endif
-}
-
-struct pipe_screen *
-egl_pipe_create_drm_screen(const char *name, int fd)
-{
-   if (strcmp(name, "i915") == 0)
-      return pipe_i915_create_screen(fd);
-   else if (strcmp(name, "i965") == 0)
-      return pipe_ilo_create_screen(fd);
-   else if (strcmp(name, "nouveau") == 0)
-      return pipe_nouveau_create_screen(fd);
-   else if (strcmp(name, "r300") == 0)
-      return pipe_r300_create_screen(fd);
-   else if (strcmp(name, "r600") == 0)
-      return pipe_r600_create_screen(fd);
-   else if (strcmp(name, "radeonsi") == 0)
-      return pipe_radeonsi_create_screen(fd);
-   else if (strcmp(name, "vmwgfx") == 0)
-      return pipe_vmwgfx_create_screen(fd);
-   else if ((strcmp(name, "kgsl") == 0) || (strcmp(name, "msm") == 0))
-      return pipe_freedreno_create_screen(fd);
-   else
-      return NULL;
-}
-
 struct pipe_screen *
 egl_pipe_create_swrast_screen(struct sw_winsys *ws)
 {
diff --git a/src/gallium/targets/egl-static/egl_pipe.h b/src/gallium/targets/egl-static/egl_pipe.h
index 65d25ba..15cc1c1 100644
--- a/src/gallium/targets/egl-static/egl_pipe.h
+++ b/src/gallium/targets/egl-static/egl_pipe.h
@@ -31,9 +31,6 @@ struct pipe_screen;
 struct sw_winsys;
 
 struct pipe_screen *
-egl_pipe_create_drm_screen(const char *name, int fd);
-
-struct pipe_screen *
 egl_pipe_create_swrast_screen(struct sw_winsys *ws);
 
 #endif /* _EGL_PIPE_H_ */
-- 
1.9.2



More information about the mesa-dev mailing list