Commit 4a88f898 authored by Ezequiel Garcia's avatar Ezequiel Garcia Committed by Mauro Carvalho Chehab

media: s5p-jpeg: Correct return type for mem2mem buffer helpers

Fix the assigned type of mem2mem buffer handling API.
Namely, these functions:

 v4l2_m2m_next_buf
 v4l2_m2m_last_buf
 v4l2_m2m_buf_remove
 v4l2_m2m_next_src_buf
 v4l2_m2m_next_dst_buf
 v4l2_m2m_last_src_buf
 v4l2_m2m_last_dst_buf
 v4l2_m2m_src_buf_remove
 v4l2_m2m_dst_buf_remove

return a struct vb2_v4l2_buffer, and not a struct vb2_buffer.

Fixing this is necessary to fix the mem2mem buffer handling API,
changing the return to the correct struct vb2_v4l2_buffer instead
of a void pointer.
Signed-off-by: default avatarEzequiel Garcia <ezequiel@collabora.com>
Signed-off-by: default avatarHans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+samsung@kernel.org>
parent 30fa627b
...@@ -793,14 +793,14 @@ static void skip(struct s5p_jpeg_buffer *buf, long len); ...@@ -793,14 +793,14 @@ static void skip(struct s5p_jpeg_buffer *buf, long len);
static void exynos4_jpeg_parse_decode_h_tbl(struct s5p_jpeg_ctx *ctx) static void exynos4_jpeg_parse_decode_h_tbl(struct s5p_jpeg_ctx *ctx)
{ {
struct s5p_jpeg *jpeg = ctx->jpeg; struct s5p_jpeg *jpeg = ctx->jpeg;
struct vb2_buffer *vb = v4l2_m2m_next_src_buf(ctx->fh.m2m_ctx); struct vb2_v4l2_buffer *vb = v4l2_m2m_next_src_buf(ctx->fh.m2m_ctx);
struct s5p_jpeg_buffer jpeg_buffer; struct s5p_jpeg_buffer jpeg_buffer;
unsigned int word; unsigned int word;
int c, x, components; int c, x, components;
jpeg_buffer.size = 2; /* Ls */ jpeg_buffer.size = 2; /* Ls */
jpeg_buffer.data = jpeg_buffer.data =
(unsigned long)vb2_plane_vaddr(vb, 0) + ctx->out_q.sos + 2; (unsigned long)vb2_plane_vaddr(&vb->vb2_buf, 0) + ctx->out_q.sos + 2;
jpeg_buffer.curr = 0; jpeg_buffer.curr = 0;
word = 0; word = 0;
...@@ -830,14 +830,14 @@ static void exynos4_jpeg_parse_decode_h_tbl(struct s5p_jpeg_ctx *ctx) ...@@ -830,14 +830,14 @@ static void exynos4_jpeg_parse_decode_h_tbl(struct s5p_jpeg_ctx *ctx)
static void exynos4_jpeg_parse_huff_tbl(struct s5p_jpeg_ctx *ctx) static void exynos4_jpeg_parse_huff_tbl(struct s5p_jpeg_ctx *ctx)
{ {
struct s5p_jpeg *jpeg = ctx->jpeg; struct s5p_jpeg *jpeg = ctx->jpeg;
struct vb2_buffer *vb = v4l2_m2m_next_src_buf(ctx->fh.m2m_ctx); struct vb2_v4l2_buffer *vb = v4l2_m2m_next_src_buf(ctx->fh.m2m_ctx);
struct s5p_jpeg_buffer jpeg_buffer; struct s5p_jpeg_buffer jpeg_buffer;
unsigned int word; unsigned int word;
int c, i, n, j; int c, i, n, j;
for (j = 0; j < ctx->out_q.dht.n; ++j) { for (j = 0; j < ctx->out_q.dht.n; ++j) {
jpeg_buffer.size = ctx->out_q.dht.len[j]; jpeg_buffer.size = ctx->out_q.dht.len[j];
jpeg_buffer.data = (unsigned long)vb2_plane_vaddr(vb, 0) + jpeg_buffer.data = (unsigned long)vb2_plane_vaddr(&vb->vb2_buf, 0) +
ctx->out_q.dht.marker[j]; ctx->out_q.dht.marker[j];
jpeg_buffer.curr = 0; jpeg_buffer.curr = 0;
...@@ -889,13 +889,13 @@ static void exynos4_jpeg_parse_huff_tbl(struct s5p_jpeg_ctx *ctx) ...@@ -889,13 +889,13 @@ static void exynos4_jpeg_parse_huff_tbl(struct s5p_jpeg_ctx *ctx)
static void exynos4_jpeg_parse_decode_q_tbl(struct s5p_jpeg_ctx *ctx) static void exynos4_jpeg_parse_decode_q_tbl(struct s5p_jpeg_ctx *ctx)
{ {
struct s5p_jpeg *jpeg = ctx->jpeg; struct s5p_jpeg *jpeg = ctx->jpeg;
struct vb2_buffer *vb = v4l2_m2m_next_src_buf(ctx->fh.m2m_ctx); struct vb2_v4l2_buffer *vb = v4l2_m2m_next_src_buf(ctx->fh.m2m_ctx);
struct s5p_jpeg_buffer jpeg_buffer; struct s5p_jpeg_buffer jpeg_buffer;
int c, x, components; int c, x, components;
jpeg_buffer.size = ctx->out_q.sof_len; jpeg_buffer.size = ctx->out_q.sof_len;
jpeg_buffer.data = jpeg_buffer.data =
(unsigned long)vb2_plane_vaddr(vb, 0) + ctx->out_q.sof; (unsigned long)vb2_plane_vaddr(&vb->vb2_buf, 0) + ctx->out_q.sof;
jpeg_buffer.curr = 0; jpeg_buffer.curr = 0;
skip(&jpeg_buffer, 5); /* P, Y, X */ skip(&jpeg_buffer, 5); /* P, Y, X */
...@@ -920,14 +920,14 @@ static void exynos4_jpeg_parse_decode_q_tbl(struct s5p_jpeg_ctx *ctx) ...@@ -920,14 +920,14 @@ static void exynos4_jpeg_parse_decode_q_tbl(struct s5p_jpeg_ctx *ctx)
static void exynos4_jpeg_parse_q_tbl(struct s5p_jpeg_ctx *ctx) static void exynos4_jpeg_parse_q_tbl(struct s5p_jpeg_ctx *ctx)
{ {
struct s5p_jpeg *jpeg = ctx->jpeg; struct s5p_jpeg *jpeg = ctx->jpeg;
struct vb2_buffer *vb = v4l2_m2m_next_src_buf(ctx->fh.m2m_ctx); struct vb2_v4l2_buffer *vb = v4l2_m2m_next_src_buf(ctx->fh.m2m_ctx);
struct s5p_jpeg_buffer jpeg_buffer; struct s5p_jpeg_buffer jpeg_buffer;
unsigned int word; unsigned int word;
int c, i, j; int c, i, j;
for (j = 0; j < ctx->out_q.dqt.n; ++j) { for (j = 0; j < ctx->out_q.dqt.n; ++j) {
jpeg_buffer.size = ctx->out_q.dqt.len[j]; jpeg_buffer.size = ctx->out_q.dqt.len[j];
jpeg_buffer.data = (unsigned long)vb2_plane_vaddr(vb, 0) + jpeg_buffer.data = (unsigned long)vb2_plane_vaddr(&vb->vb2_buf, 0) +
ctx->out_q.dqt.marker[j]; ctx->out_q.dqt.marker[j];
jpeg_buffer.curr = 0; jpeg_buffer.curr = 0;
...@@ -2075,15 +2075,15 @@ static void s5p_jpeg_device_run(void *priv) ...@@ -2075,15 +2075,15 @@ static void s5p_jpeg_device_run(void *priv)
{ {
struct s5p_jpeg_ctx *ctx = priv; struct s5p_jpeg_ctx *ctx = priv;
struct s5p_jpeg *jpeg = ctx->jpeg; struct s5p_jpeg *jpeg = ctx->jpeg;
struct vb2_buffer *src_buf, *dst_buf; struct vb2_v4l2_buffer *src_buf, *dst_buf;
unsigned long src_addr, dst_addr, flags; unsigned long src_addr, dst_addr, flags;
spin_lock_irqsave(&ctx->jpeg->slock, flags); spin_lock_irqsave(&ctx->jpeg->slock, flags);
src_buf = v4l2_m2m_next_src_buf(ctx->fh.m2m_ctx); src_buf = v4l2_m2m_next_src_buf(ctx->fh.m2m_ctx);
dst_buf = v4l2_m2m_next_dst_buf(ctx->fh.m2m_ctx); dst_buf = v4l2_m2m_next_dst_buf(ctx->fh.m2m_ctx);
src_addr = vb2_dma_contig_plane_dma_addr(src_buf, 0); src_addr = vb2_dma_contig_plane_dma_addr(&src_buf->vb2_buf, 0);
dst_addr = vb2_dma_contig_plane_dma_addr(dst_buf, 0); dst_addr = vb2_dma_contig_plane_dma_addr(&dst_buf->vb2_buf, 0);
s5p_jpeg_reset(jpeg->regs); s5p_jpeg_reset(jpeg->regs);
s5p_jpeg_poweron(jpeg->regs); s5p_jpeg_poweron(jpeg->regs);
...@@ -2156,7 +2156,7 @@ static void exynos4_jpeg_set_img_addr(struct s5p_jpeg_ctx *ctx) ...@@ -2156,7 +2156,7 @@ static void exynos4_jpeg_set_img_addr(struct s5p_jpeg_ctx *ctx)
{ {
struct s5p_jpeg *jpeg = ctx->jpeg; struct s5p_jpeg *jpeg = ctx->jpeg;
struct s5p_jpeg_fmt *fmt; struct s5p_jpeg_fmt *fmt;
struct vb2_buffer *vb; struct vb2_v4l2_buffer *vb;
struct s5p_jpeg_addr jpeg_addr = {}; struct s5p_jpeg_addr jpeg_addr = {};
u32 pix_size, padding_bytes = 0; u32 pix_size, padding_bytes = 0;
...@@ -2175,7 +2175,7 @@ static void exynos4_jpeg_set_img_addr(struct s5p_jpeg_ctx *ctx) ...@@ -2175,7 +2175,7 @@ static void exynos4_jpeg_set_img_addr(struct s5p_jpeg_ctx *ctx)
vb = v4l2_m2m_next_dst_buf(ctx->fh.m2m_ctx); vb = v4l2_m2m_next_dst_buf(ctx->fh.m2m_ctx);
} }
jpeg_addr.y = vb2_dma_contig_plane_dma_addr(vb, 0); jpeg_addr.y = vb2_dma_contig_plane_dma_addr(&vb->vb2_buf, 0);
if (fmt->colplanes == 2) { if (fmt->colplanes == 2) {
jpeg_addr.cb = jpeg_addr.y + pix_size - padding_bytes; jpeg_addr.cb = jpeg_addr.y + pix_size - padding_bytes;
...@@ -2193,7 +2193,7 @@ static void exynos4_jpeg_set_img_addr(struct s5p_jpeg_ctx *ctx) ...@@ -2193,7 +2193,7 @@ static void exynos4_jpeg_set_img_addr(struct s5p_jpeg_ctx *ctx)
static void exynos4_jpeg_set_jpeg_addr(struct s5p_jpeg_ctx *ctx) static void exynos4_jpeg_set_jpeg_addr(struct s5p_jpeg_ctx *ctx)
{ {
struct s5p_jpeg *jpeg = ctx->jpeg; struct s5p_jpeg *jpeg = ctx->jpeg;
struct vb2_buffer *vb; struct vb2_v4l2_buffer *vb;
unsigned int jpeg_addr = 0; unsigned int jpeg_addr = 0;
if (ctx->mode == S5P_JPEG_ENCODE) if (ctx->mode == S5P_JPEG_ENCODE)
...@@ -2201,7 +2201,7 @@ static void exynos4_jpeg_set_jpeg_addr(struct s5p_jpeg_ctx *ctx) ...@@ -2201,7 +2201,7 @@ static void exynos4_jpeg_set_jpeg_addr(struct s5p_jpeg_ctx *ctx)
else else
vb = v4l2_m2m_next_src_buf(ctx->fh.m2m_ctx); vb = v4l2_m2m_next_src_buf(ctx->fh.m2m_ctx);
jpeg_addr = vb2_dma_contig_plane_dma_addr(vb, 0); jpeg_addr = vb2_dma_contig_plane_dma_addr(&vb->vb2_buf, 0);
if (jpeg->variant->version == SJPEG_EXYNOS5433 && if (jpeg->variant->version == SJPEG_EXYNOS5433 &&
ctx->mode == S5P_JPEG_DECODE) ctx->mode == S5P_JPEG_DECODE)
jpeg_addr += ctx->out_q.sos; jpeg_addr += ctx->out_q.sos;
...@@ -2317,7 +2317,7 @@ static void exynos3250_jpeg_set_img_addr(struct s5p_jpeg_ctx *ctx) ...@@ -2317,7 +2317,7 @@ static void exynos3250_jpeg_set_img_addr(struct s5p_jpeg_ctx *ctx)
{ {
struct s5p_jpeg *jpeg = ctx->jpeg; struct s5p_jpeg *jpeg = ctx->jpeg;
struct s5p_jpeg_fmt *fmt; struct s5p_jpeg_fmt *fmt;
struct vb2_buffer *vb; struct vb2_v4l2_buffer *vb;
struct s5p_jpeg_addr jpeg_addr = {}; struct s5p_jpeg_addr jpeg_addr = {};
u32 pix_size; u32 pix_size;
...@@ -2331,7 +2331,7 @@ static void exynos3250_jpeg_set_img_addr(struct s5p_jpeg_ctx *ctx) ...@@ -2331,7 +2331,7 @@ static void exynos3250_jpeg_set_img_addr(struct s5p_jpeg_ctx *ctx)
fmt = ctx->cap_q.fmt; fmt = ctx->cap_q.fmt;
} }
jpeg_addr.y = vb2_dma_contig_plane_dma_addr(vb, 0); jpeg_addr.y = vb2_dma_contig_plane_dma_addr(&vb->vb2_buf, 0);
if (fmt->colplanes == 2) { if (fmt->colplanes == 2) {
jpeg_addr.cb = jpeg_addr.y + pix_size; jpeg_addr.cb = jpeg_addr.y + pix_size;
...@@ -2349,7 +2349,7 @@ static void exynos3250_jpeg_set_img_addr(struct s5p_jpeg_ctx *ctx) ...@@ -2349,7 +2349,7 @@ static void exynos3250_jpeg_set_img_addr(struct s5p_jpeg_ctx *ctx)
static void exynos3250_jpeg_set_jpeg_addr(struct s5p_jpeg_ctx *ctx) static void exynos3250_jpeg_set_jpeg_addr(struct s5p_jpeg_ctx *ctx)
{ {
struct s5p_jpeg *jpeg = ctx->jpeg; struct s5p_jpeg *jpeg = ctx->jpeg;
struct vb2_buffer *vb; struct vb2_v4l2_buffer *vb;
unsigned int jpeg_addr = 0; unsigned int jpeg_addr = 0;
if (ctx->mode == S5P_JPEG_ENCODE) if (ctx->mode == S5P_JPEG_ENCODE)
...@@ -2357,7 +2357,7 @@ static void exynos3250_jpeg_set_jpeg_addr(struct s5p_jpeg_ctx *ctx) ...@@ -2357,7 +2357,7 @@ static void exynos3250_jpeg_set_jpeg_addr(struct s5p_jpeg_ctx *ctx)
else else
vb = v4l2_m2m_next_src_buf(ctx->fh.m2m_ctx); vb = v4l2_m2m_next_src_buf(ctx->fh.m2m_ctx);
jpeg_addr = vb2_dma_contig_plane_dma_addr(vb, 0); jpeg_addr = vb2_dma_contig_plane_dma_addr(&vb->vb2_buf, 0);
exynos3250_jpeg_jpgadr(jpeg->regs, jpeg_addr); exynos3250_jpeg_jpgadr(jpeg->regs, jpeg_addr);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment