<?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>1906</bug_id>
          
          <creation_ts>2012-01-16 21:08:10 +0000</creation_ts>
          <short_desc>[QEMU]loses focus in qemux86-64 terminal When I press key [CTRL+L]</short_desc>
          <delta_ts>2012-05-08 08:15:38 +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>core</component>
          <version>1.2</version>
          <rep_platform>x86</rep_platform>
          <op_sys>x86_64</op_sys>
          <bug_status>VERIFIED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard>Patch our for review on mailing list</status_whiteboard>
          <keywords></keywords>
          <priority>Medium</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>1.2.1</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="MaNing">ningx.ma</reporter>
          <assigned_to name="Edwin Zhai">edwin.zhai</assigned_to>
          <cc>jessica.zhang</cc>
    
    <cc>jiajun.xu</cc>
    
    <cc>meta.mr.watcher</cc>
    
    <cc>meta.watcher</cc>
    
    <cc>nitin.a.kamble</cc>
    
    <cc>raj.khem</cc>
    
    <cc>richard.purdie</cc>
    
    <cc>scott.a.garman</cc>
    
    <cc>yilongx.y.sun</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>18172</commentid>
    <comment_count>0</comment_count>
    <who name="MaNing">ningx.ma</who>
    <bug_when>2012-01-16 21:08:10 +0000</bug_when>
    <thetext>Tree/Branch: Poky/1.2_M2
Commit: 0f4d99d207b224bb9ce23de00a48f795ae20b3a0

with 20120111-3 images for qemux86-64, boot system successful and then launch the
Terminal,  loses focus When I press key [CTRL+L] or set the cursor on the bottom of the terminal and press [ENTER] key. 
This problem does not exist with qemux86 image.

20120111-3 qemux86-64 image URL:
http://autobuilder.yoctoproject.org/pub/nightly/20120113-1/machines/qemu/qemux86-64/</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>18484</commentid>
    <comment_count>1</comment_count>
    <who name="Edwin Zhai">edwin.zhai</who>
    <bug_when>2012-02-05 17:55:22 +0000</bug_when>
    <thetext>What do you mean by &quot;lose focus&quot;? Can you gain the focus again? What focus? focus for windows in side qemu? Can you see &quot;Press Ctrl-Alt to exit mouse grab&quot; in qemu title bar?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>18486</commentid>
    <comment_count>2</comment_count>
    <who name="yilong, sun">yilongx.y.sun</who>
    <bug_when>2012-02-05 18:37:52 +0000</bug_when>
    <thetext>In this case, the cursor will disappear, you can&apos;t type command in this terminal.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>18684</commentid>
    <comment_count>3</comment_count>
    <who name="Edwin Zhai">edwin.zhai</who>
    <bug_when>2012-02-21 22:39:57 +0000</bug_when>
    <thetext>This bug is caused by the broken scrollbar in vte. The culprit is:

commit 6eadb8494797e44910b86b5e101823cf527c04e1
Author: Kristian Høgsberg &lt;krh@bitplanet.net&gt;
Date:   Thu Jul 15 09:07:51 2010 -0400

    Use accessors for setting adjustment
    
    We use g_object_freeze_notify() to emit the same amount of ::changed
    signals.

It seems that &quot;changed&quot; signal was not emitted with the new method. But don&apos;t know the root cause. I have created a bug in gnome&apos;s bugzilla and send out a patch to revert this commit to poky master.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>19687</commentid>
    <comment_count>4</comment_count>
    <who name="MaNing">ningx.ma</who>
    <bug_when>2012-03-30 07:56:57 +0000</bug_when>
    <thetext>This issue still exist in poky 1.2_M4 testing.

Tree/Branch: Poky/1.2_M4
Poky Commit id:4d9f4d6ac25f39fe6d5491d05c7a26195bab648b

20120328-1 qemux86-64 image URL:
http://autobuilder.yoctoproject.org/pub/nightly/20120328-1/machines/qemu/qemux86-64/</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>20680</commentid>
    <comment_count>5</comment_count>
    <who name="Richard Purdie">richard.purdie</who>
    <bug_when>2012-04-18 20:53:21 +0000</bug_when>
    <thetext>This is a compiler optimization problem showing itself up in glib. If I change gparamspecs.c to read:


