blob: 9a4189f14c22c0e620853d70b857b739b3eddac9 (
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
|
/*
* Copyright (C) Texas Instruments - http://www.ti.com/
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef _TI_HANDLE_WRAPPER_H_
#define _TI_HANDLE_WRAPPER_H_
/*
* Provide wrapper api for getting fields from gralloc
* handles
*/
#define OMAP_LEGACY_HANDLE /* For now enable legacy handle by default */
#ifdef OMAP_LEGACY_HANDLE
#include "hal_public.h"
typedef IMG_native_handle_t ti_hndl_t;
#define HND_W(h) h->iWidth
#define HND_H(h) h->iHeight
#define HND_FMT(h) h->iFormat
/*
* Return total number of ion fd entries in the handle.
*
* Legacy handle does not support ion fds, so will return 0, use this test
* to determine whether to get pvr fds instead.
*/
#define GET_ION_FD_COUNT(h) 0
/*
* Return ion fd at index 'n'.
*
* Legacy handle does not support ion fds.
*/
#define GET_ION_FD(h, n) -1
/*
* Return pvr fd
*/
#define GET_PVR_FD(h) h->fd[0]
#else
#include "gralloc/gralloc_ti_handle.h"
#include "gralloc/hal_gpu_public.h"
typedef gralloc_ti_handle ti_hndl_t;
#define HND_W(h) h->width
#define HND_H(h) h->height
#define HND_FMT(h) h->format
/*
* Return total number of ion fd entries in the handle.
*/
#define GET_ION_FD_COUNT(h) ti_gralloc_handle_num_of_planes(h)
/*
* Return ion fd at index 'n'.
*
* When iterating through the fds, an fd with value < 0 indicates the start
* of the unused fd entries.
*/
#define GET_ION_FD(h, n) h->export_fds[n]
/*
* Return pvr fd
*/
#define GET_PVR_FD(h) h->gpu_sync_fd
#endif
#endif /* _TI_HANDLE_WRAPPER_H_ */
|