GNU Linux-libre 4.14.290-gnu1
[releases.git] / drivers / staging / media / atomisp / pci / atomisp2 / css2400 / runtime / frame / interface / ia_css_frame_comm.h
1 #ifndef ISP2401
2 /*
3  * Support for Intel Camera Imaging ISP subsystem.
4  * Copyright (c) 2015, Intel Corporation.
5  *
6  * This program is free software; you can redistribute it and/or modify it
7  * under the terms and conditions of the GNU General Public License,
8  * version 2, as published by the Free Software Foundation.
9  *
10  * This program is distributed in the hope it will be useful, but WITHOUT
11  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
13  * more details.
14  */
15 #else
16 /**
17 Support for Intel Camera Imaging ISP subsystem.
18 Copyright (c) 2010 - 2015, Intel Corporation.
19
20 This program is free software; you can redistribute it and/or modify it
21 under the terms and conditions of the GNU General Public License,
22 version 2, as published by the Free Software Foundation.
23
24 This program is distributed in the hope it will be useful, but WITHOUT
25 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
26 FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
27 more details.
28 */
29 #endif
30
31 #ifndef __IA_CSS_FRAME_COMM_H__
32 #define __IA_CSS_FRAME_COMM_H__
33
34 #include "type_support.h"
35 #include "platform_support.h"
36 #include "runtime/bufq/interface/ia_css_bufq_comm.h"
37 #include <system_types.h>        /* hrt_vaddress */
38
39 /*
40  * These structs are derived from structs defined in ia_css_types.h
41  * (just take out the "_sp" from the struct name to get the "original")
42  * All the fields that are not needed by the SP are removed.
43  */
44 struct ia_css_frame_sp_plane {
45         unsigned int offset;    /* offset in bytes to start of frame data */
46                                 /* offset is wrt data in sh_css_sp_sp_frame */
47 };
48
49 struct ia_css_frame_sp_binary_plane {
50         unsigned int size;
51         struct ia_css_frame_sp_plane data;
52 };
53
54 struct ia_css_frame_sp_yuv_planes {
55         struct ia_css_frame_sp_plane y;
56         struct ia_css_frame_sp_plane u;
57         struct ia_css_frame_sp_plane v;
58 };
59
60 struct ia_css_frame_sp_nv_planes {
61         struct ia_css_frame_sp_plane y;
62         struct ia_css_frame_sp_plane uv;
63 };
64
65 struct ia_css_frame_sp_rgb_planes {
66         struct ia_css_frame_sp_plane r;
67         struct ia_css_frame_sp_plane g;
68         struct ia_css_frame_sp_plane b;
69 };
70
71 struct ia_css_frame_sp_plane6 {
72         struct ia_css_frame_sp_plane r;
73         struct ia_css_frame_sp_plane r_at_b;
74         struct ia_css_frame_sp_plane gr;
75         struct ia_css_frame_sp_plane gb;
76         struct ia_css_frame_sp_plane b;
77         struct ia_css_frame_sp_plane b_at_r;
78 };
79
80 struct ia_css_sp_resolution {
81         uint16_t width;         /* width of valid data in pixels */
82         uint16_t height;        /* Height of valid data in lines */
83 };
84
85 /*
86  * Frame info struct. This describes the contents of an image frame buffer.
87  */
88 struct ia_css_frame_sp_info {
89         struct ia_css_sp_resolution res;
90         uint16_t padded_width;          /* stride of line in memory
91                                         (in pixels) */
92         unsigned char format;           /* format of the frame data */
93         unsigned char raw_bit_depth;    /* number of valid bits per pixel,
94                                         only valid for RAW bayer frames */
95         unsigned char raw_bayer_order;  /* bayer order, only valid
96                                         for RAW bayer frames */
97         unsigned char padding[3];       /* Extend to 32 bit multiple */
98 };
99
100 struct ia_css_buffer_sp {
101         union {
102                 hrt_vaddress xmem_addr;
103                 enum sh_css_queue_id queue_id;
104         } buf_src;
105         enum ia_css_buffer_type buf_type;
106 };
107
108 struct ia_css_frame_sp {
109         struct ia_css_frame_sp_info info;
110         struct ia_css_buffer_sp buf_attr;
111         union {
112                 struct ia_css_frame_sp_plane raw;
113                 struct ia_css_frame_sp_plane rgb;
114                 struct ia_css_frame_sp_rgb_planes planar_rgb;
115                 struct ia_css_frame_sp_plane yuyv;
116                 struct ia_css_frame_sp_yuv_planes yuv;
117                 struct ia_css_frame_sp_nv_planes nv;
118                 struct ia_css_frame_sp_plane6 plane6;
119                 struct ia_css_frame_sp_binary_plane binary;
120         } planes;
121 };
122
123 void ia_css_frame_info_to_frame_sp_info(
124         struct ia_css_frame_sp_info *sp_info,
125         const struct ia_css_frame_info *info);
126
127 void ia_css_resolution_to_sp_resolution(
128         struct ia_css_sp_resolution *sp_info,
129         const struct ia_css_resolution *info);
130
131 #endif /*__IA_CSS_FRAME_COMM_H__*/
132