Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

89 lines
4.0 KiB

  1. /******************************Module*Header*******************************\
  2. *
  3. * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  4. * !! !!
  5. * !! WARNING: NOT DDK SAMPLE CODE !!
  6. * !! !!
  7. * !! This source code is provided for completeness only and should not be !!
  8. * !! used as sample code for display driver development. Only those sources !!
  9. * !! marked as sample code for a given driver component should be used for !!
  10. * !! development purposes. !!
  11. * !! !!
  12. * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  13. *
  14. * Module Name: linalloc.h
  15. *
  16. * Content:
  17. *
  18. * Copyright (c) 1994-1999 3Dlabs Inc. Ltd. All rights reserved.
  19. * Copyright (c) 1995-2003 Microsoft Corporation. All rights reserved.
  20. \*****************************************************************************/
  21. #ifndef __LINALLOC_H_
  22. #define __LINALLOC_H_
  23. // Result values from calls to videomem allocator functions
  24. #define GLDD_FAILED ((DWORD)(-1))
  25. #define GLDD_SUCCESS 0
  26. #define GLDD_NOMEM 1
  27. #define GLDD_INVALIDARGS 2
  28. #define GLDD_FREE_REFERENCE 3
  29. typedef struct tagMEMREQUEST
  30. {
  31. DWORD dwSize; // Size of this structure
  32. DWORD dwFlags; // Flags for this allocation
  33. DWORD dwAlign; // Alignment (minimum 4 Bytes)
  34. DWORD dwBytes; // Bytes to allocated (aligned up to DWORD multiples)
  35. DWORD pMem; // Pointer to the start of the memory returned
  36. } P3_MEMREQUEST, *LPMEMREQUEST;
  37. // P3_MEMREQUEST.dwFlags values for memory allocation
  38. // Favour which end of memory?
  39. #define MEM3DL_FRONT 1
  40. #define MEM3DL_BACK 2
  41. // Allocation strategy
  42. #define MEM3DL_FIRST_FIT 8
  43. typedef struct LinearAllocatorInfo;
  44. typedef void (*LinearAllocatorCallbackFn)( DWORD, DWORD );
  45. // Video local memory allocation functions
  46. BOOL _DX_LIN_InitialiseHeapManager(LinearAllocatorInfo* pAlloc,
  47. DWORD dwMemStar, DWORD dwMemEnd);
  48. void _DX_LIN_UnInitialiseHeapManager(LinearAllocatorInfo* pAlloc);
  49. DWORD _DX_LIN_GetFreeMemInHeap(LinearAllocatorInfo* pAlloc);
  50. DWORD _DX_LIN_AllocateLinearMemory(LinearAllocatorInfo* pAlloc,
  51. LPMEMREQUEST lpmmrq);
  52. DWORD _DX_LIN_FreeLinearMemory(LinearAllocatorInfo* pAlloc,
  53. DWORD dwPointer);
  54. // We will use a bitwise memory map to keep track of used & free memory
  55. // (The size of this structure will be for now 32K , which will give us
  56. // a total of 256K chunks, which for a 32MB heap means each chunk
  57. // controls 128 bytes)
  58. #define MEMORY_MAP_SIZE (32*1024)/sizeof(DWORD)
  59. typedef DWORD MemoryMap[MEMORY_MAP_SIZE]; // Chunks memory map
  60. typedef struct tagHashTable HashTable; // Forward decl when referenced from GDI
  61. typedef struct tagLinearAllocatorInfo
  62. {
  63. BOOL bResetLinAllocator; // Bool to signal us the allocators
  64. // have been reset from the 16 bit side
  65. DWORD dwMemStart; // Start of the managed memory
  66. DWORD dwMemEnd; // End of the managed memory
  67. DWORD dwMaxChunks; // Max # of chunks (can't exceed
  68. // MEMORY_MAP_SIZE*CHUNKS_PER_ELEM)
  69. DWORD dwMemPerChunk; // How much heap memory each chunk
  70. // controls
  71. MemoryMap *pMMap; // Ptr to allocations memory map
  72. MemoryMap *pLenMap; // Ptr to lenghts memory map so we don't
  73. // have to keep the sizes allocated to
  74. // each request
  75. } LinearAllocatorInfo;
  76. #endif // __LINALLOC_H_