Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Interface elements are missing, pictures are incorrectly provided, tiring etc. #5509

Closed
gosha20777 opened this issue Feb 18, 2021 · 18 comments
Closed

Comments

@gosha20777
Copy link

gosha20777 commented Feb 18, 2021

Describe the bug
After the update, the interface elements disappear, the images are rendered incorrectly, friezes and tearing.

To Reproduce
Update avalonia 0.9.12 -> 0.10.0

lacmus-foundation/lacmus-app@5a6a5bb

Expected behavior
Interface and animations makes slow, tiring, incorrect image rendering

Screenshots

The demonstration: avalonia 0.9.12 (left) vs avalonia 0.10.0 (right)

Peek 2021-02-18 13-22

Peek 2021-02-18 13-23

Desktop (please complete the following information):

  • OS: Linux (Ubuntu 20.10 / Pop_os 20.10 / Unuttu 20.04)

Additional context

Thu Feb 18 13:24:02 2021       
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 460.39       Driver Version: 460.39       CUDA Version: 11.2     |
|-------------------------------+----------------------+----------------------+
| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|                               |                      |               MIG M. |
|===============================+======================+======================|
|   0  Quadro T1000        Off  | 00000000:01:00.0  On |                  N/A |
| N/A   46C    P5     8W /  N/A |    413MiB /  3911MiB |     30%      Default |
|                               |                      |                  N/A |
+-------------------------------+----------------------+----------------------+
                                                                               
+-----------------------------------------------------------------------------+
| Processes:                                                                  |
|  GPU   GI   CI        PID   Type   Process name                  GPU Memory |
|        ID   ID                                                   Usage      |
|=============================================================================|
|    0   N/A  N/A      2016      G   /usr/lib/xorg/Xorg                189MiB |
|    0   N/A  N/A      2827      G   /usr/bin/gnome-shell               76MiB |
|    0   N/A  N/A     13224      G   ...g/netcoreapp5.0/LacmusApp      102MiB | <- avalonia 9.12
|    0   N/A  N/A     13311      G   ...g/netcoreapp5.0/LacmusApp       39MiB | <- avalonia 10.0
+-----------------------------------------------------------------------------+
  • The new version of Avalonia consumes very little GPU memory. In addition, before and after images are loaded, the amount of memory consumed remains unchanged. For comparison, for avadonia 0.9.12, this amount changes from 40 mb to 150 mb

  • The bug with disappearing interface elements also manifests itself in other applications. For example in Citrus.Avalonia.Sandbox

The interface after update is slow and veeeery slow. all animations are slowed down.

In my opinion, something is wrong with GPU usage.

https://github.com/lacmus-foundation/lacmus-app/blob/dev_avalonia_0_10/src/Program.cs#L64 - here are my startup config

I've tryed to use .UseSkia() or .With(new X11PlatformOptions { UseGpu = True }) but nothing helps

@Gillibald
Copy link
Contributor

@gosha20777
Copy link
Author

@Gillibald can you explain how i can modify this option in AppBuilder.Configure<App>()? or something else?

@gosha20777
Copy link
Author

I tried to add .With(new SkiaOptions{ MaxGpuResourceSizeBytes = 1024 * 600 * 4 * 12 * 20}) (20x more than in default)

  • Interface starts work more faster but
  • Pictures are still not rendering correctly
  • Interface buttons still disappear

@grokys
Copy link
Member

grokys commented Feb 18, 2021

Strange, cloning the repo now to take a look.

@gosha20777
Copy link
Author

@grokys I works with LARGE images
https://disk.yandex.ru/d/KXJ2iF4zUoSSlw - the archive with test image set

@grokys
Copy link
Member

grokys commented Feb 18, 2021

Thanks, I'm currently running on Windows and with your test image set I indeed see that image rendering is slow, but as you say it's improved by giving skia more GPU resources.

  • I'm not seeing the interface buttons disappearing, I guess I need to test on Linux. Have you tried on Windows yourself by any chance?
  • What do you mean by "Pictures are still not rendering correctly"? They look OK in the movie you posted above but I probably just don't know what I'm looking for

In addition, the application here seems to be using the light theme while the movie is using the dark theme, could it be that I'm testing a different commit to you? I checked out 5a6a5bb.

@gosha20777
Copy link
Author

gosha20777 commented Feb 18, 2021

@grokys

  1. Commit is correct
  2. It doesn't matter what theme you use. You can switch it in the settings.
    Try to go to File - settings and move your mouse in the settings window:

Peek 2021-02-18 15-30

  1. Pictures
  • open pictures (File - Open)
  • Select Picture
  • Scroll it (mouse wheel)
  • See that only part of the picture is shown in front of you, but not all of it:
    Screenshot from 2021-02-18 15-36-47

@gosha20777
Copy link
Author

gosha20777 commented Feb 18, 2021

Peek 2021-02-18 16-06

The same you can see at Citrus.Avalonia.Sandbox
https://github.com/worldbeater/Citrus.Avalonia

  1. git clone https://github.com/worldbeater/Citrus.Avalonia.git
  2. build and run Citrus.Avalonia.Sandbox

