Skip to content

Commit 9764252

Browse files
deborahbrouwermchehab
authored andcommitted
media: bttv: remove format field from bttv_buffer
Instead of storing the format (video or vbi) in each bttv buffer separately, just use the global bttv format because the format does not change per buffer. Signed-off-by: Deborah Brouwer <[email protected]> Signed-off-by: Hans Verkuil <[email protected]>
1 parent 04d5356 commit 9764252

File tree

3 files changed

+27
-29
lines changed

3 files changed

+27
-29
lines changed

drivers/media/pci/bt8xx/bttv-driver.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1553,7 +1553,7 @@ static int bttv_prepare_buffer(struct videobuf_queue *q,struct bttv *btv,
15531553
/* alloc + fill struct bttv_buffer (if changed) */
15541554
if (buf->vb.width != width || buf->vb.height != height ||
15551555
buf->vb.field != field ||
1556-
buf->tvnorm != norm || buf->fmt != fmt ||
1556+
buf->tvnorm != norm || btv->fmt != fmt ||
15571557
buf->crop.top != c.rect.top ||
15581558
buf->crop.left != c.rect.left ||
15591559
buf->crop.width != c.rect.width ||
@@ -1562,7 +1562,6 @@ static int bttv_prepare_buffer(struct videobuf_queue *q,struct bttv *btv,
15621562
buf->vb.height = height;
15631563
buf->vb.field = field;
15641564
buf->tvnorm = norm;
1565-
buf->fmt = fmt;
15661565
buf->crop = c.rect;
15671566
redo_dma_risc = 1;
15681567
}

drivers/media/pci/bt8xx/bttv-risc.c

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -611,11 +611,11 @@ bttv_buffer_risc(struct bttv *btv, struct bttv_buffer *buf)
611611

612612
dprintk("%d: buffer field: %s format: 0x%08x size: %dx%d\n",
613613
btv->c.nr, v4l2_field_names[buf->vb.field],
614-
buf->fmt->fourcc, buf->vb.width, buf->vb.height);
614+
btv->fmt->fourcc, buf->vb.width, buf->vb.height);
615615

616616
/* packed pixel modes */
617-
if (buf->fmt->flags & FORMAT_FLAGS_PACKED) {
618-
int bpl = (buf->fmt->depth >> 3) * buf->vb.width;
617+
if (btv->fmt->flags & FORMAT_FLAGS_PACKED) {
618+
int bpl = (btv->fmt->depth >> 3) * buf->vb.width;
619619
int bpf = bpl * (buf->vb.height >> 1);
620620

621621
bttv_calc_geo(btv,&buf->geo,buf->vb.width,buf->vb.height,
@@ -651,22 +651,22 @@ bttv_buffer_risc(struct bttv *btv, struct bttv_buffer *buf)
651651
}
652652

653653
/* planar modes */
654-
if (buf->fmt->flags & FORMAT_FLAGS_PLANAR) {
654+
if (btv->fmt->flags & FORMAT_FLAGS_PLANAR) {
655655
int uoffset, voffset;
656656
int ypadding, cpadding, lines;
657657

658658
/* calculate chroma offsets */
659659
uoffset = buf->vb.width * buf->vb.height;
660660
voffset = buf->vb.width * buf->vb.height;
661-
if (buf->fmt->flags & FORMAT_FLAGS_CrCb) {
661+
if (btv->fmt->flags & FORMAT_FLAGS_CrCb) {
662662
/* Y-Cr-Cb plane order */
663-
uoffset >>= buf->fmt->hshift;
664-
uoffset >>= buf->fmt->vshift;
663+
uoffset >>= btv->fmt->hshift;
664+
uoffset >>= btv->fmt->vshift;
665665
uoffset += voffset;
666666
} else {
667667
/* Y-Cb-Cr plane order */
668-
voffset >>= buf->fmt->hshift;
669-
voffset >>= buf->fmt->vshift;
668+
voffset >>= btv->fmt->hshift;
669+
voffset >>= btv->fmt->vshift;
670670
voffset += uoffset;
671671
}
672672

@@ -677,39 +677,39 @@ bttv_buffer_risc(struct bttv *btv, struct bttv_buffer *buf)
677677
tvnorm,&buf->crop);
678678
bttv_risc_planar(btv, &buf->top, dma->sglist,
679679
0,buf->vb.width,0,buf->vb.height,
680-
uoffset,voffset,buf->fmt->hshift,
681-
buf->fmt->vshift,0);
680+
uoffset, voffset, btv->fmt->hshift,
681+
btv->fmt->vshift, 0);
682682
break;
683683
case V4L2_FIELD_BOTTOM:
684684
bttv_calc_geo(btv,&buf->geo,buf->vb.width,
685685
buf->vb.height,0,
686686
tvnorm,&buf->crop);
687687
bttv_risc_planar(btv, &buf->bottom, dma->sglist,
688688
0,buf->vb.width,0,buf->vb.height,
689-
uoffset,voffset,buf->fmt->hshift,
690-
buf->fmt->vshift,0);
689+
uoffset, voffset, btv->fmt->hshift,
690+
btv->fmt->vshift, 0);
691691
break;
692692
case V4L2_FIELD_INTERLACED:
693693
bttv_calc_geo(btv,&buf->geo,buf->vb.width,
694694
buf->vb.height,1,
695695
tvnorm,&buf->crop);
696696
lines = buf->vb.height >> 1;
697697
ypadding = buf->vb.width;
698-
cpadding = buf->vb.width >> buf->fmt->hshift;
698+
cpadding = buf->vb.width >> btv->fmt->hshift;
699699
bttv_risc_planar(btv,&buf->top,
700700
dma->sglist,
701701
0,buf->vb.width,ypadding,lines,
702702
uoffset,voffset,
703-
buf->fmt->hshift,
704-
buf->fmt->vshift,
703+
btv->fmt->hshift,
704+
btv->fmt->vshift,
705705
cpadding);
706706
bttv_risc_planar(btv,&buf->bottom,
707707
dma->sglist,
708708
ypadding,buf->vb.width,ypadding,lines,
709709
uoffset+cpadding,
710710
voffset+cpadding,
711-
buf->fmt->hshift,
712-
buf->fmt->vshift,
711+
btv->fmt->hshift,
712+
btv->fmt->vshift,
713713
cpadding);
714714
break;
715715
case V4L2_FIELD_SEQ_TB:
@@ -718,22 +718,22 @@ bttv_buffer_risc(struct bttv *btv, struct bttv_buffer *buf)
718718
tvnorm,&buf->crop);
719719
lines = buf->vb.height >> 1;
720720
ypadding = buf->vb.width;
721-
cpadding = buf->vb.width >> buf->fmt->hshift;
721+
cpadding = buf->vb.width >> btv->fmt->hshift;
722722
bttv_risc_planar(btv,&buf->top,
723723
dma->sglist,
724724
0,buf->vb.width,0,lines,
725725
uoffset >> 1,
726726
voffset >> 1,
727-
buf->fmt->hshift,
728-
buf->fmt->vshift,
727+
btv->fmt->hshift,
728+
btv->fmt->vshift,
729729
0);
730730
bttv_risc_planar(btv,&buf->bottom,
731731
dma->sglist,
732732
lines * ypadding,buf->vb.width,0,lines,
733733
lines * ypadding + (uoffset >> 1),
734734
lines * ypadding + (voffset >> 1),
735-
buf->fmt->hshift,
736-
buf->fmt->vshift,
735+
btv->fmt->hshift,
736+
btv->fmt->vshift,
737737
0);
738738
break;
739739
default:
@@ -742,7 +742,7 @@ bttv_buffer_risc(struct bttv *btv, struct bttv_buffer *buf)
742742
}
743743

744744
/* raw data */
745-
if (buf->fmt->flags & FORMAT_FLAGS_RAW) {
745+
if (btv->fmt->flags & FORMAT_FLAGS_RAW) {
746746
/* build risc code */
747747
buf->vb.field = V4L2_FIELD_SEQ_TB;
748748
bttv_calc_geo(btv,&buf->geo,tvnorm->swidth,tvnorm->sheight,
@@ -755,7 +755,7 @@ bttv_buffer_risc(struct bttv *btv, struct bttv_buffer *buf)
755755
}
756756

757757
/* copy format info */
758-
buf->btformat = buf->fmt->btformat;
759-
buf->btswap = buf->fmt->btswap;
758+
buf->btformat = btv->fmt->btformat;
759+
buf->btswap = btv->fmt->btswap;
760760
return 0;
761761
}

drivers/media/pci/bt8xx/bttvp.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,6 @@ struct bttv_buffer {
145145
struct videobuf_buffer vb;
146146

147147
/* bttv specific */
148-
const struct bttv_format *fmt;
149148
unsigned int tvnorm;
150149
int btformat;
151150
int btswap;

0 commit comments

Comments
 (0)