Xorg server doesn't support XvPutImage drawing into a Pixmap
Submitted by Austin Yuan
Assigned to Xorg Project Team
Description
When using XvPutImage to draw into a pixmap, it always returns error because hw/xfree86/common/xf86xv.c:xf86XVPutImage checks whether the drawable is WINDOW, if not, it returns BadAlloc directly, see bellow code:
static int xf86XVPutImage( ClientPtr client, DrawablePtr pDraw, XvPortPtr pPort, GCPtr pGC, INT16 src_x, INT16 src_y, CARD16 src_w, CARD16 src_h, INT16 drw_x, INT16 drw_y, CARD16 drw_w, CARD16 drw_h, XvImagePtr format, unsigned char* data, Bool sync, CARD16 width, CARD16 height ){ XvPortRecPrivatePtr portPriv = (XvPortRecPrivatePtr)(pPort->devPriv.ptr); ScreenPtr pScreen; RegionRec WinRegion; RegionRec ClipRegion; BoxRec WinBox; int ret = Success; Bool clippedAway = FALSE;
if (pDraw->type != DRAWABLE_WINDOW) => return BadAlloc;
But usually Xvideo implementation in Xserver video driver will handle WINDOW vs PIXMAP correctly, for example:
if (pDraw->type == DRAWABLE_WINDOW) pPriv->pPixmap = (*pScreen->GetWindowPixmap)((WindowPtr)pDraw); else pPriv->pPixmap = (PixmapPtr)pDraw;
#ifdef USE_EXA if (info->useEXA) { /* Force the pixmap into framebuffer so we can draw to it. */ exaMoveInPixmap(pPriv->pPixmap); } #endif