memory alloc: Remove xglGetMemoryHeapXXX from driver,loader, glave, layers
authorJon Ashburn <jon@lunarg.com>
Wed, 14 Jan 2015 17:44:00 +0000 (10:44 -0700)
committerCourtney Goeltzenleuchter <courtney@LunarG.com>
Thu, 5 Feb 2015 00:58:09 +0000 (17:58 -0700)
glave-generate.py
icd/intel/dev.c
icd/intel/dev.h
include/xgl.h
include/xglLayer.h
layers/draw_state.c
layers/mem_tracker.c
xgl.py

index ee8c4db..a52b197 100755 (executable)
@@ -1560,7 +1560,6 @@ class Subcommand(object):
         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;')
@@ -2312,30 +2311,6 @@ class Subcommand(object):
         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);')
@@ -2677,8 +2652,6 @@ class Subcommand(object):
                             '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,
index 019f892..c69e937 100644 (file)
@@ -208,28 +208,6 @@ void intel_dev_destroy(struct intel_dev *dev)
         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)
@@ -357,30 +335,6 @@ ICD_EXPORT XGL_RESULT XGLAPI xglDestroyDevice(
     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,
index d732f7d..46c0a1e 100644 (file)
@@ -185,9 +185,6 @@ XGL_RESULT intel_dev_create(struct intel_gpu *gpu,
                             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);
index 03a0913..c243b68 100644 (file)
@@ -668,19 +668,6 @@ typedef enum _XGL_SYSTEM_ALLOC_TYPE
     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,
@@ -705,14 +692,6 @@ typedef enum _XGL_PHYSICAL_GPU_INFO_TYPE
     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()
@@ -1286,19 +1265,6 @@ typedef struct _XGL_PHYSICAL_GPU_MEMORY_PROPERTIES
     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
@@ -2066,8 +2032,6 @@ typedef XGL_RESULT (XGLAPI *xglQueueSubmitType)(XGL_QUEUE queue, XGL_UINT cmdBuf
 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);
@@ -2240,17 +2204,6 @@ XGL_RESULT XGLAPI xglDeviceWaitIdle(
 
 // 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,
index 09537dc..756b954 100644 (file)
@@ -37,8 +37,6 @@ typedef struct _XGL_LAYER_DISPATCH_TABLE
     xglQueueSetGlobalMemReferencesType QueueSetGlobalMemReferences;
     xglQueueWaitIdleType QueueWaitIdle;
     xglDeviceWaitIdleType DeviceWaitIdle;
-    xglGetMemoryHeapCountType GetMemoryHeapCount;
-    xglGetMemoryHeapInfoType GetMemoryHeapInfo;
     xglAllocMemoryType AllocMemory;
     xglFreeMemoryType FreeMemory;
     xglSetMemoryPriorityType SetMemoryPriority;
index 1b379d7..4f936ce 100644 (file)
@@ -1038,18 +1038,6 @@ XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglDeviceWaitIdle(XGL_DEVICE device)
     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);
index 4085b15..d43ff53 100644 (file)
@@ -1092,20 +1092,6 @@ XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglDeviceWaitIdle(XGL_DEVICE device)
     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);
diff --git a/xgl.py b/xgl.py
index 84b39ee..315f676 100644 (file)
--- a/xgl.py
+++ b/xgl.py
@@ -278,17 +278,6 @@ core = Extension(
         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"),