gallium: Remove util_format_s3tc_enabled
authorMatt Turner <mattst88@gmail.com>
Thu, 28 Sep 2017 21:16:18 +0000 (14:16 -0700)
committerMatt Turner <mattst88@gmail.com>
Tue, 3 Oct 2017 02:41:22 +0000 (19:41 -0700)
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
14 files changed:
src/gallium/auxiliary/util/u_format.c
src/gallium/auxiliary/util/u_format_s3tc.c
src/gallium/auxiliary/util/u_format_s3tc.h
src/gallium/drivers/llvmpipe/lp_screen.c
src/gallium/drivers/llvmpipe/lp_test_format.c
src/gallium/drivers/r300/r300_screen.c
src/gallium/drivers/r300/r300_texture.c
src/gallium/drivers/r600/r600_state_common.c
src/gallium/drivers/radeonsi/si_state.c
src/gallium/drivers/softpipe/sp_screen.c
src/gallium/drivers/swr/swr_screen.cpp
src/gallium/drivers/virgl/virgl_screen.c
src/gallium/state_trackers/dri/dri_screen.c
src/gallium/tests/unit/u_format_test.c

index a6d42a428dcc9e0c52c84e1dbbe9eab77676a75b..0fc323165481b0a62715274873ac36807221bc5e 100644 (file)
@@ -242,10 +242,6 @@ util_format_is_supported(enum pipe_format format, unsigned bind)
       return FALSE;
    }
 
-   if (util_format_is_s3tc(format) && !util_format_s3tc_enabled) {
-      return FALSE;
-   }
-
 #ifndef TEXTURE_FLOAT_ENABLED
    if ((bind & PIPE_BIND_RENDER_TARGET) &&
        format != PIPE_FORMAT_R9G9B9E5_FLOAT &&
index 8c4f2150bef57240ec4aa9a1a1e7782ac72d413f..031255f2b3ff0dc578ab22d179f65c990ec9f196 100644 (file)
 #include "u_format.h"
 #include "u_format_s3tc.h"
 #include "util/format_srgb.h"
-
-
-#if defined(_WIN32) || defined(WIN32)
-#define DXTN_LIBNAME "dxtn.dll"
-#elif defined(__CYGWIN__)
-#define DXTN_LIBNAME "cygtxc_dxtn.dll"
-#elif defined(__APPLE__)
-#define DXTN_LIBNAME "libtxc_dxtn.dylib"
-#else
-#define DXTN_LIBNAME "libtxc_dxtn.so"
-#endif
+#include "../../../mesa/main/texcompress_s3tc_tmp.h"
 
 
 static void
@@ -93,8 +83,6 @@ util_format_dxtn_pack_stub(int src_comps,
 }
 
 
-boolean util_format_s3tc_enabled = FALSE;
-
 util_format_dxtn_fetch_t util_format_dxt1_rgb_fetch = util_format_dxt1_rgb_fetch_stub;
 util_format_dxtn_fetch_t util_format_dxt1_rgba_fetch = util_format_dxt1_rgba_fetch_stub;
 util_format_dxtn_fetch_t util_format_dxt3_rgba_fetch = util_format_dxt3_rgba_fetch_stub;
@@ -107,56 +95,16 @@ void
 util_format_s3tc_init(void)
 {
    static boolean first_time = TRUE;
-   struct util_dl_library *library = NULL;
-   util_dl_proc fetch_2d_texel_rgb_dxt1;
-   util_dl_proc fetch_2d_texel_rgba_dxt1;
-   util_dl_proc fetch_2d_texel_rgba_dxt3;
-   util_dl_proc fetch_2d_texel_rgba_dxt5;
-   util_dl_proc tx_compress_dxtn;
 
    if (!first_time)
       return;
    first_time = FALSE;
 
-   if (util_format_s3tc_enabled)
-      return;
-
-   library = util_dl_open(DXTN_LIBNAME);
-   if (!library) {
-      debug_printf("couldn't open " DXTN_LIBNAME ", software DXTn "
-                   "compression/decompression unavailable\n");
-      return;
-   }
-
-   fetch_2d_texel_rgb_dxt1 =
-         util_dl_get_proc_address(library, "fetch_2d_texel_rgb_dxt1");
-   fetch_2d_texel_rgba_dxt1 =
-         util_dl_get_proc_address(library, "fetch_2d_texel_rgba_dxt1");
-   fetch_2d_texel_rgba_dxt3 =
-         util_dl_get_proc_address(library, "fetch_2d_texel_rgba_dxt3");
-   fetch_2d_texel_rgba_dxt5 =
-         util_dl_get_proc_address(library, "fetch_2d_texel_rgba_dxt5");
-   tx_compress_dxtn =
-         util_dl_get_proc_address(library, "tx_compress_dxtn");
-
-   if (!util_format_dxt1_rgb_fetch ||
-       !util_format_dxt1_rgba_fetch ||
-       !util_format_dxt3_rgba_fetch ||
-       !util_format_dxt5_rgba_fetch ||
-       !util_format_dxtn_pack) {
-      debug_printf("couldn't reference all symbols in " DXTN_LIBNAME
-                   ", software DXTn compression/decompression "
-                   "unavailable\n");
-      util_dl_close(library);
-      return;
-   }
-
    util_format_dxt1_rgb_fetch = (util_format_dxtn_fetch_t)fetch_2d_texel_rgb_dxt1;
    util_format_dxt1_rgba_fetch = (util_format_dxtn_fetch_t)fetch_2d_texel_rgba_dxt1;
    util_format_dxt3_rgba_fetch = (util_format_dxtn_fetch_t)fetch_2d_texel_rgba_dxt3;
    util_format_dxt5_rgba_fetch = (util_format_dxtn_fetch_t)fetch_2d_texel_rgba_dxt5;
    util_format_dxtn_pack = (util_format_dxtn_pack_t)tx_compress_dxtn;
-   util_format_s3tc_enabled = TRUE;
 }
 
 
index ae20010cdf8a5cf678fbb8cd120677a3faf660c6..42e62bdbb26c7984342329367065959f5ea094de 100644 (file)
@@ -58,8 +58,6 @@ typedef void
                             uint8_t *dst,
                             int dst_stride);
 
