]> rtime.felk.cvut.cz Git - hercules2020/nv-tegra/linux-4.4.git/commitdiff
drivers: vivid: Clean upstream vivid driver
authorBhanu Murthy V <bmurthyv@nvidia.com>
Wed, 24 Jan 2018 02:35:27 +0000 (18:35 -0800)
committermobile promotions <svcmobile_promotions@nvidia.com>
Sat, 27 Jan 2018 08:46:18 +0000 (00:46 -0800)
Revert tegra specific changes in upstream vivid
driver.

Bug 2044469

Change-Id: I6eb637f57c42704e8123a11e366077934fafb298
Signed-off-by: Bhanu Murthy V <bmurthyv@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1644942
Reviewed-by: Ahung Cheng <ahcheng@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Hayden Du <haydend@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
12 files changed:
drivers/media/platform/vivid/vivid-core.c
drivers/media/platform/vivid/vivid-core.h
drivers/media/platform/vivid/vivid-ctrls.c
drivers/media/platform/vivid/vivid-ctrls.h
drivers/media/platform/vivid/vivid-kthread-cap.c
drivers/media/platform/vivid/vivid-kthread-out.c
drivers/media/platform/vivid/vivid-tpg.c
drivers/media/platform/vivid/vivid-tpg.h
drivers/media/platform/vivid/vivid-vid-cap.c
drivers/media/platform/vivid/vivid-vid-cap.h
drivers/media/platform/vivid/vivid-vid-common.c
drivers/media/platform/vivid/vivid-vid-out.c

index e90122e45cce705b62e0f4af8a36e9ce2765053b..ec125becb7af995a85b2810f55424c79a96bf7c3 100644 (file)
@@ -101,14 +101,12 @@ MODULE_PARM_DESC(ccs_out_mode, " output crop/compose/scale mode:\n"
                           "\t\t    bit 0=crop, 1=compose, 2=scale,\n"
                           "\t\t    -1=user-controlled (default)");
 
-static unsigned
-multiplanar[VIVID_MAX_DEVS] = { [0 ... (VIVID_MAX_DEVS - 1)] = 2 };
+static unsigned multiplanar[VIVID_MAX_DEVS] = { [0 ... (VIVID_MAX_DEVS - 1)] = 1 };
 module_param_array(multiplanar, uint, NULL, 0444);
 MODULE_PARM_DESC(multiplanar, " 1 (default) creates a single planar device, 2 creates a multiplanar device.");
 
 /* Default: video + vbi-cap (raw and sliced) + radio rx + radio tx + sdr + vbi-out + vid-out */
