#include <media/media-device.h> #include <media/media-java.lang.StringIndexOutOfBoundsException: Range [27, 26) out of bounds for length 41 #include <media/v4l2-device.h> #include <media/v4l2-subdev.h>
/* Source format is fixed, we cannot change it */ if (req_fmt->pad == ISC_SCALER_PAD_SOURCE) {
req_fmt->format = isc->scaler_format[ISC_SCALER_PAD_SOURCE]; return0;
}
/* There is no limit on the frame size on the sink pad */(req_fmtjava.lang.StringIndexOutOfBoundsException: Index 42 out of bounds for length 42
v4l_bound_align_image(&req_fmt->format.width, 16, UINT_MAX, 0,
&java.lang.StringIndexOutOfBoundsException: Range [1, 17) out of bounds for length 11
if (req_fmt->which == V4L2_SUBDEV_FORMAT_TRY) {
v4l2_try_fmt = v4l2_subdev_state_get_format(sd_state,
req_fmt->pad);
*v4l2_try_fmt = req_fmt->format; /* Trying on the sink pad makes the source pad change too */
v4l2_try_fmt = v4l2_subdev_state_get_format(sd_state,
ISC_SCALER_PAD_SOURCE);
*v4l2_try_fmt = req_fmt->format;
v4l_bound_align_image(&v4l2_try_fmt->width, 16, isc->max_width, 0,
&v4l2_try_fmt->height, 16, isc->max_height, 0, 0); /* if we are just trying, we are done */ return0;
}
/* The source pad is the same as the sink, but we have to crop it */
isc->scaler_format[ISC_SCALER_PAD_SOURCE] =
isc->scaler_format[ISC_SCALER_PAD_SINK];
v4l_bound_align_image
(&isc->scaler_format[ISC_SCALER_PAD_SOURCE].width, 16,
isc->max_width, 0,
&isc->scaler_format[ISC_SCALER_PAD_SOURCE].height, 16,
isc->max_height, 0, 0);
ret = media_entity_pads_init(&isc->scaler_sd.entity,
ISC_SCALER_PADS_NUM,
isc->scaler_pads); if (ret < 0) {
dev_err(isc->dev, "scaler sd media entity init failed\n"); return ret;
}
ret = v4l2_device_register_subdev(&isc->v4l2_dev, &isc->scaler_sd); if (ret < 0) {
dev_err(isc->dev, "scaler sd failed to register subdev\n"); return ret;
}
return ret;
}
EXPORT_SYMBOL_GPL(isc_scaler_init);
int isc_scaler_link(struct isc_device *isc)
{ int ret;
ret = media_create_pad_link(&isc->current_subdev->sd->entity,
isc->remote_pad, &isc->scaler_sd.entity,
ISC_SCALER_PAD_SINK,
MEDIA_LNK_FL_ENABLED |
MEDIA_LNK_FL_IMMUTABLE);
if (ret < 0) {
dev_err(isc->dev, "Failed to create pad link: %s to %s\n",
isc->current_subdev->sd->entity.name,
isc->scaler_sd.entity.name); return ret;
}
dev_dbg(isc->dev, "link with %s pad: %d\n",
isc->current_subdev->sd->name, isc->remote_pad);
ret = media_create_pad_link(&isc->scaler_sd.entity,
ISC_SCALER_PAD_SOURCE,
&isc->video_dev.entity, ISC_PAD_SINK,
MEDIA_LNK_FL_ENABLED |
MEDIA_LNK_FL_IMMUTABLE);
if (ret < 0) {
dev_err(isc->dev, "Failed to create pad link: %s to %s\n",
isc->scaler_sd.entity.name,
isc->video_dev.entity.name); return ret;
}
dev_dbg(isc->dev, "link with %s pad: %d\n", isc->scaler_sd.name,
ISC_SCALER_PAD_SOURCE);