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 <bruce.cherniak@intel.com>
This commit is contained in:
Alok Hota 2018-05-25 10:19:48 -05:00 committed by Tim Rowley
parent b6b114c1ae
commit b3360f5c8b
7 changed files with 86 additions and 7 deletions

View File

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

View File

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

View File

@ -1728,10 +1728,6 @@ void InitBackendFuncTables();
/// @brief Initialize swr backend and memory internal tables
void SwrInit()
{
InitSimLoadTilesTable();
InitSimStoreTilesTable();
InitSimClearTilesTable();
InitClearTilesTable();
InitBackendFuncTables();
InitRasterizerFunctions();

View File

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

View File

@ -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();
}

View File

@ -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();
}

View File

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