huangcm
2025-02-26 a813214788f6e7b512df54f1c659cd0bdc9ac175
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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
/*
 * Copyright (c) 2007-2017 Allwinnertech Co., Ltd.
 *
 * This software is licensed under the terms of the GNU General Public
 * License version 2, as published by the Free Software Foundation, and
 * may be copied, distributed, and modified under those terms.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 */
 
#ifndef __SUNXI_TR_H__
#define __SUNXI_TR_H__
 
extern u32 dbg_inf;
 
#define TR_INFO_MSG(fmt, args...) \
   do {\
       if (dbg_inf)\
       pr_info("[TR-%s] line:%d: " fmt, __func__, __LINE__, ##args);\
   } while (0)
 
typedef enum {
   TR_FORMAT_ARGB_8888                    = 0x00,/* MSB  A-R-G-B  LSB */
   TR_FORMAT_ABGR_8888                    = 0x01,
   TR_FORMAT_RGBA_8888                    = 0x02,
   TR_FORMAT_BGRA_8888                    = 0x03,
   TR_FORMAT_XRGB_8888                    = 0x04,
   TR_FORMAT_XBGR_8888                    = 0x05,
   TR_FORMAT_RGBX_8888                    = 0x06,
   TR_FORMAT_BGRX_8888                    = 0x07,
   TR_FORMAT_RGB_888                      = 0x08,
   TR_FORMAT_BGR_888                      = 0x09,
   TR_FORMAT_RGB_565                      = 0x0a,
   TR_FORMAT_BGR_565                      = 0x0b,
   TR_FORMAT_ARGB_4444                    = 0x0c,
   TR_FORMAT_ABGR_4444                    = 0x0d,
   TR_FORMAT_RGBA_4444                    = 0x0e,
   TR_FORMAT_BGRA_4444                    = 0x0f,
   TR_FORMAT_ARGB_1555                    = 0x10,
   TR_FORMAT_ABGR_1555                    = 0x11,
   TR_FORMAT_RGBA_5551                    = 0x12,
   TR_FORMAT_BGRA_5551                    = 0x13,
 
   /* SP: semi-planar, P:planar, I:interleaved
    * UVUV: U in the LSBs;     VUVU: V in the LSBs
    */
   /*MSB A-Y-U-V LSB, reserved*/
   TR_FORMAT_YUV444_I_AYUV                = 0x40,
   TR_FORMAT_YUV444_I_VUYA                = 0x41,/*MSB  V-U-Y-A  LSB*/
   TR_FORMAT_YUV422_I_YVYU                = 0x42,/*MSB  Y-V-Y-U  LSB*/
   TR_FORMAT_YUV422_I_YUYV                = 0x43,/*MSB  Y-U-Y-V  LSB*/
   TR_FORMAT_YUV422_I_UYVY                = 0x44,/*MSB  U-Y-V-Y  LSB*/
   TR_FORMAT_YUV422_I_VYUY                = 0x45,/*MSB  V-Y-U-Y  LSB*/
   /*MSB  P3-2-1-0 LSB,  YYYY UUUU VVVV, reserved*/
   TR_FORMAT_YUV444_P                     = 0x46,
   /*MSB  P3-2-1-0 LSB   YYYY UU   VV*/
   TR_FORMAT_YUV422_P                     = 0x47,
   /*MSB  P3-2-1-0 LSB   YYYY U    V*/
   TR_FORMAT_YUV420_P                     = 0x48,
   /*MSB  P3-2-1-0 LSB   YYYY U    V*/
   TR_FORMAT_YUV411_P                     = 0x49,
   TR_FORMAT_YUV422_SP_UVUV               = 0x4a,/*MSB  V-U-V-U  LSB*/
   TR_FORMAT_YUV422_SP_VUVU               = 0x4b,/*MSB  U-V-U-V  LSB*/
   TR_FORMAT_YUV420_SP_UVUV               = 0x4c,
   TR_FORMAT_YUV420_SP_VUVU               = 0x4d,
   TR_FORMAT_YUV411_SP_UVUV               = 0x4e,
   TR_FORMAT_YUV411_SP_VUVU               = 0x4f,
   TR_FORMAT_MAX,
} tr_pixel_format;
 
typedef enum {
   TR_ROT_0        = 0x0,/*rotate clockwise 0 ROTgree*/
   TR_ROT_90       = 0x1,/*rotate clockwise 90 ROTgree*/
   TR_ROT_180      = 0x2,/*rotate clockwise 180 ROTgree*/
   TR_ROT_270      = 0x3,/*rotate clockwise 270 ROTgree*/
   TR_HFLIP        = 0x4,/*horizontal flip*/
   /*first rotate clockwise 90 ROTgree then horizontal flip*/
   TR_HFLIP_ROT_90 = 0x5,
   TR_VFLIP        = 0x6,/*vertical flip*/
   /*first rotate clockwise 90 ROTgree then vertical flip*/
   TR_VFLIP_ROT_90 = 0x7,
} tr_mode;
 
typedef struct {
   int x;
   int y;
   unsigned int w;
   unsigned int h;
} tr_rect;
 
typedef struct {
   unsigned char fmt;
   unsigned char haddr[3];
   unsigned int  laddr[3];
   unsigned int  pitch[3]; /* line stride of fb */
   unsigned int  height[3];
   int fd;
} tr_frame;
 
typedef struct {
   tr_mode mode;
 
   tr_frame   src_frame;
   tr_rect    src_rect;
 
   tr_frame   dst_frame;
   tr_rect    dst_rect;
 
   int fd;
} tr_info;
 
typedef enum tag_TR_CMD {
   TR_REQUEST = 0x03,
   TR_RELEASE = 0x04,
   TR_COMMIT = 0x05,
   TR_QUERY = 0x06,
   TR_SET_TIMEOUT = 0x07,
} tr_cmd_t;
 
/* tr_format_attr - tr format attribute
 *
 * @format: pixel format
 * @bits: bits of each component
 * @hor_rsample_u: reciprocal of horizontal sample rate
 * @hor_rsample_v: reciprocal of horizontal sample rate
 * @ver_rsample_u: reciprocal of vertical sample rate
 * @hor_rsample_v: reciprocal of vertical sample rate
 * @uvc: 1: u & v component combined
 * @interleave: 0: progressive, 1: interleave
 * @factor & div: bytes of pixel = factor / div (bytes)
 *
 * @addr[out]: address for each plane
 * @trd_addr[out]: address for each plane of right eye buffer
 */
struct tr_format_attr {
   tr_pixel_format format;
   unsigned int bits;
   unsigned int hor_rsample_u;
   unsigned int hor_rsample_v;
   unsigned int ver_rsample_u;
   unsigned int ver_rsample_v;
   unsigned int uvc;
   unsigned int interleave;
   unsigned int factor;
   unsigned int div;
};
#endif