media: bttv: remove crop info from bttv_buffer
authorDeborah Brouwer <deborah.brouwer@collabora.com>
Sat, 15 Jul 2023 02:16:05 +0000 (19:16 -0700)
committerMauro Carvalho Chehab <mchehab@kernel.org>
Mon, 14 Aug 2023 18:27:59 +0000 (20:27 +0200)
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 <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/bttvp.h

index f32050849691af0e3a01055e912a58df73c2e2a0..15825fedb4e0a05ec5583e77f641e4e3244dfedf 100644 (file)
@@ -1554,15 +1554,15 @@ static int bttv_prepare_buffer(struct videobuf_queue *q,struct bttv *btv,
        if (buf->vb.width != width || buf->vb.height != height ||
            buf->vb.field != field ||
            btv->tvnorm != norm || btv->fmt != fmt ||
-           buf->crop.top != c.rect.top ||
-           buf->crop.left != c.rect.left ||
-           buf->crop.width != c.rect.width ||
-           buf->crop.height != c.rect.height) {
+           btv->crop[!!btv->do_crop].rect.top != c.rect.top ||
+           btv->crop[!!btv->do_crop].rect.left != c.rect.left ||
+           btv->crop[!!btv->do_crop].rect.width != c.rect.width ||
+           btv->crop[!!btv->do_crop].rect.height != c.rect.height) {
                buf->vb.width  = width;
                buf->vb.height = height;
                buf->vb.field  = field;
                btv->tvnorm    = norm;
-               buf->crop      = c.rect;
+               btv->crop[!!btv->do_crop].rect = c.rect;
                redo_dma_risc = 1;
        }
 
index 0a296dc1a7a56d47abf3d0847e0d85804a0633e6..e9bc6bcc73333e6eb3fd7addba94c186969945e4 100644 (file)
@@ -620,7 +620,7 @@ bttv_buffer_risc(struct bttv *btv, struct bttv_buffer *buf)
 
                bttv_calc_geo(btv,&buf->geo,buf->vb.width,buf->vb.height,
                              V4L2_FIELD_HAS_BOTH(buf->vb.field),
-                             tvnorm,&buf->crop);
+                             tvnorm, &btv->crop[!!btv->do_crop].rect);
 
                switch (buf->vb.field) {
                case V4L2_FIELD_TOP:
@@ -674,7 +674,7 @@ bttv_buffer_risc(struct bttv *btv, struct bttv_buffer *buf)
                case V4L2_FIELD_TOP:
                        bttv_calc_geo(btv,&buf->geo,buf->vb.width,
                                      buf->vb.height,/* both_fields */ 0,
-                                     tvnorm,&buf->crop);
+                                     tvnorm, &btv->crop[!!btv->do_crop].rect);
                        bttv_risc_planar(btv, &buf->top, dma->sglist,
                                         0,buf->vb.width,0,buf->vb.height,
                                         uoffset, voffset, btv->fmt->hshift,
@@ -683,7 +683,7 @@ bttv_buffer_risc(struct bttv *btv, struct bttv_buffer *buf)
                case V4L2_FIELD_BOTTOM:
                        bttv_calc_geo(btv,&buf->geo,buf->vb.width,
                                      buf->vb.height,0,
-                                     tvnorm,&buf->crop);
+                                     tvnorm, &btv->crop[!!btv->do_crop].rect);
                        bttv_risc_planar(btv, &buf->bottom, dma->sglist,
                                         0,buf->vb.width,0,buf->vb.height,
                                         uoffset, voffset, btv->fmt->hshift,
@@ -692,7 +692,7 @@ bttv_buffer_risc(struct bttv *btv, struct bttv_buffer *buf)
                case V4L2_FIELD_INTERLACED:
                        bttv_calc_geo(btv,&buf->geo,buf->vb.width,
                                      buf->vb.height,1,
-                                     tvnorm,&buf->crop);
+                                     tvnorm, &btv->crop[!!btv->do_crop].rect);
                        lines    = buf->vb.height >> 1;
                        ypadding = buf->vb.width;
                        cpadding = buf->vb.width >> btv->fmt->hshift;
@@ -715,7 +715,7 @@ bttv_buffer_risc(struct bttv *btv, struct bttv_buffer *buf)
                case V4L2_FIELD_SEQ_TB:
                        bttv_calc_geo(btv,&buf->geo,buf->vb.width,
                                      buf->vb.height,1,
-                                     tvnorm,&buf->crop);
+                                     tvnorm, &btv->crop[!!btv->do_crop].rect);
                        lines    = buf->vb.height >> 1;
                        ypadding = buf->vb.width;
                        cpadding = buf->vb.width >> btv->fmt->hshift;
@@ -746,7 +746,7 @@ bttv_buffer_risc(struct bttv *btv, struct bttv_buffer *buf)
                /* build risc code */
                buf->vb.field = V4L2_FIELD_SEQ_TB;
                bttv_calc_geo(btv,&buf->geo,tvnorm->swidth,tvnorm->sheight,
-                             1,tvnorm,&buf->crop);
+                             1, tvnorm, &btv->crop[!!btv->do_crop].rect);
                bttv_risc_packed(btv, &buf->top,  dma->sglist,
                                 /* offset */ 0, RAW_BPL, /* padding */ 0,
                                 /* skip_lines */ 0, RAW_LINES);
index bbb5fc060fadcab26af445a3ed4e7406626b29d8..b5bb69ab8ab0361609f9b162a7a75560c9309dfb 100644 (file)
@@ -150,7 +150,6 @@ struct bttv_buffer {
        struct bttv_geometry       geo;
        struct btcx_riscmem        top;
        struct btcx_riscmem        bottom;
-       struct v4l2_rect           crop;
        unsigned int               vbi_skip[2];
        unsigned int               vbi_count[2];
 };