mirror of
https://github.com/LibreELEC/LibreELEC.tv.git
synced 2025-07-30 22:26:42 +00:00
linux (Allwinner): rebase patches for 6.0-rc2
This commit is contained in:
parent
dfddef788f
commit
7487a3f54b
@ -1,175 +0,0 @@
|
||||
From 9e203d78974aa445086dbe6b667e49b3f00d36d0 Mon Sep 17 00:00:00 2001
|
||||
From: Jernej Skrabec <jernej.skrabec@siol.net>
|
||||
Date: Sat, 26 Oct 2019 21:23:55 +0200
|
||||
Subject: [PATCH 27/44] media: cedrus: hevc: tiles hack
|
||||
|
||||
Signed-off-by: Jernej Skrabec <jernej.skrabec@siol.net>
|
||||
---
|
||||
drivers/staging/media/sunxi/cedrus/cedrus.h | 2 +
|
||||
.../staging/media/sunxi/cedrus/cedrus_h265.c | 93 +++++++++++++++++--
|
||||
include/media/hevc-ctrls.h | 5 +-
|
||||
3 files changed, 93 insertions(+), 7 deletions(-)
|
||||
|
||||
--- a/drivers/staging/media/sunxi/cedrus/cedrus.h
|
||||
+++ b/drivers/staging/media/sunxi/cedrus/cedrus.h
|
||||
@@ -144,6 +144,8 @@ struct cedrus_ctx {
|
||||
ssize_t mv_col_buf_unit_size;
|
||||
void *neighbor_info_buf;
|
||||
dma_addr_t neighbor_info_buf_addr;
|
||||
+ void *entry_points_buf;
|
||||
+ dma_addr_t entry_points_buf_addr;
|
||||
} h265;
|
||||
struct {
|
||||
unsigned int last_frame_p_type;
|
||||
--- a/drivers/staging/media/sunxi/cedrus/cedrus_h265.c
|
||||
+++ b/drivers/staging/media/sunxi/cedrus/cedrus_h265.c
|
||||
@@ -301,6 +301,61 @@ static void cedrus_h265_write_scaling_li
|
||||
}
|
||||
}
|
||||
|
||||
+static void write_entry_point_list(struct cedrus_ctx *ctx,
|
||||
+ struct cedrus_run *run,
|
||||
+ unsigned int ctb_addr_x,
|
||||
+ unsigned int ctb_addr_y)
|
||||
+{
|
||||
+ const struct v4l2_ctrl_hevc_slice_params *slice_params;
|
||||
+ const struct v4l2_ctrl_hevc_pps *pps;
|
||||
+ struct cedrus_dev *dev = ctx->dev;
|
||||
+ int i, x, tx, y, ty;
|
||||
+ u32 *entry_points;
|
||||
+
|
||||
+ pps = run->h265.pps;
|
||||
+ slice_params = run->h265.slice_params;
|
||||
+
|
||||
+ for (x = 0, tx = 0; tx < pps->num_tile_columns_minus1 + 1; tx++) {
|
||||
+ if (x + pps->column_width_minus1[tx] + 1 > ctb_addr_x)
|
||||
+ break;
|
||||
+
|
||||
+ x += pps->column_width_minus1[tx] + 1;
|
||||
+ }
|
||||
+
|
||||
+ for (y = 0, ty = 0; ty < pps->num_tile_rows_minus1 + 1; ty++) {
|
||||
+ if (y + pps->row_height_minus1[ty] + 1 > ctb_addr_y)
|
||||
+ break;
|
||||
+
|
||||
+ y += pps->row_height_minus1[ty] + 1;
|
||||
+ }
|
||||
+
|
||||
+ cedrus_write(dev, VE_DEC_H265_TILE_START_CTB, (y << 16) | (x << 0));
|
||||
+ cedrus_write(dev, VE_DEC_H265_TILE_END_CTB,
|
||||
+ ((y + pps->row_height_minus1[ty]) << 16) |
|
||||
+ ((x + pps->column_width_minus1[tx]) << 0));
|
||||
+
|
||||
+ entry_points = ctx->codec.h265.entry_points_buf;
|
||||
+ if (pps->flags & V4L2_HEVC_PPS_FLAG_ENTROPY_CODING_SYNC_ENABLED) {
|
||||
+ for (i = 0; i < slice_params->num_entry_point_offsets; i++)
|
||||
+ entry_points[i] = slice_params->entry_point_offset_minus1[i] + 1;
|
||||
+ } else {
|
||||
+ for (i = 0; i < slice_params->num_entry_point_offsets; i++) {
|
||||
+ if (tx + 1 >= pps->num_tile_columns_minus1 + 1) {
|
||||
+ x = 0;
|
||||
+ tx = 0;
|
||||
+ y += pps->row_height_minus1[ty++] + 1;
|
||||
+ } else {
|
||||
+ x += pps->column_width_minus1[tx++] + 1;
|
||||
+ }
|
||||
+
|
||||
+ entry_points[i * 4 + 0] = slice_params->entry_point_offset_minus1[i] + 1;
|
||||
+ entry_points[i * 4 + 1] = 0x0;
|
||||
+ entry_points[i * 4 + 2] = (y << 16) | (x << 0);
|
||||
+ entry_points[i * 4 + 3] = ((y + pps->row_height_minus1[ty]) << 16) | ((x + pps->column_width_minus1[tx]) << 0);
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
static void cedrus_h265_setup(struct cedrus_ctx *ctx,
|
||||
struct cedrus_run *run)
|
||||
{
|
||||
@@ -312,6 +367,7 @@ static void cedrus_h265_setup(struct ced
|
||||
const struct v4l2_hevc_pred_weight_table *pred_weight_table;
|
||||
unsigned int width_in_ctb_luma, ctb_size_luma;
|
||||
unsigned int log2_max_luma_coding_block_size;
|
||||
+ unsigned int ctb_addr_x, ctb_addr_y;
|
||||
dma_addr_t src_buf_addr;
|
||||
dma_addr_t src_buf_end_addr;
|
||||
u32 chroma_log2_weight_denom;
|
||||
@@ -390,12 +446,19 @@ static void cedrus_h265_setup(struct ced
|
||||
cedrus_write(dev, VE_DEC_H265_BITS_END_ADDR, reg);
|
||||
|
||||
/* Coding tree block address */
|
||||
- reg = VE_DEC_H265_DEC_CTB_ADDR_X(slice_params->slice_segment_addr % width_in_ctb_luma);
|
||||
- reg |= VE_DEC_H265_DEC_CTB_ADDR_Y(slice_params->slice_segment_addr / width_in_ctb_luma);
|
||||
+ ctb_addr_x = slice_params->slice_segment_addr % width_in_ctb_luma;
|
||||
+ ctb_addr_y = slice_params->slice_segment_addr / width_in_ctb_luma;
|
||||
+ reg = VE_DEC_H265_DEC_CTB_ADDR_X(ctb_addr_x);
|
||||
+ reg |= VE_DEC_H265_DEC_CTB_ADDR_Y(ctb_addr_y);
|
||||
cedrus_write(dev, VE_DEC_H265_DEC_CTB_ADDR, reg);
|
||||
|
||||
- cedrus_write(dev, VE_DEC_H265_TILE_START_CTB, 0);
|
||||
- cedrus_write(dev, VE_DEC_H265_TILE_END_CTB, 0);
|
||||
+ if ((pps->flags & V4L2_HEVC_PPS_FLAG_TILES_ENABLED) ||
|
||||
+ (pps->flags & V4L2_HEVC_PPS_FLAG_ENTROPY_CODING_SYNC_ENABLED)) {
|
||||
+ write_entry_point_list(ctx, run, ctb_addr_x, ctb_addr_y);
|
||||
+ } else {
|
||||
+ cedrus_write(dev, VE_DEC_H265_TILE_START_CTB, 0);
|
||||
+ cedrus_write(dev, VE_DEC_H265_TILE_END_CTB, 0);
|
||||
+ }
|
||||
|
||||
/* Clear the number of correctly-decoded coding tree blocks. */
|
||||
if (ctx->fh.m2m_ctx->new_frame)
|
||||
@@ -499,7 +562,9 @@ static void cedrus_h265_setup(struct ced
|
||||
V4L2_HEVC_PPS_FLAG_ENTROPY_CODING_SYNC_ENABLED,
|
||||
pps->flags);
|
||||
|
||||
- /* TODO: VE_DEC_H265_DEC_PPS_CTRL1_FLAG_TILES_ENABLED */
|
||||
+ reg |= VE_DEC_H265_FLAG(VE_DEC_H265_DEC_PPS_CTRL1_FLAG_TILES_ENABLED,
|
||||
+ V4L2_HEVC_PPS_FLAG_TILES_ENABLED,
|
||||
+ pps->flags);
|
||||
|
||||
reg |= VE_DEC_H265_FLAG(VE_DEC_H265_DEC_PPS_CTRL1_FLAG_TRANSQUANT_BYPASS_ENABLED,
|
||||
V4L2_HEVC_PPS_FLAG_TRANSQUANT_BYPASS_ENABLED,
|
||||
@@ -575,12 +640,14 @@ static void cedrus_h265_setup(struct ced
|
||||
|
||||
chroma_log2_weight_denom = pred_weight_table->luma_log2_weight_denom +
|
||||
pred_weight_table->delta_chroma_log2_weight_denom;
|
||||
- reg = VE_DEC_H265_DEC_SLICE_HDR_INFO2_NUM_ENTRY_POINT_OFFSETS(0) |
|
||||
+ reg = VE_DEC_H265_DEC_SLICE_HDR_INFO2_NUM_ENTRY_POINT_OFFSETS(slice_params->num_entry_point_offsets) |
|
||||
VE_DEC_H265_DEC_SLICE_HDR_INFO2_CHROMA_LOG2_WEIGHT_DENOM(chroma_log2_weight_denom) |
|
||||
VE_DEC_H265_DEC_SLICE_HDR_INFO2_LUMA_LOG2_WEIGHT_DENOM(pred_weight_table->luma_log2_weight_denom);
|
||||
|
||||
cedrus_write(dev, VE_DEC_H265_DEC_SLICE_HDR_INFO2, reg);
|
||||
|
||||
+ cedrus_write(dev, VE_DEC_H265_ENTRY_POINT_OFFSET_ADDR, ctx->codec.h265.entry_points_buf_addr >> 8);
|
||||
+
|
||||
/* Decoded picture size. */
|
||||
|
||||
reg = VE_DEC_H265_DEC_PIC_SIZE_WIDTH(ctx->src_fmt.width) |
|
||||
@@ -674,6 +741,18 @@ static int cedrus_h265_start(struct cedr
|
||||
if (!ctx->codec.h265.neighbor_info_buf)
|
||||
return -ENOMEM;
|
||||
|
||||
+ ctx->codec.h265.entry_points_buf =
|
||||
+ dma_alloc_coherent(dev->dev, CEDRUS_H265_ENTRY_POINTS_BUF_SIZE,
|
||||
+ &ctx->codec.h265.entry_points_buf_addr,
|
||||
+ GFP_KERNEL);
|
||||
+ if (!ctx->codec.h265.entry_points_buf) {
|
||||
+ dma_free_attrs(dev->dev, CEDRUS_H265_NEIGHBOR_INFO_BUF_SIZE,
|
||||
+ ctx->codec.h265.neighbor_info_buf,
|
||||
+ ctx->codec.h265.neighbor_info_buf_addr,
|
||||
+ DMA_ATTR_NO_KERNEL_MAPPING);
|
||||
+ return -ENOMEM;
|
||||
+ }
|
||||
+
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -693,6 +772,9 @@ static void cedrus_h265_stop(struct cedr
|
||||
ctx->codec.h265.neighbor_info_buf,
|
||||
ctx->codec.h265.neighbor_info_buf_addr,
|
||||
DMA_ATTR_NO_KERNEL_MAPPING);
|
||||
+ dma_free_coherent(dev->dev, CEDRUS_H265_ENTRY_POINTS_BUF_SIZE,
|
||||
+ ctx->codec.h265.entry_points_buf,
|
||||
+ ctx->codec.h265.entry_points_buf_addr);
|
||||
}
|
||||
|
||||
static void cedrus_h265_trigger(struct cedrus_ctx *ctx)
|
@ -133,7 +133,7 @@ index 4b01d3881214..4d425196d415 100644
|
||||
}
|
||||
}
|
||||
|
||||
@@ -388,37 +428,6 @@ static void cedrus_h265_setup(struct cedrus_ctx *ctx,
|
||||
@@ -388,36 +428,6 @@ static void cedrus_h265_setup(struct cedrus_ctx *ctx,
|
||||
width_in_ctb_luma =
|
||||
DIV_ROUND_UP(sps->pic_width_in_luma_samples, ctb_size_luma);
|
||||
|
||||
@ -163,8 +163,7 @@ index 4b01d3881214..4d425196d415 100644
|
||||
- GFP_KERNEL, DMA_ATTR_NO_KERNEL_MAPPING);
|
||||
- if (!ctx->codec.h265.mv_col_buf) {
|
||||
- ctx->codec.h265.mv_col_buf_size = 0;
|
||||
- // TODO: Abort the process here.
|
||||
- return;
|
||||
- return -ENOMEM;
|
||||
- }
|
||||
- }
|
||||
-
|
||||
|
@ -1,61 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Jonas Karlman <jonas@kwiboo.se>
|
||||
Date: Sat, 23 May 2020 15:03:46 +0000
|
||||
Subject: [PATCH] WIP: media: uapi: hevc: add fields needed for rkvdec
|
||||
|
||||
NOTE: these fields are used by rkvdec hevc backend
|
||||
|
||||
Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
|
||||
---
|
||||
include/media/hevc-ctrls.h | 16 ++++++++++++----
|
||||
1 file changed, 12 insertions(+), 4 deletions(-)
|
||||
|
||||
--- a/include/media/hevc-ctrls.h
|
||||
+++ b/include/media/hevc-ctrls.h
|
||||
@@ -58,6 +58,8 @@ enum v4l2_mpeg_video_hevc_start_code {
|
||||
/* The controls are not stable at the moment and will likely be reworked. */
|
||||
struct v4l2_ctrl_hevc_sps {
|
||||
/* ISO/IEC 23008-2, ITU-T Rec. H.265: Sequence parameter set */
|
||||
+ __u8 video_parameter_set_id;
|
||||
+ __u8 seq_parameter_set_id;
|
||||
__u16 pic_width_in_luma_samples;
|
||||
__u16 pic_height_in_luma_samples;
|
||||
__u8 bit_depth_luma_minus8;
|
||||
@@ -81,6 +83,8 @@ struct v4l2_ctrl_hevc_sps {
|
||||
__u8 chroma_format_idc;
|
||||
__u8 sps_max_sub_layers_minus1;
|
||||
|
||||
+ __u8 padding[6];
|
||||
+
|
||||
__u64 flags;
|
||||
};
|
||||
|
||||
@@ -108,6 +112,7 @@ struct v4l2_ctrl_hevc_sps {
|
||||
|
||||
struct v4l2_ctrl_hevc_pps {
|
||||
/* ISO/IEC 23008-2, ITU-T Rec. H.265: Picture parameter set */
|
||||
+ __u8 pic_parameter_set_id;
|
||||
__u8 num_extra_slice_header_bits;
|
||||
__u8 num_ref_idx_l0_default_active_minus1;
|
||||
__u8 num_ref_idx_l1_default_active_minus1;
|
||||
@@ -123,7 +128,7 @@ struct v4l2_ctrl_hevc_pps {
|
||||
__s8 pps_tc_offset_div2;
|
||||
__u8 log2_parallel_merge_level_minus2;
|
||||
|
||||
- __u8 padding[4];
|
||||
+ __u8 padding;
|
||||
__u64 flags;
|
||||
};
|
||||
|
||||
@@ -202,7 +207,10 @@ struct v4l2_ctrl_hevc_slice_params {
|
||||
__u8 ref_idx_l0[V4L2_HEVC_DPB_ENTRIES_NUM_MAX];
|
||||
__u8 ref_idx_l1[V4L2_HEVC_DPB_ENTRIES_NUM_MAX];
|
||||
|
||||
- __u8 padding;
|
||||
+ __u16 short_term_ref_pic_set_size;
|
||||
+ __u16 long_term_ref_pic_set_size;
|
||||
+
|
||||
+ __u8 padding[4];
|
||||
|
||||
/* ISO/IEC 23008-2, ITU-T Rec. H.265: Weighted prediction parameter */
|
||||
struct v4l2_hevc_pred_weight_table pred_weight_table;
|
@ -4,29 +4,28 @@ Date: Sat, 23 May 2020 15:07:15 +0000
|
||||
Subject: [PATCH] HACK: media: uapi: hevc: tiles and num_slices
|
||||
|
||||
---
|
||||
include/media/hevc-ctrls.h | 8 ++++++--
|
||||
include/uapi/linux/v4l2-controls.h | 8 ++++++--
|
||||
1 file changed, 6 insertions(+), 2 deletions(-)
|
||||
|
||||
--- a/include/media/hevc-ctrls.h
|
||||
+++ b/include/media/hevc-ctrls.h
|
||||
@@ -83,7 +83,8 @@ struct v4l2_ctrl_hevc_sps {
|
||||
--- a/include/uapi/linux/v4l2-controls.h
|
||||
+++ b/include/uapi/linux/v4l2-controls.h
|
||||
@@ -2118,7 +2118,8 @@ struct v4l2_ctrl_hevc_sps {
|
||||
__u8 chroma_format_idc;
|
||||
__u8 sps_max_sub_layers_minus1;
|
||||
|
||||
- __u8 padding[6];
|
||||
- __u8 reserved[6];
|
||||
+ __u8 num_slices;
|
||||
+ __u8 padding[5];
|
||||
|
||||
+ __u8 reserved[5];
|
||||
__u64 flags;
|
||||
};
|
||||
@@ -210,7 +211,9 @@ struct v4l2_ctrl_hevc_slice_params {
|
||||
|
||||
@@ -2375,6 +2376,9 @@ struct v4l2_ctrl_hevc_slice_params {
|
||||
__u16 short_term_ref_pic_set_size;
|
||||
__u16 long_term_ref_pic_set_size;
|
||||
|
||||
- __u8 padding[4];
|
||||
+ __u32 num_entry_point_offsets;
|
||||
+ __u32 entry_point_offset_minus1[256];
|
||||
+ __u8 padding[8];
|
||||
|
||||
+ __u8 reserved[8];
|
||||
+
|
||||
/* ISO/IEC 23008-2, ITU-T Rec. H.265: Weighted prediction parameter */
|
||||
struct v4l2_hevc_pred_weight_table pred_weight_table;
|
||||
|
||||
|
@ -108,7 +108,7 @@ Signed-off-by: Jernej Skrabec <jernej.skrabec@siol.net>
|
||||
if (!fmt)
|
||||
return -EINVAL;
|
||||
|
||||
+ sps = cedrus_find_control_data(ctx, V4L2_CID_MPEG_VIDEO_HEVC_SPS);
|
||||
+ sps = cedrus_find_control_data(ctx, V4L2_CID_STATELESS_HEVC_SPS);
|
||||
+
|
||||
+ /* The 10-bitHEVC decoder needs extra size on the output buffer. */
|
||||
+ extended = ctx->src_fmt.pixelformat == V4L2_PIX_FMT_HEVC_SLICE &&
|
||||
|
@ -66,7 +66,7 @@ index bffe1b9cd3dc..61c97619cba1 100644
|
||||
@@ -174,6 +185,8 @@ struct sun8i_hdmi_phy {
|
||||
struct regmap *regs;
|
||||
struct reset_control *rst_phy;
|
||||
struct sun8i_hdmi_phy_variant *variant;
|
||||
const struct sun8i_hdmi_phy_variant *variant;
|
||||
+ unsigned int disable_cec : 1;
|
||||
+ unsigned int bit_bang_cec : 1;
|
||||
};
|
||||
@ -182,7 +182,7 @@ index b64d93da651d..e2936e7745b8 100644
|
||||
static int sun8i_hdmi_phy_probe(struct platform_device *pdev)
|
||||
@@ -690,6 +758,14 @@ static int sun8i_hdmi_phy_probe(struct platform_device *pdev)
|
||||
|
||||
phy->variant = (struct sun8i_hdmi_phy_variant *)match->data;
|
||||
phy->variant = of_device_get_match_data(dev);
|
||||
phy->dev = dev;
|
||||
+ phy->disable_cec = of_machine_is_compatible("roofull,beelink-x2") ||
|
||||
+ of_machine_is_compatible("friendlyarm,nanopi-m1") ||
|
||||
@ -193,15 +193,5 @@ index b64d93da651d..e2936e7745b8 100644
|
||||
+ phy->bit_bang_cec = phy->disable_cec &&
|
||||
+ !of_machine_is_compatible("roofull,beelink-x2");
|
||||
|
||||
ret = of_address_to_resource(node, 0, &res);
|
||||
if (ret) {
|
||||
@@ -768,6 +844,9 @@ static int sun8i_hdmi_phy_remove(struct platform_device *pdev)
|
||||
{
|
||||
struct sun8i_hdmi_phy *phy = platform_get_drvdata(pdev);
|
||||
|
||||
+ cec_notifier_cec_adap_unregister(phy->cec_notifier, phy->cec_adapter);
|
||||
+ cec_unregister_adapter(phy->cec_adapter);
|
||||
+
|
||||
reset_control_put(phy->rst_phy);
|
||||
|
||||
clk_put(phy->clk_pll0);
|
||||
regs = devm_platform_ioremap_resource(pdev, 0);
|
||||
if (IS_ERR(regs))
|
||||
|
@ -1,52 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Ezequiel Garcia <ezequiel@vanguardiasur.com.ar>
|
||||
Date: Sun, 27 Feb 2022 08:43:18 +0100
|
||||
Subject: [PATCH] media: Add P010 tiled format
|
||||
|
||||
Add P010 tiled format
|
||||
|
||||
Signed-off-by: Ezequiel Garcia <ezequiel@vanguardiasur.com.ar>
|
||||
[rebased and updated pixel format name]
|
||||
Signed-off-by: Jernej Skrabec <jernej.skrabec@gmail.com>
|
||||
---
|
||||
drivers/media/v4l2-core/v4l2-common.c | 1 +
|
||||
drivers/media/v4l2-core/v4l2-ioctl.c | 1 +
|
||||
include/uapi/linux/videodev2.h | 1 +
|
||||
3 files changed, 3 insertions(+)
|
||||
|
||||
diff --git a/drivers/media/v4l2-core/v4l2-common.c b/drivers/media/v4l2-core/v4l2-common.c
|
||||
index df34b2a283bc..1db0020e08c0 100644
|
||||
--- a/drivers/media/v4l2-core/v4l2-common.c
|
||||
+++ b/drivers/media/v4l2-core/v4l2-common.c
|
||||
@@ -277,6 +277,7 @@ const struct v4l2_format_info *v4l2_format_info(u32 format)
|
||||
|
||||
/* Tiled YUV formats */
|
||||
{ .format = V4L2_PIX_FMT_NV12_4L4, .pixel_enc = V4L2_PIXEL_ENC_YUV, .mem_planes = 1, .comp_planes = 2, .bpp = { 1, 2, 0, 0 }, .hdiv = 2, .vdiv = 2 },
|
||||
+ { .format = V4L2_PIX_FMT_P010_4L4, .pixel_enc = V4L2_PIXEL_ENC_YUV, .mem_planes = 1, .comp_planes = 2, .bpp = { 2, 4, 0, 0 }, .hdiv = 2, .vdiv = 2 },
|
||||
|
||||
/* YUV planar formats, non contiguous variant */
|
||||
{ .format = V4L2_PIX_FMT_YUV420M, .pixel_enc = V4L2_PIXEL_ENC_YUV, .mem_planes = 3, .comp_planes = 3, .bpp = { 1, 1, 1, 0 }, .hdiv = 2, .vdiv = 2 },
|
||||
diff --git a/drivers/media/v4l2-core/v4l2-ioctl.c b/drivers/media/v4l2-core/v4l2-ioctl.c
|
||||
index 9ac557b8e146..048f326c57b9 100644
|
||||
--- a/drivers/media/v4l2-core/v4l2-ioctl.c
|
||||
+++ b/drivers/media/v4l2-core/v4l2-ioctl.c
|
||||
@@ -1302,6 +1302,7 @@ static void v4l_fill_fmtdesc(struct v4l2_fmtdesc *fmt)
|
||||
case V4L2_PIX_FMT_NV12_4L4: descr = "Y/CbCr 4:2:0 (4x4 Linear)"; break;
|
||||
case V4L2_PIX_FMT_NV12_16L16: descr = "Y/CbCr 4:2:0 (16x16 Linear)"; break;
|
||||
case V4L2_PIX_FMT_NV12_32L32: descr = "Y/CbCr 4:2:0 (32x32 Linear)"; break;
|
||||
+ case V4L2_PIX_FMT_P010_4L4: descr = "P010 tiled"; break;
|
||||
case V4L2_PIX_FMT_NV12M: descr = "Y/CbCr 4:2:0 (N-C)"; break;
|
||||
case V4L2_PIX_FMT_NV21M: descr = "Y/CrCb 4:2:0 (N-C)"; break;
|
||||
case V4L2_PIX_FMT_NV16M: descr = "Y/CbCr 4:2:2 (N-C)"; break;
|
||||
diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h
|
||||
index df8b9c486ba1..772dbadd1a24 100644
|
||||
--- a/include/uapi/linux/videodev2.h
|
||||
+++ b/include/uapi/linux/videodev2.h
|
||||
@@ -628,6 +628,7 @@ struct v4l2_pix_format {
|
||||
#define V4L2_PIX_FMT_NV12_4L4 v4l2_fourcc('V', 'T', '1', '2') /* 12 Y/CbCr 4:2:0 4x4 tiles */
|
||||
#define V4L2_PIX_FMT_NV12_16L16 v4l2_fourcc('H', 'M', '1', '2') /* 12 Y/CbCr 4:2:0 16x16 tiles */
|
||||
#define V4L2_PIX_FMT_NV12_32L32 v4l2_fourcc('S', 'T', '1', '2') /* 12 Y/CbCr 4:2:0 32x32 tiles */
|
||||
+#define V4L2_PIX_FMT_P010_4L4 v4l2_fourcc('T', '0', '1', '0') /* 12 Y/CbCr 4:2:0 10-bit 4x4 macroblocks */
|
||||
|
||||
/* Tiled YUV formats, non contiguous planes */
|
||||
#define V4L2_PIX_FMT_NV12MT v4l2_fourcc('T', 'M', '1', '2') /* 12 Y/CbCr 4:2:0 64x32 tiles */
|
@ -1,51 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Jernej Skrabec <jernej.skrabec@gmail.com>
|
||||
Date: Sun, 27 Feb 2022 09:01:00 +0100
|
||||
Subject: [PATCH] media: Add P010 format
|
||||
|
||||
Add P010 format, which is commonly used for 10-bit videos.
|
||||
|
||||
Signed-off-by: Jernej Skrabec <jernej.skrabec@gmail.com>
|
||||
---
|
||||
drivers/media/v4l2-core/v4l2-common.c | 2 ++
|
||||
drivers/media/v4l2-core/v4l2-ioctl.c | 1 +
|
||||
include/uapi/linux/videodev2.h | 1 +
|
||||
3 files changed, 4 insertions(+)
|
||||
|
||||
diff --git a/drivers/media/v4l2-core/v4l2-common.c b/drivers/media/v4l2-core/v4l2-common.c
|
||||
index 1db0020e08c0..4ede36546e9c 100644
|
||||
--- a/drivers/media/v4l2-core/v4l2-common.c
|
||||
+++ b/drivers/media/v4l2-core/v4l2-common.c
|
||||
@@ -275,6 +275,8 @@ const struct v4l2_format_info *v4l2_format_info(u32 format)
|
||||
{ .format = V4L2_PIX_FMT_YUV422P, .pixel_enc = V4L2_PIXEL_ENC_YUV, .mem_planes = 1, .comp_planes = 3, .bpp = { 1, 1, 1, 0 }, .hdiv = 2, .vdiv = 1 },
|
||||
{ .format = V4L2_PIX_FMT_GREY, .pixel_enc = V4L2_PIXEL_ENC_YUV, .mem_planes = 1, .comp_planes = 1, .bpp = { 1, 0, 0, 0 }, .hdiv = 1, .vdiv = 1 },
|
||||
|
||||
+ { .format = V4L2_PIX_FMT_P010, .pixel_enc = V4L2_PIXEL_ENC_YUV, .mem_planes = 1, .comp_planes = 2, .bpp = { 2, 4, 0, 0 }, .hdiv = 2, .vdiv = 2 },
|
||||
+
|
||||
/* Tiled YUV formats */
|
||||
{ .format = V4L2_PIX_FMT_NV12_4L4, .pixel_enc = V4L2_PIXEL_ENC_YUV, .mem_planes = 1, .comp_planes = 2, .bpp = { 1, 2, 0, 0 }, .hdiv = 2, .vdiv = 2 },
|
||||
{ .format = V4L2_PIX_FMT_P010_4L4, .pixel_enc = V4L2_PIXEL_ENC_YUV, .mem_planes = 1, .comp_planes = 2, .bpp = { 2, 4, 0, 0 }, .hdiv = 2, .vdiv = 2 },
|
||||
diff --git a/drivers/media/v4l2-core/v4l2-ioctl.c b/drivers/media/v4l2-core/v4l2-ioctl.c
|
||||
index 048f326c57b9..a8d999e23e5b 100644
|
||||
--- a/drivers/media/v4l2-core/v4l2-ioctl.c
|
||||
+++ b/drivers/media/v4l2-core/v4l2-ioctl.c
|
||||
@@ -1295,6 +1295,7 @@ static void v4l_fill_fmtdesc(struct v4l2_fmtdesc *fmt)
|
||||
case V4L2_PIX_FMT_M420: descr = "YUV 4:2:0 (M420)"; break;
|
||||
case V4L2_PIX_FMT_NV12: descr = "Y/CbCr 4:2:0"; break;
|
||||
case V4L2_PIX_FMT_NV21: descr = "Y/CrCb 4:2:0"; break;
|
||||
+ case V4L2_PIX_FMT_P010: descr = "10-bit Y/CbCr 4:2:0"; break;
|
||||
case V4L2_PIX_FMT_NV16: descr = "Y/CbCr 4:2:2"; break;
|
||||
case V4L2_PIX_FMT_NV61: descr = "Y/CrCb 4:2:2"; break;
|
||||
case V4L2_PIX_FMT_NV24: descr = "Y/CbCr 4:4:4"; break;
|
||||
diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h
|
||||
index 772dbadd1a24..211bc11a48cb 100644
|
||||
--- a/include/uapi/linux/videodev2.h
|
||||
+++ b/include/uapi/linux/videodev2.h
|
||||
@@ -597,6 +597,7 @@ struct v4l2_pix_format {
|
||||
/* two planes -- one Y, one Cr + Cb interleaved */
|
||||
#define V4L2_PIX_FMT_NV12 v4l2_fourcc('N', 'V', '1', '2') /* 12 Y/CbCr 4:2:0 */
|
||||
#define V4L2_PIX_FMT_NV21 v4l2_fourcc('N', 'V', '2', '1') /* 12 Y/CrCb 4:2:0 */
|
||||
+#define V4L2_PIX_FMT_P010 v4l2_fourcc('P', '0', '1', '0') /* 24 Y/CbCr 4:2:0 10-bit */
|
||||
#define V4L2_PIX_FMT_NV16 v4l2_fourcc('N', 'V', '1', '6') /* 16 Y/CbCr 4:2:2 */
|
||||
#define V4L2_PIX_FMT_NV61 v4l2_fourcc('N', 'V', '6', '1') /* 16 Y/CrCb 4:2:2 */
|
||||
#define V4L2_PIX_FMT_NV24 v4l2_fourcc('N', 'V', '2', '4') /* 24 Y/CbCr 4:4:4 */
|
@ -1,151 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Jernej Skrabec <jernej.skrabec@gmail.com>
|
||||
Date: Sun, 27 Feb 2022 14:59:04 +0100
|
||||
Subject: [PATCH] media: hantro: Support format filtering by depth
|
||||
|
||||
In preparation for supporting 10-bit formats, add mechanism which will
|
||||
filter formats based on pixel depth.
|
||||
|
||||
Hantro G2 supports only one decoding format natively and that is based
|
||||
on bit depth of current video frame. Additionally, it makes no sense to
|
||||
upconvert bitness, so filter those out too.
|
||||
|
||||
Signed-off-by: Jernej Skrabec <jernej.skrabec@gmail.com>
|
||||
---
|
||||
drivers/staging/media/hantro/hantro.h | 4 ++
|
||||
drivers/staging/media/hantro/hantro_v4l2.c | 48 ++++++++++++++++++++--
|
||||
drivers/staging/media/hantro/hantro_v4l2.h | 1 +
|
||||
3 files changed, 50 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/drivers/staging/media/hantro/hantro.h b/drivers/staging/media/hantro/hantro.h
|
||||
index 06d0f3597694..c6525ee8d89a 100644
|
||||
--- a/drivers/staging/media/hantro/hantro.h
|
||||
+++ b/drivers/staging/media/hantro/hantro.h
|
||||
@@ -227,6 +227,7 @@ struct hantro_dev {
|
||||
*
|
||||
* @ctrl_handler: Control handler used to register controls.
|
||||
* @jpeg_quality: User-specified JPEG compression quality.
|
||||
+ * @bit_depth: Bit depth of current frame
|
||||
*
|
||||
* @codec_ops: Set of operations related to codec mode.
|
||||
* @postproc: Post-processing context.
|
||||
@@ -252,6 +253,7 @@ struct hantro_ctx {
|
||||
|
||||
struct v4l2_ctrl_handler ctrl_handler;
|
||||
int jpeg_quality;
|
||||
+ int bit_depth;
|
||||
|
||||
const struct hantro_codec_ops *codec_ops;
|
||||
struct hantro_postproc_ctx postproc;
|
||||
@@ -278,6 +280,7 @@ struct hantro_ctx {
|
||||
* @enc_fmt: Format identifier for encoder registers.
|
||||
* @frmsize: Supported range of frame sizes (only for bitstream formats).
|
||||
* @postprocessed: Indicates if this format needs the post-processor.
|
||||
+ * @match_depth: Indicates if format bit depth must match video bit depth
|
||||
*/
|
||||
struct hantro_fmt {
|
||||
char *name;
|
||||
@@ -288,6 +291,7 @@ struct hantro_fmt {
|
||||
enum hantro_enc_fmt enc_fmt;
|
||||
struct v4l2_frmsize_stepwise frmsize;
|
||||
bool postprocessed;
|
||||
+ bool match_depth;
|
||||
};
|
||||
|
||||
struct hantro_reg {
|
||||
diff --git a/drivers/staging/media/hantro/hantro_v4l2.c b/drivers/staging/media/hantro/hantro_v4l2.c
|
||||
index e595905b3bd7..1214fa2f64ae 100644
|
||||
--- a/drivers/staging/media/hantro/hantro_v4l2.c
|
||||
+++ b/drivers/staging/media/hantro/hantro_v4l2.c
|
||||
@@ -64,6 +64,42 @@ hantro_get_postproc_formats(const struct hantro_ctx *ctx,
|
||||
return ctx->dev->variant->postproc_fmts;
|
||||
}
|
||||
|
||||
+int hantro_get_formath_depth(u32 fourcc)
|
||||
+{
|
||||
+ switch (fourcc) {
|
||||
+ case V4L2_PIX_FMT_P010:
|
||||
+ case V4L2_PIX_FMT_P010_4L4:
|
||||
+ return 10;
|
||||
+ default:
|
||||
+ return 8;
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+static bool
|
||||
+hantro_check_depth_match(const struct hantro_ctx *ctx,
|
||||
+ const struct hantro_fmt *fmt)
|
||||
+{
|
||||
+ int fmt_depth, ctx_depth = 8;
|
||||
+
|
||||
+ if (!fmt->match_depth && !fmt->postprocessed)
|
||||
+ return true;
|
||||
+
|
||||
+ /* 0 means default depth, which is 8 */
|
||||
+ if (ctx->bit_depth)
|
||||
+ ctx_depth = ctx->bit_depth;
|
||||
+
|
||||
+ fmt_depth = hantro_get_formath_depth(fmt->fourcc);
|
||||
+
|
||||
+ /*
|
||||
+ * Allow only downconversion for postproc formats for now.
|
||||
+ * It may be possible to relax that on some HW.
|
||||
+ */
|
||||
+ if (!fmt->match_depth)
|
||||
+ return fmt_depth <= ctx_depth;
|
||||
+
|
||||
+ return fmt_depth == ctx_depth;
|
||||
+}
|
||||
+
|
||||
static const struct hantro_fmt *
|
||||
hantro_find_format(const struct hantro_ctx *ctx, u32 fourcc)
|
||||
{
|
||||
@@ -91,7 +127,8 @@ hantro_get_default_fmt(const struct hantro_ctx *ctx, bool bitstream)
|
||||
formats = hantro_get_formats(ctx, &num_fmts);
|
||||
for (i = 0; i < num_fmts; i++) {
|
||||
if (bitstream == (formats[i].codec_mode !=
|
||||
- HANTRO_MODE_NONE))
|
||||
+ HANTRO_MODE_NONE) &&
|
||||
+ hantro_check_depth_match(ctx, &formats[i]))
|
||||
return &formats[i];
|
||||
}
|
||||
return NULL;
|
||||
@@ -163,11 +200,13 @@ static int vidioc_enum_fmt(struct file *file, void *priv,
|
||||
formats = hantro_get_formats(ctx, &num_fmts);
|
||||
for (i = 0; i < num_fmts; i++) {
|
||||
bool mode_none = formats[i].codec_mode == HANTRO_MODE_NONE;
|
||||
+ fmt = &formats[i];
|
||||
|
||||
if (skip_mode_none == mode_none)
|
||||
continue;
|
||||
+ if (!hantro_check_depth_match(ctx, fmt))
|
||||
+ continue;
|
||||
if (j == f->index) {
|
||||
- fmt = &formats[i];
|
||||
f->pixelformat = fmt->fourcc;
|
||||
return 0;
|
||||
}
|
||||
@@ -183,8 +222,11 @@ static int vidioc_enum_fmt(struct file *file, void *priv,
|
||||
return -EINVAL;
|
||||
formats = hantro_get_postproc_formats(ctx, &num_fmts);
|
||||
for (i = 0; i < num_fmts; i++) {
|
||||
+ fmt = &formats[i];
|
||||
+
|
||||
+ if (!hantro_check_depth_match(ctx, fmt))
|
||||
+ continue;
|
||||
if (j == f->index) {
|
||||
- fmt = &formats[i];
|
||||
f->pixelformat = fmt->fourcc;
|
||||
return 0;
|
||||
}
|
||||
diff --git a/drivers/staging/media/hantro/hantro_v4l2.h b/drivers/staging/media/hantro/hantro_v4l2.h
|
||||
index 18bc682c8556..f4a5905ed518 100644
|
||||
--- a/drivers/staging/media/hantro/hantro_v4l2.h
|
||||
+++ b/drivers/staging/media/hantro/hantro_v4l2.h
|
||||
@@ -22,5 +22,6 @@ extern const struct v4l2_ioctl_ops hantro_ioctl_ops;
|
||||
extern const struct vb2_ops hantro_queue_ops;
|
||||
|
||||
void hantro_reset_fmts(struct hantro_ctx *ctx);
|
||||
+int hantro_get_formath_depth(u32 fourcc);
|
||||
|
||||
#endif /* HANTRO_V4L2_H_ */
|
@ -1,91 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Jernej Skrabec <jernej.skrabec@gmail.com>
|
||||
Date: Sun, 27 Feb 2022 15:08:34 +0100
|
||||
Subject: [PATCH] media: hantro: postproc: Fix buffer size calculation
|
||||
|
||||
When allocating aux buffers for postprocessing, it's assumed that base
|
||||
buffer size is the same as that of output. Coincidentally, that's true
|
||||
most of the time, but not always. 10-bit source also needs aux buffer
|
||||
size which is appropriate for 10-bit native format, even if the output
|
||||
format is 8-bit. Similarly, mv sizes and other extra buffer size also
|
||||
depends on source width/height, not destination.
|
||||
|
||||
Signed-off-by: Jernej Skrabec <jernej.skrabec@gmail.com>
|
||||
---
|
||||
.../staging/media/hantro/hantro_postproc.c | 24 +++++++++++++------
|
||||
drivers/staging/media/hantro/hantro_v4l2.c | 2 +-
|
||||
drivers/staging/media/hantro/hantro_v4l2.h | 2 ++
|
||||
3 files changed, 20 insertions(+), 8 deletions(-)
|
||||
|
||||
diff --git a/drivers/staging/media/hantro/hantro_postproc.c b/drivers/staging/media/hantro/hantro_postproc.c
|
||||
index 248abe5423f0..1a76628d5754 100644
|
||||
--- a/drivers/staging/media/hantro/hantro_postproc.c
|
||||
+++ b/drivers/staging/media/hantro/hantro_postproc.c
|
||||
@@ -12,6 +12,7 @@
|
||||
#include "hantro_hw.h"
|
||||
#include "hantro_g1_regs.h"
|
||||
#include "hantro_g2_regs.h"
|
||||
+#include "hantro_v4l2.h"
|
||||
|
||||
#define HANTRO_PP_REG_WRITE(vpu, reg_name, val) \
|
||||
{ \
|
||||
@@ -137,18 +138,27 @@ int hantro_postproc_alloc(struct hantro_ctx *ctx)
|
||||
struct v4l2_m2m_ctx *m2m_ctx = ctx->fh.m2m_ctx;
|
||||
struct vb2_queue *cap_queue = &m2m_ctx->cap_q_ctx.q;
|
||||
unsigned int num_buffers = cap_queue->num_buffers;
|
||||
+ struct v4l2_pix_format_mplane pix_mp;
|
||||
+ const struct hantro_fmt *fmt;
|
||||
unsigned int i, buf_size;
|
||||
|
||||
- buf_size = ctx->dst_fmt.plane_fmt[0].sizeimage;
|
||||
+ /* this should always pick native format */
|
||||
+ fmt = hantro_get_default_fmt(ctx, false);
|
||||
+ if (!fmt)
|
||||
+ return -EINVAL;
|
||||
+ v4l2_fill_pixfmt_mp(&pix_mp, fmt->fourcc, ctx->src_fmt.width,
|
||||
+ ctx->src_fmt.height);
|
||||
+
|
||||
+ buf_size = pix_mp.plane_fmt[0].sizeimage;
|
||||
if (ctx->vpu_src_fmt->fourcc == V4L2_PIX_FMT_H264_SLICE)
|
||||
- buf_size += hantro_h264_mv_size(ctx->dst_fmt.width,
|
||||
- ctx->dst_fmt.height);
|
||||
+ buf_size += hantro_h264_mv_size(pix_mp.width,
|
||||
+ pix_mp.height);
|
||||
else if (ctx->vpu_src_fmt->fourcc == V4L2_PIX_FMT_VP9_FRAME)
|
||||
- buf_size += hantro_vp9_mv_size(ctx->dst_fmt.width,
|
||||
- ctx->dst_fmt.height);
|
||||
+ buf_size += hantro_vp9_mv_size(pix_mp.width,
|
||||
+ pix_mp.height);
|
||||
else if (ctx->vpu_src_fmt->fourcc == V4L2_PIX_FMT_HEVC_SLICE)
|
||||
- buf_size += hantro_hevc_mv_size(ctx->dst_fmt.width,
|
||||
- ctx->dst_fmt.height);
|
||||
+ buf_size += hantro_hevc_mv_size(pix_mp.width,
|
||||
+ pix_mp.height);
|
||||
|
||||
for (i = 0; i < num_buffers; ++i) {
|
||||
struct hantro_aux_buf *priv = &ctx->postproc.dec_q[i];
|
||||
diff --git a/drivers/staging/media/hantro/hantro_v4l2.c b/drivers/staging/media/hantro/hantro_v4l2.c
|
||||
index 1214fa2f64ae..69d2a108e1e6 100644
|
||||
--- a/drivers/staging/media/hantro/hantro_v4l2.c
|
||||
+++ b/drivers/staging/media/hantro/hantro_v4l2.c
|
||||
@@ -118,7 +118,7 @@ hantro_find_format(const struct hantro_ctx *ctx, u32 fourcc)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
-static const struct hantro_fmt *
|
||||
+const struct hantro_fmt *
|
||||
hantro_get_default_fmt(const struct hantro_ctx *ctx, bool bitstream)
|
||||
{
|
||||
const struct hantro_fmt *formats;
|
||||
diff --git a/drivers/staging/media/hantro/hantro_v4l2.h b/drivers/staging/media/hantro/hantro_v4l2.h
|
||||
index f4a5905ed518..cc9a645be886 100644
|
||||
--- a/drivers/staging/media/hantro/hantro_v4l2.h
|
||||
+++ b/drivers/staging/media/hantro/hantro_v4l2.h
|
||||
@@ -23,5 +23,7 @@ extern const struct vb2_ops hantro_queue_ops;
|
||||
|
||||
void hantro_reset_fmts(struct hantro_ctx *ctx);
|
||||
int hantro_get_formath_depth(u32 fourcc);
|
||||
+const struct hantro_fmt *
|
||||
+hantro_get_default_fmt(const struct hantro_ctx *ctx, bool bitstream);
|
||||
|
||||
#endif /* HANTRO_V4L2_H_ */
|
@ -1,56 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Jernej Skrabec <jernej.skrabec@gmail.com>
|
||||
Date: Sun, 27 Feb 2022 15:17:03 +0100
|
||||
Subject: [PATCH] media: hantro: postproc: Fix legacy regs configuration
|
||||
|
||||
Some postproc legacy registers were set in VP9 code. Move them to
|
||||
postproc and fix their value.
|
||||
|
||||
Signed-off-by: Jernej Skrabec <jernej.skrabec@gmail.com>
|
||||
---
|
||||
drivers/staging/media/hantro/hantro_g2_vp9_dec.c | 8 --------
|
||||
drivers/staging/media/hantro/hantro_postproc.c | 10 ++++++++++
|
||||
2 files changed, 10 insertions(+), 8 deletions(-)
|
||||
|
||||
diff --git a/drivers/staging/media/hantro/hantro_g2_vp9_dec.c b/drivers/staging/media/hantro/hantro_g2_vp9_dec.c
|
||||
index 91c21b634fab..c9cb11fd95af 100644
|
||||
--- a/drivers/staging/media/hantro/hantro_g2_vp9_dec.c
|
||||
+++ b/drivers/staging/media/hantro/hantro_g2_vp9_dec.c
|
||||
@@ -515,16 +515,8 @@ static void
|
||||
config_bit_depth(struct hantro_ctx *ctx, const struct v4l2_ctrl_vp9_frame *dec_params)
|
||||
{
|
||||
if (ctx->dev->variant->legacy_regs) {
|
||||
- u8 pp_shift = 0;
|
||||
-
|
||||
hantro_reg_write(ctx->dev, &g2_bit_depth_y, dec_params->bit_depth);
|
||||
hantro_reg_write(ctx->dev, &g2_bit_depth_c, dec_params->bit_depth);
|
||||
- hantro_reg_write(ctx->dev, &g2_rs_out_bit_depth, dec_params->bit_depth);
|
||||
-
|
||||
- if (dec_params->bit_depth > 8)
|
||||
- pp_shift = 16 - dec_params->bit_depth;
|
||||
-
|
||||
- hantro_reg_write(ctx->dev, &g2_pp_pix_shift, pp_shift);
|
||||
hantro_reg_write(ctx->dev, &g2_pix_shift, 0);
|
||||
} else {
|
||||
hantro_reg_write(ctx->dev, &g2_bit_depth_y_minus8, dec_params->bit_depth - 8);
|
||||
diff --git a/drivers/staging/media/hantro/hantro_postproc.c b/drivers/staging/media/hantro/hantro_postproc.c
|
||||
index 1a76628d5754..11ae663f11b7 100644
|
||||
--- a/drivers/staging/media/hantro/hantro_postproc.c
|
||||
+++ b/drivers/staging/media/hantro/hantro_postproc.c
|
||||
@@ -113,6 +113,16 @@ static void hantro_postproc_g2_enable(struct hantro_ctx *ctx)
|
||||
hantro_write_addr(vpu, G2_RS_OUT_LUMA_ADDR, dst_dma);
|
||||
hantro_write_addr(vpu, G2_RS_OUT_CHROMA_ADDR, dst_dma + chroma_offset);
|
||||
}
|
||||
+ if (ctx->dev->variant->legacy_regs) {
|
||||
+ int out_depth = hantro_get_formath_depth(ctx->dst_fmt.pixelformat);
|
||||
+ u8 pp_shift = 0;
|
||||
+
|
||||
+ if (out_depth > 8)
|
||||
+ pp_shift = 16 - out_depth;
|
||||
+
|
||||
+ hantro_reg_write(ctx->dev, &g2_rs_out_bit_depth, out_depth);
|
||||
+ hantro_reg_write(ctx->dev, &g2_pp_pix_shift, pp_shift);
|
||||
+ }
|
||||
hantro_reg_write(vpu, &g2_out_rs_e, 1);
|
||||
}
|
||||
|
@ -1,61 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Jernej Skrabec <jernej.skrabec@gmail.com>
|
||||
Date: Sun, 27 Feb 2022 15:19:34 +0100
|
||||
Subject: [PATCH] media: hantro: Store VP9 bit depth in context
|
||||
|
||||
Now that we have proper infrastructure for postprocessing 10-bit
|
||||
formats, store VP9 bit depth in context.
|
||||
|
||||
Signed-off-by: Jernej Skrabec <jernej.skrabec@gmail.com>
|
||||
---
|
||||
drivers/staging/media/hantro/hantro_drv.c | 23 +++++++++++++++++++++++
|
||||
1 file changed, 23 insertions(+)
|
||||
|
||||
diff --git a/drivers/staging/media/hantro/hantro_drv.c b/drivers/staging/media/hantro/hantro_drv.c
|
||||
index 6a51f39dde56..305090365e74 100644
|
||||
--- a/drivers/staging/media/hantro/hantro_drv.c
|
||||
+++ b/drivers/staging/media/hantro/hantro_drv.c
|
||||
@@ -320,6 +320,24 @@ static int hantro_hevc_s_ctrl(struct v4l2_ctrl *ctrl)
|
||||
return 0;
|
||||
}
|
||||
|
||||
+static int hantro_vp9_s_ctrl(struct v4l2_ctrl *ctrl)
|
||||
+{
|
||||
+ struct hantro_ctx *ctx;
|
||||
+
|
||||
+ ctx = container_of(ctrl->handler,
|
||||
+ struct hantro_ctx, ctrl_handler);
|
||||
+
|
||||
+ switch (ctrl->id) {
|
||||
+ case V4L2_CID_STATELESS_VP9_FRAME:
|
||||
+ ctx->bit_depth = ctrl->p_new.p_vp9_frame->bit_depth;
|
||||
+ break;
|
||||
+ default:
|
||||
+ return -EINVAL;
|
||||
+ }
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
static const struct v4l2_ctrl_ops hantro_ctrl_ops = {
|
||||
.try_ctrl = hantro_try_ctrl,
|
||||
};
|
||||
@@ -332,6 +350,10 @@ static const struct v4l2_ctrl_ops hantro_hevc_ctrl_ops = {
|
||||
.s_ctrl = hantro_hevc_s_ctrl,
|
||||
};
|
||||
|
||||
+static const struct v4l2_ctrl_ops hantro_vp9_ctrl_ops = {
|
||||
+ .s_ctrl = hantro_vp9_s_ctrl,
|
||||
+};
|
||||
+
|
||||
static const struct hantro_ctrl controls[] = {
|
||||
{
|
||||
.codec = HANTRO_JPEG_ENCODER,
|
||||
@@ -478,6 +500,7 @@ static const struct hantro_ctrl controls[] = {
|
||||
.codec = HANTRO_VP9_DECODER,
|
||||
.cfg = {
|
||||
.id = V4L2_CID_STATELESS_VP9_FRAME,
|
||||
+ .ops = &hantro_vp9_ctrl_ops,
|
||||
},
|
||||
}, {
|
||||
.codec = HANTRO_VP9_DECODER,
|
@ -1,60 +0,0 @@
|
||||
From e4b8d13f19b988a17de0226f3f8a7d03e72eac37 Mon Sep 17 00:00:00 2001
|
||||
From: Jernej Skrabec <jernej.skrabec@gmail.com>
|
||||
Date: Wed, 6 Jul 2022 19:29:01 +0100
|
||||
Subject: [PATCH] media: hantro: sunxi: Enable 10-bit decoding
|
||||
|
||||
Now that infrastructure for 10-bit decoding exists, enable it for
|
||||
Allwinner H6.
|
||||
|
||||
Tested-by: Benjamin Gaignard <benjamin.gaignard@collabora.com>
|
||||
Signed-off-by: Jernej Skrabec <jernej.skrabec@gmail.com>
|
||||
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
|
||||
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
|
||||
---
|
||||
drivers/staging/media/hantro/sunxi_vpu_hw.c | 27 +++++++++++++++++++++
|
||||
1 file changed, 27 insertions(+)
|
||||
|
||||
diff --git a/drivers/staging/media/hantro/sunxi_vpu_hw.c b/drivers/staging/media/hantro/sunxi_vpu_hw.c
|
||||
index fbeac81e59e133..02ce8b064a8f0c 100644
|
||||
--- a/drivers/staging/media/hantro/sunxi_vpu_hw.c
|
||||
+++ b/drivers/staging/media/hantro/sunxi_vpu_hw.c
|
||||
@@ -23,12 +23,39 @@ static const struct hantro_fmt sunxi_vpu_postproc_fmts[] = {
|
||||
.step_height = 32,
|
||||
},
|
||||
},
|
||||
+ {
|
||||
+ .fourcc = V4L2_PIX_FMT_P010,
|
||||
+ .codec_mode = HANTRO_MODE_NONE,
|
||||
+ .postprocessed = true,
|
||||
+ .frmsize = {
|
||||
+ .min_width = FMT_MIN_WIDTH,
|
||||
+ .max_width = FMT_UHD_WIDTH,
|
||||
+ .step_width = 32,
|
||||
+ .min_height = FMT_MIN_HEIGHT,
|
||||
+ .max_height = FMT_UHD_HEIGHT,
|
||||
+ .step_height = 32,
|
||||
+ },
|
||||
+ },
|
||||
};
|
||||
|
||||
static const struct hantro_fmt sunxi_vpu_dec_fmts[] = {
|
||||
{
|
||||
.fourcc = V4L2_PIX_FMT_NV12_4L4,
|
||||
.codec_mode = HANTRO_MODE_NONE,
|
||||
+ .match_depth = true,
|
||||
+ .frmsize = {
|
||||
+ .min_width = FMT_MIN_WIDTH,
|
||||
+ .max_width = FMT_UHD_WIDTH,
|
||||
+ .step_width = 32,
|
||||
+ .min_height = FMT_MIN_HEIGHT,
|
||||
+ .max_height = FMT_UHD_HEIGHT,
|
||||
+ .step_height = 32,
|
||||
+ },
|
||||
+ },
|
||||
+ {
|
||||
+ .fourcc = V4L2_PIX_FMT_P010_4L4,
|
||||
+ .codec_mode = HANTRO_MODE_NONE,
|
||||
+ .match_depth = true,
|
||||
.frmsize = {
|
||||
.min_width = FMT_MIN_WIDTH,
|
||||
.max_width = FMT_UHD_WIDTH,
|
@ -1,36 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Jernej Skrabec <jernej.skrabec@gmail.com>
|
||||
Date: Sun, 27 Feb 2022 17:59:18 +0100
|
||||
Subject: [PATCH] media: hantro: postproc: Properly calculate chroma offset
|
||||
|
||||
Currently chroma offset calculation assumes only 1 byte per luma, with
|
||||
no consideration for stride.
|
||||
|
||||
Take necessary information from destination pixel format which makes
|
||||
calculation completely universal.
|
||||
|
||||
Signed-off-by: Jernej Skrabec <jernej.skrabec@gmail.com>
|
||||
---
|
||||
drivers/staging/media/hantro/hantro_postproc.c | 4 +++-
|
||||
1 file changed, 3 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/drivers/staging/media/hantro/hantro_postproc.c b/drivers/staging/media/hantro/hantro_postproc.c
|
||||
index 11ae663f11b7..d8358d3289dc 100644
|
||||
--- a/drivers/staging/media/hantro/hantro_postproc.c
|
||||
+++ b/drivers/staging/media/hantro/hantro_postproc.c
|
||||
@@ -105,12 +105,14 @@ static void hantro_postproc_g2_enable(struct hantro_ctx *ctx)
|
||||
{
|
||||
struct hantro_dev *vpu = ctx->dev;
|
||||
struct vb2_v4l2_buffer *dst_buf;
|
||||
- size_t chroma_offset = ctx->dst_fmt.width * ctx->dst_fmt.height;
|
||||
+ size_t chroma_offset;
|
||||
int down_scale = down_scale_factor(ctx);
|
||||
dma_addr_t dst_dma;
|
||||
|
||||
dst_buf = hantro_get_dst_buf(ctx);
|
||||
dst_dma = vb2_dma_contig_plane_dma_addr(&dst_buf->vb2_buf, 0);
|
||||
+ chroma_offset = ctx->dst_fmt.plane_fmt[0].bytesperline *
|
||||
+ ctx->dst_fmt.height;
|
||||
|
||||
if (down_scale) {
|
||||
hantro_reg_write(vpu, &g2_down_scale_e, 1);
|
Loading…
x
Reference in New Issue
Block a user