Commit 3c161e82 authored by Hans Verkuil's avatar Hans Verkuil Committed by Mauro Carvalho Chehab

media: bttv: drop overlay support

Destructive overlay support (i.e. where the video frame is DMA-ed
straight into a framebuffer) is effectively dead. It was a
necessary evil in the early days when computers were not fast enough
to copy SDTV video frames around, but today that's no longer a problem.

It requires access to the framebuffer memory, which is a bad idea and
very hard to do safely. In addition, in drm it is today almost
impossible to get hold of the framebuffer address.

So drop support for this.
Signed-off-by: default avatarHans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@kernel.org>
parent 50a5677d
...@@ -15,7 +15,7 @@ config VIDEO_BT848 ...@@ -15,7 +15,7 @@ config VIDEO_BT848
select RADIO_ADAPTERS select RADIO_ADAPTERS
select RADIO_TEA575X select RADIO_TEA575X
help help
Support for BT848 based frame grabber/overlay boards. This includes Support for BT848 based frame grabber boards. This includes
the Miro, Hauppauge and STB boards. Please read the material in the Miro, Hauppauge and STB boards. Please read the material in
<file:Documentation/admin-guide/media/bttv.rst> for more information. <file:Documentation/admin-guide/media/bttv.rst> for more information.
......
...@@ -75,156 +75,3 @@ int btcx_riscmem_alloc(struct pci_dev *pci, ...@@ -75,156 +75,3 @@ int btcx_riscmem_alloc(struct pci_dev *pci,
} }
return 0; return 0;
} }
/* ---------------------------------------------------------- */
/* screen overlay helpers */
int
btcx_screen_clips(int swidth, int sheight, struct v4l2_rect *win,
struct v4l2_clip *clips, unsigned int n)
{
if (win->left < 0) {
/* left */
clips[n].c.left = 0;
clips[n].c.top = 0;
clips[n].c.width = -win->left;
clips[n].c.height = win->height;
n++;
}
if (win->left + win->width > swidth) {
/* right */
clips[n].c.left = swidth - win->left;
clips[n].c.top = 0;
clips[n].c.width = win->width - clips[n].c.left;
clips[n].c.height = win->height;
n++;
}
if (win->top < 0) {
/* top */
clips[n].c.left = 0;
clips[n].c.top = 0;
clips[n].c.width = win->width;
clips[n].c.height = -win->top;
n++;
}
if (win->top + win->height > sheight) {
/* bottom */
clips[n].c.left = 0;
clips[n].c.top = sheight - win->top;
clips[n].c.width = win->width;
clips[n].c.height = win->height - clips[n].c.top;
n++;
}
return n;
}
int
btcx_align(struct v4l2_rect *win, struct v4l2_clip *clips, unsigned int n, int mask)
{
s32 nx,nw,dx;
unsigned int i;
/* fixup window */
nx = (win->left + mask) & ~mask;
nw = (win->width) & ~mask;
if (nx + nw > win->left + win->width)
nw -= mask+1;
dx = nx - win->left;
win->left = nx;
win->width = nw;
dprintk("btcx: window align %dx%d+%d+%d [dx=%d]\n",
win->width, win->height, win->left, win->top, dx);
/* fixup clips */
for (i = 0; i < n; i++) {
nx = (clips[i].c.left-dx) & ~mask;
nw = (clips[i].c.width) & ~mask;
if (nx + nw < clips[i].c.left-dx + clips[i].c.width)
nw += mask+1;
clips[i].c.left = nx;
clips[i].c.width = nw;
dprintk("btcx: clip align %dx%d+%d+%d\n",
clips[i].c.width, clips[i].c.height,
clips[i].c.left, clips[i].c.top);
}
return 0;
}
void
btcx_sort_clips(struct v4l2_clip *clips, unsigned int nclips)
{
int i,j,n;
if (nclips < 2)
return;
for (i = nclips-2; i >= 0; i--) {
for (n = 0, j = 0; j <= i; j++) {
if (clips[j].c.left > clips[j+1].c.left) {
swap(clips[j], clips[j + 1]);
n++;
}
}
if (0 == n)
break;
}
}
void
btcx_calc_skips(int line, int width, int *maxy,
struct btcx_skiplist *skips, unsigned int *nskips,
const struct v4l2_clip *clips, unsigned int nclips)
{
unsigned int clip,skip;
int end, maxline;
skip=0;
maxline = 9999;
for (clip = 0; clip < nclips; clip++) {
/* sanity checks */
if (clips[clip].c.left + clips[clip].c.width <= 0)
continue;
if (clips[clip].c.left > (signed)width)
break;
/* vertical range */
if (line > clips[clip].c.top+clips[clip].c.height-1)
continue;
if (line < clips[clip].c.top) {
if (maxline > clips[clip].c.top-1)
maxline = clips[clip].c.top-1;
continue;
}
if (maxline > clips[clip].c.top+clips[clip].c.height-1)
maxline = clips[clip].c.top+clips[clip].c.height-1;
/* horizontal range */
if (0 == skip || clips[clip].c.left > skips[skip-1].end) {
/* new one */
skips[skip].start = clips[clip].c.left;
if (skips[skip].start < 0)
skips[skip].start = 0;
skips[skip].end = clips[clip].c.left + clips[clip].c.width;
if (skips[skip].end > width)
skips[skip].end = width;
skip++;
} else {
/* overlaps -- expand last one */
end = clips[clip].c.left + clips[clip].c.width;
if (skips[skip-1].end < end)
skips[skip-1].end = end;
if (skips[skip-1].end > width)
skips[skip-1].end = width;
}
}
*nskips = skip;
*maxy = maxline;
if (btcx_debug) {
dprintk("btcx: skips line %d-%d:", line, maxline);
for (skip = 0; skip < *nskips; skip++) {
pr_cont(" %d-%d", skips[skip].start, skips[skip].end);
}
pr_cont("\n");
}
}
...@@ -16,12 +16,3 @@ int btcx_riscmem_alloc(struct pci_dev *pci, ...@@ -16,12 +16,3 @@ int btcx_riscmem_alloc(struct pci_dev *pci,
unsigned int size); unsigned int size);
void btcx_riscmem_free(struct pci_dev *pci, void btcx_riscmem_free(struct pci_dev *pci,
struct btcx_riscmem *risc); struct btcx_riscmem *risc);
int btcx_screen_clips(int swidth, int sheight, struct v4l2_rect *win,
struct v4l2_clip *clips, unsigned int n);
int btcx_align(struct v4l2_rect *win, struct v4l2_clip *clips,
unsigned int n, int mask);
void btcx_sort_clips(struct v4l2_clip *clips, unsigned int nclips);
void btcx_calc_skips(int line, int width, int *maxy,
struct btcx_skiplist *skips, unsigned int *nskips,
const struct v4l2_clip *clips, unsigned int nclips);
...@@ -81,7 +81,6 @@ static int pvr_boot(struct bttv *btv); ...@@ -81,7 +81,6 @@ static int pvr_boot(struct bttv *btv);
static unsigned int triton1; static unsigned int triton1;
static unsigned int vsfx; static unsigned int vsfx;
static unsigned int latency = UNSET; static unsigned int latency = UNSET;
int no_overlay=-1;
static unsigned int card[BTTV_MAX] = { [ 0 ... (BTTV_MAX-1) ] = UNSET }; static unsigned int card[BTTV_MAX] = { [ 0 ... (BTTV_MAX-1) ] = UNSET };
static unsigned int pll[BTTV_MAX] = { [ 0 ... (BTTV_MAX-1) ] = UNSET }; static unsigned int pll[BTTV_MAX] = { [ 0 ... (BTTV_MAX-1) ] = UNSET };
...@@ -99,7 +98,6 @@ static unsigned int audiomux[5] = { [ 0 ... 4 ] = UNSET }; ...@@ -99,7 +98,6 @@ static unsigned int audiomux[5] = { [ 0 ... 4 ] = UNSET };
/* insmod options */ /* insmod options */
module_param(triton1, int, 0444); module_param(triton1, int, 0444);
module_param(vsfx, int, 0444); module_param(vsfx, int, 0444);
module_param(no_overlay, int, 0444);
module_param(latency, int, 0444); module_param(latency, int, 0444);
module_param(gpiomask, int, 0444); module_param(gpiomask, int, 0444);
module_param(audioall, int, 0444); module_param(audioall, int, 0444);
...@@ -127,7 +125,6 @@ MODULE_PARM_DESC(audiodev, "specify audio device:\n" ...@@ -127,7 +125,6 @@ MODULE_PARM_DESC(audiodev, "specify audio device:\n"
"\t\t 2 = tda7432\n" "\t\t 2 = tda7432\n"
"\t\t 3 = tvaudio"); "\t\t 3 = tvaudio");
MODULE_PARM_DESC(saa6588, "if 1, then load the saa6588 RDS module, default (0) is to use the card definition."); MODULE_PARM_DESC(saa6588, "if 1, then load the saa6588 RDS module, default (0) is to use the card definition.");
MODULE_PARM_DESC(no_overlay, "allow override overlay default (0 disables, 1 enables) [some VIA/SIS chipsets are known to have problem with overlay]");
/* I2C addresses list */ /* I2C addresses list */
...@@ -4869,11 +4866,8 @@ static void gv800s_init(struct bttv *btv) ...@@ -4869,11 +4866,8 @@ static void gv800s_init(struct bttv *btv)
void __init bttv_check_chipset(void) void __init bttv_check_chipset(void)
{ {
int pcipci_fail = 0;
struct pci_dev *dev = NULL; struct pci_dev *dev = NULL;
if (pci_pci_problems & (PCIPCI_FAIL|PCIAGP_FAIL)) /* should check if target is AGP */
pcipci_fail = 1;
if (pci_pci_problems & (PCIPCI_TRITON|PCIPCI_NATOMA|PCIPCI_VIAETBF)) if (pci_pci_problems & (PCIPCI_TRITON|PCIPCI_NATOMA|PCIPCI_VIAETBF))
triton1 = 1; triton1 = 1;
if (pci_pci_problems & PCIPCI_VSFX) if (pci_pci_problems & PCIPCI_VSFX)
...@@ -4889,15 +4883,6 @@ void __init bttv_check_chipset(void) ...@@ -4889,15 +4883,6 @@ void __init bttv_check_chipset(void)
pr_info("Host bridge needs ETBF enabled\n"); pr_info("Host bridge needs ETBF enabled\n");
if (vsfx) if (vsfx)
pr_info("Host bridge needs VSFX enabled\n"); pr_info("Host bridge needs VSFX enabled\n");
if (pcipci_fail) {
pr_info("bttv and your chipset may not work together\n");
if (!no_overlay) {
pr_info("overlay will be disabled\n");
no_overlay = 1;
} else {
pr_info("overlay forced. Use this option at your own risk.\n");
}
}
if (UNSET != latency) if (UNSET != latency)
pr_info("pci latency fixup [%d]\n", latency); pr_info("pci latency fixup [%d]\n", latency);
while ((dev = pci_get_device(PCI_VENDOR_ID_INTEL, while ((dev = pci_get_device(PCI_VENDOR_ID_INTEL,
......
This diff is collapsed.
...@@ -231,95 +231,6 @@ bttv_risc_planar(struct bttv *btv, struct btcx_riscmem *risc, ...@@ -231,95 +231,6 @@ bttv_risc_planar(struct bttv *btv, struct btcx_riscmem *risc,
return 0; return 0;
} }
static int
bttv_risc_overlay(struct bttv *btv, struct btcx_riscmem *risc,
const struct bttv_format *fmt, struct bttv_overlay *ov,
int skip_even, int skip_odd)
{
int dwords, rc, line, maxy, start, end;
unsigned skip, nskips;
struct btcx_skiplist *skips;
__le32 *rp;
u32 ri,ra;
u32 addr;
/* skip list for window clipping */
skips = kmalloc_array(ov->nclips, sizeof(*skips),GFP_KERNEL);
if (NULL == skips)
return -ENOMEM;
/* estimate risc mem: worst case is (1.5*clip+1) * lines instructions
+ sync + jump (all 2 dwords) */
dwords = (3 * ov->nclips + 2) *
((skip_even || skip_odd) ? (ov->w.height+1)>>1 : ov->w.height);
dwords += 4;
if ((rc = btcx_riscmem_alloc(btv->c.pci,risc,dwords*4)) < 0) {
kfree(skips);
return rc;
}
/* sync instruction */
rp = risc->cpu;
*(rp++) = cpu_to_le32(BT848_RISC_SYNC|BT848_FIFO_STATUS_FM1);
*(rp++) = cpu_to_le32(0);
addr = (unsigned long)btv->fbuf.base;
addr += btv->fbuf.fmt.bytesperline * ov->w.top;
addr += (fmt->depth >> 3) * ov->w.left;
/* scan lines */
for (maxy = -1, line = 0; line < ov->w.height;
line++, addr += btv->fbuf.fmt.bytesperline) {
if ((btv->opt_vcr_hack) &&
(line >= (ov->w.height - VCR_HACK_LINES)))
continue;
if ((line%2) == 0 && skip_even)
continue;
if ((line%2) == 1 && skip_odd)
continue;
/* calculate clipping */
if (line > maxy)
btcx_calc_skips(line, ov->w.width, &maxy,
skips, &nskips, ov->clips, ov->nclips);
/* write out risc code */
for (start = 0, skip = 0; start < ov->w.width; start = end) {
if (skip >= nskips) {
ri = BT848_RISC_WRITE;
end = ov->w.width;
} else if (start < skips[skip].start) {
ri = BT848_RISC_WRITE;
end = skips[skip].start;
} else {
ri = BT848_RISC_SKIP;
end = skips[skip].end;
skip++;
}
if (BT848_RISC_WRITE == ri)
ra = addr + (fmt->depth>>3)*start;
else
ra = 0;
if (0 == start)
ri |= BT848_RISC_SOL;
if (ov->w.width == end)
ri |= BT848_RISC_EOL;
ri |= (fmt->depth>>3) * (end-start);
*(rp++)=cpu_to_le32(ri);
if (0 != ra)
*(rp++)=cpu_to_le32(ra);
}
}
/* save pointer to jmp instruction address */
risc->jmp = rp;
BUG_ON((risc->jmp - risc->cpu + 2) * sizeof(*risc->cpu) > risc->size);
kfree(skips);
return 0;
}
/* ---------------------------------------------------------- */ /* ---------------------------------------------------------- */
static void static void
...@@ -848,45 +759,3 @@ bttv_buffer_risc(struct bttv *btv, struct bttv_buffer *buf) ...@@ -848,45 +759,3 @@ bttv_buffer_risc(struct bttv *btv, struct bttv_buffer *buf)
buf->btswap = buf->fmt->btswap; buf->btswap = buf->fmt->btswap;
return 0; return 0;
} }
/* ---------------------------------------------------------- */
/* calculate geometry, build risc code */
int
bttv_overlay_risc(struct bttv *btv,
struct bttv_overlay *ov,
const struct bttv_format *fmt,
struct bttv_buffer *buf)
{
/* check interleave, bottom+top fields */
dprintk("%d: overlay fields: %s format: 0x%08x size: %dx%d\n",
btv->c.nr, v4l2_field_names[buf->vb.field],
fmt->fourcc, ov->w.width, ov->w.height);
/* calculate geometry */
bttv_calc_geo(btv,&buf->geo,ov->w.width,ov->w.height,
V4L2_FIELD_HAS_BOTH(ov->field),
&bttv_tvnorms[ov->tvnorm],&buf->crop);
/* build risc code */
switch (ov->field) {
case V4L2_FIELD_TOP:
bttv_risc_overlay(btv, &buf->top, fmt, ov, 0, 0);
break;
case V4L2_FIELD_BOTTOM:
bttv_risc_overlay(btv, &buf->bottom, fmt, ov, 0, 0);
break;
case V4L2_FIELD_INTERLACED:
bttv_risc_overlay(btv, &buf->top, fmt, ov, 0, 1);
bttv_risc_overlay(btv, &buf->bottom, fmt, ov, 1, 0);
break;
default:
BUG();
}
/* copy format info */
buf->btformat = fmt->btformat;
buf->btswap = fmt->btswap;
buf->vb.field = ov->field;
return 0;
}
...@@ -50,7 +50,6 @@ ...@@ -50,7 +50,6 @@
#define RISC_SLOT_E_FIELD 12 #define RISC_SLOT_E_FIELD 12
#define RISC_SLOT_LOOP 14 #define RISC_SLOT_LOOP 14
#define RESOURCE_OVERLAY 1
#define RESOURCE_VIDEO_STREAM 2 #define RESOURCE_VIDEO_STREAM 2
#define RESOURCE_VBI 4 #define RESOURCE_VBI 4
#define RESOURCE_VIDEO_READ 8 #define RESOURCE_VIDEO_READ 8
...@@ -165,15 +164,6 @@ struct bttv_buffer_set { ...@@ -165,15 +164,6 @@ struct bttv_buffer_set {
unsigned int frame_irq; unsigned int frame_irq;
}; };
struct bttv_overlay {
unsigned int tvnorm;
struct v4l2_rect w;
enum v4l2_field field;
struct v4l2_clip *clips;
int nclips;
int setup_ok;
};
struct bttv_vbi_fmt { struct bttv_vbi_fmt {
struct v4l2_vbi_format fmt; struct v4l2_vbi_format fmt;
...@@ -216,10 +206,6 @@ struct bttv_fh { ...@@ -216,10 +206,6 @@ struct bttv_fh {
int width; int width;
int height; int height;
/* video overlay */
const struct bttv_format *ovfmt;
struct bttv_overlay ov;
/* Application called VIDIOC_S_SELECTION. */ /* Application called VIDIOC_S_SELECTION. */
int do_crop; int do_crop;
...@@ -256,12 +242,6 @@ int bttv_buffer_activate_vbi(struct bttv *btv, ...@@ -256,12 +242,6 @@ int bttv_buffer_activate_vbi(struct bttv *btv,
void bttv_dma_free(struct videobuf_queue *q, struct bttv *btv, void bttv_dma_free(struct videobuf_queue *q, struct bttv *btv,
struct bttv_buffer *buf); struct bttv_buffer *buf);
/* overlay handling */
int bttv_overlay_risc(struct bttv *btv, struct bttv_overlay *ov,
const struct bttv_format *fmt,
struct bttv_buffer *buf);
/* ---------------------------------------------------------- */ /* ---------------------------------------------------------- */
/* bttv-vbi.c */ /* bttv-vbi.c */
...@@ -278,11 +258,6 @@ extern struct bus_type bttv_sub_bus_type; ...@@ -278,11 +258,6 @@ extern struct bus_type bttv_sub_bus_type;
int bttv_sub_add_device(struct bttv_core *core, char *name); int bttv_sub_add_device(struct bttv_core *core, char *name);
int bttv_sub_del_devices(struct bttv_core *core); int bttv_sub_del_devices(struct bttv_core *core);
/* ---------------------------------------------------------- */
/* bttv-cards.c */
extern int no_overlay;
/* ---------------------------------------------------------- */ /* ---------------------------------------------------------- */
/* bttv-input.c */ /* bttv-input.c */
...@@ -454,7 +429,6 @@ struct bttv { ...@@ -454,7 +429,6 @@ struct bttv {
- must acquire s_lock before changing these - must acquire s_lock before changing these
- only the irq handler is supported to touch top + bottom + vcurr */ - only the irq handler is supported to touch top + bottom + vcurr */
struct btcx_riscmem main; struct btcx_riscmem main;
struct bttv_buffer *screen; /* overlay */
struct list_head capture; /* video capture queue */ struct list_head capture; /* video capture queue */
struct list_head vcapture; /* vbi capture queue */ struct list_head vcapture; /* vbi capture queue */
struct bttv_buffer_set curr; /* active buffers */ struct bttv_buffer_set curr; /* active buffers */
...@@ -479,7 +453,7 @@ struct bttv { ...@@ -479,7 +453,7 @@ struct bttv {
/* used to make dvb-bt8xx autoloadable */ /* used to make dvb-bt8xx autoloadable */
struct work_struct request_module_wk; struct work_struct request_module_wk;
/* Default (0) and current (1) video capturing and overlay /* Default (0) and current (1) video capturing
cropping parameters in bttv_tvnorm.cropcap units. Protected cropping parameters in bttv_tvnorm.cropcap units. Protected
by bttv.lock. */ by bttv.lock. */
struct bttv_crop crop[2]; struct bttv_crop crop[2];
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment