mirror of
https://github.com/libretro/Lakka-LibreELEC.git
synced 2024-11-23 16:30:13 +00:00
Allwinner: Rework patches
This commit is contained in:
parent
1846ac3948
commit
5f84764bf9
@ -1,62 +0,0 @@
|
||||
From 398a7c7ab82ab344d693a62ee633351f93046d91 Mon Sep 17 00:00:00 2001
|
||||
From: Jernej Skrabec <jernej.skrabec@siol.net>
|
||||
Date: Mon, 11 Mar 2019 17:30:24 +0100
|
||||
Subject: [PATCH] orangepi win: wifi & bt
|
||||
|
||||
Signed-off-by: Jernej Skrabec <jernej.skrabec@siol.net>
|
||||
---
|
||||
.../dts/allwinner/sun50i-a64-orangepi-win.dts | 23 +++++++++++++++++++
|
||||
1 file changed, 23 insertions(+)
|
||||
|
||||
diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64-orangepi-win.dts b/arch/arm64/boot/dts/allwinner/sun50i-a64-orangepi-win.dts
|
||||
index 510f661229dc..5ef3c62c765e 100644
|
||||
--- a/arch/arm64/boot/dts/allwinner/sun50i-a64-orangepi-win.dts
|
||||
+++ b/arch/arm64/boot/dts/allwinner/sun50i-a64-orangepi-win.dts
|
||||
@@ -109,6 +109,8 @@
|
||||
wifi_pwrseq: wifi_pwrseq {
|
||||
compatible = "mmc-pwrseq-simple";
|
||||
reset-gpios = <&r_pio 0 8 GPIO_ACTIVE_LOW>; /* PL8 */
|
||||
+ clocks = <&rtc 1>;
|
||||
+ clock-names = "ext_clock";
|
||||
};
|
||||
};
|
||||
|
||||
@@ -170,6 +172,14 @@
|
||||
bus-width = <4>;
|
||||
non-removable;
|
||||
status = "okay";
|
||||
+
|
||||
+ brcmf: wifi@1 {
|
||||
+ reg = <1>;
|
||||
+ compatible = "brcm,bcm4329-fmac";
|
||||
+ interrupt-parent = <&r_pio>;
|
||||
+ interrupts = <0 7 IRQ_TYPE_LEVEL_LOW>; /* PL7 */
|
||||
+ interrupt-names = "host-wake";
|
||||
+ };
|
||||
};
|
||||
|
||||
&ohci0 {
|
||||
@@ -342,7 +352,20 @@
|
||||
&uart1 {
|
||||
pinctrl-names = "default";
|
||||
pinctrl-0 = <&uart1_pins>, <&uart1_rts_cts_pins>;
|
||||
+ uart-has-rtscts;
|
||||
status = "okay";
|
||||
+
|
||||
+ bluetooth {
|
||||
+ compatible = "brcm,bcm43438-bt";
|
||||
+ max-speed = <1500000>;
|
||||
+ clocks = <&rtc 1>;
|
||||
+ clock-names = "lpo";
|
||||
+ vbat-supply = <®_dldo2>;
|
||||
+ vddio-supply = <®_dldo4>;
|
||||
+ device-wakeup-gpios = <&r_pio 0 6 GPIO_ACTIVE_HIGH>; /* PL6 */
|
||||
+ host-wakeup-gpios = <&r_pio 0 5 GPIO_ACTIVE_HIGH>; /* PL5 */
|
||||
+ shutdown-gpios = <&r_pio 0 4 GPIO_ACTIVE_HIGH>; /* PL4 */
|
||||
+ };
|
||||
};
|
||||
|
||||
/* On Pi-2 connector, RTS/CTS optional */
|
||||
--
|
||||
2.21.0
|
||||
|
@ -1,24 +0,0 @@
|
||||
diff --git a/arch/arm/boot/dts/sun8i-h3-beelink-x2.dts b/arch/arm/boot/dts/sun8i-h3-beelink-x2.dts
|
||||
index 6277f13f3eb3..6a0ac85b4616 100644
|
||||
--- a/arch/arm/boot/dts/sun8i-h3-beelink-x2.dts
|
||||
+++ b/arch/arm/boot/dts/sun8i-h3-beelink-x2.dts
|
||||
@@ -89,7 +89,10 @@
|
||||
|
||||
wifi_pwrseq: wifi_pwrseq {
|
||||
compatible = "mmc-pwrseq-simple";
|
||||
+ pinctrl-names = "default";
|
||||
reset-gpios = <&r_pio 0 7 GPIO_ACTIVE_LOW>; /* PL7 */
|
||||
+ clocks = <&rtc 1>;
|
||||
+ clock-names = "ext_clock";
|
||||
};
|
||||
|
||||
sound_spdif {
|
||||
@@ -155,6 +158,8 @@
|
||||
|
||||
&mmc1 {
|
||||
vmmc-supply = <®_vcc3v3>;
|
||||
+ vqmmc-supply = <®_vcc3v3>;
|
||||
+ mmc-pwrseq = <&wifi_pwrseq>;
|
||||
bus-width = <4>;
|
||||
non-removable;
|
||||
status = "okay";
|
@ -1,165 +0,0 @@
|
||||
From ed19ec00d4d62a74857ad9c2ea1dbf9671ac3580 Mon Sep 17 00:00:00 2001
|
||||
From: Jernej Skrabec <jernej.skrabec@siol.net>
|
||||
Date: Mon, 28 Jan 2019 19:36:54 +0100
|
||||
Subject: [PATCH 1/6] dt-bindings: media: cedrus: Add H6 compatible
|
||||
|
||||
This adds a compatible for H6. H6 VPU supports 10-bit HEVC decoding and
|
||||
additional AFBC output format for HEVC.
|
||||
|
||||
Signed-off-by: Jernej Skrabec <jernej.skrabec@siol.net>
|
||||
---
|
||||
Documentation/devicetree/bindings/media/cedrus.txt | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
diff --git a/Documentation/devicetree/bindings/media/cedrus.txt b/Documentation/devicetree/bindings/media/cedrus.txt
|
||||
index bce0705df953..20c82fb0c343 100644
|
||||
--- a/Documentation/devicetree/bindings/media/cedrus.txt
|
||||
+++ b/Documentation/devicetree/bindings/media/cedrus.txt
|
||||
@@ -13,6 +13,7 @@ Required properties:
|
||||
- "allwinner,sun8i-h3-video-engine"
|
||||
- "allwinner,sun50i-a64-video-engine"
|
||||
- "allwinner,sun50i-h5-video-engine"
|
||||
+ - "allwinner,sun50i-h6-video-engine"
|
||||
- reg : register base and length of VE;
|
||||
- clocks : list of clock specifiers, corresponding to entries in
|
||||
the clock-names property;
|
||||
--
|
||||
2.20.1
|
||||
|
||||
|
||||
From bb6b00e1225a5b382b723d3c2190429e15a4c607 Mon Sep 17 00:00:00 2001
|
||||
From: Jernej Skrabec <jernej.skrabec@siol.net>
|
||||
Date: Mon, 28 Jan 2019 19:45:38 +0100
|
||||
Subject: [PATCH 2/6] media: cedrus: Add a quirk for not setting DMA offset
|
||||
|
||||
H6 VPU doesn't work if DMA offset is set.
|
||||
|
||||
Add a quirk for it.
|
||||
|
||||
Signed-off-by: Jernej Skrabec <jernej.skrabec@siol.net>
|
||||
---
|
||||
drivers/staging/media/sunxi/cedrus/cedrus.h | 3 +++
|
||||
drivers/staging/media/sunxi/cedrus/cedrus_hw.c | 3 ++-
|
||||
2 files changed, 5 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/drivers/staging/media/sunxi/cedrus/cedrus.h b/drivers/staging/media/sunxi/cedrus/cedrus.h
|
||||
index 4aedd24a9848..c57c04b41d2e 100644
|
||||
--- a/drivers/staging/media/sunxi/cedrus/cedrus.h
|
||||
+++ b/drivers/staging/media/sunxi/cedrus/cedrus.h
|
||||
@@ -28,6 +28,8 @@
|
||||
|
||||
#define CEDRUS_CAPABILITY_UNTILED BIT(0)
|
||||
|
||||
+#define CEDRUS_QUIRK_NO_DMA_OFFSET BIT(0)
|
||||
+
|
||||
enum cedrus_codec {
|
||||
CEDRUS_CODEC_MPEG2,
|
||||
|
||||
@@ -91,6 +93,7 @@ struct cedrus_dec_ops {
|
||||
|
||||
struct cedrus_variant {
|
||||
unsigned int capabilities;
|
||||
+ unsigned int quirks;
|
||||
};
|
||||
|
||||
struct cedrus_dev {
|
||||
diff --git a/drivers/staging/media/sunxi/cedrus/cedrus_hw.c b/drivers/staging/media/sunxi/cedrus/cedrus_hw.c
|
||||
index 0acf219a8c91..fbfff7c1c771 100644
|
||||
--- a/drivers/staging/media/sunxi/cedrus/cedrus_hw.c
|
||||
+++ b/drivers/staging/media/sunxi/cedrus/cedrus_hw.c
|
||||
@@ -177,7 +177,8 @@ int cedrus_hw_probe(struct cedrus_dev *dev)
|
||||
*/
|
||||
|
||||
#ifdef PHYS_PFN_OFFSET
|
||||
- dev->dev->dma_pfn_offset = PHYS_PFN_OFFSET;
|
||||
+ if (!(variant->quirks & CEDRUS_QUIRK_NO_DMA_OFFSET))
|
||||
+ dev->dev->dma_pfn_offset = PHYS_PFN_OFFSET;
|
||||
#endif
|
||||
|
||||
ret = of_reserved_mem_device_init(dev->dev);
|
||||
--
|
||||
2.20.1
|
||||
|
||||
|
||||
From 744c66f8c328ef40b6fb246f8b9f2daa9cce4d9d Mon Sep 17 00:00:00 2001
|
||||
From: Jernej Skrabec <jernej.skrabec@siol.net>
|
||||
Date: Mon, 28 Jan 2019 19:47:33 +0100
|
||||
Subject: [PATCH 3/6] media: cedrus: Add support for H6
|
||||
|
||||
H6 has improved VPU. It supports 10-bit HEVC decoding and AFBC output
|
||||
format for HEVC.
|
||||
|
||||
Signed-off-by: Jernej Skrabec <jernej.skrabec@siol.net>
|
||||
---
|
||||
drivers/staging/media/sunxi/cedrus/cedrus.c | 9 +++++++++
|
||||
1 file changed, 9 insertions(+)
|
||||
|
||||
diff --git a/drivers/staging/media/sunxi/cedrus/cedrus.c b/drivers/staging/media/sunxi/cedrus/cedrus.c
|
||||
index ff11cbeba205..b98add3cdedd 100644
|
||||
--- a/drivers/staging/media/sunxi/cedrus/cedrus.c
|
||||
+++ b/drivers/staging/media/sunxi/cedrus/cedrus.c
|
||||
@@ -396,6 +396,11 @@ static const struct cedrus_variant sun50i_h5_cedrus_variant = {
|
||||
.capabilities = CEDRUS_CAPABILITY_UNTILED,
|
||||
};
|
||||
|
||||
+static const struct cedrus_variant sun50i_h6_cedrus_variant = {
|
||||
+ .capabilities = CEDRUS_CAPABILITY_UNTILED | CEDRUS_CAPABILITY_H265_DEC,
|
||||
+ .quirks = CEDRUS_QUIRK_NO_DMA_OFFSET,
|
||||
+};
|
||||
+
|
||||
static const struct of_device_id cedrus_dt_match[] = {
|
||||
{
|
||||
.compatible = "allwinner,sun4i-a10-video-engine",
|
||||
@@ -425,6 +430,10 @@ static const struct of_device_id cedrus_dt_match[] = {
|
||||
.compatible = "allwinner,sun50i-h5-video-engine",
|
||||
.data = &sun50i_h5_cedrus_variant,
|
||||
},
|
||||
+ {
|
||||
+ .compatible = "allwinner,sun50i-h6-video-engine",
|
||||
+ .data = &sun50i_h6_cedrus_variant,
|
||||
+ },
|
||||
{ /* sentinel */ }
|
||||
};
|
||||
MODULE_DEVICE_TABLE(of, cedrus_dt_match);
|
||||
--
|
||||
2.20.1
|
||||
|
||||
|
||||
From c1b3128ac98c05c0afde4e6e065d6b1f2ae1dfa7 Mon Sep 17 00:00:00 2001
|
||||
From: Jernej Skrabec <jernej.skrabec@siol.net>
|
||||
Date: Mon, 28 Jan 2019 19:59:27 +0100
|
||||
Subject: [PATCH 6/6] arm64: dts: allwinner: h6: Add Video Engine node
|
||||
|
||||
This adds the Video engine node for H6. It can use whole DRAM range so
|
||||
there is no need for reserved memory node.
|
||||
|
||||
Signed-off-by: Jernej Skrabec <jernej.skrabec@siol.net>
|
||||
---
|
||||
arch/arm64/boot/dts/allwinner/sun50i-h6.dtsi | 11 +++++++++++
|
||||
1 file changed, 11 insertions(+)
|
||||
|
||||
diff --git a/arch/arm64/boot/dts/allwinner/sun50i-h6.dtsi b/arch/arm64/boot/dts/allwinner/sun50i-h6.dtsi
|
||||
index 247dc0a5ce89..de4b7a1f1012 100644
|
||||
--- a/arch/arm64/boot/dts/allwinner/sun50i-h6.dtsi
|
||||
+++ b/arch/arm64/boot/dts/allwinner/sun50i-h6.dtsi
|
||||
@@ -146,6 +146,17 @@
|
||||
};
|
||||
};
|
||||
|
||||
+ video-codec@1c0e000 {
|
||||
+ compatible = "allwinner,sun50i-h6-video-engine";
|
||||
+ reg = <0x01c0e000 0x2000>;
|
||||
+ clocks = <&ccu CLK_BUS_VE>, <&ccu CLK_VE>,
|
||||
+ <&ccu CLK_MBUS_VE>;
|
||||
+ clock-names = "ahb", "mod", "ram";
|
||||
+ resets = <&ccu RST_BUS_VE>;
|
||||
+ interrupts = <GIC_SPI 89 IRQ_TYPE_LEVEL_HIGH>;
|
||||
+ allwinner,sram = <&ve_sram 1>;
|
||||
+ };
|
||||
+
|
||||
syscon: syscon@3000000 {
|
||||
compatible = "allwinner,sun50i-h6-system-control",
|
||||
"allwinner,sun50i-a64-system-control";
|
||||
--
|
||||
2.20.1
|
||||
|
@ -0,0 +1,91 @@
|
||||
From d117460aed81ee5cd384045a1189c9de758d17c6 Mon Sep 17 00:00:00 2001
|
||||
From: Jernej Skrabec <jernej.skrabec@siol.net>
|
||||
Date: Tue, 28 May 2019 21:05:34 +0200
|
||||
Subject: [PATCH] 10-bit HEVC hack
|
||||
|
||||
Signed-off-by: Jernej Skrabec <jernej.skrabec@siol.net>
|
||||
---
|
||||
drivers/staging/media/sunxi/cedrus/cedrus_h265.c | 12 ++++++++++++
|
||||
drivers/staging/media/sunxi/cedrus/cedrus_regs.h | 4 ++++
|
||||
drivers/staging/media/sunxi/cedrus/cedrus_video.c | 13 +++++++++++--
|
||||
3 files changed, 27 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/drivers/staging/media/sunxi/cedrus/cedrus_h265.c b/drivers/staging/media/sunxi/cedrus/cedrus_h265.c
|
||||
index 8bbbe69ae51f..04ba7d60ebcd 100644
|
||||
--- a/drivers/staging/media/sunxi/cedrus/cedrus_h265.c
|
||||
+++ b/drivers/staging/media/sunxi/cedrus/cedrus_h265.c
|
||||
@@ -453,6 +453,18 @@ static void cedrus_h265_setup(struct cedrus_ctx *ctx,
|
||||
|
||||
cedrus_write(dev, VE_DEC_H265_DEC_PCM_CTRL, reg);
|
||||
|
||||
+ if (sps->bit_depth_luma_minus8) {
|
||||
+ unsigned int size;
|
||||
+
|
||||
+ size = ALIGN(ctx->src_fmt.width, 16) * ALIGN(ctx->src_fmt.height, 16);
|
||||
+
|
||||
+ reg = (size * 3) / 2;
|
||||
+ cedrus_write(dev, VE_DEC_H265_OFFSET_ADDR_FIRST_OUT, reg);
|
||||
+
|
||||
+ reg = DIV_ROUND_UP(ctx->src_fmt.width, 4);
|
||||
+ cedrus_write(dev, VE_DEC_H265_10BIT_CONFIGURE, ALIGN(reg, 32));
|
||||
+ }
|
||||
+
|
||||
reg = VE_DEC_H265_DEC_PPS_CTRL0_PPS_CR_QP_OFFSET(pps->pps_cr_qp_offset) |
|
||||
VE_DEC_H265_DEC_PPS_CTRL0_PPS_CB_QP_OFFSET(pps->pps_cb_qp_offset) |
|
||||
VE_DEC_H265_DEC_PPS_CTRL0_INIT_QP_MINUS26(pps->init_qp_minus26) |
|
||||
diff --git a/drivers/staging/media/sunxi/cedrus/cedrus_regs.h b/drivers/staging/media/sunxi/cedrus/cedrus_regs.h
|
||||
index d1f010ae49ef..dd69031a2779 100644
|
||||
--- a/drivers/staging/media/sunxi/cedrus/cedrus_regs.h
|
||||
+++ b/drivers/staging/media/sunxi/cedrus/cedrus_regs.h
|
||||
@@ -505,6 +505,10 @@
|
||||
|
||||
#define VE_DEC_H265_LOW_ADDR (VE_ENGINE_DEC_H265 + 0x80)
|
||||
|
||||
+#define VE_DEC_H265_OFFSET_ADDR_FIRST_OUT (VE_ENGINE_DEC_H265 + 0x84)
|
||||
+#define VE_DEC_H265_OFFSET_ADDR_SECOND_OUT (VE_ENGINE_DEC_H265 + 0x88)
|
||||
+#define VE_DEC_H265_10BIT_CONFIGURE (VE_ENGINE_DEC_H265 + 0x8c)
|
||||
+
|
||||
#define VE_DEC_H265_LOW_ADDR_PRIMARY_CHROMA(a) \
|
||||
(((a) << 24) & GENMASK(31, 24))
|
||||
#define VE_DEC_H265_LOW_ADDR_SECONDARY_CHROMA(a) \
|
||||
diff --git a/drivers/staging/media/sunxi/cedrus/cedrus_video.c b/drivers/staging/media/sunxi/cedrus/cedrus_video.c
|
||||
index d27a9e82ff91..2c2288319c9d 100644
|
||||
--- a/drivers/staging/media/sunxi/cedrus/cedrus_video.c
|
||||
+++ b/drivers/staging/media/sunxi/cedrus/cedrus_video.c
|
||||
@@ -372,6 +372,7 @@ static int cedrus_queue_setup(struct vb2_queue *vq, unsigned int *nbufs,
|
||||
struct cedrus_ctx *ctx = vb2_get_drv_priv(vq);
|
||||
struct cedrus_dev *dev = ctx->dev;
|
||||
struct v4l2_pix_format *pix_fmt;
|
||||
+ unsigned int extra_size = 0;
|
||||
u32 directions;
|
||||
|
||||
if (V4L2_TYPE_IS_OUTPUT(vq->type)) {
|
||||
@@ -380,6 +381,14 @@ static int cedrus_queue_setup(struct vb2_queue *vq, unsigned int *nbufs,
|
||||
} else {
|
||||
directions = CEDRUS_DECODE_DST;
|
||||
pix_fmt = &ctx->dst_fmt;
|
||||
+
|
||||
+ /* The HEVC decoder needs extra size on the output buffer. */
|
||||
+ if (ctx->src_fmt.pixelformat == V4L2_PIX_FMT_HEVC_SLICE) {
|
||||
+ extra_size = DIV_ROUND_UP(pix_fmt->width, 4);
|
||||
+ extra_size = ALIGN(extra_size, 32);
|
||||
+ extra_size *= ALIGN(pix_fmt->height, 16) * 3;
|
||||
+ extra_size /= 2;
|
||||
+ }
|
||||
}
|
||||
|
||||
if (!cedrus_check_format(pix_fmt->pixelformat, directions,
|
||||
@@ -387,8 +396,8 @@ static int cedrus_queue_setup(struct vb2_queue *vq, unsigned int *nbufs,
|
||||
return -EINVAL;
|
||||
|
||||
if (*nplanes) {
|
||||
- if (sizes[0] < pix_fmt->sizeimage)
|
||||
- return -EINVAL;
|
||||
+ if (sizes[0] < (pix_fmt->sizeimage + extra_size))
|
||||
+ sizes[0] = pix_fmt->sizeimage + extra_size;
|
||||
} else {
|
||||
sizes[0] = pix_fmt->sizeimage;
|
||||
*nplanes = 1;
|
||||
--
|
||||
2.21.0
|
||||
|
@ -1,25 +0,0 @@
|
||||
From 18c9a269e2b744ee84f32de9d5c6c66857725ef8 Mon Sep 17 00:00:00 2001
|
||||
From: Jernej Skrabec <jernej.skrabec@siol.net>
|
||||
Date: Sat, 15 Dec 2018 12:56:53 +0100
|
||||
Subject: [PATCH 20/20] cedrus increase frequency
|
||||
|
||||
---
|
||||
drivers/staging/media/sunxi/cedrus/cedrus_hw.h | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/drivers/staging/media/sunxi/cedrus/cedrus_hw.h b/drivers/staging/media/sunxi/cedrus/cedrus_hw.h
|
||||
index b43c77d54b95..70677571f3d3 100644
|
||||
--- a/drivers/staging/media/sunxi/cedrus/cedrus_hw.h
|
||||
+++ b/drivers/staging/media/sunxi/cedrus/cedrus_hw.h
|
||||
@@ -16,7 +16,7 @@
|
||||
#ifndef _CEDRUS_HW_H_
|
||||
#define _CEDRUS_HW_H_
|
||||
|
||||
-#define CEDRUS_CLOCK_RATE_DEFAULT 402000000
|
||||
+#define CEDRUS_CLOCK_RATE_DEFAULT 600000000
|
||||
|
||||
int cedrus_engine_enable(struct cedrus_dev *dev, enum cedrus_codec codec);
|
||||
void cedrus_engine_disable(struct cedrus_dev *dev);
|
||||
--
|
||||
2.20.0
|
||||
|
@ -1,96 +0,0 @@
|
||||
From 9413130f5b213551519c97482462a6daea9a5343 Mon Sep 17 00:00:00 2001
|
||||
From: Jernej Skrabec <jernej.skrabec@siol.net>
|
||||
Date: Tue, 2 Apr 2019 19:32:01 +0200
|
||||
Subject: [PATCH 1/2] clk: sunxi-ng: h6: Change CEC clock parent
|
||||
|
||||
Signed-off-by: Jernej Skrabec <jernej.skrabec@siol.net>
|
||||
---
|
||||
drivers/clk/sunxi-ng/ccu-sun50i-h6.c | 11 +++++++++++
|
||||
1 file changed, 11 insertions(+)
|
||||
|
||||
diff --git a/drivers/clk/sunxi-ng/ccu-sun50i-h6.c b/drivers/clk/sunxi-ng/ccu-sun50i-h6.c
|
||||
index daf78966555e..33980067b06e 100644
|
||||
--- a/drivers/clk/sunxi-ng/ccu-sun50i-h6.c
|
||||
+++ b/drivers/clk/sunxi-ng/ccu-sun50i-h6.c
|
||||
@@ -656,6 +656,8 @@ static const char * const hdmi_cec_parents[] = { "osc32k", "pll-periph0-2x" };
|
||||
static const struct ccu_mux_fixed_prediv hdmi_cec_predivs[] = {
|
||||
{ .index = 1, .div = 36621 },
|
||||
};
|
||||
+
|
||||
+#define SUN50I_H6_HDMI_CEC_CLK_REG 0xb10
|
||||
static struct ccu_mux hdmi_cec_clk = {
|
||||
.enable = BIT(31),
|
||||
|
||||
@@ -1200,6 +1202,15 @@ static int sun50i_h6_ccu_probe(struct platform_device *pdev)
|
||||
val &= ~(GENMASK(21, 16) | BIT(0));
|
||||
writel(val | (7 << 16), reg + SUN50I_H6_PLL_AUDIO_REG);
|
||||
|
||||
+ /*
|
||||
+ * First clock parent (osc32K) is unusable for CEC. But since there
|
||||
+ * is no good way to force parent switch (both run with same frequency),
|
||||
+ * just set second clock parent here.
|
||||
+ */
|
||||
+ val = readl(reg + SUN50I_H6_HDMI_CEC_CLK_REG);
|
||||
+ val |= BIT(24);
|
||||
+ writel(val, reg + SUN50I_H6_HDMI_CEC_CLK_REG);
|
||||
+
|
||||
return sunxi_ccu_probe(pdev->dev.of_node, reg, &sun50i_h6_ccu_desc);
|
||||
}
|
||||
|
||||
--
|
||||
2.21.0
|
||||
|
||||
|
||||
From eab64a1ccf6b7cda339fdfdbfa9e1973e4cc0c85 Mon Sep 17 00:00:00 2001
|
||||
From: Jernej Skrabec <jernej.skrabec@siol.net>
|
||||
Date: Tue, 2 Apr 2019 21:15:45 +0200
|
||||
Subject: [PATCH 2/2] clk: sunxi-ng: h6: Allow video & vpu clocks to change
|
||||
parent rate
|
||||
|
||||
Video related clocks need to set rate as close as possible to the
|
||||
requested one, so they should be able to change parent clock rate.
|
||||
|
||||
VPU clock sometimes has to be set to higher than default parent clock
|
||||
rate. This is requ
|
||||
|
||||
Add CLK_SET_RATE_PARENT flag to tcon-lcd0, tcon-tv0 and ve.
|
||||
|
||||
Signed-off-by: Jernej Skrabec <jernej.skrabec@siol.net>
|
||||
---
|
||||
drivers/clk/sunxi-ng/ccu-sun50i-h6.c | 6 +++---
|
||||
1 file changed, 3 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/drivers/clk/sunxi-ng/ccu-sun50i-h6.c b/drivers/clk/sunxi-ng/ccu-sun50i-h6.c
|
||||
index 33980067b06e..3c32d7798f27 100644
|
||||
--- a/drivers/clk/sunxi-ng/ccu-sun50i-h6.c
|
||||
+++ b/drivers/clk/sunxi-ng/ccu-sun50i-h6.c
|
||||
@@ -311,7 +311,7 @@ static SUNXI_CCU_M_WITH_MUX_GATE(ve_clk, "ve", ve_parents, 0x690,
|
||||
0, 3, /* M */
|
||||
24, 1, /* mux */
|
||||
BIT(31), /* gate */
|
||||
- 0);
|
||||
+ CLK_SET_RATE_PARENT);
|
||||
|
||||
static SUNXI_CCU_GATE(bus_ve_clk, "bus-ve", "psi-ahb1-ahb2",
|
||||
0x69c, BIT(0), 0);
|
||||
@@ -691,7 +691,7 @@ static SUNXI_CCU_MUX_WITH_GATE(tcon_lcd0_clk, "tcon-lcd0",
|
||||
tcon_lcd0_parents, 0xb60,
|
||||
24, 3, /* mux */
|
||||
BIT(31), /* gate */
|
||||
- 0);
|
||||
+ CLK_SET_RATE_PARENT);
|
||||
|
||||
static SUNXI_CCU_GATE(bus_tcon_lcd0_clk, "bus-tcon-lcd0", "ahb3",
|
||||
0xb7c, BIT(0), 0);
|
||||
@@ -706,7 +706,7 @@ static SUNXI_CCU_MP_WITH_MUX_GATE(tcon_tv0_clk, "tcon-tv0",
|
||||
8, 2, /* P */
|
||||
24, 3, /* mux */
|
||||
BIT(31), /* gate */
|
||||
- 0);
|
||||
+ CLK_SET_RATE_PARENT);
|
||||
|
||||
static SUNXI_CCU_GATE(bus_tcon_tv0_clk, "bus-tcon-tv0", "ahb3",
|
||||
0xb9c, BIT(0), 0);
|
||||
--
|
||||
2.21.0
|
||||
|
@ -674,3 +674,370 @@ index b98add3cdedd..d0429c0e6b6b 100644
|
||||
--
|
||||
2.21.0
|
||||
|
||||
From ed19ec00d4d62a74857ad9c2ea1dbf9671ac3580 Mon Sep 17 00:00:00 2001
|
||||
From: Jernej Skrabec <jernej.skrabec@siol.net>
|
||||
Date: Mon, 28 Jan 2019 19:36:54 +0100
|
||||
Subject: [PATCH 1/6] dt-bindings: media: cedrus: Add H6 compatible
|
||||
|
||||
This adds a compatible for H6. H6 VPU supports 10-bit HEVC decoding and
|
||||
additional AFBC output format for HEVC.
|
||||
|
||||
Signed-off-by: Jernej Skrabec <jernej.skrabec@siol.net>
|
||||
---
|
||||
Documentation/devicetree/bindings/media/cedrus.txt | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
diff --git a/Documentation/devicetree/bindings/media/cedrus.txt b/Documentation/devicetree/bindings/media/cedrus.txt
|
||||
index bce0705df953..20c82fb0c343 100644
|
||||
--- a/Documentation/devicetree/bindings/media/cedrus.txt
|
||||
+++ b/Documentation/devicetree/bindings/media/cedrus.txt
|
||||
@@ -13,6 +13,7 @@ Required properties:
|
||||
- "allwinner,sun8i-h3-video-engine"
|
||||
- "allwinner,sun50i-a64-video-engine"
|
||||
- "allwinner,sun50i-h5-video-engine"
|
||||
+ - "allwinner,sun50i-h6-video-engine"
|
||||
- reg : register base and length of VE;
|
||||
- clocks : list of clock specifiers, corresponding to entries in
|
||||
the clock-names property;
|
||||
--
|
||||
2.20.1
|
||||
|
||||
|
||||
From bb6b00e1225a5b382b723d3c2190429e15a4c607 Mon Sep 17 00:00:00 2001
|
||||
From: Jernej Skrabec <jernej.skrabec@siol.net>
|
||||
Date: Mon, 28 Jan 2019 19:45:38 +0100
|
||||
Subject: [PATCH 2/6] media: cedrus: Add a quirk for not setting DMA offset
|
||||
|
||||
H6 VPU doesn't work if DMA offset is set.
|
||||
|
||||
Add a quirk for it.
|
||||
|
||||
Signed-off-by: Jernej Skrabec <jernej.skrabec@siol.net>
|
||||
---
|
||||
drivers/staging/media/sunxi/cedrus/cedrus.h | 3 +++
|
||||
drivers/staging/media/sunxi/cedrus/cedrus_hw.c | 3 ++-
|
||||
2 files changed, 5 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/drivers/staging/media/sunxi/cedrus/cedrus.h b/drivers/staging/media/sunxi/cedrus/cedrus.h
|
||||
index 4aedd24a9848..c57c04b41d2e 100644
|
||||
--- a/drivers/staging/media/sunxi/cedrus/cedrus.h
|
||||
+++ b/drivers/staging/media/sunxi/cedrus/cedrus.h
|
||||
@@ -28,6 +28,8 @@
|
||||
|
||||
#define CEDRUS_CAPABILITY_UNTILED BIT(0)
|
||||
|
||||
+#define CEDRUS_QUIRK_NO_DMA_OFFSET BIT(0)
|
||||
+
|
||||
enum cedrus_codec {
|
||||
CEDRUS_CODEC_MPEG2,
|
||||
|
||||
@@ -91,6 +93,7 @@ struct cedrus_dec_ops {
|
||||
|
||||
struct cedrus_variant {
|
||||
unsigned int capabilities;
|
||||
+ unsigned int quirks;
|
||||
};
|
||||
|
||||
struct cedrus_dev {
|
||||
diff --git a/drivers/staging/media/sunxi/cedrus/cedrus_hw.c b/drivers/staging/media/sunxi/cedrus/cedrus_hw.c
|
||||
index 0acf219a8c91..fbfff7c1c771 100644
|
||||
--- a/drivers/staging/media/sunxi/cedrus/cedrus_hw.c
|
||||
+++ b/drivers/staging/media/sunxi/cedrus/cedrus_hw.c
|
||||
@@ -177,7 +177,8 @@ int cedrus_hw_probe(struct cedrus_dev *dev)
|
||||
*/
|
||||
|
||||
#ifdef PHYS_PFN_OFFSET
|
||||
- dev->dev->dma_pfn_offset = PHYS_PFN_OFFSET;
|
||||
+ if (!(variant->quirks & CEDRUS_QUIRK_NO_DMA_OFFSET))
|
||||
+ dev->dev->dma_pfn_offset = PHYS_PFN_OFFSET;
|
||||
#endif
|
||||
|
||||
ret = of_reserved_mem_device_init(dev->dev);
|
||||
--
|
||||
2.20.1
|
||||
|
||||
|
||||
From 744c66f8c328ef40b6fb246f8b9f2daa9cce4d9d Mon Sep 17 00:00:00 2001
|
||||
From: Jernej Skrabec <jernej.skrabec@siol.net>
|
||||
Date: Mon, 28 Jan 2019 19:47:33 +0100
|
||||
Subject: [PATCH 3/6] media: cedrus: Add support for H6
|
||||
|
||||
H6 has improved VPU. It supports 10-bit HEVC decoding and AFBC output
|
||||
format for HEVC.
|
||||
|
||||
Signed-off-by: Jernej Skrabec <jernej.skrabec@siol.net>
|
||||
---
|
||||
drivers/staging/media/sunxi/cedrus/cedrus.c | 9 +++++++++
|
||||
1 file changed, 9 insertions(+)
|
||||
|
||||
diff --git a/drivers/staging/media/sunxi/cedrus/cedrus.c b/drivers/staging/media/sunxi/cedrus/cedrus.c
|
||||
index ff11cbeba205..b98add3cdedd 100644
|
||||
--- a/drivers/staging/media/sunxi/cedrus/cedrus.c
|
||||
+++ b/drivers/staging/media/sunxi/cedrus/cedrus.c
|
||||
@@ -396,6 +396,11 @@ static const struct cedrus_variant sun50i_h5_cedrus_variant = {
|
||||
.capabilities = CEDRUS_CAPABILITY_UNTILED,
|
||||
};
|
||||
|
||||
+static const struct cedrus_variant sun50i_h6_cedrus_variant = {
|
||||
+ .capabilities = CEDRUS_CAPABILITY_UNTILED,
|
||||
+ .quirks = CEDRUS_QUIRK_NO_DMA_OFFSET,
|
||||
+};
|
||||
+
|
||||
static const struct of_device_id cedrus_dt_match[] = {
|
||||
{
|
||||
.compatible = "allwinner,sun4i-a10-video-engine",
|
||||
@@ -425,6 +430,10 @@ static const struct of_device_id cedrus_dt_match[] = {
|
||||
.compatible = "allwinner,sun50i-h5-video-engine",
|
||||
.data = &sun50i_h5_cedrus_variant,
|
||||
},
|
||||
+ {
|
||||
+ .compatible = "allwinner,sun50i-h6-video-engine",
|
||||
+ .data = &sun50i_h6_cedrus_variant,
|
||||
+ },
|
||||
{ /* sentinel */ }
|
||||
};
|
||||
MODULE_DEVICE_TABLE(of, cedrus_dt_match);
|
||||
--
|
||||
2.20.1
|
||||
|
||||
|
||||
From c1b3128ac98c05c0afde4e6e065d6b1f2ae1dfa7 Mon Sep 17 00:00:00 2001
|
||||
From: Jernej Skrabec <jernej.skrabec@siol.net>
|
||||
Date: Mon, 28 Jan 2019 19:59:27 +0100
|
||||
Subject: [PATCH 6/6] arm64: dts: allwinner: h6: Add Video Engine node
|
||||
|
||||
This adds the Video engine node for H6. It can use whole DRAM range so
|
||||
there is no need for reserved memory node.
|
||||
|
||||
Signed-off-by: Jernej Skrabec <jernej.skrabec@siol.net>
|
||||
---
|
||||
arch/arm64/boot/dts/allwinner/sun50i-h6.dtsi | 11 +++++++++++
|
||||
1 file changed, 11 insertions(+)
|
||||
|
||||
diff --git a/arch/arm64/boot/dts/allwinner/sun50i-h6.dtsi b/arch/arm64/boot/dts/allwinner/sun50i-h6.dtsi
|
||||
index 247dc0a5ce89..de4b7a1f1012 100644
|
||||
--- a/arch/arm64/boot/dts/allwinner/sun50i-h6.dtsi
|
||||
+++ b/arch/arm64/boot/dts/allwinner/sun50i-h6.dtsi
|
||||
@@ -146,6 +146,17 @@
|
||||
};
|
||||
};
|
||||
|
||||
+ video-codec@1c0e000 {
|
||||
+ compatible = "allwinner,sun50i-h6-video-engine";
|
||||
+ reg = <0x01c0e000 0x2000>;
|
||||
+ clocks = <&ccu CLK_BUS_VE>, <&ccu CLK_VE>,
|
||||
+ <&ccu CLK_MBUS_VE>;
|
||||
+ clock-names = "ahb", "mod", "ram";
|
||||
+ resets = <&ccu RST_BUS_VE>;
|
||||
+ interrupts = <GIC_SPI 89 IRQ_TYPE_LEVEL_HIGH>;
|
||||
+ allwinner,sram = <&ve_sram 1>;
|
||||
+ };
|
||||
+
|
||||
syscon: syscon@3000000 {
|
||||
compatible = "allwinner,sun50i-h6-system-control",
|
||||
"allwinner,sun50i-a64-system-control";
|
||||
--
|
||||
2.20.1
|
||||
|
||||
From 87effaae9e90474546d441b9123bca824e670a0b Mon Sep 17 00:00:00 2001
|
||||
From: Fish Lin <linfish@google.com>
|
||||
Date: Thu, 28 Mar 2019 23:20:46 -0400
|
||||
Subject: [PATCH] media: v4l: add I / P frame min max QP definitions
|
||||
|
||||
Add following V4L2 QP parameters for H.264:
|
||||
* V4L2_CID_MPEG_VIDEO_H264_I_FRAME_MIN_QP
|
||||
* V4L2_CID_MPEG_VIDEO_H264_I_FRAME_MAX_QP
|
||||
* V4L2_CID_MPEG_VIDEO_H264_P_FRAME_MIN_QP
|
||||
* V4L2_CID_MPEG_VIDEO_H264_P_FRAME_MAX_QP
|
||||
|
||||
These controls will limit QP range for intra and inter frame,
|
||||
provide more manual control to improve video encode quality.
|
||||
|
||||
Signed-off-by: Fish Lin <linfish@google.com>
|
||||
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
|
||||
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
|
||||
---
|
||||
.../media/uapi/v4l/ext-ctrls-codec.rst | 24 +++++++++++++++++++
|
||||
drivers/media/v4l2-core/v4l2-ctrls.c | 4 ++++
|
||||
include/uapi/linux/v4l2-controls.h | 4 ++++
|
||||
3 files changed, 32 insertions(+)
|
||||
|
||||
diff --git a/Documentation/media/uapi/v4l/ext-ctrls-codec.rst b/Documentation/media/uapi/v4l/ext-ctrls-codec.rst
|
||||
index 67a122339c0e..4a8446203085 100644
|
||||
--- a/Documentation/media/uapi/v4l/ext-ctrls-codec.rst
|
||||
+++ b/Documentation/media/uapi/v4l/ext-ctrls-codec.rst
|
||||
@@ -1055,6 +1055,30 @@ enum v4l2_mpeg_video_h264_entropy_mode -
|
||||
Quantization parameter for an B frame for H264. Valid range: from 0
|
||||
to 51.
|
||||
|
||||
+``V4L2_CID_MPEG_VIDEO_H264_I_FRAME_MIN_QP (integer)``
|
||||
+ Minimum quantization parameter for the H264 I frame to limit I frame
|
||||
+ quality to a range. Valid range: from 0 to 51. If
|
||||
+ V4L2_CID_MPEG_VIDEO_H264_MIN_QP is also set, the quantization parameter
|
||||
+ should be chosen to meet both requirements.
|
||||
+
|
||||
+``V4L2_CID_MPEG_VIDEO_H264_I_FRAME_MAX_QP (integer)``
|
||||
+ Maximum quantization parameter for the H264 I frame to limit I frame
|
||||
+ quality to a range. Valid range: from 0 to 51. If
|
||||
+ V4L2_CID_MPEG_VIDEO_H264_MAX_QP is also set, the quantization parameter
|
||||
+ should be chosen to meet both requirements.
|
||||
+
|
||||
+``V4L2_CID_MPEG_VIDEO_H264_P_FRAME_MIN_QP (integer)``
|
||||
+ Minimum quantization parameter for the H264 P frame to limit P frame
|
||||
+ quality to a range. Valid range: from 0 to 51. If
|
||||
+ V4L2_CID_MPEG_VIDEO_H264_MIN_QP is also set, the quantization parameter
|
||||
+ should be chosen to meet both requirements.
|
||||
+
|
||||
+``V4L2_CID_MPEG_VIDEO_H264_P_FRAME_MAX_QP (integer)``
|
||||
+ Maximum quantization parameter for the H264 P frame to limit P frame
|
||||
+ quality to a range. Valid range: from 0 to 51. If
|
||||
+ V4L2_CID_MPEG_VIDEO_H264_MAX_QP is also set, the quantization parameter
|
||||
+ should be chosen to meet both requirements.
|
||||
+
|
||||
``V4L2_CID_MPEG_VIDEO_MPEG4_I_FRAME_QP (integer)``
|
||||
Quantization parameter for an I frame for MPEG4. Valid range: from 1
|
||||
to 31.
|
||||
diff --git a/drivers/media/v4l2-core/v4l2-ctrls.c b/drivers/media/v4l2-core/v4l2-ctrls.c
|
||||
index b1ae2e555c68..89a1fe564675 100644
|
||||
--- a/drivers/media/v4l2-core/v4l2-ctrls.c
|
||||
+++ b/drivers/media/v4l2-core/v4l2-ctrls.c
|
||||
@@ -828,6 +828,10 @@ const char *v4l2_ctrl_get_name(u32 id)
|
||||
case V4L2_CID_MPEG_VIDEO_H264_CONSTRAINED_INTRA_PREDICTION:
|
||||
return "H264 Constrained Intra Pred";
|
||||
case V4L2_CID_MPEG_VIDEO_H264_CHROMA_QP_INDEX_OFFSET: return "H264 Chroma QP Index Offset";
|
||||
+ case V4L2_CID_MPEG_VIDEO_H264_I_FRAME_MIN_QP: return "H264 I-Frame Minimum QP Value";
|
||||
+ case V4L2_CID_MPEG_VIDEO_H264_I_FRAME_MAX_QP: return "H264 I-Frame Maximum QP Value";
|
||||
+ case V4L2_CID_MPEG_VIDEO_H264_P_FRAME_MIN_QP: return "H264 P-Frame Minimum QP Value";
|
||||
+ case V4L2_CID_MPEG_VIDEO_H264_P_FRAME_MAX_QP: return "H264 P-Frame Maximum QP Value";
|
||||
case V4L2_CID_MPEG_VIDEO_MPEG4_I_FRAME_QP: return "MPEG4 I-Frame QP Value";
|
||||
case V4L2_CID_MPEG_VIDEO_MPEG4_P_FRAME_QP: return "MPEG4 P-Frame QP Value";
|
||||
case V4L2_CID_MPEG_VIDEO_MPEG4_B_FRAME_QP: return "MPEG4 B-Frame QP Value";
|
||||
diff --git a/include/uapi/linux/v4l2-controls.h b/include/uapi/linux/v4l2-controls.h
|
||||
index 78816ec88751..37807f23231e 100644
|
||||
--- a/include/uapi/linux/v4l2-controls.h
|
||||
+++ b/include/uapi/linux/v4l2-controls.h
|
||||
@@ -539,6 +539,10 @@ enum v4l2_mpeg_video_h264_hierarchical_coding_type {
|
||||
#define V4L2_CID_MPEG_VIDEO_H264_HIERARCHICAL_CODING_LAYER_QP (V4L2_CID_MPEG_BASE+382)
|
||||
#define V4L2_CID_MPEG_VIDEO_H264_CONSTRAINED_INTRA_PREDICTION (V4L2_CID_MPEG_BASE+383)
|
||||
#define V4L2_CID_MPEG_VIDEO_H264_CHROMA_QP_INDEX_OFFSET (V4L2_CID_MPEG_BASE+384)
|
||||
+#define V4L2_CID_MPEG_VIDEO_H264_I_FRAME_MIN_QP (V4L2_CID_MPEG_BASE+385)
|
||||
+#define V4L2_CID_MPEG_VIDEO_H264_I_FRAME_MAX_QP (V4L2_CID_MPEG_BASE+386)
|
||||
+#define V4L2_CID_MPEG_VIDEO_H264_P_FRAME_MIN_QP (V4L2_CID_MPEG_BASE+387)
|
||||
+#define V4L2_CID_MPEG_VIDEO_H264_P_FRAME_MAX_QP (V4L2_CID_MPEG_BASE+388)
|
||||
#define V4L2_CID_MPEG_VIDEO_MPEG4_I_FRAME_QP (V4L2_CID_MPEG_BASE+400)
|
||||
#define V4L2_CID_MPEG_VIDEO_MPEG4_P_FRAME_QP (V4L2_CID_MPEG_BASE+401)
|
||||
#define V4L2_CID_MPEG_VIDEO_MPEG4_B_FRAME_QP (V4L2_CID_MPEG_BASE+402)
|
||||
--
|
||||
2.21.0
|
||||
|
||||
From 26fae7a41313506931c9be5f532c12d8d654f153 Mon Sep 17 00:00:00 2001
|
||||
From: Jernej Skrabec <jernej.skrabec@siol.net>
|
||||
Date: Tue, 2 Apr 2019 23:06:22 +0200
|
||||
Subject: [PATCH] clk: sunxi-ng: h6: Preset hdmi-cec clock parent
|
||||
|
||||
H6 manual and BSP clock driver both states that hdmi-cec clock has two
|
||||
possible parents, osc32k and pll-periph0-2x with 36621 predivider.
|
||||
Because pll-periph0-2x is always 1.2 GHz, both parents give same
|
||||
hdmi-cec rate - 32768 Hz, which is exactly the rate needed for HDMI CEC
|
||||
controller to operate correctly.
|
||||
|
||||
However, for some reason, HDMI CEC controller doesn't work if default
|
||||
parent (osc32k) is used. BSP HDMI driver also always use pll-periph0-2x
|
||||
as hdmi-cec clock parent.
|
||||
|
||||
In order to solve the issue, preset hdmi-cec clock parent to
|
||||
pll-periph0-2x.
|
||||
|
||||
Signed-off-by: Jernej Skrabec <jernej.skrabec@siol.net>
|
||||
Signed-off-by: Maxime Ripard <maxime.ripard@bootlin.com>
|
||||
---
|
||||
drivers/clk/sunxi-ng/ccu-sun50i-h6.c | 11 +++++++++++
|
||||
1 file changed, 11 insertions(+)
|
||||
|
||||
diff --git a/drivers/clk/sunxi-ng/ccu-sun50i-h6.c b/drivers/clk/sunxi-ng/ccu-sun50i-h6.c
|
||||
index daf78966555e..33980067b06e 100644
|
||||
--- a/drivers/clk/sunxi-ng/ccu-sun50i-h6.c
|
||||
+++ b/drivers/clk/sunxi-ng/ccu-sun50i-h6.c
|
||||
@@ -656,6 +656,8 @@ static const char * const hdmi_cec_parents[] = { "osc32k", "pll-periph0-2x" };
|
||||
static const struct ccu_mux_fixed_prediv hdmi_cec_predivs[] = {
|
||||
{ .index = 1, .div = 36621 },
|
||||
};
|
||||
+
|
||||
+#define SUN50I_H6_HDMI_CEC_CLK_REG 0xb10
|
||||
static struct ccu_mux hdmi_cec_clk = {
|
||||
.enable = BIT(31),
|
||||
|
||||
@@ -1200,6 +1202,15 @@ static int sun50i_h6_ccu_probe(struct platform_device *pdev)
|
||||
val &= ~(GENMASK(21, 16) | BIT(0));
|
||||
writel(val | (7 << 16), reg + SUN50I_H6_PLL_AUDIO_REG);
|
||||
|
||||
+ /*
|
||||
+ * First clock parent (osc32K) is unusable for CEC. But since there
|
||||
+ * is no good way to force parent switch (both run with same frequency),
|
||||
+ * just set second clock parent here.
|
||||
+ */
|
||||
+ val = readl(reg + SUN50I_H6_HDMI_CEC_CLK_REG);
|
||||
+ val |= BIT(24);
|
||||
+ writel(val, reg + SUN50I_H6_HDMI_CEC_CLK_REG);
|
||||
+
|
||||
return sunxi_ccu_probe(pdev->dev.of_node, reg, &sun50i_h6_ccu_desc);
|
||||
}
|
||||
|
||||
--
|
||||
2.21.0
|
||||
|
||||
From 6597ce3de9e443f0cab693496fc529f55ae6eb01 Mon Sep 17 00:00:00 2001
|
||||
From: Jernej Skrabec <jernej.skrabec@siol.net>
|
||||
Date: Wed, 3 Apr 2019 17:14:03 +0200
|
||||
Subject: [PATCH] clk: sunxi-ng: h6: Allow video & vpu clocks to change parent
|
||||
rate
|
||||
|
||||
Video related clocks need to set rate as close as possible to the
|
||||
requested one, so they should be able to change parent clock rate.
|
||||
|
||||
When processing 4K video, VPU clock has to be set to higher rate than it
|
||||
is default parent rate. Because of that, VPU clock should be able to
|
||||
change parent clock rate.
|
||||
|
||||
Add CLK_SET_RATE_PARENT flag to tcon-lcd0, tcon-tv0 and ve.
|
||||
|
||||
Signed-off-by: Jernej Skrabec <jernej.skrabec@siol.net>
|
||||
Signed-off-by: Maxime Ripard <maxime.ripard@bootlin.com>
|
||||
---
|
||||
drivers/clk/sunxi-ng/ccu-sun50i-h6.c | 6 +++---
|
||||
1 file changed, 3 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/drivers/clk/sunxi-ng/ccu-sun50i-h6.c b/drivers/clk/sunxi-ng/ccu-sun50i-h6.c
|
||||
index 33980067b06e..3c32d7798f27 100644
|
||||
--- a/drivers/clk/sunxi-ng/ccu-sun50i-h6.c
|
||||
+++ b/drivers/clk/sunxi-ng/ccu-sun50i-h6.c
|
||||
@@ -311,7 +311,7 @@ static SUNXI_CCU_M_WITH_MUX_GATE(ve_clk, "ve", ve_parents, 0x690,
|
||||
0, 3, /* M */
|
||||
24, 1, /* mux */
|
||||
BIT(31), /* gate */
|
||||
- 0);
|
||||
+ CLK_SET_RATE_PARENT);
|
||||
|
||||
static SUNXI_CCU_GATE(bus_ve_clk, "bus-ve", "psi-ahb1-ahb2",
|
||||
0x69c, BIT(0), 0);
|
||||
@@ -691,7 +691,7 @@ static SUNXI_CCU_MUX_WITH_GATE(tcon_lcd0_clk, "tcon-lcd0",
|
||||
tcon_lcd0_parents, 0xb60,
|
||||
24, 3, /* mux */
|
||||
BIT(31), /* gate */
|
||||
- 0);
|
||||
+ CLK_SET_RATE_PARENT);
|
||||
|
||||
static SUNXI_CCU_GATE(bus_tcon_lcd0_clk, "bus-tcon-lcd0", "ahb3",
|
||||
0xb7c, BIT(0), 0);
|
||||
@@ -706,7 +706,7 @@ static SUNXI_CCU_MP_WITH_MUX_GATE(tcon_tv0_clk, "tcon-tv0",
|
||||
8, 2, /* P */
|
||||
24, 3, /* mux */
|
||||
BIT(31), /* gate */
|
||||
- 0);
|
||||
+ CLK_SET_RATE_PARENT);
|
||||
|
||||
static SUNXI_CCU_GATE(bus_tcon_tv0_clk, "bus-tcon-tv0", "ahb3",
|
||||
0xb9c, BIT(0), 0);
|
||||
--
|
||||
2.21.0
|
||||
|
2765
projects/Allwinner/patches/linux/0003-backport-from-5.3.patch
Normal file
2765
projects/Allwinner/patches/linux/0003-backport-from-5.3.patch
Normal file
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -1,8 +1,85 @@
|
||||
From bf21ad0889bdcc1dc12fe5a024fd7df7ad2c4310 Mon Sep 17 00:00:00 2001
|
||||
From: Jonas Karlman <jonas@kwiboo.se>
|
||||
Date: Tue, 26 Feb 2019 20:45:14 +0000
|
||||
Subject: [PATCH 1/2] WIP: dw-hdmi-cec: sleep 100ms on error
|
||||
|
||||
---
|
||||
drivers/gpu/drm/bridge/synopsys/dw-hdmi-cec.c | 18 ++++++++++++++++--
|
||||
1 file changed, 16 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi-cec.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi-cec.c
|
||||
index 6c323510f128..b5a1a85c8700 100644
|
||||
--- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi-cec.c
|
||||
+++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi-cec.c
|
||||
@@ -7,6 +7,7 @@
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*/
|
||||
+#include <linux/delay.h>
|
||||
#include <linux/interrupt.h>
|
||||
#include <linux/io.h>
|
||||
#include <linux/module.h>
|
||||
@@ -132,8 +133,15 @@ static irqreturn_t dw_hdmi_cec_hardirq(int irq, void *data)
|
||||
|
||||
dw_hdmi_write(cec, stat, HDMI_IH_CEC_STAT0);
|
||||
|
||||
- if (stat & CEC_STAT_ERROR_INIT) {
|
||||
- cec->tx_status = CEC_TX_STATUS_ERROR;
|
||||
+ /* Status with both done and error_initiator bits have been seen
|
||||
+ * on Rockchip RK3328 devices, transmit attempt seems to have failed
|
||||
+ * when this happens, report as low drive and block cec-framework
|
||||
+ * 100ms before core retransmits the failed message, this seems to
|
||||
+ * mitigate the issue with failed transmit attempts.
|
||||
+ */
|
||||
+ if ((stat & (CEC_STAT_DONE|CEC_STAT_ERROR_INIT)) == (CEC_STAT_DONE|CEC_STAT_ERROR_INIT)) {
|
||||
+ pr_info("dw_hdmi_cec_hardirq: stat=%02x LOW_DRIVE\n", stat);
|
||||
+ cec->tx_status = CEC_TX_STATUS_LOW_DRIVE;
|
||||
cec->tx_done = true;
|
||||
ret = IRQ_WAKE_THREAD;
|
||||
} else if (stat & CEC_STAT_DONE) {
|
||||
@@ -144,6 +152,10 @@ static irqreturn_t dw_hdmi_cec_hardirq(int irq, void *data)
|
||||
cec->tx_status = CEC_TX_STATUS_NACK;
|
||||
cec->tx_done = true;
|
||||
ret = IRQ_WAKE_THREAD;
|
||||
+ } else if (stat & CEC_STAT_ERROR_INIT) {
|
||||
+ cec->tx_status = CEC_TX_STATUS_ERROR;
|
||||
+ cec->tx_done = true;
|
||||
+ ret = IRQ_WAKE_THREAD;
|
||||
}
|
||||
|
||||
if (stat & CEC_STAT_EOM) {
|
||||
@@ -176,6 +188,8 @@ static irqreturn_t dw_hdmi_cec_thread(int irq, void *data)
|
||||
|
||||
if (cec->tx_done) {
|
||||
cec->tx_done = false;
|
||||
+ if (cec->tx_status == CEC_TX_STATUS_LOW_DRIVE)
|
||||
+ msleep(100);
|
||||
cec_transmit_attempt_done(adap, cec->tx_status);
|
||||
}
|
||||
if (cec->rx_done) {
|
||||
--
|
||||
2.21.0
|
||||
|
||||
|
||||
From 12f1abe2b5cee6575c6dd9cd29b17b589f044b80 Mon Sep 17 00:00:00 2001
|
||||
From: Jernej Skrabec <jernej.skrabec@siol.net>
|
||||
Date: Sat, 25 May 2019 12:03:39 +0200
|
||||
Subject: [PATCH 2/2] WIP: sun8i-hdmi CEC improvements
|
||||
|
||||
Signed-off-by: Jernej Skrabec <jernej.skrabec@siol.net>
|
||||
---
|
||||
drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 2 +-
|
||||
drivers/gpu/drm/sun4i/Kconfig | 10 +++
|
||||
drivers/gpu/drm/sun4i/sun8i_dw_hdmi.h | 11 +++
|
||||
drivers/gpu/drm/sun4i/sun8i_hdmi_phy.c | 83 ++++++++++++++++++++++-
|
||||
include/drm/bridge/dw_hdmi.h | 2 +
|
||||
5 files changed, 105 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c
|
||||
index a63e5f0dae56..fdda26f8b056 100644
|
||||
index 09fdc9f87651..f359c4c3f1d1 100644
|
||||
--- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c
|
||||
+++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c
|
||||
@@ -2634,7 +2634,7 @@ __dw_hdmi_probe(struct platform_device *pdev,
|
||||
@@ -2713,7 +2713,7 @@ __dw_hdmi_probe(struct platform_device *pdev,
|
||||
hdmi->audio = platform_device_register_full(&pdevinfo);
|
||||
}
|
||||
|
||||
@ -33,7 +110,7 @@ index 1dbbc3a1b763..7149c72e44c8 100644
|
||||
tristate "Support for Allwinner Display Engine 2.0 Mixer"
|
||||
default MACH_SUN8I
|
||||
diff --git a/drivers/gpu/drm/sun4i/sun8i_dw_hdmi.h b/drivers/gpu/drm/sun4i/sun8i_dw_hdmi.h
|
||||
index 720c5aa8adc1..82dd84094638 100644
|
||||
index 720c5aa8adc1..49ca001923e3 100644
|
||||
--- a/drivers/gpu/drm/sun4i/sun8i_dw_hdmi.h
|
||||
+++ b/drivers/gpu/drm/sun4i/sun8i_dw_hdmi.h
|
||||
@@ -12,6 +12,7 @@
|
||||
@ -71,15 +148,15 @@ index 720c5aa8adc1..82dd84094638 100644
|
||||
|
||||
struct sun8i_hdmi_phy {
|
||||
+ struct cec_adapter *cec_adapter;
|
||||
+ struct cec_notifier *cec_notifier;
|
||||
+ struct cec_notifier *cec_notifier;
|
||||
struct clk *clk_bus;
|
||||
struct clk *clk_mod;
|
||||
struct clk *clk_phy;
|
||||
diff --git a/drivers/gpu/drm/sun4i/sun8i_hdmi_phy.c b/drivers/gpu/drm/sun4i/sun8i_hdmi_phy.c
|
||||
index 66ea3a902e36..70e291353569 100644
|
||||
index 43643ad31730..d840bc07cba6 100644
|
||||
--- a/drivers/gpu/drm/sun4i/sun8i_hdmi_phy.c
|
||||
+++ b/drivers/gpu/drm/sun4i/sun8i_hdmi_phy.c
|
||||
@@ -503,8 +503,9 @@ static void sun8i_hdmi_phy_init_h3(struct sun8i_hdmi_phy *phy)
|
||||
@@ -504,8 +504,9 @@ static void sun8i_hdmi_phy_init_h3(struct sun8i_hdmi_phy *phy)
|
||||
regmap_update_bits(phy->regs, SUN8I_HDMI_PHY_PLL_CFG1_REG,
|
||||
SUN8I_HDMI_PHY_PLL_CFG1_CKIN_SEL_MSK, 0);
|
||||
|
||||
@ -91,7 +168,7 @@ index 66ea3a902e36..70e291353569 100644
|
||||
|
||||
/* read calibration data */
|
||||
regmap_read(phy->regs, SUN8I_HDMI_PHY_ANA_STS_REG, &val);
|
||||
@@ -530,8 +531,49 @@ void sun8i_hdmi_phy_set_ops(struct sun8i_hdmi_phy *phy,
|
||||
@@ -531,8 +532,49 @@ void sun8i_hdmi_phy_set_ops(struct sun8i_hdmi_phy *phy,
|
||||
plat_data->cur_ctr = variant->cur_ctr;
|
||||
plat_data->phy_config = variant->phy_cfg;
|
||||
}
|
||||
@ -141,7 +218,7 @@ index 66ea3a902e36..70e291353569 100644
|
||||
static struct regmap_config sun8i_hdmi_phy_regmap_config = {
|
||||
.reg_bits = 32,
|
||||
.val_bits = 32,
|
||||
@@ -548,6 +590,7 @@ static const struct sun8i_hdmi_phy_variant sun8i_a83t_hdmi_phy = {
|
||||
@@ -549,6 +591,7 @@ static const struct sun8i_hdmi_phy_variant sun8i_a83t_hdmi_phy = {
|
||||
};
|
||||
|
||||
static const struct sun8i_hdmi_phy_variant sun8i_h3_hdmi_phy = {
|
||||
@ -149,7 +226,7 @@ index 66ea3a902e36..70e291353569 100644
|
||||
.has_phy_clk = true,
|
||||
.is_custom_phy = true,
|
||||
.phy_init = &sun8i_hdmi_phy_init_h3,
|
||||
@@ -556,6 +599,7 @@ static const struct sun8i_hdmi_phy_variant sun8i_h3_hdmi_phy = {
|
||||
@@ -557,6 +600,7 @@ static const struct sun8i_hdmi_phy_variant sun8i_h3_hdmi_phy = {
|
||||
};
|
||||
|
||||
static const struct sun8i_hdmi_phy_variant sun8i_r40_hdmi_phy = {
|
||||
@ -157,7 +234,7 @@ index 66ea3a902e36..70e291353569 100644
|
||||
.has_phy_clk = true,
|
||||
.has_second_pll = true,
|
||||
.is_custom_phy = true,
|
||||
@@ -565,6 +609,7 @@ static const struct sun8i_hdmi_phy_variant sun8i_r40_hdmi_phy = {
|
||||
@@ -566,6 +610,7 @@ static const struct sun8i_hdmi_phy_variant sun8i_r40_hdmi_phy = {
|
||||
};
|
||||
|
||||
static const struct sun8i_hdmi_phy_variant sun50i_a64_hdmi_phy = {
|
||||
@ -165,7 +242,7 @@ index 66ea3a902e36..70e291353569 100644
|
||||
.has_phy_clk = true,
|
||||
.is_custom_phy = true,
|
||||
.phy_init = &sun8i_hdmi_phy_init_h3,
|
||||
@@ -708,10 +753,40 @@ int sun8i_hdmi_phy_probe(struct sun8i_dw_hdmi *hdmi, struct device_node *node)
|
||||
@@ -711,10 +756,40 @@ int sun8i_hdmi_phy_probe(struct sun8i_dw_hdmi *hdmi, struct device_node *node)
|
||||
clk_prepare_enable(phy->clk_phy);
|
||||
}
|
||||
|
||||
@ -204,9 +281,9 @@ index 66ea3a902e36..70e291353569 100644
|
||||
+err_disable_clk_phy:
|
||||
+ clk_disable_unprepare(phy->clk_phy);
|
||||
err_disable_clk_mod:
|
||||
clk_disable_unprepare(phy->clk_mod);
|
||||
clk_disable_unprepare(phy->clk_mod);
|
||||
err_disable_clk_bus:
|
||||
@@ -736,6 +811,10 @@ void sun8i_hdmi_phy_remove(struct sun8i_dw_hdmi *hdmi)
|
||||
@@ -739,6 +814,10 @@ void sun8i_hdmi_phy_remove(struct sun8i_dw_hdmi *hdmi)
|
||||
{
|
||||
struct sun8i_hdmi_phy *phy = hdmi->phy;
|
||||
|
||||
@ -218,7 +295,7 @@ index 66ea3a902e36..70e291353569 100644
|
||||
clk_disable_unprepare(phy->clk_bus);
|
||||
clk_disable_unprepare(phy->clk_phy);
|
||||
diff --git a/include/drm/bridge/dw_hdmi.h b/include/drm/bridge/dw_hdmi.h
|
||||
index 66e70770cce5..764b8bcfa62c 100644
|
||||
index 323febe7f102..cec73761856d 100644
|
||||
--- a/include/drm/bridge/dw_hdmi.h
|
||||
+++ b/include/drm/bridge/dw_hdmi.h
|
||||
@@ -144,6 +144,8 @@ struct dw_hdmi_plat_data {
|
||||
@ -230,3 +307,6 @@ index 66e70770cce5..764b8bcfa62c 100644
|
||||
};
|
||||
|
||||
struct dw_hdmi *dw_hdmi_probe(struct platform_device *pdev,
|
||||
--
|
||||
2.21.0
|
||||
|
@ -0,0 +1,76 @@
|
||||
From 443ca53cf78c635aa5bebe9f115721e55fe9ca38 Mon Sep 17 00:00:00 2001
|
||||
From: Jernej Skrabec <jernej.skrabec@siol.net>
|
||||
Date: Sat, 25 May 2019 12:33:05 +0200
|
||||
Subject: [PATCH] media: cedrus: Fix decoding for some H264 videos
|
||||
|
||||
It seems that for some H264 videos at least one bitstream parsing
|
||||
trigger must be called in order to be decoded correctly. There is no
|
||||
explanation why this helps, but it was observed that two sample videos
|
||||
with this fix are now decoded correctly and there is no regression with
|
||||
others.
|
||||
|
||||
Signed-off-by: Jernej Skrabec <jernej.skrabec@siol.net>
|
||||
---
|
||||
.../staging/media/sunxi/cedrus/cedrus_h264.c | 22 ++++++++++++++++---
|
||||
1 file changed, 19 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/drivers/staging/media/sunxi/cedrus/cedrus_h264.c b/drivers/staging/media/sunxi/cedrus/cedrus_h264.c
|
||||
index a30bb283f69f..fab14de1815a 100644
|
||||
--- a/drivers/staging/media/sunxi/cedrus/cedrus_h264.c
|
||||
+++ b/drivers/staging/media/sunxi/cedrus/cedrus_h264.c
|
||||
@@ -6,6 +6,7 @@
|
||||
* Copyright (c) 2018 Bootlin
|
||||
*/
|
||||
|
||||
+#include <linux/delay.h>
|
||||
#include <linux/types.h>
|
||||
|
||||
#include <media/videobuf2-dma-contig.h>
|
||||
@@ -289,6 +290,20 @@ static void cedrus_write_pred_weight_table(struct cedrus_ctx *ctx,
|
||||
}
|
||||
}
|
||||
|
||||
+static void cedrus_skip_bits(struct cedrus_dev *dev, int num)
|
||||
+{
|
||||
+ for (; num > 32; num -= 32) {
|
||||
+ cedrus_write(dev, VE_H264_TRIGGER_TYPE, 0x3 | (32 << 8));
|
||||
+ while (cedrus_read(dev, VE_H264_STATUS) & (1 << 8))
|
||||
+ udelay(1);
|
||||
+ }
|
||||
+ if (num > 0) {
|
||||
+ cedrus_write(dev, VE_H264_TRIGGER_TYPE, 0x3 | (num << 8));
|
||||
+ while (cedrus_read(dev, VE_H264_STATUS) & (1 << 8))
|
||||
+ udelay(1);
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
static void cedrus_set_params(struct cedrus_ctx *ctx,
|
||||
struct cedrus_run *run)
|
||||
{
|
||||
@@ -299,12 +314,11 @@ static void cedrus_set_params(struct cedrus_ctx *ctx,
|
||||
struct vb2_buffer *src_buf = &run->src->vb2_buf;
|
||||
struct cedrus_dev *dev = ctx->dev;
|
||||
dma_addr_t src_buf_addr;
|
||||
- u32 offset = slice->header_bit_size;
|
||||
- u32 len = (slice->size * 8) - offset;
|
||||
+ u32 len = slice->size * 8;
|
||||
u32 reg;
|
||||
|
||||
cedrus_write(dev, VE_H264_VLD_LEN, len);
|
||||
- cedrus_write(dev, VE_H264_VLD_OFFSET, offset);
|
||||
+ cedrus_write(dev, VE_H264_VLD_OFFSET, 0);
|
||||
|
||||
src_buf_addr = vb2_dma_contig_plane_dma_addr(src_buf, 0);
|
||||
cedrus_write(dev, VE_H264_VLD_END,
|
||||
@@ -323,6 +337,8 @@ static void cedrus_set_params(struct cedrus_ctx *ctx,
|
||||
cedrus_write(dev, VE_H264_TRIGGER_TYPE,
|
||||
VE_H264_TRIGGER_TYPE_INIT_SWDEC);
|
||||
|
||||
+ cedrus_skip_bits(dev, slice->header_bit_size);
|
||||
+
|
||||
if (((pps->flags & V4L2_H264_PPS_FLAG_WEIGHTED_PRED) &&
|
||||
(slice->slice_type == V4L2_H264_SLICE_TYPE_P ||
|
||||
slice->slice_type == V4L2_H264_SLICE_TYPE_SP)) ||
|
||||
--
|
||||
2.21.0
|
||||
|
@ -0,0 +1,36 @@
|
||||
From fce7f7e700176b402b303d2a62813cc0cdd061e0 Mon Sep 17 00:00:00 2001
|
||||
From: Jernej Skrabec <jernej.skrabec@siol.net>
|
||||
Date: Sat, 25 May 2019 13:18:50 +0200
|
||||
Subject: [PATCH 2/5] media: cedrus: Fix H264 default reference index count
|
||||
|
||||
Reference index count in VE_H264_PPS should come from PPS control.
|
||||
However, this is not really important, because reference index count is
|
||||
in our case always overridden by that from slice header.
|
||||
|
||||
Signed-off-by: Jernej Skrabec <jernej.skrabec@siol.net>
|
||||
---
|
||||
drivers/staging/media/sunxi/cedrus/cedrus_h264.c | 8 ++------
|
||||
1 file changed, 2 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/drivers/staging/media/sunxi/cedrus/cedrus_h264.c b/drivers/staging/media/sunxi/cedrus/cedrus_h264.c
|
||||
index fab14de1815a..d0ee3f90ff46 100644
|
||||
--- a/drivers/staging/media/sunxi/cedrus/cedrus_h264.c
|
||||
+++ b/drivers/staging/media/sunxi/cedrus/cedrus_h264.c
|
||||
@@ -356,12 +356,8 @@ static void cedrus_set_params(struct cedrus_ctx *ctx,
|
||||
|
||||
// picture parameters
|
||||
reg = 0;
|
||||
- /*
|
||||
- * FIXME: the kernel headers are allowing the default value to
|
||||
- * be passed, but the libva doesn't give us that.
|
||||
- */
|
||||
- reg |= (slice->num_ref_idx_l0_active_minus1 & 0x1f) << 10;
|
||||
- reg |= (slice->num_ref_idx_l1_active_minus1 & 0x1f) << 5;
|
||||
+ reg |= (pps->num_ref_idx_l0_default_active_minus1 & 0x1f) << 10;
|
||||
+ reg |= (pps->num_ref_idx_l1_default_active_minus1 & 0x1f) << 5;
|
||||
reg |= (pps->weighted_bipred_idc & 0x3) << 2;
|
||||
if (pps->flags & V4L2_H264_PPS_FLAG_ENTROPY_CODING_MODE)
|
||||
reg |= VE_H264_PPS_ENTROPY_CODING_MODE;
|
||||
--
|
||||
2.21.0
|
||||
|
@ -1,18 +1,18 @@
|
||||
From e41186f41a546d1c60797f090001da969f5eda5a Mon Sep 17 00:00:00 2001
|
||||
From 9714cf1bc8c5b48f21af3500e34497621b51a4b1 Mon Sep 17 00:00:00 2001
|
||||
From: Jernej Skrabec <jernej.skrabec@siol.net>
|
||||
Date: Thu, 14 Feb 2019 22:50:12 +0100
|
||||
Subject: [PATCH] cedrus: Improve H264
|
||||
Subject: [PATCH 3/5] media: cedrus: WIP H264 improvements
|
||||
|
||||
Signed-off-by: Jernej Skrabec <jernej.skrabec@siol.net>
|
||||
---
|
||||
.../staging/media/sunxi/cedrus/cedrus_h264.c | 69 +++++++++++--------
|
||||
1 file changed, 41 insertions(+), 28 deletions(-)
|
||||
.../staging/media/sunxi/cedrus/cedrus_h264.c | 37 ++++++++++++++-----
|
||||
1 file changed, 27 insertions(+), 10 deletions(-)
|
||||
|
||||
diff --git a/drivers/staging/media/sunxi/cedrus/cedrus_h264.c b/drivers/staging/media/sunxi/cedrus/cedrus_h264.c
|
||||
index a5c5f13ffecb..405545947b85 100644
|
||||
index d0ee3f90ff46..dcb8d3837869 100644
|
||||
--- a/drivers/staging/media/sunxi/cedrus/cedrus_h264.c
|
||||
+++ b/drivers/staging/media/sunxi/cedrus/cedrus_h264.c
|
||||
@@ -38,7 +38,7 @@ struct cedrus_h264_sram_ref_pic {
|
||||
@@ -39,7 +39,7 @@ struct cedrus_h264_sram_ref_pic {
|
||||
#define CEDRUS_H264_FRAME_NUM 18
|
||||
|
||||
#define CEDRUS_NEIGHBOR_INFO_BUF_SIZE (16 * SZ_1K)
|
||||
@ -21,7 +21,7 @@ index a5c5f13ffecb..405545947b85 100644
|
||||
|
||||
static void cedrus_h264_write_sram(struct cedrus_dev *dev,
|
||||
enum cedrus_h264_sram_off off,
|
||||
@@ -101,7 +101,7 @@ static void cedrus_write_frame_list(struct cedrus_ctx *ctx,
|
||||
@@ -102,7 +102,7 @@ static void cedrus_write_frame_list(struct cedrus_ctx *ctx,
|
||||
struct cedrus_dev *dev = ctx->dev;
|
||||
unsigned long used_dpbs = 0;
|
||||
unsigned int position;
|
||||
@ -30,7 +30,7 @@ index a5c5f13ffecb..405545947b85 100644
|
||||
unsigned int i;
|
||||
|
||||
memset(pic_list, 0, sizeof(pic_list));
|
||||
@@ -126,6 +126,11 @@ static void cedrus_write_frame_list(struct cedrus_ctx *ctx,
|
||||
@@ -123,6 +123,11 @@ static void cedrus_write_frame_list(struct cedrus_ctx *ctx,
|
||||
position = cedrus_buf->codec.h264.position;
|
||||
used_dpbs |= BIT(position);
|
||||
|
||||
@ -42,7 +42,7 @@ index a5c5f13ffecb..405545947b85 100644
|
||||
if (!(dpb->flags & V4L2_H264_DPB_ENTRY_FLAG_ACTIVE))
|
||||
continue;
|
||||
|
||||
@@ -133,13 +138,11 @@ static void cedrus_write_frame_list(struct cedrus_ctx *ctx,
|
||||
@@ -130,13 +135,11 @@ static void cedrus_write_frame_list(struct cedrus_ctx *ctx,
|
||||
dpb->top_field_order_cnt,
|
||||
dpb->bottom_field_order_cnt,
|
||||
&pic_list[position]);
|
||||
@ -59,7 +59,7 @@ index a5c5f13ffecb..405545947b85 100644
|
||||
position = find_first_zero_bit(&used_dpbs, CEDRUS_H264_FRAME_NUM);
|
||||
|
||||
output_buf = vb2_to_cedrus_buffer(&run->dst->vb2_buf);
|
||||
@@ -165,6 +168,10 @@ static void cedrus_write_frame_list(struct cedrus_ctx *ctx,
|
||||
@@ -162,6 +165,10 @@ static void cedrus_write_frame_list(struct cedrus_ctx *ctx,
|
||||
|
||||
#define CEDRUS_MAX_REF_IDX 32
|
||||
|
||||
@ -70,7 +70,7 @@ index a5c5f13ffecb..405545947b85 100644
|
||||
static void _cedrus_write_ref_list(struct cedrus_ctx *ctx,
|
||||
struct cedrus_run *run,
|
||||
const u8 *ref_list, u8 num_ref,
|
||||
@@ -187,7 +194,7 @@ static void _cedrus_write_ref_list(struct cedrus_ctx *ctx,
|
||||
@@ -184,7 +191,7 @@ static void _cedrus_write_ref_list(struct cedrus_ctx *ctx,
|
||||
int buf_idx;
|
||||
u8 dpb_idx;
|
||||
|
||||
@ -79,7 +79,7 @@ index a5c5f13ffecb..405545947b85 100644
|
||||
dpb = &decode->dpb[dpb_idx];
|
||||
|
||||
if (!(dpb->flags & V4L2_H264_DPB_ENTRY_FLAG_ACTIVE))
|
||||
@@ -206,7 +213,8 @@ static void _cedrus_write_ref_list(struct cedrus_ctx *ctx,
|
||||
@@ -199,7 +206,8 @@ static void _cedrus_write_ref_list(struct cedrus_ctx *ctx,
|
||||
position = cedrus_buf->codec.h264.position;
|
||||
|
||||
sram_array[i] |= position << 1;
|
||||
@ -89,16 +89,16 @@ index a5c5f13ffecb..405545947b85 100644
|
||||
sram_array[i] |= BIT(0);
|
||||
}
|
||||
|
||||
@@ -309,6 +317,8 @@ static void cedrus_set_params(struct cedrus_ctx *ctx,
|
||||
@@ -315,6 +323,8 @@ static void cedrus_set_params(struct cedrus_ctx *ctx,
|
||||
struct cedrus_dev *dev = ctx->dev;
|
||||
dma_addr_t src_buf_addr;
|
||||
u32 offset = slice->header_bit_size;
|
||||
u32 len = (slice->size * 8) - offset;
|
||||
u32 len = slice->size * 8;
|
||||
+ unsigned int pic_width_in_mbs;
|
||||
+ bool mbaff_picture;
|
||||
u32 reg;
|
||||
|
||||
cedrus_write(dev, VE_H264_VLD_LEN, len);
|
||||
@@ -378,12 +387,19 @@ static void cedrus_set_params(struct cedrus_ctx *ctx,
|
||||
@@ -382,12 +392,19 @@ static void cedrus_set_params(struct cedrus_ctx *ctx,
|
||||
reg |= VE_H264_SPS_DIRECT_8X8_INFERENCE;
|
||||
cedrus_write(dev, VE_H264_SPS, reg);
|
||||
|
||||
@ -119,15 +119,6 @@ index a5c5f13ffecb..405545947b85 100644
|
||||
if (slice->flags & V4L2_H264_SLICE_FLAG_FIELD_PIC)
|
||||
reg |= VE_H264_SHS_FIELD_PIC;
|
||||
if (slice->flags & V4L2_H264_SLICE_FLAG_BOTTOM_FIELD)
|
||||
@@ -531,7 +541,7 @@ static int cedrus_h264_start(struct cedrus_ctx *ctx)
|
||||
* we need to work on.
|
||||
*/
|
||||
field_size = field_size * 2;
|
||||
- ctx->codec.h264.mv_col_buf_field_size = field_size;
|
||||
+ ctx->codec.h264.mv_col_buf_field_size = ALIGN(field_size, 1024);
|
||||
|
||||
mv_col_size = field_size * 2 * CEDRUS_H264_FRAME_NUM;
|
||||
ctx->codec.h264.mv_col_buf_size = mv_col_size;
|
||||
--
|
||||
2.20.1
|
||||
2.21.0
|
||||
|
@ -1,8 +1,25 @@
|
||||
From c6582c38df2f78dc9d4f8fd920780a82a01e4d8e Mon Sep 17 00:00:00 2001
|
||||
From: Jernej Skrabec <jernej.skrabec@siol.net>
|
||||
Date: Sat, 25 May 2019 13:58:17 +0200
|
||||
Subject: [PATCH 2/3] WIP: HEVC improvements
|
||||
|
||||
Signed-off-by: Jernej Skrabec <jernej.skrabec@siol.net>
|
||||
---
|
||||
drivers/media/v4l2-core/v4l2-ctrls.c | 8 +
|
||||
drivers/staging/media/sunxi/cedrus/cedrus.c | 6 +
|
||||
drivers/staging/media/sunxi/cedrus/cedrus.h | 11 +-
|
||||
.../staging/media/sunxi/cedrus/cedrus_dec.c | 2 +
|
||||
.../staging/media/sunxi/cedrus/cedrus_h265.c | 348 +++++++++++++-----
|
||||
.../staging/media/sunxi/cedrus/cedrus_regs.h | 3 +
|
||||
.../staging/media/sunxi/cedrus/cedrus_video.c | 12 +-
|
||||
include/media/hevc-ctrls.h | 20 +-
|
||||
8 files changed, 301 insertions(+), 109 deletions(-)
|
||||
|
||||
diff --git a/drivers/media/v4l2-core/v4l2-ctrls.c b/drivers/media/v4l2-core/v4l2-ctrls.c
|
||||
index 3bab9d4e3304..a14762dff91d 100644
|
||||
index 1107698b9d06..aed7a4526193 100644
|
||||
--- a/drivers/media/v4l2-core/v4l2-ctrls.c
|
||||
+++ b/drivers/media/v4l2-core/v4l2-ctrls.c
|
||||
@@ -916,6 +916,7 @@ const char *v4l2_ctrl_get_name(u32 id)
|
||||
@@ -947,6 +947,7 @@ const char *v4l2_ctrl_get_name(u32 id)
|
||||
case V4L2_CID_MPEG_VIDEO_HEVC_SPS: return "HEVC Sequence Parameter Set";
|
||||
case V4L2_CID_MPEG_VIDEO_HEVC_PPS: return "HEVC Picture Parameter Set";
|
||||
case V4L2_CID_MPEG_VIDEO_HEVC_SLICE_PARAMS: return "HEVC Slice Parameters";
|
||||
@ -10,7 +27,7 @@ index 3bab9d4e3304..a14762dff91d 100644
|
||||
|
||||
/* CAMERA controls */
|
||||
/* Keep the order of the 'case's the same as in v4l2-controls.h! */
|
||||
@@ -1332,6 +1333,9 @@ void v4l2_ctrl_fill(u32 id, const char **name, enum v4l2_ctrl_type *type,
|
||||
@@ -1368,6 +1369,9 @@ void v4l2_ctrl_fill(u32 id, const char **name, enum v4l2_ctrl_type *type,
|
||||
case V4L2_CID_MPEG_VIDEO_HEVC_SLICE_PARAMS:
|
||||
*type = V4L2_CTRL_TYPE_HEVC_SLICE_PARAMS;
|
||||
break;
|
||||
@ -20,7 +37,7 @@ index 3bab9d4e3304..a14762dff91d 100644
|
||||
default:
|
||||
*type = V4L2_CTRL_TYPE_INTEGER;
|
||||
break;
|
||||
@@ -1708,6 +1712,7 @@ static int std_validate(const struct v4l2_ctrl *ctrl, u32 idx,
|
||||
@@ -1747,6 +1751,7 @@ static int std_validate(const struct v4l2_ctrl *ctrl, u32 idx,
|
||||
case V4L2_CTRL_TYPE_HEVC_SPS:
|
||||
case V4L2_CTRL_TYPE_HEVC_PPS:
|
||||
case V4L2_CTRL_TYPE_HEVC_SLICE_PARAMS:
|
||||
@ -28,7 +45,7 @@ index 3bab9d4e3304..a14762dff91d 100644
|
||||
return 0;
|
||||
|
||||
default:
|
||||
@@ -2314,6 +2319,9 @@ static struct v4l2_ctrl *v4l2_ctrl_new(struct v4l2_ctrl_handler *hdl,
|
||||
@@ -2356,6 +2361,9 @@ static struct v4l2_ctrl *v4l2_ctrl_new(struct v4l2_ctrl_handler *hdl,
|
||||
case V4L2_CTRL_TYPE_HEVC_SLICE_PARAMS:
|
||||
elem_size = sizeof(struct v4l2_ctrl_hevc_slice_params);
|
||||
break;
|
||||
@ -39,10 +56,10 @@ index 3bab9d4e3304..a14762dff91d 100644
|
||||
if (type < V4L2_CTRL_COMPOUND_TYPES)
|
||||
elem_size = sizeof(s32);
|
||||
diff --git a/drivers/staging/media/sunxi/cedrus/cedrus.c b/drivers/staging/media/sunxi/cedrus/cedrus.c
|
||||
index a713630ce7ba..3040f483e0a2 100644
|
||||
index 70642834f351..01860f247aa6 100644
|
||||
--- a/drivers/staging/media/sunxi/cedrus/cedrus.c
|
||||
+++ b/drivers/staging/media/sunxi/cedrus/cedrus.c
|
||||
@@ -87,6 +87,12 @@ static const struct cedrus_control cedrus_controls[] = {
|
||||
@@ -88,6 +88,12 @@ static const struct cedrus_control cedrus_controls[] = {
|
||||
.codec = CEDRUS_CODEC_H265,
|
||||
.required = true,
|
||||
},
|
||||
@ -56,10 +73,10 @@ index a713630ce7ba..3040f483e0a2 100644
|
||||
|
||||
#define CEDRUS_CONTROLS_COUNT ARRAY_SIZE(cedrus_controls)
|
||||
diff --git a/drivers/staging/media/sunxi/cedrus/cedrus.h b/drivers/staging/media/sunxi/cedrus/cedrus.h
|
||||
index b5d083812bea..deb9fa1de97c 100644
|
||||
index f19be772d78b..b518c5613fdf 100644
|
||||
--- a/drivers/staging/media/sunxi/cedrus/cedrus.h
|
||||
+++ b/drivers/staging/media/sunxi/cedrus/cedrus.h
|
||||
@@ -72,6 +72,7 @@ struct cedrus_h265_run {
|
||||
@@ -74,6 +74,7 @@ struct cedrus_h265_run {
|
||||
const struct v4l2_ctrl_hevc_sps *sps;
|
||||
const struct v4l2_ctrl_hevc_pps *pps;
|
||||
const struct v4l2_ctrl_hevc_slice_params *slice_params;
|
||||
@ -67,7 +84,7 @@ index b5d083812bea..deb9fa1de97c 100644
|
||||
};
|
||||
|
||||
struct cedrus_run {
|
||||
@@ -88,6 +89,10 @@ struct cedrus_run {
|
||||
@@ -90,6 +91,10 @@ struct cedrus_run {
|
||||
struct cedrus_buffer {
|
||||
struct v4l2_m2m_buffer m2m_buf;
|
||||
|
||||
@ -78,7 +95,7 @@ index b5d083812bea..deb9fa1de97c 100644
|
||||
union {
|
||||
struct {
|
||||
unsigned int position;
|
||||
@@ -121,12 +126,10 @@ struct cedrus_ctx {
|
||||
@@ -123,12 +128,10 @@ struct cedrus_ctx {
|
||||
dma_addr_t neighbor_info_buf_dma;
|
||||
} h264;
|
||||
struct {
|
||||
@ -94,10 +111,10 @@ index b5d083812bea..deb9fa1de97c 100644
|
||||
} codec;
|
||||
};
|
||||
diff --git a/drivers/staging/media/sunxi/cedrus/cedrus_dec.c b/drivers/staging/media/sunxi/cedrus/cedrus_dec.c
|
||||
index c50397f8692f..80c6d920142d 100644
|
||||
index c6d0ef66cdd0..104adb08492c 100644
|
||||
--- a/drivers/staging/media/sunxi/cedrus/cedrus_dec.c
|
||||
+++ b/drivers/staging/media/sunxi/cedrus/cedrus_dec.c
|
||||
@@ -68,6 +68,8 @@ void cedrus_device_run(void *priv)
|
||||
@@ -66,6 +66,8 @@ void cedrus_device_run(void *priv)
|
||||
V4L2_CID_MPEG_VIDEO_HEVC_PPS);
|
||||
run.h265.slice_params = cedrus_find_control_data(ctx,
|
||||
V4L2_CID_MPEG_VIDEO_HEVC_SLICE_PARAMS);
|
||||
@ -107,7 +124,7 @@ index c50397f8692f..80c6d920142d 100644
|
||||
|
||||
default:
|
||||
diff --git a/drivers/staging/media/sunxi/cedrus/cedrus_h265.c b/drivers/staging/media/sunxi/cedrus/cedrus_h265.c
|
||||
index f1c3665e95ab..2cc36d69548e 100644
|
||||
index fd4d86b02156..82d29c59b787 100644
|
||||
--- a/drivers/staging/media/sunxi/cedrus/cedrus_h265.c
|
||||
+++ b/drivers/staging/media/sunxi/cedrus/cedrus_h265.c
|
||||
@@ -77,24 +77,25 @@ static void cedrus_h265_sram_write_offset(struct cedrus_dev *dev, u32 offset)
|
||||
@ -157,7 +174,7 @@ index f1c3665e95ab..2cc36d69548e 100644
|
||||
};
|
||||
u32 offset = VE_DEC_H265_SRAM_OFFSET_FRAME_INFO +
|
||||
VE_DEC_H265_SRAM_OFFSET_FRAME_INFO_UNIT * index;
|
||||
@@ -157,28 +157,24 @@ static void cedrus_h265_ref_pic_list_write(struct cedrus_dev *dev,
|
||||
@@ -158,28 +158,24 @@ static void cedrus_h265_ref_pic_list_write(struct cedrus_dev *dev,
|
||||
u8 num_ref_idx_active,
|
||||
u32 sram_offset)
|
||||
{
|
||||
@ -195,7 +212,7 @@ index f1c3665e95ab..2cc36d69548e 100644
|
||||
}
|
||||
|
||||
static void cedrus_h265_pred_weight_write(struct cedrus_dev *dev,
|
||||
@@ -219,6 +215,105 @@ static void cedrus_h265_pred_weight_write(struct cedrus_dev *dev,
|
||||
@@ -220,6 +216,131 @@ static void cedrus_h265_pred_weight_write(struct cedrus_dev *dev,
|
||||
}
|
||||
}
|
||||
|
||||
@ -204,6 +221,7 @@ index f1c3665e95ab..2cc36d69548e 100644
|
||||
+{
|
||||
+ const struct v4l2_ctrl_hevc_scaling_matrix *scaling;
|
||||
+ struct cedrus_dev *dev = ctx->dev;
|
||||
+ u32 i, j, k, val;
|
||||
+
|
||||
+ scaling = run->h265.scaling_matrix;
|
||||
+
|
||||
@ -219,21 +237,46 @@ index f1c3665e95ab..2cc36d69548e 100644
|
||||
+ (scaling->scaling_list_dc_coef_16x16[3] << 8) |
|
||||
+ (scaling->scaling_list_dc_coef_16x16[2] << 0));
|
||||
+
|
||||
+ cedrus_h265_sram_write_offset(dev, VE_DEC_H265_SRAM_OFFSET_SCALING_LISTS_8x8);
|
||||
+ cedrus_h265_sram_write_data(dev, scaling->scaling_list_8x8,
|
||||
+ sizeof(scaling->scaling_list_8x8));
|
||||
+ cedrus_h265_sram_write_offset(dev, VE_DEC_H265_SRAM_OFFSET_SCALING_LISTS);
|
||||
+
|
||||
+ cedrus_h265_sram_write_offset(dev, VE_DEC_H265_SRAM_OFFSET_SCALING_LISTS_32x32);
|
||||
+ cedrus_h265_sram_write_data(dev, scaling->scaling_list_32x32,
|
||||
+ sizeof(scaling->scaling_list_32x32));
|
||||
+ for (i = 0; i < 6; i++)
|
||||
+ for (j = 0; j < 8; j++)
|
||||
+ for (k = 0; k < 8; k += 4) {
|
||||
+ val = ((u32)scaling->scaling_list_8x8[i][j + (k + 3) * 8] << 24) |
|
||||
+ ((u32)scaling->scaling_list_8x8[i][j + (k + 2) * 8] << 16) |
|
||||
+ ((u32)scaling->scaling_list_8x8[i][j + (k + 1) * 8] << 8) |
|
||||
+ scaling->scaling_list_8x8[i][j + k * 8];
|
||||
+ cedrus_write(dev, VE_DEC_H265_SRAM_DATA, val);
|
||||
+ }
|
||||
+
|
||||
+ cedrus_h265_sram_write_offset(dev, VE_DEC_H265_SRAM_OFFSET_SCALING_LISTS_16x16);
|
||||
+ cedrus_h265_sram_write_data(dev, scaling->scaling_list_16x16,
|
||||
+ sizeof(scaling->scaling_list_16x16));
|
||||
+ for (i = 0; i < 2; i++)
|
||||
+ for (j = 0; j < 8; j++)
|
||||
+ for (k = 0; k < 8; k += 4) {
|
||||
+ val = ((u32)scaling->scaling_list_32x32[i][j + (k + 3) * 8] << 24) |
|
||||
+ ((u32)scaling->scaling_list_32x32[i][j + (k + 2) * 8] << 16) |
|
||||
+ ((u32)scaling->scaling_list_32x32[i][j + (k + 1) * 8] << 8) |
|
||||
+ scaling->scaling_list_32x32[i][j + k * 8];
|
||||
+ cedrus_write(dev, VE_DEC_H265_SRAM_DATA, val);
|
||||
+ }
|
||||
+
|
||||
+ cedrus_h265_sram_write_offset(dev, VE_DEC_H265_SRAM_OFFSET_SCALING_LISTS_4x4);
|
||||
+ cedrus_h265_sram_write_data(dev, scaling->scaling_list_4x4,
|
||||
+ sizeof(scaling->scaling_list_4x4));
|
||||
+ for (i = 0; i < 6; i++)
|
||||
+ for (j = 0; j < 8; j++)
|
||||
+ for (k = 0; k < 8; k += 4) {
|
||||
+ val = ((u32)scaling->scaling_list_16x16[i][j + (k + 3) * 8] << 24) |
|
||||
+ ((u32)scaling->scaling_list_16x16[i][j + (k + 2) * 8] << 16) |
|
||||
+ ((u32)scaling->scaling_list_16x16[i][j + (k + 1) * 8] << 8) |
|
||||
+ scaling->scaling_list_16x16[i][j + k * 8];
|
||||
+ cedrus_write(dev, VE_DEC_H265_SRAM_DATA, val);
|
||||
+ }
|
||||
+
|
||||
+ for (i = 0; i < 6; i++)
|
||||
+ for (j = 0; j < 4; j++) {
|
||||
+ val = ((u32)scaling->scaling_list_4x4[i][j + 12] << 24) |
|
||||
+ ((u32)scaling->scaling_list_4x4[i][j + 8] << 16) |
|
||||
+ ((u32)scaling->scaling_list_4x4[i][j + 4] << 8) |
|
||||
+ scaling->scaling_list_4x4[i][j];
|
||||
+ cedrus_write(dev, VE_DEC_H265_SRAM_DATA, val);
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+static void write_entry_point_list(struct cedrus_ctx *ctx,
|
||||
@ -301,7 +344,7 @@ index f1c3665e95ab..2cc36d69548e 100644
|
||||
static void cedrus_h265_setup(struct cedrus_ctx *ctx,
|
||||
struct cedrus_run *run)
|
||||
{
|
||||
@@ -227,6 +322,7 @@ static void cedrus_h265_setup(struct cedrus_ctx *ctx,
|
||||
@@ -228,6 +349,7 @@ static void cedrus_h265_setup(struct cedrus_ctx *ctx,
|
||||
const struct v4l2_ctrl_hevc_pps *pps;
|
||||
const struct v4l2_ctrl_hevc_slice_params *slice_params;
|
||||
const struct v4l2_hevc_pred_weight_table *pred_weight_table;
|
||||
@ -309,7 +352,7 @@ index f1c3665e95ab..2cc36d69548e 100644
|
||||
dma_addr_t src_buf_addr;
|
||||
dma_addr_t src_buf_end_addr;
|
||||
u32 chroma_log2_weight_denom;
|
||||
@@ -239,43 +335,10 @@ static void cedrus_h265_setup(struct cedrus_ctx *ctx,
|
||||
@@ -240,43 +362,10 @@ static void cedrus_h265_setup(struct cedrus_ctx *ctx,
|
||||
slice_params = run->h265.slice_params;
|
||||
pred_weight_table = &slice_params->pred_weight_table;
|
||||
|
||||
@ -355,7 +398,7 @@ index f1c3665e95ab..2cc36d69548e 100644
|
||||
|
||||
/* Source offset and length in bits. */
|
||||
|
||||
@@ -299,18 +362,35 @@ static void cedrus_h265_setup(struct cedrus_ctx *ctx,
|
||||
@@ -300,18 +389,35 @@ static void cedrus_h265_setup(struct cedrus_ctx *ctx,
|
||||
src_buf_end_addr = src_buf_addr +
|
||||
DIV_ROUND_UP(slice_params->bit_size, 8);
|
||||
|
||||
@ -397,7 +440,7 @@ index f1c3665e95ab..2cc36d69548e 100644
|
||||
|
||||
/* Initialize bitstream access. */
|
||||
cedrus_write(dev, VE_DEC_H265_TRIGGER, VE_DEC_H265_TRIGGER_INIT_SWDEC);
|
||||
@@ -333,6 +413,7 @@ static void cedrus_h265_setup(struct cedrus_ctx *ctx,
|
||||
@@ -334,6 +440,7 @@ static void cedrus_h265_setup(struct cedrus_ctx *ctx,
|
||||
VE_DEC_H265_DEC_SPS_HDR_LOG2_DIFF_MAX_MIN_LUMA_CODING_BLOCK_SIZE(sps->log2_diff_max_min_luma_coding_block_size) |
|
||||
VE_DEC_H265_DEC_SPS_HDR_LOG2_MIN_LUMA_CODING_BLOCK_SIZE_MINUS3(sps->log2_min_luma_coding_block_size_minus3) |
|
||||
VE_DEC_H265_DEC_SPS_HDR_BIT_DEPTH_CHROMA_MINUS8(sps->bit_depth_chroma_minus8) |
|
||||
@ -405,7 +448,7 @@ index f1c3665e95ab..2cc36d69548e 100644
|
||||
VE_DEC_H265_DEC_SPS_HDR_SEPARATE_COLOUR_PLANE_FLAG(sps->separate_colour_plane_flag) |
|
||||
VE_DEC_H265_DEC_SPS_HDR_CHROMA_FORMAT_IDC(sps->chroma_format_idc);
|
||||
|
||||
@@ -362,7 +443,7 @@ static void cedrus_h265_setup(struct cedrus_ctx *ctx,
|
||||
@@ -363,7 +470,7 @@ static void cedrus_h265_setup(struct cedrus_ctx *ctx,
|
||||
VE_DEC_H265_DEC_PPS_CTRL1_PPS_LOOP_FILTER_ACROSS_SLICES_ENABLED_FLAG(pps->pps_loop_filter_across_slices_enabled_flag) |
|
||||
VE_DEC_H265_DEC_PPS_CTRL1_LOOP_FILTER_ACROSS_TILES_ENABLED_FLAG(pps->loop_filter_across_tiles_enabled_flag) |
|
||||
VE_DEC_H265_DEC_PPS_CTRL1_ENTROPY_CODING_SYNC_ENABLED_FLAG(pps->entropy_coding_sync_enabled_flag) |
|
||||
@ -414,7 +457,7 @@ index f1c3665e95ab..2cc36d69548e 100644
|
||||
VE_DEC_H265_DEC_PPS_CTRL1_TRANSQUANT_BYPASS_ENABLE_FLAG(pps->transquant_bypass_enabled_flag) |
|
||||
VE_DEC_H265_DEC_PPS_CTRL1_WEIGHTED_BIPRED_FLAG(pps->weighted_bipred_flag) |
|
||||
VE_DEC_H265_DEC_PPS_CTRL1_WEIGHTED_PRED_FLAG(pps->weighted_pred_flag);
|
||||
@@ -383,7 +464,7 @@ static void cedrus_h265_setup(struct cedrus_ctx *ctx,
|
||||
@@ -384,7 +491,7 @@ static void cedrus_h265_setup(struct cedrus_ctx *ctx,
|
||||
VE_DEC_H265_DEC_SLICE_HDR_INFO0_COLOUR_PLANE_ID(slice_params->colour_plane_id) |
|
||||
VE_DEC_H265_DEC_SLICE_HDR_INFO0_SLICE_TYPE(slice_params->slice_type) |
|
||||
VE_DEC_H265_DEC_SLICE_HDR_INFO0_DEPENDENT_SLICE_SEGMENT_FLAG(pps->dependent_slice_segment_flag) |
|
||||
@ -423,7 +466,7 @@ index f1c3665e95ab..2cc36d69548e 100644
|
||||
|
||||
cedrus_write(dev, VE_DEC_H265_DEC_SLICE_HDR_INFO0, reg);
|
||||
|
||||
@@ -400,34 +481,68 @@ static void cedrus_h265_setup(struct cedrus_ctx *ctx,
|
||||
@@ -401,34 +508,68 @@ static void cedrus_h265_setup(struct cedrus_ctx *ctx,
|
||||
|
||||
chroma_log2_weight_denom = pred_weight_table->luma_log2_weight_denom +
|
||||
pred_weight_table->delta_chroma_log2_weight_denom;
|
||||
@ -497,7 +540,7 @@ index f1c3665e95ab..2cc36d69548e 100644
|
||||
output_pic_list_index = V4L2_HEVC_DPB_ENTRIES_NUM_MAX;
|
||||
pic_order_cnt[0] = slice_params->slice_pic_order_cnt;
|
||||
pic_order_cnt[1] = slice_params->slice_pic_order_cnt;
|
||||
@@ -443,36 +558,36 @@ static void cedrus_h265_setup(struct cedrus_ctx *ctx,
|
||||
@@ -444,36 +585,36 @@ static void cedrus_h265_setup(struct cedrus_ctx *ctx,
|
||||
if (slice_params->slice_type != V4L2_HEVC_SLICE_TYPE_I) {
|
||||
cedrus_h265_ref_pic_list_write(dev, slice_params->dpb,
|
||||
slice_params->ref_idx_l0,
|
||||
@ -552,7 +595,7 @@ index f1c3665e95ab..2cc36d69548e 100644
|
||||
}
|
||||
|
||||
/* Enable appropriate interruptions. */
|
||||
@@ -483,9 +598,6 @@ static int cedrus_h265_start(struct cedrus_ctx *ctx)
|
||||
@@ -484,9 +625,6 @@ static int cedrus_h265_start(struct cedrus_ctx *ctx)
|
||||
{
|
||||
struct cedrus_dev *dev = ctx->dev;
|
||||
|
||||
@ -562,7 +605,7 @@ index f1c3665e95ab..2cc36d69548e 100644
|
||||
ctx->codec.h265.neighbor_info_buf =
|
||||
dma_alloc_coherent(dev->dev, CEDRUS_H265_NEIGHBOR_INFO_BUF_SIZE,
|
||||
&ctx->codec.h265.neighbor_info_buf_addr,
|
||||
@@ -493,6 +605,17 @@ static int cedrus_h265_start(struct cedrus_ctx *ctx)
|
||||
@@ -494,6 +632,17 @@ static int cedrus_h265_start(struct cedrus_ctx *ctx)
|
||||
if (!ctx->codec.h265.neighbor_info_buf)
|
||||
return -ENOMEM;
|
||||
|
||||
@ -580,7 +623,7 @@ index f1c3665e95ab..2cc36d69548e 100644
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -500,17 +623,12 @@ static void cedrus_h265_stop(struct cedrus_ctx *ctx)
|
||||
@@ -501,17 +650,12 @@ static void cedrus_h265_stop(struct cedrus_ctx *ctx)
|
||||
{
|
||||
struct cedrus_dev *dev = ctx->dev;
|
||||
|
||||
@ -602,7 +645,7 @@ index f1c3665e95ab..2cc36d69548e 100644
|
||||
|
||||
static void cedrus_h265_trigger(struct cedrus_ctx *ctx)
|
||||
diff --git a/drivers/staging/media/sunxi/cedrus/cedrus_regs.h b/drivers/staging/media/sunxi/cedrus/cedrus_regs.h
|
||||
index 87651d6b6227..a2931f322c7a 100644
|
||||
index 87651d6b6227..8d153dbe4f83 100644
|
||||
--- a/drivers/staging/media/sunxi/cedrus/cedrus_regs.h
|
||||
+++ b/drivers/staging/media/sunxi/cedrus/cedrus_regs.h
|
||||
@@ -496,6 +496,9 @@
|
||||
@ -615,23 +658,11 @@ index 87651d6b6227..a2931f322c7a 100644
|
||||
#define VE_DEC_H265_LOW_ADDR (VE_ENGINE_DEC_H265 + 0x80)
|
||||
|
||||
#define VE_DEC_H265_LOW_ADDR_PRIMARY_CHROMA(a) \
|
||||
@@ -513,7 +516,10 @@
|
||||
#define VE_DEC_H265_SRAM_OFFSET_PRED_WEIGHT_CHROMA_L1 0x80
|
||||
#define VE_DEC_H265_SRAM_OFFSET_FRAME_INFO 0x400
|
||||
#define VE_DEC_H265_SRAM_OFFSET_FRAME_INFO_UNIT 0x20
|
||||
-#define VE_DEC_H265_SRAM_OFFSET_SCALING_LISTS 0x800
|
||||
+#define VE_DEC_H265_SRAM_OFFSET_SCALING_LISTS_8x8 0x800
|
||||
+#define VE_DEC_H265_SRAM_OFFSET_SCALING_LISTS_32x32 0x980
|
||||
+#define VE_DEC_H265_SRAM_OFFSET_SCALING_LISTS_16x16 0xa00
|
||||
+#define VE_DEC_H265_SRAM_OFFSET_SCALING_LISTS_4x4 0xb80
|
||||
#define VE_DEC_H265_SRAM_OFFSET_REF_PIC_LIST0 0xc00
|
||||
#define VE_DEC_H265_SRAM_OFFSET_REF_PIC_LIST1 0xc10
|
||||
|
||||
diff --git a/drivers/staging/media/sunxi/cedrus/cedrus_video.c b/drivers/staging/media/sunxi/cedrus/cedrus_video.c
|
||||
index b9acdc03c839..adf00513c15f 100644
|
||||
index dbe6f9510641..a0817cae1d69 100644
|
||||
--- a/drivers/staging/media/sunxi/cedrus/cedrus_video.c
|
||||
+++ b/drivers/staging/media/sunxi/cedrus/cedrus_video.c
|
||||
@@ -423,8 +423,18 @@ static void cedrus_buf_cleanup(struct vb2_buffer *vb)
|
||||
@@ -433,8 +433,18 @@ static void cedrus_buf_cleanup(struct vb2_buffer *vb)
|
||||
struct vb2_queue *vq = vb->vb2_queue;
|
||||
struct cedrus_ctx *ctx = vb2_get_drv_priv(vq);
|
||||
|
||||
@ -652,24 +683,24 @@ index b9acdc03c839..adf00513c15f 100644
|
||||
|
||||
static int cedrus_buf_out_validate(struct vb2_buffer *vb)
|
||||
diff --git a/include/media/hevc-ctrls.h b/include/media/hevc-ctrls.h
|
||||
index 005c71c67163..4bf3d79047f4 100644
|
||||
index 2de83d9f6d47..19469097c6d4 100644
|
||||
--- a/include/media/hevc-ctrls.h
|
||||
+++ b/include/media/hevc-ctrls.h
|
||||
@@ -14,11 +14,13 @@
|
||||
#define V4L2_CID_MPEG_VIDEO_HEVC_SPS (V4L2_CID_MPEG_BASE + 645)
|
||||
#define V4L2_CID_MPEG_VIDEO_HEVC_PPS (V4L2_CID_MPEG_BASE + 646)
|
||||
#define V4L2_CID_MPEG_VIDEO_HEVC_SLICE_PARAMS (V4L2_CID_MPEG_BASE + 647)
|
||||
+#define V4L2_CID_MPEG_VIDEO_HEVC_SCALING_MATRIX (V4L2_CID_MPEG_BASE + 648)
|
||||
@@ -17,11 +17,13 @@
|
||||
#define V4L2_CID_MPEG_VIDEO_HEVC_SPS (V4L2_CID_MPEG_BASE + 1008)
|
||||
#define V4L2_CID_MPEG_VIDEO_HEVC_PPS (V4L2_CID_MPEG_BASE + 1009)
|
||||
#define V4L2_CID_MPEG_VIDEO_HEVC_SLICE_PARAMS (V4L2_CID_MPEG_BASE + 1010)
|
||||
+#define V4L2_CID_MPEG_VIDEO_HEVC_SCALING_MATRIX (V4L2_CID_MPEG_BASE + 1011)
|
||||
|
||||
/* enum v4l2_ctrl_type type values */
|
||||
#define V4L2_CTRL_TYPE_HEVC_SPS 0x0115
|
||||
#define V4L2_CTRL_TYPE_HEVC_PPS 0x0116
|
||||
#define V4L2_CTRL_TYPE_HEVC_SLICE_PARAMS 0x0117
|
||||
+#define V4L2_CTRL_TYPE_HEVC_SCALING_MATRIX 0x0118
|
||||
#define V4L2_CTRL_TYPE_HEVC_SPS 0x0120
|
||||
#define V4L2_CTRL_TYPE_HEVC_PPS 0x0121
|
||||
#define V4L2_CTRL_TYPE_HEVC_SLICE_PARAMS 0x0122
|
||||
+#define V4L2_CTRL_TYPE_HEVC_SCALING_MATRIX 0x0123
|
||||
|
||||
#define V4L2_HEVC_SLICE_TYPE_B 0
|
||||
#define V4L2_HEVC_SLICE_TYPE_P 1
|
||||
@@ -91,7 +93,7 @@ struct v4l2_ctrl_hevc_pps {
|
||||
@@ -95,7 +97,7 @@ struct v4l2_ctrl_hevc_pps {
|
||||
__u8 lists_modification_present_flag;
|
||||
__u8 log2_parallel_merge_level_minus2;
|
||||
__u8 slice_segment_header_extension_present_flag;
|
||||
@ -678,7 +709,7 @@ index 005c71c67163..4bf3d79047f4 100644
|
||||
};
|
||||
|
||||
#define V4L2_HEVC_DPB_ENTRY_RPS_ST_CURR_BEFORE 0x01
|
||||
@@ -175,7 +177,21 @@ struct v4l2_ctrl_hevc_slice_params {
|
||||
@@ -179,7 +181,21 @@ struct v4l2_ctrl_hevc_slice_params {
|
||||
/* ISO/IEC 23008-2, ITU-T Rec. H.265: Weighted prediction parameter */
|
||||
struct v4l2_hevc_pred_weight_table pred_weight_table;
|
||||
|
||||
@ -701,3 +732,6 @@ index 005c71c67163..4bf3d79047f4 100644
|
||||
};
|
||||
|
||||
#endif
|
||||
--
|
||||
2.21.0
|
||||
|
@ -1,62 +0,0 @@
|
||||
From 9ce5c66f0f98cc968598307f7f7feb39a83d7342 Mon Sep 17 00:00:00 2001
|
||||
From: Jonas Karlman <jonas@kwiboo.se>
|
||||
Date: Tue, 26 Feb 2019 20:45:14 +0000
|
||||
Subject: [PATCH] WIP: dw-hdmi-cec: sleep 100ms on error
|
||||
|
||||
---
|
||||
drivers/gpu/drm/bridge/synopsys/dw-hdmi-cec.c | 18 ++++++++++++++++--
|
||||
1 file changed, 16 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi-cec.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi-cec.c
|
||||
index 6c323510f128..b5a1a85c8700 100644
|
||||
--- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi-cec.c
|
||||
+++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi-cec.c
|
||||
@@ -7,6 +7,7 @@
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*/
|
||||
+#include <linux/delay.h>
|
||||
#include <linux/interrupt.h>
|
||||
#include <linux/io.h>
|
||||
#include <linux/module.h>
|
||||
@@ -132,8 +133,15 @@ static irqreturn_t dw_hdmi_cec_hardirq(int irq, void *data)
|
||||
|
||||
dw_hdmi_write(cec, stat, HDMI_IH_CEC_STAT0);
|
||||
|
||||
- if (stat & CEC_STAT_ERROR_INIT) {
|
||||
- cec->tx_status = CEC_TX_STATUS_ERROR;
|
||||
+ /* Status with both done and error_initiator bits have been seen
|
||||
+ * on Rockchip RK3328 devices, transmit attempt seems to have failed
|
||||
+ * when this happens, report as low drive and block cec-framework
|
||||
+ * 100ms before core retransmits the failed message, this seems to
|
||||
+ * mitigate the issue with failed transmit attempts.
|
||||
+ */
|
||||
+ if ((stat & (CEC_STAT_DONE|CEC_STAT_ERROR_INIT)) == (CEC_STAT_DONE|CEC_STAT_ERROR_INIT)) {
|
||||
+ pr_info("dw_hdmi_cec_hardirq: stat=%02x LOW_DRIVE\n", stat);
|
||||
+ cec->tx_status = CEC_TX_STATUS_LOW_DRIVE;
|
||||
cec->tx_done = true;
|
||||
ret = IRQ_WAKE_THREAD;
|
||||
} else if (stat & CEC_STAT_DONE) {
|
||||
@@ -144,6 +152,10 @@ static irqreturn_t dw_hdmi_cec_hardirq(int irq, void *data)
|
||||
cec->tx_status = CEC_TX_STATUS_NACK;
|
||||
cec->tx_done = true;
|
||||
ret = IRQ_WAKE_THREAD;
|
||||
+ } else if (stat & CEC_STAT_ERROR_INIT) {
|
||||
+ cec->tx_status = CEC_TX_STATUS_ERROR;
|
||||
+ cec->tx_done = true;
|
||||
+ ret = IRQ_WAKE_THREAD;
|
||||
}
|
||||
|
||||
if (stat & CEC_STAT_EOM) {
|
||||
@@ -176,6 +188,8 @@ static irqreturn_t dw_hdmi_cec_thread(int irq, void *data)
|
||||
|
||||
if (cec->tx_done) {
|
||||
cec->tx_done = false;
|
||||
+ if (cec->tx_status == CEC_TX_STATUS_LOW_DRIVE)
|
||||
+ msleep(100);
|
||||
cec_transmit_attempt_done(adap, cec->tx_status);
|
||||
}
|
||||
if (cec->rx_done) {
|
||||
--
|
||||
2.20.1
|
||||
|
@ -1,7 +1,7 @@
|
||||
From bd5fed9f390fea4ef8df1abb5f4ac6b64fab5974 Mon Sep 17 00:00:00 2001
|
||||
From 6a900f36a70f921886f05373846368ca6f09446e Mon Sep 17 00:00:00 2001
|
||||
From: Jernej Skrabec <jernej.skrabec@siol.net>
|
||||
Date: Mon, 18 Feb 2019 21:51:31 +0100
|
||||
Subject: [PATCH] cedrus h264 4k
|
||||
Date: Sat, 25 May 2019 14:16:55 +0200
|
||||
Subject: [PATCH 5/5] cedrus h264 4k
|
||||
|
||||
Signed-off-by: Jernej Skrabec <jernej.skrabec@siol.net>
|
||||
---
|
||||
@ -16,10 +16,10 @@ Signed-off-by: Jernej Skrabec <jernej.skrabec@siol.net>
|
||||
8 files changed, 98 insertions(+), 59 deletions(-)
|
||||
|
||||
diff --git a/drivers/staging/media/sunxi/cedrus/cedrus.h b/drivers/staging/media/sunxi/cedrus/cedrus.h
|
||||
index deb9fa1de97c..8815332fe1c1 100644
|
||||
index b518c5613fdf..ee00449d3345 100644
|
||||
--- a/drivers/staging/media/sunxi/cedrus/cedrus.h
|
||||
+++ b/drivers/staging/media/sunxi/cedrus/cedrus.h
|
||||
@@ -116,14 +116,18 @@ struct cedrus_ctx {
|
||||
@@ -118,14 +118,18 @@ struct cedrus_ctx {
|
||||
|
||||
union {
|
||||
struct {
|
||||
@ -43,7 +43,7 @@ index deb9fa1de97c..8815332fe1c1 100644
|
||||
struct {
|
||||
void *neighbor_info_buf;
|
||||
diff --git a/drivers/staging/media/sunxi/cedrus/cedrus_h264.c b/drivers/staging/media/sunxi/cedrus/cedrus_h264.c
|
||||
index 405545947b85..737a317fd1ee 100644
|
||||
index dcb8d3837869..4fafaf2c6c0a 100644
|
||||
--- a/drivers/staging/media/sunxi/cedrus/cedrus_h264.c
|
||||
+++ b/drivers/staging/media/sunxi/cedrus/cedrus_h264.c
|
||||
@@ -55,16 +55,14 @@ static void cedrus_h264_write_sram(struct cedrus_dev *dev,
|
||||
@ -73,20 +73,21 @@ index 405545947b85..737a317fd1ee 100644
|
||||
struct vb2_buffer *vbuf = &buf->m2m_buf.vb.vb2_buf;
|
||||
- unsigned int position = buf->codec.h264.position;
|
||||
|
||||
pic->top_field_order_cnt = top_field_order_cnt;
|
||||
pic->bottom_field_order_cnt = bottom_field_order_cnt;
|
||||
@@ -84,8 +81,8 @@ static void cedrus_fill_ref_pic(struct cedrus_ctx *ctx,
|
||||
|
||||
pic->luma_ptr = cedrus_buf_addr(vbuf, &ctx->dst_fmt, 0);
|
||||
pic->chroma_ptr = cedrus_buf_addr(vbuf, &ctx->dst_fmt, 1);
|
||||
- pic->mv_col_top_ptr = cedrus_h264_mv_col_buf_addr(ctx, position, 0);
|
||||
- pic->mv_col_bot_ptr = cedrus_h264_mv_col_buf_addr(ctx, position, 1);
|
||||
+ pic->mv_col_top_ptr = cedrus_h264_mv_col_buf_addr(ctx, buf, 0);
|
||||
+ pic->mv_col_bot_ptr = cedrus_h264_mv_col_buf_addr(ctx, buf, 1);
|
||||
pic->top_field_order_cnt = cpu_to_le32(top_field_order_cnt);
|
||||
pic->bottom_field_order_cnt = cpu_to_le32(bottom_field_order_cnt);
|
||||
@@ -85,9 +82,9 @@ static void cedrus_fill_ref_pic(struct cedrus_ctx *ctx,
|
||||
pic->luma_ptr = cpu_to_le32(cedrus_buf_addr(vbuf, &ctx->dst_fmt, 0));
|
||||
pic->chroma_ptr = cpu_to_le32(cedrus_buf_addr(vbuf, &ctx->dst_fmt, 1));
|
||||
pic->mv_col_top_ptr =
|
||||
- cpu_to_le32(cedrus_h264_mv_col_buf_addr(ctx, position, 0));
|
||||
+ cpu_to_le32(cedrus_h264_mv_col_buf_addr(ctx, buf, 0));
|
||||
pic->mv_col_bot_ptr =
|
||||
- cpu_to_le32(cedrus_h264_mv_col_buf_addr(ctx, position, 1));
|
||||
+ cpu_to_le32(cedrus_h264_mv_col_buf_addr(ctx, buf, 1));
|
||||
}
|
||||
|
||||
static void cedrus_write_frame_list(struct cedrus_ctx *ctx,
|
||||
@@ -148,6 +145,28 @@ static void cedrus_write_frame_list(struct cedrus_ctx *ctx,
|
||||
@@ -145,6 +142,28 @@ static void cedrus_write_frame_list(struct cedrus_ctx *ctx,
|
||||
output_buf = vb2_to_cedrus_buffer(&run->dst->vb2_buf);
|
||||
output_buf->codec.h264.position = position;
|
||||
|
||||
@ -101,7 +102,7 @@ index 405545947b85..737a317fd1ee 100644
|
||||
+ if (!(sps->flags & V4L2_H264_SPS_FLAG_FRAME_MBS_ONLY))
|
||||
+ field_size = field_size * 2;
|
||||
+
|
||||
+ output_buf->mv_col_buf_size = ALIGN(field_size, 1024) * 2;
|
||||
+ output_buf->mv_col_buf_size = field_size * 2;
|
||||
+ output_buf->mv_col_buf =
|
||||
+ dma_alloc_coherent(dev->dev,
|
||||
+ output_buf->mv_col_buf_size,
|
||||
@ -115,7 +116,7 @@ index 405545947b85..737a317fd1ee 100644
|
||||
if (slice->flags & V4L2_H264_SLICE_FLAG_FIELD_PIC)
|
||||
output_buf->codec.h264.pic_type = CEDRUS_H264_PIC_TYPE_FIELD;
|
||||
else if (sps->flags & V4L2_H264_SPS_FLAG_MB_ADAPTIVE_FRAME_FIELD)
|
||||
@@ -331,6 +350,14 @@ static void cedrus_set_params(struct cedrus_ctx *ctx,
|
||||
@@ -338,6 +357,14 @@ static void cedrus_set_params(struct cedrus_ctx *ctx,
|
||||
VE_H264_VLD_ADDR_FIRST | VE_H264_VLD_ADDR_VALID |
|
||||
VE_H264_VLD_ADDR_LAST);
|
||||
|
||||
@ -130,7 +131,7 @@ index 405545947b85..737a317fd1ee 100644
|
||||
/*
|
||||
* FIXME: Since the bitstream parsing is done in software, and
|
||||
* in userspace, this shouldn't be needed anymore. But it
|
||||
@@ -471,7 +498,8 @@ static void cedrus_h264_setup(struct cedrus_ctx *ctx,
|
||||
@@ -476,7 +503,8 @@ static void cedrus_h264_setup(struct cedrus_ctx *ctx,
|
||||
{
|
||||
struct cedrus_dev *dev = ctx->dev;
|
||||
|
||||
@ -140,7 +141,7 @@ index 405545947b85..737a317fd1ee 100644
|
||||
|
||||
cedrus_write(dev, VE_H264_SDROT_CTRL, 0);
|
||||
cedrus_write(dev, VE_H264_EXTRA_BUFFER1,
|
||||
@@ -490,8 +518,6 @@ static void cedrus_h264_setup(struct cedrus_ctx *ctx,
|
||||
@@ -493,8 +521,6 @@ static void cedrus_h264_setup(struct cedrus_ctx *ctx,
|
||||
static int cedrus_h264_start(struct cedrus_ctx *ctx)
|
||||
{
|
||||
struct cedrus_dev *dev = ctx->dev;
|
||||
@ -149,7 +150,7 @@ index 405545947b85..737a317fd1ee 100644
|
||||
int ret;
|
||||
|
||||
/*
|
||||
@@ -523,44 +549,42 @@ static int cedrus_h264_start(struct cedrus_ctx *ctx)
|
||||
@@ -526,44 +552,42 @@ static int cedrus_h264_start(struct cedrus_ctx *ctx)
|
||||
goto err_pic_buf;
|
||||
}
|
||||
|
||||
@ -183,7 +184,7 @@ index 405545947b85..737a317fd1ee 100644
|
||||
- * we need to work on.
|
||||
- */
|
||||
- field_size = field_size * 2;
|
||||
- ctx->codec.h264.mv_col_buf_field_size = ALIGN(field_size, 1024);
|
||||
- ctx->codec.h264.mv_col_buf_field_size = field_size;
|
||||
-
|
||||
- mv_col_size = field_size * 2 * CEDRUS_H264_FRAME_NUM;
|
||||
- ctx->codec.h264.mv_col_buf_size = mv_col_size;
|
||||
@ -221,7 +222,7 @@ index 405545947b85..737a317fd1ee 100644
|
||||
err_pic_buf:
|
||||
dma_free_coherent(dev->dev, CEDRUS_PIC_INFO_BUF_SIZE,
|
||||
ctx->codec.h264.pic_info_buf,
|
||||
@@ -572,15 +596,20 @@ static void cedrus_h264_stop(struct cedrus_ctx *ctx)
|
||||
@@ -575,15 +599,20 @@ static void cedrus_h264_stop(struct cedrus_ctx *ctx)
|
||||
{
|
||||
struct cedrus_dev *dev = ctx->dev;
|
||||
|
||||
@ -246,10 +247,10 @@ index 405545947b85..737a317fd1ee 100644
|
||||
|
||||
static void cedrus_h264_trigger(struct cedrus_ctx *ctx)
|
||||
diff --git a/drivers/staging/media/sunxi/cedrus/cedrus_h265.c b/drivers/staging/media/sunxi/cedrus/cedrus_h265.c
|
||||
index 2cc36d69548e..246d747d3fa9 100644
|
||||
index 51ee459b2d21..f915429e9c88 100644
|
||||
--- a/drivers/staging/media/sunxi/cedrus/cedrus_h265.c
|
||||
+++ b/drivers/staging/media/sunxi/cedrus/cedrus_h265.c
|
||||
@@ -336,9 +336,7 @@ static void cedrus_h265_setup(struct cedrus_ctx *ctx,
|
||||
@@ -337,9 +337,7 @@ static void cedrus_h265_setup(struct cedrus_ctx *ctx,
|
||||
pred_weight_table = &slice_params->pred_weight_table;
|
||||
|
||||
/* Activate H265 engine. */
|
||||
@ -261,7 +262,7 @@ index 2cc36d69548e..246d747d3fa9 100644
|
||||
/* Source offset and length in bits. */
|
||||
|
||||
diff --git a/drivers/staging/media/sunxi/cedrus/cedrus_hw.c b/drivers/staging/media/sunxi/cedrus/cedrus_hw.c
|
||||
index 6be604c52d5c..4b6c69010e39 100644
|
||||
index 7d2f6eedfc28..9503d395855b 100644
|
||||
--- a/drivers/staging/media/sunxi/cedrus/cedrus_hw.c
|
||||
+++ b/drivers/staging/media/sunxi/cedrus/cedrus_hw.c
|
||||
@@ -30,7 +30,8 @@
|
||||
@ -297,12 +298,12 @@ index 6be604c52d5c..4b6c69010e39 100644
|
||||
cedrus_write(dev, VE_PRIMARY_CHROMA_BUF_LEN, reg);
|
||||
|
||||
diff --git a/drivers/staging/media/sunxi/cedrus/cedrus_hw.h b/drivers/staging/media/sunxi/cedrus/cedrus_hw.h
|
||||
index b43c77d54b95..40b44722b7c0 100644
|
||||
index 27d0882397aa..0e67c69812be 100644
|
||||
--- a/drivers/staging/media/sunxi/cedrus/cedrus_hw.h
|
||||
+++ b/drivers/staging/media/sunxi/cedrus/cedrus_hw.h
|
||||
@@ -18,7 +18,8 @@
|
||||
|
||||
#define CEDRUS_CLOCK_RATE_DEFAULT 320000000
|
||||
@@ -16,7 +16,8 @@
|
||||
#ifndef _CEDRUS_HW_H_
|
||||
#define _CEDRUS_HW_H_
|
||||
|
||||
-int cedrus_engine_enable(struct cedrus_dev *dev, enum cedrus_codec codec);
|
||||
+int cedrus_engine_enable(struct cedrus_dev *dev, enum cedrus_codec codec,
|
||||
@ -311,7 +312,7 @@ index b43c77d54b95..40b44722b7c0 100644
|
||||
|
||||
void cedrus_dst_format_set(struct cedrus_dev *dev,
|
||||
diff --git a/drivers/staging/media/sunxi/cedrus/cedrus_mpeg2.c b/drivers/staging/media/sunxi/cedrus/cedrus_mpeg2.c
|
||||
index cb45fda9aaeb..2f6384ca385d 100644
|
||||
index 13c34927bad5..fc00a2cbf9bf 100644
|
||||
--- a/drivers/staging/media/sunxi/cedrus/cedrus_mpeg2.c
|
||||
+++ b/drivers/staging/media/sunxi/cedrus/cedrus_mpeg2.c
|
||||
@@ -96,7 +96,7 @@ static void cedrus_mpeg2_setup(struct cedrus_ctx *ctx, struct cedrus_run *run)
|
||||
@ -339,7 +340,7 @@ index a2931f322c7a..df000b7c99be 100644
|
||||
#define VE_PRIMARY_FB_LINE_STRIDE 0xc8
|
||||
|
||||
diff --git a/drivers/staging/media/sunxi/cedrus/cedrus_video.c b/drivers/staging/media/sunxi/cedrus/cedrus_video.c
|
||||
index adf00513c15f..b24317b26fd2 100644
|
||||
index a0817cae1d69..d27a9e82ff91 100644
|
||||
--- a/drivers/staging/media/sunxi/cedrus/cedrus_video.c
|
||||
+++ b/drivers/staging/media/sunxi/cedrus/cedrus_video.c
|
||||
@@ -29,8 +29,8 @@
|
||||
@ -354,5 +355,5 @@ index adf00513c15f..b24317b26fd2 100644
|
||||
static struct cedrus_format cedrus_formats[] = {
|
||||
{
|
||||
--
|
||||
2.20.1
|
||||
2.21.0
|
||||
|
@ -1,91 +0,0 @@
|
||||
From e3a864e94eb7b22812d7d9b80403aaba7ade8e49 Mon Sep 17 00:00:00 2001
|
||||
From: Jernej Skrabec <jernej.skrabec@siol.net>
|
||||
Date: Wed, 8 May 2019 23:36:51 +0200
|
||||
Subject: [PATCH] Revert "media: vb2: keep track of timestamp status"
|
||||
|
||||
This reverts commit 7e4e71624491d8a8befe62b43138beb0ab696006.
|
||||
---
|
||||
drivers/media/common/videobuf2/videobuf2-core.c | 3 ---
|
||||
drivers/media/common/videobuf2/videobuf2-v4l2.c | 3 +--
|
||||
drivers/media/v4l2-core/v4l2-mem2mem.c | 1 -
|
||||
include/media/videobuf2-core.h | 3 ---
|
||||
4 files changed, 1 insertion(+), 9 deletions(-)
|
||||
|
||||
diff --git a/drivers/media/common/videobuf2/videobuf2-core.c b/drivers/media/common/videobuf2/videobuf2-core.c
|
||||
index 3cf25abf5807..3b0c6d3dd1e3 100644
|
||||
--- a/drivers/media/common/videobuf2/videobuf2-core.c
|
||||
+++ b/drivers/media/common/videobuf2/videobuf2-core.c
|
||||
@@ -1041,7 +1041,6 @@ static int __prepare_userptr(struct vb2_buffer *vb)
|
||||
if (vb->planes[plane].mem_priv) {
|
||||
if (!reacquired) {
|
||||
reacquired = true;
|
||||
- vb->copied_timestamp = 0;
|
||||
call_void_vb_qop(vb, buf_cleanup, vb);
|
||||
}
|
||||
call_void_memop(vb, put_userptr, vb->planes[plane].mem_priv);
|
||||
@@ -1166,7 +1165,6 @@ static int __prepare_dmabuf(struct vb2_buffer *vb)
|
||||
|
||||
if (!reacquired) {
|
||||
reacquired = true;
|
||||
- vb->copied_timestamp = 0;
|
||||
call_void_vb_qop(vb, buf_cleanup, vb);
|
||||
}
|
||||
|
||||
@@ -1957,7 +1955,6 @@ static void __vb2_queue_cancel(struct vb2_queue *q)
|
||||
if (vb->request)
|
||||
media_request_put(vb->request);
|
||||
vb->request = NULL;
|
||||
- vb->copied_timestamp = 0;
|
||||
}
|
||||
}
|
||||
|
||||
diff --git a/drivers/media/common/videobuf2/videobuf2-v4l2.c b/drivers/media/common/videobuf2/videobuf2-v4l2.c
|
||||
index fb9ac7696fc6..ba57dee66592 100644
|
||||
--- a/drivers/media/common/videobuf2/videobuf2-v4l2.c
|
||||
+++ b/drivers/media/common/videobuf2/videobuf2-v4l2.c
|
||||
@@ -608,8 +608,7 @@ int vb2_find_timestamp(const struct vb2_queue *q, u64 timestamp,
|
||||
unsigned int i;
|
||||
|
||||
for (i = start_idx; i < q->num_buffers; i++)
|
||||
- if (q->bufs[i]->copied_timestamp &&
|
||||
- q->bufs[i]->timestamp == timestamp)
|
||||
+ if (q->bufs[i]->timestamp == timestamp)
|
||||
return i;
|
||||
return -1;
|
||||
}
|
||||
diff --git a/drivers/media/v4l2-core/v4l2-mem2mem.c b/drivers/media/v4l2-core/v4l2-mem2mem.c
|
||||
index 3392833d9541..82ef90af3de1 100644
|
||||
--- a/drivers/media/v4l2-core/v4l2-mem2mem.c
|
||||
+++ b/drivers/media/v4l2-core/v4l2-mem2mem.c
|
||||
@@ -989,7 +989,6 @@ void v4l2_m2m_buf_copy_metadata(const struct vb2_v4l2_buffer *out_vb,
|
||||
cap_vb->field = out_vb->field;
|
||||
cap_vb->flags &= ~mask;
|
||||
cap_vb->flags |= out_vb->flags & mask;
|
||||
- cap_vb->vb2_buf.copied_timestamp = 1;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(v4l2_m2m_buf_copy_metadata);
|
||||
|
||||
diff --git a/include/media/videobuf2-core.h b/include/media/videobuf2-core.h
|
||||
index 22f3ff76a8b5..7cdeadb6b596 100644
|
||||
--- a/include/media/videobuf2-core.h
|
||||
+++ b/include/media/videobuf2-core.h
|
||||
@@ -260,8 +260,6 @@ struct vb2_buffer {
|
||||
* prepared: this buffer has been prepared, i.e. the
|
||||
* buf_prepare op was called. It is cleared again
|
||||
* after the 'buf_finish' op is called.
|
||||
- * copied_timestamp: the timestamp of this capture buffer was copied
|
||||
- * from an output buffer.
|
||||
* queued_entry: entry on the queued buffers list, which holds
|
||||
* all buffers queued from userspace
|
||||
* done_entry: entry on the list that stores all buffers ready
|
||||
@@ -271,7 +269,6 @@ struct vb2_buffer {
|
||||
enum vb2_buffer_state state;
|
||||
unsigned int synced:1;
|
||||
unsigned int prepared:1;
|
||||
- unsigned int copied_timestamp:1;
|
||||
|
||||
struct vb2_plane planes[VB2_MAX_PLANES];
|
||||
struct list_head queued_entry;
|
||||
--
|
||||
2.21.0
|
||||
|
@ -1,25 +0,0 @@
|
||||
From 18c9a269e2b744ee84f32de9d5c6c66857725ef8 Mon Sep 17 00:00:00 2001
|
||||
From: Jernej Skrabec <jernej.skrabec@siol.net>
|
||||
Date: Sat, 15 Dec 2018 12:56:53 +0100
|
||||
Subject: [PATCH 20/20] cedrus increase frequency
|
||||
|
||||
---
|
||||
drivers/staging/media/sunxi/cedrus/cedrus_hw.h | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/drivers/staging/media/sunxi/cedrus/cedrus_hw.h b/drivers/staging/media/sunxi/cedrus/cedrus_hw.h
|
||||
index b43c77d54b95..70677571f3d3 100644
|
||||
--- a/drivers/staging/media/sunxi/cedrus/cedrus_hw.h
|
||||
+++ b/drivers/staging/media/sunxi/cedrus/cedrus_hw.h
|
||||
@@ -16,7 +16,7 @@
|
||||
#ifndef _CEDRUS_HW_H_
|
||||
#define _CEDRUS_HW_H_
|
||||
|
||||
-#define CEDRUS_CLOCK_RATE_DEFAULT 320000000
|
||||
+#define CEDRUS_CLOCK_RATE_DEFAULT 402000000
|
||||
|
||||
int cedrus_engine_enable(struct cedrus_dev *dev, enum cedrus_codec codec);
|
||||
void cedrus_engine_disable(struct cedrus_dev *dev);
|
||||
--
|
||||
2.20.0
|
||||
|
Loading…
Reference in New Issue
Block a user