Merge tag 'v4.8' into patchwork
Linux 4.8 * tag 'v4.8': (1761 commits) Linux 4.8 ARM: 8618/1: decompressor: reset ttbcr fields to use TTBR0 on ARMv7 MIPS: CM: Fix mips_cm_max_vp_width for non-MT kernels on MT systems include/linux/property.h: fix typo/compile error ocfs2: fix deadlock on mmapped page in ocfs2_write_begin_nolock() mm: workingset: fix crash in shadow node shrinker caused by replace_page_cache_page() MAINTAINERS: Switch to kernel.org email address for Javi Merino x86/entry/64: Fix context tracking state warning when load_gs_index fails x86/boot: Initialize FPU and X86_FEATURE_ALWAYS even if we don't have CPUID x86/vdso: Fix building on big endian host x86/boot: Fix another __read_cr4() case on 486 sctp: fix the issue sctp_diag uses lock_sock in rcu_read_lock sctp: change to check peer prsctp_capable when using prsctp polices sctp: remove prsctp_param from sctp_chunk sctp: move sent_count to the memory hole in sctp_chunk tg3: Avoid NULL pointer dereference in tg3_io_error_detected() x86/init: Fix cr4_init_shadow() on CR4-less machines MIPS: Fix detection of unsupported highmem with cache aliases MIPS: Malta: Fix IOCU disable switch read for MIPS64 MIPS: Fix BUILD_ROLLBACK_PROLOGUE for microMIPS ...
Этот коммит содержится в:
@@ -178,7 +178,7 @@ config VIDEO_MEDIATEK_VPU
|
||||
config VIDEO_MEDIATEK_VCODEC
|
||||
tristate "Mediatek Video Codec driver"
|
||||
depends on MTK_IOMMU || COMPILE_TEST
|
||||
depends on VIDEO_DEV && VIDEO_V4L2
|
||||
depends on VIDEO_DEV && VIDEO_V4L2 && HAS_DMA
|
||||
depends on ARCH_MEDIATEK || COMPILE_TEST
|
||||
select VIDEOBUF2_DMA_CONTIG
|
||||
select V4L2_MEM2MEM_DEV
|
||||
|
@@ -23,7 +23,6 @@
|
||||
#include <media/v4l2-ioctl.h>
|
||||
#include <media/videobuf2-core.h>
|
||||
|
||||
#include "mtk_vcodec_util.h"
|
||||
|
||||
#define MTK_VCODEC_DRV_NAME "mtk_vcodec_drv"
|
||||
#define MTK_VCODEC_ENC_NAME "mtk-vcodec-enc"
|
||||
|
@@ -490,7 +490,6 @@ static int vidioc_venc_s_fmt_out(struct file *file, void *priv,
|
||||
struct mtk_q_data *q_data;
|
||||
int ret, i;
|
||||
struct mtk_video_fmt *fmt;
|
||||
unsigned int pitch_w_div16;
|
||||
struct v4l2_pix_format_mplane *pix_fmt_mp = &f->fmt.pix_mp;
|
||||
|
||||
vq = v4l2_m2m_get_vq(ctx->m2m_ctx, f->type);
|
||||
@@ -533,15 +532,6 @@ static int vidioc_venc_s_fmt_out(struct file *file, void *priv,
|
||||
q_data->coded_width = f->fmt.pix_mp.width;
|
||||
q_data->coded_height = f->fmt.pix_mp.height;
|
||||
|
||||
pitch_w_div16 = DIV_ROUND_UP(q_data->visible_width, 16);
|
||||
if (pitch_w_div16 % 8 != 0) {
|
||||
/* Adjust returned width/height, so application could correctly
|
||||
* allocate hw required memory
|
||||
*/
|
||||
q_data->visible_height += 32;
|
||||
vidioc_try_fmt(f, q_data->fmt);
|
||||
}
|
||||
|
||||
q_data->field = f->fmt.pix_mp.field;
|
||||
ctx->colorspace = f->fmt.pix_mp.colorspace;
|
||||
ctx->ycbcr_enc = f->fmt.pix_mp.ycbcr_enc;
|
||||
@@ -947,7 +937,8 @@ static int mtk_venc_encode_header(void *priv)
|
||||
{
|
||||
struct mtk_vcodec_ctx *ctx = priv;
|
||||
int ret;
|
||||
struct vb2_buffer *dst_buf;
|
||||
struct vb2_buffer *src_buf, *dst_buf;
|
||||
struct vb2_v4l2_buffer *dst_vb2_v4l2, *src_vb2_v4l2;
|
||||
struct mtk_vcodec_mem bs_buf;
|
||||
struct venc_done_result enc_result;
|
||||
|
||||
@@ -980,6 +971,15 @@ static int mtk_venc_encode_header(void *priv)
|
||||
mtk_v4l2_err("venc_if_encode failed=%d", ret);
|
||||
return -EINVAL;
|
||||
}
|
||||
src_buf = v4l2_m2m_next_src_buf(ctx->m2m_ctx);
|
||||
if (src_buf) {
|
||||
src_vb2_v4l2 = to_vb2_v4l2_buffer(src_buf);
|
||||
dst_vb2_v4l2 = to_vb2_v4l2_buffer(dst_buf);
|
||||
dst_buf->timestamp = src_buf->timestamp;
|
||||
dst_vb2_v4l2->timecode = src_vb2_v4l2->timecode;
|
||||
} else {
|
||||
mtk_v4l2_err("No timestamp for the header buffer.");
|
||||
}
|
||||
|
||||
ctx->state = MTK_STATE_HEADER;
|
||||
dst_buf->planes[0].bytesused = enc_result.bs_size;
|
||||
@@ -1072,7 +1072,7 @@ static void mtk_venc_worker(struct work_struct *work)
|
||||
struct mtk_vcodec_mem bs_buf;
|
||||
struct venc_done_result enc_result;
|
||||
int ret, i;
|
||||
struct vb2_v4l2_buffer *vb2_v4l2;
|
||||
struct vb2_v4l2_buffer *dst_vb2_v4l2, *src_vb2_v4l2;
|
||||
|
||||
/* check dst_buf, dst_buf may be removed in device_run
|
||||
* to stored encdoe header so we need check dst_buf and
|
||||
@@ -1112,9 +1112,14 @@ static void mtk_venc_worker(struct work_struct *work)
|
||||
ret = venc_if_encode(ctx, VENC_START_OPT_ENCODE_FRAME,
|
||||
&frm_buf, &bs_buf, &enc_result);
|
||||
|
||||
vb2_v4l2 = container_of(dst_buf, struct vb2_v4l2_buffer, vb2_buf);
|
||||
src_vb2_v4l2 = to_vb2_v4l2_buffer(src_buf);
|
||||
dst_vb2_v4l2 = to_vb2_v4l2_buffer(dst_buf);
|
||||
|
||||
dst_buf->timestamp = src_buf->timestamp;
|
||||
dst_vb2_v4l2->timecode = src_vb2_v4l2->timecode;
|
||||
|
||||
if (enc_result.is_key_frm)
|
||||
vb2_v4l2->flags |= V4L2_BUF_FLAG_KEYFRAME;
|
||||
dst_vb2_v4l2->flags |= V4L2_BUF_FLAG_KEYFRAME;
|
||||
|
||||
if (ret) {
|
||||
v4l2_m2m_buf_done(to_vb2_v4l2_buffer(src_buf),
|
||||
@@ -1286,7 +1291,7 @@ int mtk_vcodec_enc_ctrls_setup(struct mtk_vcodec_ctx *ctx)
|
||||
0, V4L2_MPEG_VIDEO_HEADER_MODE_SEPARATE);
|
||||
v4l2_ctrl_new_std_menu(handler, ops, V4L2_CID_MPEG_VIDEO_H264_PROFILE,
|
||||
V4L2_MPEG_VIDEO_H264_PROFILE_HIGH,
|
||||
0, V4L2_MPEG_VIDEO_H264_PROFILE_MAIN);
|
||||
0, V4L2_MPEG_VIDEO_H264_PROFILE_HIGH);
|
||||
v4l2_ctrl_new_std_menu(handler, ops, V4L2_CID_MPEG_VIDEO_H264_LEVEL,
|
||||
V4L2_MPEG_VIDEO_H264_LEVEL_4_2,
|
||||
0, V4L2_MPEG_VIDEO_H264_LEVEL_4_0);
|
||||
@@ -1357,5 +1362,10 @@ int mtk_venc_lock(struct mtk_vcodec_ctx *ctx)
|
||||
|
||||
void mtk_vcodec_enc_release(struct mtk_vcodec_ctx *ctx)
|
||||
{
|
||||
venc_if_deinit(ctx);
|
||||
int ret = venc_if_deinit(ctx);
|
||||
|
||||
if (ret)
|
||||
mtk_v4l2_err("venc_if_deinit failed=%d", ret);
|
||||
|
||||
ctx->state = MTK_STATE_FREE;
|
||||
}
|
||||
|
@@ -218,11 +218,15 @@ static int fops_vcodec_release(struct file *file)
|
||||
mtk_v4l2_debug(1, "[%d] encoder", ctx->id);
|
||||
mutex_lock(&dev->dev_mutex);
|
||||
|
||||
/*
|
||||
* Call v4l2_m2m_ctx_release to make sure the worker thread is not
|
||||
* running after venc_if_deinit.
|
||||
*/
|
||||
v4l2_m2m_ctx_release(ctx->m2m_ctx);
|
||||
mtk_vcodec_enc_release(ctx);
|
||||
v4l2_fh_del(&ctx->fh);
|
||||
v4l2_fh_exit(&ctx->fh);
|
||||
v4l2_ctrl_handler_free(&ctx->ctrl_hdl);
|
||||
v4l2_m2m_ctx_release(ctx->m2m_ctx);
|
||||
|
||||
list_del_init(&ctx->list);
|
||||
dev->num_instances--;
|
||||
|
@@ -16,7 +16,6 @@
|
||||
#define _MTK_VCODEC_INTR_H_
|
||||
|
||||
#define MTK_INST_IRQ_RECEIVED 0x1
|
||||
#define MTK_INST_WORK_THREAD_ABORT_DONE 0x2
|
||||
|
||||
struct mtk_vcodec_ctx;
|
||||
|
||||
|
@@ -61,6 +61,8 @@ enum venc_h264_bs_mode {
|
||||
|
||||
/*
|
||||
* struct venc_h264_vpu_config - Structure for h264 encoder configuration
|
||||
* AP-W/R : AP is writer/reader on this item
|
||||
* VPU-W/R: VPU is write/reader on this item
|
||||
* @input_fourcc: input fourcc
|
||||
* @bitrate: target bitrate (in bps)
|
||||
* @pic_w: picture width. Picture size is visible stream resolution, in pixels,
|
||||
@@ -94,13 +96,13 @@ struct venc_h264_vpu_config {
|
||||
|
||||
/*
|
||||
* struct venc_h264_vpu_buf - Structure for buffer information
|
||||
* @align: buffer alignment (in bytes)
|
||||
* AP-W/R : AP is writer/reader on this item
|
||||
* VPU-W/R: VPU is write/reader on this item
|
||||
* @iova: IO virtual address
|
||||
* @vpua: VPU side memory addr which is used by RC_CODE
|
||||
* @size: buffer size (in bytes)
|
||||
*/
|
||||
struct venc_h264_vpu_buf {
|
||||
u32 align;
|
||||
u32 iova;
|
||||
u32 vpua;
|
||||
u32 size;
|
||||
@@ -108,6 +110,8 @@ struct venc_h264_vpu_buf {
|
||||
|
||||
/*
|
||||
* struct venc_h264_vsi - Structure for VPU driver control and info share
|
||||
* AP-W/R : AP is writer/reader on this item
|
||||
* VPU-W/R: VPU is write/reader on this item
|
||||
* This structure is allocated in VPU side and shared to AP side.
|
||||
* @config: h264 encoder configuration
|
||||
* @work_bufs: working buffer information in VPU side
|
||||
@@ -150,12 +154,6 @@ struct venc_h264_inst {
|
||||
struct mtk_vcodec_ctx *ctx;
|
||||
};
|
||||
|
||||
static inline void h264_write_reg(struct venc_h264_inst *inst, u32 addr,
|
||||
u32 val)
|
||||
{
|
||||
writel(val, inst->hw_base + addr);
|
||||
}
|
||||
|
||||
static inline u32 h264_read_reg(struct venc_h264_inst *inst, u32 addr)
|
||||
{
|
||||
return readl(inst->hw_base + addr);
|
||||
@@ -214,6 +212,8 @@ static unsigned int h264_get_level(struct venc_h264_inst *inst,
|
||||
return 40;
|
||||
case V4L2_MPEG_VIDEO_H264_LEVEL_4_1:
|
||||
return 41;
|
||||
case V4L2_MPEG_VIDEO_H264_LEVEL_4_2:
|
||||
return 42;
|
||||
default:
|
||||
mtk_vcodec_debug(inst, "unsupported level %d", level);
|
||||
return 31;
|
||||
|
@@ -56,6 +56,8 @@ enum venc_vp8_vpu_work_buf {
|
||||
|
||||
/*
|
||||
* struct venc_vp8_vpu_config - Structure for vp8 encoder configuration
|
||||
* AP-W/R : AP is writer/reader on this item
|
||||
* VPU-W/R: VPU is write/reader on this item
|
||||
* @input_fourcc: input fourcc
|
||||
* @bitrate: target bitrate (in bps)
|
||||
* @pic_w: picture width. Picture size is visible stream resolution, in pixels,
|
||||
@@ -83,14 +85,14 @@ struct venc_vp8_vpu_config {
|
||||
};
|
||||
|
||||
/*
|
||||
* struct venc_vp8_vpu_buf -Structure for buffer information
|
||||
* @align: buffer alignment (in bytes)
|
||||
* struct venc_vp8_vpu_buf - Structure for buffer information
|
||||
* AP-W/R : AP is writer/reader on this item
|
||||
* VPU-W/R: VPU is write/reader on this item
|
||||
* @iova: IO virtual address
|
||||
* @vpua: VPU side memory addr which is used by RC_CODE
|
||||
* @size: buffer size (in bytes)
|
||||
*/
|
||||
struct venc_vp8_vpu_buf {
|
||||
u32 align;
|
||||
u32 iova;
|
||||
u32 vpua;
|
||||
u32 size;
|
||||
@@ -98,6 +100,8 @@ struct venc_vp8_vpu_buf {
|
||||
|
||||
/*
|
||||
* struct venc_vp8_vsi - Structure for VPU driver control and info share
|
||||
* AP-W/R : AP is writer/reader on this item
|
||||
* VPU-W/R: VPU is write/reader on this item
|
||||
* This structure is allocated in VPU side and shared to AP side.
|
||||
* @config: vp8 encoder configuration
|
||||
* @work_bufs: working buffer information in VPU side
|
||||
@@ -138,12 +142,6 @@ struct venc_vp8_inst {
|
||||
struct mtk_vcodec_ctx *ctx;
|
||||
};
|
||||
|
||||
static inline void vp8_enc_write_reg(struct venc_vp8_inst *inst, u32 addr,
|
||||
u32 val)
|
||||
{
|
||||
writel(val, inst->hw_base + addr);
|
||||
}
|
||||
|
||||
static inline u32 vp8_enc_read_reg(struct venc_vp8_inst *inst, u32 addr)
|
||||
{
|
||||
return readl(inst->hw_base + addr);
|
||||
|
Ссылка в новой задаче
Block a user