<div class="gmail_quote">
<div class="gmail_quote">
<div class="gmail_quote">
<div class="im">
<div>Hi All, </div>
<div> </div>
<div>I am trying to run multi-instance of H.264 decoder. </div>
<div>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. </div>
<div>   Left window  is instance 1 </div>
<div>  Right window is instance 2</div>
<div>I am not doing any buffer creations. </div>
<div><span><font size="3"></font></span> </div>
<div> </div></div>
<div><strong><img title="?ui=2&amp;view=att&amp;th=1250b4fe2869f2b0&amp;attid=0.1&amp;disp=attd&amp;realattid=ii_1250b4fe2869f2b0&amp;zw" height="41" alt="?ui=2&amp;view=att&amp;th=1250b4fe2869f2b0&amp;attid=0.1&amp;disp=attd&amp;realattid=ii_1250b4fe2869f2b0&amp;zw" src="cid:ii_1250b4fe2869f2b0" width="74"></strong>  these colors alternate in every vaPutSurface call</div>

<div> Left window is Instance 1 - Right window is Instance 2</div>
<div>
<div></div>
<div class="h5">
<div><strong></strong> </div>
<div><strong></strong> </div>
<div>When I do not call <strong>vaTernminate</strong> 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). </div>

<div> </div>
<div>Is this a bug or do i need to take care of someother things for multi-instance creation. </div>
<div><font size="3"><font face="arial,helvetica,sans-serif"><span style="FONT-SIZE: 12pt; FONT-FAMILY: &#39;Times New Roman&#39;,&#39;serif&#39;"></span></font></font><strong></strong> </div>
<div><strong>Here is the Sequence of calls</strong></div>
<div>  </div>
<div>
<div>
<div>XOpenDisplay;<br>vaGetDisplay   </div>
<div>vaInitialize</div>
<div>XCreateSimpleWindow</div>
<div> </div>
<div>    - vaCreateConfig, vaCreateConfig1 (<strong>VAProfileH264Main</strong>)<br>    - vaCreateSurfaces, vaCreateSurfaces1<br>    - vaCreateContext, vaCreateContext1</div>
<div> </div>
<div>loop</div>
<div>{</div>
<div>  vaSyncSurface(--, vaContext, vaSurface);<br>  vaPutSurface(--,vaSurface,---------);</div>
<div>  </div>
<div>  vaSyncSurface(--, vaContext1, vaSurface1);<br>  vaPutSurface(--,vaSurface1,------------);</div>
<div>}</div>
<div><br>     - DestroyContext, DestroyContext1<br>     - DestroySurfaces, DestroySurfaces1<br>     - DestroyConfig,DestroyConfig1<br></div>
<div>vaTerminate</div>
<div>XCloseDisplay</div>
<div> </div>
<div>---------------------------------<br><strong>Details of the Setup<br></strong>----------------------------------<br>Board            - <strong>NANO-8044-1600<br></strong>Platform        -  <strong>Atom Z530 + Poulsbo US15W  <br>
</strong>IEGDVersion -  <strong>10.2.1447</strong><br>Libva Version -  <strong>Rev. 0.29<br></strong>OS                - <strong>Ubuntu 8.04</strong></div>
<div> </div>
<div>  </div></div></div>
<div><strong>Here is the code</strong></div>
<div> </div>
<div>int main(int argc,char **argv)<br>{<br>    VAEntrypoint entrypoints[5];<br>    int num_entrypoints,vld_entrypoint;<br>    VAConfigAttrib attrib;<br> <br>    VAConfigID config_id;<br>    VASurfaceID vaSurface;<br>    VAContextID vaContext;<br>
 <br>    VAConfigID config_id1;<br>   VASurfaceID vaSurface1;<br>    VAContextID vaContext1;<br> <br> <br>    VABufferID vaSliceDataBuf;<br> <br>    int major_ver, minor_ver;<br>    Display *x11_display;<br>    VADisplay vaDisplay;<br>
    VAStatus vaStatus;<br>    Window win = 0;<br> <br>    int i;<br> <br> <br>    x11_display = XOpenDisplay(NULL);<br>    vaDisplay = vaGetDisplay(x11_display);<br>    vaStatus = vaInitialize(vaDisplay, &amp;major_ver, &amp;minor_ver);<br>
 <br>    win = XCreateSimpleWindow(x11_display,RootWindow(x11_display, 0),0, 0,720,480,0, 0,WhitePixel(x11_display, 255));<br> XMapWindow(x11_display, win);<br> XSync(x11_display, True);<br> <br> <br> <br>    vaStatus = vaQueryConfigEntrypoints(vaDisplay,VAProfileH264Main,entrypoints,&amp;num_entrypoints);<br>
 <br> if(VA_STATUS_SUCCESS != vaStatus) {<br>  printf(&quot;QueryEntryPoints :%d\n&quot;, vaStatus);<br>  exit(-1);<br> }<br> <br>    for (vld_entrypoint = 0; vld_entrypoint &lt; num_entrypoints; vld_entrypoint++) {<br>  <br>
  if (entrypoints[vld_entrypoint] == VAEntrypointVLD)<br>            break;<br>    }<br>    if (vld_entrypoint == num_entrypoints) {<br>        /* not find VLD entry point */<br>        exit(-1);<br>    }<br> <br> <br>    attrib.type = VAConfigAttribRTFormat;<br>
 <br>    vaStatus = vaGetConfigAttributes(vaDisplay,VAProfileH264Main,VAEntrypointVLD,&amp;attrib,1);<br>    if ((attrib.value &amp; VA_RT_FORMAT_YUV420) == 0)    {<br>        /* not find desired YUV420 RT format */<br>        exit(-1);<br>
    }<br> <br> vaStatus = vaCreateConfig(vaDisplay,VAProfileH264Main,VAEntrypointVLD,&amp;attrib,1,&amp;config_id);<br> vaStatus = vaCreateConfig(vaDisplay,VAProfileH264Main,VAEntrypointVLD,&amp;attrib,1,&amp;config_id1);<br>
 <br> if(VA_STATUS_SUCCESS != vaStatus) {<br>  printf(&quot;vaCreateConfig Failure:%d\n&quot;, vaStatus);<br>  exit(-1);<br> }<br> <br> vaStatus = vaCreateSurfaces(vaDisplay,352,240_HEIGHT,VA_RT_FORMAT_YUV420,1,&amp;vaSurface);<br>
 vaStatus = vaCreateSurfaces(vaDisplay,352,240,VA_RT_FORMAT_YUV420,1,&amp;vaSurface1);<br> <br> if(VA_STATUS_SUCCESS != vaStatus) {<br>  printf(&quot;vaCreateSurfaces Failure :%d\n&quot;, vaStatus);<br>  return -1;<br> }<br>
 <br>    /* Create a context for this decode pipe */<br>    vaStatus = vaCreateContext(vaDisplay, config_id,352,240,VA_PROGRESSIVE,&amp;vaSurface,1,&amp;vaContext);<br>    vaStatus = vaCreateContext(vaDisplay, config_id,352,240,VA_PROGRESSIVE,&amp;vaSurface,1,&amp;vaContext1);<br>
 <br> if(VA_STATUS_SUCCESS != vaStatus) {<br>  printf(&quot;vaCreateContext Failure :%d\n&quot;, vaStatus);<br>  return -1;<br> }<br> <br> <br> for(i=0;i&lt;200;i++)<br> {<br>  vaStatus = vaSyncSurface(vaDisplay, vaContext, vaSurface);<br>
  vaStatus = vaPutSurface(vaDisplay,vaSurface,win,0,0,352,240,0,0,352,240,NULL,0,0);<br>  <br>  vaStatus = vaSyncSurface(vaDisplay, vaContext1, vaSurface1);<br>  vaStatus = vaPutSurface(vaDisplay,vaSurface1,win,0,0,352,240,360,0,352,240,NULL,0,0);<br>
  <br>  <br> }<br> vaDestroyContext(vaDisplay,vaContext);<br>    vaDestroySurfaces(vaDisplay,&amp;vaSurface,1);<br>    vaDestroyConfig(vaDisplay,config_id);<br> <br> vaDestroyContext(vaDisplay,vaContext1);<br> vaDestroySurfaces(vaDisplay,&amp;vaSurface1,1);<br>
 vaDestroyConfig(vaDisplay,config_id1);<br> <br>    vaTerminate(vaDisplay);<br>    XCloseDisplay(x11_display);<br>    return 0;<br>}</div>
<div> </div>
<div>Regards,</div>
<div>Sambhav </div></div></div></div><font color="#888888"><br></font></div><br></div><br>