val = mxc_isi_read(pipe, CHNL_IMG_CTRL);
val &= ~(CHNL_IMG_CTRL_DEC_X_MASK | CHNL_IMG_CTRL_DEC_Y_MASK |
CHNL_IMG_CTRL_YCBCR_MODE);
val |= CHNL_IMG_CTRL_DEC_X(ilog2(decx))
| CHNL_IMG_CTRL_DEC_Y(ilog2(decy));
/* * Contrary to what the documentation states, YCBCR_MODE does not * control conversion between YCbCr and RGB, but whether the scaler * operates in YUV mode or in RGB mode. It must be set when the scaler * input is YUV.
*/ if (encoding == MXC_ISI_ENC_YUV)
val |= CHNL_IMG_CTRL_YCBCR_MODE;
val = mxc_isi_read(pipe, CHNL_CTRL);
val &= ~(CHNL_CTRL_CHNL_BYPASS | CHNL_CTRL_CHAIN_BUF_MASK |
CHNL_CTRL_BLANK_PXL_MASK | CHNL_CTRL_SRC_TYPE_MASK |
CHNL_CTRL_MIPI_VC_ID_MASK | CHNL_CTRL_SRC_INPUT_MASK);
/* * If no scaling or color space conversion is needed, bypass the * channel.
*/ if (bypass)
val |= CHNL_CTRL_CHNL_BYPASS;
/* Chain line buffers if needed. */ if (pipe->chained)
val |= CHNL_CTRL_CHAIN_BUF(CHNL_CTRL_CHAIN_BUF_2_CHAIN);
val |= CHNL_CTRL_BLANK_PXL(0xff);
/* Input source (including VC configuration for CSI-2) */ if (input == MXC_ISI_INPUT_MEM) { /* * The memory input is connected to the last port of the * crossbar switch, after all pixel link inputs. The SRC_INPUT * field controls the input selection and must be set * accordingly, despite being documented as ignored when using * the memory input in the i.MX8MP reference manual, and * reserved in the i.MX8MN reference manual.
*/
val |= CHNL_CTRL_SRC_TYPE(CHNL_CTRL_SRC_TYPE_MEMORY);
val |= CHNL_CTRL_SRC_INPUT(pipe->isi->pdata->num_ports);
} else {
val |= CHNL_CTRL_SRC_TYPE(CHNL_CTRL_SRC_TYPE_DEVICE);
val |= CHNL_CTRL_SRC_INPUT(input);
val |= CHNL_CTRL_MIPI_VC_ID(0); /* FIXME: For CSI-2 only */
}
/* set outbuf format */
dev_dbg(pipe->isi->dev, "output format %p4cc", &format->pixelformat);
val = mxc_isi_read(pipe, CHNL_IMG_CTRL);
val &= ~CHNL_IMG_CTRL_FORMAT_MASK;
val |= CHNL_IMG_CTRL_FORMAT(info->isi_out_format);
mxc_isi_write(pipe, CHNL_IMG_CTRL, val);
/* line pitch */
mxc_isi_write(pipe, CHNL_OUT_BUF_PITCH,
format->plane_fmt[0].bytesperline);
}
val = mxc_isi_read(pipe, CHNL_CTRL);
val &= ~CHNL_CTRL_CHNL_EN;
mxc_isi_write(pipe, CHNL_CTRL, val);
mutex_unlock(&pipe->lock);
}
/* ----------------------------------------------------------------------------- * Resource management & chaining
*/ int mxc_isi_channel_acquire(struct mxc_isi_pipe *pipe,
mxc_isi_pipe_irq_t irq_handler, bool bypass)
{
u8 resources; int ret = 0;
mutex_lock(&pipe->lock);
if (pipe->irq_handler) {
ret = -EBUSY; goto unlock;
}
/* * Make sure the resources we need are available. The output buffer is * always needed to operate the channel, the line buffer is needed only * when the channel isn't in bypass mode.
*/
resources = MXC_ISI_CHANNEL_RES_OUTPUT_BUF
| (!bypass ? MXC_ISI_CHANNEL_RES_LINE_BUF : 0); if ((pipe->available_res & resources) != resources) {
ret = -EBUSY; goto unlock;
}
/* * We currently support line buffer chaining only, for handling images with a * width larger than 2048 pixels. * * TODO: Support secondary line buffer for downscaling YUV420 images.
*/ int mxc_isi_channel_chain(struct mxc_isi_pipe *pipe, bool bypass)
{ /* Channel chaining requires both line and output buffer. */ const u8 resources = MXC_ISI_CHANNEL_RES_OUTPUT_BUF
| MXC_ISI_CHANNEL_RES_LINE_BUF; struct mxc_isi_pipe *chained_pipe = pipe + 1; int ret = 0;
/* * If buffer chaining is required, make sure this channel is not the * last one, otherwise there's no 'next' channel to chain with. This * should be prevented by checks in the set format handlers, but let's * be defensive.
*/ if (WARN_ON(pipe->id == pipe->isi->pdata->num_channels - 1)) return -EINVAL;
mutex_lock(&chained_pipe->lock);
/* Safety checks. */ if (WARN_ON(pipe->chained || chained_pipe->chained_res)) {
ret = -EINVAL; goto unlock;
}
if ((chained_pipe->available_res & resources) != resources) {
ret = -EBUSY; goto unlock;
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.