targets/dri-swrast: Convert to static/shared pipe-driver
authorEmil Velikov <emil.l.velikov@gmail.com>
Sat, 21 Jun 2014 11:50:10 +0000 (12:50 +0100)
committerEmil Velikov <emil.l.velikov@gmail.com>
Thu, 10 Jul 2014 00:06:49 +0000 (01:06 +0100)
Convert the final dri target to the single DRI (megadriver) library.
Cleanup all the automake leftovers from the conversion stage and
update the scons build.

v2: Link in llvmpipe, when applicable.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Tested-by: Rob Clark <robclark@freedesktop.org>
Tested-by: Thomas Helland <thomashelland90 at gmail.com>
Acked-by: Tom Stellard <thomas.stellard@amd.com>
configure.ac
src/gallium/Automake.inc
src/gallium/SConscript
src/gallium/auxiliary/target-helpers/inline_sw_helper.h
src/gallium/targets/Makefile.am
src/gallium/targets/dri-swrast/Makefile.am [deleted file]
src/gallium/targets/dri-swrast/SConscript [deleted file]
src/gallium/targets/dri-swrast/swrast_drm_api.c [deleted file]
src/gallium/targets/dri/Makefile.am
src/gallium/targets/dri/SConscript
src/gallium/targets/dri/target.c

index b8f15479a7281d5ee0e41e3557786eb7e500e2ae..0d4e26d3527b920f9789a1a8e828679673bc3451 100644 (file)
@@ -1985,7 +1985,7 @@ if test -n "$with_gallium_drivers"; then
             fi
 
             if test "x$enable_dri" = xyes; then
-                GALLIUM_TARGET_DIRS="$GALLIUM_TARGET_DIRS dri-swrast"
+                GALLIUM_TARGET_DIRS="$GALLIUM_TARGET_DIRS dri/swrast"
             fi
             ;;
         *)
