summaryrefslogtreecommitdiff
path: root/drivers/media/video/tiler/dmm_2d_alloc.h
blob: b3b9b1997d9a61a8acda31bad7048d4152a12f9a (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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
/*
 * dmm_2d_alloc.h
 *
 * DMM driver support functions for TI OMAP processors.
 *
 * Copyright (C) 2009-2010 Texas Instruments, Inc.
 *
 * This package is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 as
 * published by the Free Software Foundation.
 *
 * THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
 */

#ifndef _DMM_2D_ALLOC_H
#define _DMM_2D_ALLOC_H

#define __NEWCODE__

enum MSP_BOOL {
	MSP_FALSE = 0,
	MSP_TRUE
};

enum SideAffinity {
	PSA_NONE,
	PSA_LEFT,
	PSA_TOP,
	PSA_BOTTOM,
	PSA_RIGHT
};

struct dmmTILERContPageAreaT {
	unsigned short x0;
	unsigned short y0;
	unsigned short x1;
	unsigned short y1;
	unsigned short xPageOfst;
	unsigned short yPageOfst;
	unsigned short xPageCount;
	unsigned short yPageCount;
	enum SideAffinity fitToSide;
	int patCustomPages;
	unsigned long *patPageEntriesSpace;
#ifdef __NEWCODE__
	struct page *page_list;
	unsigned long *page_list_virt;
#endif
	unsigned long *patPageEntries;
};

struct dmmTILERContPageAreaSpecT {
	struct dmmTILERContPageAreaT ttlExpndAr;
	struct dmmTILERContPageAreaT plmntAr;
	struct dmmTILERContPageAreaT *anchrAr;
};

struct dmmTILERContPageLstT {
	struct dmmTILERContPageLstT *pgArNext;
	struct dmmTILERContPageAreaT *anchrAr;
	struct dmmTILERContPageAreaT pgAr;
};

struct dmmTILERContCtxT {
	signed long contSizeX;
	signed long contSizeY;
	struct dmmTILERContPageLstT *usdArList;
	struct dmmTILERContPageAreaSpecT tmpArSelect;
};

/* ========================================================================== */
/**
 *  alloc2DArea()
 *
 * @brief  Allocates a 2D area and returns a pointer to it.
 *
 * @param tlrCtx - dmmTILERContCtxT* - [in] TILER context structure.
 *
 * @param areaReq - dmmTILERContPageAreaT* - [in] Required area for allcoation.
 *
 * @return dmmTILERContPageAreaT*: pointer to the allocated area.
 *
 * @pre There is no pre conditions.
 *
 * @post There is no post conditions.
 *
 * @see
 */
/* ========================================================================== */
struct dmmTILERContPageAreaT *alloc_2d_area(
	struct dmmTILERContCtxT *dmmTilerCtx,
	struct dmmTILERContPageAreaT *areaReq);

/* ========================================================================== */
/**
 *  deAlloc2DArea()
 *
 * @brief  Deletes a 2D area from the TILER context.
 *
 * @param tlrCtx - dmmTILERContCtxT* - [in] TILER context structure.
 *
 * @param areaRem - dmmTILERContPageAreaT* - [in] Area to remove.
 *
 * @return int: True if the specified area is successfuly deleted.
 *
 * @pre There is no pre conditions.
 *
 * @post There is no post conditions.
 *
 * @see
 */
/* ========================================================================== */
enum MSP_BOOL dealloc_2d_area(struct dmmTILERContCtxT *dmmTilerCtx,
			 struct dmmTILERContPageAreaT *areaRem);

/* ========================================================================== */
/**
 *  search2DArea()
 *
 * @brief  Deletes a 2D area from the TILER context.
 *
 * @param tlrCtx - dmmTILERContCtxT* - [in] TILER context structure.
 *
 * @param X - signed long - [in] X coordinate of the search area.
 *
 * @param Y - signed long - [in] X coordinate of the search area.
 *
 * @param xInvert - int - [in] X coordinate is inverted.
 *
 * @param yInvert - int - [in] Y coordinate is inverted.
 *
 * @return dmmTILERContPageAreaT*: pointer to the discovered 2D area
 * or NULL if no such area is found.
 *
 * @pre There is no pre conditions.
 *
 * @post There is no post conditions.
 *
 * @see
 */
/* ========================================================================== */
struct dmmTILERContPageAreaT *search_2d_area(
	struct dmmTILERContCtxT *dmmTilerCtx,
	signed long X,
	signed long Y,
	enum MSP_BOOL xInvert,
	enum MSP_BOOL yInvert);

#endif /* _DMM_2D_ALLOC_H */