aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/samsung/mali/common/mali_memory.h
blob: 78e294595bbbee8ae68152ab9f2183f346cbaecf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
/*
 * Copyright (C) 2010-2012 ARM Limited. All rights reserved.
 * 
 * This program is free software and is provided to you under the terms of the GNU General Public License version 2
 * as published by the Free Software Foundation, and any use by you of this program is subject to the terms of such GNU licence.
 * 
 * A copy of the licence is included with the program, and can also be obtained from Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 */

#ifndef __MALI_MEMORY_H__
#define __MALI_MEMORY_H__

#include "mali_osk.h"
#include "mali_session.h"

struct mali_cluster;
struct mali_group;

/** @brief Initialize Mali memory subsystem
 *
 * Allocate and initialize internal data structures. Must be called before
 * allocating Mali memory.
 *
 * @return On success _MALI_OSK_ERR_OK, othervise some error code describing the error.
 */
_mali_osk_errcode_t mali_memory_initialize(void);

/** @brief Terminate Mali memory system
 *
 * Clean up and release internal data structures.
 */
void mali_memory_terminate(void);

/** @brief Start new Mali memory session
 *
 * Allocate and prepare session specific memory allocation data data. The
 * session page directory, lock, and descriptor map is set up.
 *
 * @param mali_session_data pointer to the session data structure
 */
_mali_osk_errcode_t mali_memory_session_begin(struct mali_session_data *mali_session_data);

/** @brief Close a Mali memory session
 *
 * Release session specific memory allocation related data.
 *
 * @param mali_session_data pointer to the session data structure
 */
void mali_memory_session_end(struct mali_session_data *mali_session_data);

/** @brief Allocate a page table page
 *
 * Allocate a page for use as a page directory or page table. The page is
 * mapped into kernel space.
 *
 * @return _MALI_OSK_ERR_OK on success, othervise an error code
 * @param table_page GPU pointer to the allocated page
 * @param mapping CPU pointer to the mapping of the allocated page
 */
_mali_osk_errcode_t mali_mmu_get_table_page(u32 *table_page, mali_io_address *mapping);

/** @brief Release a page table page
 *
 * Release a page table page allocated through \a mali_mmu_get_table_page
 *
 * @param pa the GPU address of the page to release
 */
void mali_mmu_release_table_page(u32 pa);


/** @brief Parse resource and prepare the OS memory allocator
 */
_mali_osk_errcode_t mali_memory_core_resource_os_memory(_mali_osk_resource_t * resource);

/** @brief Parse resource and prepare the dedicated memory allocator
 */
_mali_osk_errcode_t mali_memory_core_resource_dedicated_memory(_mali_osk_resource_t * resource);

mali_allocation_engine mali_mem_get_memory_engine(void);

#endif /* __MALI_MEMORY_H__ */