media: vivid: add pixel_array test control
This control will change dimensions according to the source resolution. Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
This commit is contained in:
parent
43cc0ec381
commit
6bc7643d1b
|
@ -35,7 +35,9 @@
|
||||||
#define MAX_HEIGHT 2160
|
#define MAX_HEIGHT 2160
|
||||||
/* The minimum image width/height */
|
/* The minimum image width/height */
|
||||||
#define MIN_WIDTH 16
|
#define MIN_WIDTH 16
|
||||||
#define MIN_HEIGHT 16
|
#define MIN_HEIGHT MIN_WIDTH
|
||||||
|
/* Pixel Array control divider */
|
||||||
|
#define PIXEL_ARRAY_DIV MIN_WIDTH
|
||||||
/* The data_offset of plane 0 for the multiplanar formats */
|
/* The data_offset of plane 0 for the multiplanar formats */
|
||||||
#define PLANE0_DATA_OFFSET 128
|
#define PLANE0_DATA_OFFSET 128
|
||||||
|
|
||||||
|
@ -227,6 +229,7 @@ struct vivid_dev {
|
||||||
struct v4l2_ctrl *bitmask;
|
struct v4l2_ctrl *bitmask;
|
||||||
struct v4l2_ctrl *int_menu;
|
struct v4l2_ctrl *int_menu;
|
||||||
struct v4l2_ctrl *ro_int32;
|
struct v4l2_ctrl *ro_int32;
|
||||||
|
struct v4l2_ctrl *pixel_array;
|
||||||
struct v4l2_ctrl *test_pattern;
|
struct v4l2_ctrl *test_pattern;
|
||||||
struct v4l2_ctrl *colorspace;
|
struct v4l2_ctrl *colorspace;
|
||||||
struct v4l2_ctrl *rgb_range_cap;
|
struct v4l2_ctrl *rgb_range_cap;
|
||||||
|
|
|
@ -35,6 +35,7 @@
|
||||||
#define VIVID_CID_AREA (VIVID_CID_CUSTOM_BASE + 11)
|
#define VIVID_CID_AREA (VIVID_CID_CUSTOM_BASE + 11)
|
||||||
#define VIVID_CID_RO_INTEGER (VIVID_CID_CUSTOM_BASE + 12)
|
#define VIVID_CID_RO_INTEGER (VIVID_CID_CUSTOM_BASE + 12)
|
||||||
#define VIVID_CID_U32_DYN_ARRAY (VIVID_CID_CUSTOM_BASE + 13)
|
#define VIVID_CID_U32_DYN_ARRAY (VIVID_CID_CUSTOM_BASE + 13)
|
||||||
|
#define VIVID_CID_U8_PIXEL_ARRAY (VIVID_CID_CUSTOM_BASE + 14)
|
||||||
|
|
||||||
#define VIVID_CID_VIVID_BASE (0x00f00000 | 0xf000)
|
#define VIVID_CID_VIVID_BASE (0x00f00000 | 0xf000)
|
||||||
#define VIVID_CID_VIVID_CLASS (0x00f00000 | 1)
|
#define VIVID_CID_VIVID_CLASS (0x00f00000 | 1)
|
||||||
|
@ -228,6 +229,18 @@ static const struct v4l2_ctrl_config vivid_ctrl_u8_4d_array = {
|
||||||
.dims = { 2, 3, 4, 5 },
|
.dims = { 2, 3, 4, 5 },
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static const struct v4l2_ctrl_config vivid_ctrl_u8_pixel_array = {
|
||||||
|
.ops = &vivid_user_gen_ctrl_ops,
|
||||||
|
.id = VIVID_CID_U8_PIXEL_ARRAY,
|
||||||
|
.name = "U8 Pixel Array",
|
||||||
|
.type = V4L2_CTRL_TYPE_U8,
|
||||||
|
.def = 0x80,
|
||||||
|
.min = 0x00,
|
||||||
|
.max = 0xff,
|
||||||
|
.step = 1,
|
||||||
|
.dims = { 640 / PIXEL_ARRAY_DIV, 360 / PIXEL_ARRAY_DIV },
|
||||||
|
};
|
||||||
|
|
||||||
static const char * const vivid_ctrl_menu_strings[] = {
|
static const char * const vivid_ctrl_menu_strings[] = {
|
||||||
"Menu Item 0 (Skipped)",
|
"Menu Item 0 (Skipped)",
|
||||||
"Menu Item 1",
|
"Menu Item 1",
|
||||||
|
@ -1642,6 +1655,7 @@ int vivid_create_controls(struct vivid_dev *dev, bool show_ccs_cap,
|
||||||
v4l2_ctrl_new_custom(hdl_user_gen, &vivid_ctrl_u32_dyn_array, NULL);
|
v4l2_ctrl_new_custom(hdl_user_gen, &vivid_ctrl_u32_dyn_array, NULL);
|
||||||
v4l2_ctrl_new_custom(hdl_user_gen, &vivid_ctrl_u16_matrix, NULL);
|
v4l2_ctrl_new_custom(hdl_user_gen, &vivid_ctrl_u16_matrix, NULL);
|
||||||
v4l2_ctrl_new_custom(hdl_user_gen, &vivid_ctrl_u8_4d_array, NULL);
|
v4l2_ctrl_new_custom(hdl_user_gen, &vivid_ctrl_u8_4d_array, NULL);
|
||||||
|
dev->pixel_array = v4l2_ctrl_new_custom(hdl_user_gen, &vivid_ctrl_u8_pixel_array, NULL);
|
||||||
|
|
||||||
if (dev->has_vid_cap) {
|
if (dev->has_vid_cap) {
|
||||||
/* Image Processing Controls */
|
/* Image Processing Controls */
|
||||||
|
|
|
@ -381,6 +381,7 @@ static enum tpg_pixel_aspect vivid_get_pixel_aspect(const struct vivid_dev *dev)
|
||||||
void vivid_update_format_cap(struct vivid_dev *dev, bool keep_controls)
|
void vivid_update_format_cap(struct vivid_dev *dev, bool keep_controls)
|
||||||
{
|
{
|
||||||
struct v4l2_bt_timings *bt = &dev->dv_timings_cap[dev->input].bt;
|
struct v4l2_bt_timings *bt = &dev->dv_timings_cap[dev->input].bt;
|
||||||
|
u32 dims[V4L2_CTRL_MAX_DIMS] = {};
|
||||||
unsigned size;
|
unsigned size;
|
||||||
u64 pixelclock;
|
u64 pixelclock;
|
||||||
|
|
||||||
|
@ -459,6 +460,9 @@ void vivid_update_format_cap(struct vivid_dev *dev, bool keep_controls)
|
||||||
tpg_s_video_aspect(&dev->tpg, vivid_get_video_aspect(dev));
|
tpg_s_video_aspect(&dev->tpg, vivid_get_video_aspect(dev));
|
||||||
tpg_s_pixel_aspect(&dev->tpg, vivid_get_pixel_aspect(dev));
|
tpg_s_pixel_aspect(&dev->tpg, vivid_get_pixel_aspect(dev));
|
||||||
tpg_update_mv_step(&dev->tpg);
|
tpg_update_mv_step(&dev->tpg);
|
||||||
|
dims[0] = roundup(dev->src_rect.width, PIXEL_ARRAY_DIV);
|
||||||
|
dims[1] = roundup(dev->src_rect.height, PIXEL_ARRAY_DIV);
|
||||||
|
v4l2_ctrl_modify_dimensions(dev->pixel_array, dims);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Map the field to something that is valid for the current input */
|
/* Map the field to something that is valid for the current input */
|
||||||
|
|
Loading…
Reference in New Issue