Adding XV capabilities to a driver

Helmut Auer vdr at helmutauer.de
Sat May 26 14:35:18 PDT 2007


Hello Alex
>> ...
>> but xvinfo tells me:
>>
>> X-Video Extension version 2.2
>> screen #0
>>  no adaptors present
>>
>> I cannot see any errors, but xv is not present :(
>>     
>
> Make sure that your initvideo() function is called in your driver's
> screeninit() function and that your initvideo() function actually
> allocates an adapter and calls xf86XVScreenInit().  Take a look at
> another driver for an example.  radeon calls RADEONInitVideo() from
> RADEONScreenInit() and RADEONInitVideo() allocates the Xv adapter and
> calls xf86XVScreenInit().
>
>   
the xf86XVScreenInit will be called ( See code below ).
The log shows:
(EE) Tvia(0): Init XvInit (0)
(EE) Tvia(0): Init XvInit new
(EE) Tvia(0): num_adaptors:1

Bye
Helmut

> Alex
>
>   

void TviaInitVideo(ScreenPtr pScreen)
{
   ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
   XF86VideoAdaptorPtr *adaptors, *newAdaptors = NULL;
   XF86VideoAdaptorPtr newAdaptor = NULL;
   int num_adaptors;

   newAdaptor = TviaSetupVideo(pScreen);
   num_adaptors = xf86XVListGenericAdaptors(pScrn, &adaptors);

   XV_debug("Initialize Video \n");
   xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
              "Init XvInit (%d)\n",num_adaptors );

   if (newAdaptor) {
      xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
                 "Init XvInit new\n" );
      if (!num_adaptors) {
         num_adaptors = 1;
         adaptors = &newAdaptor;
      }
      else {
         newAdaptors =  /* need to free this someplace */
                        xalloc((num_adaptors + 1) * 
sizeof(XF86VideoAdaptorPtr*));
         if (newAdaptors) {
            memcpy(newAdaptors, adaptors, num_adaptors *
                   sizeof(XF86VideoAdaptorPtr));
            newAdaptors[num_adaptors] = newAdaptor;
            adaptors = newAdaptors;
            num_adaptors++;
         }
      }
   }
   XV_debug("num_adaptors:%x\n",num_adaptors);
   xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
              "num_adaptors:%x\n",num_adaptors);
   if (num_adaptors)
      xf86XVScreenInit(pScreen, adaptors, num_adaptors);

   if (newAdaptors)
      xfree(newAdaptors);
}




More information about the xorg mailing list