linux/drivers/staging/media/atomisp/pci/isp/kernels/iterator/iterator_1.0/ia_css_iterator.host.c
<<
>>
Prefs
   1// SPDX-License-Identifier: GPL-2.0
   2/*
   3 * Support for Intel Camera Imaging ISP subsystem.
   4 * Copyright (c) 2015, Intel Corporation.
   5 *
   6 * This program is free software; you can redistribute it and/or modify it
   7 * under the terms and conditions of the GNU General Public License,
   8 * version 2, as published by the Free Software Foundation.
   9 *
  10 * This program is distributed in the hope it will be useful, but WITHOUT
  11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  12 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
  13 * more details.
  14 */
  15
  16#include "ia_css_iterator.host.h"
  17#include "ia_css_frame_public.h"
  18#include "ia_css_binary.h"
  19#include "ia_css_err.h"
  20#define IA_CSS_INCLUDE_CONFIGURATIONS
  21#include "ia_css_isp_configs.h"
  22
  23static const struct ia_css_iterator_configuration default_config = {
  24        .input_info = (struct ia_css_frame_info *)NULL,
  25};
  26
  27void
  28ia_css_iterator_config(
  29    struct sh_css_isp_iterator_isp_config *to,
  30    const struct ia_css_iterator_configuration *from,
  31    unsigned int size)
  32{
  33        (void)size;
  34        ia_css_frame_info_to_frame_sp_info(&to->input_info,    from->input_info);
  35        ia_css_frame_info_to_frame_sp_info(&to->internal_info, from->internal_info);
  36        ia_css_frame_info_to_frame_sp_info(&to->output_info,   from->output_info);
  37        ia_css_frame_info_to_frame_sp_info(&to->vf_info,       from->vf_info);
  38        ia_css_resolution_to_sp_resolution(&to->dvs_envelope,  from->dvs_envelope);
  39}
  40
  41int
  42ia_css_iterator_configure(
  43    const struct ia_css_binary *binary,
  44    const struct ia_css_frame_info *in_info) {
  45        struct ia_css_frame_info my_info = IA_CSS_BINARY_DEFAULT_FRAME_INFO;
  46        struct ia_css_iterator_configuration config = default_config;
  47
  48        config.input_info    = &binary->in_frame_info;
  49        config.internal_info = &binary->internal_frame_info;
  50        config.output_info   = &binary->out_frame_info[0];
  51        config.vf_info       = &binary->vf_frame_info;
  52        config.dvs_envelope  = &binary->dvs_envelope;
  53
  54        /* Use in_info iso binary->in_frame_info.
  55         * They can differ in padded width in case of scaling, e.g. for capture_pp.
  56         * Find out why.
  57        */
  58        if (in_info)
  59                config.input_info = in_info;
  60        if (binary->out_frame_info[0].res.width == 0)
  61                config.output_info = &binary->out_frame_info[1];
  62        my_info = *config.output_info;
  63        config.output_info = &my_info;
  64        /* we do this only for preview pipe because in fill_binary_info function
  65         * we assign vf_out res to out res, but for ISP internal processing, we need
  66         * the original out res. for video pipe, it has two output pins --- out and
  67         * vf_out, so it can keep these two resolutions already. */
  68        if (binary->info->sp.pipeline.mode == IA_CSS_BINARY_MODE_PREVIEW &&
  69            binary->vf_downscale_log2 > 0)
  70        {
  71                /* TODO: Remove this after preview output decimation is fixed
  72                 * by configuring out&vf info files properly */
  73                my_info.padded_width <<= binary->vf_downscale_log2;
  74                my_info.res.width    <<= binary->vf_downscale_log2;
  75                my_info.res.height   <<= binary->vf_downscale_log2;
  76        }
  77
  78        ia_css_configure_iterator(binary, &config);
  79
  80        return 0;
  81}
  82