<div dir="ltr">Thanks for your suggestion.<br>Yes it gave me some headache, not as much as some other ones related to OpenGL and Xlib but it was significant, I had to write custom code to experiment, also consult ASM code for latest Intel broadwell processors(although any 64 bit processor opcodes would do), debug in assembly etc. -Wall is actually not a good idea since it does throw a lot of unimportant warnings since code base is large. I have fine tuned the list of warnings that I believe absolute necessary, most of them come from -Wall and some additional ones that -Wall doesn't cover. <br><div><br></div><div>Regards,</div><div>Ratin</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Sun, Oct 25, 2015 at 9:51 AM, Emil Velikov <span dir="ltr"><<a href="mailto:emil.l.velikov@gmail.com" target="_blank">emil.l.velikov@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Ratin,<br>
<br>
I would strongly recommend going through the warning and fixing the<br>
(your and/or libva) code. I realise how tedious this might be,<br>
although it will save you a ton of time/headaches in the long run.<br>
Same goes for -Wextra ;-)<br>
<br>
Regards,<br>
Emil<br>
<div class="HOEnZb"><div class="h5"><br>
On 23 October 2015 at 19:15, Ratin <<a href="mailto:ratin3@gmail.com">ratin3@gmail.com</a>> wrote:<br>
> Hi Emil, I only had basic warnings enabled (-Wpedantic -Wformat etc) since I<br>
> get tons of non-severe warnings. I added -Wall and I do get "implicit<br>
> declaration of function 'vaGetDisplay' [-Wimplicit-function-declaration]". I<br>
> will keep this enabled and perhaps redirect compiler output to a file and<br>
> grep for serious warnings.<br>
><br>
> Thanks<br>
><br>
> Ratin<br>
><br>
><br>
><br>
><br>
><br>
><br>
><br>
> On Thu, Oct 22, 2015 at 1:49 AM, Emil Velikov <<a href="mailto:emil.l.velikov@gmail.com">emil.l.velikov@gmail.com</a>><br>
> wrote:<br>
>><br>
>> Hi Ratin,<br>
>><br>
>> Out of curiosity - when you say libva_x11.h you meant<br>
>> /usr/include/va/va_x11.h, is that correct ? Upon closer look, the<br>
>> header seems to be the only place where the function is declared, thus<br>
>> the compiler should have thrown a warning. Do you have those disabled<br>
>> by any chance ?<br>
>><br>
>> Cheers,<br>
>> Emil<br>
>><br>
>><br>
>> On 22 October 2015 at 01:47, Ratin <<a href="mailto:ratin3@gmail.com">ratin3@gmail.com</a>> wrote:<br>
>> > Found the culprit, it was missing header (libva_x11.h). If anybody<br>
>> > interested to know, this caused the compiler to think the function will<br>
>> > return a 32 bit pointer, so the compiler inserted a cltq statement into<br>
>> > the<br>
>> > assembly code which was flipping the upper 32 bits to all 1s.<br>
>> ><br>
>> > On Wed, Oct 21, 2015 at 12:15 PM, Ratin <<a href="mailto:ratin3@gmail.com">ratin3@gmail.com</a>> wrote:<br>
>> >><br>
>> >> # uname -a<br>
>> >> Linux nuc1 3.16.0-51-generic #69~14.04.1-Ubuntu SMP Wed Oct 7 15:32:41<br>
>> >> UTC<br>
>> >> 2015 x86_64 x86_64 x86_64 GNU/Linux<br>
>> >><br>
>> >><br>
>> >><br>
>> >><br>
>> >> On Wed, Oct 21, 2015 at 12:13 PM, Ratin <<a href="mailto:ratin3@gmail.com">ratin3@gmail.com</a>> wrote:<br>
>> >>><br>
>> >>> Breakpoint 1, vaGetDisplay (native_dpy=0x7fffe4312870) at va_x11.c:154<br>
>> >>> 154    {<br>
>> >>> (gdb) list<br>
>> >>> 149<br>
>> >>> 150<br>
>> >>> 151    VADisplay vaGetDisplay (<br>
>> >>> 152        Display *native_dpy /* implementation specific */<br>
>> >>> 153    )<br>
>> >>> 154    {<br>
>> >>> 155      VADisplay dpy = NULL;<br>
>> >>> 156      VADisplayContextP pDisplayContext;<br>
>> >>> 157<br>
>> >>> ;;;<br>
>> >>> 179          pDisplayContext->opaque          = NULL;<br>
>> >>> 177          pDisplayContext->vaDestroy       =<br>
>> >>> va_DisplayContextDestroy;<br>
>> >>> 178          pDisplayContext->vaGetDriverName =<br>
>> >>> va_DisplayContextGetDriverName;<br>
>> >>> 181          dpy                              =<br>
>> >>> (VADisplay)pDisplayContext;<br>
>> >>> 195    }<br>
>> >>> (gdb) p dpy<br>
>> >>> $2 = (VADisplay) 0x7fffe42d3160<br>
>> >>> (gdb) n <========================== stack unroll happens here<br>
>> >>> (gdb) list<br>
>> >>> 935            pVAAPICNTX->vaDisplay = (VADisplay)  <==== upper level<br>
>> >>> code vaGetDisplay(pVAAPICNTX->mX11Display);<br>
>> >>> 936             pVAAPICNTX->voWindow = pRendererParams->mWindow;<br>
>> >>> (gdb) p pVAAPICNTX->vaDisplay<br>
>> >>> $3 = (void *) 0xffffffffe42d3160<br>
>> >>><br>
>> >>><br>
>> >>> pVAAPICNTX is malloced struct ptr and one of the element of it is the<br>
>> >>> vaDisplay declated like this :<br>
>> >>><br>
>> >>> typedef struct _VAAPICNTX<br>
>> >>> {<br>
>> >>>     uint32_t                  VAContextID;<br>
>> >>>    Window                   voWindow;<br>
>> >>>    int voWidth;<br>
>> >>>    int voHeight;<br>
>> >>> ;;;<br>
>> >>> ;;;<br>
>> >>>     VADisplay               vaDisplay;<br>
>> >>><br>
>> >>> ;;;<br>
>> >>><br>
>> >>> ;;;<br>
>> >>><br>
>> >>> }VAAPICNTX, *PVAAPICNTX;<br>
>> >>><br>
>> >>><br>
>> >>> As you can see, dpy above around line 195 in  vaGetDisplay function is<br>
>> >>> shown as 0x7fffe42d3160 but once the program counter comes out of that<br>
>> >>> function and stack rolling happens, and context switches to upper<br>
>> >>> level<br>
>> >>> code, the assigned value has  0xffffffffe42d3160 (sign extended vs<br>
>> >>> unsigned). What might cause this ? Next instance when I call<br>
>> >>> vaInitialize<br>
>> >>> with this vaDisplay, it craches:<br>
>> >>><br>
>> >>> Program received signal SIGSEGV, Segmentation fault.<br>
>> >>> vaDisplayIsValid (dpy=0xffffffffe42d3450) at va.c:102<br>
>> >>> 102        return pDisplayContext && (pDisplayContext->vadpy_magic ==<br>
>> >>> VA_DISPLAY_MAGIC) && pDisplayContext->vaIsValid(pDisplayContext);<br>
>> >>><br>
>> >>><br>
>> >>><br>
>> >>> Any help/pointer would be appreciated. Thanks<br>
>> >>><br>
>> >>><br>
>> >>><br>
>> >>> gcc --version<br>
>> >>> gcc (Ubuntu 4.8.4-2ubuntu1~14.04) 4.8.4<br>
>> >>> Copyright (C) 2013 Free Software Foundation, Inc.<br>
>> >>> This is free software; see the source for copying conditions.  There<br>
>> >>> is<br>
>> >>> NO<br>
>> >>> warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR<br>
>> >>> PURPOSE.<br>
>> >>><br>
>> >>> ls -la <a href="http://libc-2.19.so" rel="noreferrer" target="_blank">libc-2.19.so</a><br>
>> >>> -rwxr-xr-x 1 root root 1845024 Dec  4  2014 <a href="http://libc-2.19.so" rel="noreferrer" target="_blank">libc-2.19.so</a><br>
>> >>><br>
>> >>> ldd --version<br>
>> >>> ldd (Ubuntu EGLIBC 2.19-0ubuntu6.5) 2.19<br>
>> >>><br>
>> >>><br>
>> >>> Platform:<br>
>> >>><br>
>> >>> Ratin<br>
>> >>><br>
>> >>><br>
>> >>><br>
>> >>><br>
>> >><br>
>> ><br>
>> ><br>
>> > _______________________________________________<br>
>> > Libva mailing list<br>
>> > <a href="mailto:Libva@lists.freedesktop.org">Libva@lists.freedesktop.org</a><br>
>> > <a href="http://lists.freedesktop.org/mailman/listinfo/libva" rel="noreferrer" target="_blank">http://lists.freedesktop.org/mailman/listinfo/libva</a><br>
>> ><br>
</div></div></blockquote></div><br></div>