mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-11 07:03:09 -04:00
msm: vidc: Add support for 128x32 alignment of NV12
Introduce new internal driver color format V4L2_PIX_FMT_NV12_128 and uapi color format COLOR_FMT_NV12_128 to map with NV12 128x32 alignment. Also, clean up intermediate HAL color formats. Change-Id: Ia28d0f422f2777bda865c2fc6c7499cce9dabb54 Signed-off-by: Priyanka Gujjula <pgujjula@codeaurora.org>
This commit is contained in:
parent
2686a86b94
commit
372b7136f5
10 changed files with 82 additions and 84 deletions
|
|
@ -1,6 +1,6 @@
|
|||
/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
|
||||
/*
|
||||
* Copyright (c) 2019, The Linux Foundation. All rights reserved.
|
||||
* Copyright (c) 2019-2020, The Linux Foundation. All rights reserved.
|
||||
*/
|
||||
|
||||
#ifndef __MSM_MEDIA_INFO_H__
|
||||
|
|
@ -57,6 +57,41 @@ enum color_fmts {
|
|||
* + UV_Stride * UV_Scanlines, 4096)
|
||||
*/
|
||||
COLOR_FMT_NV12,
|
||||
/* Venus NV12:
|
||||
* YUV 4:2:0 image with a plane of 8 bit Y samples followed
|
||||
* by an interleaved U/V plane containing 8 bit 2x2 subsampled
|
||||
* colour difference samples.
|
||||
*
|
||||
* <-------- Y/UV_Stride -------->
|
||||
* <------- Width ------->
|
||||
* Y Y Y Y Y Y Y Y Y Y Y Y . . . . ^ ^
|
||||
* Y Y Y Y Y Y Y Y Y Y Y Y . . . . | |
|
||||
* Y Y Y Y Y Y Y Y Y Y Y Y . . . . Height |
|
||||
* Y Y Y Y Y Y Y Y Y Y Y Y . . . . | Y_Scanlines
|
||||
* Y Y Y Y Y Y Y Y Y Y Y Y . . . . | |
|
||||
* Y Y Y Y Y Y Y Y Y Y Y Y . . . . | |
|
||||
* Y Y Y Y Y Y Y Y Y Y Y Y . . . . | |
|
||||
* Y Y Y Y Y Y Y Y Y Y Y Y . . . . V |
|
||||
* . . . . . . . . . . . . . . . . |
|
||||
* . . . . . . . . . . . . . . . . |
|
||||
* . . . . . . . . . . . . . . . . |
|
||||
* . . . . . . . . . . . . . . . . V
|
||||
* U V U V U V U V U V U V . . . . ^
|
||||
* U V U V U V U V U V U V . . . . |
|
||||
* U V U V U V U V U V U V . . . . |
|
||||
* U V U V U V U V U V U V . . . . UV_Scanlines
|
||||
* . . . . . . . . . . . . . . . . |
|
||||
* . . . . . . . . . . . . . . . . V
|
||||
* . . . . . . . . . . . . . . . . --> Buffer size alignment
|
||||
*
|
||||
* Y_Stride : Width aligned to 128
|
||||
* UV_Stride : Width aligned to 128
|
||||
* Y_Scanlines: Height aligned to 32
|
||||
* UV_Scanlines: Height/2 aligned to 16
|
||||
* Total size = align(Y_Stride * Y_Scanlines
|
||||
* + UV_Stride * UV_Scanlines, 4096)
|
||||
*/
|
||||
COLOR_FMT_NV12_128,
|
||||
/* Venus NV21:
|
||||
* YUV 4:2:0 image with a plane of 8 bit Y samples followed
|
||||
* by an interleaved V/U plane containing 8 bit 2x2 subsampled
|
||||
|
|
@ -790,6 +825,7 @@ static inline unsigned int VENUS_Y_STRIDE(unsigned int color_fmt,
|
|||
alignment = 512;
|
||||
stride = MSM_MEDIA_ALIGN(width, alignment);
|
||||
break;
|
||||
case COLOR_FMT_NV12_128:
|
||||
case COLOR_FMT_NV12_UBWC:
|
||||
alignment = 128;
|
||||
stride = MSM_MEDIA_ALIGN(width, alignment);
|
||||
|
|
@ -833,6 +869,7 @@ static inline unsigned int VENUS_UV_STRIDE(unsigned int color_fmt,
|
|||
alignment = 512;
|
||||
stride = MSM_MEDIA_ALIGN(width, alignment);
|
||||
break;
|
||||
case COLOR_FMT_NV12_128:
|
||||
case COLOR_FMT_NV12_UBWC:
|
||||
alignment = 128;
|
||||
stride = MSM_MEDIA_ALIGN(width, alignment);
|
||||
|
|
@ -875,6 +912,7 @@ static inline unsigned int VENUS_Y_SCANLINES(unsigned int color_fmt,
|
|||
case COLOR_FMT_NV12_512:
|
||||
alignment = 512;
|
||||
break;
|
||||
case COLOR_FMT_NV12_128:
|
||||
case COLOR_FMT_NV12_UBWC:
|
||||
case COLOR_FMT_P010:
|
||||
alignment = 32;
|
||||
|
|
@ -912,6 +950,7 @@ static inline unsigned int VENUS_UV_SCANLINES(unsigned int color_fmt,
|
|||
case COLOR_FMT_NV12_512:
|
||||
alignment = 256;
|
||||
break;
|
||||
case COLOR_FMT_NV12_128:
|
||||
case COLOR_FMT_NV12_BPP10_UBWC:
|
||||
case COLOR_FMT_P010_UBWC:
|
||||
case COLOR_FMT_P010:
|
||||
|
|
@ -1212,6 +1251,7 @@ static inline unsigned int VENUS_BUFFER_SIZE(unsigned int color_fmt,
|
|||
case COLOR_FMT_NV12:
|
||||
case COLOR_FMT_P010:
|
||||
case COLOR_FMT_NV12_512:
|
||||
case COLOR_FMT_NV12_128:
|
||||
y_plane = y_stride * y_sclines;
|
||||
uv_plane = uv_stride * uv_sclines;
|
||||
size = y_plane + uv_plane;
|
||||
|
|
|
|||
|
|
@ -14,6 +14,8 @@
|
|||
#define V4L2_PIX_FMT_NV12_UBWC v4l2_fourcc('Q', '1', '2', '8')
|
||||
/* NV12_512 8-bit Y/CbCr 4:2:0 */
|
||||
#define V4L2_PIX_FMT_NV12_512 v4l2_fourcc('Q', '5', '1', '2')
|
||||
/* NV12_128 8-bit Y/CbCr 4:2:0 */
|
||||
#define V4L2_PIX_FMT_NV12_128 v4l2_fourcc('N', '1', '2', '8')
|
||||
/* NV12 10-bit Y/CbCr 4:2:0 */
|
||||
#define V4L2_PIX_FMT_NV12_P010_UBWC v4l2_fourcc('Q', '1', '2', 'B')
|
||||
/* UBWC 10-bit Y/CbCr 4:2:0 */
|
||||
|
|
|
|||
|
|
@ -1036,6 +1036,11 @@ static struct msm_vidc_format_desc venc_input_formats[] = {
|
|||
.description = "Y/CbCr 4:2:0 10bit",
|
||||
.fourcc = V4L2_PIX_FMT_SDE_Y_CBCR_H2V2_P010_VENUS,
|
||||
},
|
||||
{
|
||||
.name = "YCbCr Semiplanar 4:2:0 128 aligned",
|
||||
.description = "Y/CbCr 4:2:0 128 aligned",
|
||||
.fourcc = V4L2_PIX_FMT_NV12_128,
|
||||
},
|
||||
{
|
||||
.name = "YCbCr Semiplanar 4:2:0 512 aligned",
|
||||
.description = "Y/CbCr 4:2:0 512 aligned",
|
||||
|
|
@ -1070,6 +1075,14 @@ struct msm_vidc_format_constraint enc_pix_format_constraints[] = {
|
|||
.uv_max_stride = 8192,
|
||||
.uv_buffer_alignment = 256,
|
||||
},
|
||||
{
|
||||
.fourcc = V4L2_PIX_FMT_NV12_128,
|
||||
.num_planes = 2,
|
||||
.y_max_stride = 8192,
|
||||
.y_buffer_alignment = 128,
|
||||
.uv_max_stride = 8192,
|
||||
.uv_buffer_alignment = 32,
|
||||
},
|
||||
{
|
||||
.fourcc = V4L2_PIX_FMT_NV12_512,
|
||||
.num_planes = 2,
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||
/*
|
||||
* Copyright (c) 2019, The Linux Foundation. All rights reserved.
|
||||
* Copyright (c) 2019-2020, The Linux Foundation. All rights reserved.
|
||||
*/
|
||||
|
||||
#ifndef __H_MSM_VIDC_BUS_DEFS_H__
|
||||
|
|
@ -228,30 +228,30 @@ struct lut const *__lut(int width, int height, int fps);
|
|||
fp_t __compression_ratio(struct lut const *entry, int bpp);
|
||||
void __dump(struct dump dump[], int len, u32 sid);
|
||||
|
||||
static inline bool __ubwc(enum hal_uncompressed_format f)
|
||||
static inline bool __ubwc(u32 format)
|
||||
{
|
||||
switch (f) {
|
||||
case HAL_COLOR_FORMAT_NV12_UBWC:
|
||||
case HAL_COLOR_FORMAT_NV12_TP10_UBWC:
|
||||
switch (format) {
|
||||
case HFI_COLOR_FORMAT_NV12_UBWC:
|
||||
case HFI_COLOR_FORMAT_YUV420_TP10_UBWC:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
static inline int __bpp(enum hal_uncompressed_format f, u32 sid)
|
||||
static inline int __bpp(u32 format, u32 sid)
|
||||
{
|
||||
switch (f) {
|
||||
case HAL_COLOR_FORMAT_NV12:
|
||||
case HAL_COLOR_FORMAT_NV21:
|
||||
case HAL_COLOR_FORMAT_NV12_UBWC:
|
||||
case HAL_COLOR_FORMAT_RGBA8888_UBWC:
|
||||
switch (format) {
|
||||
case HFI_COLOR_FORMAT_NV12:
|
||||
case HFI_COLOR_FORMAT_NV21:
|
||||
case HFI_COLOR_FORMAT_NV12_UBWC:
|
||||
case HFI_COLOR_FORMAT_RGBA8888_UBWC:
|
||||
return 8;
|
||||
case HAL_COLOR_FORMAT_NV12_TP10_UBWC:
|
||||
case HAL_COLOR_FORMAT_P010:
|
||||
case HFI_COLOR_FORMAT_YUV420_TP10_UBWC:
|
||||
case HFI_COLOR_FORMAT_P010:
|
||||
return 10;
|
||||
default:
|
||||
s_vpr_e(sid, "Unsupported colorformat (%x)", f);
|
||||
s_vpr_e(sid, "Unsupported colorformat (%x)", format);
|
||||
return INT_MAX;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
// SPDX-License-Identifier: GPL-2.0-only
|
||||
/*
|
||||
* Copyright (c) 2015-2019, The Linux Foundation. All rights reserved.
|
||||
* Copyright (c) 2015-2020, The Linux Foundation. All rights reserved.
|
||||
*/
|
||||
|
||||
#include "msm_vidc_bus.h"
|
||||
|
|
@ -337,7 +337,7 @@ static unsigned long __calculate_encoder(struct vidc_bus_vote_data *d)
|
|||
|
||||
b_frames_enabled = d->b_frames_enabled;
|
||||
original_color_format = d->num_formats >= 1 ?
|
||||
d->color_formats[0] : HAL_UNUSED_COLOR;
|
||||
d->color_formats[0] : HFI_COLOR_FORMAT_NV12_UBWC;
|
||||
|
||||
original_compression_enabled = __ubwc(original_color_format);
|
||||
|
||||
|
|
|
|||
|
|
@ -438,16 +438,16 @@ int msm_comm_vote_bus(struct msm_vidc_inst *inst)
|
|||
if (msm_comm_get_stream_output_mode(inst) ==
|
||||
HAL_VIDEO_DECODER_PRIMARY) {
|
||||
vote_data->color_formats[0] =
|
||||
msm_comm_get_hal_uncompressed(
|
||||
inst->clk_data.opb_fourcc);
|
||||
msm_comm_get_hfi_uncompressed(
|
||||
inst->clk_data.opb_fourcc, inst->sid);
|
||||
vote_data->num_formats = 1;
|
||||
} else {
|
||||
vote_data->color_formats[0] =
|
||||
msm_comm_get_hal_uncompressed(
|
||||
inst->clk_data.dpb_fourcc);
|
||||
msm_comm_get_hfi_uncompressed(
|
||||
inst->clk_data.dpb_fourcc, inst->sid);
|
||||
vote_data->color_formats[1] =
|
||||
msm_comm_get_hal_uncompressed(
|
||||
inst->clk_data.opb_fourcc);
|
||||
msm_comm_get_hfi_uncompressed(
|
||||
inst->clk_data.opb_fourcc, inst->sid);
|
||||
vote_data->num_formats = 2;
|
||||
}
|
||||
vote_data->work_mode = inst->clk_data.work_mode;
|
||||
|
|
|
|||
|
|
@ -852,48 +852,13 @@ enum hal_video_codec get_hal_codec(int fourcc, u32 sid)
|
|||
return codec;
|
||||
}
|
||||
|
||||
enum hal_uncompressed_format msm_comm_get_hal_uncompressed(int fourcc)
|
||||
{
|
||||
enum hal_uncompressed_format format = HAL_UNUSED_COLOR;
|
||||
|
||||
switch (fourcc) {
|
||||
case V4L2_PIX_FMT_NV12:
|
||||
format = HAL_COLOR_FORMAT_NV12;
|
||||
break;
|
||||
case V4L2_PIX_FMT_NV12_512:
|
||||
format = HAL_COLOR_FORMAT_NV12_512;
|
||||
break;
|
||||
case V4L2_PIX_FMT_NV21:
|
||||
format = HAL_COLOR_FORMAT_NV21;
|
||||
break;
|
||||
case V4L2_PIX_FMT_NV12_UBWC:
|
||||
format = HAL_COLOR_FORMAT_NV12_UBWC;
|
||||
break;
|
||||
case V4L2_PIX_FMT_NV12_TP10_UBWC:
|
||||
format = HAL_COLOR_FORMAT_NV12_TP10_UBWC;
|
||||
break;
|
||||
case V4L2_PIX_FMT_SDE_Y_CBCR_H2V2_P010_VENUS:
|
||||
format = HAL_COLOR_FORMAT_P010;
|
||||
break;
|
||||
case V4L2_PIX_FMT_RGBA8888_UBWC:
|
||||
format = HAL_COLOR_FORMAT_RGBA8888_UBWC;
|
||||
break;
|
||||
default:
|
||||
format = HAL_UNUSED_COLOR;
|
||||
break;
|
||||
}
|
||||
|
||||
return format;
|
||||
}
|
||||
|
||||
u32 msm_comm_get_hfi_uncompressed(int fourcc, u32 sid)
|
||||
{
|
||||
u32 format;
|
||||
|
||||
switch (fourcc) {
|
||||
case V4L2_PIX_FMT_NV12:
|
||||
format = HFI_COLOR_FORMAT_NV12;
|
||||
break;
|
||||
case V4L2_PIX_FMT_NV12_128:
|
||||
case V4L2_PIX_FMT_NV12_512:
|
||||
format = HFI_COLOR_FORMAT_NV12;
|
||||
break;
|
||||
|
|
@ -3718,6 +3683,8 @@ u32 msm_comm_convert_color_fmt(u32 v4l2_fmt, u32 sid)
|
|||
return COLOR_FMT_NV12;
|
||||
case V4L2_PIX_FMT_NV21:
|
||||
return COLOR_FMT_NV21;
|
||||
case V4L2_PIX_FMT_NV12_128:
|
||||
return COLOR_FMT_NV12_128;
|
||||
case V4L2_PIX_FMT_NV12_512:
|
||||
return COLOR_FMT_NV12_512;
|
||||
case V4L2_PIX_FMT_SDE_Y_CBCR_H2V2_P010_VENUS:
|
||||
|
|
|
|||
|
|
@ -344,7 +344,6 @@ int msm_comm_get_v4l2_profile(int fourcc, int profile, u32 sid);
|
|||
int msm_comm_get_v4l2_level(int fourcc, int level, u32 sid);
|
||||
int msm_comm_session_continue(void *instance);
|
||||
int msm_vidc_send_pending_eos_buffers(struct msm_vidc_inst *inst);
|
||||
enum hal_uncompressed_format msm_comm_get_hal_uncompressed(int fourcc);
|
||||
u32 msm_comm_get_hfi_uncompressed(int fourcc, u32 sid);
|
||||
u32 msm_comm_convert_color_fmt(u32 v4l2_fmt, u32 sid);
|
||||
struct vb2_buffer *msm_comm_get_vb_using_vidc_buffer(
|
||||
|
|
|
|||
|
|
@ -411,7 +411,7 @@ struct vidc_bus_vote_data {
|
|||
u32 sid;
|
||||
enum hal_domain domain;
|
||||
enum hal_video_codec codec;
|
||||
enum hal_uncompressed_format color_formats[2];
|
||||
u32 color_formats[2];
|
||||
int num_formats; /* 1 = DPB-OPB unified; 2 = split */
|
||||
int input_height, input_width, bitrate;
|
||||
int output_height, output_width;
|
||||
|
|
|
|||
|
|
@ -129,29 +129,6 @@ enum hal_video_codec {
|
|||
HAL_UNUSED_CODEC = 0x10000000,
|
||||
};
|
||||
|
||||
enum hal_uncompressed_format {
|
||||
HAL_COLOR_FORMAT_MONOCHROME = 0x00000001,
|
||||
HAL_COLOR_FORMAT_NV12 = 0x00000002,
|
||||
HAL_COLOR_FORMAT_NV21 = 0x00000004,
|
||||
HAL_COLOR_FORMAT_NV12_4x4TILE = 0x00000008,
|
||||
HAL_COLOR_FORMAT_NV21_4x4TILE = 0x00000010,
|
||||
HAL_COLOR_FORMAT_YUYV = 0x00000020,
|
||||
HAL_COLOR_FORMAT_YVYU = 0x00000040,
|
||||
HAL_COLOR_FORMAT_UYVY = 0x00000080,
|
||||
HAL_COLOR_FORMAT_VYUY = 0x00000100,
|
||||
HAL_COLOR_FORMAT_RGB565 = 0x00000200,
|
||||
HAL_COLOR_FORMAT_BGR565 = 0x00000400,
|
||||
HAL_COLOR_FORMAT_RGB888 = 0x00000800,
|
||||
HAL_COLOR_FORMAT_BGR888 = 0x00001000,
|
||||
HAL_COLOR_FORMAT_NV12_UBWC = 0x00002000,
|
||||
HAL_COLOR_FORMAT_NV12_TP10_UBWC = 0x00004000,
|
||||
HAL_COLOR_FORMAT_RGBA8888 = 0x00008000,
|
||||
HAL_COLOR_FORMAT_RGBA8888_UBWC = 0x00010000,
|
||||
HAL_COLOR_FORMAT_P010 = 0x00020000,
|
||||
HAL_COLOR_FORMAT_NV12_512 = 0x00040000,
|
||||
HAL_UNUSED_COLOR = 0x10000000,
|
||||
};
|
||||
|
||||
enum hal_ssr_trigger_type {
|
||||
SSR_ERR_FATAL = 1,
|
||||
SSR_SW_DIV_BY_ZERO,
|
||||
|
|
|
|||
Loading…
Reference in a new issue