- add NUMA awareness to drawer threads

This commit is contained in:
Magnus Norddahl 2018-11-22 14:48:09 +01:00
commit 3e9f531b5f
8 changed files with 162 additions and 18 deletions

View file

@ -127,8 +127,13 @@ void PolyTriangleThreadData::ClearStencil(uint8_t value)
int height = buffer->Height();
uint8_t *data = buffer->Values();
data += core * width;
for (int y = core; y < height; y += num_cores)
int start_y = numa_node * height / num_numa_nodes;
int end_y = (numa_node + 1) * height / num_numa_nodes;
int core_skip = (num_cores - (start_y - core) % num_cores) % num_cores;
start_y += core_skip;
data += start_y * width;
for (int y = start_y; y < end_y; y += num_cores)
{
memset(data, value, width);
data += num_cores * width;
@ -146,6 +151,8 @@ void PolyTriangleThreadData::SetViewport(int x, int y, int width, int height, ui
dest_height = new_dest_height;
dest_pitch = new_dest_pitch;
dest_bgra = new_dest_bgra;
numa_start_y = numa_node * dest_height / num_numa_nodes;
numa_end_y = (numa_node + 1) * dest_height / num_numa_nodes;
ccw = true;
weaponScene = false;
}
@ -642,7 +649,7 @@ int PolyTriangleThreadData::ClipEdge(const ShadedTriVertex *verts, ShadedTriVert
PolyTriangleThreadData *PolyTriangleThreadData::Get(DrawerThread *thread)
{
if (!thread->poly)
thread->poly = std::make_shared<PolyTriangleThreadData>(thread->core, thread->num_cores);
thread->poly = std::make_shared<PolyTriangleThreadData>(thread->core, thread->num_cores, thread->numa_node, thread->num_numa_nodes);
return thread->poly.get();
}