media: bttv: move vbi_skip/vbi_count out of buffer
authorDeborah Brouwer <deborah.brouwer@collabora.com>
Sat, 15 Jul 2023 02:16:06 +0000 (19:16 -0700)
committerMauro Carvalho Chehab <mchehab@kernel.org>
Mon, 14 Aug 2023 18:27:59 +0000 (20:27 +0200)
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 <deborah.brouwer@collabora.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
drivers/media/pci/bt8xx/bttv-driver.c
drivers/media/pci/bt8xx/bttv-risc.c
drivers/media/pci/bt8xx/bttv-vbi.c
drivers/media/pci/bt8xx/bttvp.h

index 15825fedb4e0a05ec5583e77f641e4e3244dfedf..4d1e0743f193340eeb28cd9d87c7173e2a730c3c 100644 (file)
@@ -3631,6 +3631,8 @@ static int bttv_probe(struct pci_dev *dev, const struct pci_device_id *pci_id)
        btv->input = 0;
        btv->tvnorm = 0; /* Index into bttv_tvnorms[] i.e. PAL. */
        bttv_vbi_fmt_reset(&btv->vbi_fmt, btv->tvnorm);
+       btv->vbi_count[0] = VBI_DEFLINES;
+       btv->vbi_count[1] = VBI_DEFLINES;
        btv->do_crop = 0;
 
        v4l2_ctrl_new_std(hdl, &bttv_ctrl_ops,
index e9bc6bcc73333e6eb3fd7addba94c186969945e4..97248e340a283e90a43e41b1f219610bd8d8b930 100644 (file)
@@ -525,12 +525,12 @@ bttv_buffer_activate_vbi(struct bttv *btv,
                        btwrite(crop,   BT848_O_CROP);
                }
 
-               if (vbi->vbi_count[0] > 0) {
+               if (btv->vbi_count[0] > 0) {
                        top = &vbi->top;
                        top_irq_flags = 4;
                }
 
-               if (vbi->vbi_count[1] > 0) {
+               if (btv->vbi_count[1] > 0) {
                        top_irq_flags = 0;
                        bottom = &vbi->bottom;
                        bottom_irq_flags = 4;
index 4e7fd9a78ace3ce2871168c02bf6930c78a6f478..2fd990039adf1eee65e5d2aa0b1de00a2f384b39 100644 (file)
@@ -125,14 +125,14 @@ static int vbi_buffer_prepare(struct videobuf_queue *q,
 
        redo_dma_risc = 0;
 
-       if (buf->vbi_skip[0] != skip_lines0 ||
-           buf->vbi_skip[1] != skip_lines1 ||
-           buf->vbi_count[0] != fh->vbi_fmt.fmt.count[0] ||
-           buf->vbi_count[1] != fh->vbi_fmt.fmt.count[1]) {
-               buf->vbi_skip[0] = skip_lines0;
-               buf->vbi_skip[1] = skip_lines1;
-               buf->vbi_count[0] = fh->vbi_fmt.fmt.count[0];
-               buf->vbi_count[1] = fh->vbi_fmt.fmt.count[1];
+       if (btv->vbi_skip[0] != skip_lines0 ||
+           btv->vbi_skip[1] != skip_lines1 ||
+           btv->vbi_count[0] != fh->vbi_fmt.fmt.count[0] ||
+           btv->vbi_count[1] != fh->vbi_fmt.fmt.count[1]) {
+               btv->vbi_skip[0] = skip_lines0;
+               btv->vbi_skip[1] = skip_lines1;
+               btv->vbi_count[0] = fh->vbi_fmt.fmt.count[0];
+               btv->vbi_count[1] = fh->vbi_fmt.fmt.count[1];
                redo_dma_risc = 1;
        }
 
index b5bb69ab8ab0361609f9b162a7a75560c9309dfb..bce2401de9bd1d21610dfc75c0d3396591dc2c32 100644 (file)
@@ -150,8 +150,6 @@ struct bttv_buffer {
        struct bttv_geometry       geo;
        struct btcx_riscmem        top;
        struct btcx_riscmem        bottom;
-       unsigned int               vbi_skip[2];
-       unsigned int               vbi_count[2];
 };
 
 struct bttv_buffer_set {
@@ -239,6 +237,8 @@ void bttv_dma_free(struct videobuf_queue *q, struct bttv *btv,
 /* ---------------------------------------------------------- */
 /* bttv-vbi.c                                                 */
 
+#define VBI_DEFLINES 16
+
 int bttv_try_fmt_vbi_cap(struct file *file, void *fh, struct v4l2_format *f);
 int bttv_g_fmt_vbi_cap(struct file *file, void *fh, struct v4l2_format *f);
 int bttv_s_fmt_vbi_cap(struct file *file, void *fh, struct v4l2_format *f);
@@ -447,6 +447,9 @@ struct bttv {
        int width;
        int height;
        struct bttv_vbi_fmt vbi_fmt;
+       unsigned int vbi_skip[2];
+       unsigned int vbi_count[2];
+
        /* Application called VIDIOC_S_SELECTION. */
        int do_crop;