aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/platform/coda
diff options
context:
space:
mode:
authorPhilipp Zabel <p.zabel@pengutronix.de>2015-07-16 12:19:37 -0400
committerMauro Carvalho Chehab <mchehab@osg.samsung.com>2015-07-17 10:27:17 -0400
commit4e447ff199cfc4bc04ddb515d3d9ab46bb19530a (patch)
tree07c658bc54c8ca342f935dfc8ce83a87a3d04d55 /drivers/media/platform/coda
parentcde29ef313de391ec9a1e461458274623ab1eb87 (diff)
[media] coda: move cache setup into coda9_set_frame_cache, also use it in start_encoding
The frame cache should be set up correctly to encode NV12 source frames. This was not done before, so move the cache setup out of start_decoding into its own function and call it from both start_encoding and start_decoding. 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@osg.samsung.com>
Diffstat (limited to 'drivers/media/platform/coda')
-rw-r--r--drivers/media/platform/coda/coda-bit.c45
1 files changed, 25 insertions, 20 deletions
diff --git a/drivers/media/platform/coda/coda-bit.c b/drivers/media/platform/coda/coda-bit.c
index b14affcf8dc0..46c70547fc12 100644
--- a/drivers/media/platform/coda/coda-bit.c
+++ b/drivers/media/platform/coda/coda-bit.c
@@ -721,6 +721,26 @@ err_clk_per:
721 return ret; 721 return ret;
722} 722}
723 723
724static void coda9_set_frame_cache(struct coda_ctx *ctx, u32 fourcc)
725{
726 u32 cache_size, cache_config;
727
728 /* Luma 2x0 page, 2x6 cache, chroma 2x0 page, 2x4 cache size */
729 cache_size = 0x20262024;
730 cache_config = 2 << CODA9_CACHE_PAGEMERGE_OFFSET;
731 coda_write(ctx->dev, cache_size, CODA9_CMD_SET_FRAME_CACHE_SIZE);
732 if (fourcc == V4L2_PIX_FMT_NV12) {
733 cache_config |= 32 << CODA9_CACHE_LUMA_BUFFER_SIZE_OFFSET |
734 16 << CODA9_CACHE_CR_BUFFER_SIZE_OFFSET |
735 0 << CODA9_CACHE_CB_BUFFER_SIZE_OFFSET;
736 } else {
737 cache_config |= 32 << CODA9_CACHE_LUMA_BUFFER_SIZE_OFFSET |
738 8 << CODA9_CACHE_CR_BUFFER_SIZE_OFFSET |
739 8 << CODA9_CACHE_CB_BUFFER_SIZE_OFFSET;
740 }
741 coda_write(ctx->dev, cache_config, CODA9_CMD_SET_FRAME_CACHE_CONFIG);
742}
743
724/* 744/*
725 * Encoder context operations 745 * Encoder context operations
726 */ 746 */
@@ -1049,6 +1069,8 @@ static int coda_start_encoding(struct coda_ctx *ctx)
1049 coda_write(dev, ctx->iram_info.buf_btp_use, 1069 coda_write(dev, ctx->iram_info.buf_btp_use,
1050 CODA9_CMD_SET_FRAME_AXI_BTP_ADDR); 1070 CODA9_CMD_SET_FRAME_AXI_BTP_ADDR);
1051 1071
1072 coda9_set_frame_cache(ctx, q_data_src->fourcc);
1073
1052 /* FIXME */ 1074 /* FIXME */
1053 coda_write(dev, ctx->internal_frames[2].paddr, 1075 coda_write(dev, ctx->internal_frames[2].paddr,
1054 CODA9_CMD_SET_FRAME_SUBSAMP_A); 1076 CODA9_CMD_SET_FRAME_SUBSAMP_A);
@@ -1606,30 +1628,13 @@ static int __coda_start_decoding(struct coda_ctx *ctx)
1606 CODA7_CMD_SET_FRAME_AXI_DBKC_ADDR); 1628 CODA7_CMD_SET_FRAME_AXI_DBKC_ADDR);
1607 coda_write(dev, ctx->iram_info.buf_ovl_use, 1629 coda_write(dev, ctx->iram_info.buf_ovl_use,
1608 CODA7_CMD_SET_FRAME_AXI_OVL_ADDR); 1630 CODA7_CMD_SET_FRAME_AXI_OVL_ADDR);
1609 if (dev->devtype->product == CODA_960) 1631 if (dev->devtype->product == CODA_960) {
1610 coda_write(dev, ctx->iram_info.buf_btp_use, 1632 coda_write(dev, ctx->iram_info.buf_btp_use,
1611 CODA9_CMD_SET_FRAME_AXI_BTP_ADDR); 1633 CODA9_CMD_SET_FRAME_AXI_BTP_ADDR);
1612 }
1613
1614 if (dev->devtype->product == CODA_960) {
1615 int cbb_size, crb_size;
1616
1617 coda_write(dev, -1, CODA9_CMD_SET_FRAME_DELAY);
1618 /* Luma 2x0 page, 2x6 cache, chroma 2x0 page, 2x4 cache size */
1619 coda_write(dev, 0x20262024, CODA9_CMD_SET_FRAME_CACHE_SIZE);
1620 1634
1621 if (dst_fourcc == V4L2_PIX_FMT_NV12) { 1635 coda_write(dev, -1, CODA9_CMD_SET_FRAME_DELAY);
1622 cbb_size = 0; 1636 coda9_set_frame_cache(ctx, dst_fourcc);
1623 crb_size = 16;
1624 } else {
1625 cbb_size = 8;
1626 crb_size = 8;
1627 } 1637 }
1628 coda_write(dev, 2 << CODA9_CACHE_PAGEMERGE_OFFSET |
1629 32 << CODA9_CACHE_LUMA_BUFFER_SIZE_OFFSET |
1630 cbb_size << CODA9_CACHE_CB_BUFFER_SIZE_OFFSET |
1631 crb_size << CODA9_CACHE_CR_BUFFER_SIZE_OFFSET,
1632 CODA9_CMD_SET_FRAME_CACHE_CONFIG);
1633 } 1638 }
1634 1639
1635 if (src_fourcc == V4L2_PIX_FMT_H264) { 1640 if (src_fourcc == V4L2_PIX_FMT_H264) {