.depth = 12,
.mmal_component = MMAL_COMPONENT_CAMERA,
.ybbp = 1,
+ .remove_padding = 1,
},
{
.name = "4:2:2, packed, YUYV",
.depth = 16,
.mmal_component = MMAL_COMPONENT_CAMERA,
.ybbp = 2,
+ .remove_padding = 0,
},
{
.name = "RGB24 (LE)",
.depth = 24,
.mmal_component = MMAL_COMPONENT_CAMERA,
.ybbp = 3,
+ .remove_padding = 0,
},
{
.name = "JPEG",
.depth = 8,
.mmal_component = MMAL_COMPONENT_IMAGE_ENCODE,
.ybbp = 0,
+ .remove_padding = 0,
},
{
.name = "H264",
.depth = 8,
.mmal_component = MMAL_COMPONENT_VIDEO_ENCODE,
.ybbp = 0,
+ .remove_padding = 0,
},
{
.name = "MJPEG",
.depth = 8,
.mmal_component = MMAL_COMPONENT_VIDEO_ENCODE,
.ybbp = 0,
+ .remove_padding = 0,
},
{
.name = "4:2:2, packed, YVYU",
.depth = 16,
.mmal_component = MMAL_COMPONENT_CAMERA,
.ybbp = 2,
+ .remove_padding = 0,
},
{
.name = "4:2:2, packed, VYUY",
.depth = 16,
.mmal_component = MMAL_COMPONENT_CAMERA,
.ybbp = 2,
+ .remove_padding = 0,
},
{
.name = "4:2:2, packed, UYVY",
.depth = 16,
.mmal_component = MMAL_COMPONENT_CAMERA,
.ybbp = 2,
+ .remove_padding = 0,
},
{
.name = "4:2:0, planar, NV12",
.depth = 12,
.mmal_component = MMAL_COMPONENT_CAMERA,
.ybbp = 1,
+ .remove_padding = 1,
},
{
.name = "RGB24 (BE)",
.depth = 24,
.mmal_component = MMAL_COMPONENT_CAMERA,
.ybbp = 3,
+ .remove_padding = 0,
},
{
.name = "4:2:0, planar, YVU",
.depth = 12,
.mmal_component = MMAL_COMPONENT_CAMERA,
.ybbp = 1,
+ .remove_padding = 1,
},
{
.name = "4:2:0, planar, NV21",
.depth = 12,
.mmal_component = MMAL_COMPONENT_CAMERA,
.ybbp = 1,
+ .remove_padding = 1,
},
{
.name = "RGB32 (BE)",
.depth = 32,
.mmal_component = MMAL_COMPONENT_CAMERA,
.ybbp = 4,
+ .remove_padding = 0,
},
};
&f->fmt.pix.height, MIN_HEIGHT, dev->max_height,
1, 0);
f->fmt.pix.bytesperline = f->fmt.pix.width * mfmt->ybbp;
+ if (!mfmt->remove_padding) {
+ int align_mask = ((32 * mfmt->depth) >> 3) - 1;
+ /* GPU isn't removing padding, so stride is aligned to 32 */
+ f->fmt.pix.bytesperline =
+ (f->fmt.pix.bytesperline + align_mask) & ~align_mask;
+ v4l2_dbg(1, bcm2835_v4l2_debug, &dev->v4l2_dev,
+ "Not removing padding, so bytes/line = %d, "
+ "(align_mask %d)\n",
+ f->fmt.pix.bytesperline, align_mask);
+ }
/* Image buffer has to be padded to allow for alignment, even though
- * we then remove that padding before delivering the buffer.
+ * we sometimes then remove that padding before delivering the buffer.
*/
f->fmt.pix.sizeimage = ((f->fmt.pix.height + 15) & ~15) *
(((f->fmt.pix.width + 31) & ~31) * mfmt->depth) >> 3;
struct vchiq_mmal_port *port = NULL, *camera_port = NULL;
struct vchiq_mmal_component *encode_component = NULL;
struct mmal_fmt *mfmt = get_format(f);
+ u32 remove_padding;
BUG_ON(!mfmt);
camera_port->format.encoding = MMAL_ENCODING_RGB24;
}
+ remove_padding = mfmt->remove_padding;
+ vchiq_mmal_port_parameter_set(dev->instance,
+ camera_port,
+ MMAL_PARAMETER_NO_IMAGE_PADDING,
+ &remove_padding, sizeof(remove_padding));
+
camera_port->format.encoding_variant = 0;
camera_port->es.video.width = f->fmt.pix.width;
camera_port->es.video.height = f->fmt.pix.height;
{
int ret;
struct mmal_es_format_local *format;
- u32 bool_true = 1;
u32 supported_encodings[MAX_SUPPORTED_ENCODINGS];
int param_size;
struct vchiq_mmal_component *camera;
format->es->video.frame_rate.num = 0; /* Rely on fps_range */
format->es->video.frame_rate.den = 1;
- vchiq_mmal_port_parameter_set(dev->instance,
- &camera->output[MMAL_CAMERA_PORT_VIDEO],
- MMAL_PARAMETER_NO_IMAGE_PADDING,
- &bool_true, sizeof(bool_true));
-
format = &camera->output[MMAL_CAMERA_PORT_CAPTURE].format;
format->encoding = MMAL_ENCODING_OPAQUE;
dev->capture.enc_profile = V4L2_MPEG_VIDEO_H264_PROFILE_HIGH;
dev->capture.enc_level = V4L2_MPEG_VIDEO_H264_LEVEL_4_0;
- vchiq_mmal_port_parameter_set(dev->instance,
- &camera->output[MMAL_CAMERA_PORT_CAPTURE],
- MMAL_PARAMETER_NO_IMAGE_PADDING,
- &bool_true, sizeof(bool_true));
-
/* get the preview component ready */
ret = vchiq_mmal_component_init(
dev->instance, "ril.video_render",