f012b23d64
This is implementing multi-stream decoder support. The multi-stream will be used to enable/disable the primary/secondary decoder outputs. Depending on formats on both decoder outputs we could implement downscale, dithering and supporting UBWC (universal bandwidth compression) formats. The UBWC compressed raw format is used to optimize interconnect bandwidth for bigger resolutions like 4K and hence we will get some power-saving benefits as well. Both decoder outputs are distinguished by buffer_type field in the HFI packets. For example HFI_BUFFER_OUTPUT is the buffer type for primary decoder output and HFI_BUFFER_OUTPUT2 is for secondary decoder output. Starting from Venus 4xx the DPB buffers format must be UBWC, so the multi-stream becomes mandatory for this Venus version. That means that we need to allocate internally in the driver a set of DPB buffers (with UBWC NV12 format) and give them to the firmware. The other decoder output (we called it OPB) format will be NV12 linear format and with the same resolution (or smaller in case the user wants to downscale). The DPB buffers are used for decoder reference frames and those have to be in a specific format (UBWC). So one decoder output is used to fill those reference buffers while the other output is used to fill the userspace buffers with the user requested format. Signed-off-by: Stanimir Varbanov <stanimir.varbanov@linaro.org> Reviewed-by: Tomasz Figa <tfiga@chromium.org> Reviewed-by: Alexandre Courbot <acourbot@chromium.org> Tested-by: Alexandre Courbot <acourbot@chromium.org> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
66 lines
3.0 KiB
C
66 lines
3.0 KiB
C
/*
|
|
* Copyright (c) 2012-2016, The Linux Foundation. All rights reserved.
|
|
* Copyright (C) 2017 Linaro Ltd.
|
|
*
|
|
* This program is free software; you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License version 2 and
|
|
* only version 2 as published by the Free Software Foundation.
|
|
*
|
|
* This program is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU General Public License for more details.
|
|
*
|
|
*/
|
|
#ifndef __VENUS_HELPERS_H__
|
|
#define __VENUS_HELPERS_H__
|
|
|
|
#include <media/videobuf2-v4l2.h>
|
|
|
|
struct venus_inst;
|
|
|
|
bool venus_helper_check_codec(struct venus_inst *inst, u32 v4l2_pixfmt);
|
|
struct vb2_v4l2_buffer *venus_helper_find_buf(struct venus_inst *inst,
|
|
unsigned int type, u32 idx);
|
|
void venus_helper_buffers_done(struct venus_inst *inst,
|
|
enum vb2_buffer_state state);
|
|
int venus_helper_vb2_buf_init(struct vb2_buffer *vb);
|
|
int venus_helper_vb2_buf_prepare(struct vb2_buffer *vb);
|
|
void venus_helper_vb2_buf_queue(struct vb2_buffer *vb);
|
|
void venus_helper_vb2_stop_streaming(struct vb2_queue *q);
|
|
int venus_helper_vb2_start_streaming(struct venus_inst *inst);
|
|
void venus_helper_m2m_device_run(void *priv);
|
|
void venus_helper_m2m_job_abort(void *priv);
|
|
int venus_helper_get_bufreq(struct venus_inst *inst, u32 type,
|
|
struct hfi_buffer_requirements *req);
|
|
u32 venus_helper_get_framesz_raw(u32 hfi_fmt, u32 width, u32 height);
|
|
u32 venus_helper_get_framesz(u32 v4l2_fmt, u32 width, u32 height);
|
|
int venus_helper_set_input_resolution(struct venus_inst *inst,
|
|
unsigned int width, unsigned int height);
|
|
int venus_helper_set_output_resolution(struct venus_inst *inst,
|
|
unsigned int width, unsigned int height,
|
|
u32 buftype);
|
|
int venus_helper_set_work_mode(struct venus_inst *inst, u32 mode);
|
|
int venus_helper_set_core_usage(struct venus_inst *inst, u32 usage);
|
|
int venus_helper_set_num_bufs(struct venus_inst *inst, unsigned int input_bufs,
|
|
unsigned int output_bufs,
|
|
unsigned int output2_bufs);
|
|
int venus_helper_set_raw_format(struct venus_inst *inst, u32 hfi_format,
|
|
u32 buftype);
|
|
int venus_helper_set_color_format(struct venus_inst *inst, u32 fmt);
|
|
int venus_helper_set_dyn_bufmode(struct venus_inst *inst);
|
|
int venus_helper_set_bufsize(struct venus_inst *inst, u32 bufsize, u32 buftype);
|
|
int venus_helper_set_multistream(struct venus_inst *inst, bool out_en,
|
|
bool out2_en);
|
|
unsigned int venus_helper_get_opb_size(struct venus_inst *inst);
|
|
void venus_helper_acquire_buf_ref(struct vb2_v4l2_buffer *vbuf);
|
|
void venus_helper_release_buf_ref(struct venus_inst *inst, unsigned int idx);
|
|
void venus_helper_init_instance(struct venus_inst *inst);
|
|
int venus_helper_get_out_fmts(struct venus_inst *inst, u32 fmt, u32 *out_fmt,
|
|
u32 *out2_fmt, bool ubwc);
|
|
int venus_helper_alloc_dpb_bufs(struct venus_inst *inst);
|
|
int venus_helper_free_dpb_bufs(struct venus_inst *inst);
|
|
int venus_helper_power_enable(struct venus_core *core, u32 session_type,
|
|
bool enable);
|
|
#endif
|