Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 138132
b: refs/heads/master
c: 1159b7f
h: refs/heads/master
v: v3
  • Loading branch information
Trent Piepho authored and Mauro Carvalho Chehab committed Mar 30, 2009
1 parent 67b502a commit 70ae618
Show file tree
Hide file tree
Showing 4 changed files with 387 additions and 515 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: ce904bcba41d0b4b809e9573ca43f391e5ffcf4b
refs/heads/master: 1159b7f19f324db0c61d1277987374865690ec06
59 changes: 27 additions & 32 deletions trunk/drivers/media/video/zoran/zoran.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -280,21 +282,21 @@ struct zoran_mapping {
int count;
};

struct zoran_jpg_buffer {
struct zoran_mapping *map;
__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_buffer {
struct zoran_mapping *map;
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 */
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 */
} 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 */
} v4l;
};
};

enum zoran_lock_activity {
Expand All @@ -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;
Expand All @@ -325,17 +321,16 @@ struct zoran;
struct zoran_fh {
struct zoran *zr;

enum zoran_map_mode map_mode; /* Flag which bufferset will map by next mmap() */
enum zoran_map_mode map_mode; /* Flag which bufferset will map by next mmap() */

struct zoran_overlay_settings overlay_settings;
u32 *overlay_mask; /* overlay mask */
enum zoran_lock_activity overlay_active; /* feature currently in use? */
u32 *overlay_mask; /* overlay mask */
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 {
Expand Down Expand Up @@ -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 */
Expand All @@ -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
Expand Down
12 changes: 6 additions & 6 deletions trunk/drivers/media/video/zoran/zoran_device.c
Original file line number Diff line number Diff line change
Expand Up @@ -1125,17 +1125,17 @@ 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 -
zr->jpg_err_shift) & 1) * 2;
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++;
Expand All @@ -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,
Expand Down Expand Up @@ -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);
}
}
Expand Down Expand Up @@ -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;
Expand Down
Loading

0 comments on commit 70ae618

Please sign in to comment.