hwloc icon indicating copy to clipboard operation
hwloc copied to clipboard

Black lstopo window

Open rubin55 opened this issue 2 years ago • 7 comments

What version of hwloc are you using?

# lstopo --version
lstopo 2.9.1

Which operating system and hardware are you running on?

# uname -a
Linux ORION 6.5.7-arch1-1 #1 SMP PREEMPT_DYNAMIC Tue, 10 Oct 2023 21:10:21 +0000 x86_64 GNU/Linux
# lstopo -
Machine (126GB total)
  Package L#0
    NUMANode L#0 (P#0 126GB)
    L3 L#0 (16MB)
      L2 L#0 (512KB) + L1d L#0 (32KB) + L1i L#0 (32KB) + Core L#0
        PU L#0 (P#0)
        PU L#1 (P#8)
      L2 L#1 (512KB) + L1d L#1 (32KB) + L1i L#1 (32KB) + Core L#1
        PU L#2 (P#1)
        PU L#3 (P#9)
      L2 L#2 (512KB) + L1d L#2 (32KB) + L1i L#2 (32KB) + Core L#2
        PU L#4 (P#2)
        PU L#5 (P#10)
      L2 L#3 (512KB) + L1d L#3 (32KB) + L1i L#3 (32KB) + Core L#3
        PU L#6 (P#3)
        PU L#7 (P#11)
    L3 L#1 (16MB)
      L2 L#4 (512KB) + L1d L#4 (32KB) + L1i L#4 (32KB) + Core L#4
        PU L#8 (P#4)
        PU L#9 (P#12)
      L2 L#5 (512KB) + L1d L#5 (32KB) + L1i L#5 (32KB) + Core L#5
        PU L#10 (P#5)
        PU L#11 (P#13)
      L2 L#6 (512KB) + L1d L#6 (32KB) + L1i L#6 (32KB) + Core L#6
        PU L#12 (P#6)
        PU L#13 (P#14)
      L2 L#7 (512KB) + L1d L#7 (32KB) + L1i L#7 (32KB) + Core L#7
        PU L#14 (P#7)
        PU L#15 (P#15)
  HostBridge
    PCIBridge
      PCI 01:00.0 (NVMExp)
        Block(Disk) "nvme0n1"
    PCIBridge
      PCI 02:00.1 (SATA)
        Block(Disk) "sdd"
        Block(Disk) "sdb"
        Block(Disk) "sdc"
        Block(Disk) "sda"
      PCIBridge
        PCIBridge
          PCI 04:00.0 (Ethernet)
            Net "eth0"
    PCIBridge
      PCIBridge
        PCIBridge
          PCI 0a:00.0 (VGA)
  Misc(MemoryModule)
  Misc(MemoryModule)
  Misc(MemoryModule)
  Misc(MemoryModule)

Details of the problem

  • What happened?

Running lstopo produces a black window, see screenshot: lstopo-black-window

  • How did you start your process?

I simply run lstopo from the commandline.

  • How did it fail? Crash? Unexpected result?

It displays a black window instead of the GL-based overview of my system.

rubin55 avatar Oct 14 '23 14:10 rubin55

Oh, that's interesting. Random things to test:

  • if the graphical output, try resize the window, pressing + or - to change zoom, etc
  • Export to PNG with lstopo foo.pngand open that new foo.png. Is it black as well? If yes, that's a Cairo issue. If not, that's a Cairo/X11 only issue.
  • Do you have some sort of black theme in your graphical environment or whatever that could lead to some colors being inverted and lstopo failing to adapt?
  • Try lstopo --palette white and lstopo --palette grey in case they work better.
  • Try to change the colors of one object by adding style attribute in the XML:
lstopo foo.xml
hwloc-annotate foo.xml foo.xml -- root -- info lstopoStyle "Background=#000000;Text=#ffffff"
lstopo -i foo.xml 

bgoglin avatar Oct 14 '23 17:10 bgoglin

Thanks for the pointers, here goes:

  • Resizing, either by dragging or +/- does not change anything, window stays black
  • Exporting to PNG works: the resulting image displays normally
  • I don't have any theme customization going on (tried with default Gnome, both dark mode and light mode)
  • The --palette options don't change anything, window stays black
  • When changing the colors through foo.xml, the left-top title for the machine becomes readable (white text on black background)

Fwiw, I tested on three machines (all running the same version and same OS/kernel, two with AMD Radeon cards, one with Intel graphics). The radeons both display fully black screens, the intel displays this: lstopo-black-window-intel

rubin55 avatar Oct 14 '23 17:10 rubin55

What cairo version do you have? Do you know if things worked better on these systems in the past?

bgoglin avatar Oct 14 '23 17:10 bgoglin

These systems use cairo 1.18.0 currently. I do know that these systems all had lstopo working normally before.

rubin55 avatar Oct 14 '23 17:10 rubin55

Thanks, ok I am going to upgrade my cairo on several systems to try to reproduce.

bgoglin avatar Oct 14 '23 17:10 bgoglin

In the meantime, you could try to comment-out this line in the source since it sets the drawing color to black. We're supposed to only draw the border of the box with this color, but maybe we end up filling the box some reason.

--- a/utils/lstopo/lstopo-cairo.c
+++ b/utils/lstopo/lstopo-cairo.c
@@ -73,7 +73,7 @@ topo_cairo_box(struct lstopo_output *loutput, const struct lstopo_color *lcolor,
   cairo_fill(c);
 
   cairo_rectangle(c, x, y, width, height);
-  cairo_set_source_rgb(c, 0, 0, 0);
+//  cairo_set_source_rgb(c, 0, 0, 0);
 
   if (cpukind_style) {
     double dash = (double)(1U << cpukind_style);

Boxes won't have border anymore, but hopefully they'll have the expected background.

Another random patch to try is this one in case your compiler decides to cast to float after dividing:

--- a/utils/lstopo/lstopo-cairo.c
+++ b/utils/lstopo/lstopo-cairo.c
@@ -69,7 +69,7 @@ topo_cairo_box(struct lstopo_output *loutput, const struct lstopo_color *lcolor,
   int r = lcolor->r, g = lcolor->g, b = lcolor->b;
 
   cairo_rectangle(c, x, y, width, height);
-  cairo_set_source_rgb(c, (float)r / 255, (float) g / 255, (float) b / 255);
+  cairo_set_source_rgb(c, ((float)r) / 255, ((float)g) / 255, ((float)b) / 255);
   cairo_fill(c);
 
   cairo_rectangle(c, x, y, width, height);

bgoglin avatar Oct 14 '23 18:10 bgoglin

Hello, did you have a chance to test the ideas above?

bgoglin avatar Jun 12 '24 08:06 bgoglin

Hi, I'm sorry, I couldn't reproduce this after a random pacman -Syu; I didn't run into the issue again :/.

rubin55 avatar Jul 12 '24 20:07 rubin55

Thank you for replying. I am going to close, and hopefully you won't ever face the issue anymore. Otherwise feel free to reopen.

bgoglin avatar Jul 22 '24 07:07 bgoglin