linux/drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/binary/interface/ia_css_binary.h
<<
>>
Prefs
   1#ifndef ISP2401
   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#else
  16/**
  17Support for Intel Camera Imaging ISP subsystem.
  18Copyright (c) 2010 - 2015, Intel Corporation.
  19
  20This program is free software; you can redistribute it and/or modify it
  21under the terms and conditions of the GNU General Public License,
  22version 2, as published by the Free Software Foundation.
  23
  24This program is distributed in the hope it will be useful, but WITHOUT
  25ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  26FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
  27more details.
  28*/
  29#endif
  30
  31#ifndef _IA_CSS_BINARY_H_
  32#define _IA_CSS_BINARY_H_
  33
  34#include <type_support.h>
  35#include "ia_css_types.h"
  36#include "ia_css_err.h"
  37#include "ia_css_stream_format.h"
  38#include "ia_css_stream_public.h"
  39#include "ia_css_frame_public.h"
  40#include "sh_css_metrics.h"
  41#include "isp/kernels/fixedbds/fixedbds_1.0/ia_css_fixedbds_types.h"
  42
  43/* The binary mode is used in pre-processor expressions so we cannot
  44 * use an enum here. */
  45#define IA_CSS_BINARY_MODE_COPY       0
  46#define IA_CSS_BINARY_MODE_PREVIEW    1
  47#define IA_CSS_BINARY_MODE_PRIMARY    2
  48#define IA_CSS_BINARY_MODE_VIDEO      3
  49#define IA_CSS_BINARY_MODE_PRE_ISP    4
  50#define IA_CSS_BINARY_MODE_GDC        5
  51#define IA_CSS_BINARY_MODE_POST_ISP   6
  52#define IA_CSS_BINARY_MODE_ANR        7
  53#define IA_CSS_BINARY_MODE_CAPTURE_PP 8
  54#define IA_CSS_BINARY_MODE_VF_PP      9
  55#define IA_CSS_BINARY_MODE_PRE_DE     10
  56#define IA_CSS_BINARY_MODE_PRIMARY_HQ_STAGE0    11
  57#define IA_CSS_BINARY_MODE_PRIMARY_HQ_STAGE1    12
  58#define IA_CSS_BINARY_MODE_PRIMARY_HQ_STAGE2    13
  59#define IA_CSS_BINARY_MODE_PRIMARY_HQ_STAGE3    14
  60#define IA_CSS_BINARY_MODE_PRIMARY_HQ_STAGE4    15
  61#define IA_CSS_BINARY_MODE_PRIMARY_HQ_STAGE5    16
  62#define IA_CSS_BINARY_NUM_MODES       17
  63
  64#define MAX_NUM_PRIMARY_STAGES 6
  65#define NUM_PRIMARY_HQ_STAGES  6  /* number of primary stages for ISP2.6.1 high quality pipe */
  66#define NUM_PRIMARY_STAGES     1  /* number of primary satges for ISP1/ISP2.2 pipe */
  67
  68/* Indicate where binaries can read input from */
  69#define IA_CSS_BINARY_INPUT_SENSOR   0
  70#define IA_CSS_BINARY_INPUT_MEMORY   1
  71#define IA_CSS_BINARY_INPUT_VARIABLE 2
  72
  73/* Should be included without the path.
  74   However, that requires adding the path to numerous makefiles
  75   that have nothing to do with isp parameters.
  76 */
  77#include "runtime/isp_param/interface/ia_css_isp_param_types.h"
  78
  79/* now these ports only include output ports but not vf output ports */
  80enum {
  81        IA_CSS_BINARY_OUTPUT_PORT_0 = 0,
  82        IA_CSS_BINARY_OUTPUT_PORT_1 = 1,
  83        IA_CSS_BINARY_MAX_OUTPUT_PORTS = 2
  84};
  85
  86struct ia_css_cas_binary_descr {
  87        unsigned int num_stage;
  88        unsigned int num_output_stage;
  89        struct ia_css_frame_info *in_info;
  90        struct ia_css_frame_info *internal_out_info;
  91        struct ia_css_frame_info *out_info;
  92        struct ia_css_frame_info *vf_info;
  93        bool *is_output_stage;
  94};
  95
  96struct ia_css_binary_descr {
  97        int mode;
  98        bool online;
  99        bool continuous;
 100        bool striped;
 101        bool two_ppc;
 102        bool enable_yuv_ds;
 103        bool enable_high_speed;
 104        bool enable_dvs_6axis;
 105        bool enable_reduced_pipe;
 106        bool enable_dz;
 107        bool enable_xnr;
 108        bool enable_fractional_ds;
 109        bool enable_dpc;
 110#ifdef ISP2401
 111        bool enable_luma_only;
 112        bool enable_tnr;
 113#endif
 114        bool enable_capture_pp_bli;
 115        struct ia_css_resolution dvs_env;
 116        enum atomisp_input_format stream_format;
 117        struct ia_css_frame_info *in_info;              /* the info of the input-frame with the
 118                                                           ISP required resolution. */
 119        struct ia_css_frame_info *bds_out_info;
 120        struct ia_css_frame_info *out_info[IA_CSS_BINARY_MAX_OUTPUT_PORTS];
 121        struct ia_css_frame_info *vf_info;
 122        unsigned int isp_pipe_version;
 123        unsigned int required_bds_factor;
 124        int stream_config_left_padding;
 125};
 126
 127struct ia_css_binary {
 128        const struct ia_css_binary_xinfo *info;
 129        enum atomisp_input_format input_format;
 130        struct ia_css_frame_info in_frame_info;
 131        struct ia_css_frame_info internal_frame_info;
 132        struct ia_css_frame_info out_frame_info[IA_CSS_BINARY_MAX_OUTPUT_PORTS];
 133        struct ia_css_resolution effective_in_frame_res;
 134        struct ia_css_frame_info vf_frame_info;
 135        int                      input_buf_vectors;
 136        int                      deci_factor_log2;
 137        int                      vf_downscale_log2;
 138        int                      s3atbl_width;
 139        int                      s3atbl_height;
 140        int                      s3atbl_isp_width;
 141        int                      s3atbl_isp_height;
 142        unsigned int             morph_tbl_width;
 143        unsigned int             morph_tbl_aligned_width;
 144        unsigned int             morph_tbl_height;
 145        int                      sctbl_width_per_color;
 146        int                      sctbl_aligned_width_per_color;
 147        int                      sctbl_height;
 148#ifdef ISP2401
 149        int                      sctbl_legacy_width_per_color;
 150        int                      sctbl_legacy_height;
 151#endif
 152        struct ia_css_sdis_info  dis;
 153        struct ia_css_resolution dvs_envelope;
 154        bool                     online;
 155        unsigned int             uds_xc;
 156        unsigned int             uds_yc;
 157        unsigned int             left_padding;
 158        struct sh_css_binary_metrics metrics;
 159        struct ia_css_isp_param_host_segments mem_params;
 160        struct ia_css_isp_param_css_segments  css_params;
 161};
 162
 163#define IA_CSS_BINARY_DEFAULT_SETTINGS \
 164(struct ia_css_binary) { \
 165        .input_format           = ATOMISP_INPUT_FORMAT_YUV420_8_LEGACY, \
 166        .in_frame_info          = IA_CSS_BINARY_DEFAULT_FRAME_INFO, \
 167        .internal_frame_info    = IA_CSS_BINARY_DEFAULT_FRAME_INFO, \
 168        .out_frame_info         = {IA_CSS_BINARY_DEFAULT_FRAME_INFO}, \
 169        .vf_frame_info          = IA_CSS_BINARY_DEFAULT_FRAME_INFO, \
 170}
 171
 172enum ia_css_err
 173ia_css_binary_init_infos(void);
 174
 175enum ia_css_err
 176ia_css_binary_uninit(void);
 177
 178enum ia_css_err
 179ia_css_binary_fill_info(const struct ia_css_binary_xinfo *xinfo,
 180                 bool online,
 181                 bool two_ppc,
 182                 enum atomisp_input_format stream_format,
 183                 const struct ia_css_frame_info *in_info,
 184                 const struct ia_css_frame_info *bds_out_info,
 185                 const struct ia_css_frame_info *out_info[],
 186                 const struct ia_css_frame_info *vf_info,
 187                 struct ia_css_binary *binary,
 188                 struct ia_css_resolution *dvs_env,
 189                 int stream_config_left_padding,
 190                 bool accelerator);
 191
 192enum ia_css_err
 193ia_css_binary_find(struct ia_css_binary_descr *descr,
 194                   struct ia_css_binary *binary);
 195
 196/* @brief Get the shading information of the specified shading correction type.
 197 *
 198 * @param[in] binary: The isp binary which has the shading correction.
 199 * @param[in] type: The shading correction type.
 200 * @param[in] required_bds_factor: The bayer downscaling factor required in the pipe.
 201 * @param[in] stream_config: The stream configuration.
 202#ifndef ISP2401
 203 * @param[out] info: The shading information.
 204#else
 205 * @param[out] shading_info: The shading information.
 206 *              The shading information necessary as API is stored in the shading_info.
 207#endif
 208 *              The driver needs to get this information to generate
 209#ifndef ISP2401
 210 *              the shading table directly required in the isp.
 211#else
 212 *              the shading table directly required from ISP.
 213 * @param[out] pipe_config: The pipe configuration.
 214 *              The shading information related to ISP (but, not necessary as API) is stored in the pipe_config.
 215#endif
 216 * @return      IA_CSS_SUCCESS or error code upon error.
 217 *
 218 */
 219enum ia_css_err
 220ia_css_binary_get_shading_info(const struct ia_css_binary *binary,
 221                        enum ia_css_shading_correction_type type,
 222                        unsigned int required_bds_factor,
 223                        const struct ia_css_stream_config *stream_config,
 224#ifndef ISP2401
 225                        struct ia_css_shading_info *info);
 226#else
 227                        struct ia_css_shading_info *shading_info,
 228                        struct ia_css_pipe_config *pipe_config);
 229#endif
 230
 231enum ia_css_err
 232ia_css_binary_3a_grid_info(const struct ia_css_binary *binary,
 233                           struct ia_css_grid_info *info,
 234                           struct ia_css_pipe *pipe);
 235
 236void
 237ia_css_binary_dvs_grid_info(const struct ia_css_binary *binary,
 238                            struct ia_css_grid_info *info,
 239                            struct ia_css_pipe *pipe);
 240
 241void
 242ia_css_binary_dvs_stat_grid_info(
 243        const struct ia_css_binary *binary,
 244        struct ia_css_grid_info *info,
 245        struct ia_css_pipe *pipe);
 246
 247unsigned
 248ia_css_binary_max_vf_width(void);
 249
 250void
 251ia_css_binary_destroy_isp_parameters(struct ia_css_binary *binary);
 252
 253void
 254ia_css_binary_get_isp_binaries(struct ia_css_binary_xinfo **binaries,
 255        uint32_t *num_isp_binaries);
 256
 257#endif /* _IA_CSS_BINARY_H_ */
 258