static gboolean
param_double_validate (GParamSpec *pspec,
		       GValue     *value)
{
  GParamSpecDouble *dspec = G_PARAM_SPEC_DOUBLE (pspec);
  gdouble oval = value-&gt;data[0].v_double;
  
  value-&gt;data[0].v_double = CLAMP (value-&gt;data[0].v_double, dspec-&gt;minimum, dspec-&gt;maximum);

  printf(&quot;Here %f %f %f %f\n&quot;, value-&gt;data[0].v_double, oval, dspec-&gt;minimum, dspec-&gt;maximum);
  
  return value-&gt;data[0].v_double != oval;
}

then I see things like:

Here -179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368.000000 30.000000 -179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368.000000 179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368.000000

so its taking the value of dspec-&gt;minimum which is clearly lower than 30.

If I change it to:

static gboolean
param_double_validate (GParamSpec *pspec,
		       GValue     *value)
{
  GParamSpecDouble *dspec = G_PARAM_SPEC_DOUBLE (pspec);
  gdouble oval = value-&gt;data[0].v_double;
  
  value-&gt;data[0].v_double = CLAMP (value-&gt;data[0].v_double, dspec-&gt;minimum, dspec-&gt;maximum);

  if (oval &lt; dspec-&gt;minimum)
      printf(&quot;Here 1 %f %f %f %f\n&quot;, value-&gt;data[0].v_double, oval, dspec-&gt;minimum, dspec-&gt;maximum);
  else
      printf(&quot;Here 2 %f %f %f %f\n&quot;, value-&gt;data[0].v_double, oval, dspec-&gt;minimum, dspec-&gt;maximum);
  
  return value-&gt;data[0].v_double != oval;
}

then I see:

Here 2 30.000000 30.000000 -179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368.000000 179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368.000000

and as an added bonus the issue reported in this bug goes away as the parameters used by the gtkadjustment start working. Exactly what the issue is remains to be seen but this looks like the right place to start looking for the problem,</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>20681</commentid>
    <comment_count>6</comment_count>
    <who name="Richard Purdie">richard.purdie</who>
    <bug_when>2012-04-18 20:58:58 +0000</bug_when>
    <thetext>Just to make this clearer, the definition of CLAMP:

#define CLAMP(x, low, high)  (((x) &gt; (high)) ? (high) : (((x) &lt; (low)) ? (low) : (x)))</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>20682</commentid>
    <comment_count>7</comment_count>
    <who name="Khem Raj">raj.khem</who>
    <bug_when>2012-04-18 21:29:35 +0000</bug_when>
    <thetext>what happens of you change

gdouble oval = value-&gt;data[0].v_double;

to 

volatile gdouble oval = value-&gt;data[0].v_double;

in that function</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>20683</commentid>
    <comment_count>8</comment_count>
    <who name="Nitin Kamble">nitin.a.kamble</who>
    <bug_when>2012-04-18 21:45:08 +0000</bug_when>
    <thetext>also changing the CLAMP statement as follows will make compiler&apos;s work simpler.

