aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/pci
diff options
context:
space:
mode:
authorHans Verkuil <hans.verkuil@cisco.com>2014-08-29 02:46:05 -0400
committerMauro Carvalho Chehab <mchehab@osg.samsung.com>2014-11-03 05:20:45 -0500
commit637bc2079678e08476d884f02a5d5d3208b5c018 (patch)
treed3d6bc06adbecee50f7165f609a8f18ea146524e /drivers/media/pci
parent082417d10fafe7be835d143ade7114b5ce26cb50 (diff)
[media] cx88: remove fmt from the buffer struct
This is a duplicate of dev->fmt and can be removed. As a consequence a lot of tests that check if the format has changed midstream can be removed as well: the format cannot change midstream, so this is a bogus check. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Diffstat (limited to 'drivers/media/pci')
-rw-r--r--drivers/media/pci/cx88/cx88-mpeg.c6
-rw-r--r--drivers/media/pci/cx88/cx88-video.c116
-rw-r--r--drivers/media/pci/cx88/cx88.h1
3 files changed, 46 insertions, 77 deletions
diff --git a/drivers/media/pci/cx88/cx88-mpeg.c b/drivers/media/pci/cx88/cx88-mpeg.c
index 74b7b8614c23..2803b6f17646 100644
--- a/drivers/media/pci/cx88/cx88-mpeg.c
+++ b/drivers/media/pci/cx88/cx88-mpeg.c
@@ -229,17 +229,13 @@ static int cx8802_restart_queue(struct cx8802_dev *dev,
229 dprintk(1,"[%p/%d] restart_queue - first active\n", 229 dprintk(1,"[%p/%d] restart_queue - first active\n",
230 buf,buf->vb.i); 230 buf,buf->vb.i);
231 231
232 } else if (prev->vb.width == buf->vb.width && 232 } else {
233 prev->vb.height == buf->vb.height &&
234 prev->fmt == buf->fmt) {
235 list_move_tail(&buf->vb.queue, &q->active); 233 list_move_tail(&buf->vb.queue, &q->active);
236 buf->vb.state = VIDEOBUF_ACTIVE; 234 buf->vb.state = VIDEOBUF_ACTIVE;
237 buf->count = q->count++; 235 buf->count = q->count++;
238 prev->risc.jmp[1] = cpu_to_le32(buf->risc.dma); 236 prev->risc.jmp[1] = cpu_to_le32(buf->risc.dma);
239 dprintk(1,"[%p/%d] restart_queue - move to active\n", 237 dprintk(1,"[%p/%d] restart_queue - move to active\n",
240 buf,buf->vb.i); 238 buf,buf->vb.i);
241 } else {
242 return 0;
243 } 239 }
244 prev = buf; 240 prev = buf;
245 } 241 }
diff --git a/drivers/media/pci/cx88/cx88-video.c b/drivers/media/pci/cx88/cx88-video.c
index ce27e6d4f16e..095542316917 100644
--- a/drivers/media/pci/cx88/cx88-video.c
+++ b/drivers/media/pci/cx88/cx88-video.c
@@ -420,7 +420,7 @@ static int start_video_dma(struct cx8800_dev *dev,
420 cx88_sram_channel_setup(core, &cx88_sram_channels[SRAM_CH21], 420 cx88_sram_channel_setup(core, &cx88_sram_channels[SRAM_CH21],
421 buf->bpl, buf->risc.dma); 421 buf->bpl, buf->risc.dma);
422 cx88_set_scale(core, buf->vb.width, buf->vb.height, buf->vb.field); 422 cx88_set_scale(core, buf->vb.width, buf->vb.height, buf->vb.field);
423 cx_write(MO_COLOR_CTRL, buf->fmt->cxformat | ColorFormatGamma); 423 cx_write(MO_COLOR_CTRL, dev->fmt->cxformat | ColorFormatGamma);
424 424
425 /* reset counter */ 425 /* reset counter */
426 cx_write(MO_VIDY_GPCNTRL,GP_COUNT_CONTROL_RESET); 426 cx_write(MO_VIDY_GPCNTRL,GP_COUNT_CONTROL_RESET);
@@ -497,17 +497,13 @@ static int restart_video_queue(struct cx8800_dev *dev,
497 dprintk(2,"[%p/%d] restart_queue - first active\n", 497 dprintk(2,"[%p/%d] restart_queue - first active\n",
498 buf,buf->vb.i); 498 buf,buf->vb.i);
499 499
500 } else if (prev->vb.width == buf->vb.width && 500 } else {
501 prev->vb.height == buf->vb.height &&
502 prev->fmt == buf->fmt) {
503 list_move_tail(&buf->vb.queue, &q->active); 501 list_move_tail(&buf->vb.queue, &q->active);
504 buf->vb.state = VIDEOBUF_ACTIVE; 502 buf->vb.state = VIDEOBUF_ACTIVE;
505 buf->count = q->count++; 503 buf->count = q->count++;
506 prev->risc.jmp[1] = cpu_to_le32(buf->risc.dma); 504 prev->risc.jmp[1] = cpu_to_le32(buf->risc.dma);
507 dprintk(2,"[%p/%d] restart_queue - move to active\n", 505 dprintk(2,"[%p/%d] restart_queue - move to active\n",
508 buf,buf->vb.i); 506 buf,buf->vb.i);
509 } else {
510 return 0;
511 } 507 }
512 prev = buf; 508 prev = buf;
513 } 509 }
@@ -538,7 +534,7 @@ buffer_prepare(struct videobuf_queue *q, struct videobuf_buffer *vb,
538 struct cx88_core *core = dev->core; 534 struct cx88_core *core = dev->core;
539 struct cx88_buffer *buf = container_of(vb,struct cx88_buffer,vb); 535 struct cx88_buffer *buf = container_of(vb,struct cx88_buffer,vb);
540 struct videobuf_dmabuf *dma=videobuf_to_dma(&buf->vb); 536 struct videobuf_dmabuf *dma=videobuf_to_dma(&buf->vb);
541 int rc, init_buffer = 0; 537 int rc;
542 538
543 BUG_ON(NULL == dev->fmt); 539 BUG_ON(NULL == dev->fmt);
544 if (dev->width < 48 || dev->width > norm_maxw(core->tvnorm) || 540 if (dev->width < 48 || dev->width > norm_maxw(core->tvnorm) ||
@@ -548,59 +544,47 @@ buffer_prepare(struct videobuf_queue *q, struct videobuf_buffer *vb,
548 if (0 != buf->vb.baddr && buf->vb.bsize < buf->vb.size) 544 if (0 != buf->vb.baddr && buf->vb.bsize < buf->vb.size)
549 return -EINVAL; 545 return -EINVAL;
550 546
551 if (buf->fmt != dev->fmt || 547 buf->vb.width = dev->width;
552 buf->vb.width != dev->width || 548 buf->vb.height = dev->height;
553 buf->vb.height != dev->height || 549 buf->vb.field = field;
554 buf->vb.field != field) {
555 buf->fmt = dev->fmt;
556 buf->vb.width = dev->width;
557 buf->vb.height = dev->height;
558 buf->vb.field = field;
559 init_buffer = 1;
560 }
561
562 if (VIDEOBUF_NEEDS_INIT == buf->vb.state) { 550 if (VIDEOBUF_NEEDS_INIT == buf->vb.state) {
563 init_buffer = 1;
564 if (0 != (rc = videobuf_iolock(q,&buf->vb,NULL))) 551 if (0 != (rc = videobuf_iolock(q,&buf->vb,NULL)))
565 goto fail; 552 goto fail;
566 } 553 }
567 554
568 if (init_buffer) { 555 buf->bpl = buf->vb.width * dev->fmt->depth >> 3;
569 buf->bpl = buf->vb.width * buf->fmt->depth >> 3; 556 switch (buf->vb.field) {
570 switch (buf->vb.field) { 557 case V4L2_FIELD_TOP:
571 case V4L2_FIELD_TOP: 558 cx88_risc_buffer(dev->pci, &buf->risc,
572 cx88_risc_buffer(dev->pci, &buf->risc, 559 dma->sglist, 0, UNSET,
573 dma->sglist, 0, UNSET, 560 buf->bpl, 0, buf->vb.height);
574 buf->bpl, 0, buf->vb.height); 561 break;
575 break; 562 case V4L2_FIELD_BOTTOM:
576 case V4L2_FIELD_BOTTOM: 563 cx88_risc_buffer(dev->pci, &buf->risc,
577 cx88_risc_buffer(dev->pci, &buf->risc, 564 dma->sglist, UNSET, 0,
578 dma->sglist, UNSET, 0, 565 buf->bpl, 0, buf->vb.height);
579 buf->bpl, 0, buf->vb.height); 566 break;
580 break; 567 case V4L2_FIELD_SEQ_TB:
581 case V4L2_FIELD_INTERLACED: 568 cx88_risc_buffer(dev->pci, &buf->risc,
582 cx88_risc_buffer(dev->pci, &buf->risc, 569 dma->sglist,
583 dma->sglist, 0, buf->bpl, 570 0, buf->bpl * (buf->vb.height >> 1),
584 buf->bpl, buf->bpl, 571 buf->bpl, 0,
585 buf->vb.height >> 1); 572 buf->vb.height >> 1);
586 break; 573 break;
587 case V4L2_FIELD_SEQ_TB: 574 case V4L2_FIELD_SEQ_BT:
588 cx88_risc_buffer(dev->pci, &buf->risc, 575 cx88_risc_buffer(dev->pci, &buf->risc,
589 dma->sglist, 576 dma->sglist,
590 0, buf->bpl * (buf->vb.height >> 1), 577 buf->bpl * (buf->vb.height >> 1), 0,
591 buf->bpl, 0, 578 buf->bpl, 0,
592 buf->vb.height >> 1); 579 buf->vb.height >> 1);
593 break; 580 break;
594 case V4L2_FIELD_SEQ_BT: 581 case V4L2_FIELD_INTERLACED:
595 cx88_risc_buffer(dev->pci, &buf->risc, 582 default:
596 dma->sglist, 583 cx88_risc_buffer(dev->pci, &buf->risc,
597 buf->bpl * (buf->vb.height >> 1), 0, 584 dma->sglist, 0, buf->bpl,
598 buf->bpl, 0, 585 buf->bpl, buf->bpl,
599 buf->vb.height >> 1); 586 buf->vb.height >> 1);
600 break; 587 break;
601 default:
602 BUG();
603 }
604 } 588 }
605 dprintk(2,"[%p/%d] buffer_prepare - %dx%d %dbpp \"%s\" - dma=0x%08lx\n", 589 dprintk(2,"[%p/%d] buffer_prepare - %dx%d %dbpp \"%s\" - dma=0x%08lx\n",
606 buf, buf->vb.i, 590 buf, buf->vb.i,
@@ -646,22 +630,12 @@ buffer_queue(struct videobuf_queue *vq, struct videobuf_buffer *vb)
646 630
647 } else { 631 } else {
648 prev = list_entry(q->active.prev, struct cx88_buffer, vb.queue); 632 prev = list_entry(q->active.prev, struct cx88_buffer, vb.queue);
649 if (prev->vb.width == buf->vb.width && 633 list_add_tail(&buf->vb.queue, &q->active);
650 prev->vb.height == buf->vb.height && 634 buf->vb.state = VIDEOBUF_ACTIVE;
651 prev->fmt == buf->fmt) { 635 buf->count = q->count++;
652 list_add_tail(&buf->vb.queue,&q->active); 636 prev->risc.jmp[1] = cpu_to_le32(buf->risc.dma);
653 buf->vb.state = VIDEOBUF_ACTIVE; 637 dprintk(2, "[%p/%d] buffer_queue - append to active\n",
654 buf->count = q->count++; 638 buf, buf->vb.i);
655 prev->risc.jmp[1] = cpu_to_le32(buf->risc.dma);
656 dprintk(2,"[%p/%d] buffer_queue - append to active\n",
657 buf, buf->vb.i);
658
659 } else {
660 list_add_tail(&buf->vb.queue,&q->queued);
661 buf->vb.state = VIDEOBUF_QUEUED;
662 dprintk(2,"[%p/%d] buffer_queue - first queued\n",
663 buf, buf->vb.i);
664 }
665 } 639 }
666} 640}
667 641
diff --git a/drivers/media/pci/cx88/cx88.h b/drivers/media/pci/cx88/cx88.h
index 28893a6b249e..ddc7991723eb 100644
--- a/drivers/media/pci/cx88/cx88.h
+++ b/drivers/media/pci/cx88/cx88.h
@@ -319,7 +319,6 @@ struct cx88_buffer {
319 /* cx88 specific */ 319 /* cx88 specific */
320 unsigned int bpl; 320 unsigned int bpl;
321 struct btcx_riscmem risc; 321 struct btcx_riscmem risc;
322 const struct cx8800_fmt *fmt;
323 u32 count; 322 u32 count;
324}; 323};
325 324