Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 63175
b: refs/heads/master
c: 603d6f2
h: refs/heads/master
i:
  63173: bcb65a0
  63171: f80fb06
  63167: a765c78
v: v3
  • Loading branch information
Trent Piepho authored and Mauro Carvalho Chehab committed Jul 30, 2007
1 parent 0f60370 commit af9e9ad
Show file tree
Hide file tree
Showing 4 changed files with 87 additions and 98 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: bb2e033913f14b2f9f6745e206c3ea5df481b4fd
refs/heads/master: 603d6f2c8f9f3604f9c6c1f8903efc2df30a000f
5 changes: 5 additions & 0 deletions trunk/drivers/media/video/zoran.h
Original file line number Diff line number Diff line change
Expand Up @@ -240,11 +240,16 @@ enum gpcs_type {

struct zoran_format {
char *name;
#ifdef CONFIG_VIDEO_V4L1_COMPAT
int palette;
#endif
#ifdef CONFIG_VIDEO_V4L2
__u32 fourcc;
int colorspace;
#endif
int depth;
__u32 flags;
__u32 vfespfr;
};
/* flags */
#define ZORAN_FORMAT_COMPRESSED 1<<0
Expand Down
33 changes: 1 addition & 32 deletions trunk/drivers/media/video/zoran_device.c
Original file line number Diff line number Diff line change
Expand Up @@ -429,8 +429,6 @@ zr36057_set_vfe (struct zoran *zr,
reg |= (HorDcm << ZR36057_VFESPFR_HorDcm);
reg |= (VerDcm << ZR36057_VFESPFR_VerDcm);
reg |= (DispMode << ZR36057_VFESPFR_DispMode);
if (format->palette != VIDEO_PALETTE_YUV422 && format->palette != VIDEO_PALETTE_YUYV)
reg |= ZR36057_VFESPFR_LittleEndian;
/* RJ: I don't know, why the following has to be the opposite
* of the corresponding ZR36060 setting, but only this way
* we get the correct colors when uncompressing to the screen */
Expand All @@ -439,43 +437,14 @@ zr36057_set_vfe (struct zoran *zr,
if (zr->norm != VIDEO_MODE_NTSC)
reg |= ZR36057_VFESPFR_ExtFl; // NEEDED!!!!!!! Wolfgang
reg |= ZR36057_VFESPFR_TopField;
switch (format->palette) {

case VIDEO_PALETTE_YUYV:
case VIDEO_PALETTE_YUV422:
reg |= ZR36057_VFESPFR_YUV422;
break;

case VIDEO_PALETTE_RGB555:
reg |= ZR36057_VFESPFR_RGB555 | ZR36057_VFESPFR_ErrDif;
break;

case VIDEO_PALETTE_RGB565:
reg |= ZR36057_VFESPFR_RGB565 | ZR36057_VFESPFR_ErrDif;
break;

case VIDEO_PALETTE_RGB24:
reg |= ZR36057_VFESPFR_RGB888 | ZR36057_VFESPFR_Pack24;
break;

case VIDEO_PALETTE_RGB32:
reg |= ZR36057_VFESPFR_RGB888;
break;

default:
dprintk(1,
KERN_INFO "%s: set_vfe() - unknown color_fmt=%x\n",
ZR_DEVNAME(zr), format->palette);
return;

}
if (HorDcm >= 48) {
reg |= 3 << ZR36057_VFESPFR_HFilter; /* 5 tap filter */
} else if (HorDcm >= 32) {
reg |= 2 << ZR36057_VFESPFR_HFilter; /* 4 tap filter */
} else if (HorDcm >= 16) {
reg |= 1 << ZR36057_VFESPFR_HFilter; /* 3 tap filter */
}
reg |= format->vfespfr;
btwrite(reg, ZR36057_VFESPFR);

/* display configuration */
Expand Down
145 changes: 80 additions & 65 deletions trunk/drivers/media/video/zoran_driver.c
Original file line number Diff line number Diff line change
Expand Up @@ -99,88 +99,103 @@

#include <asm/byteorder.h>

const struct zoran_format zoran_formats[] = {
{
.name = "15-bit RGB",
.palette = VIDEO_PALETTE_RGB555,
#ifdef CONFIG_VIDEO_V4L2
#ifdef __LITTLE_ENDIAN
.fourcc = V4L2_PIX_FMT_RGB555,
#if defined(CONFIG_VIDEO_V4L2) && defined(CONFIG_VIDEO_V4L1_COMPAT)
#define ZFMT(pal, fcc, cs) \
.palette = (pal), .fourcc = (fcc), .colorspace = (cs)
#elif defined(CONFIG_VIDEO_V4L2)
#define ZFMT(pal, fcc, cs) \
.fourcc = (fcc), .colorspace = (cs)
#else
.fourcc = V4L2_PIX_FMT_RGB555X,
#endif
.colorspace = V4L2_COLORSPACE_SRGB,
#define ZFMT(pal, fcc, cs) \
.palette = (pal)
#endif

const struct zoran_format zoran_formats[] = {
{
.name = "15-bit RGB LE",
ZFMT(VIDEO_PALETTE_RGB555,
V4L2_PIX_FMT_RGB555, V4L2_COLORSPACE_SRGB),
.depth = 15,
.flags = ZORAN_FORMAT_CAPTURE |
ZORAN_FORMAT_OVERLAY,
.vfespfr = ZR36057_VFESPFR_RGB555|ZR36057_VFESPFR_ErrDif|
ZR36057_VFESPFR_LittleEndian,
}, {
.name = "16-bit RGB",
.palette = VIDEO_PALETTE_RGB565,
#ifdef CONFIG_VIDEO_V4L2
#ifdef __LITTLE_ENDIAN
.fourcc = V4L2_PIX_FMT_RGB565,
#else
.fourcc = V4L2_PIX_FMT_RGB565X,
#endif
.colorspace = V4L2_COLORSPACE_SRGB,
#endif
.name = "15-bit RGB BE",
ZFMT(-1,
V4L2_PIX_FMT_RGB555X, V4L2_COLORSPACE_SRGB),
.depth = 15,
.flags = ZORAN_FORMAT_CAPTURE |
ZORAN_FORMAT_OVERLAY,
.vfespfr = ZR36057_VFESPFR_RGB555|ZR36057_VFESPFR_ErrDif,
}, {
.name = "16-bit RGB LE",
ZFMT(VIDEO_PALETTE_RGB565,
V4L2_PIX_FMT_RGB565, V4L2_COLORSPACE_SRGB),
.depth = 16,
.flags = ZORAN_FORMAT_CAPTURE |
ZORAN_FORMAT_OVERLAY,
.vfespfr = ZR36057_VFESPFR_RGB565|ZR36057_VFESPFR_ErrDif|
ZR36057_VFESPFR_LittleEndian,
}, {
.name = "16-bit RGB BE",
ZFMT(-1,
V4L2_PIX_FMT_RGB565, V4L2_COLORSPACE_SRGB),
.depth = 16,
.flags = ZORAN_FORMAT_CAPTURE |
ZORAN_FORMAT_OVERLAY,
.vfespfr = ZR36057_VFESPFR_RGB565|ZR36057_VFESPFR_ErrDif,
}, {
.name = "24-bit RGB",
.palette = VIDEO_PALETTE_RGB24,
#ifdef CONFIG_VIDEO_V4L2
#ifdef __LITTLE_ENDIAN
.fourcc = V4L2_PIX_FMT_BGR24,
#else
.fourcc = V4L2_PIX_FMT_RGB24,
#endif
.colorspace = V4L2_COLORSPACE_SRGB,
#endif
ZFMT(VIDEO_PALETTE_RGB24,
V4L2_PIX_FMT_BGR24, V4L2_COLORSPACE_SRGB),
.depth = 24,
.flags = ZORAN_FORMAT_CAPTURE |
ZORAN_FORMAT_OVERLAY,
.vfespfr = ZR36057_VFESPFR_RGB888|ZR36057_VFESPFR_Pack24,
}, {
.name = "32-bit RGB",
.palette = VIDEO_PALETTE_RGB32,
#ifdef CONFIG_VIDEO_V4L2
#ifdef __LITTLE_ENDIAN
.fourcc = V4L2_PIX_FMT_BGR32,
#else
.fourcc = V4L2_PIX_FMT_RGB32,
#endif
.colorspace = V4L2_COLORSPACE_SRGB,
#endif
.name = "32-bit RGB LE",
ZFMT(VIDEO_PALETTE_RGB32,
V4L2_PIX_FMT_BGR32, V4L2_COLORSPACE_SRGB),
.depth = 32,
.flags = ZORAN_FORMAT_CAPTURE |
ZORAN_FORMAT_OVERLAY,
.vfespfr = ZR36057_VFESPFR_RGB888|ZR36057_VFESPFR_LittleEndian,
}, {
.name = "32-bit RGB BE",
ZFMT(-1,
V4L2_PIX_FMT_RGB32, V4L2_COLORSPACE_SRGB),
.depth = 32,
.flags = ZORAN_FORMAT_CAPTURE |
ZORAN_FORMAT_OVERLAY,
.vfespfr = ZR36057_VFESPFR_RGB888,
}, {
.name = "4:2:2, packed, YUYV",
.palette = VIDEO_PALETTE_YUV422,
#ifdef CONFIG_VIDEO_V4L2
.fourcc = V4L2_PIX_FMT_YUYV,
.colorspace = V4L2_COLORSPACE_SMPTE170M,
#endif
ZFMT(VIDEO_PALETTE_YUV422,
V4L2_PIX_FMT_YUYV, V4L2_COLORSPACE_SMPTE170M),
.depth = 16,
.flags = ZORAN_FORMAT_CAPTURE |
ZORAN_FORMAT_OVERLAY,
.vfespfr = ZR36057_VFESPFR_YUV422,
}, {
.name = "4:2:2, packed, UYVY",
ZFMT(VIDEO_PALETTE_UYVY,
V4L2_PIX_FMT_UYVY, V4L2_COLORSPACE_SMPTE170M),
.depth = 16,
.flags = ZORAN_FORMAT_CAPTURE |
ZORAN_FORMAT_OVERLAY,
.vfespfr = ZR36057_VFESPFR_YUV422|ZR36057_VFESPFR_LittleEndian,
}, {
.name = "Hardware-encoded Motion-JPEG",
.palette = -1,
#ifdef CONFIG_VIDEO_V4L2
.fourcc = V4L2_PIX_FMT_MJPEG,
.colorspace = V4L2_COLORSPACE_SMPTE170M,
#endif
ZFMT(-1,
V4L2_PIX_FMT_MJPEG, V4L2_COLORSPACE_SMPTE170M),
.depth = 0,
.flags = ZORAN_FORMAT_CAPTURE |
ZORAN_FORMAT_PLAYBACK |
ZORAN_FORMAT_COMPRESSED,
}
};
static const int zoran_num_formats =
(sizeof(zoran_formats) / sizeof(struct zoran_format));
#define NUM_FORMATS ARRAY_SIZE(zoran_formats)

// RJ: Test only - want to test BUZ_USE_HIMEM even when CONFIG_BIGPHYS_AREA is defined

Expand Down Expand Up @@ -768,13 +783,13 @@ v4l_grab (struct file *file,
struct zoran *zr = fh->zr;
int res = 0, i;

for (i = 0; i < zoran_num_formats; i++) {
for (i = 0; i < NUM_FORMATS; i++) {
if (zoran_formats[i].palette == mp->format &&
zoran_formats[i].flags & ZORAN_FORMAT_CAPTURE &&
!(zoran_formats[i].flags & ZORAN_FORMAT_COMPRESSED))
break;
}
if (i == zoran_num_formats || zoran_formats[i].depth == 0) {
if (i == NUM_FORMATS || zoran_formats[i].depth == 0) {
dprintk(1,
KERN_ERR
"%s: v4l_grab() - wrong bytes-per-pixel format\n",
Expand Down Expand Up @@ -2107,7 +2122,7 @@ zoran_do_ioctl (struct inode *inode,
vpict->colour, vpict->contrast, vpict->depth,
vpict->palette);

for (i = 0; i < zoran_num_formats; i++) {
for (i = 0; i < NUM_FORMATS; i++) {
const struct zoran_format *fmt = &zoran_formats[i];

if (fmt->palette != -1 &&
Expand All @@ -2116,7 +2131,7 @@ zoran_do_ioctl (struct inode *inode,
fmt->depth == vpict->depth)
break;
}
if (i == zoran_num_formats) {
if (i == NUM_FORMATS) {
dprintk(1,
KERN_ERR
"%s: VIDIOCSPICT - Invalid palette %d\n",
Expand Down Expand Up @@ -2220,10 +2235,10 @@ zoran_do_ioctl (struct inode *inode,
ZR_DEVNAME(zr), vbuf->base, vbuf->width,
vbuf->height, vbuf->depth, vbuf->bytesperline);

for (i = 0; i < zoran_num_formats; i++)
for (i = 0; i < NUM_FORMATS; i++)
if (zoran_formats[i].depth == vbuf->depth)
break;
if (i == zoran_num_formats) {
if (i == NUM_FORMATS) {
dprintk(1,
KERN_ERR
"%s: VIDIOCSFBUF - invalid fbuf depth %d\n",
Expand Down Expand Up @@ -2672,14 +2687,14 @@ zoran_do_ioctl (struct inode *inode,
return -EINVAL;
}

for (i = 0; i < zoran_num_formats; i++) {
for (i = 0; i < NUM_FORMATS; i++) {
if (zoran_formats[i].flags & flag)
num++;
if (num == fmt->index)
break;
}
if (fmt->index < 0 /* late, but not too late */ ||
i == zoran_num_formats)
i == NUM_FORMATS)
return -EINVAL;

memset(fmt, 0, sizeof(*fmt));
Expand Down Expand Up @@ -2942,11 +2957,11 @@ zoran_do_ioctl (struct inode *inode,
sfmtjpg_unlock_and_return:
mutex_unlock(&zr->resource_lock);
} else {
for (i = 0; i < zoran_num_formats; i++)
for (i = 0; i < NUM_FORMATS; i++)
if (fmt->fmt.pix.pixelformat ==
zoran_formats[i].fourcc)
break;
if (i == zoran_num_formats) {
if (i == NUM_FORMATS) {
dprintk(1,
KERN_ERR
"%s: VIDIOC_S_FMT - unknown/unsupported format 0x%x (%4.4s)\n",
Expand Down Expand Up @@ -3055,10 +3070,10 @@ zoran_do_ioctl (struct inode *inode,
fb->fmt.bytesperline, fb->fmt.pixelformat,
(char *) &printformat);

for (i = 0; i < zoran_num_formats; i++)
for (i = 0; i < NUM_FORMATS; i++)
if (zoran_formats[i].fourcc == fb->fmt.pixelformat)
break;
if (i == zoran_num_formats) {
if (i == NUM_FORMATS) {
dprintk(1,
KERN_ERR
"%s: VIDIOC_S_FBUF - format=0x%x (%4.4s) not allowed\n",
Expand Down Expand Up @@ -4151,11 +4166,11 @@ zoran_do_ioctl (struct inode *inode,
V4L2_BUF_TYPE_VIDEO_CAPTURE) {
int i;

for (i = 0; i < zoran_num_formats; i++)
for (i = 0; i < NUM_FORMATS; i++)
if (zoran_formats[i].fourcc ==
fmt->fmt.pix.pixelformat)
break;
if (i == zoran_num_formats) {
if (i == NUM_FORMATS) {
res = -EINVAL;
goto tryfmt_unlock_and_return;
}
Expand Down

0 comments on commit af9e9ad

Please sign in to comment.