@@ -2199,7 +2199,6 @@ AC_CONFIG_FILES([Makefile
                src/gallium/state_trackers/xa/Makefile
                src/gallium/state_trackers/xvmc/Makefile
                src/gallium/targets/Makefile
-               src/gallium/targets/dri-swrast/Makefile
                src/gallium/targets/dri/Makefile
                src/gallium/targets/egl-static/Makefile
                src/gallium/targets/gbm/Makefile
index bef16c8aff60c9252d77e3451faf7690ecf3a57e..73d65a4d10fecc57c6aba563c46ce5cc798ff335 100644 (file)
@@ -26,21 +26,6 @@ GALLIUM_DRIVER_CXXFLAGS = \
        $(DEFINES) \
        $(VISIBILITY_CXXFLAGS)
 
-GALLIUM_DRI_CFLAGS = \
-       -I$(top_srcdir)/include \
-       -I$(top_srcdir)/src/gallium/state_trackers/dri \
-       -I$(top_srcdir)/src/mesa/drivers/dri/common \
-       -I$(top_srcdir)/src/gallium/include \
-       -I$(top_srcdir)/src/gallium/auxiliary \
-       -I$(top_srcdir)/src/gallium/drivers \
-       -I$(top_srcdir)/src/gallium/winsys \
-       -I$(top_srcdir)/src/mesa \
-       -I$(top_srcdir)/src/mapi \
-       $(DEFINES) \
-       $(PTHREAD_CFLAGS) \
-       $(LIBDRM_CFLAGS) \
-       $(VISIBILITY_CFLAGS)
-
 GALLIUM_TARGET_CFLAGS = \
        -I$(top_srcdir)/include \
        -I$(top_srcdir)/src/loader \
@@ -53,35 +38,12 @@ GALLIUM_TARGET_CFLAGS = \
        $(LIBDRM_CFLAGS) \
        $(VISIBILITY_CFLAGS)
 
-
-GALLIUM_DRI_LINKER_FLAGS = \
-       -shared \
-       -shrext .so \
-       -module \
-       -avoid-version \
-       $(GC_SECTIONS)
-
-if HAVE_LD_VERSION_SCRIPT
-GALLIUM_DRI_LINKER_FLAGS += \
-       -Wl,--version-script=$(top_srcdir)/src/gallium/targets/dri/dri.sym
-
-endif
-
-
 GALLIUM_COMMON_LIB_DEPS = \
        -lm \
        $(CLOCK_LIB) \
        $(PTHREAD_LIBS) \
        $(DLOPEN_LIBS)
 
-GALLIUM_DRI_LIB_DEPS = \
-       $(top_builddir)/src/mesa/libmesagallium.la \
-       $(top_builddir)/src/gallium/auxiliary/libgallium.la \
-       $(SELINUX_LIBS) \
-       $(LIBDRM_LIBS) \
-       $(EXPAT_LIBS) \
-       $(GALLIUM_COMMON_LIB_DEPS)
-
 GALLIUM_WINSYS_CFLAGS = \
        -I$(top_srcdir)/include \
        -I$(top_srcdir)/src/gallium/include \
@@ -89,11 +51,6 @@ GALLIUM_WINSYS_CFLAGS = \
        $(DEFINES) \
        $(VISIBILITY_CFLAGS)
 
-if HAVE_MESA_LLVM
-GALLIUM_DRI_LINKER_FLAGS += $(LLVM_LDFLAGS)
-GALLIUM_DRI_LIB_DEPS += $(LLVM_LIBS)
-endif
-
 
 GALLIUM_PIPE_LOADER_WINSYS_LIBS = \
        $(top_builddir)/src/gallium/winsys/sw/null/libws_null.la
index df71b9aeada7daf9aa09d43862de58913305a863..8d9849e00099a20f20aa537064c668ccbf8472c3 100644 (file)
@@ -107,7 +107,6 @@ if not env['embedded']:
 
     if env['dri']:
         SConscript([
-            'targets/dri-swrast/SConscript',
             'targets/dri/SConscript',
         ])
 
index 596c691e9c11f01382beed7a5789d2485d72c049..8a144db09c3943a5e9a5e9a663d3d49003f957ae 100644 (file)
@@ -57,5 +57,41 @@ sw_screen_create(struct sw_winsys *winsys)
    return sw_screen_create_named(winsys, driver);
 }
 
+#if defined(GALLIUM_SOFTPIPE)
+#if defined(DRI_TARGET)
+#include "target-helpers/inline_debug_helper.h"
+#include "sw/dri/dri_sw_winsys.h"
+#include "dri_screen.h"
+
+const __DRIextension **__driDriverGetExtensions_swrast(void);
+
+PUBLIC const __DRIextension **__driDriverGetExtensions_swrast(void)
+{
+   globalDriverAPI = &galliumsw_driver_api;
+   return galliumsw_driver_extensions;
+}
+
+INLINE struct pipe_screen *
+drisw_create_screen(struct drisw_loader_funcs *lf)
+{
+   struct sw_winsys *winsys = NULL;
+   struct pipe_screen *screen = NULL;
+
+   winsys = dri_create_sw_winsys(lf);
+   if (winsys == NULL)
+      return NULL;
+
+   screen = sw_screen_create(winsys);
+   if (screen == NULL) {
+      winsys->destroy(winsys);
+      return NULL;
+   }
+
+   screen = debug_screen_wrap(screen);
+   return screen;
+}
+#endif // DRI_TARGET
+#endif // GALLIUM_SOFTPIPE
+
 
 #endif
index 5e0ecc34a77e8c816c66d6c1b4233665d45357e2..3cacb040a7a6563eb26e8f2b58879493ec43a13e 100644 (file)
@@ -24,6 +24,10 @@ SUBDIRS =
 
 if HAVE_DRI2
 SUBDIRS += dri
+else
+if HAVE_DRISW
+SUBDIRS += dri
+endif
 endif
 
 if HAVE_X11_DRIVER
@@ -58,12 +62,6 @@ if HAVE_CLOVER
 SUBDIRS += opencl
 endif
 
-if HAVE_GALLIUM_SOFTPIPE
-if HAVE_DRISW
-SUBDIRS += dri-swrast
-endif
-endif
-
 if NEED_GALLIUM_LOADER
 SUBDIRS += pipe-loader
 endif
diff --git a/src/gallium/targets/dri-swrast/Makefile.am b/src/gallium/targets/dri-swrast/Makefile.am
deleted file mode 100644 (file)
index 3e3f1c7..0000000
+++ /dev/null
@@ -1,55 +0,0 @@
-# Copyright © 2012 Intel Corporation
-#
-# 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 (including the next
-# paragraph) 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.
-
-include $(top_srcdir)/src/gallium/Automake.inc
-
-AM_CFLAGS = \
-       $(GALLIUM_DRI_CFLAGS)
-AM_CPPFLAGS = \
-       -DGALLIUM_RBUG \
-       -DGALLIUM_TRACE \
-       -DGALLIUM_SOFTPIPE
-
-dridir = $(DRI_DRIVER_INSTALL_DIR)
-dri_LTLIBRARIES = swrast_dri.la
-
-nodist_EXTRA_swrast_dri_la_SOURCES = dummy.cpp
-swrast_dri_la_SOURCES = swrast_drm_api.c
-
-swrast_dri_la_LDFLAGS = $(GALLIUM_DRI_LINKER_FLAGS)
-
-swrast_dri_la_LIBADD = \
-       $(top_builddir)/src/mesa/drivers/dri/common/libdricommon.la \
-       $(top_builddir)/src/mesa/drivers/dri/common/libmegadriver_stub.la \
-       $(top_builddir)/src/gallium/state_trackers/dri/libdri.la \
-       $(top_builddir)/src/gallium/winsys/sw/dri/libswdri.la \
-       $(top_builddir)/src/gallium/drivers/softpipe/libsoftpipe.la \
-       $(top_builddir)/src/gallium/drivers/trace/libtrace.la \
-       $(top_builddir)/src/gallium/drivers/rbug/librbug.la \
-       $(GALLIUM_DRI_LIB_DEPS)
-
-if HAVE_MESA_LLVM
-AM_CPPFLAGS += -DGALLIUM_LLVMPIPE
-swrast_dri_la_LIBADD += $(top_builddir)/src/gallium/drivers/llvmpipe/libllvmpipe.la
-endif
-
-include $(top_srcdir)/install-gallium-links.mk
diff --git a/src/gallium/targets/dri-swrast/SConscript b/src/gallium/targets/dri-swrast/SConscript
deleted file mode 100644 (file)
index 374444b..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-Import('*')
-
-env = drienv.Clone()
-
-env.Append(CPPPATH = [
-    '#/src/loader',
-    '#/src/mapi',
-    '#/src/mesa',
-    '#/src/mesa/drivers/dri/common',
-    '#/src/gallium/state_trackers/dri',
-])
-
-env.Prepend(LIBS = [
-    st_dri,
-    ws_dri,
-    trace,
-    rbug,
-    mesa,
-    glsl,
-    gallium,
-    megadrivers_stub,
-    dri_common,
-])
-
-if True:
-    env.Append(CPPDEFINES = [
-        'GALLIUM_SOFTPIPE',
-        'GALLIUM_RBUG',
-        'GALLIUM_TRACE',
-    ])
-    env.Prepend(LIBS = [softpipe])
-
-if env['llvm']:
-    env.Append(CPPDEFINES = 'GALLIUM_LLVMPIPE')
-    env.Prepend(LIBS = [llvmpipe])
-
-swrast_sources = [
-    'swrast_drm_api.c'
-]
-
-module = env.LoadableModule(
-    target ='swrast_dri.so',
-    source = swrast_sources,
-    SHLIBPREFIX = '',
-)
-
-module = env.InstallSharedLibrary(module)
-
-env.Alias('dri-swrast', module)
diff --git a/src/gallium/targets/dri-swrast/swrast_drm_api.c b/src/gallium/targets/dri-swrast/swrast_drm_api.c
deleted file mode 100644 (file)
index 102d5bd..0000000
+++ /dev/null
@@ -1,74 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2009, VMware, Inc.
- * All Rights Reserved.
- * Copyright 2010 George Sapountzis <gsapountzis@gmail.com>
- *
- * 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, sub license, 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 (including the
- * next paragraph) 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 NON-INFRINGEMENT.
- * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS 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.
- *
- **************************************************************************/
-
-#include "pipe/p_compiler.h"
-#include "util/u_memory.h"
-
-#include "target-helpers/inline_debug_helper.h"
-#include "target-helpers/inline_sw_helper.h"
-
-#include "state_tracker/drm_driver.h"
-#include "sw/dri/dri_sw_winsys.h"
-#include "dri_screen.h"
-
-const __DRIextension **__driDriverGetExtensions_swrast(void);
-
-PUBLIC const __DRIextension **__driDriverGetExtensions_swrast(void)
-{
-   globalDriverAPI = &galliumsw_driver_api;
-   return galliumsw_driver_extensions;
-}
-
-DRM_DRIVER_DESCRIPTOR("swrast", NULL, NULL, NULL);
-
-struct pipe_screen *
-drisw_create_screen(struct drisw_loader_funcs *lf)
-{
-   struct sw_winsys *winsys = NULL;
-   struct pipe_screen *screen = NULL;
-
-   winsys = dri_create_sw_winsys(lf);
-   if (winsys == NULL)
-      return NULL;
-
-   screen = sw_screen_create(winsys);
-   if (!screen)
-      goto fail;
-
-   screen = debug_screen_wrap(screen);
-
-   return screen;
-
-fail:
-   if (winsys)
-      winsys->destroy(winsys);
-
-   return NULL;
-}
-
-/* vim: set sw=3 ts=8 sts=3 expandtab: */
index 4da3e71d6af3401c2ca1bfb4f6139f1ba44a1b5d..61d6bc7aa3ead301ac210f1f1f2b583018536db8 100644 (file)
@@ -140,6 +140,20 @@ STATIC_TARGET_LIB_DEPS += \
 
 endif
 
+if HAVE_GALLIUM_SOFTPIPE
+MEGADRIVERS += swrast
+STATIC_TARGET_CPPFLAGS += -DGALLIUM_SOFTPIPE
+STATIC_TARGET_LIB_DEPS += \
+       $(top_builddir)/src/gallium/winsys/sw/dri/libswdri.la \
+       $(top_builddir)/src/gallium/drivers/softpipe/libsoftpipe.la
+endif
+
+if NEED_GALLIUM_LLVMPIPE_DRIVER
+STATIC_TARGET_CPPFLAGS += -DGALLIUM_LLVMPIPE
+STATIC_TARGET_LIB_DEPS += \
+       $(top_builddir)/src/gallium/drivers/llvmpipe/libllvmpipe.la
+endif
+
 gallium_dri_la_SOURCES += target.c
 AM_CPPFLAGS += $(STATIC_TARGET_CPPFLAGS)
 gallium_dri_la_LIBADD += $(STATIC_TARGET_LIB_DEPS)
index 27e2047740e4db1d93fa8e0bc4dc7d0e50cf4910..faf370f2c34e3efe542946b875dca1010565c779 100644 (file)
@@ -18,11 +18,16 @@ if env['build'] == 'release':
     env.Append(CPPDEFINES = ['GALLIUM_RBUG'])
     env.Prepend(LIBS = [rbug])
 else:
-    env.Append(CPPDEFINES = ['GALLIUM_TRACE', 'GALLIUM_RBUG', 'GALLIUM_GALAHAD', 'GALLIUM_SOFTPIPE'])
-    env.Prepend(LIBS = [trace, rbug, galahad, softpipe, ws_wrapper])
+    env.Append(CPPDEFINES = ['GALLIUM_TRACE', 'GALLIUM_RBUG', 'GALLIUM_GALAHAD'])
+    env.Prepend(LIBS = [trace, rbug, galahad])
+
+if env['llvm']:
+    env.Append(CPPDEFINES = 'GALLIUM_LLVMPIPE')
+    env.Prepend(LIBS = [llvmpipe])
 
 env.Append(CPPDEFINES = [
     'GALLIUM_VMWGFX',
+    'GALLIUM_SOFTPIPE',
     'DRI_TARGET',
 ])
 
@@ -30,6 +35,8 @@ env.Prepend(LIBS = [
     st_dri,
     svgadrm,
     svga,
+    ws_dri,
+    softpipe,
     libloader,
     mesa,
     glsl,
@@ -39,9 +46,15 @@ env.Prepend(LIBS = [
 ])
 
 module = env.LoadableModule(
-    target = 'vmwgfx_dri.so',
+    target = 'gallium_dri.so',
     source = 'target.c',
     SHLIBPREFIX = '',
 )
 
+# vmwgfx_dri.so
+env.Command('vmwgfx_dri.so', 'gallium_dri.so', "ln -f ${SOURCE} ${TARGET}")
+# swrast_dri.so
+env.Command('swrast_dri.so', 'gallium_dri.so', "ln -f ${SOURCE} ${TARGET}")
+
 env.Alias('dri-vmwgfx', module)
+env.Alias('dri-swrast', module)
index fde4a4a7dcfc59615a0c82c473297e7fa9ce58d8..32a11ef6281b448dd5189472d0a191ae6c7f773a 100644 (file)
@@ -1 +1,2 @@
 #include "target-helpers/inline_drm_helper.h"
+#include "target-helpers/inline_sw_helper.h"