summaryrefslogtreecommitdiff
path: root/drivers/gpu/arm/utgard/linux/mali_memory_defer_bind.h
blob: ef67540434f51af823aa25bc1f9622a9448c36d4 (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
/*
 * Copyright (C) 2013-2015 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_DEFER_BIND_H_
#define __MALI_MEMORY_DEFER_BIND_H_


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

#include <linux/list.h>
#include <linux/mm.h>
#include <linux/rbtree.h>
#include <linux/spinlock.h>
#include <linux/types.h>


#include "mali_memory_types.h"
#include "mali_memory_os_alloc.h"
#include "mali_uk_types.h"

struct mali_gp_job;

typedef struct mali_defer_mem {
	struct list_head node;   /*dlist node in bind manager */
	u32 flag;
} mali_defer_mem;


typedef struct mali_defer_mem_block {
	struct list_head free_pages; /* page pool */
	atomic_t num_free_pages;
} mali_defer_mem_block;

/* varying memory list need to bind */
typedef struct mali_backend_bind_list {
	struct list_head node;
	struct mali_mem_backend *bkend;
	u32 vaddr;
	u32 page_num;
	struct mali_session_data *session;
	u32 flag;
} mali_backend_bind_lists;


typedef struct mali_defer_bind_manager {
	atomic_t num_used_pages;
	atomic_t num_dmem;
} mali_defer_bind_manager;

_mali_osk_errcode_t mali_mem_defer_bind_manager_init(void);
void mali_mem_defer_bind_manager_destory(void);
_mali_osk_errcode_t mali_mem_defer_bind(u32 count, struct mali_gp_job *gp,
					struct mali_defer_mem_block *dmem_block);
_mali_osk_errcode_t mali_mem_defer_bind_allocation_prepare(mali_mem_allocation *alloc, struct list_head *list);
_mali_osk_errcode_t mali_mem_prepare_mem_for_job(struct mali_gp_job *next_gp_job, mali_defer_mem_block *dblock);
void mali_mem_defer_dmem_free(struct mali_gp_job *gp);

#endif