Exemplo n.º 1
0
void vlInitXvMC(ScreenPtr pScreen, unsigned int num_adaptors, XF86MCAdaptorPtr *adaptors)
{
	ScrnInfoPtr	pScrn;
	int		i;
	
	assert(pScreen);
	assert(adaptors);
	
	for (i = 0; i < num_adaptors; ++i)
		assert(adaptors[i]);
	
	pScrn = xf86Screens[pScreen->myNum];
	
	if (!xf86XvMCScreenInit(pScreen, num_adaptors, adaptors))
		xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "[XvMC] Failed to initialize extension.\n");
	else
		xf86DrvMsg(pScrn->scrnIndex, X_INFO, "[XvMC] Extension initialized.\n");
	
#if (XvMCVersion > 1) || (XvMCRevision > 0)
	/*
	if (xf86XvMCRegisterDRInfo(pScreen, "XvMCg3dvl", "0:0.0", -1, -1, -1) != Success)
		xf86DrvMsg(pScrn->scrnIndex, X_WARNING, "[XvMC] Failed to register client library, using XvMCConfig.\n");
	else
		xf86DrvMsg(pScrn->scrnIndex, X_INFO, "[XvMC] Registered client library.\n");
	*/
#endif
}
void RADEONInitVideo(ScreenPtr pScreen)
{
    ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
    RADEONInfoPtr    info = RADEONPTR(pScrn);
    RADEONEntPtr pRADEONEnt = RADEONEntPriv(pScrn);
    XF86VideoAdaptorPtr *adaptors, *newAdaptors = NULL;
    XF86VideoAdaptorPtr texturedAdaptor = NULL;
    int num_adaptors;

    /* no overlay or 3D on RN50 */
    if (info->ChipFamily == CHIP_FAMILY_RV100 && !pRADEONEnt->HasCRTC2)
	    return;

    num_adaptors = xf86XVListGenericAdaptors(pScrn, &adaptors);
    newAdaptors = malloc((num_adaptors + 2) * sizeof(XF86VideoAdaptorPtr *));
    if (newAdaptors == NULL)
	return;

    memcpy(newAdaptors, adaptors, num_adaptors * sizeof(XF86VideoAdaptorPtr));
    adaptors = newAdaptors;

    if (info->use_glamor) {
        texturedAdaptor = radeon_glamor_xv_init(pScreen, 16);
	if (texturedAdaptor != NULL) {
	    adaptors[num_adaptors++] = texturedAdaptor;
	    xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Set up textured video (glamor)\n");
	} else
	    xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Failed to set up textured video (glamor)\n");
    } else if ((info->ChipFamily < CHIP_FAMILY_RS400)
	|| (info->directRenderingEnabled)
	) {
	texturedAdaptor = RADEONSetupImageTexturedVideo(pScreen);
	if (texturedAdaptor != NULL) {
	    adaptors[num_adaptors++] = texturedAdaptor;
	    xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Set up textured video\n");
	} else
	    xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Failed to set up textured video\n");
    } else
	xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Textured video requires CP on R5xx/R6xx/R7xx/IGP\n");

    if(num_adaptors)
	xf86XVScreenInit(pScreen, adaptors, num_adaptors);

    if(texturedAdaptor) {
	XF86MCAdaptorPtr xvmcAdaptor = RADEONCreateAdaptorXvMC(pScreen, (char *)texturedAdaptor->name);
	if(xvmcAdaptor) {
	    if(!xf86XvMCScreenInit(pScreen, 1, &xvmcAdaptor))
		xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "[XvMC] Failed to initialize extension.\n");
	    else
		xf86DrvMsg(pScrn->scrnIndex, X_INFO, "[XvMC] Extension initialized.\n");
	}
    }

    if(newAdaptors)
	free(newAdaptors);

}
Exemplo n.º 3
0
void
xorg_xvmc_init(ScreenPtr pScreen, char *name)
{
   ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
   XF86MCAdaptorPtr adaptorXvMC = xf86XvMCCreateAdaptorRec();
   if (!adaptorXvMC)
      return;

   *adaptorXvMC = adaptor_template;
   adaptorXvMC->name = name;
   xf86DrvMsg(pScrn->scrnIndex, X_INFO,
              "[XvMC] Associated with %s.\n", name);
   if (!xf86XvMCScreenInit(pScreen, 1, &adaptorXvMC))
      xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
                 "[XvMC] Failed to initialize extension.\n");
   else
      xf86DrvMsg(pScrn->scrnIndex, X_INFO,
                 "[XvMC] Extension initialized.\n");
   xf86XvMCDestroyAdaptorRec(adaptorXvMC);
}
Exemplo n.º 4
0
/**************************************************************************
 *
 *  I810InitMC
 *
 *  Initialize the hardware motion compensation extension for this
 *  hardware. The initialization routines want the address of the pointers
 *  to the structures, not the address of the structures. This means we
 *  allocate (or create static?) the pointer memory and pass that 
 *  address. This seems a little convoluted.
 *
 *  We need to allocate memory for the device depended adaptor record. 
 *  This is what holds the pointers to all our device functions.
 *
 *  We need to map the overlay registers into the drm.
 *
 *  We need to map the surfaces into the drm.
 *
 *  Inputs:
 *    Screen pointer
 *
 *  Outputs:
 *    None, this calls the device independent screen initialization 
 *    function.
 *
 *  Revisions:
 *  
 **************************************************************************/
