Try apply this patch and add below to the v4l2-ctl capute command line.
–set-ctrl preferred_stride=256 preferred_stride=256
diff --git a/drivers/media/platform/tegra/camera/vi/channel.c b/drivers/media/platform/tegra/camera/vi/channel.c
index 6a2777e..c2a28d0 100644
--- a/drivers/media/platform/tegra/camera/vi/channel.c
+++ b/drivers/media/platform/tegra/camera/vi/channel.c
@@ -254,6 +254,10 @@ static void tegra_channel_update_format(struct tegra_channel *chan,
chan->format.pixelformat = fourcc;
chan->format.bytesperline = preferred_stride ?: bytesperline;
+ dev_dbg(&chan->video->dev,
+ "%s: Resolution= %dx%d bytesperline=%d\n",
+ __func__, width, height, chan->format.bytesperline);
+
tegra_channel_fmt_align(chan, chan->fmtinfo,
&chan->format.width,
&chan->format.height,
@@ -332,7 +336,8 @@ static void tegra_channel_fmts_bitmap_init(struct tegra_channel *chan)
tegra_channel_update_format(chan, chan->format.width,
chan->format.height,
chan->fmtinfo->fourcc,
- &chan->fmtinfo->bpp, 0);
+ &chan->fmtinfo->bpp,
+ chan->preferred_stride);
if (chan->total_ports > 1)
update_gang_mode(chan);
@@ -1125,7 +1130,8 @@ tegra_channel_s_dv_timings(struct file *file, void *fh,
if (!ret)
tegra_channel_update_format(chan, bt->width, bt->height,
- chan->fmtinfo->fourcc, &chan->fmtinfo->bpp, 0);
+ chan->fmtinfo->fourcc, &chan->fmtinfo->bpp,
+ chan->preferred_stride);
if (chan->total_ports > 1)
update_gang_mode(chan);
@@ -1226,6 +1232,14 @@ int tegra_channel_s_ctrl(struct v4l2_ctrl *ctrl)
case TEGRA_CAMERA_CID_LOW_LATENCY:
chan->low_latency = ctrl->val;
break;
+ case TEGRA_CAMERA_CID_VI_PREFERRED_STRIDE:
+ chan->preferred_stride = ctrl->val;
+ tegra_channel_update_format(chan, chan->format.width,
+ chan->format.height,
+ chan->format.pixelformat,
+ &chan->fmtinfo->bpp,
+ chan->preferred_stride);
+ break;
default:
dev_err(&chan->video->dev, "%s: Invalid ctrl %u\n",
__func__, ctrl->id);
@@ -1360,6 +1374,16 @@ static const struct v4l2_ctrl_config common_custom_ctrls[] = {
.max = 1,
.step = 1,
},
+ {
+ .ops = &channel_ctrl_ops,
+ .id = TEGRA_CAMERA_CID_VI_PREFERRED_STRIDE,
+ .name = "Preferred Stride",
+ .type = V4L2_CTRL_TYPE_INTEGER,
+ .min = 0,
+ .max = 65535,
+ .step = 1,
+ .def = 0,
+ },
};
#define GET_TEGRA_CAMERA_CTRL(id, c) \
@@ -1913,6 +1937,10 @@ __tegra_channel_set_format(struct tegra_channel *chan,
if (!ret) {
chan->format = *pix;
chan->fmtinfo = vfmt;
+
+ if (chan->preferred_stride)
+ pix->bytesperline = chan->preferred_stride;
+
tegra_channel_update_format(chan, pix->width,
pix->height, vfmt->fourcc, &vfmt->bpp,
pix->bytesperline);
@@ -2294,7 +2322,8 @@ int tegra_channel_init(struct tegra_channel *chan)
tegra_channel_update_format(chan, TEGRA_DEF_WIDTH,
TEGRA_DEF_HEIGHT,
chan->fmtinfo->fourcc,
- &chan->fmtinfo->bpp, 0);
+ &chan->fmtinfo->bpp,
+ chan->preferred_stride);
chan->buffer_offset[0] = 0;
/* Init bpl factor to 1, will be overidden based on interlace_type */
diff --git a/include/media/mc_common.h b/include/media/mc_common.h
index 01b0345..891cfe8 100644
--- a/include/media/mc_common.h
+++ b/include/media/mc_common.h
@@ -208,6 +208,7 @@ struct tegra_channel {
void __iomem *csibase[TEGRA_CSI_BLOCKS];
unsigned int stride_align;
+ unsigned int preferred_stride;
unsigned int width_align;
unsigned int height_align;
unsigned int size_align;
diff --git a/include/media/tegra-v4l2-camera.h b/include/media/tegra-v4l2-camera.h
index cb63198..1c91672 100644
--- a/include/media/tegra-v4l2-camera.h
+++ b/include/media/tegra-v4l2-camera.h
@@ -53,6 +53,7 @@
#define TEGRA_CAMERA_CID_SENSOR_CONTROL_PROPERTIES (TEGRA_CAMERA_CID_BASE+107)
#define TEGRA_CAMERA_CID_SENSOR_DV_TIMINGS (TEGRA_CAMERA_CID_BASE+108)
#define TEGRA_CAMERA_CID_LOW_LATENCY (TEGRA_CAMERA_CID_BASE+109)
+#define TEGRA_CAMERA_CID_VI_PREFERRED_STRIDE (TEGRA_CAMERA_CID_BASE+110)
/**
* This is temporary with the current v4l2 infrastructure