Merge "video: driver: Add support to 1kx1k tile for HEIC encoding"

Este commit está contenido en:
qctecmdr
2023-04-29 10:04:29 -07:00
cometido por Gerrit - the friendly Code Review server
Se han modificado 8 ficheros con 35 adiciones y 22 borrados

Ver fichero

@@ -244,6 +244,9 @@ enum v4l2_mpeg_vidc_av1_tier {
#define V4L2_CID_MPEG_VIDC_DRIVER_VERSION \
(V4L2_CID_MPEG_VIDC_BASE + 0x48)
#define V4L2_CID_MPEG_VIDC_GRID_WIDTH \
(V4L2_CID_MPEG_VIDC_BASE + 0x49)
int msm_vidc_adjust_ir_period(void *instance, struct v4l2_ctrl *ctrl);
int msm_vidc_adjust_dec_frame_rate(void *instance, struct v4l2_ctrl *ctrl);
int msm_vidc_adjust_dec_operating_rate(void *instance, struct v4l2_ctrl *ctrl);

Ver fichero

@@ -22,7 +22,6 @@
#include "hfi_property.h"
#include "hfi_command.h"
/* version: major[24:31], minor[16:23], revision[0:15] */
#define DRIVER_VERSION 0x04000000
#define DEFAULT_VIDEO_CONCEAL_COLOR_BLACK 0x8020010
@@ -1905,12 +1904,17 @@ static struct msm_platform_inst_capability instance_cap_data_kalama[] = {
HFI_PROP_DEC_QP_METADATA,
CAP_FLAG_BITMASK | CAP_FLAG_META},
{GRID, ENC, HEIC,
{GRID_ENABLE, ENC, HEIC,
0, 1, 1, 1,
0,
HFI_PROP_HEIC_GRID_ENABLE,
CAP_FLAG_OUTPUT_PORT},
{GRID_SIZE, ENC, HEIC,
HEIC_GRID_WIDTH, HEIC_GRID_WIDTH * 2,
HEIC_GRID_WIDTH, HEIC_GRID_WIDTH,
V4L2_CID_MPEG_VIDC_GRID_WIDTH},
{COMPLEXITY, ENC, H264|HEVC,
0, 100,
1, DEFAULT_COMPLEXITY,
@@ -2463,7 +2467,7 @@ static struct msm_platform_inst_cap_dependency instance_cap_dependency_data_kala
msm_vidc_adjust_roi_info,
NULL},
{GRID, ENC, HEIC,
{GRID_ENABLE, ENC, HEIC,
{0},
NULL,
msm_vidc_set_u32},

Ver fichero

@@ -24,7 +24,6 @@
#include "hfi_command.h"
#include "venus_hfi.h"
/* version: major[24:31], minor[16:23], revision[0:15] */
#define DRIVER_VERSION 0x04000000
#define DEFAULT_VIDEO_CONCEAL_COLOR_BLACK 0x8020010
@@ -2021,12 +2020,17 @@ static struct msm_platform_inst_capability instance_cap_data_pineapple[] = {
HFI_PROP_DEC_QP_METADATA,
CAP_FLAG_BITMASK | CAP_FLAG_META},
{GRID, ENC, HEIC,
{GRID_ENABLE, ENC, HEIC,
0, 1, 1, 1,
0,
HFI_PROP_HEIC_GRID_ENABLE,
CAP_FLAG_OUTPUT_PORT},
{GRID_SIZE, ENC, HEIC,
HEIC_GRID_WIDTH, HEIC_GRID_WIDTH * 2,
HEIC_GRID_WIDTH, HEIC_GRID_WIDTH,
V4L2_CID_MPEG_VIDC_GRID_WIDTH},
{COMPLEXITY, ENC, H264|HEVC,
0, 100,
1, DEFAULT_COMPLEXITY,
@@ -2630,7 +2634,7 @@ static struct msm_platform_inst_cap_dependency instance_cap_dependency_data_pine
msm_vidc_adjust_roi_info,
NULL},
{GRID, ENC, HEIC,
{GRID_ENABLE, ENC, HEIC,
{0},
NULL,
msm_vidc_set_u32},

Ver fichero

@@ -14,7 +14,6 @@
#include "msm_vidc_inst.h"
#define MSM_VIDC_SESSION_INACTIVE_THRESHOLD_MS 1000
#define HEIC_GRID_DIMENSION 512
enum msm_vidc_debugfs_event;

Ver fichero

@@ -137,6 +137,7 @@ enum msm_vidc_metadata_bits {
#define MAX_TRANSCODING_STATS_FRAME_RATE 60
#define MAX_TRANSCODING_STATS_WIDTH 4096
#define MAX_TRANSCODING_STATS_HEIGHT 2304
#define HEIC_GRID_WIDTH 512
#define DCVS_WINDOW 16
#define ENC_FPS_WINDOW 3
@@ -357,7 +358,8 @@ enum msm_vidc_metadata_bits {
CAP(BASELAYER_PRIORITY) \
CAP(IR_TYPE) \
CAP(AU_DELIMITER) \
CAP(GRID) \
CAP(GRID_ENABLE) \
CAP(GRID_SIZE) \
CAP(I_FRAME_MIN_QP) \
CAP(P_FRAME_MIN_QP) \
CAP(B_FRAME_MIN_QP) \

Ver fichero

@@ -150,6 +150,7 @@ static int msm_venc_set_stride_scanline(struct msm_vidc_inst *inst,
u32 color_format, stride_y, scanline_y;
u32 stride_uv = 0, scanline_uv = 0;
u32 payload[2];
u32 grid_size;
if (port != INPUT_PORT) {
i_vpr_e(inst, "%s: invalid port %d\n", __func__, port);
@@ -165,8 +166,9 @@ static int msm_venc_set_stride_scanline(struct msm_vidc_inst *inst,
}
if (is_image_session(inst)) {
stride_y = ALIGN(inst->fmts[INPUT_PORT].fmt.pix_mp.width, HEIC_GRID_DIMENSION);
scanline_y = ALIGN(inst->fmts[INPUT_PORT].fmt.pix_mp.height, HEIC_GRID_DIMENSION);
grid_size = inst->capabilities[GRID_SIZE].value;
stride_y = ALIGN(inst->fmts[INPUT_PORT].fmt.pix_mp.width, grid_size);
scanline_y = ALIGN(inst->fmts[INPUT_PORT].fmt.pix_mp.height, grid_size);
} else if (is_rgba_colorformat(color_format)) {
stride_y = video_rgb_stride_pix(color_format,
inst->fmts[INPUT_PORT].fmt.pix_mp.width);
@@ -1232,7 +1234,8 @@ int msm_venc_s_fmt_output(struct msm_vidc_inst *inst, struct v4l2_format *f)
fmt->fmt.pix_mp.height = ALIGN(height, codec_align);
/* use grid dimension for image session */
if (is_image_session(inst))
fmt->fmt.pix_mp.width = fmt->fmt.pix_mp.height = HEIC_GRID_DIMENSION;
fmt->fmt.pix_mp.width = fmt->fmt.pix_mp.height =
inst->capabilities[GRID_SIZE].value;
fmt->fmt.pix_mp.num_planes = 1;
fmt->fmt.pix_mp.plane_fmt[0].bytesperline = 0;
fmt->fmt.pix_mp.plane_fmt[0].sizeimage = call_session_op(core,
@@ -1332,7 +1335,8 @@ static int msm_venc_s_fmt_input(struct msm_vidc_inst *inst, struct v4l2_format *
height = f->fmt.pix_mp.height;
if (is_image_session(inst)) {
bytesperline = ALIGN(f->fmt.pix_mp.width, HEIC_GRID_DIMENSION) *
bytesperline = ALIGN(f->fmt.pix_mp.width,
inst->capabilities[GRID_SIZE].value) *
(is_10bit_colorformat(pix_fmt) ? 2 : 1);
} else if (is_rgba_colorformat(pix_fmt)) {
bytesperline = video_rgb_stride_bytes(pix_fmt, f->fmt.pix_mp.width);
@@ -1347,10 +1351,7 @@ static int msm_venc_s_fmt_input(struct msm_vidc_inst *inst, struct v4l2_format *
fmt->fmt.pix_mp.num_planes = 1;
fmt->fmt.pix_mp.pixelformat = f->fmt.pix_mp.pixelformat;
fmt->fmt.pix_mp.plane_fmt[0].bytesperline = bytesperline;
if (is_image_session(inst))
size = bytesperline * height * 3 / 2;
else
size = call_session_op(core, buffer_size, inst, MSM_VIDC_BUF_INPUT);
size = call_session_op(core, buffer_size, inst, MSM_VIDC_BUF_INPUT);
fmt->fmt.pix_mp.plane_fmt[0].sizeimage = size;
/* update input port colorspace info */
fmt->fmt.pix_mp.colorspace = f->fmt.pix_mp.colorspace;

Ver fichero

@@ -313,8 +313,8 @@ u32 msm_vidc_encoder_input_size(struct msm_vidc_inst *inst)
colorformat = v4l2_colorformat_to_driver(inst, f->fmt.pix_mp.pixelformat,
__func__);
if (is_image_session(inst)) {
width = ALIGN(width, HEIC_GRID_DIMENSION);
height = ALIGN(height, HEIC_GRID_DIMENSION);
width = ALIGN(width, inst->capabilities[GRID_SIZE].value);
height = ALIGN(height, inst->capabilities[GRID_SIZE].value);
}
size = video_buffer_size(colorformat, width, height, true);
return size;
@@ -460,8 +460,8 @@ u32 msm_vidc_encoder_input_meta_size(struct msm_vidc_inst *inst)
width = f->fmt.pix_mp.width;
height = f->fmt.pix_mp.height;
if (is_image_session(inst)) {
width = ALIGN(width, HEIC_GRID_DIMENSION);
height = ALIGN(height, HEIC_GRID_DIMENSION);
width = ALIGN(width, inst->capabilities[GRID_SIZE].value);
height = ALIGN(height, inst->capabilities[GRID_SIZE].value);
}
size += ROI_METADATA_SIZE(width, height, lcu_size);
size = ALIGN(size, SZ_4K);

Ver fichero

@@ -5710,8 +5710,8 @@ static bool msm_vidc_allow_image_encode_session(struct msm_vidc_inst *inst)
/* is output grid dimension */
fmt = &inst->fmts[OUTPUT_PORT];
allow = fmt->fmt.pix_mp.width == HEIC_GRID_DIMENSION;
allow &= fmt->fmt.pix_mp.height == HEIC_GRID_DIMENSION;
allow = fmt->fmt.pix_mp.width == cap[GRID_SIZE].value;
allow &= fmt->fmt.pix_mp.height == cap[GRID_SIZE].value;
if (!allow) {
i_vpr_e(inst, "%s: output is not a grid dimension: %u x %u\n", __func__,
fmt->fmt.pix_mp.width, fmt->fmt.pix_mp.height);