From b3360f5c8b74906187a8801d83f2c4f73f3c025e Mon Sep 17 00:00:00 2001 From: Alok Hota Date: Fri, 25 May 2018 10:19:48 -0500 Subject: [PATCH] swr/rast: Moved memory init out of core swr init Added two new files for a wrapper function for initialization v2: added missing include for single architecture builds Reviewed-by: Bruce Cherniak --- src/gallium/drivers/swr/Makefile.sources | 4 +- src/gallium/drivers/swr/meson.build | 2 + .../drivers/swr/rasterizer/core/api.cpp | 4 -- .../drivers/swr/rasterizer/core/state.h | 3 +- .../swr/rasterizer/memory/InitMemory.cpp | 39 +++++++++++++++++++ .../swr/rasterizer/memory/InitMemory.h | 33 ++++++++++++++++ src/gallium/drivers/swr/swr_loader.cpp | 8 +++- 7 files changed, 86 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 6753d501a0d..b298356079e 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 9b272aaebdc..b95c8bc1bf8 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 47f3633d54b..c932ec0bd66 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 c26dabe8383..9db17eeed01 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 #include +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 00000000000..bff96e17f43 --- /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 00000000000..14cca6ab324 --- /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 01b98046462..c5b2e294ef7 100644 --- a/src/gallium/drivers/swr/swr_loader.cpp +++ b/src/gallium/drivers/swr/swr_loader.cpp @@ -21,6 +21,7 @@ * IN THE SOFTWARE. ***************************************************************************/ +#include "memory/InitMemory.h" #include "util/u_cpu_detect.h" #include "util/u_dl.h" #include "swr_public.h" @@ -35,6 +36,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 +50,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 +60,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.30.2