linux/drivers/staging/media/meson/vdec/vdec_helpers.h
<<
>>
Prefs
   1/* SPDX-License-Identifier: GPL-2.0+ */
   2/*
   3 * Copyright (C) 2018 BayLibre, SAS
   4 * Author: Maxime Jourdan <mjourdan@baylibre.com>
   5 */
   6
   7#ifndef __MESON_VDEC_HELPERS_H_
   8#define __MESON_VDEC_HELPERS_H_
   9
  10#include "vdec.h"
  11
  12/**
  13 * amvdec_set_canvases() - Map VB2 buffers to canvases
  14 *
  15 * @sess: current session
  16 * @reg_base: Registry bases of where to write the canvas indexes
  17 * @reg_num: number of contiguous registers after each reg_base (including it)
  18 */
  19int amvdec_set_canvases(struct amvdec_session *sess,
  20                        u32 reg_base[], u32 reg_num[]);
  21
  22/* Helpers to read/write to the various IPs (DOS, PARSER) */
  23u32 amvdec_read_dos(struct amvdec_core *core, u32 reg);
  24void amvdec_write_dos(struct amvdec_core *core, u32 reg, u32 val);
  25void amvdec_write_dos_bits(struct amvdec_core *core, u32 reg, u32 val);
  26void amvdec_clear_dos_bits(struct amvdec_core *core, u32 reg, u32 val);
  27u32 amvdec_read_parser(struct amvdec_core *core, u32 reg);
  28void amvdec_write_parser(struct amvdec_core *core, u32 reg, u32 val);
  29
  30/**
  31 * amvdec_dst_buf_done_idx() - Signal that a buffer is done decoding
  32 *
  33 * @sess: current session
  34 * @buf_idx: hardware buffer index
  35 * @offset: VIFIFO bitstream offset corresponding to the buffer
  36 * @field: V4L2 interlaced field
  37 */
  38void amvdec_dst_buf_done_idx(struct amvdec_session *sess, u32 buf_idx,
  39                             u32 offset, u32 field);
  40void amvdec_dst_buf_done(struct amvdec_session *sess,
  41                         struct vb2_v4l2_buffer *vbuf, u32 field);
  42void amvdec_dst_buf_done_offset(struct amvdec_session *sess,
  43                                struct vb2_v4l2_buffer *vbuf,
  44                                u32 offset, u32 field, bool allow_drop);
  45
  46/**
  47 * amvdec_add_ts_reorder() - Add a timestamp to the list in chronological order
  48 *
  49 * @sess: current session
  50 * @ts: timestamp to add
  51 * @offset: offset in the VIFIFO where the associated packet was written
  52 */
  53void amvdec_add_ts_reorder(struct amvdec_session *sess, u64 ts, u32 offset);
  54void amvdec_remove_ts(struct amvdec_session *sess, u64 ts);
  55
  56/**
  57 * amvdec_set_par_from_dar() - Set Pixel Aspect Ratio from Display Aspect Ratio
  58 *
  59 * @sess: current session
  60 * @dar_num: numerator of the DAR
  61 * @dar_den: denominator of the DAR
  62 */
  63void amvdec_set_par_from_dar(struct amvdec_session *sess,
  64                             u32 dar_num, u32 dar_den);
  65
  66/**
  67 * amvdec_src_change() - Notify new resolution/DPB size to the core
  68 *
  69 * @sess: current session
  70 * @width: picture width detected by the hardware
  71 * @height: picture height detected by the hardware
  72 * @dpb_size: Decoded Picture Buffer size (= amount of buffers for decoding)
  73 */
  74void amvdec_src_change(struct amvdec_session *sess, u32 width,
  75                       u32 height, u32 dpb_size);
  76
  77/**
  78 * amvdec_abort() - Abort the current decoding session
  79 *
  80 * @sess: current session
  81 */
  82void amvdec_abort(struct amvdec_session *sess);
  83#endif
  84