<div class="MsoNormal" style="MARGIN: 0in 0in 10pt">
<div>Hi All,</div>
<div> </div>
<div>I am trying to derive an image buffer from  a VA Surface using vaDeriveImage API. </div>
<div>But once I call this API I am not getting any valid data in the output argument VAImage.</div>
<div>The code is given below. </div>
<div> </div>
<div>
<div>The sample application present at <a href="http://cgit.freedesktop.org/libva/tree/test/putsurface">http://cgit.freedesktop.org/libva/tree/test/putsurface</a> also failed. </div>
<div> </div></div>
<div>Is this API supported in the following setup ?</div>
<div><strong></strong> </div>
<div><strong>Board</strong>              - Portwell NANO-8044-1600<br><strong>Platform</strong>          -  Atom Z530 + Poulsbo US15W  <br><strong>IEGDVersion</strong>    -  10.2.1447<br><strong>Libva Version</strong>  -  Rev. 0.29<br>
<strong>OS</strong>                   - Ubuntu 8.04</div>
<div> </div>
<div> </div>
<div>Here is my code:</div>
<div>The width and height of the VA surface is 352x288. But the output of vaDeriveImage is 0x0</div>
<div><span style="FONT-SIZE: 9pt; LINE-HEIGHT: 115%; FONT-FAMILY: &#39;Courier New&#39;"></span> </div>
<div><span style="FONT-SIZE: 9pt; LINE-HEIGHT: 115%; FONT-FAMILY: &#39;Courier New&#39;">#define SURFACE_NUM 1</span></div></div>
<p class="MsoNormal" style="MARGIN: 0in 0in 10pt"><span style="FONT-SIZE: 9pt; LINE-HEIGHT: 115%; FONT-FAMILY: &#39;Courier New&#39;">#define CHECK_VASTATUS(va_status,func)<span>                                  </span>\</span></p>

<p class="MsoNormal" style="MARGIN: 0in 0in 10pt"><span style="FONT-SIZE: 9pt; LINE-HEIGHT: 115%; FONT-FAMILY: &#39;Courier New&#39;">if (va_status != VA_STATUS_SUCCESS) {<span>                                   </span>\</span></p>

<p class="MsoNormal" style="MARGIN: 0in 0in 10pt"><span style="FONT-SIZE: 9pt; LINE-HEIGHT: 115%; FONT-FAMILY: &#39;Courier New&#39;"><span>    </span>fprintf(stderr,&quot;%s:%s (%d) failed,exit\n&quot;, __func__, func, __LINE__); \</span></p>

<p class="MsoNormal" style="MARGIN: 0in 0in 10pt"><span style="FONT-SIZE: 9pt; LINE-HEIGHT: 115%; FONT-FAMILY: &#39;Courier New&#39;"><span>    </span>exit(1);<span>                                                            </span>\</span></p>

<p class="MsoNormal" style="MARGIN: 0in 0in 10pt"><span style="FONT-SIZE: 9pt; LINE-HEIGHT: 115%; FONT-FAMILY: &#39;Courier New&#39;">}</span></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 10pt"><span style="FONT-SIZE: 9pt; LINE-HEIGHT: 115%; FONT-FAMILY: &#39;Courier New&#39;">int main(int argc,char **argv)</span></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 10pt"><span style="FONT-SIZE: 9pt; LINE-HEIGHT: 115%; FONT-FAMILY: &#39;Courier New&#39;">{</span></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 10pt"><span style="FONT-SIZE: 9pt; LINE-HEIGHT: 115%; FONT-FAMILY: &#39;Courier New&#39;"><span>       </span>VAStatus va_status;</span></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 10pt"><span style="FONT-SIZE: 9pt; LINE-HEIGHT: 115%; FONT-FAMILY: &#39;Courier New&#39;"><span>       </span>VAImage surface_image;</span></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 10pt"><span style="FONT-SIZE: 9pt; LINE-HEIGHT: 115%; FONT-FAMILY: &#39;Courier New&#39;"><span>       </span>static<span>  </span>Display *x11_display;</span></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 10pt"><span style="FONT-SIZE: 9pt; LINE-HEIGHT: 115%; FONT-FAMILY: &#39;Courier New&#39;"><span>       </span>static<span>  </span>VADisplay *va_dpy;</span></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 10pt"><span style="FONT-SIZE: 9pt; LINE-HEIGHT: 115%; FONT-FAMILY: &#39;Courier New&#39;"><span>       </span>int major_ver, minor_ver;</span></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 10pt"><span style="FONT-SIZE: 9pt; LINE-HEIGHT: 115%; FONT-FAMILY: &#39;Courier New&#39;"><span>       </span>static<span>  </span>VASurfaceID surface_id[SURFACE_NUM];</span></p>

