Bug 144214 - enabling skia on macOS results in 75% of window painted in red on macOS
Summary: enabling skia on macOS results in 75% of window painted in red on macOS
Status: VERIFIED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: UI (show other bugs)
Version:
(earliest affected)
7.3.0.0 alpha0+
Hardware: All macOS (All)
: medium normal
Assignee: Not Assigned
URL:
Whiteboard: target:7.3.0
Keywords:
Depends on:
Blocks: Skia
  Show dependency treegraph
 
Reported: 2021-08-31 11:34 UTC by steve
Modified: 2021-11-21 23:08 UTC (History)
8 users (show)

See Also:
Crash report or crash signature:
Regression By:


Attachments
LO Preferences with skia enabled on macOS (255.70 KB, image/png)
2021-08-31 11:35 UTC, steve
Details
LO start center with skia enabled on macOS (968.72 KB, image/png)
2021-08-31 11:35 UTC, steve
Details
LO patch (7.09 KB, patch)
2021-09-01 14:51 UTC, Luboš Luňák
Details
Screenshot 1 (951.81 KB, image/png)
2021-11-16 18:33 UTC, Thorsten Wagner
Details
Screenshot 2 (979.69 KB, image/png)
2021-11-16 18:33 UTC, Thorsten Wagner
Details
Screenshot 3 (856.97 KB, image/png)
2021-11-16 18:34 UTC, Thorsten Wagner
Details
Screenshot 4 (2.09 MB, image/png)
2021-11-16 18:34 UTC, Thorsten Wagner
Details

Note You need to log in before you can comment on or make changes to this bug.
Description steve 2021-08-31 11:34:20 UTC
Description:
see screenshots

Using LO 7.3 master build from today 2021-08-31 on macOS 11.5.2.

Steps to Reproduce:
1. LO > Preferences > LibreOffice > View > Use Skia for all rendering (enable)
2. restart LO

Actual Results:
UI moves to top left quarter of window, rest of window space is painted red

Expected Results:
Usable LO with normal UI.


Reproducible: Always


User Profile Reset: No



