dk / Prima

prima.eu.org
Other
108 stars 27 forks source link

Tests failing on Ubuntu 24.04 LTS #122

Open mohawk2 opened 3 days ago

mohawk2 commented 3 days ago

They were working fine, then I went and "upgraded" my Ubuntu from 22.04 LTS to 24.04 LTS. Now lots of plotting stuff is broken including PGPLOT, and also Prima is failing several tests:

[...]
#   Failed test 'gc.bits.linePattern.aa'
#   at t/Object/GPState.t line 150.
#          got: '
# 0000000000000000
# 0000000000000000
# 0000000000000000
# 0000000000000000
# 0000000000000000
# 0000000000000000
# 0000000000000000
# 0000000000000000'
#     expected: anything else
[...]
===(   10360;28  171/?  0/? )===========================================
#   Failed test '(--no-fribidi --no-harfbuzz)  - glyphs plotting'
#   at t/Object/Shaping.t line 16.

#   Failed test 'glyphs plotting'
#   at t/Object/Shaping.t line 16.
#          got: '25369'
#     expected: '25114'
# font: [FreeSerif]

#   Failed test '(--no-fribidi --no-harfbuzz)  - glyphs plotting, terse version'
#   at t/Object/Shaping.t line 16.

#   Failed test 'glyphs plotting, terse version'
#   at t/Object/Shaping.t line 16.
#          got: '25369'
#     expected: '25114'
# font: [FreeSerif]

#   Failed test '(--no-fribidi --no-harfbuzz)  - glyphs plotting 45 degrees'
#   at t/Object/Shaping.t line 16.

#   Failed test 'glyphs plotting 45 degrees'
#   at t/Object/Shaping.t line 16.
#          got: '26464'
#     expected: '25189'
# font: [FreeSerif]
# Bitmap dump 1 32x32
#                                 
#                                 
#                                 
#                                 
#                                 
#                                 
#                                 
#                                 
#            *****                
#           ******                
#             ****     ******     
#             ****    ********    
#            ****    ***  *****   
#            ****    **    ****   
#            ****          ****   
#            ****          ****   
#            ****          ****   
#            ****         ****    
#           ****         ****     
#           ****        ****      
#           ****       ****       
#           ****     ****         
#         ******    ****     **   
#            ***** ************   
#                  ***********    
#                       *****     
#      ***                        
#         ******                  
#               ******            
#                     ******      
#                           ***   
#                                 
# Bitmap dump 2 32x32
#                                 
#                                 
#                                 
#                                 
#                                 
#                                 
#                                 
#                                 
#            *****                
#           ******                
#             ****     ******     
#             ****    ********    
#            ****    ***  *****   
#            ****    **    ****   
#            ****          ****   
#            ****          ****   
#            ****          ****   
#            ****         ****    
#           ****         ****     
#           ****        ****      
#           ****       ****       
#           ****     ****         
#         ******    ****     **   
#            ***** ************   
#                  ***********    
#                       *****     
#      ****                       
#         *******                 
#               *******           
#                     *******     
#                           ****  
#                                 
# Looks like you failed 3 tests of 44.
dk commented 3 days ago

I tried that on my ubuntu 22 so far nothing with this line:

perl t/Object/Shaping.t font=FreeSerif

can you possibly check if your FreeSerif is this one?

$ fc-match FreeSerif-12
FreeSerif.otf: "FreeSerif" "Regular"
$ locate FreeSerif.otf | xargs -n 1 md5sum
524939c1572e22d1463002b3086548a0  /usr/share/fonts/opentype/freefont/FreeSerif.otf

If not, maybe I can spare effort upgrading or setting up a VM with v24, if you can put that otf here?

dk commented 3 days ago

Also, if gc.bits.linePattern.aa is broken and PGPLOT plotting is broken, I'd guess that this has to do with Xorg/Xwayland's way to plot antialiased shapes, because Prima does the tesselation itself and only sends primitive shapes to X. The X backend rendeding is done either by full-on software using Xrender, but this is a piece by Keith Packard and his work is usually rock-solid. Or it is EGL/OpenGL-based by Eric Anholt, and it has a couple of nasty holes. I wonder if the same errors are present on Xvfb instead of the X-based display.

dk commented 2 days ago

I found a laptop I could upgrade to v24, and fixed the font issue - but the line issue I couldn't reproduce. People on forums say that 24.00 is too alpha to make any conclusions, and recommend to wait for 24.01. The fact that there are line plotting problems also in PGPLOT, I'd strongly suspect some graphic driver issue. These days Xorg can run without a config, but you may want to create one where the backend is not EGL. Other than this, I'm not sure what to do about this problem

mohawk2 commented 2 days ago

Thanks for merging the PR. I am assuming when you say "v24" you mean Ubuntu 24.04 LTS? They don't push it out to general release (which is when I saw it) until it's at the ".1" version, so that is not remotely alpha.

On reflection, I think the Gnuplot issue is as simple as it now putting its Wayland-related warnings on stdout (so the Perl driver can see it) instead of on stderr as before. That just means I need to fix the Perl driver to ignore that, like I had to when Gnuplot 6 changed its multiplotting stuff which I first saw on MacOS.

I agree that the issues I'm seeing with PGPLOT are Wayland-related, but I don't know what you mean about EGL etc. Could you link me to something so I can learn? Unfortunately, with PGPLOT being as currently "stable" (dead) as it is, my first option with that is not updating it to work with Wayland, though there are moves afoot to change that.

Turning to this actual issue: thank you for the patch you linked above, which has made the shape stuff pass again. The t/Object/GPState.t error is still the same. If there's anything you need from me in debugging this, let me know.

dk commented 2 days ago

I can only speculate about PGPLOT/Wayland problems, but I would definitely try both PGPLOT and GPState.t under XWayland, native XOrg, and Xvfb. Sure, there can be also some problem with Prima's tesselation, that causes line 217 to not draw any lines under AA mode, (the test bitmap displays only zeros, and there should be something else too). This one though can be tested with this code:

use strict;
use warnings;
use Prima;
my $d = Prima::DeviceBitmap->new( 
    size        => [8,8],
    type        => dbt::Pixmap,
    lineWidth   => 2,
    lineJoin    => lj::Miter,
    lineEnd     => le::Square,
    linePattern => lp::Dot,
    rop2        => rop::NoOper,
    antialias   => 1,
);
$d->clear;
$d->polyline([2,2,6,2,6,6]);
$d = $d->image;
$d->type(im::BW);
$d->type(im::Byte);
$d = $d->data;
$d =~ tr/\x00\xff/* /;
print join("\n", split /(.{8})/, $d), "\n";

It should display two dots, each is made from 4 *'s. That's lp::Dot line pattern with line width=2. Let's see if this will be working under wayland, xorg, and xvfb

mohawk2 commented 12 hours ago

I had to fix the last line of your script since it was making spurious blank lines (the split was splitting, returning the captured parens, but also the empty strings between those 8-char blocks) to:

print join "\n", $d =~ /(.{1,8})/g, "";

Under my Wayland on Ubuntu 24.04 (the only system I have easy access to) the updated script gives:


 **     
 **     

     ** 
     ** 
dk commented 12 hours ago

Yes that how it supposed to be ... and yet the test fails doing the same thing? Very strange... do you think if you will be able to condense the test script to some minimal version that can fail with the linepatterns? Since I cannot reproduce it may be the only way to figure out what's wrong there...