video: driver: fixes for upstream/downstream driver compilation

- do not use vidc_v4l2_extensions.h for upstream driver compilation.
- resolve compilation issues in upstream and downstream driver due
  to above change.
- add volatile flag in the database.

Signed-off-by: Darshana Patil <quic_darshana@quicinc.com>
Change-Id: I1985cae29a459af2250f7044d85c5cd22cdd68f7
This commit is contained in:
Darshana Patil
2022-08-11 17:54:21 -07:00
committed by Gerrit - the friendly Code Review server
parent 90fabfb02b
commit c4beadb5d2
10 changed files with 64 additions and 112 deletions

View File

@@ -268,16 +268,20 @@ static struct msm_platform_inst_capability instance_cap_data_kalama[] = {
MSM_VIDC_FMT_NV12C},
{MIN_BUFFERS_INPUT, ENC|DEC, CODECS_ALL, 0, 64, 1, 4,
V4L2_CID_MIN_BUFFERS_FOR_OUTPUT},
V4L2_CID_MIN_BUFFERS_FOR_OUTPUT,
0,
CAP_FLAG_VOLATILE},
{MIN_BUFFERS_INPUT, ENC|DEC, HEIC, 0, 64, 1, 1,
V4L2_CID_MIN_BUFFERS_FOR_OUTPUT},
V4L2_CID_MIN_BUFFERS_FOR_OUTPUT,
0,
CAP_FLAG_VOLATILE},
{MIN_BUFFERS_OUTPUT, ENC|DEC, CODECS_ALL,
0, 64, 1, 4,
V4L2_CID_MIN_BUFFERS_FOR_CAPTURE,
HFI_PROP_BUFFER_FW_MIN_OUTPUT_COUNT,
CAP_FLAG_OUTPUT_PORT},
CAP_FLAG_OUTPUT_PORT | CAP_FLAG_VOLATILE},
/* (8192 * 4320) / 256 */
{MBPF, ENC, CODECS_ALL, 64, 138240, 1, 138240},
@@ -405,7 +409,7 @@ static struct msm_platform_inst_capability instance_cap_data_kalama[] = {
0, 0,
CAP_FLAG_NONE},
{SLICE_INTERFACE, DEC, CODECS_ALL,
{SLICE_DECODE, DEC, CODECS_ALL,
0, 0, 0, 0,
V4L2_CID_MPEG_VIDEO_DECODER_SLICE_INTERFACE,
0},
@@ -603,9 +607,9 @@ static struct msm_platform_inst_capability instance_cap_data_kalama[] = {
CAP_FLAG_OUTPUT_PORT},
{USE_LTR, ENC, H264|HEVC,
INVALID_DEFAULT_MARK_OR_USE_LTR,
0,
((1 << MAX_LTR_FRAME_COUNT) - 1),
1, INVALID_DEFAULT_MARK_OR_USE_LTR,
0, 0,
V4L2_CID_MPEG_VIDEO_USE_LTR_FRAMES,
HFI_PROP_LTR_USE,
CAP_FLAG_INPUT_PORT | CAP_FLAG_DYNAMIC_ALLOWED},
@@ -1310,7 +1314,8 @@ static struct msm_platform_inst_capability instance_cap_data_kalama[] = {
{FILM_GRAIN, DEC, AV1,
0, 1, 1, 0,
0,
HFI_PROP_AV1_FILM_GRAIN_PRESENT},
HFI_PROP_AV1_FILM_GRAIN_PRESENT,
CAP_FLAG_VOLATILE},
{SUPER_BLOCK, DEC, AV1,
0, 1, 1, 0,

View File

@@ -6,6 +6,7 @@
#include <soc/qcom/of_common.h>
#include <media/v4l2_vidc_extensions.h>
#include "msm_vidc_kalama.h"
#include "msm_vidc_platform.h"
#include "msm_vidc_debug.h"
@@ -392,16 +393,20 @@ static struct msm_platform_inst_capability instance_cap_data_kalama[] = {
MSM_VIDC_FMT_NV12C},
{MIN_BUFFERS_INPUT, ENC|DEC, CODECS_ALL, 0, 64, 1, 4,
V4L2_CID_MIN_BUFFERS_FOR_OUTPUT},
V4L2_CID_MIN_BUFFERS_FOR_OUTPUT,
0,
CAP_FLAG_VOLATILE},
{MIN_BUFFERS_INPUT, ENC|DEC, HEIC, 0, 64, 1, 1,
V4L2_CID_MIN_BUFFERS_FOR_OUTPUT},
V4L2_CID_MIN_BUFFERS_FOR_OUTPUT,
0,
CAP_FLAG_VOLATILE},
{MIN_BUFFERS_OUTPUT, ENC|DEC, CODECS_ALL,
0, 64, 1, 4,
V4L2_CID_MIN_BUFFERS_FOR_CAPTURE,
HFI_PROP_BUFFER_FW_MIN_OUTPUT_COUNT,
CAP_FLAG_OUTPUT_PORT},
CAP_FLAG_OUTPUT_PORT | CAP_FLAG_VOLATILE},
/* (8192 * 4320) / 256 */
{MBPF, ENC, CODECS_ALL, 64, 138240, 1, 138240},
@@ -574,7 +579,9 @@ static struct msm_platform_inst_capability instance_cap_data_kalama[] = {
{FENCE_FD, DEC, CODECS_ALL,
INVALID_FD, INT_MAX, 1, INVALID_FD,
V4L2_CID_MPEG_VIDC_SW_FENCE_FD},
V4L2_CID_MPEG_VIDC_SW_FENCE_FD,
0,
CAP_FLAG_VOLATILE},
{TS_REORDER, DEC, H264|HEVC,
0, 1, 1, 0,
@@ -830,9 +837,9 @@ static struct msm_platform_inst_capability instance_cap_data_kalama[] = {
CAP_FLAG_OUTPUT_PORT},
{USE_LTR, ENC, H264|HEVC,
INVALID_DEFAULT_MARK_OR_USE_LTR,
0,
((1 << MAX_LTR_FRAME_COUNT) - 1),
1, INVALID_DEFAULT_MARK_OR_USE_LTR,
0, 0,
V4L2_CID_MPEG_VIDEO_USE_LTR_FRAMES,
HFI_PROP_LTR_USE,
CAP_FLAG_INPUT_PORT | CAP_FLAG_DYNAMIC_ALLOWED},
@@ -1638,7 +1645,8 @@ static struct msm_platform_inst_capability instance_cap_data_kalama[] = {
{FILM_GRAIN, DEC, AV1,
0, 1, 1, 0,
V4L2_CID_MPEG_VIDC_AV1D_FILM_GRAIN_PRESENT,
HFI_PROP_AV1_FILM_GRAIN_PRESENT},
HFI_PROP_AV1_FILM_GRAIN_PRESENT,
CAP_FLAG_VOLATILE},
{SUPER_BLOCK, DEC, AV1,
0, 1, 1, 0,

View File

@@ -7,7 +7,6 @@
#ifndef _MSM_VIDC_CONTROL_H_
#define _MSM_VIDC_CONTROL_H_
#include <media/v4l2_vidc_extensions.h>
#include "msm_vidc_inst.h"
#include "msm_vidc_internal.h"

View File

@@ -8,7 +8,6 @@
#include <linux/workqueue.h>
#include <linux/iommu.h>
#include <media/v4l2_vidc_extensions.h>
#include "msm_vidc_internal.h"
#include "msm_vidc_core.h"
#include "msm_vidc_inst.h"

View File

@@ -579,6 +579,7 @@ enum msm_vidc_inst_capability_flags {
CAP_FLAG_OUTPUT_PORT = BIT(3),
CAP_FLAG_CLIENT_SET = BIT(4),
CAP_FLAG_BITMASK = BIT(5),
CAP_FLAG_VOLATILE = BIT(6),
};
struct msm_vidc_inst_cap {

View File

@@ -4,7 +4,6 @@
*/
/* Copyright (c) 2022. Qualcomm Innovation Center, Inc. All rights reserved. */
#include <media/v4l2_vidc_extensions.h>
#include "msm_media_info.h"
#include <linux/v4l2-common.h>

View File

@@ -3,7 +3,6 @@
* Copyright (c) 2020-2021, The Linux Foundation. All rights reserved.
*/
#include <media/v4l2_vidc_extensions.h>
#include "msm_media_info.h"
#include "msm_venc.h"

View File

@@ -39,22 +39,6 @@ static bool is_priv_ctrl(u32 id)
* available yet. Hence, make this as private ctrl for time being
*/
case V4L2_CID_MPEG_VIDEO_HEVC_PROFILE:
/*
* TODO: V4L2_CID_MPEG_VIDEO_H264_HIERARCHICAL_CODING_TYPE is
* std ctrl. But needs some fixes in v4l2-ctrls.c. Hence,
* make this as private ctrl for time being
*/
case V4L2_CID_MPEG_VIDEO_H264_HIERARCHICAL_CODING_TYPE:
/*
* TODO: treat below std ctrls as private ctrls until
* all below ctrls are available in upstream
*/
case V4L2_CID_MPEG_VIDEO_AU_DELIMITER:
case V4L2_CID_MPEG_VIDEO_LTR_COUNT:
case V4L2_CID_MPEG_VIDEO_FRAME_LTR_INDEX:
case V4L2_CID_MPEG_VIDEO_USE_LTR_FRAMES:
case V4L2_CID_MPEG_VIDEO_DEC_DISPLAY_DELAY:
case V4L2_CID_MPEG_VIDEO_DEC_DISPLAY_DELAY_ENABLE:
private = true;
break;
default:
@@ -65,25 +49,6 @@ static bool is_priv_ctrl(u32 id)
return private;
}
static const char *const mpeg_video_rate_control[] = {
"VBR",
"CBR",
"CBR VFR",
"MBR",
"MBR VFR",
"CQ",
NULL,
};
static const char *const mpeg_video_stream_format[] = {
"NAL Format Start Codes",
"NAL Format One NAL Per Buffer",
"NAL Format One Byte Length",
"NAL Format Two Byte Length",
"NAL Format Four Byte Length",
NULL,
};
static const char *const mpeg_video_blur_types[] = {
"Blur None",
"Blur External",
@@ -91,12 +56,6 @@ static const char *const mpeg_video_blur_types[] = {
NULL,
};
static const char *const mpeg_video_avc_coding_layer[] = {
"B",
"P",
NULL,
};
static const char *const mpeg_video_hevc_profile[] = {
"Main",
"Main Still Picture",
@@ -174,30 +133,36 @@ u32 msm_vidc_get_port_info(struct msm_vidc_inst *inst,
}
static const char * const * msm_vidc_get_qmenu_type(
struct msm_vidc_inst *inst, u32 control_id)
struct msm_vidc_inst *inst, u32 cap_id)
{
switch (control_id) {
case V4L2_CID_MPEG_VIDEO_BITRATE_MODE:
return mpeg_video_rate_control;
case V4L2_CID_MPEG_VIDEO_HEVC_SIZE_OF_LENGTH_FIELD:
return mpeg_video_stream_format;
case V4L2_CID_MPEG_VIDC_VIDEO_BLUR_TYPES:
switch (cap_id) {
case BLUR_TYPES:
return mpeg_video_blur_types;
case V4L2_CID_MPEG_VIDEO_H264_HIERARCHICAL_CODING_TYPE:
return mpeg_video_avc_coding_layer;
case V4L2_CID_MPEG_VIDEO_HEVC_PROFILE:
case PROFILE:
if (inst->codec == MSM_VIDC_HEVC || inst->codec == MSM_VIDC_HEIC) {
return mpeg_video_hevc_profile;
case V4L2_CID_MPEG_VIDEO_AV1_PROFILE:
} else if (inst->codec == MSM_VIDC_AV1) {
return av1_profile;
case V4L2_CID_MPEG_VIDEO_AV1_LEVEL:
} else {
i_vpr_e(inst, "%s: invalid codec type %d for cap id %d\n",
__func__, inst->codec, cap_id);
return NULL;
}
case LEVEL:
if (inst->codec == MSM_VIDC_AV1) {
return av1_level;
case V4L2_CID_MPEG_VIDEO_AV1_TIER:
} else {
i_vpr_e(inst, "%s: invalid codec type %d for cap id %d\n",
__func__, inst->codec, cap_id);
return NULL;
}
case AV1_TIER:
return av1_tier;
case V4L2_CID_MPEG_VIDEO_VIDC_INTRA_REFRESH_TYPE:
case IR_TYPE:
return mpeg_video_vidc_ir_type;
default:
i_vpr_e(inst, "%s: No available qmenu for ctrl %#x\n",
__func__, control_id);
i_vpr_e(inst, "%s: No available qmenu for cap id %d\n",
__func__, cap_id);
return NULL;
}
}
@@ -745,15 +710,6 @@ error:
return rc;
}
void msm_vidc_add_volatile_flag(struct v4l2_ctrl *ctrl)
{
if (ctrl->id == V4L2_CID_MIN_BUFFERS_FOR_OUTPUT ||
ctrl->id == V4L2_CID_MIN_BUFFERS_FOR_CAPTURE ||
ctrl->id == V4L2_CID_MPEG_VIDC_AV1D_FILM_GRAIN_PRESENT ||
ctrl->id == V4L2_CID_MPEG_VIDC_SW_FENCE_FD)
ctrl->flags |= V4L2_CTRL_FLAG_VOLATILE;
}
int msm_vidc_ctrl_deinit(struct msm_vidc_inst *inst)
{
if (!inst) {
@@ -866,7 +822,7 @@ int msm_vidc_ctrl_init(struct msm_vidc_inst *inst)
ctrl_cfg.menu_skip_mask =
~(capability->cap[idx].step_or_mask);
ctrl_cfg.qmenu = msm_vidc_get_qmenu_type(inst,
capability->cap[idx].v4l2_id);
capability->cap[idx].cap_id);
} else {
ctrl_cfg.step =
capability->cap[idx].step_or_mask;
@@ -915,11 +871,9 @@ int msm_vidc_ctrl_init(struct msm_vidc_inst *inst)
goto error;
}
/*
* TODO(AS)
* ctrl->flags |= capability->cap[idx].flags;
*/
msm_vidc_add_volatile_flag(ctrl);
if (capability->cap[idx].flags & CAP_FLAG_VOLATILE)
ctrl->flags |= V4L2_CTRL_FLAG_VOLATILE;
ctrl->flags |= V4L2_CTRL_FLAG_EXECUTE_ON_WRITE;
inst->ctrls[ctrl_idx] = ctrl;
ctrl_idx++;
@@ -2902,7 +2856,7 @@ int msm_vidc_adjust_dec_slice_mode(void *instance, struct v4l2_ctrl *ctrl)
u32 adjusted_value = 0;
s32 low_latency = -1;
s32 picture_order = -1;
s32 outbuf_fence = V4L2_MPEG_VIDC_META_DISABLE;
s32 outbuf_fence = 0;
if (!inst || !inst->capabilities) {
d_vpr_e("%s: invalid params\n", __func__);
@@ -2922,7 +2876,7 @@ int msm_vidc_adjust_dec_slice_mode(void *instance, struct v4l2_ctrl *ctrl)
if (!low_latency || !picture_order ||
!is_meta_rx_inp_enabled(inst, META_OUTBUF_FENCE))
adjusted_value = V4L2_MPEG_MSM_VIDC_DISABLE;
adjusted_value = 0;
msm_vidc_update_cap_value(inst, SLICE_DECODE,
adjusted_value, __func__);
@@ -4527,7 +4481,7 @@ int msm_vidc_set_vui_timing_info(void *instance,
* V4L2_CID_MPEG_VIDC_VUI_TIMING_INFO and hence reverse
* the hfi_value from cap_id value.
*/
if (inst->capabilities->cap[cap_id].value == V4L2_MPEG_MSM_VIDC_ENABLE)
if (inst->capabilities->cap[cap_id].value == 1)
hfi_value = 0;
else
hfi_value = 1;

View File

@@ -3,6 +3,7 @@
* Copyright (c) 2022. Qualcomm Innovation Center, Inc. All rights reserved.
*/
#include <media/v4l2_vidc_extensions.h>
#include "msm_vidc_control_ext.h"
#include "msm_vidc_debug.h"
#include "hfi_packet.h"

View File

@@ -188,7 +188,6 @@ int msm_vidc_scale_buses(struct msm_vidc_inst *inst)
struct vidc_bus_vote_data *vote_data;
struct v4l2_format *out_f;
struct v4l2_format *inp_f;
int codec = 0;
u32 operating_rate, frame_rate;
if (!inst || !inst->core || !inst->capabilities) {
@@ -211,27 +210,15 @@ int msm_vidc_scale_buses(struct msm_vidc_inst *inst)
out_f = &inst->fmts[OUTPUT_PORT];
inp_f = &inst->fmts[INPUT_PORT];
switch (inst->domain) {
case MSM_VIDC_DECODER:
codec = inp_f->fmt.pix_mp.pixelformat;
break;
case MSM_VIDC_ENCODER:
codec = out_f->fmt.pix_mp.pixelformat;
break;
default:
i_vpr_e(inst, "%s: invalid session_type %#x\n",
__func__, inst->domain);
break;
}
vote_data->codec = inst->codec;
vote_data->input_width = inp_f->fmt.pix_mp.width;
vote_data->input_height = inp_f->fmt.pix_mp.height;
vote_data->output_width = out_f->fmt.pix_mp.width;
vote_data->output_height = out_f->fmt.pix_mp.height;
vote_data->lcu_size = (codec == V4L2_PIX_FMT_HEVC ||
codec == V4L2_PIX_FMT_VP9) ? 32 : 16;
if (codec == V4L2_PIX_FMT_AV1)
vote_data->lcu_size = (inst->codec == MSM_VIDC_HEVC ||
inst->codec == MSM_VIDC_VP9) ? 32 : 16;
if (inst->codec == MSM_VIDC_AV1)
vote_data->lcu_size =
inst->capabilities->cap[SUPER_BLOCK].value ? 128 : 64;
vote_data->fps = inst->max_rate;