Skip to content

Commit c9c0df3

Browse files
deborahbrouwermchehab
authored andcommitted
media: bttv: move vbi_skip/vbi_count out of buffer
Instead of storing vbi_skip and vbi_count in each bttv buffer separately, move them to the main bttv struct as they won't change per buffer. Signed-off-by: Deborah Brouwer <[email protected]> Signed-off-by: Hans Verkuil <[email protected]>
1 parent 0f5f12e commit c9c0df3

File tree

4 files changed

+17
-12
lines changed

4 files changed

+17
-12
lines changed

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3631,6 +3631,8 @@ static int bttv_probe(struct pci_dev *dev, const struct pci_device_id *pci_id)
36313631
btv->input = 0;
36323632
btv->tvnorm = 0; /* Index into bttv_tvnorms[] i.e. PAL. */
36333633
bttv_vbi_fmt_reset(&btv->vbi_fmt, btv->tvnorm);
3634+
btv->vbi_count[0] = VBI_DEFLINES;
3635+
btv->vbi_count[1] = VBI_DEFLINES;
36343636
btv->do_crop = 0;
36353637

36363638
v4l2_ctrl_new_std(hdl, &bttv_ctrl_ops,

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -525,12 +525,12 @@ bttv_buffer_activate_vbi(struct bttv *btv,
525525
btwrite(crop, BT848_O_CROP);
526526
}
527527

528-
if (vbi->vbi_count[0] > 0) {
528+
if (btv->vbi_count[0] > 0) {
529529
top = &vbi->top;
530530
top_irq_flags = 4;
531531
}
532532

533-
if (vbi->vbi_count[1] > 0) {
533+
if (btv->vbi_count[1] > 0) {
534534
top_irq_flags = 0;
535535
bottom = &vbi->bottom;
536536
bottom_irq_flags = 4;

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

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -125,14 +125,14 @@ static int vbi_buffer_prepare(struct videobuf_queue *q,
125125

126126
redo_dma_risc = 0;
127127

128-
if (buf->vbi_skip[0] != skip_lines0 ||
129-
buf->vbi_skip[1] != skip_lines1 ||
130-
buf->vbi_count[0] != fh->vbi_fmt.fmt.count[0] ||
131-
buf->vbi_count[1] != fh->vbi_fmt.fmt.count[1]) {
132-
buf->vbi_skip[0] = skip_lines0;
133-
buf->vbi_skip[1] = skip_lines1;
134-
buf->vbi_count[0] = fh->vbi_fmt.fmt.count[0];
135-
buf->vbi_count[1] = fh->vbi_fmt.fmt.count[1];
128+
if (btv->vbi_skip[0] != skip_lines0 ||
129+
btv->vbi_skip[1] != skip_lines1 ||
130+
btv->vbi_count[0] != fh->vbi_fmt.fmt.count[0] ||
131+
btv->vbi_count[1] != fh->vbi_fmt.fmt.count[1]) {
132+
btv->vbi_skip[0] = skip_lines0;
133+
btv->vbi_skip[1] = skip_lines1;
134+
btv->vbi_count[0] = fh->vbi_fmt.fmt.count[0];
135+
btv->vbi_count[1] = fh->vbi_fmt.fmt.count[1];
136136
redo_dma_risc = 1;
137137
}
138138

drivers/media/pci/bt8xx/bttvp.h

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,8 +150,6 @@ struct bttv_buffer {
150150
struct bttv_geometry geo;
151151
struct btcx_riscmem top;
152152
struct btcx_riscmem bottom;
153-
unsigned int vbi_skip[2];
154-
unsigned int vbi_count[2];
155153
};
156154

157155
struct bttv_buffer_set {
@@ -239,6 +237,8 @@ void bttv_dma_free(struct videobuf_queue *q, struct bttv *btv,
239237
/* ---------------------------------------------------------- */
240238
/* bttv-vbi.c */
241239

240+
#define VBI_DEFLINES 16
241+
242242
int bttv_try_fmt_vbi_cap(struct file *file, void *fh, struct v4l2_format *f);
243243
int bttv_g_fmt_vbi_cap(struct file *file, void *fh, struct v4l2_format *f);
244244
int bttv_s_fmt_vbi_cap(struct file *file, void *fh, struct v4l2_format *f);
@@ -447,6 +447,9 @@ struct bttv {
447447
int width;
448448
int height;
449449
struct bttv_vbi_fmt vbi_fmt;
450+
unsigned int vbi_skip[2];
451+
unsigned int vbi_count[2];
452+
450453
/* Application called VIDIOC_S_SELECTION. */
451454
int do_crop;
452455

0 commit comments

Comments
 (0)