aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/misc/gcx/gcbv/gcmain.h
blob: 45b55b6753fc9830b6ad1ebf25eab0ec94cbfeb8 (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
/*
 * gcmain.h
 *
 * Copyright (C) 2010-2011 Vivante Corporation.
 *
 * 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 GCMAIN_H
#define GCMAIN_H

#include <linux/slab.h>
#include <linux/module.h>
#include <linux/vmalloc.h>
#include <linux/dma-mapping.h>
#include <linux/list.h>
#include <linux/gcx.h>
#include <linux/gcioctl.h>
#include <linux/gccore.h>
#include <linux/bltsville.h>
#include <linux/bvinternal.h>

#define GC_DEV_NAME	"gc2d"


/*******************************************************************************
 * Miscellaneous macros.
 */

#define gcalloc(type, size) \
	kmalloc(size, GFP_KERNEL)

#define gcfree(ptr) \
	kfree(ptr)


/*******************************************************************************
 * Core driver API definitions.
 */

#define gc_getcaps_wrapper(gcicaps) \
	gc_caps(gcicaps)

#define gc_commit_wrapper(gcicommit) \
	gc_commit(gcicommit, false)

#define gc_map_wrapper(gcimap) \
	gc_map(gcimap, false)

#define gc_unmap_wrapper(gcimap) \
	gc_unmap(gcimap, false)

#define gc_callback_wrapper(gcicallbackarm) \
	gc_callback(gcicallbackarm, false)


/*******************************************************************************
 * Surface allocation.
 */

enum bverror allocate_surface(struct bvbuffdesc **bvbuffdesc,
			      void **buffer,
			      unsigned int size);

void free_surface(struct bvbuffdesc *bvbuffdesc,
		  void *buffer);


/*******************************************************************************
 * Floating point conversions.
 */

unsigned char gcfp2norm8(float value);


/*******************************************************************************
 * Cache operation wrapper.
 */

enum bverror gcbvcacheop(int count, struct c2dmrgn rgn[],
			 enum bvcacheop cacheop);


/*******************************************************************************
 * BLTsville API.
 */

void bv_init(void);
void bv_exit(void);

enum bverror bv_map(struct bvbuffdesc *buffdesc);
enum bverror bv_unmap(struct bvbuffdesc *buffdesc);
enum bverror bv_blt(struct bvbltparams *bltparams);
enum bverror bv_cache(struct bvcopparams *copparams);

#endif