pvrsrv_memalloc_physheap.h 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. /*************************************************************************/ /*!
  2. @File pvrsrv_memalloc_physheap.h
  3. @Title Services Phys Heap types
  4. @Copyright Copyright (c) Imagination Technologies Ltd. All Rights Reserved
  5. @Description Used in creating and allocating from Physical Heaps.
  6. @License Dual MIT/GPLv2
  7. The contents of this file are subject to the MIT license as set out below.
  8. Permission is hereby granted, free of charge, to any person obtaining a copy
  9. of this software and associated documentation files (the "Software"), to deal
  10. in the Software without restriction, including without limitation the rights
  11. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  12. copies of the Software, and to permit persons to whom the Software is
  13. furnished to do so, subject to the following conditions:
  14. The above copyright notice and this permission notice shall be included in
  15. all copies or substantial portions of the Software.
  16. Alternatively, the contents of this file may be used under the terms of
  17. the GNU General Public License Version 2 ("GPL") in which case the provisions
  18. of GPL are applicable instead of those above.
  19. If you wish to allow use of your version of this file only under the terms of
  20. GPL, and not to allow others to use your version of this file under the terms
  21. of the MIT license, indicate your decision by deleting the provisions above
  22. and replace them with the notice and other provisions required by GPL as set
  23. out in the file called "GPL-COPYING" included in this distribution. If you do
  24. not delete the provisions above, a recipient may use your version of this file
  25. under the terms of either the MIT license or GPL.
  26. This License is also included in this distribution in the file called
  27. "MIT-COPYING".
  28. EXCEPT AS OTHERWISE STATED IN A NEGOTIATED AGREEMENT: (A) THE SOFTWARE IS
  29. PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
  30. BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
  31. PURPOSE AND NONINFRINGEMENT; AND (B) IN NO EVENT SHALL THE AUTHORS OR
  32. COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  33. IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  34. CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  35. */ /**************************************************************************/
  36. #ifndef PVRSRV_MEMALLOC_PHYSHEAP_H
  37. #define PVRSRV_MEMALLOC_PHYSHEAP_H
  38. #include "img_defs.h"
  39. /*
  40. * These IDs are replicated in the Device Memory allocation flags to allow
  41. * allocations to be made in terms of their locality/use to ensure the correct
  42. * physical heap is accessed for the given system/platform configuration.
  43. * A system Phys Heap Config is linked to one or more Phys Heaps. When a heap
  44. * is not present in the system configuration the allocation will fallback to
  45. * the default GPU_LOCAL physical heap which all systems must define.
  46. * See PVRSRV_MEMALLOCFLAGS_*_MAPPABLE_MASK.
  47. *
  48. * NOTE: Enum order important, table in physheap.c must change if order changed.
  49. */
  50. typedef enum
  51. {
  52. /* Services client accessible heaps */
  53. PVRSRV_PHYS_HEAP_DEFAULT = 0, /* default phys heap for device memory allocations */
  54. PVRSRV_PHYS_HEAP_GPU_LOCAL = 1, /* used for buffers with more GPU access than CPU */
  55. PVRSRV_PHYS_HEAP_CPU_LOCAL = 2, /* used for buffers with more CPU access than GPU */
  56. PVRSRV_PHYS_HEAP_GPU_PRIVATE = 3, /* used for buffers that only required GPU read/write access, not visible to the CPU. */
  57. /* Services internal heaps */
  58. PVRSRV_PHYS_HEAP_FW_MAIN = 4, /* runtime data, e.g. CCBs, sync objects */
  59. PVRSRV_PHYS_HEAP_EXTERNAL = 5, /* used by some PMR import/export factories where the physical memory heap is not managed by the pvrsrv driver */
  60. PVRSRV_PHYS_HEAP_GPU_COHERENT = 6, /* used for a cache coherent region */
  61. PVRSRV_PHYS_HEAP_GPU_SECURE = 7, /* used by security validation */
  62. PVRSRV_PHYS_HEAP_FW_CONFIG = 8, /* subheap of FW_MAIN, configuration data for FW init */
  63. PVRSRV_PHYS_HEAP_FW_CODE = 9, /* used by security validation or dedicated fw */
  64. PVRSRV_PHYS_HEAP_FW_PRIV_DATA = 10, /* internal FW data (like the stack, FW control data structures, etc.) */
  65. PVRSRV_PHYS_HEAP_FW_PREMAP0 = 11, /* Host OS premap fw heap */
  66. PVRSRV_PHYS_HEAP_FW_PREMAP1 = 12, /* Guest OS 1 premap fw heap */
  67. PVRSRV_PHYS_HEAP_FW_PREMAP2 = 13, /* Guest OS 2 premap fw heap */
  68. PVRSRV_PHYS_HEAP_FW_PREMAP3 = 14, /* Guest OS 3 premap fw heap */
  69. PVRSRV_PHYS_HEAP_FW_PREMAP4 = 15, /* Guest OS 4 premap fw heap */
  70. PVRSRV_PHYS_HEAP_FW_PREMAP5 = 16, /* Guest OS 5 premap fw heap */
  71. PVRSRV_PHYS_HEAP_FW_PREMAP6 = 17, /* Guest OS 6 premap fw heap */
  72. PVRSRV_PHYS_HEAP_FW_PREMAP7 = 18, /* Guest OS 7 premap fw heap */
  73. PVRSRV_PHYS_HEAP_LAST
  74. } PVRSRV_PHYS_HEAP;
  75. static_assert(PVRSRV_PHYS_HEAP_LAST <= (0x1FU + 1U), "Ensure enum fits in memalloc flags bitfield.");
  76. typedef struct _PHYS_HEAP_MEM_STATS_
  77. {
  78. IMG_UINT64 ePhysHeapID;
  79. IMG_UINT64 ui64TotalSize;
  80. IMG_UINT64 ui64FreeSize;
  81. }PHYS_HEAP_MEM_STATS, *PHYS_HEAP_MEM_STATS_PTR;
  82. #endif /* PVRSRV_MEMALLOC_PHYSHEAP_H */