blob: 92ec2372a899617043cbabae868bdd13ad362aff [file] [log] [blame]
Chia-I Wuf9911eb2014-08-06 13:50:31 +08001/*
2 * XGL
3 *
4 * Copyright (C) 2014 LunarG, Inc.
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * copy of this software and associated documentation files (the "Software"),
8 * to deal in the Software without restriction, including without limitation
9 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10 * and/or sell copies of the Software, and to permit persons to whom the
11 * Software is furnished to do so, subject to the following conditions:
12 *
13 * The above copyright notice and this permission notice shall be included
14 * in all copies or substantial portions of the Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22 * DEALINGS IN THE SOFTWARE.
23 */
24
25#ifndef MEM_H
26#define MEM_H
27
28#include "intel.h"
29
30struct intel_bo;
31
32struct intel_mem {
33 struct intel_base base;
34
35 struct intel_bo *bo;
36};
37
38XGL_RESULT intel_mem_alloc(struct intel_dev *dev,
39 const XGL_MEMORY_ALLOC_INFO *info,
40 struct intel_mem **mem_ret);
41void intel_mem_free(struct intel_mem *mem);
42
43XGL_RESULT intel_mem_set_priority(struct intel_mem *mem,
44 XGL_MEMORY_PRIORITY priority);
45
46void *intel_mem_map(struct intel_mem *mem, XGL_FLAGS flags);
47void intel_mem_unmap(struct intel_mem *mem);
48
49static inline struct intel_mem *intel_mem(XGL_GPU_MEMORY mem)
50{
51 return (struct intel_mem *) mem;
52}
53
54XGL_RESULT XGLAPI intelAllocMemory(
55 XGL_DEVICE device,
56 const XGL_MEMORY_ALLOC_INFO* pAllocInfo,
57 XGL_GPU_MEMORY* pMem);
58
59XGL_RESULT XGLAPI intelFreeMemory(
60 XGL_GPU_MEMORY mem);
61
62XGL_RESULT XGLAPI intelSetMemoryPriority(
63 XGL_GPU_MEMORY mem,
64 XGL_MEMORY_PRIORITY priority);
65
66XGL_RESULT XGLAPI intelMapMemory(
67 XGL_GPU_MEMORY mem,
68 XGL_FLAGS flags,
69 XGL_VOID** ppData);
70
71XGL_RESULT XGLAPI intelUnmapMemory(
72 XGL_GPU_MEMORY mem);
73
74#endif /* MEM_H */