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