[69061] | 1 | /* $Id: HGSMIMemAlloc.h 98103 2023-01-17 14:15:46Z vboxsync $ */
|
---|
| 2 | /*
|
---|
[98103] | 3 | * Copyright (C) 2017-2023 Oracle and/or its affiliates.
|
---|
[69061] | 4 | *
|
---|
[69346] | 5 | * Permission is hereby granted, free of charge, to any person
|
---|
| 6 | * obtaining a copy of this software and associated documentation
|
---|
| 7 | * files (the "Software"), to deal in the Software without
|
---|
| 8 | * restriction, including without limitation the rights to use,
|
---|
| 9 | * copy, modify, merge, publish, distribute, sublicense, and/or sell
|
---|
| 10 | * copies of the Software, and to permit persons to whom the
|
---|
| 11 | * Software is furnished to do so, subject to the following
|
---|
| 12 | * conditions:
|
---|
[69061] | 13 | *
|
---|
[69346] | 14 | * The above copyright notice and this permission notice shall be
|
---|
| 15 | * included in all copies or substantial portions of the Software.
|
---|
[69061] | 16 | *
|
---|
[69346] | 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
---|
| 18 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
---|
| 19 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
---|
| 20 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
---|
| 21 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
---|
| 22 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
---|
| 23 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
---|
| 24 | * OTHER DEALINGS IN THE SOFTWARE.
|
---|
[69061] | 25 | */
|
---|
| 26 |
|
---|
| 27 |
|
---|
| 28 | /* In builds inside of the VirtualBox source tree we override the default
|
---|
| 29 | * HGSMIMemAlloc.h using -include, therefore this define must match the one
|
---|
| 30 | * there. */
|
---|
[76535] | 31 |
|
---|
[76558] | 32 | #ifndef VBOX_INCLUDED_Graphics_HGSMIMemAlloc_h
|
---|
| 33 | #define VBOX_INCLUDED_Graphics_HGSMIMemAlloc_h
|
---|
[76535] | 34 | #ifndef RT_WITHOUT_PRAGMA_ONCE
|
---|
| 35 | # pragma once
|
---|
| 36 | #endif
|
---|
[69061] | 37 |
|
---|
| 38 | #include "HGSMIDefs.h"
|
---|
| 39 | #include "VBoxVideoIPRT.h"
|
---|
| 40 |
|
---|
| 41 | #define HGSMI_MA_DESC_ORDER_BASE UINT32_C(5)
|
---|
| 42 |
|
---|
| 43 | #define HGSMI_MA_BLOCK_SIZE_MIN (UINT32_C(1) << (HGSMI_MA_DESC_ORDER_BASE + 0))
|
---|
| 44 |
|
---|
| 45 | typedef struct HGSMIMADATA
|
---|
| 46 | {
|
---|
| 47 | HGSMIAREA area;
|
---|
| 48 | bool fAllocated;
|
---|
| 49 | } HGSMIMADATA;
|
---|
| 50 |
|
---|
| 51 | RT_C_DECLS_BEGIN
|
---|
| 52 |
|
---|
| 53 | int HGSMIMAInit(HGSMIMADATA *pMA, const HGSMIAREA *pArea,
|
---|
[71590] | 54 | HGSMIOFFSET *paDescriptors, uint32_t cDescriptors,
|
---|
| 55 | HGSMISIZE cbMaxBlock, const HGSMIENV *pEnv);
|
---|
[69061] | 56 | void HGSMIMAUninit(HGSMIMADATA *pMA);
|
---|
| 57 |
|
---|
[71590] | 58 | void RT_UNTRUSTED_VOLATILE_GUEST *HGSMIMAAlloc(HGSMIMADATA *pMA, HGSMISIZE cb);
|
---|
| 59 | void HGSMIMAFree(HGSMIMADATA *pMA, void RT_UNTRUSTED_VOLATILE_GUEST *pv);
|
---|
[69061] | 60 |
|
---|
| 61 | RT_C_DECLS_END
|
---|
| 62 |
|
---|
[76558] | 63 | #endif /* !VBOX_INCLUDED_Graphics_HGSMIMemAlloc_h */
|
---|