<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: 'Courier New'"></span> </div>
<div><span style="FONT-SIZE: 9pt; LINE-HEIGHT: 115%; FONT-FAMILY: 'Courier New'">#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: 'Courier New'">#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: 'Courier New'">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: 'Courier New'"><span> </span>fprintf(stderr,"%s:%s (%d) failed,exit\n", __func__, func, __LINE__); \</span></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 10pt"><span style="FONT-SIZE: 9pt; LINE-HEIGHT: 115%; FONT-FAMILY: 'Courier New'"><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: 'Courier New'">}</span></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 10pt"><span style="FONT-SIZE: 9pt; LINE-HEIGHT: 115%; FONT-FAMILY: 'Courier New'">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: 'Courier New'">{</span></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 10pt"><span style="FONT-SIZE: 9pt; LINE-HEIGHT: 115%; FONT-FAMILY: 'Courier New'"><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: 'Courier New'"><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: 'Courier New'"><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: 'Courier New'"><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: 'Courier New'"><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: 'Courier New'"><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: 'Courier New'"><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: 'Courier New'"><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: 'Courier New'"> int screen; </span></div>
<div class="MsoNormal" style="MARGIN: 0in 0in 10pt"><span style="FONT-SIZE: 9pt; LINE-HEIGHT: 115%; FONT-FAMILY: 'Courier New'"> Window root, win;</span></div>
<div class="MsoNormal" style="MARGIN: 0in 0in 10pt"><span style="FONT-SIZE: 9pt; LINE-HEIGHT: 115%; FONT-FAMILY: 'Courier New'"> </span></div>
<div class="MsoNormal" style="MARGIN: 0in 0in 10pt"><span style="FONT-SIZE: 9pt; LINE-HEIGHT: 115%; FONT-FAMILY: 'Courier New'"></span><span style="FONT-SIZE: 9pt; LINE-HEIGHT: 115%; FONT-FAMILY: 'Courier New'"><span> </span><span> </span><span> </span>x11_display = XOpenDisplay(":0.0");</span></div>
<p class="MsoNormal" style="MARGIN: 0in 0in 10pt; TEXT-INDENT: 0.5in"><span style="FONT-SIZE: 9pt; LINE-HEIGHT: 115%; FONT-FAMILY: 'Courier New'">if (x11_display == NULL) {</span></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 10pt"><span style="FONT-SIZE: 9pt; LINE-HEIGHT: 115%; FONT-FAMILY: 'Courier New'"><span> </span><span> </span>fprintf(stderr, "Can't connect X server!\n");</span></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 10pt"><span style="FONT-SIZE: 9pt; LINE-HEIGHT: 115%; FONT-FAMILY: 'Courier New'"><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: 'Courier New'"><span> </span>}</span></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 10pt"><span style="FONT-SIZE: 9pt; LINE-HEIGHT: 115%; FONT-FAMILY: 'Courier New'"><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: 'Courier New'"><span> </span></span><span style="FONT-SIZE: 9pt; LINE-HEIGHT: 115%; FONT-FAMILY: 'Courier New'">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: 'Courier New'"><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: 'Courier New'"> </span><span style="FONT-SIZE: 9pt; LINE-HEIGHT: 115%; FONT-FAMILY: 'Courier New'"><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: 'Courier New'"><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: 'Courier New'"><span> </span></span></div>
<div class="MsoNormal" style="MARGIN: 0in 0in 10pt"><span style="FONT-SIZE: 9pt; LINE-HEIGHT: 115%; FONT-FAMILY: 'Courier New'"><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: 'Courier New'"><span> </span>va_status = vaInitialize(va_dpy, &major_ver, &minor_ver);</span></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 10pt"><span style="FONT-SIZE: 9pt; LINE-HEIGHT: 115%; FONT-FAMILY: 'Courier New'"><span> </span>CHECK_VASTATUS(va_status, "vaInitialize");</span></p>
<div class="MsoNormal" style="MARGIN: 0in 0in 10pt"><span style="FONT-SIZE: 9pt; LINE-HEIGHT: 115%; FONT-FAMILY: 'Courier New'"><span></span></span> </div>
<div class="MsoNormal" style="MARGIN: 0in 0in 10pt"><span style="FONT-SIZE: 9pt; LINE-HEIGHT: 115%; FONT-FAMILY: 'Courier New'"><span> </span>va_status = vaCreateSurfaces(va_dpy,width, height,VA_RT_FORMAT_YUV420, SURFACE_NUM, &surface_id[0]);</span></div>
<p class="MsoNormal" style="MARGIN: 0in 0in 10pt"><span style="FONT-SIZE: 9pt; LINE-HEIGHT: 115%; FONT-FAMILY: 'Courier New'"><span> </span>CHECK_VASTATUS(va_status, "vaCreateSurfaces");</span></p>
<div class="MsoNormal" style="MARGIN: 0in 0in 10pt"><span style="FONT-SIZE: 9pt; LINE-HEIGHT: 115%; FONT-FAMILY: 'Courier New'"><span></span></span> </div>
<div class="MsoNormal" style="MARGIN: 0in 0in 10pt"><span style="FONT-SIZE: 9pt; LINE-HEIGHT: 115%; FONT-FAMILY: 'Courier New'"><span> </span>va_status = vaDeriveImage(va_dpy,surface_id[0],&surface_image);</span></div>
<p class="MsoNormal" style="MARGIN: 0in 0in 10pt"><span style="FONT-SIZE: 9pt; LINE-HEIGHT: 115%; FONT-FAMILY: 'Courier New'"><span> </span>CHECK_VASTATUS(va_status,"vaDeriveImage");</span></p>
<div class="MsoNormal" style="MARGIN: 0in 0in 10pt"><span style="FONT-SIZE: 9pt; LINE-HEIGHT: 115%; FONT-FAMILY: 'Courier New'"><span></span></span> </div>
<div class="MsoNormal" style="MARGIN: 0in 0in 10pt"><span style="FONT-SIZE: 9pt; LINE-HEIGHT: 115%; FONT-FAMILY: 'Courier New'"><span> </span>printf("Surface Width<span> </span>:%u\n",surface_image.width);</span></div>
<p class="MsoNormal" style="MARGIN: 0in 0in 10pt"><span style="FONT-SIZE: 9pt; LINE-HEIGHT: 115%; FONT-FAMILY: 'Courier New'"><span> </span>printf("Surface Height :%u\n",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: 'Courier New'">vaDestroySurfaces(va_dpy,&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: 'Courier New'"><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: 'Courier New'"></span></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 10pt"><span style="FONT-SIZE: 9pt; LINE-HEIGHT: 115%; FONT-FAMILY: 'Courier New'">}</span></p>