targets/dri-swrast: Convert to static/shared pipe-driver

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>
This commit is contained in:
Emil Velikov 2014-06-21 12:50:10 +01:00
parent 29ca7d2c94
commit 0bdc3e1afd
11 changed files with 72 additions and 233 deletions

View 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

View 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

View file

@ -107,7 +107,6 @@ if not env['embedded']:
if env['dri']:
SConscript([
'targets/dri-swrast/SConscript',
'targets/dri/SConscript',
])

View 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

View 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

View file

@ -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

View file

@ -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)

View file

@ -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: */

View 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)

View 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)

View file

@ -1 +1,2 @@
#include "target-helpers/inline_drm_helper.h"
#include "target-helpers/inline_sw_helper.h"