<p class="MsoNormal" style="MARGIN: 0in 0in 10pt"><span style="FONT-SIZE: 9pt; LINE-HEIGHT: 115%; FONT-FAMILY: &#39;Courier New&#39;"><span>       </span>static<span>  </span>int width=352, height=288;</span></p>
<div class="MsoNormal" style="MARGIN: 0in 0in 10pt"><span style="FONT-SIZE: 9pt; LINE-HEIGHT: 115%; FONT-FAMILY: &#39;Courier New&#39;"><span>       </span>void *surface_p=NULL;</span></div>
<div class="MsoNormal" style="MARGIN: 0in 0in 10pt"><span style="FONT-SIZE: 9pt; LINE-HEIGHT: 115%; FONT-FAMILY: &#39;Courier New&#39;">       int screen; </span></div>
<div class="MsoNormal" style="MARGIN: 0in 0in 10pt"><span style="FONT-SIZE: 9pt; LINE-HEIGHT: 115%; FONT-FAMILY: &#39;Courier New&#39;">       Window root, win;</span></div>
<div class="MsoNormal" style="MARGIN: 0in 0in 10pt"><span style="FONT-SIZE: 9pt; LINE-HEIGHT: 115%; FONT-FAMILY: &#39;Courier New&#39;"> </span></div>
<div class="MsoNormal" style="MARGIN: 0in 0in 10pt"><span style="FONT-SIZE: 9pt; LINE-HEIGHT: 115%; FONT-FAMILY: &#39;Courier New&#39;"></span><span style="FONT-SIZE: 9pt; LINE-HEIGHT: 115%; FONT-FAMILY: &#39;Courier New&#39;"><span>   </span><span>   </span><span> </span>x11_display = XOpenDisplay(&quot;:0.0&quot;);</span></div>

