mirror of
https://github.com/LibreELEC/LibreELEC.tv.git
synced 2025-07-29 13:46:49 +00:00
Allwinner: linux: Remove vmalloc workaround
This commit is contained in:
parent
85b190b30f
commit
83d0cb5391
@ -51,6 +51,3 @@
|
|||||||
|
|
||||||
# set the addon project
|
# set the addon project
|
||||||
ADDON_PROJECT="ARMv7"
|
ADDON_PROJECT="ARMv7"
|
||||||
|
|
||||||
# additional kernel parameters
|
|
||||||
EXTRA_CMDLINE="$EXTRA_CMDLINE vmalloc=320M"
|
|
||||||
|
@ -48,6 +48,3 @@
|
|||||||
|
|
||||||
# set the addon project
|
# set the addon project
|
||||||
ADDON_PROJECT="ARMv7"
|
ADDON_PROJECT="ARMv7"
|
||||||
|
|
||||||
# additional kernel parameters
|
|
||||||
EXTRA_CMDLINE="$EXTRA_CMDLINE vmalloc=320M"
|
|
||||||
|
@ -0,0 +1,266 @@
|
|||||||
|
From 6ed03518966d47be39ed628b6b8f228b6ea9a908 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Jernej Skrabec <jernej.skrabec@gmail.com>
|
||||||
|
Date: Sun, 12 Sep 2021 07:46:51 +0200
|
||||||
|
Subject: [PATCH] media: cedrus: Don't kernel map most buffers
|
||||||
|
|
||||||
|
Except VP8 probability coefficients buffer, all other buffers are never
|
||||||
|
accessed by CPU. That allows us to mark them with DMA_ATTR_NO_KERNEL_MAPPING
|
||||||
|
flag. This helps with decoding big (like 4k) videos on 32-bit ARM
|
||||||
|
platforms where default vmalloc size is relatively small - 240 MiB.
|
||||||
|
Since auxiliary buffer are not yet efficiently allocated, this can be
|
||||||
|
easily exceeded. Even if allocation is optimized, 4k videos will still
|
||||||
|
often exceed this limit.
|
||||||
|
|
||||||
|
Signed-off-by: Jernej Skrabec <jernej.skrabec@gmail.com>
|
||||||
|
---
|
||||||
|
.../staging/media/sunxi/cedrus/cedrus_h264.c | 102 ++++++++++--------
|
||||||
|
.../staging/media/sunxi/cedrus/cedrus_h265.c | 28 ++---
|
||||||
|
.../staging/media/sunxi/cedrus/cedrus_video.c | 2 +
|
||||||
|
3 files changed, 73 insertions(+), 59 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/drivers/staging/media/sunxi/cedrus/cedrus_h264.c b/drivers/staging/media/sunxi/cedrus/cedrus_h264.c
|
||||||
|
index de7442d4834d..6e38b37d9fe1 100644
|
||||||
|
--- a/drivers/staging/media/sunxi/cedrus/cedrus_h264.c
|
||||||
|
+++ b/drivers/staging/media/sunxi/cedrus/cedrus_h264.c
|
||||||
|
@@ -538,23 +538,23 @@ static int cedrus_h264_start(struct cedrus_ctx *ctx)
|
||||||
|
|
||||||
|
ctx->codec.h264.pic_info_buf_size = pic_info_size;
|
||||||
|
ctx->codec.h264.pic_info_buf =
|
||||||
|
- dma_alloc_coherent(dev->dev, ctx->codec.h264.pic_info_buf_size,
|
||||||
|
- &ctx->codec.h264.pic_info_buf_dma,
|
||||||
|
- GFP_KERNEL);
|
||||||
|
+ dma_alloc_attrs(dev->dev, ctx->codec.h264.pic_info_buf_size,
|
||||||
|
+ &ctx->codec.h264.pic_info_buf_dma,
|
||||||
|
+ GFP_KERNEL, DMA_ATTR_NO_KERNEL_MAPPING);
|
||||||
|
if (!ctx->codec.h264.pic_info_buf)
|
||||||
|
return -ENOMEM;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* That buffer is supposed to be 16kiB in size, and be aligned
|
||||||
|
- * on 16kiB as well. However, dma_alloc_coherent provides the
|
||||||
|
+ * on 16kiB as well. However, dma_alloc_attrs provides the
|
||||||
|
* guarantee that we'll have a CPU and DMA address aligned on
|
||||||
|
* the smallest page order that is greater to the requested
|
||||||
|
* size, so we don't have to overallocate.
|
||||||
|
*/
|
||||||
|
ctx->codec.h264.neighbor_info_buf =
|
||||||
|
- dma_alloc_coherent(dev->dev, CEDRUS_NEIGHBOR_INFO_BUF_SIZE,
|
||||||
|
- &ctx->codec.h264.neighbor_info_buf_dma,
|
||||||
|
- GFP_KERNEL);
|
||||||
|
+ dma_alloc_attrs(dev->dev, CEDRUS_NEIGHBOR_INFO_BUF_SIZE,
|
||||||
|
+ &ctx->codec.h264.neighbor_info_buf_dma,
|
||||||
|
+ GFP_KERNEL, DMA_ATTR_NO_KERNEL_MAPPING);
|
||||||
|
if (!ctx->codec.h264.neighbor_info_buf) {
|
||||||
|
ret = -ENOMEM;
|
||||||
|
goto err_pic_buf;
|
||||||
|
@@ -582,10 +582,11 @@ static int cedrus_h264_start(struct cedrus_ctx *ctx)
|
||||||
|
|
||||||
|
mv_col_size = field_size * 2 * CEDRUS_H264_FRAME_NUM;
|
||||||
|
ctx->codec.h264.mv_col_buf_size = mv_col_size;
|
||||||
|
- ctx->codec.h264.mv_col_buf = dma_alloc_coherent(dev->dev,
|
||||||
|
- ctx->codec.h264.mv_col_buf_size,
|
||||||
|
- &ctx->codec.h264.mv_col_buf_dma,
|
||||||
|
- GFP_KERNEL);
|
||||||
|
+ ctx->codec.h264.mv_col_buf =
|
||||||
|
+ dma_alloc_attrs(dev->dev,
|
||||||
|
+ ctx->codec.h264.mv_col_buf_size,
|
||||||
|
+ &ctx->codec.h264.mv_col_buf_dma,
|
||||||
|
+ GFP_KERNEL, DMA_ATTR_NO_KERNEL_MAPPING);
|
||||||
|
if (!ctx->codec.h264.mv_col_buf) {
|
||||||
|
ret = -ENOMEM;
|
||||||
|
goto err_neighbor_buf;
|
||||||
|
@@ -600,10 +601,10 @@ static int cedrus_h264_start(struct cedrus_ctx *ctx)
|
||||||
|
ctx->codec.h264.deblk_buf_size =
|
||||||
|
ALIGN(ctx->src_fmt.width, 32) * 12;
|
||||||
|
ctx->codec.h264.deblk_buf =
|
||||||
|
- dma_alloc_coherent(dev->dev,
|
||||||
|
- ctx->codec.h264.deblk_buf_size,
|
||||||
|
- &ctx->codec.h264.deblk_buf_dma,
|
||||||
|
- GFP_KERNEL);
|
||||||
|
+ dma_alloc_attrs(dev->dev,
|
||||||
|
+ ctx->codec.h264.deblk_buf_size,
|
||||||
|
+ &ctx->codec.h264.deblk_buf_dma,
|
||||||
|
+ GFP_KERNEL, DMA_ATTR_NO_KERNEL_MAPPING);
|
||||||
|
if (!ctx->codec.h264.deblk_buf) {
|
||||||
|
ret = -ENOMEM;
|
||||||
|
goto err_mv_col_buf;
|
||||||
|
@@ -616,10 +617,10 @@ static int cedrus_h264_start(struct cedrus_ctx *ctx)
|
||||||
|
ctx->codec.h264.intra_pred_buf_size =
|
||||||
|
ALIGN(ctx->src_fmt.width, 64) * 5 * 2;
|
||||||
|
ctx->codec.h264.intra_pred_buf =
|
||||||
|
- dma_alloc_coherent(dev->dev,
|
||||||
|
- ctx->codec.h264.intra_pred_buf_size,
|
||||||
|
- &ctx->codec.h264.intra_pred_buf_dma,
|
||||||
|
- GFP_KERNEL);
|
||||||
|
+ dma_alloc_attrs(dev->dev,
|
||||||
|
+ ctx->codec.h264.intra_pred_buf_size,
|
||||||
|
+ &ctx->codec.h264.intra_pred_buf_dma,
|
||||||
|
+ GFP_KERNEL, DMA_ATTR_NO_KERNEL_MAPPING);
|
||||||
|
if (!ctx->codec.h264.intra_pred_buf) {
|
||||||
|
ret = -ENOMEM;
|
||||||
|
goto err_deblk_buf;
|
||||||
|
@@ -629,24 +630,28 @@ static int cedrus_h264_start(struct cedrus_ctx *ctx)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
err_deblk_buf:
|
||||||
|
- dma_free_coherent(dev->dev, ctx->codec.h264.deblk_buf_size,
|
||||||
|
- ctx->codec.h264.deblk_buf,
|
||||||
|
- ctx->codec.h264.deblk_buf_dma);
|
||||||
|
+ dma_free_attrs(dev->dev, ctx->codec.h264.deblk_buf_size,
|
||||||
|
+ ctx->codec.h264.deblk_buf,
|
||||||
|
+ ctx->codec.h264.deblk_buf_dma,
|
||||||
|
+ DMA_ATTR_NO_KERNEL_MAPPING);
|
||||||
|
|
||||||
|
err_mv_col_buf:
|
||||||
|
- dma_free_coherent(dev->dev, ctx->codec.h264.mv_col_buf_size,
|
||||||
|
- ctx->codec.h264.mv_col_buf,
|
||||||
|
- ctx->codec.h264.mv_col_buf_dma);
|
||||||
|
+ dma_free_attrs(dev->dev, ctx->codec.h264.mv_col_buf_size,
|
||||||
|
+ ctx->codec.h264.mv_col_buf,
|
||||||
|
+ ctx->codec.h264.mv_col_buf_dma,
|
||||||
|
+ DMA_ATTR_NO_KERNEL_MAPPING);
|
||||||
|
|
||||||
|
err_neighbor_buf:
|
||||||
|
- dma_free_coherent(dev->dev, CEDRUS_NEIGHBOR_INFO_BUF_SIZE,
|
||||||
|
- ctx->codec.h264.neighbor_info_buf,
|
||||||
|
- ctx->codec.h264.neighbor_info_buf_dma);
|
||||||
|
+ dma_free_attrs(dev->dev, CEDRUS_NEIGHBOR_INFO_BUF_SIZE,
|
||||||
|
+ ctx->codec.h264.neighbor_info_buf,
|
||||||
|
+ ctx->codec.h264.neighbor_info_buf_dma,
|
||||||
|
+ DMA_ATTR_NO_KERNEL_MAPPING);
|
||||||
|
|
||||||
|
err_pic_buf:
|
||||||
|
- dma_free_coherent(dev->dev, ctx->codec.h264.pic_info_buf_size,
|
||||||
|
- ctx->codec.h264.pic_info_buf,
|
||||||
|
- ctx->codec.h264.pic_info_buf_dma);
|
||||||
|
+ dma_free_attrs(dev->dev, ctx->codec.h264.pic_info_buf_size,
|
||||||
|
+ ctx->codec.h264.pic_info_buf,
|
||||||
|
+ ctx->codec.h264.pic_info_buf_dma,
|
||||||
|
+ DMA_ATTR_NO_KERNEL_MAPPING);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -654,23 +659,28 @@ static void cedrus_h264_stop(struct cedrus_ctx *ctx)
|
||||||
|
{
|
||||||
|
struct cedrus_dev *dev = ctx->dev;
|
||||||
|
|
||||||
|
- dma_free_coherent(dev->dev, ctx->codec.h264.mv_col_buf_size,
|
||||||
|
- ctx->codec.h264.mv_col_buf,
|
||||||
|
- ctx->codec.h264.mv_col_buf_dma);
|
||||||
|
- dma_free_coherent(dev->dev, CEDRUS_NEIGHBOR_INFO_BUF_SIZE,
|
||||||
|
- ctx->codec.h264.neighbor_info_buf,
|
||||||
|
- ctx->codec.h264.neighbor_info_buf_dma);
|
||||||
|
- dma_free_coherent(dev->dev, ctx->codec.h264.pic_info_buf_size,
|
||||||
|
- ctx->codec.h264.pic_info_buf,
|
||||||
|
- ctx->codec.h264.pic_info_buf_dma);
|
||||||
|
+ dma_free_attrs(dev->dev, ctx->codec.h264.mv_col_buf_size,
|
||||||
|
+ ctx->codec.h264.mv_col_buf,
|
||||||
|
+ ctx->codec.h264.mv_col_buf_dma,
|
||||||
|
+ DMA_ATTR_NO_KERNEL_MAPPING);
|
||||||
|
+ dma_free_attrs(dev->dev, CEDRUS_NEIGHBOR_INFO_BUF_SIZE,
|
||||||
|
+ ctx->codec.h264.neighbor_info_buf,
|
||||||
|
+ ctx->codec.h264.neighbor_info_buf_dma,
|
||||||
|
+ DMA_ATTR_NO_KERNEL_MAPPING);
|
||||||
|
+ dma_free_attrs(dev->dev, ctx->codec.h264.pic_info_buf_size,
|
||||||
|
+ ctx->codec.h264.pic_info_buf,
|
||||||
|
+ ctx->codec.h264.pic_info_buf_dma,
|
||||||
|
+ DMA_ATTR_NO_KERNEL_MAPPING);
|
||||||
|
if (ctx->codec.h264.deblk_buf_size)
|
||||||
|
- dma_free_coherent(dev->dev, ctx->codec.h264.deblk_buf_size,
|
||||||
|
- ctx->codec.h264.deblk_buf,
|
||||||
|
- ctx->codec.h264.deblk_buf_dma);
|
||||||
|
+ dma_free_attrs(dev->dev, ctx->codec.h264.deblk_buf_size,
|
||||||
|
+ ctx->codec.h264.deblk_buf,
|
||||||
|
+ ctx->codec.h264.deblk_buf_dma,
|
||||||
|
+ DMA_ATTR_NO_KERNEL_MAPPING);
|
||||||
|
if (ctx->codec.h264.intra_pred_buf_size)
|
||||||
|
- dma_free_coherent(dev->dev, ctx->codec.h264.intra_pred_buf_size,
|
||||||
|
- ctx->codec.h264.intra_pred_buf,
|
||||||
|
- ctx->codec.h264.intra_pred_buf_dma);
|
||||||
|
+ dma_free_attrs(dev->dev, ctx->codec.h264.intra_pred_buf_size,
|
||||||
|
+ ctx->codec.h264.intra_pred_buf,
|
||||||
|
+ ctx->codec.h264.intra_pred_buf_dma,
|
||||||
|
+ DMA_ATTR_NO_KERNEL_MAPPING);
|
||||||
|
}
|
||||||
|
|
||||||
|
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 3d9561d4aadb..bb7eb56106c5 100644
|
||||||
|
--- a/drivers/staging/media/sunxi/cedrus/cedrus_h265.c
|
||||||
|
+++ b/drivers/staging/media/sunxi/cedrus/cedrus_h265.c
|
||||||
|
@@ -351,10 +351,10 @@ static void cedrus_h265_setup(struct cedrus_ctx *ctx,
|
||||||
|
ctx->codec.h265.mv_col_buf_unit_size;
|
||||||
|
|
||||||
|
ctx->codec.h265.mv_col_buf =
|
||||||
|
- dma_alloc_coherent(dev->dev,
|
||||||
|
- ctx->codec.h265.mv_col_buf_size,
|
||||||
|
- &ctx->codec.h265.mv_col_buf_addr,
|
||||||
|
- GFP_KERNEL);
|
||||||
|
+ dma_alloc_attrs(dev->dev,
|
||||||
|
+ ctx->codec.h265.mv_col_buf_size,
|
||||||
|
+ &ctx->codec.h265.mv_col_buf_addr,
|
||||||
|
+ 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.
|
||||||
|
@@ -668,9 +668,9 @@ static int cedrus_h265_start(struct cedrus_ctx *ctx)
|
||||||
|
ctx->codec.h265.mv_col_buf_size = 0;
|
||||||
|
|
||||||
|
ctx->codec.h265.neighbor_info_buf =
|
||||||
|
- dma_alloc_coherent(dev->dev, CEDRUS_H265_NEIGHBOR_INFO_BUF_SIZE,
|
||||||
|
- &ctx->codec.h265.neighbor_info_buf_addr,
|
||||||
|
- GFP_KERNEL);
|
||||||
|
+ dma_alloc_attrs(dev->dev, CEDRUS_H265_NEIGHBOR_INFO_BUF_SIZE,
|
||||||
|
+ &ctx->codec.h265.neighbor_info_buf_addr,
|
||||||
|
+ GFP_KERNEL, DMA_ATTR_NO_KERNEL_MAPPING);
|
||||||
|
if (!ctx->codec.h265.neighbor_info_buf)
|
||||||
|
return -ENOMEM;
|
||||||
|
|
||||||
|
@@ -682,16 +682,18 @@ static void cedrus_h265_stop(struct cedrus_ctx *ctx)
|
||||||
|
struct cedrus_dev *dev = ctx->dev;
|
||||||
|
|
||||||
|
if (ctx->codec.h265.mv_col_buf_size > 0) {
|
||||||
|
- dma_free_coherent(dev->dev, ctx->codec.h265.mv_col_buf_size,
|
||||||
|
- ctx->codec.h265.mv_col_buf,
|
||||||
|
- ctx->codec.h265.mv_col_buf_addr);
|
||||||
|
+ dma_free_attrs(dev->dev, ctx->codec.h265.mv_col_buf_size,
|
||||||
|
+ ctx->codec.h265.mv_col_buf,
|
||||||
|
+ ctx->codec.h265.mv_col_buf_addr,
|
||||||
|
+ DMA_ATTR_NO_KERNEL_MAPPING);
|
||||||
|
|
||||||
|
ctx->codec.h265.mv_col_buf_size = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
- dma_free_coherent(dev->dev, CEDRUS_H265_NEIGHBOR_INFO_BUF_SIZE,
|
||||||
|
- ctx->codec.h265.neighbor_info_buf,
|
||||||
|
- ctx->codec.h265.neighbor_info_buf_addr);
|
||||||
|
+ 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);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void cedrus_h265_trigger(struct cedrus_ctx *ctx)
|
||||||
|
diff --git a/drivers/staging/media/sunxi/cedrus/cedrus_video.c b/drivers/staging/media/sunxi/cedrus/cedrus_video.c
|
||||||
|
index 66714609b577..800ffa5382de 100644
|
||||||
|
--- a/drivers/staging/media/sunxi/cedrus/cedrus_video.c
|
||||||
|
+++ b/drivers/staging/media/sunxi/cedrus/cedrus_video.c
|
||||||
|
@@ -568,6 +568,7 @@ int cedrus_queue_init(void *priv, struct vb2_queue *src_vq,
|
||||||
|
|
||||||
|
src_vq->type = V4L2_BUF_TYPE_VIDEO_OUTPUT;
|
||||||
|
src_vq->io_modes = VB2_MMAP | VB2_DMABUF;
|
||||||
|
+ src_vq->dma_attrs = DMA_ATTR_NO_KERNEL_MAPPING;
|
||||||
|
src_vq->drv_priv = ctx;
|
||||||
|
src_vq->buf_struct_size = sizeof(struct cedrus_buffer);
|
||||||
|
src_vq->ops = &cedrus_qops;
|
||||||
|
@@ -584,6 +585,7 @@ int cedrus_queue_init(void *priv, struct vb2_queue *src_vq,
|
||||||
|
|
||||||
|
dst_vq->type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
|
||||||
|
dst_vq->io_modes = VB2_MMAP | VB2_DMABUF;
|
||||||
|
+ src_vq->dma_attrs = DMA_ATTR_NO_KERNEL_MAPPING;
|
||||||
|
dst_vq->drv_priv = ctx;
|
||||||
|
dst_vq->buf_struct_size = sizeof(struct cedrus_buffer);
|
||||||
|
dst_vq->ops = &cedrus_qops;
|
||||||
|
--
|
||||||
|
2.33.0
|
||||||
|
|
@ -154,21 +154,21 @@ Signed-off-by: Jernej Skrabec <jernej.skrabec@siol.net>
|
|||||||
+ GFP_KERNEL);
|
+ GFP_KERNEL);
|
||||||
+ if (!ctx->codec.h265.entry_points_buf) {
|
+ if (!ctx->codec.h265.entry_points_buf) {
|
||||||
+ dma_free_coherent(dev->dev, CEDRUS_H265_NEIGHBOR_INFO_BUF_SIZE,
|
+ dma_free_coherent(dev->dev, CEDRUS_H265_NEIGHBOR_INFO_BUF_SIZE,
|
||||||
+ ctx->codec.h265.neighbor_info_buf,
|
+ ctx->codec.h265.neighbor_info_buf,
|
||||||
+ ctx->codec.h265.neighbor_info_buf_addr);
|
+ ctx->codec.h265.neighbor_info_buf_addr);
|
||||||
+ return -ENOMEM;
|
+ return -ENOMEM;
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -692,6 +770,9 @@ static void cedrus_h265_stop(struct cedr
|
@@ -693,6 +771,9 @@ static void cedrus_h265_stop(struct cedr
|
||||||
dma_free_coherent(dev->dev, CEDRUS_H265_NEIGHBOR_INFO_BUF_SIZE,
|
ctx->codec.h265.neighbor_info_buf,
|
||||||
ctx->codec.h265.neighbor_info_buf,
|
ctx->codec.h265.neighbor_info_buf_addr,
|
||||||
ctx->codec.h265.neighbor_info_buf_addr);
|
DMA_ATTR_NO_KERNEL_MAPPING);
|
||||||
+ dma_free_coherent(dev->dev, CEDRUS_H265_ENTRY_POINTS_BUF_SIZE,
|
+ dma_free_coherent(dev->dev, CEDRUS_H265_ENTRY_POINTS_BUF_SIZE,
|
||||||
+ ctx->codec.h265.entry_points_buf,
|
+ ctx->codec.h265.entry_points_buf,
|
||||||
+ ctx->codec.h265.entry_points_buf_addr);
|
+ ctx->codec.h265.entry_points_buf_addr);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void cedrus_h265_trigger(struct cedrus_ctx *ctx)
|
static void cedrus_h265_trigger(struct cedrus_ctx *ctx)
|
@ -77,10 +77,10 @@ Signed-off-by: Jernej Skrabec <jernej.skrabec@siol.net>
|
|||||||
+ CEDRUS_H265_MV_COL_BUF_UNIT_CTB_SIZE, 1024);
|
+ CEDRUS_H265_MV_COL_BUF_UNIT_CTB_SIZE, 1024);
|
||||||
+
|
+
|
||||||
+ cedrus_buf->codec.h265.mv_col_buf =
|
+ cedrus_buf->codec.h265.mv_col_buf =
|
||||||
+ dma_alloc_coherent(ctx->dev->dev,
|
+ dma_alloc_attrs(ctx->dev->dev,
|
||||||
+ cedrus_buf->codec.h265.mv_col_buf_size,
|
+ cedrus_buf->codec.h265.mv_col_buf_size,
|
||||||
+ &cedrus_buf->codec.h265.mv_col_buf_dma,
|
+ &cedrus_buf->codec.h265.mv_col_buf_dma,
|
||||||
+ GFP_KERNEL);
|
+ GFP_KERNEL, DMA_ATTR_NO_KERNEL_MAPPING);
|
||||||
+
|
+
|
||||||
+ if (!cedrus_buf->codec.h265.mv_col_buf) {
|
+ if (!cedrus_buf->codec.h265.mv_col_buf) {
|
||||||
+ cedrus_buf->codec.h265.mv_col_buf_size = 0;
|
+ cedrus_buf->codec.h265.mv_col_buf_size = 0;
|
||||||
@ -153,10 +153,10 @@ Signed-off-by: Jernej Skrabec <jernej.skrabec@siol.net>
|
|||||||
- ctx->codec.h265.mv_col_buf_unit_size;
|
- ctx->codec.h265.mv_col_buf_unit_size;
|
||||||
-
|
-
|
||||||
- ctx->codec.h265.mv_col_buf =
|
- ctx->codec.h265.mv_col_buf =
|
||||||
- dma_alloc_coherent(dev->dev,
|
- dma_alloc_attrs(dev->dev,
|
||||||
- ctx->codec.h265.mv_col_buf_size,
|
- ctx->codec.h265.mv_col_buf_size,
|
||||||
- &ctx->codec.h265.mv_col_buf_addr,
|
- &ctx->codec.h265.mv_col_buf_addr,
|
||||||
- GFP_KERNEL);
|
- GFP_KERNEL, DMA_ATTR_NO_KERNEL_MAPPING);
|
||||||
- if (!ctx->codec.h265.mv_col_buf) {
|
- if (!ctx->codec.h265.mv_col_buf) {
|
||||||
- ctx->codec.h265.mv_col_buf_size = 0;
|
- ctx->codec.h265.mv_col_buf_size = 0;
|
||||||
- // TODO: Abort the process here.
|
- // TODO: Abort the process here.
|
||||||
@ -193,24 +193,25 @@ Signed-off-by: Jernej Skrabec <jernej.skrabec@siol.net>
|
|||||||
- ctx->codec.h265.mv_col_buf_size = 0;
|
- ctx->codec.h265.mv_col_buf_size = 0;
|
||||||
-
|
-
|
||||||
ctx->codec.h265.neighbor_info_buf =
|
ctx->codec.h265.neighbor_info_buf =
|
||||||
dma_alloc_coherent(dev->dev, CEDRUS_H265_NEIGHBOR_INFO_BUF_SIZE,
|
dma_alloc_attrs(dev->dev, CEDRUS_H265_NEIGHBOR_INFO_BUF_SIZE,
|
||||||
&ctx->codec.h265.neighbor_info_buf_addr,
|
&ctx->codec.h265.neighbor_info_buf_addr,
|
||||||
@@ -759,14 +767,6 @@ static void cedrus_h265_stop(struct cedr
|
@@ -759,15 +767,6 @@ static void cedrus_h265_stop(struct cedr
|
||||||
{
|
{
|
||||||
struct cedrus_dev *dev = ctx->dev;
|
struct cedrus_dev *dev = ctx->dev;
|
||||||
|
|
||||||
- if (ctx->codec.h265.mv_col_buf_size > 0) {
|
- if (ctx->codec.h265.mv_col_buf_size > 0) {
|
||||||
- dma_free_coherent(dev->dev, ctx->codec.h265.mv_col_buf_size,
|
- dma_free_attrs(dev->dev, ctx->codec.h265.mv_col_buf_size,
|
||||||
- ctx->codec.h265.mv_col_buf,
|
- ctx->codec.h265.mv_col_buf,
|
||||||
- ctx->codec.h265.mv_col_buf_addr);
|
- ctx->codec.h265.mv_col_buf_addr,
|
||||||
|
- DMA_ATTR_NO_KERNEL_MAPPING);
|
||||||
-
|
-
|
||||||
- ctx->codec.h265.mv_col_buf_size = 0;
|
- ctx->codec.h265.mv_col_buf_size = 0;
|
||||||
- }
|
- }
|
||||||
-
|
-
|
||||||
dma_free_coherent(dev->dev, CEDRUS_H265_NEIGHBOR_INFO_BUF_SIZE,
|
dma_free_attrs(dev->dev, CEDRUS_H265_NEIGHBOR_INFO_BUF_SIZE,
|
||||||
ctx->codec.h265.neighbor_info_buf,
|
ctx->codec.h265.neighbor_info_buf,
|
||||||
ctx->codec.h265.neighbor_info_buf_addr);
|
ctx->codec.h265.neighbor_info_buf_addr);
|
||||||
@@ -782,6 +782,16 @@ static void cedrus_h265_trigger(struct c
|
@@ -782,6 +782,17 @@ static void cedrus_h265_trigger(struct c
|
||||||
cedrus_write(dev, VE_DEC_H265_TRIGGER, VE_DEC_H265_TRIGGER_DEC_SLICE);
|
cedrus_write(dev, VE_DEC_H265_TRIGGER, VE_DEC_H265_TRIGGER_DEC_SLICE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -218,10 +219,11 @@ Signed-off-by: Jernej Skrabec <jernej.skrabec@siol.net>
|
|||||||
+ struct cedrus_buffer *buf)
|
+ struct cedrus_buffer *buf)
|
||||||
+{
|
+{
|
||||||
+ if (buf->codec.h265.mv_col_buf_size)
|
+ if (buf->codec.h265.mv_col_buf_size)
|
||||||
+ dma_free_coherent(ctx->dev->dev,
|
+ dma_free_attrs(ctx->dev->dev,
|
||||||
+ buf->codec.h265.mv_col_buf_size,
|
+ buf->codec.h265.mv_col_buf_size,
|
||||||
+ buf->codec.h265.mv_col_buf,
|
+ buf->codec.h265.mv_col_buf,
|
||||||
+ buf->codec.h265.mv_col_buf_dma);
|
+ buf->codec.h265.mv_col_buf_dma,
|
||||||
|
+ DMA_ATTR_NO_KERNEL_MAPPING);
|
||||||
+}
|
+}
|
||||||
+
|
+
|
||||||
struct cedrus_dec_ops cedrus_dec_ops_h265 = {
|
struct cedrus_dec_ops cedrus_dec_ops_h265 = {
|
@ -82,10 +82,10 @@ Signed-off-by: Jernej Skrabec <jernej.skrabec@siol.net>
|
|||||||
+
|
+
|
||||||
+ output_buf->codec.h264.mv_col_buf_size = field_size * 2;
|
+ output_buf->codec.h264.mv_col_buf_size = field_size * 2;
|
||||||
+ output_buf->codec.h264.mv_col_buf =
|
+ output_buf->codec.h264.mv_col_buf =
|
||||||
+ dma_alloc_coherent(dev->dev,
|
+ dma_alloc_attrs(dev->dev,
|
||||||
+ output_buf->codec.h264.mv_col_buf_size,
|
+ output_buf->codec.h264.mv_col_buf_size,
|
||||||
+ &output_buf->codec.h264.mv_col_buf_dma,
|
+ &output_buf->codec.h264.mv_col_buf_dma,
|
||||||
+ GFP_KERNEL);
|
+ GFP_KERNEL, DMA_ATTR_NO_KERNEL_MAPPING);
|
||||||
+
|
+
|
||||||
+ if (!output_buf->codec.h264.mv_col_buf)
|
+ if (!output_buf->codec.h264.mv_col_buf)
|
||||||
+ output_buf->codec.h264.mv_col_buf_size = 0;
|
+ output_buf->codec.h264.mv_col_buf_size = 0;
|
||||||
@ -103,7 +103,7 @@ Signed-off-by: Jernej Skrabec <jernej.skrabec@siol.net>
|
|||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
/* Formula for picture buffer size is taken from CedarX source. */
|
/* Formula for picture buffer size is taken from CedarX source. */
|
||||||
@@ -560,37 +577,6 @@ static int cedrus_h264_start(struct cedr
|
@@ -560,38 +577,6 @@ static int cedrus_h264_start(struct cedr
|
||||||
goto err_pic_buf;
|
goto err_pic_buf;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -129,10 +129,11 @@ Signed-off-by: Jernej Skrabec <jernej.skrabec@siol.net>
|
|||||||
-
|
-
|
||||||
- mv_col_size = field_size * 2 * CEDRUS_H264_FRAME_NUM;
|
- mv_col_size = field_size * 2 * CEDRUS_H264_FRAME_NUM;
|
||||||
- ctx->codec.h264.mv_col_buf_size = mv_col_size;
|
- ctx->codec.h264.mv_col_buf_size = mv_col_size;
|
||||||
- ctx->codec.h264.mv_col_buf = dma_alloc_coherent(dev->dev,
|
- ctx->codec.h264.mv_col_buf =
|
||||||
- ctx->codec.h264.mv_col_buf_size,
|
- dma_alloc_attrs(dev->dev,
|
||||||
- &ctx->codec.h264.mv_col_buf_dma,
|
- ctx->codec.h264.mv_col_buf_size,
|
||||||
- GFP_KERNEL);
|
- &ctx->codec.h264.mv_col_buf_dma,
|
||||||
|
- GFP_KERNEL, DMA_ATTR_NO_KERNEL_MAPPING);
|
||||||
- if (!ctx->codec.h264.mv_col_buf) {
|
- if (!ctx->codec.h264.mv_col_buf) {
|
||||||
- ret = -ENOMEM;
|
- ret = -ENOMEM;
|
||||||
- goto err_neighbor_buf;
|
- goto err_neighbor_buf;
|
||||||
@ -150,29 +151,31 @@ Signed-off-by: Jernej Skrabec <jernej.skrabec@siol.net>
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -633,11 +619,6 @@ err_deblk_buf:
|
@@ -633,12 +619,6 @@ err_deblk_buf:
|
||||||
ctx->codec.h264.deblk_buf,
|
ctx->codec.h264.deblk_buf,
|
||||||
ctx->codec.h264.deblk_buf_dma);
|
ctx->codec.h264.deblk_buf_dma);
|
||||||
|
|
||||||
-err_mv_col_buf:
|
-err_mv_col_buf:
|
||||||
- dma_free_coherent(dev->dev, ctx->codec.h264.mv_col_buf_size,
|
- dma_free_attrs(dev->dev, ctx->codec.h264.mv_col_buf_size,
|
||||||
- ctx->codec.h264.mv_col_buf,
|
- ctx->codec.h264.mv_col_buf,
|
||||||
- ctx->codec.h264.mv_col_buf_dma);
|
- ctx->codec.h264.mv_col_buf_dma,
|
||||||
|
- DMA_ATTR_NO_KERNEL_MAPPING);
|
||||||
-
|
-
|
||||||
err_neighbor_buf:
|
err_neighbor_buf:
|
||||||
dma_free_coherent(dev->dev, CEDRUS_NEIGHBOR_INFO_BUF_SIZE,
|
dma_free_attrs(dev->dev, CEDRUS_NEIGHBOR_INFO_BUF_SIZE,
|
||||||
ctx->codec.h264.neighbor_info_buf,
|
ctx->codec.h264.neighbor_info_buf,
|
||||||
@@ -654,9 +635,6 @@ static void cedrus_h264_stop(struct cedr
|
@@ -654,10 +635,6 @@ static void cedrus_h264_stop(struct cedr
|
||||||
{
|
{
|
||||||
struct cedrus_dev *dev = ctx->dev;
|
struct cedrus_dev *dev = ctx->dev;
|
||||||
|
|
||||||
- dma_free_coherent(dev->dev, ctx->codec.h264.mv_col_buf_size,
|
- dma_free_attrs(dev->dev, ctx->codec.h264.mv_col_buf_size,
|
||||||
- ctx->codec.h264.mv_col_buf,
|
- ctx->codec.h264.mv_col_buf,
|
||||||
- ctx->codec.h264.mv_col_buf_dma);
|
- ctx->codec.h264.mv_col_buf_dma,
|
||||||
dma_free_coherent(dev->dev, CEDRUS_NEIGHBOR_INFO_BUF_SIZE,
|
- DMA_ATTR_NO_KERNEL_MAPPING);
|
||||||
ctx->codec.h264.neighbor_info_buf,
|
dma_free_attrs(dev->dev, CEDRUS_NEIGHBOR_INFO_BUF_SIZE,
|
||||||
ctx->codec.h264.neighbor_info_buf_dma);
|
ctx->codec.h264.neighbor_info_buf,
|
||||||
@@ -681,6 +659,16 @@ static void cedrus_h264_trigger(struct c
|
ctx->codec.h264.neighbor_info_buf_dma,
|
||||||
|
@@ -681,6 +659,17 @@ static void cedrus_h264_trigger(struct c
|
||||||
VE_H264_TRIGGER_TYPE_AVC_SLICE_DECODE);
|
VE_H264_TRIGGER_TYPE_AVC_SLICE_DECODE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -180,10 +183,11 @@ Signed-off-by: Jernej Skrabec <jernej.skrabec@siol.net>
|
|||||||
+ struct cedrus_buffer *buf)
|
+ struct cedrus_buffer *buf)
|
||||||
+{
|
+{
|
||||||
+ if (buf->codec.h264.mv_col_buf_size)
|
+ if (buf->codec.h264.mv_col_buf_size)
|
||||||
+ dma_free_coherent(ctx->dev->dev,
|
+ dma_free_attrs(ctx->dev->dev,
|
||||||
+ buf->codec.h264.mv_col_buf_size,
|
+ buf->codec.h264.mv_col_buf_size,
|
||||||
+ buf->codec.h264.mv_col_buf,
|
+ buf->codec.h264.mv_col_buf,
|
||||||
+ buf->codec.h264.mv_col_buf_dma);
|
+ buf->codec.h264.mv_col_buf_dma,
|
||||||
|
+ DMA_ATTR_NO_KERNEL_MAPPING);
|
||||||
+}
|
+}
|
||||||
+
|
+
|
||||||
struct cedrus_dec_ops cedrus_dec_ops_h264 = {
|
struct cedrus_dec_ops cedrus_dec_ops_h264 = {
|
Loading…
x
Reference in New Issue
Block a user