mirror of
https://github.com/torvalds/linux.git
synced 2026-07-27 17:47:41 +02:00
media: rockchip: rga: remove size from rga_frame
The size member is only used for the mmu page table mapping. Therefore avoid storing the value and instead only calculate it in place. This also avoids the calculation entirely when an external iommu is used. Reviewed-by: Nicolas Dufresne <nicolas.dufresne@collabora.com> Signed-off-by: Sven Püschel <s.pueschel@pengutronix.de> Signed-off-by: Nicolas Dufresne <nicolas.dufresne@collabora.com> Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
This commit is contained in:
parent
6b7c185537
commit
d11d812dde
|
|
@ -79,6 +79,8 @@ static int rga_buf_init(struct vb2_buffer *vb)
|
|||
struct rockchip_rga *rga = ctx->rga;
|
||||
struct rga_frame *f = rga_get_frame(ctx, vb->vb2_queue->type);
|
||||
size_t n_desc = 0;
|
||||
u32 size = 0;
|
||||
u8 i;
|
||||
|
||||
if (IS_ERR(f))
|
||||
return PTR_ERR(f);
|
||||
|
|
@ -86,7 +88,9 @@ static int rga_buf_init(struct vb2_buffer *vb)
|
|||
if (!rga_has_internal_iommu(rga))
|
||||
return 0;
|
||||
|
||||
n_desc = DIV_ROUND_UP(f->size, PAGE_SIZE);
|
||||
for (i = 0; i < f->pix.num_planes; i++)
|
||||
size += f->pix.plane_fmt[i].sizeimage;
|
||||
n_desc = DIV_ROUND_UP(size, PAGE_SIZE);
|
||||
|
||||
rbuf->n_desc = n_desc;
|
||||
rbuf->dma_desc = dma_alloc_coherent(rga->dev,
|
||||
|
|
|
|||
|
|
@ -268,7 +268,6 @@ static int rga_open(struct file *file)
|
|||
};
|
||||
|
||||
def_frame.stride = (def_width * def_frame.fmt->depth) >> 3;
|
||||
def_frame.size = def_frame.stride * def_height;
|
||||
|
||||
ctx = kzalloc_obj(*ctx);
|
||||
if (!ctx)
|
||||
|
|
@ -481,9 +480,6 @@ static int vidioc_s_fmt(struct file *file, void *priv, struct v4l2_format *f)
|
|||
frm = rga_get_frame(ctx, f->type);
|
||||
if (IS_ERR(frm))
|
||||
return PTR_ERR(frm);
|
||||
frm->size = 0;
|
||||
for (i = 0; i < pix_fmt->num_planes; i++)
|
||||
frm->size += pix_fmt->plane_fmt[i].sizeimage;
|
||||
frm->fmt = rga_fmt_find(rga, pix_fmt->pixelformat);
|
||||
frm->stride = pix_fmt->plane_fmt[0].bytesperline;
|
||||
|
||||
|
|
@ -508,10 +504,10 @@ static int vidioc_s_fmt(struct file *file, void *priv, struct v4l2_format *f)
|
|||
ctx->cmdbuf_dirty = true;
|
||||
|
||||
v4l2_dbg(debug, 1, &rga->v4l2_dev,
|
||||
"[%s] fmt - %p4cc %dx%d (stride %d, sizeimage %d)\n",
|
||||
"[%s] fmt - %p4cc %dx%d (stride %d)\n",
|
||||
V4L2_TYPE_IS_OUTPUT(f->type) ? "OUTPUT" : "CAPTURE",
|
||||
&frm->fmt->fourcc, pix_fmt->width, pix_fmt->height,
|
||||
frm->stride, frm->size);
|
||||
frm->stride);
|
||||
|
||||
for (i = 0; i < pix_fmt->num_planes; i++) {
|
||||
v4l2_dbg(debug, 1, &rga->v4l2_dev,
|
||||
|
|
|
|||
|
|
@ -34,7 +34,6 @@ struct rga_frame {
|
|||
|
||||
/* Variables that can calculated once and reused */
|
||||
u32 stride;
|
||||
u32 size;
|
||||
};
|
||||
|
||||
struct rga_dma_desc {
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user