1 /****************************************************************************
2 * Copyright (C) 2014-2016 Intel Corporation. All Rights Reserved.
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
11 * The above copyright notice and this permission notice (including the next
12 * paragraph) shall be included in all copies or substantial portions of the
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
25 * @brief Definitions for SWR threading model.
27 ******************************************************************************/
32 #include <unordered_set>
34 typedef std::thread
* THREAD_PTR
;
41 uint32_t procGroupId
; // Will always be 0 for non-Windows OS
42 uint32_t threadId
; // within the procGroup for Windows
43 uint32_t numaId
; // NUMA node id
44 uint32_t coreId
; // Core id
45 uint32_t htId
; // Hyperthread id
47 SWR_CONTEXT
*pContext
;
48 bool forceBindProcGroup
; // Only useful when MAX_WORKER_THREADS is set.
57 volatile bool inThreadShutdown
;
58 THREAD_DATA
*pThreadData
;
61 typedef std::unordered_set
<uint32_t> TileSet
;
63 void CreateThreadPool(SWR_CONTEXT
*pContext
, THREAD_POOL
*pPool
);
64 void DestroyThreadPool(SWR_CONTEXT
*pContext
, THREAD_POOL
*pPool
);
66 // Expose FE and BE worker functions to the API thread if single threaded
67 void WorkOnFifoFE(SWR_CONTEXT
*pContext
, uint32_t workerId
, uint32_t &curDrawFE
);
68 void WorkOnFifoBE(SWR_CONTEXT
*pContext
, uint32_t workerId
, uint32_t &curDrawBE
, TileSet
&usedTiles
, uint32_t numaNode
, uint32_t numaMask
);
69 void WorkOnCompute(SWR_CONTEXT
*pContext
, uint32_t workerId
, uint32_t &curDrawBE
);
70 int32_t CompleteDrawContext(SWR_CONTEXT
* pContext
, DRAW_CONTEXT
* pDC
);