<p class="MsoNormal" style="MARGIN: 0in 0in 10pt; TEXT-INDENT: 0.5in"><span style="FONT-SIZE: 9pt; LINE-HEIGHT: 115%; FONT-FAMILY: &#39;Courier New&#39;">if (x11_display == NULL) {</span></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 10pt"><span style="FONT-SIZE: 9pt; LINE-HEIGHT: 115%; FONT-FAMILY: &#39;Courier New&#39;"><span>       </span><span>        </span>fprintf(stderr, &quot;Can&#39;t connect X server!\n&quot;);</span></p>

<p class="MsoNormal" style="MARGIN: 0in 0in 10pt"><span style="FONT-SIZE: 9pt; LINE-HEIGHT: 115%; FONT-FAMILY: &#39;Courier New&#39;"><span>       </span><span>        </span>exit(-1);</span></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 10pt"><span style="FONT-SIZE: 9pt; LINE-HEIGHT: 115%; FONT-FAMILY: &#39;Courier New&#39;"><span>       </span>}</span></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 10pt"><span style="FONT-SIZE: 9pt; LINE-HEIGHT: 115%; FONT-FAMILY: &#39;Courier New&#39;"><span>       </span>screen = DefaultScreen(x11_display);</span></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 10pt"><span style="FONT-SIZE: 9pt; LINE-HEIGHT: 115%; FONT-FAMILY: &#39;Courier New&#39;"><span>       </span></span><span style="FONT-SIZE: 9pt; LINE-HEIGHT: 115%; FONT-FAMILY: &#39;Courier New&#39;">root = RootWindow(x11_display, screen);</span></p>

<p class="MsoNormal" style="MARGIN: 0in 0in 10pt"><span style="FONT-SIZE: 9pt; LINE-HEIGHT: 115%; FONT-FAMILY: &#39;Courier New&#39;"><span>       </span>win = XCreateSimpleWindow(x11_display, root, 0, 0, width, height,0, 0, WhitePixel(x11_display, 0));</span></p>

<p class="MsoNormal" style="MARGIN: 0in 0in 10pt"><span style="FONT-SIZE: 9pt; LINE-HEIGHT: 115%; FONT-FAMILY: &#39;Courier New&#39;"> </span><span style="FONT-SIZE: 9pt; LINE-HEIGHT: 115%; FONT-FAMILY: &#39;Courier New&#39;"><span>      </span>XMapWindow(x11_display, win);</span></p>

<p class="MsoNormal" style="MARGIN: 0in 0in 10pt"><span style="FONT-SIZE: 9pt; LINE-HEIGHT: 115%; FONT-FAMILY: &#39;Courier New&#39;"><span>       </span>XSync(x11_display, False);</span></p>
<div class="MsoNormal" style="MARGIN: 0in 0in 10pt"><span style="FONT-SIZE: 9pt; LINE-HEIGHT: 115%; FONT-FAMILY: &#39;Courier New&#39;"><span> </span></span></div>
<div class="MsoNormal" style="MARGIN: 0in 0in 10pt"><span style="FONT-SIZE: 9pt; LINE-HEIGHT: 115%; FONT-FAMILY: &#39;Courier New&#39;"><span>       </span>va_dpy = vaGetDisplay(x11_display);</span></div>
<p class="MsoNormal" style="MARGIN: 0in 0in 10pt"><span style="FONT-SIZE: 9pt; LINE-HEIGHT: 115%; FONT-FAMILY: &#39;Courier New&#39;"><span>       </span>va_status = vaInitialize(va_dpy, &amp;major_ver, &amp;minor_ver);</span></p>

<p class="MsoNormal" style="MARGIN: 0in 0in 10pt"><span style="FONT-SIZE: 9pt; LINE-HEIGHT: 115%; FONT-FAMILY: &#39;Courier New&#39;"><span>       </span>CHECK_VASTATUS(va_status, &quot;vaInitialize&quot;);</span></p>
<div class="MsoNormal" style="MARGIN: 0in 0in 10pt"><span style="FONT-SIZE: 9pt; LINE-HEIGHT: 115%; FONT-FAMILY: &#39;Courier New&#39;"><span></span></span> </div>
<div class="MsoNormal" style="MARGIN: 0in 0in 10pt"><span style="FONT-SIZE: 9pt; LINE-HEIGHT: 115%; FONT-FAMILY: &#39;Courier New&#39;"><span>       </span>va_status = vaCreateSurfaces(va_dpy,width, height,VA_RT_FORMAT_YUV420, SURFACE_NUM, &amp;surface_id[0]);</span></div>

<p class="MsoNormal" style="MARGIN: 0in 0in 10pt"><span style="FONT-SIZE: 9pt; LINE-HEIGHT: 115%; FONT-FAMILY: &#39;Courier New&#39;"><span>       </span>CHECK_VASTATUS(va_status, &quot;vaCreateSurfaces&quot;);</span></p>

<div class="MsoNormal" style="MARGIN: 0in 0in 10pt"><span style="FONT-SIZE: 9pt; LINE-HEIGHT: 115%; FONT-FAMILY: &#39;Courier New&#39;"><span></span></span> </div>
<div class="MsoNormal" style="MARGIN: 0in 0in 10pt"><span style="FONT-SIZE: 9pt; LINE-HEIGHT: 115%; FONT-FAMILY: &#39;Courier New&#39;"><span>       </span>va_status = vaDeriveImage(va_dpy,surface_id[0],&amp;surface_image);</span></div>

<p class="MsoNormal" style="MARGIN: 0in 0in 10pt"><span style="FONT-SIZE: 9pt; LINE-HEIGHT: 115%; FONT-FAMILY: &#39;Courier New&#39;"><span>       </span>CHECK_VASTATUS(va_status,&quot;vaDeriveImage&quot;);</span></p>
<div class="MsoNormal" style="MARGIN: 0in 0in 10pt"><span style="FONT-SIZE: 9pt; LINE-HEIGHT: 115%; FONT-FAMILY: &#39;Courier New&#39;"><span></span></span> </div>
<div class="MsoNormal" style="MARGIN: 0in 0in 10pt"><span style="FONT-SIZE: 9pt; LINE-HEIGHT: 115%; FONT-FAMILY: &#39;Courier New&#39;"><span>       </span>printf(&quot;Surface Width<span>  </span>:%u\n&quot;,surface_image.width);</span></div>

<p class="MsoNormal" style="MARGIN: 0in 0in 10pt"><span style="FONT-SIZE: 9pt; LINE-HEIGHT: 115%; FONT-FAMILY: &#39;Courier New&#39;"><span>       </span>printf(&quot;Surface Height :%u\n&quot;,surface_image.height);</span></p>

<div class="MsoNormal" style="MARGIN: 0in 0in 10pt; TEXT-INDENT: 0.5in"> </div>
<div class="MsoNormal" style="MARGIN: 0in 0in 10pt; TEXT-INDENT: 0.5in"><span style="FONT-SIZE: 9pt; LINE-HEIGHT: 115%; FONT-FAMILY: &#39;Courier New&#39;">vaDestroySurfaces(va_dpy,&amp;surface_id[0],SURFACE_NUM);</span></div>

<p class="MsoNormal" style="MARGIN: 0in 0in 10pt"><span style="FONT-SIZE: 9pt; LINE-HEIGHT: 115%; FONT-FAMILY: &#39;Courier New&#39;"><span>    </span><span>   </span>vaTerminate(va_dpy);</span></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 10pt"><span style="FONT-SIZE: 9pt; LINE-HEIGHT: 115%; FONT-FAMILY: &#39;Courier New&#39;"></span></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 10pt"><span style="FONT-SIZE: 9pt; LINE-HEIGHT: 115%; FONT-FAMILY: &#39;Courier New&#39;">}</span></p>