media: staging: media: Introduce NVIDIA Tegra video decoder driver

NVIDIA Tegra20/30/114/124/132 SoC's have video decoder engine that
supports standard set of video formats like H.264 / MPEG-4 / WMV / VC1.

Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
This commit is contained in:
Dmitry Osipenko 2017-12-11 19:26:08 -05:00 committed by Mauro Carvalho Chehab
parent 94e53262a2
commit cd6c56feb5
8 changed files with 1315 additions and 0 deletions

View file

@ -8680,6 +8680,15 @@ T: git git://linuxtv.org/media_tree.git
S: Maintained
F: drivers/media/dvb-frontends/stv6111*
MEDIA DRIVERS FOR NVIDIA TEGRA - VDE
M: Dmitry Osipenko <digetx@gmail.com>
L: linux-media@vger.kernel.org
L: linux-tegra@vger.kernel.org
T: git git://linuxtv.org/media_tree.git
S: Maintained
F: Documentation/devicetree/bindings/media/nvidia,tegra-vde.txt
F: drivers/staging/media/tegra-vde/
MEDIA INPUT INFRASTRUCTURE (V4L/DVB)
M: Mauro Carvalho Chehab <mchehab@s-opensource.com>
M: Mauro Carvalho Chehab <mchehab@kernel.org>

View file

@ -34,4 +34,6 @@ source "drivers/staging/media/omap4iss/Kconfig"
# Keep LIRC at the end, as it has sub-menus
source "drivers/staging/media/lirc/Kconfig"
source "drivers/staging/media/tegra-vde/Kconfig"
endif

View file

@ -6,3 +6,4 @@ obj-$(CONFIG_LIRC_STAGING) += lirc/
obj-$(CONFIG_VIDEO_DM365_VPFE) += davinci_vpfe/
obj-$(CONFIG_VIDEO_OMAP4) += omap4iss/
obj-$(CONFIG_INTEL_ATOMISP) += atomisp/
obj-$(CONFIG_TEGRA_VDE) += tegra-vde/

View file

@ -0,0 +1,7 @@
config TEGRA_VDE
tristate "NVIDIA Tegra Video Decoder Engine driver"
depends on ARCH_TEGRA || COMPILE_TEST
select SRAM
help
Say Y here to enable support for the NVIDIA Tegra video decoder
driver.

View file

@ -0,0 +1 @@
obj-$(CONFIG_TEGRA_VDE) += tegra-vde.o

View file

@ -0,0 +1,4 @@
TODO:
- Implement V4L2 API once it gains support for stateless decoders.
Contact: Dmitry Osipenko <digetx@gmail.com>

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,78 @@
/*
* Copyright (C) 2016-2017 Dmitry Osipenko <digetx@gmail.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version
* 2 of the License, or (at your option) any later version.
*/
#ifndef _UAPI_TEGRA_VDE_H_
#define _UAPI_TEGRA_VDE_H_
#include <linux/types.h>
#include <asm/ioctl.h>
#define FLAG_B_FRAME (1 << 0)
#define FLAG_REFERENCE (1 << 1)
struct tegra_vde_h264_frame {
__s32 y_fd;
__s32 cb_fd;
__s32 cr_fd;
__s32 aux_fd;
__u32 y_offset;
__u32 cb_offset;
__u32 cr_offset;
__u32 aux_offset;
__u32 frame_num;
__u32 flags;
__u32 reserved;
} __attribute__((packed));
struct tegra_vde_h264_decoder_ctx {
__s32 bitstream_data_fd;
__u32 bitstream_data_offset;
__u64 dpb_frames_ptr;
__u8 dpb_frames_nb;
__u8 dpb_ref_frames_with_earlier_poc_nb;
// SPS
__u8 baseline_profile;
__u8 level_idc;
__u8 log2_max_pic_order_cnt_lsb;
__u8 log2_max_frame_num;
__u8 pic_order_cnt_type;
__u8 direct_8x8_inference_flag;
__u8 pic_width_in_mbs;
__u8 pic_height_in_mbs;
// PPS
__u8 pic_init_qp;
__u8 deblocking_filter_control_present_flag;
__u8 constrained_intra_pred_flag;
__u8 chroma_qp_index_offset;
__u8 pic_order_present_flag;
// Slice header
__u8 num_ref_idx_l0_active_minus1;
__u8 num_ref_idx_l1_active_minus1;
__u32 reserved;
} __attribute__((packed));
#define VDE_IOCTL_BASE ('v' + 0x20)
#define VDE_IO(nr) _IO(VDE_IOCTL_BASE, nr)
#define VDE_IOR(nr, type) _IOR(VDE_IOCTL_BASE, nr, type)
#define VDE_IOW(nr, type) _IOW(VDE_IOCTL_BASE, nr, type)
#define VDE_IOWR(nr, type) _IOWR(VDE_IOCTL_BASE, nr, type)
#define TEGRA_VDE_DECODE_H264 0x00
#define TEGRA_VDE_IOCTL_DECODE_H264 \
VDE_IOW(TEGRA_VDE_DECODE_H264, struct tegra_vde_h264_decoder_ctx)
#endif // _UAPI_TEGRA_VDE_H_