@gosha20777
Copy link
Author

  • swithed to the default theme from Citrus.Avalonia

Buttons will works fine and now is not disappear

But: images still rendering incorrect: only a small part of image shows.

@grokys
Copy link
Member

grokys commented Feb 18, 2021

I think only a small part of the image showing is due to how you're using the ZoomAndPan control. If you use DevTools and hover over the ItemsControl in the ZoomBorder you can see the control highlighted in blue, and the ItemsControl doesn't fill the ZoomBorder:

image

(It's a bit hard to see here but there is a blue rectangle overlay displaying the bounds of the control)

It looks like the Bounds of the ItemsControl is correct but it has a RenderTransform applied which is making it smaller. I think the render transform needs to apply to the image not the ItemsControl itself.

Given that the problems were:

  • Slow: fixed by giving skia more memory
  • Buttons disappearing: fixed by switching to default Citrus.Avalonia theme
  • Image rendering incorrectly: problem with zooming the wrong thing

I'm going to close this issue. Please add a comment if you think I'm closing in error.

@grokys grokys closed this as completed Feb 18, 2021
@maxkatz6
Copy link
Member

Buttons disappearing: fixed by switching to default Citrus.Avalonia theme

I am not sure if it's normal for Citrus.Avalonia. Problem can be on our side too. @worldbeater

@gosha20777
Copy link
Author

gosha20777 commented Feb 19, 2021

yep i think too. Citrus.Avalonia is not use any difficult and custom logic, it is simply set of modifiers for default theme...

I did a little research and ran the Citrus.Avalonia.Sandbox on different os. Buttons disappear only on Linux Ubuntu 20.10 (gnome). But for Ubuntu KDE everything is fine. It seems strange to me. I advise you to pay attention to this problem and look at behavior of Citrus.Avalonia.Sandbox.

@grokys
Copy link
Member

grokys commented Feb 19, 2021

Ok reopening then!

@worldbeater
Copy link
Contributor

worldbeater commented Feb 22, 2021

Yeah encountered yet another runtime theme changing issue with Citrus.Avalonia #5530 Assuming Citrus.Avalonia is just a bunch of style selectors, probably we are using a weird selector somewhere in the library. Although I wasn't able to find out what's causing the buggy behavior yet, so probably that's something else.

@gosha20777
Copy link
Author

d

@gosha20777
Copy link
Author

gosha20777 commented Aug 10, 2021

I was able to spot the problem.

  • The problem concerns the Border control.
  • It does not work correctly with non-symmetric BorderThickness.
  • This only appears on Linux with nvidia drivers

How to reproduce?
Create the application with:
App.xaml

<Application xmlns="https://github.com/avaloniaui"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             x:Class="MyApp">
    <Application.Styles>
        <StyleInclude Source="avares://Avalonia.Themes.Default/DefaultTheme.xaml"/>
        <StyleInclude Source="avares://Avalonia.Themes.Default/Accents/BaseDark.xaml" />
    </Application.Styles>
</Application>

MainWindow,xaml

<Window xmlns="https://github.com/avaloniaui"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Background="{DynamicResource ThemeBackgroundColor}"
        x:Class="MyApp.MainWindow"
        Width="920" Height="630">
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>
        <Border Padding="20"
                CornerRadius="3"
                BorderThickness="2 1 2 4"
                BorderBrush="Black"
                Background="Red"
                Margin="7"
                BoxShadow="5 5 10 2 Blue">
            <Grid>
                <Grid.RowDefinitions>
                    <RowDefinition Height="*"/>
                    <RowDefinition Height="*"/>
                    <RowDefinition Height="*"/>
                </Grid.RowDefinitions>
                <ComboBox Grid.Row="0" SelectedIndex="0">
                    <ComboBoxItem Content="First option" />
                    <ComboBoxItem Content="Second option" />
                    <ComboBoxItem Content="Third option" />
                </ComboBox>
                <ComboBox Grid.Row="1" SelectedIndex="0">
                    <ComboBoxItem Content="First option" />
                    <ComboBoxItem Content="Second option" />
                    <ComboBoxItem Content="Third option" />
                </ComboBox>
                <ComboBox Grid.Row="2" SelectedIndex="0">
                    <ComboBoxItem Content="First option" />
                    <ComboBoxItem Content="Second option" />
                    <ComboBoxItem Content="Third option" />
                </ComboBox>
            </Grid>
        </Border>
    </Grid>
</Window>

See a problem.

But it works fine with symmetric BorderThickness (e.g. BorderThickness="2 1 2 4")
It also works fine when I use <FluentTheme Mode="Dark"></FluentTheme> in App.xaml (I do not know why)

@gosha20777
Copy link
Author

bug.mp4

@maxkatz6
Copy link
Member

Expected to be fixed in 0.10.11 with updated Skia. It did fix another similar issue on m1.
If not - ping me to reopen.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants