<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugzilla.yoctoproject.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.6"
          urlbase="https://bugzilla.yoctoproject.org/"
          
          maintainer="it-coreprojects-helpdesk@linuxfoundation.org"
>

    <bug>
          <bug_id>1442</bug_id>
          
          <creation_ts>2011-09-01 19:59:53 +0000</creation_ts>
          <short_desc>openGL application seems not working on qemux86</short_desc>
          <delta_ts>2011-09-23 23:27:01 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>7</classification_id>
          <classification>Build System, Metadata &amp; Runtime</classification>
          <product>OE-Core</product>
          <component>graphics</component>
          <version>unspecified</version>
          <rep_platform>x86</rep_platform>
          <op_sys>x86</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>High</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>1.1</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Lianhao Lu">lianhao.lu</reporter>
          <assigned_to name="Edwin Zhai">edwin.zhai</assigned_to>
          <cc>edwin.zhai</cc>
    
    <cc>meta.mr.watcher</cc>
    
    <cc>meta.watcher</cc>
    
    <cc>sgw</cc>
          
          
          <cf_os>---</cf_os>
          <cf_regression_type>---</cf_regression_type>
          
          <cf_docchange>---</cf_docchange>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>15958</commentid>
    <comment_count>0</comment_count>
    <who name="Lianhao Lu">lianhao.lu</who>
    <bug_when>2011-09-01 19:59:53 +0000</bug_when>
    <thetext>Tree/Branch: Poky/Master
Commit: dfce2695b96ab587b8235cfab2859a874e9d2eef

Using the core-image-sato-sdk image for qemux86, when running openGL applications in the target, the applications would report the following errors in the target:

sh-4.1# ./glxgears
go on...
You maybe forgot to launch QEMU with -enable-gl argument.
Trying TCP/IP communication instead
impossible to connect to server: Connection refused

Checking the QEMU launch options confirmed that &quot;-enable-gl&quot; argument was used. And the qemu printed the following errors on the host:

func_number &gt;= 0 &amp;&amp; func_number &lt; GL_N_CALLS failed
cpu_get_phys_page_debug(env, 00000000) == ffffffff
not in phys mem 00000000(ffffffff 00000000)
cpu_x86_handle_mmu_fault = 1
call _init32 pid=1159
cannot get call parameters</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>16384</commentid>
    <comment_count>1</comment_count>
    <who name="Edwin Zhai">edwin.zhai</who>
    <bug_when>2011-09-21 23:56:00 +0000</bug_when>
    <thetext>Root cause is new gcc&apos;s optimization plus our small bug for saving register.
opengl calling (in call_opengl_qemu) includes 4 steps:
1. prepare opengl parameters on stack
2. save some &quot;input&quot; register by push
3. load &quot;input&quot; register with parameters on stack via same index as step 1
4. issue &quot;int 0x99&quot; to trap into qemu, who will get parameter in the registers

Attaching objdump of different gcc output for same qemugl code, you can see new gcc uses &quot;%esp&quot; rather than &quot;%ebp&quot; to index local variable in stack, which leads wrong index in step 3, as push decrease &quot;%esp&quot; automatically. So when trapping into qemu, wrong parameters are accessed.

Saving registers via local variables will fix it.


** compiled by new gcc **
mov    %eax,0x38(%esp)
mov    %edx,0x34(%esp)
mov    0x60(%esp),%eax
mov    0x68(%esp),%edx
mov    %eax,0x30(%esp)
mov    %ebp,0x2c(%esp)
mov    %edx,0x28(%esp)
push   %ebx
push   %ecx
push   %edx
push   %esi
mov    0x38(%esp),%eax
mov    0x34(%esp),%ebx
mov    0x30(%esp),%ecx
mov    0x2c(%esp),%edx
mov    0x28(%esp),%esi
int    $0x99
pop    %esi
pop    %edx
pop    %ecx
pop    %ebx


** compiled by old gcc **
mov    %eax,-0x1c(%ebp)
mov    %edx,-0x20(%ebp)
mov    0x8(%ebp),%eax
mov    0xc(%ebp),%edx
mov    0x10(%ebp),%ecx
mov    %eax,-0x24(%ebp)
mov    %edx,-0x28(%ebp)
mov    %ecx,-0x2c(%ebp)
push   %ebx
push   %ecx
push   %edx
push   %esi
mov    -0x1c(%ebp),%eax
mov    -0x20(%ebp),%ebx
mov    -0x24(%ebp),%ecx
mov    -0x28(%ebp),%edx
mov    -0x2c(%ebp),%esi
int    $0x99
pop    %esi
pop    %edx
pop    %ecx
pop    %ebx</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>16456</commentid>
    <comment_count>2</comment_count>
    <who name="Edwin Zhai">edwin.zhai</who>
    <bug_when>2011-09-23 23:27:01 +0000</bug_when>
    <thetext>http://git.yoctoproject.org/cgit/cgit.cgi/poky/commit/?id=0289683798bb3b6d1cfbf7cccb834b4b78d9bdab</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>