summaryrefslogtreecommitdiff
path: root/src/v4l.c
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@redhat.com>2011-02-11 09:07:53 -0200
committerMauro Carvalho Chehab <mchehab@redhat.com>2011-02-11 09:24:53 -0200
commitf7e6dcee73fe7bd95a1f9ae34018dbf4f2412f00 (patch)
tree4833f806e2dd60f5a1c5a30a7af5f6a40a194e55 /src/v4l.c
parent6167b289f12ae9edff5640c8dc95eec102db1ee8 (diff)
Fix arguments for v4l_check_yuv
The device name and the file descriptors are wrong at the cal for v4l_check_yuv(). Due to that, the driver were falling back to work with RGB formats. While here, add a code to prevent V4L driver to work if no video adapter provide Xv overlay method. Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'src/v4l.c')
-rw-r--r--src/v4l.c19
1 files changed, 13 insertions, 6 deletions
diff --git a/src/v4l.c b/src/v4l.c
index 877977c..7b3d538 100644
--- a/src/v4l.c
+++ b/src/v4l.c
@@ -351,7 +351,7 @@ static void AddAllV4LControls(PortPrivPtr p, XF86AttributeRec **list,
/* setup yuv overlay + hw scaling: look if we find some common video
format which both v4l driver and the X-Server can handle */
-static void v4l_check_yuv(ScrnInfoPtr pScrn, PortPrivPtr pPPriv,
+static int v4l_check_yuv(ScrnInfoPtr pScrn, PortPrivPtr pPPriv,
char *dev, int fd)
{
static const struct {
@@ -371,7 +371,7 @@ static void v4l_check_yuv(ScrnInfoPtr pScrn, PortPrivPtr pPPriv,
xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 2,
"v4l: Number of Xv formats: %d\n", pPPriv->nformat);
if (!pPPriv->nformat)
- return;
+ return FALSE;
for (fmt = 0; yuvlist[fmt].v4l_palette != 0; fmt++) {
pPPriv->pixelformat = yuvlist[fmt].v4l_palette;
@@ -390,11 +390,11 @@ static void v4l_check_yuv(ScrnInfoPtr pScrn, PortPrivPtr pPPriv,
xf86DrvMsg(pScrn->scrnIndex, X_INFO,
"v4l[%s]: using hw video scaling [%4.4s].\n",
dev,(char*)&(pPPriv->format[i].image->id));
- return;
+ return TRUE;
}
}
}
- return;
+ return TRUE;
}
static int V4lOpenDevice(PortPrivPtr pPPriv, ScrnInfoPtr pScrn)
@@ -1144,7 +1144,15 @@ V4LInit(ScrnInfoPtr pScrn, XF86VideoAdaptorPtr **adaptors)
continue;
}
- xf86Msg(X_INFO, "v4l: %s device supports overlay mode.\n",dev);
+ if (v4l_check_yuv(pScrn, pPPriv, dev, fd) == FALSE) {
+ xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 2,
+ "Xv Overlay not supported. Can't use v4l driver\n");
+ free(pPPriv);
+ close(fd);
+ continue;
+ }
+
+ xf86Msg(X_INFO, "v4l: enabling overlay mode for %s.\n", dev);
strncpy(V4L_NAME, dev, 16);
V4LBuildEncodings(pPPriv, fd);
if (NULL == pPPriv->enc)
@@ -1172,7 +1180,6 @@ V4LInit(ScrnInfoPtr pScrn, XF86VideoAdaptorPtr **adaptors)
}
/* Initialize yuv_format */
- v4l_check_yuv(pScrn, pPPriv, V4L_NAME, V4L_FD);
if (0 != pPPriv->yuv_format) {
/* pass throuth scaler attributes */
for (j = 0; j < pPPriv->myfmt->num_attributes; j++) {