Added two new files for a wrapper function for initialization
---
 src/gallium/drivers/swr/Makefile.sources           |  4 ++-
 src/gallium/drivers/swr/meson.build                |  2 ++
 src/gallium/drivers/swr/rasterizer/core/api.cpp    |  4 ---
 src/gallium/drivers/swr/rasterizer/core/state.h    |  3 +-
 .../drivers/swr/rasterizer/memory/InitMemory.cpp   | 39 ++++++++++++++++++++++
 .../drivers/swr/rasterizer/memory/InitMemory.h     | 33 ++++++++++++++++++
 src/gallium/drivers/swr/swr_loader.cpp             |  7 +++-
 7 files changed, 85 insertions(+), 7 deletions(-)
 create mode 100644 src/gallium/drivers/swr/rasterizer/memory/InitMemory.cpp
 create mode 100644 src/gallium/drivers/swr/rasterizer/memory/InitMemory.h

diff --git a/src/gallium/drivers/swr/Makefile.sources 
b/src/gallium/drivers/swr/Makefile.sources
index 6753d50..b298356 100644
--- a/src/gallium/drivers/swr/Makefile.sources
+++ b/src/gallium/drivers/swr/Makefile.sources
@@ -177,4 +177,6 @@ MEMORY_CXX_SOURCES := \
        rasterizer/memory/StoreTile_TileY2.cpp \
        rasterizer/memory/StoreTile_TileY.cpp \
        rasterizer/memory/TilingFunctions.h \
-       rasterizer/memory/tilingtraits.h
+       rasterizer/memory/tilingtraits.h \
+       rasterizer/memory/InitMemory.cpp \
+       rasterizer/memory/InitMemory.h
diff --git a/src/gallium/drivers/swr/meson.build 
b/src/gallium/drivers/swr/meson.build
index 9b272aa..b95c8bc 100644
--- a/src/gallium/drivers/swr/meson.build
+++ b/src/gallium/drivers/swr/meson.build
@@ -151,6 +151,8 @@ files_swr_arch = files(
   'rasterizer/memory/StoreTile_TileY.cpp',
   'rasterizer/memory/TilingFunctions.h',
   'rasterizer/memory/tilingtraits.h',
+  'rasterizer/memory/InitMemory.h',
+  'rasterizer/memory/InitMemory.cpp',
 )
 
 swr_context_files = files('swr_context.h')
diff --git a/src/gallium/drivers/swr/rasterizer/core/api.cpp 
b/src/gallium/drivers/swr/rasterizer/core/api.cpp
index 47f3633..c932ec0 100644
--- a/src/gallium/drivers/swr/rasterizer/core/api.cpp
+++ b/src/gallium/drivers/swr/rasterizer/core/api.cpp
@@ -1728,10 +1728,6 @@ void InitBackendFuncTables();
 /// @brief Initialize swr backend and memory internal tables
 void SwrInit()
 {
-    InitSimLoadTilesTable();
-    InitSimStoreTilesTable();
-    InitSimClearTilesTable();
-
     InitClearTilesTable();
     InitBackendFuncTables();
     InitRasterizerFunctions();
diff --git a/src/gallium/drivers/swr/rasterizer/core/state.h 
b/src/gallium/drivers/swr/rasterizer/core/state.h
index c26dabe..9db17ee 100644
--- a/src/gallium/drivers/swr/rasterizer/core/state.h
+++ b/src/gallium/drivers/swr/rasterizer/core/state.h
@@ -29,10 +29,11 @@
 
 #include "common/formats.h"
 #include "common/intrin.h"
-using gfxptr_t = unsigned long long;
 #include <functional>
 #include <algorithm>
 
+using gfxptr_t = unsigned long long;
+
 //////////////////////////////////////////////////////////////////////////
 /// PRIMITIVE_TOPOLOGY.
 //////////////////////////////////////////////////////////////////////////
diff --git a/src/gallium/drivers/swr/rasterizer/memory/InitMemory.cpp 
b/src/gallium/drivers/swr/rasterizer/memory/InitMemory.cpp
new file mode 100644
index 0000000..bff96e1
--- /dev/null
+++ b/src/gallium/drivers/swr/rasterizer/memory/InitMemory.cpp
@@ -0,0 +1,39 @@
+/****************************************************************************
+* Copyright (C) 2018 Intel Corporation.   All Rights Reserved.
+*
+* 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.
+*
+* @file InitMemory.cpp
+*
+* @brief Provide access to tiles table initialization functions
+*
+******************************************************************************/
+#include "memory/InitMemory.h"
+
+void InitSimLoadTilesTable();
+void InitSimStoreTilesTable();
+void InitSimClearTilesTable();
+
+void InitTilesTable()
+{
+    InitSimLoadTilesTable();
+    InitSimStoreTilesTable();
+    InitSimClearTilesTable();
+}
diff --git a/src/gallium/drivers/swr/rasterizer/memory/InitMemory.h 
b/src/gallium/drivers/swr/rasterizer/memory/InitMemory.h
new file mode 100644
index 0000000..14cca6a
--- /dev/null
+++ b/src/gallium/drivers/swr/rasterizer/memory/InitMemory.h
@@ -0,0 +1,33 @@
+/****************************************************************************
+* Copyright (C) 2018 Intel Corporation.   All Rights Reserved.
+*
+* 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.
+*
+* @file InitMemory.h
+*
+* @brief Provide access to tiles table initialization functions
+*
+******************************************************************************/
+#include "common/os.h"
+
+extern "C"
+{
+    SWR_VISIBLE void SWR_API InitTilesTable();
+}
diff --git a/src/gallium/drivers/swr/swr_loader.cpp 
b/src/gallium/drivers/swr/swr_loader.cpp
index 01b9804..28c6c11 100644
--- a/src/gallium/drivers/swr/swr_loader.cpp
+++ b/src/gallium/drivers/swr/swr_loader.cpp
@@ -35,6 +35,7 @@ swr_initialize_screen_interface(struct swr_screen *screen, 
const char arch[])
 #ifdef HAVE_SWR_BUILTIN
    screen->pLibrary = NULL;
    screen->pfnSwrGetInterface = SwrGetInterface;
+   InitTilesTable();
    fprintf(stderr, "(using: builtin).\n");
 #else
    char filename[256] = { 0 };
@@ -48,7 +49,9 @@ swr_initialize_screen_interface(struct swr_screen *screen, 
const char arch[])
 
    util_dl_proc pApiProc = util_dl_get_proc_address(screen->pLibrary,
       "SwrGetInterface");
-   if (!pApiProc) {
+   util_dl_proc pInitFunc = util_dl_get_proc_address(screen->pLibrary,
+      "InitTilesTable");
+   if (!pApiProc || !pInitFunc) {
       fprintf(stderr, "(skipping: %s).\n", util_dl_error());
       util_dl_close(screen->pLibrary);
       screen->pLibrary = NULL;
@@ -56,6 +59,8 @@ swr_initialize_screen_interface(struct swr_screen *screen, 
const char arch[])
    }
 
    screen->pfnSwrGetInterface = (PFNSwrGetInterface)pApiProc;
+   pInitFunc();
+
    fprintf(stderr, "(using: %s).\n", filename);
 #endif
    return true;
-- 
2.7.4

_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to