Skip to content

Commit 0f5f12e

Browse files
deborahbrouwermchehab
authored andcommitted
media: bttv: remove crop info from bttv_buffer
Instead of storing the cropping parameters in each bttv buffer separately, just use the global bttv crop because it won't change per buffer. Signed-off-by: Deborah Brouwer <[email protected]> Signed-off-by: Hans Verkuil <[email protected]>
1 parent 87df33b commit 0f5f12e

File tree

3 files changed

+11
-12
lines changed

3 files changed

+11
-12
lines changed

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1554,15 +1554,15 @@ static int bttv_prepare_buffer(struct videobuf_queue *q,struct bttv *btv,
15541554
if (buf->vb.width != width || buf->vb.height != height ||
15551555
buf->vb.field != field ||
15561556
btv->tvnorm != norm || btv->fmt != fmt ||
1557-
buf->crop.top != c.rect.top ||
1558-
buf->crop.left != c.rect.left ||
1559-
buf->crop.width != c.rect.width ||
1560-
buf->crop.height != c.rect.height) {
1557+
btv->crop[!!btv->do_crop].rect.top != c.rect.top ||
1558+
btv->crop[!!btv->do_crop].rect.left != c.rect.left ||
1559+
btv->crop[!!btv->do_crop].rect.width != c.rect.width ||
1560+
btv->crop[!!btv->do_crop].rect.height != c.rect.height) {
15611561
buf->vb.width = width;
15621562
buf->vb.height = height;
15631563
buf->vb.field = field;
15641564
btv->tvnorm = norm;
1565-
buf->crop = c.rect;
1565+
btv->crop[!!btv->do_crop].rect = c.rect;
15661566
redo_dma_risc = 1;
15671567
}
15681568

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -620,7 +620,7 @@ bttv_buffer_risc(struct bttv *btv, struct bttv_buffer *buf)
620620

621621
bttv_calc_geo(btv,&buf->geo,buf->vb.width,buf->vb.height,
622622
V4L2_FIELD_HAS_BOTH(buf->vb.field),
623-
tvnorm,&buf->crop);
623+
tvnorm, &btv->crop[!!btv->do_crop].rect);
624624

625625
switch (buf->vb.field) {
626626
case V4L2_FIELD_TOP:
@@ -674,7 +674,7 @@ bttv_buffer_risc(struct bttv *btv, struct bttv_buffer *buf)
674674
case V4L2_FIELD_TOP:
675675
bttv_calc_geo(btv,&buf->geo,buf->vb.width,
676676
buf->vb.height,/* both_fields */ 0,
677-
tvnorm,&buf->crop);
677+
tvnorm, &btv->crop[!!btv->do_crop].rect);
678678
bttv_risc_planar(btv, &buf->top, dma->sglist,
679679
0,buf->vb.width,0,buf->vb.height,
680680
uoffset, voffset, btv->fmt->hshift,
@@ -683,7 +683,7 @@ bttv_buffer_risc(struct bttv *btv, struct bttv_buffer *buf)
683683
case V4L2_FIELD_BOTTOM:
684684
bttv_calc_geo(btv,&buf->geo,buf->vb.width,
685685
buf->vb.height,0,
686-
tvnorm,&buf->crop);
686+
tvnorm, &btv->crop[!!btv->do_crop].rect);
687687
bttv_risc_planar(btv, &buf->bottom, dma->sglist,
688688
0,buf->vb.width,0,buf->vb.height,
689689
uoffset, voffset, btv->fmt->hshift,
@@ -692,7 +692,7 @@ bttv_buffer_risc(struct bttv *btv, struct bttv_buffer *buf)
692692
case V4L2_FIELD_INTERLACED:
693693
bttv_calc_geo(btv,&buf->geo,buf->vb.width,
694694
buf->vb.height,1,
695-
tvnorm,&buf->crop);
695+
tvnorm, &btv->crop[!!btv->do_crop].rect);
696696
lines = buf->vb.height >> 1;
697697
ypadding = buf->vb.width;
698698
cpadding = buf->vb.width >> btv->fmt->hshift;
@@ -715,7 +715,7 @@ bttv_buffer_risc(struct bttv *btv, struct bttv_buffer *buf)
715715
case V4L2_FIELD_SEQ_TB:
716716
bttv_calc_geo(btv,&buf->geo,buf->vb.width,
717717
buf->vb.height,1,
718-
tvnorm,&buf->crop);
718+
tvnorm, &btv->crop[!!btv->do_crop].rect);
719719
lines = buf->vb.height >> 1;
720720
ypadding = buf->vb.width;
721721
cpadding = buf->vb.width >> btv->fmt->hshift;
@@ -746,7 +746,7 @@ bttv_buffer_risc(struct bttv *btv, struct bttv_buffer *buf)
746746
/* build risc code */
747747
buf->vb.field = V4L2_FIELD_SEQ_TB;
748748
bttv_calc_geo(btv,&buf->geo,tvnorm->swidth,tvnorm->sheight,
749-
1,tvnorm,&buf->crop);
749+
1, tvnorm, &btv->crop[!!btv->do_crop].rect);
750750
bttv_risc_packed(btv, &buf->top, dma->sglist,
751751
/* offset */ 0, RAW_BPL, /* padding */ 0,
752752
/* skip_lines */ 0, RAW_LINES);

drivers/media/pci/bt8xx/bttvp.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,6 @@ struct bttv_buffer {
150150
struct bttv_geometry geo;
151151
struct btcx_riscmem top;
152152
struct btcx_riscmem bottom;
153-
struct v4l2_rect crop;
154153
unsigned int vbi_skip[2];
155154
unsigned int vbi_count[2];
156155
};

0 commit comments

Comments
 (0)