[OpenJDK 2D-Dev] CR 7029934 : Xrender: Text is truncated with 64 bit Linux JRE

Phil Race philip.race at oracle.com
Thu Mar 31 19:07:01 UTC 2011


So .. I took the liberty of revising the fix : 
http://cr.openjdk.java.net/~prr/7029934/

- In the 32 bit case we now avoid stack or malloc allocation - basically
  doing what the code was doing previously.

- In the 64 bit case we use the stack up to 256 glyphs (maybe this is 
too much
  as its going to be 256*8 = 1Kbytes?) and malloc above that. I could
  reduce it to say 32*8 = 256 bytes. What do people think ?

- I got rid of a compiler warning on line 647. This is unrelated but we
  are trying to eliminate such warnings.

-phil.

Phil Race wrote:
> Yeah, I thought about that too. Wasn't sure how useful it would be.
>
> -phil.
>
> On 3/30/2011 4:48 PM, Jim Graham wrote:
>> Also, perhaps gids could be stack allocated if it is small enough 
>> like xids is in the other function?
>>
>>             ...jim
>>
>> On 3/30/2011 4:35 PM, Phil Race wrote:
>>> Hi Clemens,
>>>
>>> 677 if ((ids = (jint *) (*env)->GetPrimitiveArrayCritical(env, 
>>> gidArray,
>>> NULL)) == NULL) {
>>> ..
>>> 688 (*env)->ReleasePrimitiveArrayCritical(env, gidArray, gids, 
>>> JNI_ABORT);
>>> ^^^^^
>>>
>>>
>>> So the release should be on "ids".
>>>
>>> I wonder if in the 32 bit case (or more precisely sizeof(jint) ==
>>> sizeof(Glyph)
>>> if we could skip the extra malloc and free ? Not sure how critical 
>>> this is.
>>>
>>>
>>> 723 xids = (Glyph *) malloc(sizeof(unsigned int) * glyphCnt);
>>>
>>> The cast should now be to (unsigned int*)
>>>
>>> I can make these changes.
>>>
>>> BTW when I look at the XRender headers "render.h" I see that it defines
>>> typedef unsigned long Glyph;
>>>
>>> so its not that the XID is defined to be 64 bits its the Glyph type
>>> directly and this maybe is something that Xrender should have done
>>> differently.
>>>
>>> Also it is (was) a bug on Solaris as well. It was pilot error on my 
>>> part
>>> that made me think otherwise.
>>>
>>> The only thing I've seen that concerns me is I've had a couple of 
>>> abrupt
>>> disconnects from the Xserver shutting down Java2Demo. I am not sure
>>> if that's an Xserver problem or a client problem or if its even 
>>> specific
>>> to this 64 bit remote display scenario or what .. because its not
>>> been that easy to reproduce.
>>>
>>> -phil.
>>>
>>> Clemens Eisserer wrote:
>>>> Hi Phil,
>>>>
>>>> The problem was caused by the assumption that sizeof(int) ==
>>>> sizeof(XID), however Xlib uses unsigned long for XIDs, even if XIDs
>>>> are defined to be 32-bit on wire. According to the xorg mailing list
>>>> ists safe to store those values in 4-byte variables, the only case
>>>> which needs attention are arrays.
>>>>
>>>> In this case the problem was I passed a Glyph* to
>>>> XRenderCompositeText, which however expected a unsigned int*. Both are
>>>> 4bytes wide on ia32, but Glyph is 8 bytes on amd64. XRenderFreeGlyphs
>>>> was also affected.
>>>>
>>>> - Clemens
>>>>
>>>> PS: I can't access information for 7029934 - which seems to be rather
>>>> common for many bug-numbers I see floating arround on the mailing
>>>> lists. Any idea why?
>>>>
>>>>
>>>> 2011/3/22 Clemens Eisserer <linuxhippy at gmail.com>:
>>>>> Hi Phil,
>>>>>
>>>>> I'll have a look at this one soon.
>>>>> I also hope to fix the bug causing intellij's editor to be completly
>>>>> unuseable before jdk7's freeze phase - however I guess I'll need a
>>>>> little help for that.
>>>>>
>>>>> Just remembered that I promies results some time ago, sorry, I'll
>>>>> send it soon.
>>>>> Its just, university is giving me a really hard time. Starting with
>>>>> 6th April everything will be far more relaxed =)
>>>>>
>>>>> Thanks, Clemens
>>>>>
>>>>>
>>>>> 2011/3/22 Phil Race <philip.race at oracle.com>:
>>>>>> Clemens,
>>>>>>
>>>>>> Have you tried 64 bit Linux JRE? SQE reports, and I have verified,
>>>>>> text is
>>>>>> truncated
>>>>>> But only on Linux. Solaris is OK. B&W, greyscale, LCD are all the 
>>>>>> same.
>>>>>>
>>>>>> -phil..
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> *Change Request ID*: 7029934
>>>>>>
>>>>>> *Synopsis*: Xrender: Text is truncated with 64 bit Linux JRE
>>>>>>
>>>>>>
>>>>>> === *Description*
>>>>>> ============================================================
>>>>>> java version "1.7.0-ea"
>>>>>> Java(TM) SE Runtime Environment (build 1.7.0-ea-b134)
>>>>>> Java HotSpot(TM) 64-Bit Server VM (build 21.0-b04, mixed mode)
>>>>>>
>>>>>> Platform: OEL6
>>>>>> 2.6.32-100.28.5.el6.x86_64 #1 SMP Wed Feb 2 18:40:23 EST 2011 x86_64
>>>>>> x86_64
>>>>>> x86_64 GNU/Linux
>>>>>>
>>>>>> Problem:
>>>>>> When launch Java2Demo in OEL6 machine, the text partially shows 
>>>>>> in the
>>>>>> application. It only happens in 64 bits java.
>>>>>> I tried 32 bits java, the demo looks fine.
>>>>>>
>>>>>> Please see attached screen shot for detail.
>>>>>>
>>>>>> How to reproduce the problem:
>>>>>> 1, Launch the demo by using jdk1.7.0-b134 ever early versions(like
>>>>>> b120)
>>>>>> 2, When the demo GUI comes up, you can see all text in frame 
>>>>>> shows only
>>>>>> partially
>>>>>> [root at dhcp-santaclara22-2fl-west-10-132-182-109 linux-x64]# bin/java
>>>>>> -jar
>>>>>> -Dsun.java2d.xrender=True demo/jfc/Java2D/*.jar
>>>>>> XRender pipeline enabled
>>>>>> Xrender: INFO: Jules library not installed.
>>>>>>
>>>>>> You can use the OEL6 machine to reproduce this problem,
>>>>>> I add machine info is in comments
>>>>>>
>>>>>> *** (#1 of 1): 2011-03-22 16:41:39 GMT+00:00 tao.t.zhang at oracle.com
>>>>>> *** Last Edit: 2011-03-22 17:15:42 GMT+00:00 tao.t.zhang at oracle.com
>>>>>>
>>>>>>
>>>>>> === *Evaluation*
>>>>>> =============================================================
>>>>>> Looks bad. Seems like all text rendering that goes via Xrender is
>>>>>> truncated.
>>>>>> Looks like the first half of any given drawString is visible and the
>>>>>> rest is
>>>>>> missing. Its not specific to Java2Demo. Its in SwingSet2 and in 
>>>>>> applet
>>>>>> demos.
>>>>>>
>>>>>> It seems to have been this way since the first Xrender build (b97)
>>>>>> and its
>>>>>> not just OEL 6. Its also Ubuntu 10.04, so probably all 64 bit 
>>>>>> Linuxes.
>>>>>> But 64 bit Solaris on Intel/AMD is fine!
>>>>>>
>>>>>> I reproduced this displaying remotely from an OEL 6 box and an
>>>>>> Ubuntu box
>>>>>> with Solaris 11 x86 as the display server, so its presumably
>>>>>> something on
>>>>>> the client (application) end.
>>>>>> The code is all the same so maybe its something to do with the
>>>>>> compilation.
>>>>>>
>>>>>> *** (#1 of 1): 2011-03-22 20:37:53 GMT+00:00 philip.race at oracle.com
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>
>




More information about the 2d-dev mailing list