#include <linux/iopoll.h>
#include <linux/pm_runtime.h>
#include <linux/reset.h>
#include <linux/slab.h>
#include <media/v4l2-h264.h>
#include "trace.h"
#include "vde.h"
#define FLAG_B_FRAME …
#define FLAG_REFERENCE …
struct tegra_vde_h264_decoder_ctx { … };
struct h264_reflists { … };
static int tegra_vde_wait_mbe(struct tegra_vde *vde)
{ … }
static int tegra_vde_setup_mbe_frame_idx(struct tegra_vde *vde,
unsigned int refs_nb,
bool setup_refs)
{ … }
static void tegra_vde_mbe_set_0xa_reg(struct tegra_vde *vde, int reg, u32 val)
{ … }
static int tegra_vde_wait_bsev(struct tegra_vde *vde, bool wait_dma)
{ … }
static int tegra_vde_push_to_bsev_icmdqueue(struct tegra_vde *vde,
u32 value, bool wait_dma)
{ … }
static void tegra_vde_setup_frameid(struct tegra_vde *vde,
struct tegra_video_frame *frame,
unsigned int frameid,
u32 mbs_width, u32 mbs_height)
{ … }
static void tegra_setup_frameidx(struct tegra_vde *vde,
struct tegra_video_frame *frames,
unsigned int frames_nb,
u32 mbs_width, u32 mbs_height)
{ … }
static void tegra_vde_setup_iram_entry(struct tegra_vde *vde,
unsigned int table,
unsigned int row,
u32 value1, u32 value2)
{ … }
static void tegra_vde_setup_iram_tables(struct tegra_vde *vde,
struct tegra_video_frame *dpb_frames,
unsigned int ref_frames_nb,
unsigned int with_earlier_poc_nb)
{ … }
static int tegra_vde_setup_hw_context(struct tegra_vde *vde,
struct tegra_vde_h264_decoder_ctx *ctx,
struct tegra_video_frame *dpb_frames,
dma_addr_t bitstream_data_addr,
size_t bitstream_data_size,
unsigned int macroblocks_nb)
{ … }
static void tegra_vde_decode_frame(struct tegra_vde *vde,
unsigned int macroblocks_nb)
{ … }
static int tegra_vde_validate_h264_ctx(struct device *dev,
struct tegra_vde_h264_decoder_ctx *ctx)
{ … }
static int tegra_vde_decode_begin(struct tegra_vde *vde,
struct tegra_vde_h264_decoder_ctx *ctx,
struct tegra_video_frame *dpb_frames,
dma_addr_t bitstream_data_addr,
size_t bitstream_data_size)
{ … }
static void tegra_vde_decode_abort(struct tegra_vde *vde)
{ … }
static int tegra_vde_decode_end(struct tegra_vde *vde)
{ … }
static struct vb2_buffer *get_ref_buf(struct tegra_ctx *ctx,
struct vb2_v4l2_buffer *dst,
unsigned int dpb_idx)
{ … }
static int tegra_vde_validate_vb_size(struct tegra_ctx *ctx,
struct vb2_buffer *vb,
unsigned int plane_id,
size_t min_size)
{ … }
static int tegra_vde_h264_setup_frame(struct tegra_ctx *ctx,
struct tegra_vde_h264_decoder_ctx *h264,
struct v4l2_h264_reflist_builder *b,
struct vb2_buffer *vb,
unsigned int ref_id,
unsigned int id)
{ … }
static int tegra_vde_h264_setup_frames(struct tegra_ctx *ctx,
struct tegra_vde_h264_decoder_ctx *h264)
{ … }
static unsigned int to_tegra_vde_h264_level_idc(unsigned int level_idc)
{ … }
static int tegra_vde_h264_setup_context(struct tegra_ctx *ctx,
struct tegra_vde_h264_decoder_ctx *h264)
{ … }
int tegra_vde_h264_decode_run(struct tegra_ctx *ctx)
{ … }
int tegra_vde_h264_decode_wait(struct tegra_ctx *ctx)
{ … }