Claims
- 1. A method for video memory management in a computer environment having a main processing unit for executing an operating system and an application, a system memory, and a graphics processing unit having an aperture that maps, in a tiled manner, between a portion of system memory and the graphics processing unit, the method comprising:
managing memory for video data in a heap that is in a private address space of the application; allocating virtual memory and maintaining mappings between the allocated virtual memory, the heap, and the aperture such that both the main processing unit and the graphics processing unit can view the data in an untiled manner.
- 2. The method as recited in claim 1, wherein managing memory and maintaining mappings comprises:
allocating memory in a rectangular heap in an application private address range for storing a static allocation of video data, the static allocation of video data not being directly accessible by the main processing unit; finding a region in the address range of the graphics processing unit aperture large enough to store the static allocation of video data; populating the found region with free pages; and copying the static allocation of video data from the rectangular heap to the address range of the graphics processing unit aperture.
- 3. The method as recited in claim 2, wherein managing memory and maintaining mappings further comprises:
copying the static allocation of video data from the address range of the graphics processing unit aperture to the rectangular heap; and unpopulating the found region of the graphics processing unit aperture.
- 4. The method as recited in claim 1, wherein managing memory and maintaining mappings comprises:
expanding a static allocation of video data to a multiple of a tile size of the graphics processing unit aperture; allocating memory in a rectangular heap in an application private address range for storing the expanded static allocation of video data, the static allocation of video data not being directly accessible by the main processing unit; finding a region in the address range of the graphics processing unit aperture large enough to store the unexpanded static allocation of video data; locking the memory allocated in the rectangular heap; and mapping the found region in the address range of the graphics processing unit aperture to the memory allocated in the rectangular heap.
- 5. The method as recited in claim 4, wherein managing memory and maintaining mappings further comprises:
unmapping the found region in the address range of the graphics processing unit aperture from the memory allocated in the rectangular heap; and unlocking the memory allocated in the rectangular heap.
- 6. The method as recited in claim 1, wherein managing memory and maintaining mappings comprises:
allocating memory in a rectangular heap in an application private address range for storing a static allocation of video data, the static allocation of video data not being directly accessible by the main processing unit; finding a region in the address range of the graphics processing unit aperture large enough to store the static allocation of video data; locking the memory allocated in the rectangular heap; and mapping the found region in the address range of the graphics processing unit aperture to the memory allocated in the rectangular heap.
- 7. The method as recited in claim 6, wherein managing memory and maintaining mappings further comprises:
unmapping the found region in the address range of the graphics processing unit aperture from the memory allocated in the rectangular heap; and unlocking the memory allocated in the rectangular heap.
- 8. The method as recited in claim 1, wherein managing memory and maintaining mappings comprises:
allocating memory in a linear heap in an application private address range for storing a dynamic allocation of video data, the dynamic allocation of video data being directly accessible by the main processing unit; finding a linear region in the address range of the graphics processing unit aperture large enough to store the dynamic allocation of video data; locking the memory allocated in the linear heap; and mapping the found region in the address range of the graphics processing unit aperture to the memory allocated in the linear heap.
- 9. The method as recited in claim 8, wherein managing memory and maintaining mappings further comprises:
unmapping the found region in the address range of the graphics processing unit aperture from the memory allocated in the linear heap; and unlocking the memory allocated in the linear heap.
- 10. The method as recited in claim 8, wherein managing memory and maintaining mappings further comprises:
giving the address of the memory allocated in the linear heap to the application.
- 11. The method as recited in claim 1, wherein managing memory and maintaining mappings comprises:
allocating memory in a linear heap in an application private address range for storing a dynamic allocation of video data, the dynamic allocation of video data being directly accessible by the main processing unit; finding a rectangular region in the address range of the graphics processing unit aperture large enough to store the dynamic allocation of video data; locking the memory allocated in the linear heap; and mapping the found region in the address range of the graphics processing unit aperture to the memory allocated in the linear heap.
- 12. The method as recited in claim 11, wherein managing memory and maintaining mappings further comprises:
unmapping the found region in the address range of the graphics processing unit aperture from the memory allocated in the linear heap; and unlocking the memory allocated in the linear heap.
- 13. The method as recited in claim 11, wherein managing memory and maintaining mappings further comprises:
allocating a temporary buffer having an address; untiling the dynamic allocation of video data from the memory allocated in the linear heap into the temporary buffer; and giving the application the address of the temporary buffer to the application.
- 14. The method as recited in claim 13, wherein managing memory and maintaining mappings further comprises:
tiling the dynamic allocation of video data from the temporary buffer into the memory allocated in the linear heap; and freeing the temporary buffer.
- 15. The method as recited in claim 1, wherein managing memory and maintaining mappings comprises:
allocating memory in a rectangular heap in an application private address range for storing a dynamic allocation of video data, the dynamic allocation of video data being directly accessible by the main processing unit; finding a rectangular region in the address range of the graphics processing unit aperture large enough to store the dynamic allocation of video data; populating the found region with free pages; and tiling the dynamic allocation of video data from the memory allocated in the rectangular heap to the found address range of the graphics processing unit aperture.
- 16. The method as recited in claim 15, wherein managing memory and maintaining mappings further comprises:
rotating a virtual address for the dynamic allocation of video data from the found address range of the graphics processing unit aperture to the memory allocated in the rectangular heap, if the virtual address currently points to the found address range of the graphics processing unit aperture; untiling the dynamic allocation of video data from the found address range of the graphics processing unit aperture to the memory allocated in the rectangular heap; and unpopulating the found region of the graphics processing unit aperture.
- 17. The method as recited in claim 15, wherein managing memory and maintaining mappings further comprises:
rotating a virtual address for the dynamic allocation of video data from the memory allocated in the rectangular heap to the found address range of the graphics processing unit aperture, if the virtual address currently points to the memory allocated in the rectangular heap; giving the address of the memory allocated in the rectangular heap to the application.
- 18. The method as recited in claim 1, wherein managing memory and maintaining mappings comprises:
allocating memory in a rectangular heap in an application private address range for storing a dynamic allocation of video data, the dynamic allocation of video data being directly accessible by the main processing unit; finding a rectangular region in the address range of the graphics processing unit aperture large enough to store the dynamic allocation of video data; populating the found region with free pages; and tiling the dynamic allocation of video data from the memory allocated in the rectangular heap to the found address range of the graphics processing unit aperture.
- 19. The method as recited in claim 18, wherein managing memory and maintaining mappings further comprises:
rotating a virtual address for the dynamic allocation of video data from the found address range of the graphics processing unit aperture to the memory allocated in the rectangular heap, if the virtual address currently points to the found address range of the graphics processing unit aperture; untiling the dynamic allocation of video data from the found address range of the graphics processing unit aperture to the memory allocated in the rectangular heap; and unpopulating the found region of the graphics processing unit aperture.
- 20. The method as recited in claim 18, wherein managing memory and maintaining mappings further comprises:
evicting the dynamic allocation of video data from the found address range of the graphics processing unit aperture; and giving the address of the memory allocated in the rectangular heap to the application.
- 21. The method as recited in claim 1, wherein managing memory and maintaining mappings comprises:
allocating memory in a rectangular heap in an application private address range for storing a dynamic allocation of video data, the dynamic allocation of video data being directly accessible by the main processing unit; allocating memory in a linear heap in an application private address range for storing a dynamic allocation of video data, the dynamic allocation of video data being directly accessible by the main processing unit; finding a rectangular region in the address range of the graphics processing unit aperture large enough to store the dynamic allocation of video data; locking the memory allocated in the linear heap; and mapping the found region in the address range of the graphics processing unit aperture to the rectangular heap.
- 22. The method as recited in claim 21, wherein managing memory and maintaining mappings further comprises:
rotating a virtual address for the dynamic allocation of video data from the found address range of the graphics processing unit aperture to the memory allocated in the rectangular heap, if the virtual address currently points to the found address range of the graphics processing unit aperture; unmapping the found region in the address range of the graphics processing unit aperture from the rectangular heap; and unlocking the memory allocated in the linear heap.
- 23. The method as recited in claim 21, wherein managing memory and maintaining mappings further comprises:
paging the dynamic allocation of video data into the found address range of the graphics processing unit aperture; rotating a virtual address for the dynamic allocation of video data from the found address range of the graphics processing unit aperture to the memory allocated in the rectangular heap, if the virtual address currently points to the found address range of the graphics processing unit aperture; and giving the address of the memory allocated in the rectangular heap to the application.
- 24. The method as recited in claim 21, wherein managing memory and maintaining mappings further comprises:
tiling the dynamic allocation of video data from the memory allocated in the linear heap to the memory allocated in the linear heap, if the dynamic allocation of video data was evicted.
CROSS-REFERENCE TO RELATED APPLICATIONS
[0001] This application claims priority of U.S. Provisional Application Ser. No. 60/448,400 entitled “Video Memory Manager Rectangular Heap,” filed Feb. 18, 2003. This application is related to co-pending application U.S. patent application Ser. No. ______ (Attorney Docket No. MSFT-2812/304049.02) entitled “Video Memory Management,” filed Dec. 30, 2003, and incorporated by reference herein in its entirety.
Provisional Applications (1)
|
Number |
Date |
Country |
|
60448400 |
Feb 2003 |
US |