rc_body.append(' struct xglFuncs m_xglFuncs;')
rc_body.append(' void copy_mem_remap_range_struct(XGL_VIRTUAL_MEMORY_REMAP_RANGE *outRange, const XGL_VIRTUAL_MEMORY_REMAP_RANGE *inRange);')
rc_body.append(' xglDisplay *m_display;')
- rc_body.append(' XGL_MEMORY_HEAP_PROPERTIES m_heapProps[XGL_MAX_MEMORY_HEAPS];')
rc_body.append(' struct shaderPair {')
rc_body.append(' XGL_SHADER *addr;')
rc_body.append(' XGL_SHADER val;')
qs_body.append(' GLV_DELETE(memRefs);')
return "\n".join(qs_body)
- def _gen_replay_get_memory_heap_count(self):
- mhc_body = []
- mhc_body.append(' XGL_UINT count;')
- mhc_body.append(' replayResult = m_xglFuncs.real_xglGetMemoryHeapCount(remap(pPacket->device), &count);')
- mhc_body.append(' if (count < 1 || count >= XGL_MAX_MEMORY_HEAPS)')
- mhc_body.append(' glv_LogError("xglGetMemoryHeapCount returned bad value count = %u\\n", count);')
- return "\n".join(mhc_body)
-
- def _gen_replay_get_memory_heap_info(self):
- mhi_body = []
- mhi_body.append(' // TODO handle case where traced heap count, ids and properties do not match replay heaps')
- mhi_body.append(' XGL_SIZE dataSize = sizeof(XGL_MEMORY_HEAP_PROPERTIES);')
- mhi_body.append(' // TODO check returned properties match queried properties if this makes sense')
- mhi_body.append(' if (pPacket->heapId >= XGL_MAX_MEMORY_HEAPS)')
- mhi_body.append(' {')
- mhi_body.append(' glv_LogError("xglGetMemoryHeapInfo bad heapid (%d) skipping packet\\n");')
- mhi_body.append(' break;')
- mhi_body.append(' }')
- mhi_body.append(' replayResult = m_xglFuncs.real_xglGetMemoryHeapInfo(remap(pPacket->device), pPacket->heapId, pPacket->infoType, &dataSize,')
- mhi_body.append(' static_cast <XGL_VOID *> (&(m_heapProps[pPacket->heapId])));')
- mhi_body.append(' if (dataSize != sizeof(XGL_MEMORY_HEAP_PROPERTIES))')
- mhi_body.append(' glv_LogError("xglGetMemoryHeapInfo returned bad size = %u\\n", dataSize);')
- return "\n".join(mhi_body)
-
def _gen_replay_remap_virtual_memory_pages(self):
rvm_body = []
rvm_body.append(' XGL_VIRTUAL_MEMORY_REMAP_RANGE *pRemappedRanges = GLV_NEW_ARRAY( XGL_VIRTUAL_MEMORY_REMAP_RANGE, pPacket->rangeCount);')
'CreateDevice': self._gen_replay_create_device,
'GetExtensionSupport': self._gen_replay_get_extension_support,
'QueueSubmit': self._gen_replay_queue_submit,
- 'GetMemoryHeapCount': self._gen_replay_get_memory_heap_count,
- 'GetMemoryHeapInfo': self._gen_replay_get_memory_heap_info,
'RemapVirtualMemoryPages': self._gen_replay_remap_virtual_memory_pages,
'GetObjectInfo': self._gen_replay_get_object_info,
'GetFormatInfo': self._gen_replay_get_format_info,
intel_gpu_close(gpu);
}
-void intel_dev_get_heap_props(const struct intel_dev *dev,
- XGL_MEMORY_HEAP_PROPERTIES *props)
-{
- props->structSize = sizeof(XGL_MEMORY_HEAP_PROPERTIES);
-
- props->heapMemoryType = XGL_HEAP_MEMORY_LOCAL;
-
- props->heapSize = 0xffffffff; /* TODO system memory size */
-
- props->pageSize = 4096;
- props->flags = XGL_MEMORY_HEAP_CPU_VISIBLE_BIT |
- XGL_MEMORY_HEAP_CPU_GPU_COHERENT_BIT |
- XGL_MEMORY_HEAP_CPU_WRITE_COMBINED_BIT |
- XGL_MEMORY_HEAP_HOLDS_PINNED_BIT |
- XGL_MEMORY_HEAP_SHAREABLE_BIT;
-
- props->gpuReadPerfRating = 100.0f;
- props->gpuWritePerfRating = 100.0f;
- props->cpuReadPerfRating = 10.0f;
- props->cpuWritePerfRating = 80.0f;
-}
-
XGL_RESULT intel_dev_add_msg_filter(struct intel_dev *dev,
XGL_INT msg_code,
XGL_DBG_MSG_FILTER filter)
return XGL_SUCCESS;
}
-ICD_EXPORT XGL_RESULT XGLAPI xglGetMemoryHeapCount(
- XGL_DEVICE device,
- XGL_UINT* pCount)
-{
- *pCount = 1;
- return XGL_SUCCESS;
-}
-
-ICD_EXPORT XGL_RESULT XGLAPI xglGetMemoryHeapInfo(
- XGL_DEVICE device,
- XGL_UINT heapId,
- XGL_MEMORY_HEAP_INFO_TYPE infoType,
- XGL_SIZE* pDataSize,
- XGL_VOID* pData)
-{
- struct intel_dev *dev = intel_dev(device);
-
- *pDataSize = sizeof(XGL_MEMORY_HEAP_PROPERTIES);
- if (pData != NULL)
- intel_dev_get_heap_props(dev, pData);
-
- return XGL_SUCCESS;
-}
-
ICD_EXPORT XGL_RESULT XGLAPI xglGetDeviceQueue(
XGL_DEVICE device,
XGL_QUEUE_TYPE queueType,
struct intel_dev **dev_ret);
void intel_dev_destroy(struct intel_dev *dev);
-void intel_dev_get_heap_props(const struct intel_dev *dev,
- XGL_MEMORY_HEAP_PROPERTIES *props);
-
XGL_RESULT intel_dev_add_msg_filter(struct intel_dev *dev,
XGL_INT msg_code,
XGL_DBG_MSG_FILTER filter);
XGL_MAX_ENUM(_XGL_SYSTEM_ALLOC_TYPE)
} XGL_SYSTEM_ALLOC_TYPE;
-typedef enum _XGL_HEAP_MEMORY_TYPE
-{
- XGL_HEAP_MEMORY_OTHER = 0x00000000,
- XGL_HEAP_MEMORY_LOCAL = 0x00000001,
- XGL_HEAP_MEMORY_REMOTE = 0x00000002,
- XGL_HEAP_MEMORY_EMBEDDED = 0x00000003,
-
- XGL_HEAP_MEMORY_BEGIN_RANGE = XGL_HEAP_MEMORY_OTHER,
- XGL_HEAP_MEMORY_END_RANGE = XGL_HEAP_MEMORY_EMBEDDED,
- XGL_NUM_HEAP_MEMORY_TYPE = (XGL_HEAP_MEMORY_END_RANGE - XGL_HEAP_MEMORY_BEGIN_RANGE + 1),
- XGL_MAX_ENUM(_XGL_HEAP_MEMORY_TYPE)
-} XGL_HEAP_MEMORY_TYPE;
-
typedef enum _XGL_PHYSICAL_GPU_TYPE
{
XGL_GPU_TYPE_OTHER = 0x00000000,
XGL_MAX_ENUM(_XGL_PHYSICAL_GPU_INFO_TYPE)
} XGL_PHYSICAL_GPU_INFO_TYPE;
-typedef enum _XGL_MEMORY_HEAP_INFO_TYPE
-{
- // Info type for xglGetMemoryHeapInfo()
- XGL_INFO_TYPE_MEMORY_HEAP_PROPERTIES = 0x00000000,
-
- XGL_MAX_ENUM(_XGL_MEMORY_HEAP_INFO_TYPE)
-} XGL_MEMORY_HEAP_INFO_TYPE;
-
typedef enum _XGL_FORMAT_INFO_TYPE
{
// Info type for xlgGetFormatInfo()
XGL_BOOL supportsPinning;
} XGL_PHYSICAL_GPU_MEMORY_PROPERTIES;
-typedef struct _XGL_MEMORY_HEAP_PROPERTIES
-{
- XGL_SIZE structSize; // Size of structure in bytes
- XGL_HEAP_MEMORY_TYPE heapMemoryType; // XGL_HEAP_MEMORY_TYPE
- XGL_GPU_SIZE heapSize; // Specified in bytes
- XGL_GPU_SIZE pageSize; // Specified in bytes
- XGL_FLAGS flags; // XGL_MEMORY_HEAP_FLAGS
- XGL_FLOAT gpuReadPerfRating;
- XGL_FLOAT gpuWritePerfRating;
- XGL_FLOAT cpuReadPerfRating;
- XGL_FLOAT cpuWritePerfRating;
-} XGL_MEMORY_HEAP_PROPERTIES;
-
typedef struct _XGL_MEMORY_ALLOC_INFO
{
XGL_STRUCTURE_TYPE sType; // Must be XGL_STRUCTURE_TYPE_MEMORY_ALLOC_INFO
typedef XGL_RESULT (XGLAPI *xglQueueSetGlobalMemReferencesType)(XGL_QUEUE queue, XGL_UINT memRefCount, const XGL_MEMORY_REF* pMemRefs);
typedef XGL_RESULT (XGLAPI *xglQueueWaitIdleType)(XGL_QUEUE queue);
typedef XGL_RESULT (XGLAPI *xglDeviceWaitIdleType)(XGL_DEVICE device);
-typedef XGL_RESULT (XGLAPI *xglGetMemoryHeapCountType)(XGL_DEVICE device, XGL_UINT* pCount);
-typedef XGL_RESULT (XGLAPI *xglGetMemoryHeapInfoType)(XGL_DEVICE device, XGL_UINT heapId, XGL_MEMORY_HEAP_INFO_TYPE infoType, XGL_SIZE* pDataSize, XGL_VOID* pData);
typedef XGL_RESULT (XGLAPI *xglAllocMemoryType)(XGL_DEVICE device, const XGL_MEMORY_ALLOC_INFO* pAllocInfo, XGL_GPU_MEMORY* pMem);
typedef XGL_RESULT (XGLAPI *xglFreeMemoryType)(XGL_GPU_MEMORY mem);
typedef XGL_RESULT (XGLAPI *xglSetMemoryPriorityType)(XGL_GPU_MEMORY mem, XGL_MEMORY_PRIORITY priority);
// Memory functions
-XGL_RESULT XGLAPI xglGetMemoryHeapCount(
- XGL_DEVICE device,
- XGL_UINT* pCount);
-
-XGL_RESULT XGLAPI xglGetMemoryHeapInfo(
- XGL_DEVICE device,
- XGL_UINT heapId,
- XGL_MEMORY_HEAP_INFO_TYPE infoType,
- XGL_SIZE* pDataSize,
- XGL_VOID* pData);
-
XGL_RESULT XGLAPI xglAllocMemory(
XGL_DEVICE device,
const XGL_MEMORY_ALLOC_INFO* pAllocInfo,
xglQueueSetGlobalMemReferencesType QueueSetGlobalMemReferences;
xglQueueWaitIdleType QueueWaitIdle;
xglDeviceWaitIdleType DeviceWaitIdle;
- xglGetMemoryHeapCountType GetMemoryHeapCount;
- xglGetMemoryHeapInfoType GetMemoryHeapInfo;
xglAllocMemoryType AllocMemory;
xglFreeMemoryType FreeMemory;
xglSetMemoryPriorityType SetMemoryPriority;
return result;
}
-XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglGetMemoryHeapCount(XGL_DEVICE device, XGL_UINT* pCount)
-{
- XGL_RESULT result = nextTable.GetMemoryHeapCount(device, pCount);
- return result;
-}
-
-XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglGetMemoryHeapInfo(XGL_DEVICE device, XGL_UINT heapId, XGL_MEMORY_HEAP_INFO_TYPE infoType, XGL_SIZE* pDataSize, XGL_VOID* pData)
-{
- XGL_RESULT result = nextTable.GetMemoryHeapInfo(device, heapId, infoType, pDataSize, pData);
- return result;
-}
-
XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglAllocMemory(XGL_DEVICE device, const XGL_MEMORY_ALLOC_INFO* pAllocInfo, XGL_GPU_MEMORY* pMem)
{
XGL_RESULT result = nextTable.AllocMemory(device, pAllocInfo, pMem);
return result;
}
-XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglGetMemoryHeapCount(XGL_DEVICE device, XGL_UINT* pCount)
-{
- // TODO : Track memory stats here
- XGL_RESULT result = nextTable.GetMemoryHeapCount(device, pCount);
- return result;
-}
-
-XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglGetMemoryHeapInfo(XGL_DEVICE device, XGL_UINT heapId, XGL_MEMORY_HEAP_INFO_TYPE infoType, XGL_SIZE* pDataSize, XGL_VOID* pData)
-{
- // TODO : Track memory stats here
- XGL_RESULT result = nextTable.GetMemoryHeapInfo(device, heapId, infoType, pDataSize, pData);
- return result;
-}
-
XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglAllocMemory(XGL_DEVICE device, const XGL_MEMORY_ALLOC_INFO* pAllocInfo, XGL_GPU_MEMORY* pMem)
{
XGL_RESULT result = nextTable.AllocMemory(device, pAllocInfo, pMem);
Proto("XGL_RESULT", "DeviceWaitIdle",
[Param("XGL_DEVICE", "device")]),
- Proto("XGL_RESULT", "GetMemoryHeapCount",
- [Param("XGL_DEVICE", "device"),
- Param("XGL_UINT*", "pCount")]),
-
- Proto("XGL_RESULT", "GetMemoryHeapInfo",
- [Param("XGL_DEVICE", "device"),
- Param("XGL_UINT", "heapId"),
- Param("XGL_MEMORY_HEAP_INFO_TYPE", "infoType"),
- Param("XGL_SIZE*", "pDataSize"),
- Param("XGL_VOID*", "pData")]),
-
Proto("XGL_RESULT", "AllocMemory",
[Param("XGL_DEVICE", "device"),
Param("const XGL_MEMORY_ALLOC_INFO*", "pAllocInfo"),