JDK-4844952 : drawString corruption on Matrox video cards on linux
  • Type: Bug
  • Component: client-libs
  • Sub-Component: 2d
  • Affected Version: 1.4.0,1.4.2,5.0
  • Priority: P4
  • Status: Closed
  • Resolution: Fixed
  • OS:
    linux,linux_redhat_3.0,linux_redhat_7.2,linux_redhat_9.0,linux_suse_sles_8 linux,linux_redhat_3.0,linux_redhat_7.2,linux_redhat_9.0,linux_suse_sles_8
  • CPU: x86
  • Submitted: 2003-04-08
  • Updated: 2004-04-08
  • Resolved: 2004-03-30
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other
5.0 b45Fixed
Related Reports
Duplicate :  
Duplicate :  
Duplicate :  
Duplicate :  
Duplicate :  
Relates :  
Description

Name: dk106046			Date: 04/08/2003

OPERATING SYSTEM(S):
Red hat 7.3 & 8
Turbo 7 & 8
Possibly other Linux

FULL JDK VERSION(S):
1.4.2-beta-b19



Run the following applet on Linux where acceleration is on
ie in XF86Config the device "NoAccel" is commented out

DrawTextTest.html
-----------------
<body>
<applet code="DrawTextTest.class" height=350 width=350>
</applet>
</body>


DrawTextTest.java
-----------------
import java.awt.Graphics;
import java.awt.Font;

public class DrawTextTest extends java.applet.Applet {

    public void paint(Graphics screen) {

       Font f = new Font("serif", Font.PLAIN, 48);
        screen.setFont(f);
        screen.drawString("Test string", 50, 50);
    }
}


The problem is that the text is distorted. The top part of the chars
repeats vertically. (FYI It seems that the problem could be in X11TextRenderer_md.c
with the way checkPixmap is used. Increasing the value of TEXT_BM_HEIGHT in 
so that only one pixmap is being used by AWTDrawGlyphList eradicates this problem.)


======================================================================


###@###.### 2003-10-31
Found also on SuSE 8.2 Pro with GlobalSuite test case
font-render/awt/two/CharViewMultiLine.java
and promoted J2SE 1.5.0 b25

HW: Ati 3D Rage Pro
See attached snapshot

###@###.### 2003-11-12
Another platform RedHat AS 3.0 has the same behaviour with GlobalSuite test cases:
font-render/awt/two/CharView
font-render/awt/two/CharViewMultiLine

HW: Ati 3D Rage Pro


###@###.###: 2003-12-16
Another platform Mercury 12c has the same behaviour with GlobalSuite test cases:
font-render/awt/two/CharView
font-render/awt/two/CharViewMultiLine
video card: ATI Technologies Inc 3D Rage Pro AGP 1X/2X rev 92



Name: pr15447			Date: 01/22/2004


FULL PRODUCT VERSION :
1.4.2_01

FULL OS VERSION :
Linux linux 2.4.18-4GB #1 Wed MAr 27 13:57:05 UTC 2002 i686 unknown

EXTRA RELEVANT SYSTEM CONFIGURATION :
Using SunOne studio 5.0

A DESCRIPTION OF THE PROBLEM :
When I try to print text at a 90 degree angle, I get a repeated text occurence.  For instance, If I tried the string "Degrees Celcuis", it will print "iusciusciuscius".  The frequency of repitition seems random to me.  The rotation is successful, but the text is printed incorrectly.  When I remove the rotate function, the text is printed properly.

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
//aString is a string
//g2 is a Graphics2D object
g2.rotate(-Math.PI/2,10,10);
g2.drawString(aString,10,10);

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
if aString = "Degrees Celcuis", I expected "Degrees Celcuis" to display on the screen after my Graphics2D object has beenb rotated and I call drawString.
ACTUAL -
Rather, I get "iusciusciuscius" to display.

REPRODUCIBILITY :
This bug can be reproduced always.

---------- BEGIN SOURCE ----------
import javax.swing.*;
import java.awt.*;

public class DrawStringBug extends javax.swing.JFrame {
    
    public DrawStringBug() {
        initComponents();
        this.setSize(200,300);
        
    }
    
    public void paint(Graphics g) {
        
        Font axisFont =  new Font("Arial",Font.PLAIN,10);
        Graphics2D g2 = (Graphics2D)g;
        g2.rotate(-Math.PI/2,100,100);
        g2.drawString("ABCDEFGHIJKLMNOPQRSTUVWXYZ",-50,100);
    
    }
   
