Commit 1159b7f1 authored by Trent Piepho's avatar Trent Piepho Committed by Mauro Carvalho Chehab

V4L/DVB (10930): zoran: Unify buffer descriptors

The zoran driver had two kinds of buffer descriptors, one for jpg buffers
and one for raw buffers.  They were mostly the same with only a couple
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent ce904bcb
......@@ -172,6 +172,8 @@ Private IOCTL to set up for displaying MJPEG
#endif
#define V4L_MASK_FRAME (V4L_MAX_FRAME - 1)
#define MAX_FRAME (BUZ_MAX_FRAME > VIDEO_MAX_FRAME ? BUZ_MAX_FRAME : VIDEO_MAX_FRAME)
#include "zr36057.h"
enum card_type {
......@@ -280,21 +282,21 @@ struct zoran_mapping {
int count;
};
struct zoran_jpg_buffer {
struct zoran_buffer {
struct zoran_mapping *map;
enum zoran_buffer_state state; /* state: unused/pending/dma/done */
struct zoran_sync bs; /* DONE: info to return to application */
union {
struct {
__le32 *frag_tab; /* addresses of frag table */
u32 frag_tab_bus; /* same value cached to save time in ISR */
enum zoran_buffer_state state; /* non-zero if corresponding buffer is in use in grab queue */
struct zoran_sync bs; /* DONE: info to return to application */
};
struct zoran_v4l_buffer {
struct zoran_mapping *map;
} jpg;
struct {
char *fbuffer; /* virtual address of frame buffer */
unsigned long fbuffer_phys; /* physical address of frame buffer */
unsigned long fbuffer_bus; /* bus address of frame buffer */
enum zoran_buffer_state state; /* state: unused/pending/done */
struct zoran_sync bs; /* DONE: info to return to application */
unsigned long fbuffer_phys;/* physical address of frame buffer */
unsigned long fbuffer_bus;/* bus address of frame buffer */
} v4l;
};
};
enum zoran_lock_activity {
......@@ -304,19 +306,13 @@ enum zoran_lock_activity {
};
/* buffer collections */
struct zoran_jpg_struct {
struct zoran_buffer_col {
enum zoran_lock_activity active; /* feature currently in use? */
struct zoran_jpg_buffer buffer[BUZ_MAX_FRAME]; /* buffers */
int num_buffers, buffer_size;
unsigned int num_buffers, buffer_size;
struct zoran_buffer buffer[MAX_FRAME]; /* buffers */
u8 allocated; /* Flag if buffers are allocated */
u8 need_contiguous; /* Flag if contiguous buffers are needed */
};
struct zoran_v4l_struct {
enum zoran_lock_activity active; /* feature currently in use? */
struct zoran_v4l_buffer buffer[VIDEO_MAX_FRAME]; /* buffers */
int num_buffers, buffer_size;
u8 allocated; /* Flag if buffers are allocated */
/* only applies to jpg buffers, raw buffers are always contiguous */
};
struct zoran;
......@@ -329,13 +325,12 @@ struct zoran_fh {
struct zoran_overlay_settings overlay_settings;
u32 *overlay_mask; /* overlay mask */
enum zoran_lock_activity overlay_active; /* feature currently in use? */
enum zoran_lock_activity overlay_active;/* feature currently in use? */
struct zoran_v4l_settings v4l_settings; /* structure with a lot of things to play with */
struct zoran_v4l_struct v4l_buffers; /* V4L buffers' info */
struct zoran_buffer_col buffers; /* buffers' info */
struct zoran_v4l_settings v4l_settings; /* structure with a lot of things to play with */
struct zoran_jpg_settings jpg_settings; /* structure with a lot of things to play with */
struct zoran_jpg_struct jpg_buffers; /* MJPEG buffers' info */
};
struct card_info {
......@@ -434,7 +429,7 @@ struct zoran {
unsigned long v4l_pend_tail;
unsigned long v4l_sync_tail;
int v4l_pend[V4L_MAX_FRAME];
struct zoran_v4l_struct v4l_buffers; /* V4L buffers' info */
struct zoran_buffer_col v4l_buffers; /* V4L buffers' info */
/* Buz MJPEG parameters */
enum zoran_codec_mode codec_mode; /* status of codec */
......@@ -461,7 +456,7 @@ struct zoran {
int jpg_pend[BUZ_MAX_FRAME];
/* array indexed by frame number */
struct zoran_jpg_struct jpg_buffers; /* MJPEG buffers' info */
struct zoran_buffer_col jpg_buffers; /* MJPEG buffers' info */
/* Additional stuff for testing */
#ifdef CONFIG_PROC_FS
......
......@@ -1125,7 +1125,7 @@ zoran_feed_stat_com (struct zoran *zr)
if (!(zr->stat_com[i] & cpu_to_le32(1)))
break;
zr->stat_com[i] =
cpu_to_le32(zr->jpg_buffers.buffer[frame].frag_tab_bus);
cpu_to_le32(zr->jpg_buffers.buffer[frame].jpg.frag_tab_bus);
} else {
/* fill 2 stat_com entries */
i = ((zr->jpg_dma_head -
......@@ -1133,9 +1133,9 @@ zoran_feed_stat_com (struct zoran *zr)
if (!(zr->stat_com[i] & cpu_to_le32(1)))
break;
zr->stat_com[i] =
cpu_to_le32(zr->jpg_buffers.buffer[frame].frag_tab_bus);
cpu_to_le32(zr->jpg_buffers.buffer[frame].jpg.frag_tab_bus);
zr->stat_com[i + 1] =
cpu_to_le32(zr->jpg_buffers.buffer[frame].frag_tab_bus);
cpu_to_le32(zr->jpg_buffers.buffer[frame].jpg.frag_tab_bus);
}
zr->jpg_buffers.buffer[frame].state = BUZ_STATE_DMA;
zr->jpg_dma_head++;
......@@ -1155,7 +1155,7 @@ zoran_reap_stat_com (struct zoran *zr)
u32 stat_com;
unsigned int seq;
unsigned int dif;
struct zoran_jpg_buffer *buffer;
struct zoran_buffer *buffer;
int frame;
/* In motion decompress we don't have a hardware frame counter,
......@@ -1298,7 +1298,7 @@ error_handler (struct zoran *zr,
printk(KERN_INFO "stat_com frames:");
for (j = 0; j < BUZ_NUM_STAT_COM; j++) {
for (i = 0; i < zr->jpg_buffers.num_buffers; i++) {
if (le32_to_cpu(zr->stat_com[j]) == zr->jpg_buffers.buffer[i].frag_tab_bus)
if (le32_to_cpu(zr->stat_com[j]) == zr->jpg_buffers.buffer[i].jpg.frag_tab_bus)
printk(KERN_CONT "% d->%d", j, i);
}
}
......@@ -1437,7 +1437,7 @@ zoran_irq (int irq,
/* Buffer address */
reg = zr->v4l_buffers.buffer[frame].fbuffer_bus;
reg = zr->v4l_buffers.buffer[frame].v4l.fbuffer_bus;
btwrite(reg, ZR36057_VDTR);
if (zr->v4l_settings.height > BUZ_MAX_HEIGHT / 2)
reg += zr->v4l_settings.bytesperline;
......
This diff is collapsed.
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