/* * The BRx can't perform format conversion, all sink and source formats must be * identical. We pick the format on the first sink pad (pad 0) and propagate it * to all other pads.
*/
switch (pad) { case BRX_PAD_SINK(0): /* Default to YUV if the requested format is not supported. */ if (fmt->code != MEDIA_BUS_FMT_ARGB8888_1X32 &&
fmt->code != MEDIA_BUS_FMT_AYUV8_1X32)
fmt->code = MEDIA_BUS_FMT_AYUV8_1X32;
vsp1_entity_adjust_color_space(fmt); break;
default: /* The BRx can't perform format conversion. */
format = v4l2_subdev_state_get_format(sd_state,
BRX_PAD_SINK(0));
fmt->code = format->code;
if (sel->pad == brx->entity.source_pad) return -EINVAL;
if (sel->target != V4L2_SEL_TGT_COMPOSE) return -EINVAL;
mutex_lock(&brx->entity.lock);
state = vsp1_entity_get_state(&brx->entity, sd_state, sel->which); if (!state) {
ret = -EINVAL; goto done;
}
/* * The compose rectangle top left corner must be inside the output * frame.
*/
format = v4l2_subdev_state_get_format(state, brx->entity.source_pad);
sel->r.left = clamp_t(unsignedint, sel->r.left, 0, format->width - 1);
sel->r.top = clamp_t(unsignedint, sel->r.top, 0, format->height - 1);
/* * Scaling isn't supported, the compose rectangle size must be identical * to the sink format size.
*/
format = v4l2_subdev_state_get_format(state, sel->pad);
sel->r.width = format->width;
sel->r.height = format->height;
format = v4l2_subdev_state_get_format(state, brx->entity.source_pad);
/* * The hardware is extremely flexible but we have no userspace API to * expose all the parameters, nor is it clear whether we would have use * cases for all the supported modes. Let's just hardcode the parameters * to sane default values for now.
*/
/* * Disable dithering and enable color data normalization unless the * format at the pipeline output is premultiplied.
*/
flags = pipe->output ? pipe->output->format.flags : 0;
vsp1_brx_write(brx, dlb, VI6_BRU_INCTRL,
flags & V4L2_PIX_FMT_FLAG_PREMUL_ALPHA ?
0 : VI6_BRU_INCTRL_NRM);
/* * Set the background position to cover the whole output image and * configure its color.
*/
vsp1_brx_write(brx, dlb, VI6_BRU_VIRRPF_SIZE,
(format->width << VI6_BRU_VIRRPF_SIZE_HSIZE_SHIFT) |
(format->height << VI6_BRU_VIRRPF_SIZE_VSIZE_SHIFT));
vsp1_brx_write(brx, dlb, VI6_BRU_VIRRPF_LOC, 0);
/* * Route BRU input 1 as SRC input to the ROP unit and configure the ROP * unit with a NOP operation to make BRU input 1 available as the * Blend/ROP unit B SRC input. Only needed for BRU, the BRS has no ROP * unit.
*/ if (entity->type == VSP1_ENTITY_BRU)
vsp1_brx_write(brx, dlb, VI6_BRU_ROP,
VI6_BRU_ROP_DSTSEL_BRUIN(1) |
VI6_BRU_ROP_CROP(VI6_ROP_NOP) |
VI6_BRU_ROP_AROP(VI6_ROP_NOP));
for (i = 0; i < brx->entity.source_pad; ++i) { bool premultiplied = false;
u32 ctrl = 0;
/* * Configure all Blend/ROP units corresponding to an enabled BRx * input for alpha blending. Blend/ROP units corresponding to * disabled BRx inputs are used in ROP NOP mode to ignore the * SRC input.
*/ if (brx->inputs[i].rpf) {
ctrl |= VI6_BRU_CTRL_RBC;
/* * Select the virtual RPF as the Blend/ROP unit A DST input to * serve as a background color.
*/ if (i == 0)
ctrl |= VI6_BRU_CTRL_DSTSEL_VRPF;
/* * Route inputs 0 to 3 as SRC inputs to Blend/ROP units A to D * in that order. In the BRU the Blend/ROP unit B SRC is * hardwired to the ROP unit output, the corresponding register * bits must be set to 0. The BRS has no ROP unit and doesn't * need any special processing.
*/ if (!(entity->type == VSP1_ENTITY_BRU && i == 1))
ctrl |= VI6_BRU_CTRL_SRCSEL_BRUIN(i);
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.