void I810InitMC(ScreenPtr pScreen)
{
  ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
  I810Ptr pI810 = I810PTR(pScrn);
  int i;

  /* Clear the Surface Allocation */
  for(i=0; i<I810_MAX_SURFACES; i++) {
	pI810->surfaceAllocation[i] = 0;
  }  

  /* Cursor is at a page boundary, Overlay regs are not, don't forget */
  if (drmAddMap(pI810->drmSubFD, (drm_handle_t)pI810->CursorStart,
                4096, DRM_AGP, 0, (drmAddress) &pI810->overlay_map) < 0) {
    xf86DrvMsg(pScreen->myNum, X_ERROR, "drmAddMap(overlay) failed\n");
    return;
  }
  if (drmAddMap(pI810->drmSubFD, (drm_handle_t)pI810->MC.Start,
                pI810->MC.Size, DRM_AGP, 0, (drmAddress) &pI810->mc_map) < 0) {
    xf86DrvMsg(pScreen->myNum, X_ERROR, "drmAddMap(MC) failed\n");
    return;
  }
  xf86XvMCScreenInit(pScreen, 1, ppAdapt);
}
void
ViaInitXVMC(ScreenPtr pScreen)
{
    ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
    VIAPtr pVia = VIAPTR(pScrn);
    ViaXvMCPtr vXvMC = &(pVia->xvmc);
    volatile ViaXvMCSAreaPriv *saPriv;

    pVia->XvMCEnabled = 0;

    if ((pVia->Chipset == VIA_KM400) ||
        (pVia->Chipset == VIA_CX700) ||
        (pVia->Chipset == VIA_K8M890) ||
        (pVia->Chipset == VIA_P4M900) ||
        (pVia->Chipset == VIA_VX800) ||
        (pVia->Chipset == VIA_VX855) ||
        (pVia->Chipset == VIA_VX900)) {
        xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
                   "[XvMC] XvMC is not supported on this chipset.\n");
        return;
    }

    if (!pVia->directRenderingType) {
        xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
                   "[XvMC] Cannot use XvMC without DRI!\n");
        return;
    }

    if (((pVia->drmVerMajor <= 2) && (pVia->drmVerMinor < 4))) {
        xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
                   "[XvMC] Kernel drm is not compatible with XvMC.\n");
        xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
                   "[XvMC] Kernel drm version is %d.%d.%d; "
                   "at least version 2.4.0 is needed.\n",
                   pVia->drmVerMajor, pVia->drmVerMinor, pVia->drmVerPL);
        xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
                   "[XvMC] Please update. Disabling XvMC.\n");
        return;
    }

    vXvMC->mmioBase = pVia->registerHandle;

    if (drmAddMap(pVia->drmmode.fd,
                  (drm_handle_t) pVia->FrameBufferBase,
                  pVia->videoRambytes, DRM_FRAME_BUFFER, 0,
                  &(vXvMC->fbBase)) < 0) {
        xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
                   "[XvMC] drmAddMap(FB) failed. Disabling XvMC.\n");
        return;
    }

    initViaXvMC(vXvMC);

    if (!xf86XvMCScreenInit(pScreen, 1, ((pVia->Chipset == VIA_PM800)
                                         ? ppAdapt_pga : ppAdapt))) {
        xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
                   "[XvMC] XvMCScreenInit failed. Disabling XvMC.\n");
        drmRmMap(pVia->drmmode.fd, vXvMC->fbBase);
        return;
    }
#if (XvMCVersion > 1) || (XvMCRevision > 0)
    {
        DRIInfoPtr pDRIInfo = pVia->pDRIInfo;

        if (pVia->ChipId != PCI_CHIP_VT3259 &&
            pVia->ChipId != PCI_CHIP_VT3364) {
            xf86DrvMsg(pScrn->scrnIndex, X_INFO,
                       "[XvMC] Registering chromeXvMC.\n");
            xf86XvMCRegisterDRInfo(pScreen, "chromeXvMC", pDRIInfo->busIdString,
                                   VIAXVMC_MAJOR, VIAXVMC_MINOR, VIAXVMC_PL);
        } else {
            xf86DrvMsg(pScrn->scrnIndex, X_INFO,
                       "[XvMC] Registering chromeXvMCPro.\n");
            xf86XvMCRegisterDRInfo(pScreen, "chromeXvMCPro",
                                   pDRIInfo->busIdString, VIAXVMC_MAJOR,
                                   VIAXVMC_MINOR, VIAXVMC_PL);
        }
    }
#endif

    vXvMC->activePorts = 0;
    saPriv = (ViaXvMCSAreaPriv *) DRIGetSAREAPrivate(pScreen);
    saPriv->XvMCCtxNoGrabbed = ~0;

    XVMCLOCKPTR(saPriv, UNICHROME_LOCK_DECODER1)->lock = 0;

    xf86DrvMsg(pScrn->scrnIndex, X_INFO,
               "[XvMC] Initialized XvMC extension.\n");
    pVia->XvMCEnabled = 1;
}