summaryrefslogtreecommitdiff
path: root/moorefield_hdmi/include/pvr/hal/img_gralloc.h
blob: d9560fa83bdcb249805c59c283ae4e90859253e3 (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
/* Copyright (c) Imagination Technologies Ltd.
 *
 * The contents of this file are subject to the MIT license as set out below.
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 * THE SOFTWARE.
 */

#ifndef IMG_GRALLOC_H
#define IMG_GRALLOC_H

#include <hardware/gralloc.h>

/* for gralloc1_rect_t */
#include <hardware/gralloc1.h>

static inline int gralloc0_register_img
	(const gralloc_module_t *g, buffer_handle_t handle)
{
	return g->registerBuffer(g, handle);
}

static inline int gralloc0_unregister_img
	(const gralloc_module_t *g, buffer_handle_t handle)
{
	return g->unregisterBuffer(g, handle);
}

static inline int gralloc0_device_alloc_img
	(alloc_device_t *d, int w, int h, int format, int usage,
	 buffer_handle_t *handle, int *stride)
{
	return d->alloc(d, w, h, format, usage, handle, stride);
}

static inline int gralloc0_device_free_img
	(alloc_device_t *d, buffer_handle_t handle)
{
	return d->free(d, handle);
}

static inline int gralloc0_lock_async_img
	(const gralloc_module_t *g, buffer_handle_t handle, int usage,
	 const gralloc1_rect_t *r, void **vaddr, int acquireFence)
{
	return g->lockAsync(g, handle, usage,
						r->left, r->top, r->width, r->height,
						vaddr, acquireFence);
}

static inline int gralloc0_unlock_async_img
	(const gralloc_module_t *g, buffer_handle_t handle, int *releaseFence)
{
	return g->unlockAsync(g, handle, releaseFence);
}

static inline int gralloc0_blit_handle_to_handle_img
	(const gralloc_module_t *g, buffer_handle_t src, buffer_handle_t dest,
	 int w, int h, int x, int y, int transform, int input_fence,
	 int *output_fence)
{
	return g->perform(g, GRALLOC_BLIT_HANDLE_TO_HANDLE_IMG, src, dest, w, h,
					  x, y, transform, input_fence, output_fence);
}

static inline int gralloc0_get_buffer_cpu_addresses_img
	(const gralloc_module_t *g, buffer_handle_t handle, void **vaddrs,
	 size_t *sizes)
{
	return g->perform(g, GRALLOC_GET_BUFFER_CPU_ADDRESSES_IMG, handle, vaddrs,
					  sizes);
}

static inline int gralloc0_put_buffer_cpu_addresses_img
	(const gralloc_module_t *g, buffer_handle_t handle)
{
	return g->perform(g, GRALLOC_PUT_BUFFER_CPU_ADDRESSES_IMG, handle);
}

static inline int gralloc0_get_display_device_img
	(const gralloc_module_t *g, void **ppvDispDev)
{
	return g->perform(g, GRALLOC_GET_DISPLAY_DEVICE_IMG, ppvDispDev);
}

static inline int gralloc0_get_display_status_img
	(const gralloc_module_t *g, buffer_handle_t handle, uint32_t *pui32Status)
{
	return g->perform(g, GRALLOC_GET_DISPLAY_STATUS_IMG, handle, pui32Status);
}

#endif /* IMG_GRALLOC_H */