value-&gt;data[0].v_double = CLAMP (oval, dspec-&gt;minimum,
dspec-&gt;maximum);</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>20687</commentid>
    <comment_count>9</comment_count>
    <who name="Richard Purdie">richard.purdie</who>
    <bug_when>2012-04-18 22:54:14 +0000</bug_when>
    <thetext>(In reply to comment #7)
&gt; what happens of you change
&gt; 
&gt; gdouble oval = value-&gt;data[0].v_double;
&gt; 
&gt; to 
&gt; 
&gt; volatile gdouble oval = value-&gt;data[0].v_double;
&gt; 
&gt; in that function

It doesn&apos;t help, things still break.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>20688</commentid>
    <comment_count>10</comment_count>
    <who name="Richard Purdie">richard.purdie</who>
    <bug_when>2012-04-18 22:59:46 +0000</bug_when>
    <thetext>(In reply to comment #8)
&gt; also changing the CLAMP statement as follows will make compiler&apos;s work simpler.
&gt; 
&gt; value-&gt;data[0].v_double = CLAMP (oval, dspec-&gt;minimum,
&gt; dspec-&gt;maximum);

This helps only if oval is also marked as volatile</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>20692</commentid>
    <comment_count>11</comment_count>
    <who name="Khem Raj">raj.khem</who>
    <bug_when>2012-04-19 01:12:05 +0000</bug_when>
    <thetext>(In reply to comment #9)
&gt; (In reply to comment #7)
&gt; &gt; what happens of you change
&gt; &gt; 
&gt; &gt; gdouble oval = value-&gt;data[0].v_double;
&gt; &gt; 
&gt; &gt; to 
&gt; &gt; 
&gt; &gt; volatile gdouble oval = value-&gt;data[0].v_double;
&gt; &gt; 
&gt; &gt; in that function
&gt; 
&gt; It doesn&apos;t help, things still break.

hmmm interesting I wonder if we are looking at right place. Can you post preprocessed file somewhere ?
(In reply to comment #9)
&gt; (In reply to comment #7)
&gt; &gt; what happens of you change
&gt; &gt; 
&gt; &gt; gdouble oval = value-&gt;data[0].v_double;
&gt; &gt; 
&gt; &gt; to 
&gt; &gt; 
&gt; &gt; volatile gdouble oval = value-&gt;data[0].v_double;
&gt; &gt; 
&gt; &gt; in that function
&gt; 
&gt; It doesn&apos;t help, things still break.

OK then my next question would be does it happen on real hardware ?
just to get qemu out of being an issue here
I will look at the gcc output once I get the preprocessed
file.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>20703</commentid>
    <comment_count>12</comment_count>
    <who name="Khem Raj">raj.khem</who>
    <bug_when>2012-04-19 06:20:22 +0000</bug_when>
    <thetext>I looked at the disassembly of both with and without printf addition. One difference I saw is that in case when if else printf code is not there
optimizer finds a usecase for maxsd instruction and AFAICT code is correct
 
      movsd   8(%rsi), %xmm1
        movsd   80(%rdi), %xmm0
        ucomisd %xmm0, %xmm1
        ja      .L82
        movsd   72(%rdi), %xmm0
        maxsd   %xmm1, %xmm0
.L82:
        xorl    %edx, %edx
        movl    $1, %eax
        movsd   %xmm0, 8(%rsi)
        ucomisd %xmm1, %xmm0
        setp    %dl
        cmove   %edx, %eax
        ret




so I tried to see if qemu is emulating maxsd correctly
groking though the qemu sources I found an interesting commit which explained the problem clearly to me. So please backport the below patch into qemu
and retry


http://git.qemu.org/?p=qemu.git;a=commitdiff;h=a4d1f142542935b90d2eb30f3aead4edcf455fe6;hp=9841aee16f1e68f5a9063589c898c40b44473add


here is the detailed log message

commit a4d1f142542935b90d2eb30f3aead4edcf455fe6
Author: Aurelien Jarno &lt;aurelien@aurel32.net&gt;
Date:   Sat Jan 7 15:20:11 2012 +0100

    target-i386: fix {min,max}{pd,ps,sd,ss} SSE2 instructions
    
    minpd, minps, minsd, minss and maxpd, maxps, maxsd, maxss SSE2
    instructions have been broken when switching target-i386 to softfloat.
    It&apos;s not possible to use comparison instructions on float types anymore
    to softfloat, so use the floatXX_lt function instead, as the
    float_XX_min and float_XX_max functions can&apos;t be used due to the Intel
    specific behaviour.
    
    As it implements the correct NaNs behaviour, let&apos;s remove the
    corresponding entry from the TODO.
    
    It fixes GDM screen display on Debian Lenny.
    
    Thanks to Peter Maydell and Jason Wessel for their analysis of the
    problem.
    
    Signed-off-by: Aurelien Jarno &lt;aurelien@aurel32.net&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>20708</commentid>
    <comment_count>13</comment_count>
    <who name="Richard Purdie">richard.purdie</who>
    <bug_when>2012-04-19 07:35:03 +0000</bug_when>
    <thetext>Nice catch Khem, that does indeed solve the problem (and at least one other issue, files not being displayed in pcmanfm)! :)

I&apos;ll send out a patch for this.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>20980</commentid>
    <comment_count>14</comment_count>
    <who name="Richard Purdie">richard.purdie</who>
    <bug_when>2012-05-02 14:04:11 +0000</bug_when>
    <thetext>Fixed in http://git.yoctoproject.org/cgit.cgi/poky/commit/?id=a4d913d925ce7fcd6d18ee68e4cd6741b4c3eb7c</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>21170</commentid>
    <comment_count>15</comment_count>
    <who name="yilong, sun">yilongx.y.sun</who>
    <bug_when>2012-05-08 08:15:38 +0000</bug_when>
    <thetext>This issue is fixed and verified.

Tree/Branch: Poky/master
Commit: 38da655788361e949d605bebfab45cf5830df613</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>