    private void initComponents() {//GEN-BEGIN:initComponents

        getContentPane().setLayout(null);

        addWindowListener(new java.awt.event.WindowAdapter() {
            public void windowClosing(java.awt.event.WindowEvent evt) {
                exitForm(evt);
            }
        });

        pack();

    private void exitForm(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_exitForm
        System.exit(0);
    }
    
    public static void main(String args[]) {
        new DrawStringBug().show();
        
    }
    
}

---------- END SOURCE ----------
(Review ID: 209907)
======================================================================

Comments
CONVERTED DATA BugTraq+ Release Management Values COMMIT TO FIX: tiger-beta2 FIXED IN: tiger-beta2 INTEGRATED IN: tiger-b45 tiger-beta2 VERIFIED IN: tiger-beta2
14-06-2004

WORK AROUND Name: dk106046 Date: 04/08/2003 Turning off acceleration prevents this behaviour. ie Option "NoAccel" is uncommented Not an acceptable workaround however. ======================================================================
11-06-2004

EVALUATION Graphics.drawString is owned by 2D. ###@###.### 2003-04-08 ================================= I wasn't able to reproduce this here, and have contacted the submitter who is trying to get more details on the configurations which have shown this problem. ###@###.### 2003-05-06 ============================ This bug appears to be specific to some Matrox Millenium models. The submitter could not reproduce it on ATI, nor could I, nor could I reproduce it on Nvidia, or intel chipset. However once the submitter indicated it was a Matrox device, I was able to reproduce it on java2d-lab-51, which has a Matrox card. That machine is running RedHat 7.2 (slightly different than anything tried by the submitter). Also that machine has two cards (ie 2 X11 screens) displaying to 0.0 works fine, displaying to :0.1 shows the problem. So we can be fairly confident that this is a problem in the graphics driver for this device and nothing else. I also reproduced it as far back as 1.4 beta1 - but not on 1.3.1! ###@###.### 2003-05-13 ============================ There is mention in the description of problems seen in GlobalSuite on Linux with an ATI card. The majority of those problems appear to be bugs in GlobalSuite, not Java 2D or Linux. This bug (4844952) is specifically a Linux bug and so far has only been conclusively demonstrated on a Matrox card. We need further confirmation that its visible on ATI cards, using a test case other than the buggy GlobalSuite ones - and it needs to be one which positively draws to the screen and so invokes this code. The test case DrawTextTest should be used. ###@###.### 2004-03-10 =========================== There have been a few cases where bugs have been considered to be the same as 4844952 but are in fact test bugs, or are clipping of text instead of corruption of the text, or aren't on linux. There exists a specific test for 4844952 which is DrawTextTest.java in the description. Before adding to this bug or closing a bug as a duplicate of this bug, run DrawTextTest and if that looks fine you are not seeing 4844952 and what you are seeing will be completely unrelated. ###@###.### 2004-03-11 ============================ I made the required tests (Tiger b41): - 'appletviewer DrawTextTest.html' - 'java -jar Font2DTest.jar' Video card: mga: PCI:*(1:0:0) Matrox Graphics, Inc. MGA G400 AGP rev 130, Mem @ 0xf8000000/25, 0xff6fc000/14, 0xfe800000/23, BIOS @ 0x80000000/17 ati: PCI:*(1:0:0) ATI Mach64 GB rev 92, Mem @ 0xfd000000/24, 0xfcfff000/12, I/O @ 0xec00/8 Results: drawTextTest-quickSilver_b08-mga.png : ERR drawTextTest-w2003as-mga.png : OK font2DTest-quickSilver-b08-mga.pn : OK drawTextTest-rhas30-ati.png : OK ###@###.### 2004-03-12 =========================== The last set of results above seem to confirm that this bug is entirely specific to large or rotated text on Matrox cards on Linux. ###@###.### 2004-03-12 ============================ The JDK code is using a pixmap as a stipple. a XChangeGC call is made to specify the pixmap to use as the stipple. It looks as if the DDX for the MGA is caching this pixmap somwhere - probably in framebuffer memory - as its not being updated when an XPutImage call is made which changes the contents of the pixmap. This seems to me like a DDX bug. Fortunately we can work around with simple, low risk, minimal overhead code. ###@###.### 2004-03-15 ============================ It was pointed out that according to: Scheiffler & Gettys, Section 7.1 "Manipulating Graphics Context/State" in the paragraphs that discuss tile/stipples, top of p. 174... Storing a pixmap in a GC might or might not result in a copy being made. If the pixmap is later used as the destination for a graphics request, the change might or might not be reflected in the GC. So this fix is apparently necessary for correctness. However this isn't mentioned (it seems) in the O'Reilly series : X11 protocol or Xlib reference or programming manuals ###@###.### 2004-03-16 ============================
16-03-2004