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