Merge "video: driver: fixes for upstream/downstream driver compilation"

This commit is contained in:
qctecmdr
2022-08-23 14:26:58 -07:00
committed by Gerrit - the friendly Code Review server
commit 91e54040b8
13 muutettua tiedostoa jossa 69 lisäystä ja 179 poistoa

Näytä tiedosto

@@ -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"

Näytä tiedosto

@@ -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"
@@ -407,7 +406,7 @@ int msm_vidc_alloc_and_queue_session_internal_buffers(struct msm_vidc_inst *inst
enum msm_vidc_buffer_type buffer_type);
int msm_vidc_release_internal_buffers(struct msm_vidc_inst *inst,
enum msm_vidc_buffer_type buffer_type);
int msm_vidc_buffer_done(struct msm_vidc_inst *inst,
int msm_vidc_vb2_buffer_done(struct msm_vidc_inst *inst,
struct msm_vidc_buffer *buf);
int msm_vidc_remove_session(struct msm_vidc_inst *inst);
int msm_vidc_add_session(struct msm_vidc_inst *inst);

Näytä tiedosto

@@ -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 {

Näytä tiedosto

@@ -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>
@@ -2599,7 +2598,6 @@ int msm_vdec_subscribe_event(struct msm_vidc_inst *inst,
switch (sub->type) {
case V4L2_EVENT_EOS:
case V4L2_EVENT_VIDC_METADATA:
rc = v4l2_event_subscribe(&inst->event_handler, sub, MAX_EVENTS, NULL);
break;
case V4L2_EVENT_SOURCE_CHANGE:

Näytä tiedosto

@@ -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"

Näytä tiedosto

@@ -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:
return mpeg_video_hevc_profile;
case V4L2_CID_MPEG_VIDEO_AV1_PROFILE:
return av1_profile;
case V4L2_CID_MPEG_VIDEO_AV1_LEVEL:
return av1_level;
case V4L2_CID_MPEG_VIDEO_AV1_TIER:
case PROFILE:
if (inst->codec == MSM_VIDC_HEVC || inst->codec == MSM_VIDC_HEIC) {
return mpeg_video_hevc_profile;
} else if (inst->codec == MSM_VIDC_AV1) {
return av1_profile;
} 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;
} 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;

Näytä tiedosto

@@ -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"

Näytä tiedosto

@@ -4110,7 +4110,7 @@ int msm_vidc_release_internal_buffers(struct msm_vidc_inst *inst,
return 0;
}
static int msm_vidc_vb2_buffer_done(struct msm_vidc_inst *inst,
int msm_vidc_vb2_buffer_done(struct msm_vidc_inst *inst,
struct msm_vidc_buffer *buf)
{
int type, port, state;
@@ -4177,56 +4177,6 @@ static int msm_vidc_vb2_buffer_done(struct msm_vidc_inst *inst,
return 0;
}
static int msm_vidc_v4l2_buffer_event(struct msm_vidc_inst *inst,
struct msm_vidc_buffer *buf)
{
int rc = 0;
struct v4l2_event event = {0};
struct v4l2_event_vidc_metadata *event_data = NULL;
if (!inst || !buf) {
d_vpr_e("%s: invalid params\n", __func__);
return -EINVAL;
}
if (buf->type != MSM_VIDC_BUF_INPUT_META) {
i_vpr_e(inst, "%s: unsupported buffer type %s\n",
__func__, buf_name(buf->type));
return -EINVAL;
}
event.type = V4L2_EVENT_VIDC_METADATA;
event_data = (struct v4l2_event_vidc_metadata *)event.u.data;
event_data->type = INPUT_META_PLANE;
event_data->fd = buf->fd;
event_data->index = buf->index;
event_data->bytesused = buf->data_size;
event_data->offset = buf->data_offset;
v4l2_event_queue_fh(&inst->event_handler, &event);
return rc;
}
int msm_vidc_buffer_done(struct msm_vidc_inst *inst,
struct msm_vidc_buffer *buf)
{
if (!inst || !inst->capabilities || !buf) {
d_vpr_e("%s: invalid params\n", __func__);
return -EINVAL;
}
if (buf->type == MSM_VIDC_BUF_INPUT_META &&
inst->capabilities->cap[INPUT_META_VIA_REQUEST].value) {
if (is_meta_rx_inp_enabled(inst, META_OUTBUF_FENCE))
return msm_vidc_v4l2_buffer_event(inst, buf);
} else {
return msm_vidc_vb2_buffer_done(inst, buf);
}
return 0;
}
int msm_vidc_event_queue_init(struct msm_vidc_inst *inst)
{
int rc = 0;
@@ -5612,7 +5562,7 @@ int msm_vidc_flush_buffers(struct msm_vidc_inst *inst,
buf->attr & MSM_VIDC_ATTR_DEFERRED) {
print_vidc_buffer(VIDC_HIGH, "high", "flushing buffer", inst, buf);
if (!(buf->attr & MSM_VIDC_ATTR_BUFFER_DONE))
msm_vidc_buffer_done(inst, buf);
msm_vidc_vb2_buffer_done(inst, buf);
msm_vidc_put_driver_buf(inst, buf);
}
}
@@ -5757,7 +5707,7 @@ void msm_vidc_destroy_buffers(struct msm_vidc_inst *inst)
list_for_each_entry_safe(buf, dummy, &buffers->list, list) {
print_vidc_buffer(VIDC_ERR, "err ", "destroying ", inst, buf);
if (!(buf->attr & MSM_VIDC_ATTR_BUFFER_DONE))
msm_vidc_buffer_done(inst, buf);
msm_vidc_vb2_buffer_done(inst, buf);
msm_vidc_put_driver_buf(inst, buf);
}
msm_vidc_unmap_buffers(inst, ext_buf_types[i]);

Näytä tiedosto

@@ -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;

Näytä tiedosto

@@ -1251,7 +1251,7 @@ static int handle_dequeue_buffers(struct msm_vidc_inst *inst)
"vb2 done already", inst, buf);
} else {
buf->attr |= MSM_VIDC_ATTR_BUFFER_DONE;
rc = msm_vidc_buffer_done(inst, buf);
rc = msm_vidc_vb2_buffer_done(inst, buf);
if (rc) {
print_vidc_buffer(VIDC_HIGH, "err ",
"vb2 done failed", inst, buf);