diff options
Diffstat (limited to 'mesalib')
-rw-r--r-- | mesalib/configure.ac | 81 | ||||
-rw-r--r-- | mesalib/install-gallium-links.mk | 2 | ||||
-rw-r--r-- | mesalib/install-lib-links.mk | 2 | ||||
-rw-r--r-- | mesalib/src/gallium/Automake.inc | 46 | ||||
-rw-r--r-- | mesalib/src/mesa/drivers/dri/Makefile.am | 1 | ||||
-rw-r--r-- | mesalib/src/mesa/drivers/dri/common/Makefile.am | 2 | ||||
-rw-r--r-- | mesalib/src/mesa/main/formats.c | 20 | ||||
-rw-r--r-- | mesalib/src/mesa/main/texstore.c | 10 | ||||
-rw-r--r-- | mesalib/src/mesa/state_tracker/st_format.c | 6 |
9 files changed, 128 insertions, 42 deletions
diff --git a/mesalib/configure.ac b/mesalib/configure.ac index 1e5e49667..af1b0d1fa 100644 --- a/mesalib/configure.ac +++ b/mesalib/configure.ac @@ -284,15 +284,18 @@ dnl Can't have static and shared libraries, default to static if user dnl explicitly requested. If both disabled, set to static since shared dnl was explicitly requested. case "x$enable_static$enable_shared" in -xnoyes ) +xyesyes) + AC_MSG_WARN([Cannot build static and shared libraries, disabling shared]) + enable_shared=no ;; -* ) - AC_MSG_WARN([Messa build supports only shared libraries, enabling shared]) +xnono) + AC_MSG_WARN([Cannot disable both static and shared libraries, enabling shared]) enable_shared=yes - enable_static=no ;; esac +AM_CONDITIONAL(BUILD_SHARED, test "x$enable_shared" = xyes) + dnl dnl other compiler options dnl @@ -313,6 +316,22 @@ if test "x$enable_debug" = xyes; then fi dnl +dnl Check if linker supports garbage collection +dnl +save_LDFLAGS=$LDFLAGS +LDFLAGS="$LDFLAGS -Wl,--gc-sections" +AC_MSG_CHECKING([whether ld supports --gc-sections]) +AC_LINK_IFELSE( + [AC_LANG_SOURCE([static char UnusedFunc() { return 5; } int main() { return 0;}])], + [AC_MSG_RESULT([yes]) + GC_SECTIONS="-Wl,--gc-sections";], + [AC_MSG_RESULT([no]) + GC_SECTIONS="";]) +LDFLAGS=$save_LDFLAGS + +AC_SUBST([GC_SECTIONS]) + +dnl dnl compatibility symlinks dnl case "$host_os" in @@ -527,11 +546,20 @@ AC_ARG_ENABLE([dri], [enable DRI modules @<:@default=enabled@:>@])], [enable_dri="$enableval"], [enable_dri=yes]) + +case "$host_os" in +linux*) + dri3_default=yes + ;; +*) + dri3_default=no + ;; +esac AC_ARG_ENABLE([dri3], [AS_HELP_STRING([--enable-dri3], - [enable DRI3 @<:@default=enabled@:>@])], + [enable DRI3 @<:@default=auto@:>@])], [enable_dri3="$enableval"], - [enable_dri3=yes]) + [enable_dri3="$dri3_default"]) AC_ARG_ENABLE([glx], [AS_HELP_STRING([--enable-glx], [enable GLX library @<:@default=enabled@:>@])], @@ -750,8 +778,8 @@ if test "x$enable_dri" = xyes; then fi if test "x$enable_gallium_osmesa" = xyes; then - if test -z "$with_gallium_drivers"; then - AC_MSG_ERROR([Cannot enable gallium_osmesa without Gallium]) + if ! echo "$with_gallium_drivers" | grep -q 'swrast'; then + AC_MSG_ERROR([gallium_osmesa requires the gallium swrast driver]) fi if test "x$enable_osmesa" = xyes; then AC_MSG_ERROR([Cannot enable both classic and Gallium OSMesa implementations]) @@ -773,6 +801,10 @@ PKG_CHECK_MODULES([LIBUDEV], [libudev >= $LIBUDEV_REQUIRED], have_libudev=yes, have_libudev=no) if test "x$enable_dri" = xyes; then + if test "$enable_static" = yes; then + AC_MSG_ERROR([Cannot use static libraries for DRI drivers]) + fi + # not a hard requirement as swrast does not depend on it if test "x$have_libdrm" = xyes; then DRI_PC_REQ_PRIV="libdrm >= $LIBDRM_REQUIRED" @@ -823,9 +855,6 @@ xyesno) PKG_CHECK_MODULES([DRI2PROTO], [dri2proto >= $DRI2PROTO_REQUIRED]) GL_PC_REQ_PRIV="$GL_PC_REQ_PRIV libdrm >= $LIBDRM_REQUIRED" if test x"$enable_dri3" = xyes; then - if test x"$have_libudev" != xyes; then - AC_MSG_ERROR([DRI3 requires libudev >= $LIBUDEV_REQUIRED]) - fi PKG_CHECK_MODULES([DRI3PROTO], [dri3proto >= $DRI3PROTO_REQUIRED]) PKG_CHECK_MODULES([PRESENTPROTO], [presentproto >= $PRESENTPROTO_REQUIRED]) fi @@ -978,7 +1007,7 @@ if test "x$enable_dri" = xyes; then gnu*) DEFINES="$DEFINES -DUSE_EXTERNAL_DXTN_LIB=1" DEFINES="$DEFINES -DHAVE_ALIAS" - ;; + ;; solaris*) DEFINES="$DEFINES -DUSE_EXTERNAL_DXTN_LIB=1" ;; @@ -1104,7 +1133,12 @@ x16|x32) esac if test "x$enable_osmesa" = xyes -o "x$enable_gallium_osmesa" = xyes; then - OSMESA_LIB_DEPS="-lm $PTHREAD_LIBS $SELINUX_LIBS $DLOPEN_LIBS" + # only link libraries with osmesa if shared + if test "$enable_static" = no; then + OSMESA_LIB_DEPS="-lm $PTHREAD_LIBS $SELINUX_LIBS $DLOPEN_LIBS" + else + OSMESA_LIB_DEPS="" + fi OSMESA_MESA_DEPS="" OSMESA_PC_LIB_PRIV="-lm $PTHREAD_LIBS $SELINUX_LIBS $DLOPEN_LIBS" fi @@ -1153,8 +1187,11 @@ if test "x$enable_egl" = xyes; then AC_CHECK_FUNC(mincore, [DEFINES="$DEFINES -DHAVE_MINCORE"]) - if test "x$enable_dri" = xyes; then - HAVE_EGL_DRIVER_DRI2=1 + if test "$enable_static" != yes; then + if test "x$enable_dri" = xyes; then + HAVE_EGL_DRIVER_DRI2=1 + fi + fi fi AM_CONDITIONAL(HAVE_EGL, test "x$enable_egl" = xyes) @@ -1252,7 +1289,7 @@ AM_CONDITIONAL(HAVE_OPENVG, test "x$enable_openvg" = xyes) dnl dnl Gallium G3DVL configuration dnl -if test -n "$with_gallium_drivers"; then +if test -n "$with_gallium_drivers" && ! echo "$with_gallium_drivers" | grep -q 'swrast'; then if test "x$enable_xvmc" = xauto; then PKG_CHECK_EXISTS([xvmc], [enable_xvmc=yes], [enable_xvmc=no]) fi @@ -1435,15 +1472,15 @@ else EGL_NATIVE_PLATFORM="_EGL_INVALID_PLATFORM" fi -if echo "$egl_platforms" | grep 'x11' >/dev/null 2>&1; then +if echo "$egl_platforms" | grep -q 'x11'; then GALLIUM_WINSYS_DIRS="$GALLIUM_WINSYS_DIRS sw/xlib" NEED_WINSYS_XLIB=yes fi -AM_CONDITIONAL(HAVE_EGL_PLATFORM_X11, echo "$egl_platforms" | grep 'x11' >/dev/null 2>&1) -AM_CONDITIONAL(HAVE_EGL_PLATFORM_WAYLAND, echo "$egl_platforms" | grep 'wayland' >/dev/null 2>&1) -AM_CONDITIONAL(HAVE_EGL_PLATFORM_DRM, echo "$egl_platforms" | grep 'drm' >/dev/null 2>&1) -AM_CONDITIONAL(HAVE_EGL_PLATFORM_FBDEV, echo "$egl_platforms" | grep 'fbdev' >/dev/null 2>&1) -AM_CONDITIONAL(HAVE_EGL_PLATFORM_NULL, echo "$egl_platforms" | grep 'null' >/dev/null 2>&1) +AM_CONDITIONAL(HAVE_EGL_PLATFORM_X11, echo "$egl_platforms" | grep -q 'x11') +AM_CONDITIONAL(HAVE_EGL_PLATFORM_WAYLAND, echo "$egl_platforms" | grep -q 'wayland') +AM_CONDITIONAL(HAVE_EGL_PLATFORM_DRM, echo "$egl_platforms" | grep -q 'drm') +AM_CONDITIONAL(HAVE_EGL_PLATFORM_FBDEV, echo "$egl_platforms" | grep -q 'fbdev') +AM_CONDITIONAL(HAVE_EGL_PLATFORM_NULL, echo "$egl_platforms" | grep -q 'null') AM_CONDITIONAL(HAVE_EGL_DRIVER_DRI2, test "x$HAVE_EGL_DRIVER_DRI2" != "x") diff --git a/mesalib/install-gallium-links.mk b/mesalib/install-gallium-links.mk index 5ee923b25..6ed8a24a7 100644 --- a/mesalib/install-gallium-links.mk +++ b/mesalib/install-gallium-links.mk @@ -1,6 +1,7 @@ # Provide compatibility with scripts for the old Mesa build system for # a while by putting a link to the driver into /lib of the build tree. +if BUILD_SHARED if HAVE_COMPAT_SYMLINKS all-local : .libs/install-gallium-links @@ -23,3 +24,4 @@ all-local : .libs/install-gallium-links fi; \ done && touch $@ endif +endif diff --git a/mesalib/install-lib-links.mk b/mesalib/install-lib-links.mk index 0e1371987..09fb86a0b 100644 --- a/mesalib/install-lib-links.mk +++ b/mesalib/install-lib-links.mk @@ -1,6 +1,7 @@ # Provide compatibility with scripts for the old Mesa build system for # a while by putting a link to the driver into /lib of the build tree. +if BUILD_SHARED if HAVE_COMPAT_SYMLINKS all-local : .libs/install-mesa-links @@ -14,3 +15,4 @@ all-local : .libs/install-mesa-links fi; \ done && touch $@ endif +endif diff --git a/mesalib/src/gallium/Automake.inc b/mesalib/src/gallium/Automake.inc index 1acc99ef5..56f1433a0 100644 --- a/mesalib/src/gallium/Automake.inc +++ b/mesalib/src/gallium/Automake.inc @@ -54,25 +54,37 @@ GALLIUM_VIDEO_CFLAGS = \ DRI_VERSION_SCRIPT ?= $(top_srcdir)/src/gallium/state_trackers/dri/dri.link GALLIUM_DRI_LINKER_FLAGS = \ + -shared \ -module \ -avoid-version \ - -Wl,--version-script=$(DRI_VERSION_SCRIPT) \ - -shared \ - -no-undefined + $(GC_SECTIONS) \ + -Wl,--version-script=$(DRI_VERSION_SCRIPT) GALLIUM_VDPAU_LINKER_FLAGS = \ + -shared \ -module \ + -no-undefined \ -version-number $(VDPAU_MAJOR):$(VDPAU_MINOR) \ -export-symbols-regex $(VDPAU_EXPORTS) \ - -shared \ - -no-undefined + $(GC_SECTIONS) \ + -Wl,--no-undefined GALLIUM_XVMC_LINKER_FLAGS = \ + -shared \ -module \ + -no-undefined \ -version-number $(XVMC_MAJOR):$(XVMC_MINOR) \ - -shared \ -export-symbols-regex '^XvMC' \ - -no-undefined + $(GC_SECTIONS) \ + -Wl,--no-undefined + +GALLIUM_OMX_LINKER_FLAGS = \ + -shared \ + -module \ + -no-undefined \ + -export-symbols-regex $(EXPORTS) \ + $(GC_SECTIONS) \ + -Wl,--no-undefined GALLIUM_VDPAU_LIB_DEPS = \ $(top_builddir)/src/gallium/auxiliary/libgallium.la \ @@ -90,9 +102,29 @@ GALLIUM_XVMC_LIB_DEPS = \ $(XVMC_LIBS) \ $(LIBDRM_LIBS) +GALLIUM_OMX_LIB_DEPS = \ + $(top_builddir)/src/gallium/auxiliary/libgallium.la \ + $(top_builddir)/src/gallium/state_trackers/omx/libomxtracker.la \ + $(GALLIUM_DRI_LIB_DEPS) \ + $(OMX_LIBS) + GALLIUM_WINSYS_CFLAGS = \ -I$(top_srcdir)/include \ -I$(top_srcdir)/src/gallium/include \ -I$(top_srcdir)/src/gallium/auxiliary \ $(DEFINES) \ $(VISIBILITY_CFLAGS) + +if HAVE_MESA_LLVM + +GALLIUM_DRI_LINKER_FLAGS += $(LLVM_LDFLAGS) +GALLIUM_VDPAU_LINKER_FLAGS += $(LLVM_LDFLAGS) +GALLIUM_XVMC_LINKER_FLAGS += $(LLVM_LDFLAGS) +GALLIUM_OMX_LINKER_FLAGS += $(LLVM_LDFLAGS) + +GALLIUM_DRI_LIB_DEPS += $(LLVM_LIBS) +GALLIUM_VDPAU_LIB_DEPS += $(LLVM_LIBS) +GALLIUM_XVMC_LIB_DEPS += $(LLVM_LIBS) +GALLIUM_OMX_LIB_DEPS += $(LLVM_LIBS) + +endif diff --git a/mesalib/src/mesa/drivers/dri/Makefile.am b/mesalib/src/mesa/drivers/dri/Makefile.am index 17ac76be1..f1fee122c 100644 --- a/mesalib/src/mesa/drivers/dri/Makefile.am +++ b/mesalib/src/mesa/drivers/dri/Makefile.am @@ -53,6 +53,7 @@ mesa_dri_drivers_la_SOURCES = mesa_dri_drivers_la_LDFLAGS = \ -module -avoid-version -shared \ -Wl,-Bsymbolic \ + $(GC_SECTIONS) \ $() mesa_dri_drivers_la_LIBADD = \ ../../libmesa.la \ diff --git a/mesalib/src/mesa/drivers/dri/common/Makefile.am b/mesalib/src/mesa/drivers/dri/common/Makefile.am index e500bdb30..c98ccf7b8 100644 --- a/mesalib/src/mesa/drivers/dri/common/Makefile.am +++ b/mesalib/src/mesa/drivers/dri/common/Makefile.am @@ -48,7 +48,7 @@ sysconf_DATA = drirc if DRICOMMON_NEED_LIBDRM AM_CFLAGS += $(LIBDRM_CFLAGS) -libdricommon_la_LDFLAGS = $(LIBDRM_LIBS) +libdricommon_la_LIBADD = $(LIBDRM_LIBS) else AM_CFLAGS += -D__NOT_HAVE_DRM_H endif diff --git a/mesalib/src/mesa/main/formats.c b/mesalib/src/mesa/main/formats.c index 4fb1f116b..fb2501c69 100644 --- a/mesalib/src/mesa/main/formats.c +++ b/mesalib/src/mesa/main/formats.c @@ -3153,9 +3153,9 @@ _mesa_format_matches_format_and_type(mesa_format mesa_format, case MESA_FORMAT_L_UNORM16: return format == GL_LUMINANCE && type == GL_UNSIGNED_SHORT && !swapBytes; case MESA_FORMAT_I_UNORM8: - return format == GL_INTENSITY && type == GL_UNSIGNED_BYTE; + return format == GL_RED && type == GL_UNSIGNED_BYTE; case MESA_FORMAT_I_UNORM16: - return format == GL_INTENSITY && type == GL_UNSIGNED_SHORT && !swapBytes; + return format == GL_RED && type == GL_UNSIGNED_SHORT && !swapBytes; case MESA_FORMAT_YCBCR: return format == GL_YCBCR_MESA && @@ -3247,9 +3247,9 @@ _mesa_format_matches_format_and_type(mesa_format mesa_format, return format == GL_LUMINANCE_ALPHA && type == GL_HALF_FLOAT && !swapBytes; case MESA_FORMAT_I_FLOAT32: - return format == GL_INTENSITY && type == GL_FLOAT && !swapBytes; + return format == GL_RED && type == GL_FLOAT && !swapBytes; case MESA_FORMAT_I_FLOAT16: - return format == GL_INTENSITY && type == GL_HALF_FLOAT && !swapBytes; + return format == GL_RED && type == GL_HALF_FLOAT && !swapBytes; case MESA_FORMAT_R_FLOAT32: return format == GL_RED && type == GL_FLOAT && !swapBytes; @@ -3277,13 +3277,17 @@ _mesa_format_matches_format_and_type(mesa_format mesa_format, return format == GL_ALPHA_INTEGER && type == GL_INT && !swapBytes; case MESA_FORMAT_I_UINT8: + return format == GL_RED_INTEGER && type == GL_UNSIGNED_BYTE; case MESA_FORMAT_I_UINT16: + return format == GL_RED_INTEGER && type == GL_UNSIGNED_SHORT && !swapBytes; case MESA_FORMAT_I_UINT32: + return format == GL_RED_INTEGER && type == GL_UNSIGNED_INT && !swapBytes; case MESA_FORMAT_I_SINT8: + return format == GL_RED_INTEGER && type == GL_BYTE; case MESA_FORMAT_I_SINT16: + return format == GL_RED_INTEGER && type == GL_SHORT && !swapBytes; case MESA_FORMAT_I_SINT32: - /* GL_INTENSITY_INTEGER_EXT doesn't exist. */ - return GL_FALSE; + return format == GL_RED_INTEGER && type == GL_INT && !swapBytes; case MESA_FORMAT_L_UINT8: return format == GL_LUMINANCE_INTEGER_EXT && type == GL_UNSIGNED_BYTE; @@ -3450,7 +3454,7 @@ _mesa_format_matches_format_and_type(mesa_format mesa_format, return format == GL_LUMINANCE_ALPHA && type == GL_BYTE && littleEndian && !swapBytes; case MESA_FORMAT_I_SNORM8: - return format == GL_INTENSITY && type == GL_BYTE; + return format == GL_RED && type == GL_BYTE; case MESA_FORMAT_A_SNORM16: return format == GL_ALPHA && type == GL_SHORT && !swapBytes; case MESA_FORMAT_L_SNORM16: @@ -3459,7 +3463,7 @@ _mesa_format_matches_format_and_type(mesa_format mesa_format, return format == GL_LUMINANCE_ALPHA && type == GL_SHORT && littleEndian && !swapBytes; case MESA_FORMAT_I_SNORM16: - return format == GL_INTENSITY && type == GL_SHORT && littleEndian && + return format == GL_RED && type == GL_SHORT && littleEndian && !swapBytes; case MESA_FORMAT_B10G10R10A2_UINT: diff --git a/mesalib/src/mesa/main/texstore.c b/mesalib/src/mesa/main/texstore.c index b68ba603e..fe3b07256 100644 --- a/mesalib/src/mesa/main/texstore.c +++ b/mesalib/src/mesa/main/texstore.c @@ -3260,12 +3260,16 @@ _mesa_texstore_srgba8(TEXSTORE_PARAMS) GLboolean k; ASSERT(dstFormat == MESA_FORMAT_A8B8G8R8_SRGB || - dstFormat == MESA_FORMAT_R8G8B8X8_SRGB); + dstFormat == MESA_FORMAT_R8G8B8X8_SRGB || + dstFormat == MESA_FORMAT_R8G8B8A8_SRGB); /* reuse normal rgba texstore code */ if (dstFormat == MESA_FORMAT_A8B8G8R8_SRGB) { newDstFormat = MESA_FORMAT_A8B8G8R8_UNORM; } + else if (dstFormat == MESA_FORMAT_R8G8B8A8_SRGB) { + newDstFormat = MESA_FORMAT_R8G8B8A8_UNORM; + } else if (dstFormat == MESA_FORMAT_R8G8B8X8_SRGB) { newDstFormat = MESA_FORMAT_R8G8B8X8_UNORM; } @@ -3294,9 +3298,6 @@ _mesa_texstore_sargb8(TEXSTORE_PARAMS) case MESA_FORMAT_B8G8R8A8_SRGB: newDstFormat = MESA_FORMAT_B8G8R8A8_UNORM; break; - case MESA_FORMAT_R8G8B8A8_SRGB: - newDstFormat = MESA_FORMAT_R8G8B8A8_UNORM; - break; case MESA_FORMAT_B8G8R8X8_SRGB: newDstFormat = MESA_FORMAT_B8G8R8X8_UNORM; break; @@ -3852,6 +3853,7 @@ _mesa_get_texstore_func(mesa_format format) table[MESA_FORMAT_B5G5R5X1_UNORM] = store_ubyte_texture; table[MESA_FORMAT_R8G8B8X8_SNORM] = _mesa_texstore_signed_rgbx8888; table[MESA_FORMAT_R8G8B8X8_SRGB] = _mesa_texstore_srgba8; + table[MESA_FORMAT_R8G8B8A8_SRGB] = _mesa_texstore_srgba8; table[MESA_FORMAT_RGBX_UINT8] = _mesa_texstore_rgba_uint8; table[MESA_FORMAT_RGBX_SINT8] = _mesa_texstore_rgba_int8; table[MESA_FORMAT_B10G10R10X2_UNORM] = _mesa_texstore_argb2101010; diff --git a/mesalib/src/mesa/state_tracker/st_format.c b/mesalib/src/mesa/state_tracker/st_format.c index cd6b46681..38d4ccfea 100644 --- a/mesalib/src/mesa/state_tracker/st_format.c +++ b/mesalib/src/mesa/state_tracker/st_format.c @@ -1750,6 +1750,12 @@ st_choose_matching_format(struct pipe_screen *screen, unsigned bind, if (_mesa_get_format_color_encoding(mesa_format) == GL_SRGB) { continue; } + if (_mesa_get_format_bits(mesa_format, GL_TEXTURE_INTENSITY_SIZE) > 0) { + /* If `format` is GL_RED/GL_RED_INTEGER, then we might match some + * intensity formats, which we don't want. + */ + continue; + } if (_mesa_format_matches_format_and_type(mesa_format, format, type, swapBytes)) { |