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