diff options
-rw-r--r-- | drivers/media/platform/coda/coda-bit.c | 45 |
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 | ||
724 | static 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) { |