Skip to content

Commit 6ab7030

Browse files
jhautboismchehab
authored andcommitted
media: staging: ipu3-imgu: add the AWB memory layout
While parsing the RAW AWB metadata, the AWB layout was missing to fully understand which byte corresponds to which feature. Make the field names and usage explicit, as it is used by the userspace applications. [Sakari Ailus: Changed wording of sat_ratio field as per review comments, fixed a whitespace issue.] Signed-off-by: Jean-Michel Hautbois <[email protected]> Reviewed-by: Laurent Pinchart <[email protected]> Reviewed-by: Bingbu Cao <[email protected]> Reviewed-by: Tomasz Figa <[email protected]> Signed-off-by: Sakari Ailus <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
1 parent 5fcec42 commit 6ab7030

File tree

1 file changed

+27
-5
lines changed

1 file changed

+27
-5
lines changed

drivers/staging/media/ipu3/include/uapi/intel-ipu3.h

Lines changed: 27 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -67,17 +67,39 @@ struct ipu3_uapi_grid_config {
6767
__u16 y_end;
6868
} __packed;
6969

70+
/**
71+
* struct ipu3_uapi_awb_set_item - Memory layout for each cell in AWB
72+
*
73+
* @Gr_avg: Green average for red lines in the cell.
74+
* @R_avg: Red average in the cell.
75+
* @B_avg: Blue average in the cell.
76+
* @Gb_avg: Green average for blue lines in the cell.
77+
* @sat_ratio: Percentage of pixels over the thresholds specified in
78+
* ipu3_uapi_awb_config_s, coded from 0 to 255.
79+
* @padding0: Unused byte for padding.
80+
* @padding1: Unused byte for padding.
81+
* @padding2: Unused byte for padding.
82+
*/
83+
struct ipu3_uapi_awb_set_item {
84+
__u8 Gr_avg;
85+
__u8 R_avg;
86+
__u8 B_avg;
87+
__u8 Gb_avg;
88+
__u8 sat_ratio;
89+
__u8 padding0;
90+
__u8 padding1;
91+
__u8 padding2;
92+
} __attribute__((packed));
93+
7094
/*
7195
* The grid based data is divided into "slices" called set, each slice of setX
7296
* refers to ipu3_uapi_grid_config width * height_per_slice.
7397
*/
7498
#define IPU3_UAPI_AWB_MAX_SETS 60
7599
/* Based on grid size 80 * 60 and cell size 16 x 16 */
76-
#define IPU3_UAPI_AWB_SET_SIZE 1280
77-
#define IPU3_UAPI_AWB_MD_ITEM_SIZE 8
100+
#define IPU3_UAPI_AWB_SET_SIZE 160
78101
#define IPU3_UAPI_AWB_SPARE_FOR_BUBBLES \
79-
(IPU3_UAPI_MAX_BUBBLE_SIZE * IPU3_UAPI_MAX_STRIPES * \
80-
IPU3_UAPI_AWB_MD_ITEM_SIZE)
102+
(IPU3_UAPI_MAX_BUBBLE_SIZE * IPU3_UAPI_MAX_STRIPES)
81103
#define IPU3_UAPI_AWB_MAX_BUFFER_SIZE \
82104
(IPU3_UAPI_AWB_MAX_SETS * \
83105
(IPU3_UAPI_AWB_SET_SIZE + IPU3_UAPI_AWB_SPARE_FOR_BUBBLES))
@@ -89,7 +111,7 @@ struct ipu3_uapi_grid_config {
89111
* the average values for each color channel.
90112
*/
91113
struct ipu3_uapi_awb_raw_buffer {
92-
__u8 meta_data[IPU3_UAPI_AWB_MAX_BUFFER_SIZE]
114+
struct ipu3_uapi_awb_set_item meta_data[IPU3_UAPI_AWB_MAX_BUFFER_SIZE]
93115
__attribute__((aligned(32)));
94116
} __packed;
95117

0 commit comments

Comments
 (0)