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 <deborah.brouwer@collabora.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
This commit is contained in:
parent
04d5356512
commit
9764252d4b
@ -1553,7 +1553,7 @@ static int bttv_prepare_buffer(struct videobuf_queue *q,struct bttv *btv,
|
|||||||
/* alloc + fill struct bttv_buffer (if changed) */
|
/* alloc + fill struct bttv_buffer (if changed) */
|
||||||
if (buf->vb.width != width || buf->vb.height != height ||
|
if (buf->vb.width != width || buf->vb.height != height ||
|
||||||
buf->vb.field != field ||
|
buf->vb.field != field ||
|
||||||
buf->tvnorm != norm || buf->fmt != fmt ||
|
buf->tvnorm != norm || btv->fmt != fmt ||
|
||||||
buf->crop.top != c.rect.top ||
|
buf->crop.top != c.rect.top ||
|
||||||
buf->crop.left != c.rect.left ||
|
buf->crop.left != c.rect.left ||
|
||||||
buf->crop.width != c.rect.width ||
|
buf->crop.width != c.rect.width ||
|
||||||
@ -1562,7 +1562,6 @@ static int bttv_prepare_buffer(struct videobuf_queue *q,struct bttv *btv,
|
|||||||
buf->vb.height = height;
|
buf->vb.height = height;
|
||||||
buf->vb.field = field;
|
buf->vb.field = field;
|
||||||
buf->tvnorm = norm;
|
buf->tvnorm = norm;
|
||||||
buf->fmt = fmt;
|
|
||||||
buf->crop = c.rect;
|
buf->crop = c.rect;
|
||||||
redo_dma_risc = 1;
|
redo_dma_risc = 1;
|
||||||
}
|
}
|
||||||
|
@ -611,11 +611,11 @@ bttv_buffer_risc(struct bttv *btv, struct bttv_buffer *buf)
|
|||||||
|
|
||||||
dprintk("%d: buffer field: %s format: 0x%08x size: %dx%d\n",
|
dprintk("%d: buffer field: %s format: 0x%08x size: %dx%d\n",
|
||||||
btv->c.nr, v4l2_field_names[buf->vb.field],
|
btv->c.nr, v4l2_field_names[buf->vb.field],
|
||||||
buf->fmt->fourcc, buf->vb.width, buf->vb.height);
|
btv->fmt->fourcc, buf->vb.width, buf->vb.height);
|
||||||
|
|
||||||
/* packed pixel modes */
|
/* packed pixel modes */
|
||||||
if (buf->fmt->flags & FORMAT_FLAGS_PACKED) {
|
if (btv->fmt->flags & FORMAT_FLAGS_PACKED) {
|
||||||
int bpl = (buf->fmt->depth >> 3) * buf->vb.width;
|
int bpl = (btv->fmt->depth >> 3) * buf->vb.width;
|
||||||
int bpf = bpl * (buf->vb.height >> 1);
|
int bpf = bpl * (buf->vb.height >> 1);
|
||||||
|
|
||||||
bttv_calc_geo(btv,&buf->geo,buf->vb.width,buf->vb.height,
|
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)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* planar modes */
|
/* planar modes */
|
||||||
if (buf->fmt->flags & FORMAT_FLAGS_PLANAR) {
|
if (btv->fmt->flags & FORMAT_FLAGS_PLANAR) {
|
||||||
int uoffset, voffset;
|
int uoffset, voffset;
|
||||||
int ypadding, cpadding, lines;
|
int ypadding, cpadding, lines;
|
||||||
|
|
||||||
/* calculate chroma offsets */
|
/* calculate chroma offsets */
|
||||||
uoffset = buf->vb.width * buf->vb.height;
|
uoffset = buf->vb.width * buf->vb.height;
|
||||||
voffset = buf->vb.width * buf->vb.height;
|
voffset = buf->vb.width * buf->vb.height;
|
||||||
if (buf->fmt->flags & FORMAT_FLAGS_CrCb) {
|
if (btv->fmt->flags & FORMAT_FLAGS_CrCb) {
|
||||||
/* Y-Cr-Cb plane order */
|
/* Y-Cr-Cb plane order */
|
||||||
uoffset >>= buf->fmt->hshift;
|
uoffset >>= btv->fmt->hshift;
|
||||||
uoffset >>= buf->fmt->vshift;
|
uoffset >>= btv->fmt->vshift;
|
||||||
uoffset += voffset;
|
uoffset += voffset;
|
||||||
} else {
|
} else {
|
||||||
/* Y-Cb-Cr plane order */
|
/* Y-Cb-Cr plane order */
|
||||||
voffset >>= buf->fmt->hshift;
|
voffset >>= btv->fmt->hshift;
|
||||||
voffset >>= buf->fmt->vshift;
|
voffset >>= btv->fmt->vshift;
|
||||||
voffset += uoffset;
|
voffset += uoffset;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -677,8 +677,8 @@ bttv_buffer_risc(struct bttv *btv, struct bttv_buffer *buf)
|
|||||||
tvnorm,&buf->crop);
|
tvnorm,&buf->crop);
|
||||||
bttv_risc_planar(btv, &buf->top, dma->sglist,
|
bttv_risc_planar(btv, &buf->top, dma->sglist,
|
||||||
0,buf->vb.width,0,buf->vb.height,
|
0,buf->vb.width,0,buf->vb.height,
|
||||||
uoffset,voffset,buf->fmt->hshift,
|
uoffset, voffset, btv->fmt->hshift,
|
||||||
buf->fmt->vshift,0);
|
btv->fmt->vshift, 0);
|
||||||
break;
|
break;
|
||||||
case V4L2_FIELD_BOTTOM:
|
case V4L2_FIELD_BOTTOM:
|
||||||
bttv_calc_geo(btv,&buf->geo,buf->vb.width,
|
bttv_calc_geo(btv,&buf->geo,buf->vb.width,
|
||||||
@ -686,8 +686,8 @@ bttv_buffer_risc(struct bttv *btv, struct bttv_buffer *buf)
|
|||||||
tvnorm,&buf->crop);
|
tvnorm,&buf->crop);
|
||||||
bttv_risc_planar(btv, &buf->bottom, dma->sglist,
|
bttv_risc_planar(btv, &buf->bottom, dma->sglist,
|
||||||
0,buf->vb.width,0,buf->vb.height,
|
0,buf->vb.width,0,buf->vb.height,
|
||||||
uoffset,voffset,buf->fmt->hshift,
|
uoffset, voffset, btv->fmt->hshift,
|
||||||
buf->fmt->vshift,0);
|
btv->fmt->vshift, 0);
|
||||||
break;
|
break;
|
||||||
case V4L2_FIELD_INTERLACED:
|
case V4L2_FIELD_INTERLACED:
|
||||||
bttv_calc_geo(btv,&buf->geo,buf->vb.width,
|
bttv_calc_geo(btv,&buf->geo,buf->vb.width,
|
||||||
@ -695,21 +695,21 @@ bttv_buffer_risc(struct bttv *btv, struct bttv_buffer *buf)
|
|||||||
tvnorm,&buf->crop);
|
tvnorm,&buf->crop);
|
||||||
lines = buf->vb.height >> 1;
|
lines = buf->vb.height >> 1;
|
||||||
ypadding = buf->vb.width;
|
ypadding = buf->vb.width;
|
||||||
cpadding = buf->vb.width >> buf->fmt->hshift;
|
cpadding = buf->vb.width >> btv->fmt->hshift;
|
||||||
bttv_risc_planar(btv,&buf->top,
|
bttv_risc_planar(btv,&buf->top,
|
||||||
dma->sglist,
|
dma->sglist,
|
||||||
0,buf->vb.width,ypadding,lines,
|
0,buf->vb.width,ypadding,lines,
|
||||||
uoffset,voffset,
|
uoffset,voffset,
|
||||||
buf->fmt->hshift,
|
btv->fmt->hshift,
|
||||||
buf->fmt->vshift,
|
btv->fmt->vshift,
|
||||||
cpadding);
|
cpadding);
|
||||||
bttv_risc_planar(btv,&buf->bottom,
|
bttv_risc_planar(btv,&buf->bottom,
|
||||||
dma->sglist,
|
dma->sglist,
|
||||||
ypadding,buf->vb.width,ypadding,lines,
|
ypadding,buf->vb.width,ypadding,lines,
|
||||||
uoffset+cpadding,
|
uoffset+cpadding,
|
||||||
voffset+cpadding,
|
voffset+cpadding,
|
||||||
buf->fmt->hshift,
|
btv->fmt->hshift,
|
||||||
buf->fmt->vshift,
|
btv->fmt->vshift,
|
||||||
cpadding);
|
cpadding);
|
||||||
break;
|
break;
|
||||||
case V4L2_FIELD_SEQ_TB:
|
case V4L2_FIELD_SEQ_TB:
|
||||||
@ -718,22 +718,22 @@ bttv_buffer_risc(struct bttv *btv, struct bttv_buffer *buf)
|
|||||||
tvnorm,&buf->crop);
|
tvnorm,&buf->crop);
|
||||||
lines = buf->vb.height >> 1;
|
lines = buf->vb.height >> 1;
|
||||||
ypadding = buf->vb.width;
|
ypadding = buf->vb.width;
|
||||||
cpadding = buf->vb.width >> buf->fmt->hshift;
|
cpadding = buf->vb.width >> btv->fmt->hshift;
|
||||||
bttv_risc_planar(btv,&buf->top,
|
bttv_risc_planar(btv,&buf->top,
|
||||||
dma->sglist,
|
dma->sglist,
|
||||||
0,buf->vb.width,0,lines,
|
0,buf->vb.width,0,lines,
|
||||||
uoffset >> 1,
|
uoffset >> 1,
|
||||||
voffset >> 1,
|
voffset >> 1,
|
||||||
buf->fmt->hshift,
|
btv->fmt->hshift,
|
||||||
buf->fmt->vshift,
|
btv->fmt->vshift,
|
||||||
0);
|
0);
|
||||||
bttv_risc_planar(btv,&buf->bottom,
|
bttv_risc_planar(btv,&buf->bottom,
|
||||||
dma->sglist,
|
dma->sglist,
|
||||||
lines * ypadding,buf->vb.width,0,lines,
|
lines * ypadding,buf->vb.width,0,lines,
|
||||||
lines * ypadding + (uoffset >> 1),
|
lines * ypadding + (uoffset >> 1),
|
||||||
lines * ypadding + (voffset >> 1),
|
lines * ypadding + (voffset >> 1),
|
||||||
buf->fmt->hshift,
|
btv->fmt->hshift,
|
||||||
buf->fmt->vshift,
|
btv->fmt->vshift,
|
||||||
0);
|
0);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@ -742,7 +742,7 @@ bttv_buffer_risc(struct bttv *btv, struct bttv_buffer *buf)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* raw data */
|
/* raw data */
|
||||||
if (buf->fmt->flags & FORMAT_FLAGS_RAW) {
|
if (btv->fmt->flags & FORMAT_FLAGS_RAW) {
|
||||||
/* build risc code */
|
/* build risc code */
|
||||||
buf->vb.field = V4L2_FIELD_SEQ_TB;
|
buf->vb.field = V4L2_FIELD_SEQ_TB;
|
||||||
bttv_calc_geo(btv,&buf->geo,tvnorm->swidth,tvnorm->sheight,
|
bttv_calc_geo(btv,&buf->geo,tvnorm->swidth,tvnorm->sheight,
|
||||||
@ -755,7 +755,7 @@ bttv_buffer_risc(struct bttv *btv, struct bttv_buffer *buf)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* copy format info */
|
/* copy format info */
|
||||||
buf->btformat = buf->fmt->btformat;
|
buf->btformat = btv->fmt->btformat;
|
||||||
buf->btswap = buf->fmt->btswap;
|
buf->btswap = btv->fmt->btswap;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -145,7 +145,6 @@ struct bttv_buffer {
|
|||||||
struct videobuf_buffer vb;
|
struct videobuf_buffer vb;
|
||||||
|
|
||||||
/* bttv specific */
|
/* bttv specific */
|
||||||
const struct bttv_format *fmt;
|
|
||||||
unsigned int tvnorm;
|
unsigned int tvnorm;
|
||||||
int btformat;
|
int btformat;
|
||||||
int btswap;
|
int btswap;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user