[Libva] Fwd: Problem in multi-instance decode

Sambhav isambhav at gmail.com
Wed Nov 18 23:24:05 PST 2009


 Hi All,

I am trying to run multi-instance of H.264 decoder.
When 1 display surfaces of the both the instances sequentially in a loop, I
am seeing a dark green-light green alternating colors as shown in the
pictures below.
   Left window  is instance 1
  Right window is instance 2
I am not doing any buffer creations.


*[image:
?ui=2&view=att&th=1250b4fe2869f2b0&attid=0.1&disp=attd&realattid=ii_1250b4fe2869f2b0&zw]
*  these colors alternate in every vaPutSurface call
* [image:
?ui=2&view=att&th=1250b500a4f1c145&attid=0.1&disp=attd&realattid=ii_1250b500a4f1c145&zw]
* Left window is Instance 1 - Right window is Instance 2
**
**
When I do not call *vaTernminate* in the first run and then re-run the same
program, the PutSurface is giving proper outputs without any problem. Also
the time taken in the first run is 3-4 times more than the second run(with
vaTerminate not done in first run).

Is this a bug or do i need to take care of someother things for
multi-instance creation.
**
*Here is the Sequence of calls*

 XOpenDisplay;
vaGetDisplay
vaInitialize
XCreateSimpleWindow

    - vaCreateConfig, vaCreateConfig1 (*VAProfileH264Main*)
    - vaCreateSurfaces, vaCreateSurfaces1
    - vaCreateContext, vaCreateContext1

loop
{
  vaSyncSurface(--, vaContext, vaSurface);
  vaPutSurface(--,vaSurface,---------);

  vaSyncSurface(--, vaContext1, vaSurface1);
  vaPutSurface(--,vaSurface1,------------);
}

     - DestroyContext, DestroyContext1
     - DestroySurfaces, DestroySurfaces1
     - DestroyConfig,DestroyConfig1
vaTerminate
XCloseDisplay

---------------------------------
*Details of the Setup
*----------------------------------
Board            - *NANO-8044-1600
*Platform        -  *Atom Z530 + Poulsbo US15W
*IEGDVersion -  *10.2.1447*
Libva Version -  *Rev. 0.29
*OS                - *Ubuntu 8.04*


*Here is the code*

int main(int argc,char **argv)
{
    VAEntrypoint entrypoints[5];
    int num_entrypoints,vld_entrypoint;
    VAConfigAttrib attrib;

    VAConfigID config_id;
    VASurfaceID vaSurface;
    VAContextID vaContext;

    VAConfigID config_id1;
   VASurfaceID vaSurface1;
    VAContextID vaContext1;


    VABufferID vaSliceDataBuf;

    int major_ver, minor_ver;
    Display *x11_display;
    VADisplay vaDisplay;
    VAStatus vaStatus;
    Window win = 0;

    int i;


    x11_display = XOpenDisplay(NULL);
    vaDisplay = vaGetDisplay(x11_display);
    vaStatus = vaInitialize(vaDisplay, &major_ver, &minor_ver);

    win = XCreateSimpleWindow(x11_display,RootWindow(x11_display, 0),0,
0,720,480,0, 0,WhitePixel(x11_display, 255));
 XMapWindow(x11_display, win);
 XSync(x11_display, True);



    vaStatus =
vaQueryConfigEntrypoints(vaDisplay,VAProfileH264Main,entrypoints,&num_entrypoints);

 if(VA_STATUS_SUCCESS != vaStatus) {
  printf("QueryEntryPoints :%d\n", vaStatus);
  exit(-1);
 }

    for (vld_entrypoint = 0; vld_entrypoint < num_entrypoints;
vld_entrypoint++) {

  if (entrypoints[vld_entrypoint] == VAEntrypointVLD)
            break;
    }
    if (vld_entrypoint == num_entrypoints) {
        /* not find VLD entry point */
        exit(-1);
    }


    attrib.type = VAConfigAttribRTFormat;

    vaStatus =
vaGetConfigAttributes(vaDisplay,VAProfileH264Main,VAEntrypointVLD,&attrib,1);
    if ((attrib.value & VA_RT_FORMAT_YUV420) == 0)    {
        /* not find desired YUV420 RT format */
        exit(-1);
    }

 vaStatus =
vaCreateConfig(vaDisplay,VAProfileH264Main,VAEntrypointVLD,&attrib,1,&config_id);
 vaStatus =
vaCreateConfig(vaDisplay,VAProfileH264Main,VAEntrypointVLD,&attrib,1,&config_id1);

 if(VA_STATUS_SUCCESS != vaStatus) {
  printf("vaCreateConfig Failure:%d\n", vaStatus);
  exit(-1);
 }

 vaStatus =
vaCreateSurfaces(vaDisplay,352,240_HEIGHT,VA_RT_FORMAT_YUV420,1,&vaSurface);
 vaStatus =
vaCreateSurfaces(vaDisplay,352,240,VA_RT_FORMAT_YUV420,1,&vaSurface1);

 if(VA_STATUS_SUCCESS != vaStatus) {
  printf("vaCreateSurfaces Failure :%d\n", vaStatus);
  return -1;
 }

    /* Create a context for this decode pipe */
    vaStatus = vaCreateContext(vaDisplay,
config_id,352,240,VA_PROGRESSIVE,&vaSurface,1,&vaContext);
    vaStatus = vaCreateContext(vaDisplay,
config_id,352,240,VA_PROGRESSIVE,&vaSurface,1,&vaContext1);

 if(VA_STATUS_SUCCESS != vaStatus) {
  printf("vaCreateContext Failure :%d\n", vaStatus);
  return -1;
 }


 for(i=0;i<200;i++)
 {
  vaStatus = vaSyncSurface(vaDisplay, vaContext, vaSurface);
  vaStatus =
vaPutSurface(vaDisplay,vaSurface,win,0,0,352,240,0,0,352,240,NULL,0,0);

  vaStatus = vaSyncSurface(vaDisplay, vaContext1, vaSurface1);
  vaStatus =
vaPutSurface(vaDisplay,vaSurface1,win,0,0,352,240,360,0,352,240,NULL,0,0);


 }
 vaDestroyContext(vaDisplay,vaContext);
    vaDestroySurfaces(vaDisplay,&vaSurface,1);
    vaDestroyConfig(vaDisplay,config_id);

 vaDestroyContext(vaDisplay,vaContext1);
 vaDestroySurfaces(vaDisplay,&vaSurface1,1);
 vaDestroyConfig(vaDisplay,config_id1);

    vaTerminate(vaDisplay);
    XCloseDisplay(x11_display);
    return 0;
}

Regards,
Sambhav
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freedesktop.org/archives/libva/attachments/20091119/ee77e0cf/attachment-0001.htm 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: image/jpeg
Size: 14776 bytes
Desc: not available
Url : http://lists.freedesktop.org/archives/libva/attachments/20091119/ee77e0cf/attachment-0002.jpeg 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: image/jpeg
Size: 14715 bytes
Desc: not available
Url : http://lists.freedesktop.org/archives/libva/attachments/20091119/ee77e0cf/attachment-0003.jpeg 


More information about the Libva mailing list