-extern boolean util_format_s3tc_enabled;
-
 extern util_format_dxtn_fetch_t util_format_dxt1_rgb_fetch;
 extern util_format_dxtn_fetch_t util_format_dxt1_rgba_fetch;
 extern util_format_dxtn_fetch_t util_format_dxt3_rgba_fetch;
index 53171162a54c7b6bfc79998080e027107a51ab02..7b694b5755147ac81c362361f5aa65d01cc74566 100644 (file)
@@ -532,10 +532,6 @@ llvmpipe_is_format_supported( struct pipe_screen *_screen,
        format != PIPE_FORMAT_ETC1_RGB8)
       return FALSE;
 
-   if (format_desc->layout == UTIL_FORMAT_LAYOUT_S3TC) {
-      return util_format_s3tc_enabled;
-   }
-
    /*
     * Everything can be supported by u_format
     * (those without fetch_rgba_float might be not but shouldn't hit that)
index 9b16162131fa9e03cb96c8f47bfae197429e7b47..fd79087287e054838a761428c75f30292d5623d1 100644 (file)
@@ -383,11 +383,6 @@ test_all(unsigned verbose, FILE *fp)
       if (util_format_is_pure_integer(format))
         continue;
 
-      if (format_desc->layout == UTIL_FORMAT_LAYOUT_S3TC &&
-          !util_format_s3tc_enabled) {
-         continue;
-      }
-
       /* only have util fetch func for etc1 */
       if (format_desc->layout == UTIL_FORMAT_LAYOUT_ETC &&
           format != PIPE_FORMAT_ETC1_RGB8) {
index 0c3e097535dbf0fa7acecc48125fbefaf5cc2e19..6d6b5fb74ab16a2517a20be529e3a6b8bf1b716f 100644 (file)
@@ -127,7 +127,7 @@ static int r300_get_param(struct pipe_screen* pscreen, enum pipe_cap param)
 
         /* r300 cannot do swizzling of compressed textures. Supported otherwise. */
         case PIPE_CAP_TEXTURE_SWIZZLE:
-            return util_format_s3tc_enabled ? r300screen->caps.dxtc_swizzle : 1;
+            return r300screen->caps.dxtc_swizzle;
 
         /* We don't support color clamping on r500, so that we can use color
          * intepolators for generic varyings. */
index 8873c54ebce25d57b6991f18a66c75aecfd5d1d2..0658205f87926a9dab2703349c5b2b837667db57 100644 (file)
@@ -250,10 +250,6 @@ uint32_t r300_translate_texformat(enum pipe_format format,
 
     /* S3TC formats. */
     if (desc->layout == UTIL_FORMAT_LAYOUT_S3TC) {
-        if (!util_format_s3tc_enabled) {
-            return ~0; /* Unsupported. */
-        }
-
         switch (format) {
             case PIPE_FORMAT_DXT1_RGB:
             case PIPE_FORMAT_DXT1_RGBA:
index 7e2b34bf798323bd580bb5ad26a378c140212265..0e8c5d666ef9bf0180bd2594d62878493f894738 100644 (file)
@@ -2405,10 +2405,6 @@ uint32_t r600_translate_texformat(struct pipe_screen *screen,
        }
 
        if (desc->layout == UTIL_FORMAT_LAYOUT_S3TC) {
-               if (!util_format_s3tc_enabled) {
-                       goto out_unknown;
-               }
-
                switch (format) {
                case PIPE_FORMAT_DXT1_RGB:
                case PIPE_FORMAT_DXT1_RGBA:
index 4965a8374ff853283ddf3fea9ddc7972d8c75ddc..67cd17462775b6c5215ba1417f911b4dda876504 100644 (file)
@@ -1712,10 +1712,6 @@ static uint32_t si_translate_texformat(struct pipe_screen *screen,
                if (!enable_compressed_formats)
                        goto out_unknown;
 
-               if (!util_format_s3tc_enabled) {
-                       goto out_unknown;
-               }
-
                switch (format) {
                case PIPE_FORMAT_DXT1_RGB:
                case PIPE_FORMAT_DXT1_RGBA:
index 7e9d9e6592f7b2936b584e24339d1f3113cdd8d6..50eefe65af75ea769fde58cbab7277d1b505bb55 100644 (file)
@@ -460,10 +460,6 @@ softpipe_is_format_supported( struct pipe_screen *screen,
     * All other operations (sampling, transfer, etc).
     */
 
-   if (format_desc->layout == UTIL_FORMAT_LAYOUT_S3TC) {
-      return util_format_s3tc_enabled;
-   }
-
    /*
     * Everything else should be supported by u_format.
     */
index ee7782d648d32b2881400a1680aea60d4bfa5b13..3ae56f52d5f06f054f7d911d0c218aea29b98fde 100644 (file)
@@ -147,10 +147,6 @@ swr_is_format_supported(struct pipe_screen *_screen,
       return FALSE;
    }
 
-   if (format_desc->layout == UTIL_FORMAT_LAYOUT_S3TC) {
-      return util_format_s3tc_enabled;
-   }
-
    return TRUE;
 }
 
index 935ce2f9b0aeb2d918e73462a747d4face11c282..f2636aac382d82c8fa7cb391c237147804eea49d 100644 (file)
@@ -486,9 +486,7 @@ virgl_is_format_supported( struct pipe_screen *screen,
     */
 
    if (format_desc->layout == UTIL_FORMAT_LAYOUT_S3TC) {
-      if (util_format_s3tc_enabled)
-         goto out_lookup;
-      return FALSE;
+      goto out_lookup;
    }
    if (format_desc->layout == UTIL_FORMAT_LAYOUT_RGTC) {
       goto out_lookup;
index 1d9f441223e1538595d444e7011b1c834b721ab4..803264a58f18a9c264360b90061bf84fb2c5cea7 100644 (file)
@@ -505,19 +505,6 @@ dri_init_screen_helper(struct dri_screen *screen,
    else
       screen->target = PIPE_TEXTURE_RECT;
 
-   /* Handle force_s3tc_enable. */
-   if (!util_format_s3tc_enabled && screen->options.force_s3tc_enable) {
-      /* Ensure libtxc_dxtn has been loaded if available.
-       * Forcing S3TC on before calling this would prevent loading
-       * the library.
-       * This is just a precaution, the driver should have called it
-       * already.
-       */
-      util_format_s3tc_init();
-
-      util_format_s3tc_enabled = TRUE;
-   }
-
    dri_postprocessing_init(screen);
 
    screen->st_api->query_versions(screen->st_api, &screen->base,
index 69d6c7dd3a225ec90f3109a3a8d3e1a98b25f3fc..2152b227f6a3570b8f0665d7f54e57a27f8300bf 100644 (file)
@@ -722,11 +722,6 @@ test_all(void)
       assert(format_desc->block.height <= UTIL_FORMAT_MAX_UNPACKED_HEIGHT);
       assert(format_desc->block.width  <= UTIL_FORMAT_MAX_UNPACKED_WIDTH);
 
-      if (format_desc->layout == UTIL_FORMAT_LAYOUT_S3TC &&
-          !util_format_s3tc_enabled) {
-         continue;
-      }
-
 #     define TEST_ONE_FUNC(name) \
       if (format_desc->name) { \
          if (!test_one_func(format_desc, &test_format_##name, #name)) { \