Additional Info:
would love to copy about info, but that is not possible in this state.
Comment 1 steve 2021-08-31 11:35:08 UTC
Created attachment 174664 [details]
LO Preferences with skia enabled on macOS
Comment 2 steve 2021-08-31 11:35:32 UTC
Created attachment 174665 [details]
LO start center with skia enabled on macOS
Comment 3 Luboš Luňák 2021-09-01 08:31:27 UTC
Are there any specific steps needed to reproduce this? What happens if you resize the window?
Comment 4 Stephan Bergmann 2021-09-01 11:24:46 UTC
(In reply to Luboš Luňák from comment #3)
> Are there any specific steps needed to reproduce this?

I see this too, on a Mac mini connected to a 28" 3840x2160 display (and "Default for display" in the System Preferences' Displays pane).

> What happens if you resize the window?

It resizes the (too small) content and shows it in the top-left quarter of the window, and the rest of the window is painted red/pink again.
Comment 5 Luboš Luňák 2021-09-01 14:51:30 UTC
Created attachment 174703 [details]
LO patch

I see. I don't have the HW for this, and my Mac even resists attempts to enable HiDPI at least somehow for debugging, but I think I understand the issue.

Can somebody test this patch if it improves the situation in Raster and/or Metal mode? If it's still broken, please provide me with the debug output from it.
Comment 6 Commit Notification 2021-09-01 22:05:20 UTC
Luboš Luňák committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/11b954e4f92da7620ba2dc89430fa09d3946f780

Revert "make Skia the default now on Mac too" (tdf#144214)

It will be available in 7.3.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 7 Roman Kuznetsov 2021-09-02 17:58:32 UTC
I think this problem is only for HiDPI screens. I don't see the "red problem" in

Version: 7.3.0.0.alpha0+ / LibreOffice Community
Build ID: 368e21fbc34fa4104f16498a54ab77704f39e6b4
CPU threads: 4; OS: Mac OS X 10.16; UI render: Skia/Metal; VCL: osx
Locale: ru-RU (ru_RU.UTF-8); UI: en-US
Calc: threaded

but I have only fullHD 1920x1080px display
Comment 8 Roman Kuznetsov 2021-09-02 18:04:45 UTC
Thorsten, you are fixed the HiDPI macOS problem previously. May be you could help here?
Comment 9 Stephan Bergmann 2021-09-03 05:43:12 UTC
(In reply to Luboš Luňák from comment #5)
> Created attachment 174703 [details]
> LO patch
[...]
> Can somebody test this patch if it improves the situation in Raster and/or
> Metal mode? If it's still broken, please provide me with the debug output
> from it.

That patch works fine here.  (And just for the record, the debug output is

> debug:45526:491929: SETVIRDEVGRAPHICS:1x1:2x2:2
> debug:45526:491929: SETVIRDEVGRAPHICS:648x200:1296x400:2
> debug:45526:491929: CREATE:648x200:1296x400
> debug:45526:491929: SETVIRDEVGRAPHICS:1x1:2x2:2
> debug:45526:491929: SETVIRDEVGRAPHICS:1x1:2x2:2
> debug:45526:491929: SETVIRDEVGRAPHICS:220x46:440x92:2
> debug:45526:491929: SETVIRDEVGRAPHICS:1x1:2x2:2
> debug:45526:491929: SETVIRDEVGRAPHICS:181x256:362x512:2
> debug:45526:491929: SETVIRDEVGRAPHICS:1x1:2x2:2
> debug:45526:491929: SETVIRDEVGRAPHICS:178x256:356x512:2
> debug:45526:491929: SETVIRDEVGRAPHICS:1x1:2x2:2
> debug:45526:491929: CREATE:1536x818:3072x1636
> debug:45526:491929: SETVIRDEVGRAPHICS:1x1:2x2:2
> debug:45526:491929: SETVIRDEVGRAPHICS:1x1:2x2:2
> debug:45526:491929: SETVIRDEVGRAPHICS:1x1:2x2:2
> debug:45526:491929: SETVIRDEVGRAPHICS:1x1:2x2:2

for me.)
Comment 10 steve 2021-09-03 09:11:33 UTC
Thanks Lubos for your continued work on Skia. The problem that LO UI is only shown in top left quarter and the rest of the window is rendered red is persisting with todays master (of which I cannot copy the version info due to this problem).

Can you share which debug output you need and the exact steps needed to provide that info?
Comment 11 Luboš Luňák 2021-09-03 17:28:01 UTC
(In reply to Stephan Bergmann from comment #9)
> That patch works fine here.

Ok, thank you, then I think I know how to fix this. Have you tried also raster mode (I don't see its debug output in what you pasted, so just checking)?

(In reply to steve from comment #10)
> Can you share which debug output you need and the exact steps needed to
> provide that info?

I posted a patch together with the comment. If you don't know what to do with it, then don't worry about it.
Comment 12 steve 2021-09-04 08:36:22 UTC
> Have you tried also raster mode
Happy to give it a try, if you let me know how. Currently with the UI as it is, I am unable to adjust any setting.
Comment 13 Stephan Bergmann 2021-09-06 06:39:40 UTC
(In reply to Luboš Luňák from comment #11)
> Ok, thank you, then I think I know how to fix this. Have you tried also
> raster mode (I don't see its debug output in what you pasted, so just
> checking)?

No idea what you mean with "raster mode", but I note the following with the "LibreOffice - Preferences... - LibreOffice - View - Graphics Output" settings:

* "Use Skia for all rendering" off: OK

* "Use Skia for all rendering" on, "Force Skia software rendering" off: OK

* "Use Skia for all rendering" on, "Force Skia software rendering" off: All windows (documents and dialogs) only contain white background, no content at all; resizing doesn't change that.
Comment 14 Stephan Bergmann 2021-09-06 06:41:36 UTC
(In reply to Stephan Bergmann from comment #13)
> * "Use Skia for all rendering" off: OK
> 
> * "Use Skia for all rendering" on, "Force Skia software rendering" off: OK
> 
> * "Use Skia for all rendering" on, "Force Skia software rendering" off: All
> windows (documents and dialogs) only contain white background, no content at
> all; resizing doesn't change that.

typo here, the third (broken) case is the

  "Use Skia for all rendering" on, "Force Skia software rendering" ON

one
Comment 15 steve 2021-09-06 09:54:42 UTC
Another data point:

Version: 7.3.0.0.alpha0+ / LibreOffice Community
Build ID: 4cd3ce9848aa039b8d443a1257d1298231680b01
CPU threads: 8; OS: Mac OS X 10.16; UI render: default; VCL: osx
Locale: en-US (en_DE.UTF-8); UI: en-US
Calc: threaded

Use Skia for all rendering: ON
Force Skia software rendering: OFF
-> Running into top left quarter UI issue with rest of window rendered red.

@Stephan: This is interesting as that combination seems to work in your test, right? Which mac are you testing on? Using MacBookPro14,3 here.
Comment 16 Stephan Bergmann 2021-09-06 10:21:59 UTC
(In reply to steve from comment #15)
> Use Skia for all rendering: ON
> Force Skia software rendering: OFF
> -> Running into top left quarter UI issue with rest of window rendered red.
> 
> @Stephan: This is interesting as that combination seems to work in your
> test, right? Which mac are you testing on? Using MacBookPro14,3 here.

It works for me with Luboš' attachment 174703 [details] "LO patch" applied.
Comment 17 Luboš Luňák 2021-09-06 13:05:03 UTC
(In reply to Stephan Bergmann from comment #13)

Ok, thanks. I've bought an EDID emulator that allows me to fake HiDPI support, so I think I'll finish this without problems.

> No idea what you mean with "raster mode"

> "Skia software rendering"

That is raster mode :).
Comment 18 Thorsten Wagner 2021-09-24 21:55:55 UTC
Confirming that patch attached causes rendering in double size on retina displays as desired (no red areas as without patch).

I did not investigate the code, but patch seems to be an upscaling to the desired size causing blurry text again. Bitmaps are blurry too due to upscaling (see LO logo for example).

For me the advantage of using Skia on macOS is not really obvious. I do not face any performance issues with graphics using LO on macOS. To use Metal graphics implementation of CALayers (not CGLayers as used by current implementation) would be a way to continue using Apple's display technologies (such as retina text). Otherwise sharp rendering of text and bitmaps has to be implemented at least.

For a production release I recommend removing Skia options and buttons like "Run Graphics Tests" unless implementation is fully functional on macOS (no issue on master branch as long it is not included in a production release by mistake).
Comment 19 Commit Notification 2021-11-16 09:40:02 UTC
Luboš Luňák committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/b5983dbe2c41f38e653201574cf20cd4bd76e950

implement HiDPI support for Skia/Mac (tdf#144214)

It will be available in 7.3.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 20 Luboš Luňák 2021-11-16 09:46:13 UTC
This should all work properly now, closing.
Comment 21 Thorsten Wagner 2021-11-16 18:32:26 UTC
Confirming that red areas are fixed. There are serveral other issues preventing Skia on macOS ready to be released:

(1) Missing text rendering in some situations (see black boxes on screenshot 1 attached)

(2) Blurry control elements (see example within red box on screenshot 2)

(3) Incomplete rendering (see example of missing scanlines within red box on screenshot 3)

(4) Blurry bitmaps (unfortunately on retina displays not better than current native rendering implementation whichs lacks retina quality bitmaps too, see example within red box on screenshot 4)

All screenshots are taken with macOS 11.6.1 Big Sur on a retina display.

I do not know whether there are other tickets for Skia on macOS covering the issues above. If there are such other tickets please file them as related and close this ticket again.
Comment 22 Thorsten Wagner 2021-11-16 18:33:28 UTC
Created attachment 176293 [details]
Screenshot 1
Comment 23 Thorsten Wagner 2021-11-16 18:33:49 UTC
Created attachment 176294 [details]
Screenshot 2
Comment 24 Thorsten Wagner 2021-11-16 18:34:10 UTC
Created attachment 176295 [details]
Screenshot 3
Comment 25 Thorsten Wagner 2021-11-16 18:34:40 UTC
Created attachment 176296 [details]
Screenshot 4
Comment 26 Luboš Luňák 2021-11-17 09:50:46 UTC
Please create separate bugreports for separate problems. This specific problem has been fixed.
Comment 27 steve 2021-11-19 01:24:59 UTC
verified, thanks for the fix!
Comment 28 Luboš Luňák 2021-11-19 07:51:53 UTC
I"ve fixed 1),2) and 3). 4) is a generic problem that needs handling in all relevant places.

(In reply to Thorsten Wagner from comment #18)
> For me the advantage of using Skia on macOS is not really obvious. I do not
> face any performance issues with graphics using LO on macOS.

Some others do apparently: bug#113023 . Those bugreports are 3-5 years old. I don't know what exactly the problem is there, but at least some of them are about the native VCL backend not keeping up with copying so much data.
Comment 29 Thorsten Wagner 2021-11-20 18:42:03 UTC
Thank you for fixing. I filed two other tickets with further related issues:

tdf#145796
tdf#145797