From f7e6dcee73fe7bd95a1f9ae34018dbf4f2412f00 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Fri, 11 Feb 2011 09:07:53 -0200 Subject: 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 --- src/v4l.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) (limited to 'src/v4l.c') 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++) { -- cgit v1.2.3