linux/drivers/staging/media/meson/vdec/codec_hevc_common.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_HEVC_COMMON_H_
   8#define __MESON_VDEC_HEVC_COMMON_H_
   9
  10#include "vdec.h"
  11
  12#define PARSER_CMD_SKIP_CFG_0 0x0000090b
  13#define PARSER_CMD_SKIP_CFG_1 0x1b14140f
  14#define PARSER_CMD_SKIP_CFG_2 0x001b1910
  15
  16#define VDEC_HEVC_PARSER_CMD_LEN 37
  17extern const u16 vdec_hevc_parser_cmd[VDEC_HEVC_PARSER_CMD_LEN];
  18
  19#define MAX_REF_PIC_NUM 24
  20
  21struct codec_hevc_common {
  22        void      *fbc_buffer_vaddr[MAX_REF_PIC_NUM];
  23        dma_addr_t fbc_buffer_paddr[MAX_REF_PIC_NUM];
  24
  25        void      *mmu_header_vaddr[MAX_REF_PIC_NUM];
  26        dma_addr_t mmu_header_paddr[MAX_REF_PIC_NUM];
  27
  28        void      *mmu_map_vaddr;
  29        dma_addr_t mmu_map_paddr;
  30};
  31
  32/* Returns 1 if we must use framebuffer compression */
  33static inline int codec_hevc_use_fbc(u32 pixfmt, int is_10bit)
  34{
  35        /* TOFIX: Handle Amlogic Compressed buffer for 8bit also */
  36        return is_10bit;
  37}
  38
  39/* Returns 1 if we are decoding 10-bit but outputting 8-bit NV12 */
  40static inline int codec_hevc_use_downsample(u32 pixfmt, int is_10bit)
  41{
  42        return is_10bit;
  43}
  44
  45/* Returns 1 if we are decoding using the IOMMU */
  46static inline int codec_hevc_use_mmu(u32 revision, u32 pixfmt, int is_10bit)
  47{
  48        return revision >= VDEC_REVISION_G12A &&
  49               codec_hevc_use_fbc(pixfmt, is_10bit);
  50}
  51
  52/* Configure decode head read mode */
  53void codec_hevc_setup_decode_head(struct amvdec_session *sess, int is_10bit);
  54
  55void codec_hevc_free_fbc_buffers(struct amvdec_session *sess,
  56                                 struct codec_hevc_common *comm);
  57
  58void codec_hevc_free_mmu_headers(struct amvdec_session *sess,
  59                                 struct codec_hevc_common *comm);
  60
  61int codec_hevc_setup_buffers(struct amvdec_session *sess,
  62                             struct codec_hevc_common *comm,
  63                             int is_10bit);
  64
  65void codec_hevc_fill_mmu_map(struct amvdec_session *sess,
  66                             struct codec_hevc_common *comm,
  67                             struct vb2_buffer *vb);
  68
  69#endif
  70