diff options
Diffstat (limited to 'drivers/media/platform/coda/coda-bit.c')
-rw-r--r-- | drivers/media/platform/coda/coda-bit.c | 48 |
1 files changed, 37 insertions, 11 deletions
diff --git a/drivers/media/platform/coda/coda-bit.c b/drivers/media/platform/coda/coda-bit.c index 46c70547fc12..3d434a4ed537 100644 --- a/drivers/media/platform/coda/coda-bit.c +++ b/drivers/media/platform/coda/coda-bit.c | |||
@@ -340,7 +340,6 @@ static int coda_alloc_framebuffers(struct coda_ctx *ctx, | |||
340 | { | 340 | { |
341 | struct coda_dev *dev = ctx->dev; | 341 | struct coda_dev *dev = ctx->dev; |
342 | int width, height; | 342 | int width, height; |
343 | dma_addr_t paddr; | ||
344 | int ysize; | 343 | int ysize; |
345 | int ret; | 344 | int ret; |
346 | int i; | 345 | int i; |
@@ -360,7 +359,10 @@ static int coda_alloc_framebuffers(struct coda_ctx *ctx, | |||
360 | size_t size; | 359 | size_t size; |
361 | char *name; | 360 | char *name; |
362 | 361 | ||
363 | size = ysize + ysize / 2; | 362 | if (ctx->tiled_map_type == GDI_TILED_FRAME_MB_RASTER_MAP) |
363 | size = round_up(ysize, 4096) + ysize / 2; | ||
364 | else | ||
365 | size = ysize + ysize / 2; | ||
364 | if (ctx->codec->src_fourcc == V4L2_PIX_FMT_H264 && | 366 | if (ctx->codec->src_fourcc == V4L2_PIX_FMT_H264 && |
365 | dev->devtype->product != CODA_DX6) | 367 | dev->devtype->product != CODA_DX6) |
366 | size += ysize / 4; | 368 | size += ysize / 4; |
@@ -376,11 +378,23 @@ static int coda_alloc_framebuffers(struct coda_ctx *ctx, | |||
376 | 378 | ||
377 | /* Register frame buffers in the parameter buffer */ | 379 | /* Register frame buffers in the parameter buffer */ |
378 | for (i = 0; i < ctx->num_internal_frames; i++) { | 380 | for (i = 0; i < ctx->num_internal_frames; i++) { |
379 | paddr = ctx->internal_frames[i].paddr; | 381 | u32 y, cb, cr; |
382 | |||
380 | /* Start addresses of Y, Cb, Cr planes */ | 383 | /* Start addresses of Y, Cb, Cr planes */ |
381 | coda_parabuf_write(ctx, i * 3 + 0, paddr); | 384 | y = ctx->internal_frames[i].paddr; |
382 | coda_parabuf_write(ctx, i * 3 + 1, paddr + ysize); | 385 | cb = y + ysize; |
383 | coda_parabuf_write(ctx, i * 3 + 2, paddr + ysize + ysize / 4); | 386 | cr = y + ysize + ysize/4; |
387 | if (ctx->tiled_map_type == GDI_TILED_FRAME_MB_RASTER_MAP) { | ||
388 | cb = round_up(cb, 4096); | ||
389 | cr = 0; | ||
390 | /* Packed 20-bit MSB of base addresses */ | ||
391 | /* YYYYYCCC, CCyyyyyc, cccc.... */ | ||
392 | y = (y & 0xfffff000) | cb >> 20; | ||
393 | cb = (cb & 0x000ff000) << 12; | ||
394 | } | ||
395 | coda_parabuf_write(ctx, i * 3 + 0, y); | ||
396 | coda_parabuf_write(ctx, i * 3 + 1, cb); | ||
397 | coda_parabuf_write(ctx, i * 3 + 2, cr); | ||
384 | 398 | ||
385 | /* mvcol buffer for h.264 */ | 399 | /* mvcol buffer for h.264 */ |
386 | if (ctx->codec->src_fourcc == V4L2_PIX_FMT_H264 && | 400 | if (ctx->codec->src_fourcc == V4L2_PIX_FMT_H264 && |
@@ -725,9 +739,15 @@ static void coda9_set_frame_cache(struct coda_ctx *ctx, u32 fourcc) | |||
725 | { | 739 | { |
726 | u32 cache_size, cache_config; | 740 | u32 cache_size, cache_config; |
727 | 741 | ||
728 | /* Luma 2x0 page, 2x6 cache, chroma 2x0 page, 2x4 cache size */ | 742 | if (ctx->tiled_map_type == GDI_LINEAR_FRAME_MAP) { |
729 | cache_size = 0x20262024; | 743 | /* Luma 2x0 page, 2x6 cache, chroma 2x0 page, 2x4 cache size */ |
730 | cache_config = 2 << CODA9_CACHE_PAGEMERGE_OFFSET; | 744 | cache_size = 0x20262024; |
745 | cache_config = 2 << CODA9_CACHE_PAGEMERGE_OFFSET; | ||
746 | } else { | ||
747 | /* Luma 0x2 page, 4x4 cache, chroma 0x2 page, 4x3 cache size */ | ||
748 | cache_size = 0x02440243; | ||
749 | cache_config = 1 << CODA9_CACHE_PAGEMERGE_OFFSET; | ||
750 | } | ||
731 | coda_write(ctx->dev, cache_size, CODA9_CMD_SET_FRAME_CACHE_SIZE); | 751 | coda_write(ctx->dev, cache_size, CODA9_CMD_SET_FRAME_CACHE_SIZE); |
732 | if (fourcc == V4L2_PIX_FMT_NV12) { | 752 | if (fourcc == V4L2_PIX_FMT_NV12) { |
733 | cache_config |= 32 << CODA9_CACHE_LUMA_BUFFER_SIZE_OFFSET | | 753 | cache_config |= 32 << CODA9_CACHE_LUMA_BUFFER_SIZE_OFFSET | |
@@ -818,9 +838,12 @@ static int coda_start_encoding(struct coda_ctx *ctx) | |||
818 | break; | 838 | break; |
819 | } | 839 | } |
820 | 840 | ||
821 | ctx->frame_mem_ctrl &= ~CODA_FRAME_CHROMA_INTERLEAVE; | 841 | ctx->frame_mem_ctrl &= ~(CODA_FRAME_CHROMA_INTERLEAVE | (0x3 << 9) | |
842 | CODA9_FRAME_TILED2LINEAR); | ||
822 | if (q_data_src->fourcc == V4L2_PIX_FMT_NV12) | 843 | if (q_data_src->fourcc == V4L2_PIX_FMT_NV12) |
823 | ctx->frame_mem_ctrl |= CODA_FRAME_CHROMA_INTERLEAVE; | 844 | ctx->frame_mem_ctrl |= CODA_FRAME_CHROMA_INTERLEAVE; |
845 | if (ctx->tiled_map_type == GDI_TILED_FRAME_MB_RASTER_MAP) | ||
846 | ctx->frame_mem_ctrl |= (0x3 << 9) | CODA9_FRAME_TILED2LINEAR; | ||
824 | coda_write(dev, ctx->frame_mem_ctrl, CODA_REG_BIT_FRAME_MEM_CTRL); | 847 | coda_write(dev, ctx->frame_mem_ctrl, CODA_REG_BIT_FRAME_MEM_CTRL); |
825 | 848 | ||
826 | if (dev->devtype->product == CODA_DX6) { | 849 | if (dev->devtype->product == CODA_DX6) { |
@@ -1497,9 +1520,12 @@ static int __coda_start_decoding(struct coda_ctx *ctx) | |||
1497 | /* Update coda bitstream read and write pointers from kfifo */ | 1520 | /* Update coda bitstream read and write pointers from kfifo */ |
1498 | coda_kfifo_sync_to_device_full(ctx); | 1521 | coda_kfifo_sync_to_device_full(ctx); |
1499 | 1522 | ||
1500 | ctx->frame_mem_ctrl &= ~CODA_FRAME_CHROMA_INTERLEAVE; | 1523 | ctx->frame_mem_ctrl &= ~(CODA_FRAME_CHROMA_INTERLEAVE | (0x3 << 9) | |
1524 | CODA9_FRAME_TILED2LINEAR); | ||
1501 | if (dst_fourcc == V4L2_PIX_FMT_NV12) | 1525 | if (dst_fourcc == V4L2_PIX_FMT_NV12) |
1502 | ctx->frame_mem_ctrl |= CODA_FRAME_CHROMA_INTERLEAVE; | 1526 | ctx->frame_mem_ctrl |= CODA_FRAME_CHROMA_INTERLEAVE; |
1527 | if (ctx->tiled_map_type == GDI_TILED_FRAME_MB_RASTER_MAP) | ||
1528 | ctx->frame_mem_ctrl |= (0x3 << 9) | CODA9_FRAME_TILED2LINEAR; | ||
1503 | coda_write(dev, ctx->frame_mem_ctrl, CODA_REG_BIT_FRAME_MEM_CTRL); | 1529 | coda_write(dev, ctx->frame_mem_ctrl, CODA_REG_BIT_FRAME_MEM_CTRL); |
1504 | 1530 | ||
1505 | ctx->display_idx = -1; | 1531 | ctx->display_idx = -1; |