2 * Copyright@ Samsung Electronics Co. LTD
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
18 * \file ExynosBuffer.h
19 * \brief header file for ExynosBuffer
20 * \author Sangwoo, Park(sw5771.park@samsung.com)
23 * <b>Revision History: </b>
24 * - 2010/06/03 : Sangwoo, Park(sw5771.park@samsung.com) \n
27 * - 2012/03/14 : sangwoo.park(sw5771.park@samsung.com) \n
28 * Change file, struct name to ExynosXXX.
32 #ifndef EXYNOS_BUFFER_H_
33 #define EXYNOS_BUFFER_H_
35 #include <sys/types.h>
37 //! Buffer information
48 BUFFER_TYPE_VIRT
= 1, //!< virtual address
49 BUFFER_TYPE_PHYS
= 1 << 1, //!< physical address
50 BUFFER_TYPE_RESERVED
= 1 << 2, //!< reserved type
51 BUFFER_TYPE_FD
= 1 << 3, //!< physical address
55 //! Buffer virtual address
57 char *p
; //! single address.
58 char *extP
[3]; //! Y Cb Cr.
61 //! Buffer physical address
63 unsigned int p
; //! single address.
64 unsigned int extP
[3]; //! Y Cb Cr.
67 //! Buffer file descriptors
73 //! Buffer reserved id
75 unsigned int p
; //! \n
76 unsigned int extP
[3]; //! \n
89 for (int i
= 0; i
< 3; i
++) {
99 ExynosBuffer(const ExynosBuffer
*other
)
101 for (int i
= 0; i
< 3; i
++) {
102 virt
. extP
[i
] = other
->virt
.extP
[i
];
103 phys
. extP
[i
] = other
->phys
.extP
[i
];
104 fd
. extFd
[i
] = other
->fd
.extFd
[i
];
105 reserved
.extP
[i
] = other
->reserved
.extP
[i
];
106 size
. extS
[i
] = other
->size
.extS
[i
];
110 //! Operator(=) override
111 ExynosBuffer
& operator =(const ExynosBuffer
&other
)
113 for (int i
= 0; i
< 3; i
++) {
114 virt
. extP
[i
] = other
.virt
.extP
[i
];
115 phys
. extP
[i
] = other
.phys
.extP
[i
];
116 fd
. extFd
[i
] = other
.fd
.extFd
[i
];
117 reserved
.extP
[i
] = other
.reserved
.extP
[i
];
118 size
. extS
[i
] = other
.size
.extS
[i
];
123 //! Operator(==) override
124 bool operator ==(const ExynosBuffer
&other
) const
126 return ( virt
. extP
[0] == other
.virt
.extP
[0]
127 && virt
. extP
[1] == other
.virt
.extP
[1]
128 && virt
. extP
[2] == other
.virt
.extP
[2]
129 && phys
. extP
[0] == other
.phys
.extP
[0]
130 && phys
. extP
[1] == other
.phys
.extP
[1]
131 && phys
. extP
[2] == other
.phys
.extP
[2]
132 && fd
. extFd
[0] == other
.fd
.extFd
[0]
133 && fd
. extFd
[1] == other
.fd
.extFd
[1]
134 && fd
. extFd
[2] == other
.fd
.extFd
[2]
135 && reserved
.extP
[0] == other
.reserved
.extP
[0]
136 && reserved
.extP
[1] == other
.reserved
.extP
[1]
137 && reserved
.extP
[2] == other
.reserved
.extP
[2]
138 && size
. extS
[0] == other
.size
.extS
[0]
139 && size
. extS
[1] == other
.size
.extS
[1]
140 && size
. extS
[2] == other
.size
.extS
[2]);
143 //! Operator(!=) override
144 bool operator !=(const ExynosBuffer
&other
) const
147 return !(*this == other
);
151 static int BUFFER_TYPE(ExynosBuffer
*buf
)
153 int type
= BUFFER_TYPE_BASE
;
155 type
|= BUFFER_TYPE_VIRT
;
157 type
|= BUFFER_TYPE_PHYS
;
159 type
|= BUFFER_TYPE_FD
;
161 type
|= BUFFER_TYPE_RESERVED
;
168 #endif //EXYNOS_BUFFER_H_