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