diff options
author | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2012-03-21 07:03:21 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2012-05-15 15:08:22 -0400 |
commit | 2b61d46e2c44568886bc099f8085aefc7107e372 (patch) | |
tree | e948595df69c6e9ad5c22a3bc00e93fb0a8ef93d /drivers/media | |
parent | 584943aa0692fea9ec3356c7d4677dd7a225cdef (diff) |
[media] soc_camera: Use soc_camera_device::sizeimage to compute buffer sizes
Instead of computing the buffer size manually in the videobuf queue
setup and buffer prepare callbacks, use the previously negotiated
soc_camera_device::sizeimage value.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media')
-rw-r--r-- | drivers/media/video/atmel-isi.c | 17 | ||||
-rw-r--r-- | drivers/media/video/mx1_camera.c | 14 | ||||
-rw-r--r-- | drivers/media/video/mx2_camera.c | 14 | ||||
-rw-r--r-- | drivers/media/video/mx3_camera.c | 20 | ||||
-rw-r--r-- | drivers/media/video/omap1_camera.c | 14 | ||||
-rw-r--r-- | drivers/media/video/pxa_camera.c | 14 | ||||
-rw-r--r-- | drivers/media/video/sh_mobile_ceu_camera.c | 25 |
7 files changed, 29 insertions, 89 deletions
diff --git a/drivers/media/video/atmel-isi.c b/drivers/media/video/atmel-isi.c index ec3f6a06f9c3..d58491b897ca 100644 --- a/drivers/media/video/atmel-isi.c +++ b/drivers/media/video/atmel-isi.c | |||
@@ -260,7 +260,7 @@ static int queue_setup(struct vb2_queue *vq, const struct v4l2_format *fmt, | |||
260 | struct soc_camera_host *ici = to_soc_camera_host(icd->parent); | 260 | struct soc_camera_host *ici = to_soc_camera_host(icd->parent); |
261 | struct atmel_isi *isi = ici->priv; | 261 | struct atmel_isi *isi = ici->priv; |
262 | unsigned long size; | 262 | unsigned long size; |
263 | int ret, bytes_per_line; | 263 | int ret; |
264 | 264 | ||
265 | /* Reset ISI */ | 265 | /* Reset ISI */ |
266 | ret = atmel_isi_wait_status(isi, WAIT_ISI_RESET); | 266 | ret = atmel_isi_wait_status(isi, WAIT_ISI_RESET); |
@@ -271,13 +271,7 @@ static int queue_setup(struct vb2_queue *vq, const struct v4l2_format *fmt, | |||
271 | /* Disable all interrupts */ | 271 | /* Disable all interrupts */ |
272 | isi_writel(isi, ISI_INTDIS, ~0UL); | 272 | isi_writel(isi, ISI_INTDIS, ~0UL); |
273 | 273 | ||
274 | bytes_per_line = soc_mbus_bytes_per_line(icd->user_width, | 274 | size = icd->sizeimage; |
275 | icd->current_fmt->host_fmt); | ||
276 | |||
277 | if (bytes_per_line < 0) | ||
278 | return bytes_per_line; | ||
279 | |||
280 | size = bytes_per_line * icd->user_height; | ||
281 | 275 | ||
282 | if (!*nbuffers || *nbuffers > MAX_BUFFER_NUM) | 276 | if (!*nbuffers || *nbuffers > MAX_BUFFER_NUM) |
283 | *nbuffers = MAX_BUFFER_NUM; | 277 | *nbuffers = MAX_BUFFER_NUM; |
@@ -316,13 +310,8 @@ static int buffer_prepare(struct vb2_buffer *vb) | |||
316 | struct atmel_isi *isi = ici->priv; | 310 | struct atmel_isi *isi = ici->priv; |
317 | unsigned long size; | 311 | unsigned long size; |
318 | struct isi_dma_desc *desc; | 312 | struct isi_dma_desc *desc; |
319 | int bytes_per_line = soc_mbus_bytes_per_line(icd->user_width, | ||
320 | icd->current_fmt->host_fmt); | ||
321 | |||
322 | if (bytes_per_line < 0) | ||
323 | return bytes_per_line; | ||
324 | 313 | ||
325 | size = bytes_per_line * icd->user_height; | 314 | size = icd->sizeimage; |
326 | 315 | ||
327 | if (vb2_plane_size(vb, 0) < size) { | 316 | if (vb2_plane_size(vb, 0) < size) { |
328 | dev_err(icd->parent, "%s data will not fit into plane (%lu < %lu)\n", | 317 | dev_err(icd->parent, "%s data will not fit into plane (%lu < %lu)\n", |
diff --git a/drivers/media/video/mx1_camera.c b/drivers/media/video/mx1_camera.c index 055d11ddb038..4296a8350298 100644 --- a/drivers/media/video/mx1_camera.c +++ b/drivers/media/video/mx1_camera.c | |||
@@ -126,13 +126,8 @@ static int mx1_videobuf_setup(struct videobuf_queue *vq, unsigned int *count, | |||
126 | unsigned int *size) | 126 | unsigned int *size) |
127 | { | 127 | { |
128 | struct soc_camera_device *icd = vq->priv_data; | 128 | struct soc_camera_device *icd = vq->priv_data; |
129 | int bytes_per_line = soc_mbus_bytes_per_line(icd->user_width, | ||
130 | icd->current_fmt->host_fmt); | ||
131 | 129 | ||
132 | if (bytes_per_line < 0) | 130 | *size = icd->sizeimage; |
133 | return bytes_per_line; | ||
134 | |||
135 | *size = bytes_per_line * icd->user_height; | ||
136 | 131 | ||
137 | if (!*count) | 132 | if (!*count) |
138 | *count = 32; | 133 | *count = 32; |
@@ -171,11 +166,6 @@ static int mx1_videobuf_prepare(struct videobuf_queue *vq, | |||
171 | struct soc_camera_device *icd = vq->priv_data; | 166 | struct soc_camera_device *icd = vq->priv_data; |
172 | struct mx1_buffer *buf = container_of(vb, struct mx1_buffer, vb); | 167 | struct mx1_buffer *buf = container_of(vb, struct mx1_buffer, vb); |
173 | int ret; | 168 | int ret; |
174 | int bytes_per_line = soc_mbus_bytes_per_line(icd->user_width, | ||
175 | icd->current_fmt->host_fmt); | ||
176 | |||
177 | if (bytes_per_line < 0) | ||
178 | return bytes_per_line; | ||
179 | 169 | ||
180 | dev_dbg(icd->parent, "%s (vb=0x%p) 0x%08lx %d\n", __func__, | 170 | dev_dbg(icd->parent, "%s (vb=0x%p) 0x%08lx %d\n", __func__, |
181 | vb, vb->baddr, vb->bsize); | 171 | vb, vb->baddr, vb->bsize); |
@@ -202,7 +192,7 @@ static int mx1_videobuf_prepare(struct videobuf_queue *vq, | |||
202 | vb->state = VIDEOBUF_NEEDS_INIT; | 192 | vb->state = VIDEOBUF_NEEDS_INIT; |
203 | } | 193 | } |
204 | 194 | ||
205 | vb->size = bytes_per_line * vb->height; | 195 | vb->size = icd->sizeimage; |
206 | if (0 != vb->baddr && vb->bsize < vb->size) { | 196 | if (0 != vb->baddr && vb->bsize < vb->size) { |
207 | ret = -EINVAL; | 197 | ret = -EINVAL; |
208 | goto out; | 198 | goto out; |
diff --git a/drivers/media/video/mx2_camera.c b/drivers/media/video/mx2_camera.c index 36d17f3483eb..368049dbe105 100644 --- a/drivers/media/video/mx2_camera.c +++ b/drivers/media/video/mx2_camera.c | |||
@@ -538,8 +538,6 @@ static int mx2_videobuf_setup(struct vb2_queue *vq, | |||
538 | struct soc_camera_device *icd = soc_camera_from_vb2q(vq); | 538 | struct soc_camera_device *icd = soc_camera_from_vb2q(vq); |
539 | struct soc_camera_host *ici = to_soc_camera_host(icd->parent); | 539 | struct soc_camera_host *ici = to_soc_camera_host(icd->parent); |
540 | struct mx2_camera_dev *pcdev = ici->priv; | 540 | struct mx2_camera_dev *pcdev = ici->priv; |
541 | int bytes_per_line = soc_mbus_bytes_per_line(icd->user_width, | ||
542 | icd->current_fmt->host_fmt); | ||
543 | 541 | ||
544 | dev_dbg(icd->parent, "count=%d, size=%d\n", *count, sizes[0]); | 542 | dev_dbg(icd->parent, "count=%d, size=%d\n", *count, sizes[0]); |
545 | 543 | ||
@@ -547,12 +545,9 @@ static int mx2_videobuf_setup(struct vb2_queue *vq, | |||
547 | if (fmt != NULL) | 545 | if (fmt != NULL) |
548 | return -ENOTTY; | 546 | return -ENOTTY; |
549 | 547 | ||
550 | if (bytes_per_line < 0) | ||
551 | return bytes_per_line; | ||
552 | |||
553 | alloc_ctxs[0] = pcdev->alloc_ctx; | 548 | alloc_ctxs[0] = pcdev->alloc_ctx; |
554 | 549 | ||
555 | sizes[0] = bytes_per_line * icd->user_height; | 550 | sizes[0] = icd->sizeimage; |
556 | 551 | ||
557 | if (0 == *count) | 552 | if (0 == *count) |
558 | *count = 32; | 553 | *count = 32; |
@@ -568,16 +563,11 @@ static int mx2_videobuf_setup(struct vb2_queue *vq, | |||
568 | static int mx2_videobuf_prepare(struct vb2_buffer *vb) | 563 | static int mx2_videobuf_prepare(struct vb2_buffer *vb) |
569 | { | 564 | { |
570 | struct soc_camera_device *icd = soc_camera_from_vb2q(vb->vb2_queue); | 565 | struct soc_camera_device *icd = soc_camera_from_vb2q(vb->vb2_queue); |
571 | int bytes_per_line = soc_mbus_bytes_per_line(icd->user_width, | ||
572 | icd->current_fmt->host_fmt); | ||
573 | int ret = 0; | 566 | int ret = 0; |
574 | 567 | ||
575 | dev_dbg(icd->parent, "%s (vb=0x%p) 0x%p %lu\n", __func__, | 568 | dev_dbg(icd->parent, "%s (vb=0x%p) 0x%p %lu\n", __func__, |
576 | vb, vb2_plane_vaddr(vb, 0), vb2_get_plane_payload(vb, 0)); | 569 | vb, vb2_plane_vaddr(vb, 0), vb2_get_plane_payload(vb, 0)); |
577 | 570 | ||
578 | if (bytes_per_line < 0) | ||
579 | return bytes_per_line; | ||
580 | |||
581 | #ifdef DEBUG | 571 | #ifdef DEBUG |
582 | /* | 572 | /* |
583 | * This can be useful if you want to see if we actually fill | 573 | * This can be useful if you want to see if we actually fill |
@@ -587,7 +577,7 @@ static int mx2_videobuf_prepare(struct vb2_buffer *vb) | |||
587 | 0xaa, vb2_get_plane_payload(vb, 0)); | 577 | 0xaa, vb2_get_plane_payload(vb, 0)); |
588 | #endif | 578 | #endif |
589 | 579 | ||
590 | vb2_set_plane_payload(vb, 0, bytes_per_line * icd->user_height); | 580 | vb2_set_plane_payload(vb, 0, icd->sizeimage); |
591 | if (vb2_plane_vaddr(vb, 0) && | 581 | if (vb2_plane_vaddr(vb, 0) && |
592 | vb2_get_plane_payload(vb, 0) > vb2_plane_size(vb, 0)) { | 582 | vb2_get_plane_payload(vb, 0) > vb2_plane_size(vb, 0)) { |
593 | ret = -EINVAL; | 583 | ret = -EINVAL; |
diff --git a/drivers/media/video/mx3_camera.c b/drivers/media/video/mx3_camera.c index 93c35ef5f0ad..b3016adb0f4f 100644 --- a/drivers/media/video/mx3_camera.c +++ b/drivers/media/video/mx3_camera.c | |||
@@ -199,8 +199,6 @@ static int mx3_videobuf_setup(struct vb2_queue *vq, | |||
199 | struct soc_camera_device *icd = soc_camera_from_vb2q(vq); | 199 | struct soc_camera_device *icd = soc_camera_from_vb2q(vq); |
200 | struct soc_camera_host *ici = to_soc_camera_host(icd->parent); | 200 | struct soc_camera_host *ici = to_soc_camera_host(icd->parent); |
201 | struct mx3_camera_dev *mx3_cam = ici->priv; | 201 | struct mx3_camera_dev *mx3_cam = ici->priv; |
202 | int bytes_per_line; | ||
203 | unsigned int height; | ||
204 | 202 | ||
205 | if (!mx3_cam->idmac_channel[0]) | 203 | if (!mx3_cam->idmac_channel[0]) |
206 | return -EINVAL; | 204 | return -EINVAL; |
@@ -208,21 +206,21 @@ static int mx3_videobuf_setup(struct vb2_queue *vq, | |||
208 | if (fmt) { | 206 | if (fmt) { |
209 | const struct soc_camera_format_xlate *xlate = soc_camera_xlate_by_fourcc(icd, | 207 | const struct soc_camera_format_xlate *xlate = soc_camera_xlate_by_fourcc(icd, |
210 | fmt->fmt.pix.pixelformat); | 208 | fmt->fmt.pix.pixelformat); |
209 | int bytes_per_line; | ||
210 | |||
211 | if (!xlate) | 211 | if (!xlate) |
212 | return -EINVAL; | 212 | return -EINVAL; |
213 | |||
213 | bytes_per_line = soc_mbus_bytes_per_line(fmt->fmt.pix.width, | 214 | bytes_per_line = soc_mbus_bytes_per_line(fmt->fmt.pix.width, |
214 | xlate->host_fmt); | 215 | xlate->host_fmt); |
215 | height = fmt->fmt.pix.height; | 216 | if (bytes_per_line < 0) |
217 | return bytes_per_line; | ||
218 | |||
219 | sizes[0] = bytes_per_line * fmt->fmt.pix.height; | ||
216 | } else { | 220 | } else { |
217 | /* Called from VIDIOC_REQBUFS or in compatibility mode */ | 221 | /* Called from VIDIOC_REQBUFS or in compatibility mode */ |
218 | bytes_per_line = soc_mbus_bytes_per_line(icd->user_width, | 222 | sizes[0] = icd->sizeimage; |
219 | icd->current_fmt->host_fmt); | ||
220 | height = icd->user_height; | ||
221 | } | 223 | } |
222 | if (bytes_per_line < 0) | ||
223 | return bytes_per_line; | ||
224 | |||
225 | sizes[0] = bytes_per_line * height; | ||
226 | 224 | ||
227 | alloc_ctxs[0] = mx3_cam->alloc_ctx; | 225 | alloc_ctxs[0] = mx3_cam->alloc_ctx; |
228 | 226 | ||
@@ -274,7 +272,7 @@ static void mx3_videobuf_queue(struct vb2_buffer *vb) | |||
274 | 272 | ||
275 | BUG_ON(bytes_per_line <= 0); | 273 | BUG_ON(bytes_per_line <= 0); |
276 | 274 | ||
277 | new_size = bytes_per_line * icd->user_height; | 275 | new_size = icd->sizeimage; |
278 | 276 | ||
279 | if (vb2_plane_size(vb, 0) < new_size) { | 277 | if (vb2_plane_size(vb, 0) < new_size) { |
280 | dev_err(icd->parent, "Buffer #%d too small (%lu < %zu)\n", | 278 | dev_err(icd->parent, "Buffer #%d too small (%lu < %zu)\n", |
diff --git a/drivers/media/video/omap1_camera.c b/drivers/media/video/omap1_camera.c index c20f5ecd6790..addab76048c3 100644 --- a/drivers/media/video/omap1_camera.c +++ b/drivers/media/video/omap1_camera.c | |||
@@ -206,15 +206,10 @@ static int omap1_videobuf_setup(struct videobuf_queue *vq, unsigned int *count, | |||
206 | unsigned int *size) | 206 | unsigned int *size) |
207 | { | 207 | { |
208 | struct soc_camera_device *icd = vq->priv_data; | 208 | struct soc_camera_device *icd = vq->priv_data; |
209 | int bytes_per_line = soc_mbus_bytes_per_line(icd->user_width, | ||
210 | icd->current_fmt->host_fmt); | ||
211 | struct soc_camera_host *ici = to_soc_camera_host(icd->parent); | 209 | struct soc_camera_host *ici = to_soc_camera_host(icd->parent); |
212 | struct omap1_cam_dev *pcdev = ici->priv; | 210 | struct omap1_cam_dev *pcdev = ici->priv; |
213 | 211 | ||
214 | if (bytes_per_line < 0) | 212 | *size = icd->sizeimage; |
215 | return bytes_per_line; | ||
216 | |||
217 | *size = bytes_per_line * icd->user_height; | ||
218 | 213 | ||
219 | if (!*count || *count < OMAP1_CAMERA_MIN_BUF_COUNT(pcdev->vb_mode)) | 214 | if (!*count || *count < OMAP1_CAMERA_MIN_BUF_COUNT(pcdev->vb_mode)) |
220 | *count = OMAP1_CAMERA_MIN_BUF_COUNT(pcdev->vb_mode); | 215 | *count = OMAP1_CAMERA_MIN_BUF_COUNT(pcdev->vb_mode); |
@@ -256,15 +251,10 @@ static int omap1_videobuf_prepare(struct videobuf_queue *vq, | |||
256 | { | 251 | { |
257 | struct soc_camera_device *icd = vq->priv_data; | 252 | struct soc_camera_device *icd = vq->priv_data; |
258 | struct omap1_cam_buf *buf = container_of(vb, struct omap1_cam_buf, vb); | 253 | struct omap1_cam_buf *buf = container_of(vb, struct omap1_cam_buf, vb); |
259 | int bytes_per_line = soc_mbus_bytes_per_line(icd->user_width, | ||
260 | icd->current_fmt->host_fmt); | ||
261 | struct soc_camera_host *ici = to_soc_camera_host(icd->parent); | 254 | struct soc_camera_host *ici = to_soc_camera_host(icd->parent); |
262 | struct omap1_cam_dev *pcdev = ici->priv; | 255 | struct omap1_cam_dev *pcdev = ici->priv; |
263 | int ret; | 256 | int ret; |
264 | 257 | ||
265 | if (bytes_per_line < 0) | ||
266 | return bytes_per_line; | ||
267 | |||
268 | WARN_ON(!list_empty(&vb->queue)); | 258 | WARN_ON(!list_empty(&vb->queue)); |
269 | 259 | ||
270 | BUG_ON(NULL == icd->current_fmt); | 260 | BUG_ON(NULL == icd->current_fmt); |
@@ -281,7 +271,7 @@ static int omap1_videobuf_prepare(struct videobuf_queue *vq, | |||
281 | vb->state = VIDEOBUF_NEEDS_INIT; | 271 | vb->state = VIDEOBUF_NEEDS_INIT; |
282 | } | 272 | } |
283 | 273 | ||
284 | vb->size = bytes_per_line * vb->height; | 274 | vb->size = icd->sizeimage; |
285 | 275 | ||
286 | if (vb->baddr && vb->bsize < vb->size) { | 276 | if (vb->baddr && vb->bsize < vb->size) { |
287 | ret = -EINVAL; | 277 | ret = -EINVAL; |
diff --git a/drivers/media/video/pxa_camera.c b/drivers/media/video/pxa_camera.c index 5a413f4427e0..6130abe31c43 100644 --- a/drivers/media/video/pxa_camera.c +++ b/drivers/media/video/pxa_camera.c | |||
@@ -241,15 +241,10 @@ static int pxa_videobuf_setup(struct videobuf_queue *vq, unsigned int *count, | |||
241 | unsigned int *size) | 241 | unsigned int *size) |
242 | { | 242 | { |
243 | struct soc_camera_device *icd = vq->priv_data; | 243 | struct soc_camera_device *icd = vq->priv_data; |
244 | int bytes_per_line = soc_mbus_bytes_per_line(icd->user_width, | ||
245 | icd->current_fmt->host_fmt); | ||
246 | |||
247 | if (bytes_per_line < 0) | ||
248 | return bytes_per_line; | ||
249 | 244 | ||
250 | dev_dbg(icd->parent, "count=%d, size=%d\n", *count, *size); | 245 | dev_dbg(icd->parent, "count=%d, size=%d\n", *count, *size); |
251 | 246 | ||
252 | *size = bytes_per_line * icd->user_height; | 247 | *size = icd->sizeimage; |
253 | 248 | ||
254 | if (0 == *count) | 249 | if (0 == *count) |
255 | *count = 32; | 250 | *count = 32; |
@@ -435,11 +430,6 @@ static int pxa_videobuf_prepare(struct videobuf_queue *vq, | |||
435 | struct pxa_buffer *buf = container_of(vb, struct pxa_buffer, vb); | 430 | struct pxa_buffer *buf = container_of(vb, struct pxa_buffer, vb); |
436 | int ret; | 431 | int ret; |
437 | int size_y, size_u = 0, size_v = 0; | 432 | int size_y, size_u = 0, size_v = 0; |
438 | int bytes_per_line = soc_mbus_bytes_per_line(icd->user_width, | ||
439 | icd->current_fmt->host_fmt); | ||
440 | |||
441 | if (bytes_per_line < 0) | ||
442 | return bytes_per_line; | ||
443 | 433 | ||
444 | dev_dbg(dev, "%s (vb=0x%p) 0x%08lx %d\n", __func__, | 434 | dev_dbg(dev, "%s (vb=0x%p) 0x%08lx %d\n", __func__, |
445 | vb, vb->baddr, vb->bsize); | 435 | vb, vb->baddr, vb->bsize); |
@@ -474,7 +464,7 @@ static int pxa_videobuf_prepare(struct videobuf_queue *vq, | |||
474 | vb->state = VIDEOBUF_NEEDS_INIT; | 464 | vb->state = VIDEOBUF_NEEDS_INIT; |
475 | } | 465 | } |
476 | 466 | ||
477 | vb->size = bytes_per_line * vb->height; | 467 | vb->size = icd->sizeimage; |
478 | if (0 != vb->baddr && vb->bsize < vb->size) { | 468 | if (0 != vb->baddr && vb->bsize < vb->size) { |
479 | ret = -EINVAL; | 469 | ret = -EINVAL; |
480 | goto out; | 470 | goto out; |
diff --git a/drivers/media/video/sh_mobile_ceu_camera.c b/drivers/media/video/sh_mobile_ceu_camera.c index 424dfacd263a..8c6dc242ede2 100644 --- a/drivers/media/video/sh_mobile_ceu_camera.c +++ b/drivers/media/video/sh_mobile_ceu_camera.c | |||
@@ -210,27 +210,25 @@ static int sh_mobile_ceu_videobuf_setup(struct vb2_queue *vq, | |||
210 | struct soc_camera_device *icd = container_of(vq, struct soc_camera_device, vb2_vidq); | 210 | struct soc_camera_device *icd = container_of(vq, struct soc_camera_device, vb2_vidq); |
211 | struct soc_camera_host *ici = to_soc_camera_host(icd->parent); | 211 | struct soc_camera_host *ici = to_soc_camera_host(icd->parent); |
212 | struct sh_mobile_ceu_dev *pcdev = ici->priv; | 212 | struct sh_mobile_ceu_dev *pcdev = ici->priv; |
213 | int bytes_per_line; | ||
214 | unsigned int height; | ||
215 | 213 | ||
216 | if (fmt) { | 214 | if (fmt) { |
217 | const struct soc_camera_format_xlate *xlate = soc_camera_xlate_by_fourcc(icd, | 215 | const struct soc_camera_format_xlate *xlate = soc_camera_xlate_by_fourcc(icd, |
218 | fmt->fmt.pix.pixelformat); | 216 | fmt->fmt.pix.pixelformat); |
217 | int bytes_per_line; | ||
218 | |||
219 | if (!xlate) | 219 | if (!xlate) |
220 | return -EINVAL; | 220 | return -EINVAL; |
221 | |||
221 | bytes_per_line = soc_mbus_bytes_per_line(fmt->fmt.pix.width, | 222 | bytes_per_line = soc_mbus_bytes_per_line(fmt->fmt.pix.width, |
222 | xlate->host_fmt); | 223 | xlate->host_fmt); |
223 | height = fmt->fmt.pix.height; | 224 | if (bytes_per_line < 0) |
225 | return bytes_per_line; | ||
226 | |||
227 | sizes[0] = bytes_per_line * fmt->fmt.pix.height; | ||
224 | } else { | 228 | } else { |
225 | /* Called from VIDIOC_REQBUFS or in compatibility mode */ | 229 | /* Called from VIDIOC_REQBUFS or in compatibility mode */ |
226 | bytes_per_line = soc_mbus_bytes_per_line(icd->user_width, | 230 | sizes[0] = icd->sizeimage; |
227 | icd->current_fmt->host_fmt); | ||
228 | height = icd->user_height; | ||
229 | } | 231 | } |
230 | if (bytes_per_line < 0) | ||
231 | return bytes_per_line; | ||
232 | |||
233 | sizes[0] = bytes_per_line * height; | ||
234 | 232 | ||
235 | alloc_ctxs[0] = pcdev->alloc_ctx; | 233 | alloc_ctxs[0] = pcdev->alloc_ctx; |
236 | 234 | ||
@@ -377,13 +375,8 @@ static void sh_mobile_ceu_videobuf_queue(struct vb2_buffer *vb) | |||
377 | struct sh_mobile_ceu_dev *pcdev = ici->priv; | 375 | struct sh_mobile_ceu_dev *pcdev = ici->priv; |
378 | struct sh_mobile_ceu_buffer *buf = to_ceu_vb(vb); | 376 | struct sh_mobile_ceu_buffer *buf = to_ceu_vb(vb); |
379 | unsigned long size; | 377 | unsigned long size; |
380 | int bytes_per_line = soc_mbus_bytes_per_line(icd->user_width, | ||
381 | icd->current_fmt->host_fmt); | ||
382 | |||
383 | if (bytes_per_line < 0) | ||
384 | goto error; | ||
385 | 378 | ||
386 | size = icd->user_height * bytes_per_line; | 379 | size = icd->sizeimage; |
387 | 380 | ||
388 | if (vb2_plane_size(vb, 0) < size) { | 381 | if (vb2_plane_size(vb, 0) < size) { |
389 | dev_err(icd->parent, "Buffer #%d too small (%lu < %lu)\n", | 382 | dev_err(icd->parent, "Buffer #%d too small (%lu < %lu)\n", |