summaryrefslogtreecommitdiff
path: root/include/linux/compdev.h
blob: 9e707c7b770725cf4f6b22c5fde13d68b01f15ee (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
/*
 * Copyright (C) ST-Ericsson SA 2011
 *
 * ST-Ericsson Display overlay compositer device driver
 *
 * Author: Anders Bauer <anders.bauer@stericsson.com>
 * for ST-Ericsson.
 *
 * Modified: Per-Daniel Olsson <per-daniel.olsson@stericsson.com>
 * for ST-Ericsson.
 *
 * License terms: GNU General Public License (GPL), version 2.
 */

#ifndef _COMPDEV_H_
#define _COMPDEV_H_

#if !defined(__KERNEL__) && !defined(_KERNEL)
#include <stdint.h>
#else
#include <linux/types.h>
#include <video/mcde.h>
#endif

#if defined(__KERNEL__) || defined(_KERNEL)
#include <linux/mm_types.h>
#include <linux/bitops.h>
#else
#define BIT(nr)			(1UL << (nr))
#endif

#define COMPDEV_DEFAULT_DEVICE_PREFIX "comp"
#define NUM_COMPDEV_BUFS 2

enum compdev_fmt {
	COMPDEV_FMT_RGB565,
	COMPDEV_FMT_RGB888,
	COMPDEV_FMT_RGBX8888,
	COMPDEV_FMT_RGBA8888,
	COMPDEV_FMT_YUV422,
};

struct compdev_size {
	uint16_t width;
	uint16_t height;
};

/* Display rotation */
enum compdev_rotation {
	COMPDEV_ROT_0       = 0,
	COMPDEV_ROT_90_CCW  = 90,
	COMPDEV_ROT_180_CCW = 180,
	COMPDEV_ROT_270_CCW = 270,
	COMPDEV_ROT_90_CW   = COMPDEV_ROT_270_CCW,
	COMPDEV_ROT_180_CW  = COMPDEV_ROT_180_CCW,
	COMPDEV_ROT_270_CW  = COMPDEV_ROT_90_CCW,
};

enum compdev_ptr_type {
	COMPDEV_PTR_PHYSICAL,
	COMPDEV_PTR_HWMEM_BUF_NAME_OFFSET,
};

struct compdev_rect {
	__s32  x;
	__s32  y;
	__s32  width;
	__s32  height;
};

struct compdev_buf {
	enum compdev_ptr_type  type;
	__s32                  hwmem_buf_name;
	__s32                  fd;
	__u32                  offset;
	__u32                  len;
};

struct compdev_img {
	enum compdev_fmt     fmt;
	struct compdev_buf   buf;
	__s32                width;
	__s32                height;
	__u32                pitch;
	struct compdev_rect  dst_rect;
};

struct compdev_post_buffers_req {
	enum   compdev_rotation  rotation;
	struct compdev_img       img_buffers[NUM_COMPDEV_BUFS];
	__u8                     buffer_count;
};

#define COMPDEV_GET_SIZE_IOC       _IOR('D', 1, struct compdev_size)
#define COMPDEV_POST_BUFFERS_IOC   _IOW('D', 2, struct compdev_post_buffers_req)

#ifdef __KERNEL__

int compdev_create(struct mcde_display_device *ddev,
		struct mcde_overlay *parent_ovly);
void compdev_destroy(struct mcde_display_device *ddev);

#endif /* __KERNEL__ */

#endif /* _COMPDEV_H_ */