aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/platform/coda/coda-bit.c
diff options
context:
space:
mode:
authorPhilipp Zabel <p.zabel@pengutronix.de>2018-06-28 06:57:52 -0400
committerMauro Carvalho Chehab <mchehab+samsung@kernel.org>2018-07-25 08:26:33 -0400
commit5c9072e8458f937a9c0a38736989d128ef990fc5 (patch)
treeb83b770723e717a6180017447571a5543c976a87 /drivers/media/platform/coda/coda-bit.c
parentmedia: vicodec: add the virtual codec driver (diff)
downloadlinux-dev-5c9072e8458f937a9c0a38736989d128ef990fc5.tar.xz
linux-dev-5c9072e8458f937a9c0a38736989d128ef990fc5.zip
media: coda: move framebuffer size calculation out of loop
All internal YCbCr frame buffers are the same size, calculate ycbcr_size once before the allocation loop. Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Diffstat (limited to 'drivers/media/platform/coda/coda-bit.c')
-rw-r--r--drivers/media/platform/coda/coda-bit.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/drivers/media/platform/coda/coda-bit.c b/drivers/media/platform/coda/coda-bit.c
index 26d14e6a64cc..033abb03722b 100644
--- a/drivers/media/platform/coda/coda-bit.c
+++ b/drivers/media/platform/coda/coda-bit.c
@@ -391,7 +391,7 @@ static int coda_alloc_framebuffers(struct coda_ctx *ctx,
{
struct coda_dev *dev = ctx->dev;
int width, height;
- int ysize;
+ unsigned int ysize, ycbcr_size;
int ret;
int i;
@@ -407,15 +407,16 @@ static int coda_alloc_framebuffers(struct coda_ctx *ctx,
}
ysize = width * height;
+ if (ctx->tiled_map_type == GDI_TILED_FRAME_MB_RASTER_MAP)
+ ycbcr_size = round_up(ysize, 4096) + ysize / 2;
+ else
+ ycbcr_size = ysize + ysize / 2;
+
/* Allocate frame buffers */
for (i = 0; i < ctx->num_internal_frames; i++) {
- size_t size;
+ size_t size = ycbcr_size;
char *name;
- if (ctx->tiled_map_type == GDI_TILED_FRAME_MB_RASTER_MAP)
- size = round_up(ysize, 4096) + ysize / 2;
- else
- size = ysize + ysize / 2;
/* Add space for mvcol buffers */
if (dev->devtype->product != CODA_DX6 &&
(ctx->codec->src_fourcc == V4L2_PIX_FMT_H264 ||