-/* Expose only video capture and video output nodes for the current test pipeline */
-static unsigned node_types[VIVID_MAX_DEVS] = { [0 ... (VIVID_MAX_DEVS - 1)] = 0x0101 };
+static unsigned node_types[VIVID_MAX_DEVS] = { [0 ... (VIVID_MAX_DEVS - 1)] = 0x1d3d };
 module_param_array(node_types, uint, NULL, 0444);
 MODULE_PARM_DESC(node_types, " node types, default is 0x1d3d. Bitmask with the following meaning:\n"
                             "\t\t    bit 0: Video Capture node\n"
@@ -121,28 +119,24 @@ MODULE_PARM_DESC(node_types, " node types, default is 0x1d3d. Bitmask with the f
                             "\t\t    bit 16: Framebuffer for testing overlays");
 
 /* Default: 4 inputs */
-/* Force to have only one input for current test pipeline */
-static unsigned num_inputs[VIVID_MAX_DEVS] = { [0 ... (VIVID_MAX_DEVS - 1)] = 1 };
+static unsigned num_inputs[VIVID_MAX_DEVS] = { [0 ... (VIVID_MAX_DEVS - 1)] = 4 };
 module_param_array(num_inputs, uint, NULL, 0444);
 MODULE_PARM_DESC(num_inputs, " number of inputs, default is 4");
 
 /* Default: input 0 = WEBCAM, 1 = TV, 2 = SVID, 3 = HDMI */
-/* support only HDMI input type for current test pipeline */
-static unsigned input_types[VIVID_MAX_DEVS] = { [0 ... (VIVID_MAX_DEVS - 1)] = 0x03 };
+static unsigned input_types[VIVID_MAX_DEVS] = { [0 ... (VIVID_MAX_DEVS - 1)] = 0xe4 };
 module_param_array(input_types, uint, NULL, 0444);
 MODULE_PARM_DESC(input_types, " input types, default is 0xe4. Two bits per input,\n"
                              "\t\t    bits 0-1 == input 0, bits 31-30 == input 15.\n"
                              "\t\t    Type 0 == webcam, 1 == TV, 2 == S-Video, 3 == HDMI");
 
 /* Default: 2 outputs */
-/* Force to have only one output for current test pipeline */
-static unsigned num_outputs[VIVID_MAX_DEVS] = { [0 ... (VIVID_MAX_DEVS - 1)] = 1 };
+static unsigned num_outputs[VIVID_MAX_DEVS] = { [0 ... (VIVID_MAX_DEVS - 1)] = 2 };
 module_param_array(num_outputs, uint, NULL, 0444);
 MODULE_PARM_DESC(num_outputs, " number of outputs, default is 2");
 
 /* Default: output 0 = SVID, 1 = HDMI */
-/* support only HDMI output type for current test pipeline */
-static unsigned output_types[VIVID_MAX_DEVS] = { [0 ... (VIVID_MAX_DEVS - 1)] = 0x01 };
+static unsigned output_types[VIVID_MAX_DEVS] = { [0 ... (VIVID_MAX_DEVS - 1)] = 2 };
 module_param_array(output_types, uint, NULL, 0444);
 MODULE_PARM_DESC(output_types, " output types, default is 0x02. One bit per output,\n"
                              "\t\t    bit 0 == output 0, bit 15 == output 15.\n"
@@ -209,8 +203,7 @@ static int vidioc_querycap(struct file *file, void  *priv,
        struct video_device *vdev = video_devdata(file);
 
        strcpy(cap->driver, "vivid");
-       snprintf(cap->card, sizeof(cap->card),
-                       "%s", dev->v4l2_dev.name);
+       strcpy(cap->card, "vivid");
        snprintf(cap->bus_info, sizeof(cap->bus_info),
                        "platform:%s", dev->v4l2_dev.name);
 
@@ -653,35 +646,6 @@ static void vivid_dev_release(struct v4l2_device *v4l2_dev)
        kfree(dev);
 }
 
-static int vivid_parse_dt(struct video_device *vfd, struct vivid_dev *dev)
-{
-       struct device_node *vivid_node = NULL;
-       struct device_node *node = NULL;
-       char temp_str[OF_MAX_STR_LEN];
-
-       vivid_node = of_find_node_by_name(NULL, "vivid-driver");
-       if (!vivid_node) {
-               dev_err(&vfd->dev, "%s:cannot find vivid node\n", __func__);
-               return -ENODATA;
-       }
-
-       snprintf(temp_str, sizeof(temp_str), "%s%d", "instance", dev->inst);
-       node = of_find_node_by_name(vivid_node, temp_str);
-       if (!node) {
-               dev_err(&vfd->dev, "%s:cannot find instance node\n", __func__);
-               return -ENODATA;
-       }
-
-       sensor_common_init_sensor_properties(&vfd->dev,
-               node, &dev->sensor_props);
-
-       v4l2_ctrl_s_ctrl(dev->ctrl_sensormodes, dev->sensor_props.num_modes);
-
-       vivid_update_sensorprops(dev);
-
-       return 0;
-}
-
 static int vivid_create_instance(struct platform_device *pdev, int inst)
 {
        static const struct v4l2_dv_timings def_dv_timings =
@@ -989,11 +953,9 @@ static int vivid_create_instance(struct platform_device *pdev, int inst)
        dev->fmt_out = &vivid_formats[0];
        if (!dev->multiplanar)
                vivid_formats[0].data_offset[0] = 0;
-       dev->embedded_data_height = DEF_METADATA_HEIGHT;
-       dev->fmt_out_metadata_height = DEF_METADATA_HEIGHT;
        dev->webcam_size_idx = 1;
        dev->webcam_ival_idx = 3;
-       tpg_s_fourcc(&dev->tpg, dev->fmt_cap->fourcc, DEF_METADATA_HEIGHT);
+       tpg_s_fourcc(&dev->tpg, dev->fmt_cap->fourcc);
        dev->std_cap = V4L2_STD_PAL;
        dev->std_out = V4L2_STD_PAL;
        if (dev->input_type[0] == TV || dev->input_type[0] == SVID)
@@ -1022,11 +984,6 @@ static int vivid_create_instance(struct platform_device *pdev, int inst)
        memcpy(dev->edid, vivid_hdmi_edid, sizeof(vivid_hdmi_edid));
        ktime_get_ts(&dev->radio_rds_init_ts);
 
-       /* initialize locks */
-       spin_lock_init(&dev->slock);
-       mutex_init(&dev->mutex);
-       mutex_init(&dev->mutex_framerate);
-
        /* create all controls */
        ret = vivid_create_controls(dev, ccs_cap == -1, ccs_out == -1, no_error_inj,
                        in_type_counter[TV] || in_type_counter[SVID] ||
@@ -1057,6 +1014,10 @@ static int vivid_create_instance(struct platform_device *pdev, int inst)
        dev->fb_cap.fmt.bytesperline = dev->src_rect.width * tpg_g_twopixelsize(&dev->tpg, 0) / 2;
        dev->fb_cap.fmt.sizeimage = dev->src_rect.height * dev->fb_cap.fmt.bytesperline;
 
+       /* initialize locks */
+       spin_lock_init(&dev->slock);
+       mutex_init(&dev->mutex);
+
        /* init dma queues */
        INIT_LIST_HEAD(&dev->vid_cap_active);
        INIT_LIST_HEAD(&dev->vid_out_active);
@@ -1191,10 +1152,6 @@ static int vivid_create_instance(struct platform_device *pdev, int inst)
                        goto unreg_dev;
                v4l2_info(&dev->v4l2_dev, "V4L2 capture device registered as %s\n",
                                          video_device_node_name(vfd));
-
-               ret = vivid_parse_dt(vfd, dev);
-               if (ret < 0)
-                       goto unreg_dev;
        }
 
        if (dev->has_vid_out) {
index 8156d169df881c6270db8e6b5d5428244b71848c..55b304a705d52b137d8a4521cdfaf29e4ce6929d 100644 (file)
@@ -25,7 +25,6 @@
 #include <media/v4l2-device.h>
 #include <media/v4l2-dev.h>
 #include <media/v4l2-ctrls.h>
-#include <media/sensor_common.h>
 #include "vivid-tpg.h"
 #include "vivid-rds-gen.h"
 #include "vivid-vbi-gen.h"
@@ -59,9 +58,6 @@
 /* The minimum image width/height */
 #define MIN_WIDTH  16
 #define MIN_HEIGHT 16
-/* Metadata height max/default */
-#define MAX_METADATA_HEIGHT 16
-#define DEF_METADATA_HEIGHT 1
 /* The data_offset of plane 0 for the multiplanar formats */
 #define PLANE0_DATA_OFFSET 128
 
@@ -84,9 +80,7 @@ struct vivid_fmt {
        u32     fourcc;          /* v4l2 format id */
        bool    is_yuv;
        bool    can_do_overlay;
-       bool    is_metadata[TPG_MAX_PLANES];
        u8      vdownsampling[TPG_MAX_PLANES];
-       u8      packedpixels;
        u32     alpha_mask;
        u8      planes;
        u8      buffers;
@@ -163,7 +157,6 @@ struct vivid_dev {
        struct v4l2_ctrl_handler        ctrl_hdl_sdr_cap;
        spinlock_t                      slock;
        struct mutex                    mutex;
-       struct mutex                    mutex_framerate;
 
        /* capabilities */
        u32                             vid_cap_caps;
@@ -224,12 +217,6 @@ struct vivid_dev {
        struct v4l2_ctrl                *colorspace;
        struct v4l2_ctrl                *rgb_range_cap;
        struct v4l2_ctrl                *real_rgb_range_cap;
-       struct v4l2_ctrl                *framelength;
-       struct v4l2_ctrl                *ctrl_signalprops;
-       struct v4l2_ctrl                *ctrl_imageprops;
-       struct v4l2_ctrl                *ctrl_controlprops;
-       struct v4l2_ctrl                *ctrl_dvtimings;
-       struct v4l2_ctrl                *ctrl_sensormodes;
        struct {
                /* std_signal_mode/standard cluster */
                struct v4l2_ctrl        *ctrl_std_signal_mode;
@@ -349,7 +336,6 @@ struct vivid_dev {
        u32                             xfer_func_out;
        u32                             service_set_out;
        unsigned                        bytesperline_out[TPG_MAX_PLANES];
-       unsigned                        height_out[TPG_MAX_PLANES];
        unsigned                        tv_field_out;
        unsigned                        tv_audio_output;
        bool                            vbi_out_have_wss;
@@ -378,7 +364,7 @@ struct vivid_dev {
        unsigned                        ms_vid_cap;
        bool                            must_blank[VIDEO_MAX_FRAME];
 
-       struct vivid_fmt                *fmt_cap;
+       const struct vivid_fmt          *fmt_cap;
        struct v4l2_fract               timeperframe_vid_cap;
        enum v4l2_field                 field_cap;
        struct v4l2_rect                src_rect;
@@ -404,14 +390,9 @@ struct vivid_dev {
        u32                             vbi_cap_seq_count;
        bool                            vbi_cap_streaming;
        bool                            stream_sliced_vbi_cap;
-       u32                             embedded_data_height;
-       u32                             fmt_out_metadata_height;
-
-       /* added for NV sensor emulation */
-       struct sensor_properties        sensor_props;
 
        /* video output */
-       struct vivid_fmt                *fmt_out;
+       const struct vivid_fmt          *fmt_out;
        struct v4l2_fract               timeperframe_vid_out;
        enum v4l2_field                 field_out;
        struct v4l2_rect                sink_rect;
index 369bc8927cd9731ad354836a929d4c648b1ab4fc..f41ac0b01fecbd8b8a860531ef55ce732629aabc 100644 (file)
 
 #define VIVID_CID_SDR_CAP_FM_DEVIATION (VIVID_CID_VIVID_BASE + 110)
 
-#define VIVID_CID_COARSE_TIME          (VIVID_CID_VIVID_BASE + 120)
-#define VIVID_CID_COARSE_TIME_SHORT    (VIVID_CID_VIVID_BASE + 121)
-#define VIVID_CID_FRAME_LENGTH         (VIVID_CID_VIVID_BASE + 122)
-#define VIVID_CID_GROUP_HOLD           (VIVID_CID_VIVID_BASE + 123)
-#define VIVID_CID_HDR_EN               (VIVID_CID_VIVID_BASE + 124)
-#define VIVID_CID_SENSOR_SIGNAL_PROPERTIES (VIVID_CID_VIVID_BASE + 125)
-#define VIVID_CID_SENSOR_IMAGE_PROPERTIES (VIVID_CID_VIVID_BASE + 126)
-#define VIVID_CID_SENSOR_CONTROL_PROPERTIES (VIVID_CID_VIVID_BASE + 127)
-#define VIVID_CID_SENSOR_DV_TIMINGS (VIVID_CID_VIVID_BASE + 128)
-/**
- * This is temporary with the current v4l2 infrastructure
- * currently discussing with upstream maintainers our proposals and
- * better approaches to resolve this
- */
-#define VIVID_CID_SENSOR_MODES         (VIVID_CID_VIVID_BASE + 129)
-
 /* General User Controls */
 
 static int vivid_user_gen_s_ctrl(struct v4l2_ctrl *ctrl)
@@ -295,6 +279,7 @@ static const struct v4l2_ctrl_config vivid_ctrl_clear_fb = {
        .type = V4L2_CTRL_TYPE_BUTTON,
 };
 
+
 /* Video User Controls */
 
 static int vivid_user_vid_g_volatile_ctrl(struct v4l2_ctrl *ctrl)
@@ -485,46 +470,7 @@ static int vivid_vid_cap_s_ctrl(struct v4l2_ctrl *ctrl)
                if (dev->edid_blocks > dev->edid_max_blocks)
                        dev->edid_blocks = dev->edid_max_blocks;
                break;
-       case VIVID_CID_FRAME_LENGTH:
-               vivid_update_timeperframe(dev, ctrl->val);
-               break;
-       }
-       return 0;
-}
-
-int vivid_update_sensorprops(struct vivid_dev *dev)
-{
-       struct v4l2_ctrl *ctrl_signalprops = dev->ctrl_signalprops;
-       struct v4l2_ctrl *ctrl_imageprops = dev->ctrl_imageprops;
-       struct v4l2_ctrl *ctrl_controlprops = dev->ctrl_controlprops;
-       struct v4l2_ctrl *ctrl_dvtimings = dev->ctrl_dvtimings;
-       struct sensor_mode_properties *modes = dev->sensor_props.sensor_modes;
-       u32 i;
-
-       for (i = 0; i < dev->sensor_props.num_modes; i++) {
-               void *ptr = NULL;
-               u32 size = sizeof(struct sensor_signal_properties);
-
-               ptr = ctrl_signalprops->p_new.p + (i * size);
-               memcpy(ptr, &modes[i].signal_properties, size);
-
-               size = sizeof(struct sensor_image_properties);
-               ptr = ctrl_imageprops->p_new.p + (i * size);
-               memcpy(ptr, &modes[i].image_properties, size);
-
-               size = sizeof(struct sensor_control_properties);
-               ptr = ctrl_controlprops->p_new.p + (i * size);
-               memcpy(ptr, &modes[i].control_properties, size);
-
-               size = sizeof(struct sensor_dv_timings);
-               ptr = ctrl_dvtimings->p_new.p + (i * size);
-               memcpy(ptr, &modes[i].dv_timings, size);
        }
-       ctrl_signalprops->p_cur.p = ctrl_signalprops->p_new.p;
-       ctrl_imageprops->p_cur.p = ctrl_imageprops->p_new.p;
-       ctrl_controlprops->p_cur.p = ctrl_controlprops->p_new.p;
-       ctrl_dvtimings->p_cur.p = ctrl_dvtimings->p_new.p;
-
        return 0;
 }
 
@@ -532,135 +478,6 @@ static const struct v4l2_ctrl_ops vivid_vid_cap_ctrl_ops = {
        .s_ctrl = vivid_vid_cap_s_ctrl,
 };
 
-#define MIN_FRAME_LENGTH       0x0
-#define MAX_FRAME_LENGTH       0x7FFF
-#define DEF_FRAME_LENGTH       0x07C0
-#define MIN_EXPOSURE_COARSE    0x0002
-#define MAX_EXPOSURE_COARSE    0x7FF8
-#define DEF_EXPOSURE_COARSE    0x07B8
-
-static const struct v4l2_ctrl_config vivid_ctrl_framelength = {
-       .ops = &vivid_vid_cap_ctrl_ops,
-       .id = VIVID_CID_FRAME_LENGTH,
-       .name = "Frame Length",
-       .type = V4L2_CTRL_TYPE_INTEGER,
-       .flags = V4L2_CTRL_FLAG_SLIDER,
-       .min = MIN_FRAME_LENGTH,
-       .max = MAX_FRAME_LENGTH,
-       .def = DEF_FRAME_LENGTH,
-       .step = 1,
-};
-
-static const struct v4l2_ctrl_config vivid_ctrl_coarsetime = {
-       .ops = &vivid_vid_cap_ctrl_ops,
-       .id = VIVID_CID_COARSE_TIME,
-       .name = "Coarse Time",
-       .type = V4L2_CTRL_TYPE_INTEGER,
-       .flags = V4L2_CTRL_FLAG_SLIDER,
-       .min = MIN_EXPOSURE_COARSE,
-       .max = MAX_EXPOSURE_COARSE,
-       .def = DEF_EXPOSURE_COARSE,
-       .step = 1,
-};
-
-static const struct v4l2_ctrl_config vivid_ctrl_coarsetime_short = {
-       .ops = &vivid_vid_cap_ctrl_ops,
-       .id = VIVID_CID_COARSE_TIME_SHORT,
-       .name = "Coarse Time Short",
-       .type = V4L2_CTRL_TYPE_INTEGER,
-       .flags = V4L2_CTRL_FLAG_SLIDER,
-       .min = MIN_EXPOSURE_COARSE,
-       .max = MAX_EXPOSURE_COARSE,
-       .def = DEF_EXPOSURE_COARSE,
-       .step = 1,
-};
-
-static const struct v4l2_ctrl_config vivid_ctrl_grouphold = {
-       .ops = &vivid_vid_cap_ctrl_ops,
-       .id = VIVID_CID_GROUP_HOLD,
-       .name = "Group Hold",
-       .type = V4L2_CTRL_TYPE_BOOLEAN,
-       .min = 0,
-       .max = 1,
-       .def = 0,
-       .step = 1,
-};
-
-static const struct v4l2_ctrl_config vivid_ctrl_hdrenable = {
-       .ops = &vivid_vid_cap_ctrl_ops,
-       .id = VIVID_CID_HDR_EN,
-       .name = "HDR enable",
-       .type = V4L2_CTRL_TYPE_BOOLEAN,
-       .min = 0,
-       .max = 1,
-       .def = 0,
-       .step = 1,
-};
-
-static const struct v4l2_ctrl_config vivid_ctrl_sensor_modes = {
-       .ops = &vivid_vid_cap_ctrl_ops,
-       .id = VIVID_CID_SENSOR_MODES,
-       .name = "Sensor Modes",
-       .type = V4L2_CTRL_TYPE_INTEGER,
-       .flags = V4L2_CTRL_FLAG_READ_ONLY,
-       .min = 0,
-       .max = MAX_NUM_SENSOR_MODES,
-       .def = MAX_NUM_SENSOR_MODES,
-       .step = 1,
-};
-
-static const struct v4l2_ctrl_config vivid_ctrl_signalprops = {
-       .ops = &vivid_vid_cap_ctrl_ops,
-       .id = VIVID_CID_SENSOR_SIGNAL_PROPERTIES,
-       .name = "Sensor Signal Properties",
-       .type = V4L2_CTRL_TYPE_U32,
-       .flags = V4L2_CTRL_FLAG_HAS_PAYLOAD,
-       .min = 0,
-       .max = 0xFFFFFFFF,
-       .step = 1,
-       .def = 0,
-       .dims = { MAX_NUM_SENSOR_MODES, SENSOR_SIGNAL_PROPERTIES_CID_SIZE },
-};
-
-static const struct v4l2_ctrl_config vivid_ctrl_imageprops = {
-       .ops = &vivid_vid_cap_ctrl_ops,
-       .id = VIVID_CID_SENSOR_IMAGE_PROPERTIES,
-       .name = "Sensor Image Properties",
-       .type = V4L2_CTRL_TYPE_U32,
-       .flags = V4L2_CTRL_FLAG_HAS_PAYLOAD,
-       .min = 0,
-       .max = 0xFFFFFFFF,
-       .step = 1,
-       .def = 0,
-       .dims = { MAX_NUM_SENSOR_MODES, SENSOR_IMAGE_PROPERTIES_CID_SIZE },
-};
-
-static const struct v4l2_ctrl_config vivid_ctrl_controlprops = {
-       .ops = &vivid_vid_cap_ctrl_ops,
-       .id = VIVID_CID_SENSOR_CONTROL_PROPERTIES,
-       .name = "Sensor Control Properties",
-       .type = V4L2_CTRL_TYPE_U32,
-       .flags = V4L2_CTRL_FLAG_HAS_PAYLOAD,
-       .min = 0,
-       .max = 0xFFFFFFFF,
-       .step = 1,
-       .def = 0,
-       .dims = { MAX_NUM_SENSOR_MODES, SENSOR_CONTROL_PROPERTIES_CID_SIZE },
-};
-
-static const struct v4l2_ctrl_config vivid_ctrl_dvtimings = {
-       .ops = &vivid_vid_cap_ctrl_ops,
-       .id = VIVID_CID_SENSOR_DV_TIMINGS,
-       .name = "Sensor DV Timings",
-       .type = V4L2_CTRL_TYPE_U32,
-       .flags = V4L2_CTRL_FLAG_HAS_PAYLOAD,
-       .min = 0,
-       .max = 0xFFFFFFFF,
-       .step = 1,
-       .def = 0,
-       .dims = { MAX_NUM_SENSOR_MODES, SENSOR_DV_TIMINGS_CID_SIZE },
-};
-
 static const char * const vivid_ctrl_hor_movement_strings[] = {
        "Move Left Fast",
        "Move Left",
@@ -1558,7 +1375,7 @@ int vivid_create_controls(struct vivid_dev *dev, bool show_ccs_cap,
                dev->autogain = v4l2_ctrl_new_std(hdl_user_vid, &vivid_user_vid_ctrl_ops,
                        V4L2_CID_AUTOGAIN, 0, 1, 1, 1);
                dev->gain = v4l2_ctrl_new_std(hdl_user_vid, &vivid_user_vid_ctrl_ops,
-                       V4L2_CID_GAIN, 1, 256, 1, 100);
+                       V4L2_CID_GAIN, 0, 255, 1, 100);
                dev->alpha = v4l2_ctrl_new_std(hdl_user_vid, &vivid_user_vid_ctrl_ops,
                        V4L2_CID_ALPHA_COMPONENT, 0, 255, 1, 0);
        }
@@ -1613,23 +1430,6 @@ int vivid_create_controls(struct vivid_dev *dev, bool show_ccs_cap,
                v4l2_ctrl_new_custom(hdl_vid_cap, &vivid_ctrl_ycbcr_enc, NULL);
                v4l2_ctrl_new_custom(hdl_vid_cap, &vivid_ctrl_quantization, NULL);
                v4l2_ctrl_new_custom(hdl_vid_cap, &vivid_ctrl_alpha_mode, NULL);
-               dev->framelength = v4l2_ctrl_new_custom(hdl_vid_cap,
-                       &vivid_ctrl_framelength, NULL);
-               v4l2_ctrl_new_custom(hdl_vid_cap, &vivid_ctrl_coarsetime, NULL);
-               v4l2_ctrl_new_custom(hdl_vid_cap,
-                       &vivid_ctrl_coarsetime_short, NULL);
-               v4l2_ctrl_new_custom(hdl_vid_cap, &vivid_ctrl_grouphold, NULL);
-               v4l2_ctrl_new_custom(hdl_vid_cap, &vivid_ctrl_hdrenable, NULL);
-               dev->ctrl_signalprops = v4l2_ctrl_new_custom(hdl_vid_cap,
-                       &vivid_ctrl_signalprops, NULL);
-               dev->ctrl_imageprops = v4l2_ctrl_new_custom(hdl_vid_cap,
-                       &vivid_ctrl_imageprops, NULL);
-               dev->ctrl_controlprops = v4l2_ctrl_new_custom(hdl_vid_cap,
-                       &vivid_ctrl_controlprops, NULL);
-               dev->ctrl_dvtimings = v4l2_ctrl_new_custom(hdl_vid_cap,
-                       &vivid_ctrl_dvtimings, NULL);
-               dev->ctrl_sensormodes = v4l2_ctrl_new_custom(hdl_vid_cap,
-                       &vivid_ctrl_sensor_modes, NULL);
        }
 
        if (dev->has_vid_out && show_ccs_out) {
index c02d4ae4db112d4818d4037c857cebc78bdbb6cd..9bcca9d5635973d4a242b5948114b9129de6e0b6 100644 (file)
@@ -31,6 +31,4 @@ int vivid_create_controls(struct vivid_dev *dev, bool show_ccs_cap,
                bool has_sdtv, bool has_hdmi);
 void vivid_free_controls(struct vivid_dev *dev);
 
-int vivid_update_sensorprops(struct vivid_dev *dev);
-
 #endif
index 1b09fe8f1ef3ec8bce16fff94952302f8cf34c10..83cc6d3b47841261c0a9663ea62680d34b538fca 100644 (file)
@@ -119,8 +119,7 @@ static void blend_line(struct vivid_dev *dev, unsigned y_offset, unsigned x_offs
        }
 }
 
-static void scale_line(const u8 *src, u8 *dst, unsigned srcw, unsigned dstw,
-               unsigned twopixsize, unsigned packedpixels)
+static void scale_line(const u8 *src, u8 *dst, unsigned srcw, unsigned dstw, unsigned twopixsize)
 {
        /* Coarse scaling with Bresenham */
        unsigned int_part;
@@ -132,16 +131,9 @@ static void scale_line(const u8 *src, u8 *dst, unsigned srcw, unsigned dstw,
        /*
         * We always combine two pixels to prevent color bleed in the packed
         * yuv case.
-        * only for packed 10bit case three pixels are packed to construct
-        * 32 bit values. convert srcw and dstw to match the packing.
         */
-       if (packedpixels == 3) {
-               srcw /= 3;
-               dstw /= 3;
-       } else {
-               srcw /= 2;
-               dstw /= 2;
-       }
+       srcw /= 2;
+       dstw /= 2;
        int_part = srcw / dstw;
        fract_part = srcw % dstw;
        for (x = 0; x < dstw; x++, dst += twopixsize) {
@@ -295,18 +287,6 @@ static int vivid_copy_buffer(struct vivid_dev *dev, unsigned p, u8 *vcapbuf,
 
        voutbuf = plane_vaddr(tpg, vid_out_buf, p,
                              dev->bytesperline_out, dev->fmt_out_rect.height);
-       /* copy embedded meta data */
-       if (dev->fmt_cap->is_metadata[p] &&
-               dev->fmt_out->is_metadata[p]) {
-               unsigned size_out = vid_out_buf->vb.vb2_buf.planes[p].length;
-               unsigned size_cap = vid_cap_buf->vb.vb2_buf.planes[p].length;
-
-               size_out = size_out < size_cap ? size_out : size_cap;
-               /* copy minimum of out and capture sessions */
-               memcpy(vcapbuf, voutbuf, size_out);
-               return 0;
-       }
-
        if (p < dev->fmt_out->buffers)
                voutbuf += vid_out_buf->vb.vb2_buf.planes[p].data_offset;
        voutbuf += tpg_hdiv(tpg, p, dev->loop_vid_out.left) +
@@ -379,7 +359,7 @@ static int vivid_copy_buffer(struct vivid_dev *dev, unsigned p, u8 *vcapbuf,
                        scale_line(voutbuf + vid_out_y * stride_out, dev->scaled_line,
                                tpg_hdiv(tpg, p, dev->loop_vid_out.width),
                                tpg_hdiv(tpg, p, dev->loop_vid_cap.width),
-                               tpg_g_twopixelsize(tpg, p), tpg_g_packedpixels(tpg, p));
+                               tpg_g_twopixelsize(tpg, p));
                } else {
                        /*
                         * Offset in bytes within loop_vid_copy to the start of the
@@ -392,7 +372,7 @@ static int vivid_copy_buffer(struct vivid_dev *dev, unsigned p, u8 *vcapbuf,
 
                        scale_line(voutbuf + vid_out_y * stride_out, dev->blended_line,
                                dev->loop_vid_out.width, dev->loop_vid_copy.width,
-                               tpg_g_twopixelsize(tpg, p), tpg_g_packedpixels(tpg, p));
+                               tpg_g_twopixelsize(tpg, p));
                        if (blend)
                                blend_line(dev, vid_overlay_y + dev->loop_vid_overlay.top,
                                           dev->loop_vid_overlay.left,
@@ -403,7 +383,7 @@ static int vivid_copy_buffer(struct vivid_dev *dev, unsigned p, u8 *vcapbuf,
                                       osd, (dev->loop_vid_overlay.width * twopixsize) / 2);
                        scale_line(dev->blended_line, dev->scaled_line,
                                        dev->loop_vid_copy.width, dev->loop_vid_cap.width,
-                                       tpg_g_twopixelsize(tpg, p), tpg_g_packedpixels(tpg, p));
+                                       tpg_g_twopixelsize(tpg, p));
                }
                dev->cur_scaled_line = vid_out_y;
                memcpy(vcapbuf + vid_cap_left, dev->scaled_line,
@@ -487,36 +467,25 @@ static void vivid_fillbuff(struct vivid_dev *dev, struct vivid_buffer *buf)
 
        for (p = 0; p < tpg_g_planes(tpg); p++) {
                void *vbuf = plane_vaddr(tpg, buf, p,
-                                        tpg->bytesperline, tpg->buf_height[p]);
+                                        tpg->bytesperline, tpg->buf_height);
 
                /*
                 * The first plane of a multiplanar format has a non-zero
                 * data_offset. This helps testing whether the application
                 * correctly supports non-zero data offsets.
                 */
-               /*
-                * Disable below code as it resets embedded data passed from
-                * application.
                if (p < tpg_g_buffers(tpg) && dev->fmt_cap->data_offset[p]) {
                        memset(vbuf, dev->fmt_cap->data_offset[p] & 0xff,
                               dev->fmt_cap->data_offset[p]);
                        vbuf += dev->fmt_cap->data_offset[p];
                }
-                */
-
                tpg_calc_text_basep(tpg, basep, p, vbuf);
-               if (!is_loop || vivid_copy_buffer(dev, p, vbuf, buf)) {
-                       if (!dev->fmt_cap->is_metadata[p])
-                               tpg_fill_plane_buffer(tpg, vivid_get_std_cap(dev),
+               if (!is_loop || vivid_copy_buffer(dev, p, vbuf, buf))
+                       tpg_fill_plane_buffer(tpg, vivid_get_std_cap(dev),
                                        p, vbuf);
-               }
        }
        dev->must_blank[buf->vb.vb2_buf.index] = false;
 
-       /* Write text to plane 0 instead of the last plane */
-       tpg_calc_text_basep(tpg, basep, 0,
-               plane_vaddr(tpg, buf, 0, tpg->bytesperline, tpg->buf_height[0]));
-
        /* Updates stream time, only update at the start of a new frame. */
        if (dev->field_cap != V4L2_FIELD_ALTERNATE ||
                        (buf->vb.sequence & 1) == 0)
@@ -795,7 +764,6 @@ static int vivid_thread_vid_cap(void *data)
                        break;
 
                mutex_lock(&dev->mutex);
-               mutex_lock(&dev->mutex_framerate);
                cur_jiffies = jiffies;
                if (dev->cap_seq_resync) {
                        dev->jiffies_vid_cap = cur_jiffies;
@@ -843,7 +811,6 @@ static int vivid_thread_vid_cap(void *data)
                /* And the number of jiffies since we started */
                jiffies_since_start = jiffies - dev->jiffies_vid_cap;
 
-               mutex_unlock(&dev->mutex_framerate);
                mutex_unlock(&dev->mutex);
 
                /*
index 6c8ffc7c72131c25134b6443a6f6f81776035d15..c2c46dcdbe95acb3b79c02004d7d38594c4d18a3 100644 (file)
@@ -148,7 +148,6 @@ static int vivid_thread_vid_out(void *data)
                        break;
 
                mutex_lock(&dev->mutex);
-               mutex_lock(&dev->mutex_framerate);
                cur_jiffies = jiffies;
                if (dev->out_seq_resync) {
                        dev->jiffies_vid_out = cur_jiffies;
@@ -185,7 +184,6 @@ static int vivid_thread_vid_out(void *data)
                dev->vbi_out_seq_count = dev->out_seq_count - dev->vbi_out_seq_start;
 
                vivid_thread_vid_out_tick(dev);
-               mutex_unlock(&dev->mutex_framerate);
                mutex_unlock(&dev->mutex);
 
                /*
index 5b4d81094ef026ad1d4169f177cdee7eaeb4fd51..14256141f905dfcce58fb64f46e53a0f7566d6ec 100644 (file)
@@ -98,7 +98,7 @@ void tpg_init(struct tpg_data *tpg, unsigned w, unsigned h)
 {
        memset(tpg, 0, sizeof(*tpg));
        tpg->scaled_width = tpg->src_width = w;
-       tpg->src_height = tpg->buf_height[0] = h;
+       tpg->src_height = tpg->buf_height = h;
        tpg->crop.width = tpg->compose.width = w;
        tpg->crop.height = tpg->compose.height = h;
        tpg->recalc_colors = true;
@@ -110,7 +110,7 @@ void tpg_init(struct tpg_data *tpg, unsigned w, unsigned h)
        tpg->mv_hor_mode = TPG_MOVE_NONE;
        tpg->mv_vert_mode = TPG_MOVE_NONE;
        tpg->field = V4L2_FIELD_NONE;
-       tpg_s_fourcc(tpg, V4L2_PIX_FMT_RGB24, 0);
+       tpg_s_fourcc(tpg, V4L2_PIX_FMT_RGB24);
        tpg->colorspace = V4L2_COLORSPACE_SRGB;
        tpg->perc_fill = 100;
 }
@@ -175,7 +175,7 @@ void tpg_free(struct tpg_data *tpg)
        }
 }
 
-bool tpg_s_fourcc(struct tpg_data *tpg, u32 fourcc, u32 metadata_height)
+bool tpg_s_fourcc(struct tpg_data *tpg, u32 fourcc)
 {
        tpg->fourcc = fourcc;
        tpg->planes = 1;
@@ -184,43 +184,19 @@ bool tpg_s_fourcc(struct tpg_data *tpg, u32 fourcc, u32 metadata_height)
        tpg->interleaved = false;
        tpg->vdownsampling[0] = 1;
        tpg->hdownsampling[0] = 1;
-       tpg->packedpixels[0] = 1;
-       tpg->packedpixels[1] = 1;
-       tpg->packedpixels[2] = 1;
        tpg->hmask[0] = ~0;
        tpg->hmask[1] = ~0;
        tpg->hmask[2] = ~0;
 
        switch (fourcc) {
-       case V4L2_PIX_FMT_XBGGR10P:
-       case V4L2_PIX_FMT_XGBRG10P:
-       case V4L2_PIX_FMT_XGRBG10P:
-       case V4L2_PIX_FMT_XRGGB10P:
-               tpg->packedpixels[0] = 3;
-               tpg->is_yuv = false;
-               if (metadata_height) {
-                       tpg->buffers = 2;
-                       tpg->planes = 2;
-               }
-               tpg->vdownsampling[1] = 1;
-               tpg->hdownsampling[1] = 1;
-               break;
-       case V4L2_PIX_FMT_SBGGR10:
-       case V4L2_PIX_FMT_SGBRG10:
-       case V4L2_PIX_FMT_SGRBG10:
-       case V4L2_PIX_FMT_SRGGB10:
-               if (metadata_height) {
-                       tpg->buffers = 2;
-                       tpg->planes = 2;
-               }
-               tpg->is_yuv = false;
-               tpg->vdownsampling[1] = 1;
-               tpg->hdownsampling[1] = 1;
-               break;
        case V4L2_PIX_FMT_SBGGR8:
        case V4L2_PIX_FMT_SGBRG8:
        case V4L2_PIX_FMT_SGRBG8:
        case V4L2_PIX_FMT_SRGGB8:
+       case V4L2_PIX_FMT_SBGGR10:
+       case V4L2_PIX_FMT_SGBRG10:
+       case V4L2_PIX_FMT_SGRBG10:
+       case V4L2_PIX_FMT_SRGGB10:
        case V4L2_PIX_FMT_SBGGR12:
        case V4L2_PIX_FMT_SGBRG12:
        case V4L2_PIX_FMT_SGRBG12:
@@ -392,13 +368,6 @@ bool tpg_s_fourcc(struct tpg_data *tpg, u32 fourcc, u32 metadata_height)
                tpg->twopixelsize[0] = 4;
                tpg->twopixelsize[1] = 4;
                break;
-       case V4L2_PIX_FMT_XBGGR10P:
-       case V4L2_PIX_FMT_XGBRG10P:
-       case V4L2_PIX_FMT_XGRBG10P:
-       case V4L2_PIX_FMT_XRGGB10P:
-               tpg->twopixelsize[0] = 2 * 4;
-               tpg->twopixelsize[1] = 2 * 4;
-               break;
        case V4L2_PIX_FMT_YUV422P:
        case V4L2_PIX_FMT_YUV420:
        case V4L2_PIX_FMT_YVU420:
@@ -440,20 +409,19 @@ void tpg_reset_source(struct tpg_data *tpg, unsigned width, unsigned height,
        tpg->src_width = width;
        tpg->src_height = height;
        tpg->field = field;
-       tpg->buf_height[0] = height;
+       tpg->buf_height = height;
        if (V4L2_FIELD_HAS_T_OR_B(field))
-               tpg->buf_height[0] /= 2;
+               tpg->buf_height /= 2;
        tpg->scaled_width = width;
        tpg->crop.top = tpg->crop.left = 0;
        tpg->crop.width = width;
        tpg->crop.height = height;
        tpg->compose.top = tpg->compose.left = 0;
        tpg->compose.width = width;
-       tpg->compose.height = tpg->buf_height[0];
-       for (p = 0; p < tpg->planes; p++) {
+       tpg->compose.height = tpg->buf_height;
+       for (p = 0; p < tpg->planes; p++)
                tpg->bytesperline[p] = (width * tpg->twopixelsize[p]) /
-                       (2 * tpg->hdownsampling[p] * tpg->packedpixels[p]);
-       }
+                                      (2 * tpg->hdownsampling[p]);
        tpg->recalc_square_border = true;
 }
 
@@ -1799,12 +1767,12 @@ static unsigned tpg_calc_buffer_line(const struct tpg_data *tpg, unsigned y,
        switch (field) {
        case V4L2_FIELD_SEQ_TB:
                if (y & 1)
-                       return tpg->buf_height[0] / 2 + y / 2;
+                       return tpg->buf_height / 2 + y / 2;
                return y / 2;
        case V4L2_FIELD_SEQ_BT:
                if (y & 1)
                        return y / 2;
-               return tpg->buf_height[0] / 2 + y / 2;
+               return tpg->buf_height / 2 + y / 2;
        default:
                return y;
        }
@@ -1848,7 +1816,7 @@ void tpg_calc_text_basep(struct tpg_data *tpg,
                u8 *basep[TPG_MAX_PLANES][2], unsigned p, u8 *vbuf)
 {
        unsigned stride = tpg->bytesperline[p];
-       unsigned h = tpg->buf_height[p];
+       unsigned h = tpg->buf_height;
 
        tpg_recalc(tpg);
 
index ff2e2c54c44df6821ea6f02a54afbcebd41a7af9..9baed6a1033433e9ebd3f23eb35d7d65b7d2f2ca 100644 (file)
@@ -97,7 +97,7 @@ struct tpg_data {
        /* Source frame size */
        unsigned                        src_width, src_height;
        /* Buffer height */
-       unsigned                        buf_height[TPG_MAX_PLANES];
+       unsigned                        buf_height;
        /* Scaled output frame size */
        unsigned                        scaled_width;
        u32                             field;
@@ -149,7 +149,6 @@ struct tpg_data {
        bool                            interleaved;
        u8                              vdownsampling[TPG_MAX_PLANES];
        u8                              hdownsampling[TPG_MAX_PLANES];
-       u8                              packedpixels[TPG_MAX_PLANES];
        /*
         * horizontal positions must be ANDed with this value to enforce
         * correct boundaries for packed YUYV values.
@@ -211,7 +210,7 @@ void tpg_fill_plane_buffer(struct tpg_data *tpg, v4l2_std_id std,
                           unsigned p, u8 *vbuf);
 void tpg_fillbuffer(struct tpg_data *tpg, v4l2_std_id std,
                    unsigned p, u8 *vbuf);
-bool tpg_s_fourcc(struct tpg_data *tpg, u32 fourcc, u32 metadata_height);
+bool tpg_s_fourcc(struct tpg_data *tpg, u32 fourcc);
 void tpg_s_crop_compose(struct tpg_data *tpg, const struct v4l2_rect *crop,
                const struct v4l2_rect *compose);
 
@@ -382,21 +381,11 @@ static inline unsigned tpg_g_twopixelsize(const struct tpg_data *tpg, unsigned p
        return tpg->twopixelsize[plane];
 }
 
-static inline unsigned tpg_g_packedpixels(const struct tpg_data *tpg, unsigned plane)
-{
-       return tpg->packedpixels[plane];
-}
-
 static inline unsigned tpg_hdiv(const struct tpg_data *tpg,
                                  unsigned plane, unsigned x)
 {
-       if (tpg->packedpixels[plane] > 1)
-               return ((((x / tpg->hdownsampling[plane]) & tpg->hmask[plane]) *
-                       tpg->twopixelsize[plane]) /
-                       (2 * tpg->packedpixels[plane]));
-       else
-               return ((x / tpg->hdownsampling[plane]) & tpg->hmask[plane]) *
-                       (tpg->twopixelsize[plane] / 2);
+       return ((x / tpg->hdownsampling[plane]) & tpg->hmask[plane]) *
+               tpg->twopixelsize[plane] / 2;
 }
 
 static inline unsigned tpg_hscale(const struct tpg_data *tpg, unsigned x)
@@ -469,19 +458,13 @@ static inline unsigned tpg_calc_plane_size(const struct tpg_data *tpg, unsigned
        if (plane >= tpg_g_planes(tpg))
                return 0;
 
-       return tpg_g_bytesperline(tpg, plane) * tpg->buf_height[plane] /
+       return tpg_g_bytesperline(tpg, plane) * tpg->buf_height /
               tpg->vdownsampling[plane];
 }
 
-static inline unsigned tpg_g_buf_height(struct tpg_data *tpg, unsigned plane)
-{
-       return tpg->buf_height[plane];
-}
-
-static inline void tpg_s_buf_height(struct tpg_data *tpg,
-                                       unsigned p, unsigned h)
+static inline void tpg_s_buf_height(struct tpg_data *tpg, unsigned h)
 {
-       tpg->buf_height[p] = h;
+       tpg->buf_height = h;
 }
 
 static inline void tpg_s_field(struct tpg_data *tpg, unsigned field, bool alternate)
index ee98a4719b3acb39435a603407dbb0215ada1790..ef5412311b2fa057a9dc96f5f0f620ddfaa9f0ce 100644 (file)
@@ -67,8 +67,6 @@ static const struct vivid_fmt formats_ovl[] = {
 /* The number of discrete webcam frameintervals */
 #define VIVID_WEBCAM_IVALS (VIVID_WEBCAM_SIZES * 2)
 
-#define VIVID_HDMI_SIZES 3
-
 /* Sizes must be in increasing order */
 static const struct v4l2_frmsize_discrete webcam_sizes[VIVID_WEBCAM_SIZES] = {
        {  320, 180 },
@@ -92,12 +90,6 @@ static const struct v4l2_fract webcam_intervals[VIVID_WEBCAM_IVALS] = {
        {  1, 60 },
 };
 
-static const struct v4l2_frmsize_discrete hdmi_sizes[VIVID_HDMI_SIZES] = {
-       { 1280, 720 },
-       { 1920, 1080 },
-       { 3840, 2160 },
-};
-
 static const struct v4l2_discrete_probe webcam_probe = {
        webcam_sizes,
        VIVID_WEBCAM_SIZES
@@ -133,7 +125,7 @@ static int vid_cap_queue_setup(struct vb2_queue *vq, const void *parg,
        if (fmt) {
                const struct v4l2_pix_format_mplane *mp;
                struct v4l2_format mp_fmt;
-               struct vivid_fmt *vfmt;
+               const struct vivid_fmt *vfmt;
 
                if (!V4L2_TYPE_IS_MULTIPLANAR(fmt->type)) {
                        fmt_sp2mp(fmt, &mp_fmt);
@@ -146,21 +138,17 @@ static int vid_cap_queue_setup(struct vb2_queue *vq, const void *parg,
                 */
                if (mp->num_planes != buffers)
                        return -EINVAL;
-
                vfmt = vivid_get_format(dev, mp->pixelformat);
                for (p = 0; p < buffers; p++) {
                        sizes[p] = mp->plane_fmt[p].sizeimage;
-                       if (sizes[p] < tpg_g_line_width(&dev->tpg, p) *
-                                       tpg_g_buf_height(&dev->tpg, p) +
+                       if (sizes[p] < tpg_g_line_width(&dev->tpg, p) * h +
                                                        vfmt->data_offset[p])
                                return -EINVAL;
                }
        } else {
-               for (p = 0; p < buffers; p++) {
-                       sizes[p] = tpg_g_line_width(&dev->tpg, p) *
-                                       tpg_g_buf_height(&dev->tpg, p) +
+               for (p = 0; p < buffers; p++)
+                       sizes[p] = tpg_g_line_width(&dev->tpg, p) * h +
                                        dev->fmt_cap->data_offset[p];
-               }
        }
 
        if (vq->num_buffers + *nbuffers < 2)
@@ -183,11 +171,9 @@ static int vid_cap_queue_setup(struct vb2_queue *vq, const void *parg,
 static int vid_cap_buf_prepare(struct vb2_buffer *vb)
 {
        struct vivid_dev *dev = vb2_get_drv_priv(vb->vb2_queue);
-       struct vb2_queue *q = vb->vb2_queue;
        unsigned long size;
        unsigned buffers = tpg_g_buffers(&dev->tpg);
        unsigned p;
-       int err = 0;
 
        dprintk(dev, 1, "%s\n", __func__);
 
@@ -203,8 +189,7 @@ static int vid_cap_buf_prepare(struct vb2_buffer *vb)
                return -EINVAL;
        }
        for (p = 0; p < buffers; p++) {
-               size = tpg_g_line_width(&dev->tpg, p) *
-                       tpg_g_buf_height(&dev->tpg, p) +
+               size = tpg_g_line_width(&dev->tpg, p) * dev->fmt_cap_rect.height +
                        dev->fmt_cap->data_offset[p];
 
                if (vb2_plane_size(vb, p) < size) {
@@ -215,20 +200,6 @@ static int vid_cap_buf_prepare(struct vb2_buffer *vb)
 
                vb2_set_plane_payload(vb, p, size);
                vb->planes[p].data_offset = dev->fmt_cap->data_offset[p];
-
-               if (q->memory == V4L2_MEMORY_DMABUF) {
-                       struct dma_buf *dbuf = dma_buf_get(vb->planes[p].m.fd);
-                       enum dma_data_direction dma_dir =
-                               q->is_output ? DMA_TO_DEVICE : DMA_FROM_DEVICE;
-
-                       err = dma_buf_begin_cpu_access(dbuf, 0,
-                                       vb->planes[p].length, dma_dir);
-                       if (err) {
-                               dprintk(dev, 1, "%s dma buf cpu access for plane %d failed\n",
-                                       __func__, p);
-                               return err;
-                       }
-               }
        }
 
        return 0;
@@ -241,26 +212,6 @@ static void vid_cap_buf_finish(struct vb2_buffer *vb)
        struct v4l2_timecode *tc = &vbuf->timecode;
        unsigned fps = 25;
        unsigned seq = vbuf->sequence;
-       unsigned p;
-
-       /*
-        * DMA mapping invalid during queue cancel and error
-        * states.  Only set up for the CPU copy when streaming.
-        */
-       if (vb->state == VB2_BUF_STATE_DONE) {
-               for (p = 0; p < tpg_g_buffers(&dev->tpg); p++) {
-                       struct vb2_queue *q = vb->vb2_queue;
-
-                       if (q->memory == V4L2_MEMORY_DMABUF) {
-                               struct dma_buf *dbuf = dma_buf_get(vb->planes[p].m.fd);
-                               enum dma_data_direction dma_dir =
-                                       q->is_output ? DMA_TO_DEVICE : DMA_FROM_DEVICE;
-
-                               dma_buf_end_cpu_access(dbuf, 0,
-                                       vb->planes[p].length, dma_dir);
-                       }
-               }
-       }
 
        if (!vivid_is_sdtv_cap(dev))
                return;
@@ -446,29 +397,6 @@ static enum tpg_pixel_aspect vivid_get_pixel_aspect(const struct vivid_dev *dev)
        return TPG_PIXEL_ASPECT_SQUARE;
 }
 
-void vivid_update_timeperframe(struct vivid_dev *dev, u32 frame_length)
-{
-       struct v4l2_bt_timings *bt = &dev->dv_timings_cap.bt;
-       unsigned size;
-
-       mutex_lock(&dev->mutex_framerate);
-
-       dev->cap_seq_resync = true;
-       size = V4L2_DV_BT_FRAME_WIDTH(bt) * frame_length;
-       dev->timeperframe_vid_cap = (struct v4l2_fract) {
-               size / 100, (u32)bt->pixelclock / 100
-       };
-
-       if (dev->loop_video) {
-               dev->out_seq_resync = true;
-               dev->timeperframe_vid_out = (struct v4l2_fract) {
-                       size / 100, (u32)bt->pixelclock / 100
-               };
-       }
-
-       mutex_unlock(&dev->mutex_framerate);
-}
-
 /*
  * Called whenever the format has to be reset which can occur when
  * changing inputs, standard, timings, etc.
@@ -613,14 +541,11 @@ int vivid_g_fmt_vid_cap(struct file *file, void *priv,
        mp->xfer_func    = vivid_xfer_func_cap(dev);
        mp->ycbcr_enc    = vivid_ycbcr_enc_cap(dev);
        mp->quantization = vivid_quantization_cap(dev);
-       mp->num_planes = tpg_g_planes(&dev->tpg);
-       mp->metadata_height = dev->embedded_data_height;
+       mp->num_planes = dev->fmt_cap->buffers;
        for (p = 0; p < mp->num_planes; p++) {
-               mp->plane_fmt[p].bytesperline =
-                       tpg_g_bytesperline(&dev->tpg, p);
+               mp->plane_fmt[p].bytesperline = tpg_g_bytesperline(&dev->tpg, p);
                mp->plane_fmt[p].sizeimage =
-                       mp->plane_fmt[p].bytesperline *
-                       tpg_g_buf_height(&dev->tpg, p) +
+                       tpg_g_line_width(&dev->tpg, p) * mp->height +
                        dev->fmt_cap->data_offset[p];
        }
        return 0;
@@ -637,7 +562,6 @@ int vivid_try_fmt_vid_cap(struct file *file, void *priv,
        unsigned factor = 1;
        unsigned w, h;
        unsigned p;
-       unsigned packedpixels;
 
        fmt = vivid_get_format(dev, mp->pixelformat);
        if (!fmt) {
@@ -646,9 +570,6 @@ int vivid_try_fmt_vid_cap(struct file *file, void *priv,
                mp->pixelformat = V4L2_PIX_FMT_YUYV;
                fmt = vivid_get_format(dev, mp->pixelformat);
        }
-       packedpixels = fmt->packedpixels;
-       if (!packedpixels)
-               packedpixels = 1;
 
        mp->field = vivid_field_cap(dev, mp->field);
        if (vivid_is_webcam(dev)) {
@@ -688,17 +609,12 @@ int vivid_try_fmt_vid_cap(struct file *file, void *priv,
                mp->height = r.height / factor;
        }
 
-       /* clip metadata height maximum value */
-       if (mp->metadata_height > MAX_METADATA_HEIGHT)
-               mp->metadata_height = MAX_METADATA_HEIGHT;
-
        /* This driver supports custom bytesperline values */
 
        mp->num_planes = fmt->buffers;
        for (p = 0; p < mp->num_planes; p++) {
                /* Calculate the minimum supported bytesperline value */
-               bytesperline = ((mp->width * fmt->bit_depth[p]) >> 3) /
-                               packedpixels;
+               bytesperline = (mp->width * fmt->bit_depth[p]) >> 3;
                /* Calculate the maximum supported bytesperline value */
                max_bpl = (MAX_ZOOM * MAX_WIDTH * fmt->bit_depth[p]) >> 3;
 
@@ -706,10 +622,8 @@ int vivid_try_fmt_vid_cap(struct file *file, void *priv,
                        pfmt[p].bytesperline = max_bpl;
                if (pfmt[p].bytesperline < bytesperline)
                        pfmt[p].bytesperline = bytesperline;
-               pfmt[p].sizeimage =
-                       tpg_calc_line_width(&dev->tpg, p, pfmt[p].bytesperline) *
-                       (fmt->is_metadata[p] ? mp->metadata_height : mp->height) +
-                       fmt->data_offset[p];
+               pfmt[p].sizeimage = tpg_calc_line_width(&dev->tpg, p, pfmt[p].bytesperline) *
+                       mp->height + fmt->data_offset[p];
                memset(pfmt[p].reserved, 0, sizeof(pfmt[p].reserved));
        }
        mp->colorspace = vivid_colorspace_cap(dev);
@@ -732,7 +646,6 @@ int vivid_s_fmt_vid_cap(struct file *file, void *priv,
        unsigned factor = 1;
        unsigned p;
        unsigned i;
-       unsigned planes;
 
        if (ret < 0)
                return ret;
@@ -833,13 +746,8 @@ int vivid_s_fmt_vid_cap(struct file *file, void *priv,
 
        dev->fmt_cap_rect.width = mp->width;
        dev->fmt_cap_rect.height = mp->height;
-       tpg_s_fourcc(&dev->tpg, dev->fmt_cap->fourcc, mp->metadata_height);
-       for (p = 0; p < tpg_g_buffers(&dev->tpg); p++) {
-               unsigned height = dev->fmt_cap->is_metadata[p] ?
-                       mp->metadata_height : mp->height;
-               tpg_s_buf_height(&dev->tpg, p, height);
-       }
-       dev->embedded_data_height = mp->metadata_height;
+       tpg_s_buf_height(&dev->tpg, mp->height);
+       tpg_s_fourcc(&dev->tpg, dev->fmt_cap->fourcc);
        for (p = 0; p < tpg_g_buffers(&dev->tpg); p++)
                tpg_s_bytesperline(&dev->tpg, p, mp->plane_fmt[p].bytesperline);
        dev->field_cap = mp->field;
@@ -851,9 +759,6 @@ int vivid_s_fmt_vid_cap(struct file *file, void *priv,
        if (vivid_is_sdtv_cap(dev))
                dev->tv_field_cap = mp->field;
        tpg_update_mv_step(&dev->tpg);
-       // update framelength control to control framerate
-       v4l2_ctrl_s_ctrl(dev->framelength,
-               V4L2_DV_BT_FRAME_HEIGHT(&dev->dv_timings_cap.bt));
        return 0;
 }
 
@@ -1014,7 +919,7 @@ int vivid_vid_cap_s_selection(struct file *file, void *fh, struct v4l2_selection
                                rect_set_max_size(compose, &max_rect);
                        }
                        dev->fmt_cap_rect = fmt;
-                       tpg_s_buf_height(&dev->tpg, 0, fmt.height);
+                       tpg_s_buf_height(&dev->tpg, fmt.height);
                } else if (dev->has_compose_cap) {
                        struct v4l2_rect fmt = dev->fmt_cap_rect;
 
@@ -1023,7 +928,7 @@ int vivid_vid_cap_s_selection(struct file *file, void *fh, struct v4l2_selection
                            vb2_is_busy(&dev->vb_vid_cap_q))
                                return -EBUSY;
                        dev->fmt_cap_rect = fmt;
-                       tpg_s_buf_height(&dev->tpg, 0, fmt.height);
+                       tpg_s_buf_height(&dev->tpg, fmt.height);
                        rect_set_size_to(compose, &s->r);
                        rect_map_inside(compose, &dev->fmt_cap_rect);
                } else {
@@ -1033,7 +938,7 @@ int vivid_vid_cap_s_selection(struct file *file, void *fh, struct v4l2_selection
                        rect_set_size_to(&dev->fmt_cap_rect, &s->r);
                        rect_set_size_to(compose, &s->r);
                        rect_map_inside(compose, &dev->fmt_cap_rect);
-                       tpg_s_buf_height(&dev->tpg, 0, dev->fmt_cap_rect.height);
+                       tpg_s_buf_height(&dev->tpg, dev->fmt_cap_rect.height);
                }
                s->r.top *= factor;
                s->r.height *= factor;
@@ -1764,9 +1669,6 @@ int vivid_vid_cap_s_dv_timings(struct file *file, void *_fh,
 
        dev->dv_timings_cap = *timings;
        vivid_update_format_cap(dev, false);
-       // update framelength control to control framerate
-       v4l2_ctrl_s_ctrl(dev->framelength,
-               V4L2_DV_BT_FRAME_HEIGHT(&dev->dv_timings_cap.bt));
        return 0;
 }
 
@@ -1837,13 +1739,6 @@ int vidioc_enum_framesizes(struct file *file, void *fh,
                fsize->discrete = webcam_sizes[fsize->index];
                return 0;
        }
-       if (vivid_is_hdmi_cap(dev)) {
-               if (fsize->index >= ARRAY_SIZE(hdmi_sizes))
-                       return -EINVAL;
-               fsize->type = V4L2_FRMSIZE_TYPE_DISCRETE;
-               fsize->discrete = hdmi_sizes[fsize->index];
-               return 0;
-       }
        if (fsize->index)
                return -EINVAL;
        fsize->type = V4L2_FRMSIZE_TYPE_STEPWISE;
index 3817f06654d46dbabcc5eaaa41c188797529da80..94079815dbc274e69f6ca8709a143c6cfd0f1aef 100644 (file)
@@ -67,6 +67,5 @@ int vidioc_enum_framesizes(struct file *file, void *fh, struct v4l2_frmsizeenum
 int vidioc_enum_frameintervals(struct file *file, void *priv, struct v4l2_frmivalenum *fival);
 int vivid_vid_cap_g_parm(struct file *file, void *priv, struct v4l2_streamparm *parm);
 int vivid_vid_cap_s_parm(struct file *file, void *priv, struct v4l2_streamparm *parm);
-void vivid_update_timeperframe(struct vivid_dev *dev, u32 frame_length);
 
 #endif
index 9e90e318fcfae069300c8a9b48014db25fc98b12..1678b730dba244dc1058df46899de9f958a12fdf 100644 (file)
@@ -391,128 +391,60 @@ struct vivid_fmt vivid_formats[] = {
        },
        {
                .fourcc   = V4L2_PIX_FMT_SBGGR10, /* Bayer BG/GR */
-               .is_metadata = { 0, 1},
-               .vdownsampling = { 1, 1 },
-               .bit_depth = { 16, 16 },
-               .planes   = 2,
-               .buffers = 2,
-       },
-       {
-               .fourcc   = V4L2_PIX_FMT_SGBRG10, /* Bayer GB/RG */
-               .is_metadata = { 0, 1},
-               .vdownsampling = { 1, 1 },
-               .bit_depth = { 16, 16 },
-               .planes   = 2,
-               .buffers = 2,
-       },
-       {
-               .fourcc   = V4L2_PIX_FMT_SGRBG10, /* Bayer GR/BG */
-               .is_metadata = { 0, 1},
-               .vdownsampling = { 1, 1 },
-               .bit_depth = { 16, 16 },
-               .planes   = 2,
-               .buffers = 2,
-       },
-       {
-               .fourcc   = V4L2_PIX_FMT_SRGGB10, /* Bayer RG/GB */
-               .is_metadata = { 0, 1},
-               .vdownsampling = { 1, 1 },
-               .bit_depth = { 16, 16 },
-               .planes   = 2,
-               .buffers = 2,
-       },
-       {
-               .fourcc   = V4L2_PIX_FMT_SBGGR12, /* Bayer BG/GR */
                .vdownsampling = { 1 },
                .bit_depth = { 16 },
                .planes   = 1,
                .buffers = 1,
        },
        {
-               .fourcc   = V4L2_PIX_FMT_SGBRG12, /* Bayer GB/RG */
+               .fourcc   = V4L2_PIX_FMT_SGBRG10, /* Bayer GB/RG */
                .vdownsampling = { 1 },
                .bit_depth = { 16 },
                .planes   = 1,
                .buffers = 1,
        },
        {
-               .fourcc   = V4L2_PIX_FMT_SGRBG12, /* Bayer GR/BG */
+               .fourcc   = V4L2_PIX_FMT_SGRBG10, /* Bayer GR/BG */
                .vdownsampling = { 1 },
                .bit_depth = { 16 },
                .planes   = 1,
                .buffers = 1,
        },
        {
-               .fourcc   = V4L2_PIX_FMT_SRGGB12, /* Bayer RG/GB */
+               .fourcc   = V4L2_PIX_FMT_SRGGB10, /* Bayer RG/GB */
                .vdownsampling = { 1 },
                .bit_depth = { 16 },
                .planes   = 1,
                .buffers = 1,
        },
        {
-               .fourcc   = V4L2_PIX_FMT_SBGGR16, /* Bayer BG/GR */
+               .fourcc   = V4L2_PIX_FMT_SBGGR12, /* Bayer BG/GR */
                .vdownsampling = { 1 },
                .bit_depth = { 16 },
                .planes   = 1,
                .buffers = 1,
        },
        {
-               .fourcc   = V4L2_PIX_FMT_SGBRG16, /* Bayer GB/RG */
+               .fourcc   = V4L2_PIX_FMT_SGBRG12, /* Bayer GB/RG */
                .vdownsampling = { 1 },
                .bit_depth = { 16 },
                .planes   = 1,
                .buffers = 1,
        },
        {
-               .fourcc   = V4L2_PIX_FMT_SGRBG16, /* Bayer GR/BG */
+               .fourcc   = V4L2_PIX_FMT_SGRBG12, /* Bayer GR/BG */
                .vdownsampling = { 1 },
                .bit_depth = { 16 },
                .planes   = 1,
                .buffers = 1,
        },
        {
-               .fourcc   = V4L2_PIX_FMT_SRGGB16, /* Bayer RG/GB */
+               .fourcc   = V4L2_PIX_FMT_SRGGB12, /* Bayer RG/GB */
                .vdownsampling = { 1 },
                .bit_depth = { 16 },
                .planes   = 1,
                .buffers = 1,
        },
-       {
-               .fourcc = V4L2_PIX_FMT_XBGGR10P, /* Packed Bayer BG/GR */
-               .is_metadata = { 0, 1},
-               .vdownsampling = { 1, 1 },
-               .packedpixels = 3,
-               .bit_depth = { 32, 32},
-               .planes = 2,
-               .buffers = 2,
-       },
-       {
-               .fourcc = V4L2_PIX_FMT_XGBRG10P, /* Packed Bayer GB/RG */
-               .is_metadata = { 0, 1},
-               .vdownsampling = { 1, 1 },
-               .packedpixels = 3,
-               .bit_depth = { 32, 32 },
-               .planes = 2,
-               .buffers = 2,
-       },
-       {
-               .fourcc = V4L2_PIX_FMT_XGRBG10P, /* Packed Bayer GR/BG */
-               .is_metadata = { 0, 1},
-               .vdownsampling = { 1, 1 },
-               .packedpixels = 3,
-               .bit_depth = { 32, 32 },
-               .planes = 2,
-               .buffers = 2,
-       },
-       {
-               .fourcc = V4L2_PIX_FMT_XRGGB10P, /* Packed Bayer RG/GB */
-               .is_metadata = { 0, 1},
-               .vdownsampling = { 1, 1 },
-               .packedpixels = 3,
-               .bit_depth = { 32, 32 },
-               .planes = 2,
-               .buffers = 2,
-       },
        {
                .fourcc   = V4L2_PIX_FMT_NV16M,
                .vdownsampling = { 1, 1 },
index e0f6088d0fdd0cfc6fb0acdbfeef7aa0abb6f9b4..b77acb6a70138a4f093c783f73e0b4dae8ddddad 100644 (file)
@@ -38,12 +38,12 @@ static int vid_out_queue_setup(struct vb2_queue *vq, const void *parg,
        const struct v4l2_format *fmt = parg;
        struct vivid_dev *dev = vb2_get_drv_priv(vq);
        const struct vivid_fmt *vfmt = dev->fmt_out;
-       unsigned planes = dev->fmt_out_metadata_height ? vfmt->buffers : (vfmt->buffers - 1);
+       unsigned planes = vfmt->buffers;
        unsigned h = dev->fmt_out_rect.height;
-       unsigned size = dev->bytesperline_out[0] * (h + dev->fmt_out_metadata_height);
+       unsigned size = dev->bytesperline_out[0] * h;
        unsigned p;
 
-       for (p = vfmt->buffers; p < planes; p++)
+       for (p = vfmt->buffers; p < vfmt->planes; p++)
                size += dev->bytesperline_out[p] * h / vfmt->vdownsampling[p];
 
        if (dev->field_out == V4L2_FIELD_ALTERNATE) {
@@ -77,7 +77,7 @@ static int vid_out_queue_setup(struct vb2_queue *vq, const void *parg,
                 * Check if the number of planes in the specified format match
                 * the number of planes in the current format. You can't mix that.
                 */
-                if (mp->num_planes != planes)
+               if (mp->num_planes != planes)
                        return -EINVAL;
                sizes[0] = mp->plane_fmt[0].sizeimage;
                if (sizes[0] < size)
@@ -122,7 +122,6 @@ static int vid_out_buf_prepare(struct vb2_buffer *vb)
                return -EINVAL;
 
        planes = dev->fmt_out->planes;
-       planes -= dev->fmt_out_metadata_height ? 0 : 1;
 
        if (dev->buf_prepare_error) {
                /*
@@ -225,7 +224,6 @@ void vivid_update_format_out(struct vivid_dev *dev)
 {
        struct v4l2_bt_timings *bt = &dev->dv_timings_out.bt;
        unsigned size, p;
-       unsigned packedpixels = dev->fmt_out->packedpixels;
 
        switch (dev->output_type[dev->output]) {
        case SVID:
@@ -273,12 +271,9 @@ void vivid_update_format_out(struct vivid_dev *dev)
        if (V4L2_FIELD_HAS_T_OR_B(dev->field_out))
                dev->crop_out.height /= 2;
        dev->fmt_out_rect = dev->crop_out;
-       if (!packedpixels)
-               packedpixels = 1;
        for (p = 0; p < dev->fmt_out->planes; p++)
                dev->bytesperline_out[p] =
-                       (dev->sink_rect.width * dev->fmt_out->bit_depth[p]) /
-                               (8 * packedpixels);
+                       (dev->sink_rect.width * dev->fmt_out->bit_depth[p]) / 8;
 }
 
 /* Map the field to something that is valid for the current output */
@@ -325,20 +320,19 @@ int vivid_g_fmt_vid_out(struct file *file, void *priv,
        const struct vivid_fmt *fmt = dev->fmt_out;
        unsigned p;
 
-       mp->width        = dev->fmt_out_rect.width;
+       mp->width        = dev->fmt_out_rect.width;
        mp->height       = dev->fmt_out_rect.height;
-       mp->field        = dev->field_out;
+       mp->field        = dev->field_out;
        mp->pixelformat  = fmt->fourcc;
        mp->colorspace   = dev->colorspace_out;
        mp->xfer_func    = dev->xfer_func_out;
        mp->ycbcr_enc    = dev->ycbcr_enc_out;
        mp->quantization = dev->quantization_out;
-       mp->num_planes = dev->fmt_out_metadata_height ? fmt->buffers : (fmt->buffers - 1);
-       mp->metadata_height = dev->fmt_out_metadata_height;
+       mp->num_planes = fmt->buffers;
        for (p = 0; p < mp->num_planes; p++) {
                mp->plane_fmt[p].bytesperline = dev->bytesperline_out[p];
                mp->plane_fmt[p].sizeimage =
-                       mp->plane_fmt[p].bytesperline * dev->height_out[p];
+                       mp->plane_fmt[p].bytesperline * mp->height;
        }
        for (p = fmt->buffers; p < fmt->planes; p++) {
                unsigned stride = dev->bytesperline_out[p];
@@ -361,7 +355,6 @@ int vivid_try_fmt_vid_out(struct file *file, void *priv,
        unsigned factor = 1;
        unsigned w, h;
        unsigned p;
-       unsigned packedpixels;
 
        fmt = vivid_get_format(dev, mp->pixelformat);
        if (!fmt) {
@@ -370,9 +363,6 @@ int vivid_try_fmt_vid_out(struct file *file, void *priv,
                mp->pixelformat = V4L2_PIX_FMT_YUYV;
                fmt = vivid_get_format(dev, mp->pixelformat);
        }
-       packedpixels = fmt->packedpixels;
-       if (!packedpixels)
-               packedpixels = 1;
 
        mp->field = vivid_field_out(dev, mp->field);
        if (vivid_is_svid_out(dev)) {
@@ -405,24 +395,19 @@ int vivid_try_fmt_vid_out(struct file *file, void *priv,
                mp->height = r.height / factor;
        }
 
-       /* clip metadata height maximum value */
-       if (mp->metadata_height > MAX_METADATA_HEIGHT)
-               mp->metadata_height = MAX_METADATA_HEIGHT;
-
        /* This driver supports custom bytesperline values */
 
        /* Calculate the minimum supported bytesperline value */
-       bytesperline = ((mp->width * fmt->bit_depth[0]) >> 3) / packedpixels;
+       bytesperline = (mp->width * fmt->bit_depth[0]) >> 3;
        /* Calculate the maximum supported bytesperline value */
        max_bpl = (MAX_ZOOM * MAX_WIDTH * fmt->bit_depth[0]) >> 3;
-       mp->num_planes = dev->fmt_out_metadata_height ? fmt->buffers : (fmt->buffers - 1);
+       mp->num_planes = fmt->buffers;
        for (p = 0; p < mp->num_planes; p++) {
                if (pfmt[p].bytesperline > max_bpl)
                        pfmt[p].bytesperline = max_bpl;
                if (pfmt[p].bytesperline < bytesperline)
                        pfmt[p].bytesperline = bytesperline;
-               pfmt[p].sizeimage = pfmt[p].bytesperline *
-                       (fmt->is_metadata[p] ? mp->metadata_height : mp->height);
+               pfmt[p].sizeimage = pfmt[p].bytesperline * mp->height;
                memset(pfmt[p].reserved, 0, sizeof(pfmt[p].reserved));
        }
        for (p = fmt->buffers; p < fmt->planes; p++)
@@ -556,12 +541,8 @@ int vivid_s_fmt_vid_out(struct file *file, void *priv,
 
        dev->fmt_out_rect.width = mp->width;
        dev->fmt_out_rect.height = mp->height;
-       for (p = 0; p < mp->num_planes; p++) {
+       for (p = 0; p < mp->num_planes; p++)
                dev->bytesperline_out[p] = mp->plane_fmt[p].bytesperline;
-               dev->height_out[p] = dev->fmt_out->is_metadata[p] ?
-                       mp->metadata_height : mp->height;
-       }
-       dev->fmt_out_metadata_height = mp->metadata_height;
        for (p = dev->fmt_out->buffers; p < dev->fmt_out->planes; p++)
                dev->bytesperline_out[p] =
                        (dev->bytesperline_out[0] * dev->fmt_out->bit_depth[p]) /