mirror of
https://github.com/X11Libre/xf86-video-v4l.git
synced 2026-03-24 01:25:19 +00:00
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>
This commit is contained in:
19
src/v4l.c
19
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++) {
|
||||
|
||||
Reference in New Issue
Block a user