Opened 4 years ago
Closed 4 years ago
Last modified 4 years ago
#13618 closed Bug Report - General (fixed)
Issue in macOS for playback of 480p/i videos on retina display
Reported by: | John Hoyt | Owned by: | Mark Kendall |
---|---|---|---|
Priority: | minor | Milestone: | 31.1 |
Component: | MythTV - Video Playback | Version: | v31-fixes |
Severity: | medium | Keywords: | MacOS VideoToolbox |
Cc: | markk, David Hampton | Ticket locked: | no |
Description
In macOS Catalina with a retina display the screen only renders the playback in the bottom left quarter of the screen. This only occurs for my when playing back 480p/480i videos (i.e. 1080p videos play fullscreen)
There are also times when the screen GUI (menus) on render in the bottom quarter of the screen but the jumps back to fullscreen view after digging through menus.
A bandaid fix to the problem is to select the app, hit get info, then select the "Open in Low Resolution".
I have attached an output of mythfrontend
Attachments (28)
Change History (68)
Changed 4 years ago by
Attachment: | mythfrontend.output.txt added |
---|
comment:2 Changed 4 years ago by
Owner: | changed from Peter Bennett to Mark Kendall |
---|---|
Status: | new → accepted |
comment:3 Changed 4 years ago by
Status: | accepted → infoneeded |
---|
This is clearly related to:-
https://doc.qt.io/qt-5/highdpi.html
Unfortunately, my ageing macbook does not have a display that I can test with and I'm struggling to understand why the behaviour would be different when playing HD material - and indeed why there are no problems with the GUI.
Can you provide the same logs for:-
- playback of HD material (i.e. when it works)
- playback with SD material after 'Open in Low Resolution' works
As you are on Qt5.14, could you also try setting the 'QT_ENABLE_HIGHDPI_SCALING' environment variable and attach logs.
What happens if you enable video mode switching and try and change the GUI/video resolution to 2560x1600?
Changed 4 years ago by
Attachment: | output.lowres.480p_video.txt added |
---|
Mythfrontend out - low res set - 480 working fullscreen
Changed 4 years ago by
Attachment: | output.NON_lowres.1080.working.txt added |
---|
Mythfrontend outpu - NON low res - 1080p - working fullscreen
Changed 4 years ago by
Mythfrontend outpu - NON low res - 1080p - working fullscreen - QT_ENABLE_HIGHDPI_SCALING=1
Changed 4 years ago by
Mythfrontend outpu - NON low res - 480 - not working fullscreen - QT_ENABLE_HIGHDPI_SCALING=1
comment:4 follow-up: 5 Changed 4 years ago by
Logs uploaded. No dice on setting QT_ENABLE_HIGHDPI_SCALING (I tried both QT_ENABLE_HIGHDPI_SCALING=1 and QT_ENABLE_HIGHDPI_SCALING=0).
Can you point me to where the video mode switching setting is buried? Happy to try setting it and then setting the GUI/video resolution.
comment:5 follow-up: 6 Changed 4 years ago by
Replying to jhoyt4:
...
Can you point me to where the video mode switching setting is buried? Happy to try setting it and then setting the GUI/video resolution.
The only such setting I'm aware of is in System Preferences > Energy Saver.
comment:6 Changed 4 years ago by
The only such setting I'm aware of is in System Preferences > Energy Saver.
Unfortunately, I don't see that setting in Energy Saver (nor in Displays)
comment:7 Changed 4 years ago by
OK - progress of sorts:)
Firstly, video mode switching is accessed through 'Setup->Appearance->Separate video modes for GUI and TV playback'
If you enable that, you should then be able to select 2560x1600 for the GUI. Then just select the same resolution for 'Video output', 'Auto' for rate and 'Default' for 'Aspect'. (Using anything else for video playback may just confuse the issue and is not required for this case - as the display is native 2560x1600 and has a variable display rate - so there is no benefit in trying to use other video modes).
It would be interesting to see playback logs if that helps - though it is not a proper fix (it should work out of the box imho).
So I think the root cause of the problem is this line from the Qt docs:-
Typically, most applications work with device independent pixels; except for OpenGL and code for raster graphics.
So with a retina display, the windowing system is using 1280x800 for the mythfrontend window/widget, and this is what Qt is using/reports, but the underlying OpenGL context will be using the native display size (2560x1600).
The reason the HD video works and SD does not is not due to the different resolutions but because, in this case, the SD video is interlaced and the HD video is not. The mythtv opengl video code uses an intermediate framebuffer for deinterlacing (to improve performance) which triggers an OpenGL viewport change. The switch back to the regular/fullscreen viewport after deinterlacing is presumably where it all goes wrong - as the OpenGL context should be using 2560x1600 but is only set to 1280x800 (because that is the window size).
If you go into the details of the video display profile (Setup->Video->Playback->Current video Playback Profile - and then into the specific profile details) and disable all deinterlacing, playback *should* work.
The real head scratcher here, however, is why does the GUI work without issue? I note you said that sometimes it starts displaying in the bottom left and then reverts. Based on the assumption that the windowing system and OpenGL are using different resolutions, I don't honestly understand how it ever gets it right:)
I can only assume that there is some event received, perhaps after our window is setup, that triggers a change.
I'll pull together a debugging patch to see what is going on.
Longer term, we need a fix that works out of the box, regardless of system settings etc. Personally I don't think we want to be using a downscaled UI at all - if you are playing HD/4k material, it will just be unnecessarily downscaled - and then scaled up again by the OS; which is far from ideal.
Ideally we want to try and encourage/ensure Qt starts up with 2560x1600 (or the proper native resolution at least). I really want to avoid having to add workarounds for scaling factors etc (i.e. using https://doc.qt.io/qt-5/qwindow.html#devicePixelRatio).
What setting are you using for you macbook display? (https://support.apple.com/en-us/HT202471)
comment:8 Changed 4 years ago by
Display - Resolution set to "Default for display" (i.e. not scaled)
Setting up as follows (log uploaded):
Setup->Appearance->Separate video modes for GUI and TV playback checked
Setup->Appearance->Separate video modes for GUI and TV playback -> GUI -> 2560x1600
Setup->Appearance->Separate video modes for GUI and TV playback -> Video Output -> 2560x1600
App starts up with GUI in bottom left corner of screen
Navigate and on first click the GUI expands to fill the full screen
Playback of 1080p plays full screen
Navigate to videos - GUI stays fullscreen
Playback of 480i plays in bottom quarter of screen
Setting up as follows (log uploaded):
Setup->Appearance->Separate video modes for GUI and TV playback checked
Setup->Appearance->Separate video modes for GUI and TV playback -> GUI -> 2560x1600
Setup->Appearance->Separate video modes for GUI and TV playback -> Video Output -> 2560x1600
Setup->Video->Playback->VideoToobox?-> All deinterlacers turned off
App starts up with GUI in bottom left corner of screen
Navigate and on first click the GUI expands to fill the full screen
Playback of 1080p plays full screen
Navigate to videos - GUI stays fullscreen
Playback of 480i video - video plays in bottom left corner
Changed 4 years ago by
Attachment: | output.sepvidemode.1080pand4801.txt added |
---|
output with seperate video mode 1080p (working) 480i (not working)
Changed 4 years ago by
Attachment: | output.sepvidemode.deinterlacersoff.1080pand4801.txt added |
---|
output with seperate video mode - deinterlacers off - 1080p (working) 480i (not working)
comment:9 Changed 4 years ago by
Thanks John,
Unfortunately the switch to 2560x1600 is failing:-
2020-05-19 09:45:10.777729 E Display: Failed to change mode to 2560x1600@0.000Hz
Not sure if this is programmer error though... (just wondering if we are trying to switch modes before we have a main window - which will fail - I'll add that to the debug patch).
w.r.t to deinterlacing - unfortunately the extra framebuffer switch is still being triggered even without the deinterlacer - but I wouldn't worry about that for the moment.
More important is trying to figure out what is triggering the GUI to be adjusted when you navigate the menus. Very strange.
comment:10 Changed 4 years ago by
Just out of morbid curiosity, I set the GUI and playback screens to 1280x800. Confirmed 480i still plays in the bottom left corner. I can post a log entry if it will help.
comment:11 Changed 4 years ago by
I've attached a debugging patch to try and get some better detail on what is going on internally.
It also removes the line (that I'd forgotten about) that disables the high dpi environment variable override - which is presumably why it didn't change anything.
Can you attach logs for playback of SD material with and without QT_ENABLE_HIGHDPI_SCALING set?
thanks, Mark
comment:12 Changed 4 years ago by
Output files uploaded. Just a note, both playback with and without QT_ENABLE_HIGHDPI_SCALING set played back in the bottom left corner of the screen (i.e. no full screen).
Changed 4 years ago by
Attachment: | output.480i. QT_ENABLE_HIGHDPI_SCALING.eq.0.txt added |
---|
patched output 480i QT_ENABLE_HIGHDPI_SCALING=0
Changed 4 years ago by
Attachment: | output.480i. QT_ENABLE_HIGHDPI_SCALING.eq.1.txt added |
---|
patched output 480i QT_ENABLE_HIGHDPI_SCALING=1
comment:13 Changed 4 years ago by
Apologies, just realise that I forgot to run last night with -v playback. I've just done so and uploaded the verbose files (replacing the previous ones).
comment:14 Changed 4 years ago by
John - apologies for the delay. I've attached a test patch.
I'm reasonably confident the UI element is correct - though I'm still confused how the UI gets 'fixed' with the current code. The video element I'm less sure about - if nothing else, it is incomplete.
comment:15 Changed 4 years ago by
Forgot to mention - this needs an up to date version of fixes/31. I pushed a change to track the device pixel ratio.
comment:16 Changed 4 years ago by
Mark, no apologies necessary - you're the one doing the heavy lifting.
I have confirmed that playback for 1080p and 480i video does playback fullscreen on both a Macbook Pro 14" with 2560x1600 screen and a Macbook Pro 16" with 3584x2250 screen (both running Catalina). This is without having to set "Open in Low Resolution" Mode.
...but Unfortunately there's now an issue where the menu renders the background in the upper left hand corner (see attached screenshots). This now occurs on both Macbooks.
Also attached are the logs for both macs (hoping they help).
Please let me know if you need me to run in a more verbose log setting.
Changed 4 years ago by
Attachment: | output.macbookpro14.2560x1600.txt added |
---|
output from macbook pro 14" 2560x1600
Changed 4 years ago by
Attachment: | macbooprpo16.3584x2250.2.png added |
---|
output from macbook pro 16" 3584x2250
comment:17 Changed 4 years ago by
OK - fingers crossed. dpi3.diff should fix the UI image sizing. If so, can you confirm that the OSD is displayed properly as well? Thanks, Mark
comment:18 Changed 4 years ago by
Getting close
Menus look good Playback looks good
OSD - wrong size (see picture and log)
comment:19 Changed 4 years ago by
Milestone: | needs_triage → 31.1 |
---|
comment:20 Changed 4 years ago by
dpi4.diff attached.
Fingers crossed again. Hopefully UI, video and OSD all working correctly - and if working, this version is something approaching suitable for pushing.
comment:21 Changed 4 years ago by
So close.
Playback works great. OSD is at the correct size. Menus look good navigating and in mythvideo.
Unfortunately there's now a new bug introduces in "recordings" where the UI renders in the top left corner.
Changed 4 years ago by
Attachment: | Screen Shot 2020-06-06 at 6.56.19 AM.png added |
---|
Recordings shrunk screen
comment:23 Changed 4 years ago by
Digging through the app a bit more - unfortunately no
Mythvideo in list view and gallery view is fine - but Browse view is incorrect*
Myththimage looks correct
Manage recordings is incorrect*
Information Center is incorrect*
Program Guide is incorrect*
Settings are incorrect* - if there's just a list of menus everything looks good, if there are settings things go wonky with some items rendering shrunk and other items showing full screen. Also when prompted to save the dialog box is shrunken
Theme Chooser is incorrect*
Exit menu is correct
* by incorrect - renders shrunken in upper lefthand corner of the screen
comment:24 Changed 4 years ago by
John - not sure about latest change - though I can't think of any other reason why it would be failing.
comment:25 Changed 4 years ago by
Mark, unfortunately, the latest patch does not appear to change anything.
I'm going to attach the latest log file and a screenshot from settings to show the part works / part doesn't work problem.
I also just tried this on both the macbook pro 16 and 14 hoping the change in screen resolution would provide different behavior. It unfortunately did not.
Thanks again for working on this.
Changed 4 years ago by
Attachment: | Screen Shot 2020-06-06 at 1.46.05 PM.png added |
---|
Screenshot of half working audio settings
comment:27 Changed 4 years ago by
Regretfully, still not working.
I believe it was only working because those using v30 or earlier had non-retina displays and/or set the "Open in Low Resolution" flag.
comment:28 Changed 4 years ago by
John - I was referring to your earlier feedback from a previous patch:-
Getting close Menus look good Playback looks good OSD - wrong size (see picture and log)
So I'm assuming the menus were OK at that point?
comment:30 Changed 4 years ago by
I just recompiled with dpi3 and can confirm everything (and I mean all menus - went exhaustive) work. It's just the OSD that's buggered up.
comment:31 Changed 4 years ago by
John - dpi7.diff is dpi3 with one modification to get the OSD scaled correctly.
comment:32 Changed 4 years ago by
That looks like it fixed the OSD. Playback and the menus also look good.
comment:34 Changed 4 years ago by
John - sorry, just been a little busy. Need to find time to clean up the working version before committing. May need a little testing to ensure it is working correctly:)
comment:35 Changed 4 years ago by
Mark, I'm getting the following error on the patch file. Should I try this on a specific git revision or at head like I'm currently trying?
patching file mythtv/libs/libmythui/opengl/mythpainteropengl.cpp Hunk #1 succeeded at 20 (offset 1 line). Hunk #2 succeeded at 94 (offset -1 lines). Hunk #3 FAILED at 126. Hunk #4 FAILED at 151. Hunk #5 succeeded at 245 (offset -1 lines). Hunk #6 succeeded at 271 (offset -1 lines). Hunk #7 succeeded at 279 (offset -1 lines). Hunk #8 succeeded at 311 (offset -1 lines).
All of the rest of the files patched fine.
comment:36 Changed 4 years ago by
John - I'm assuming you need the v31 version (master has diverged a little). You will also need to do a 'make distclean' in the libs/libmythui source directory - otherwise it won't pick up that MythPainter? is now a QObject.
comment:37 Changed 4 years ago by
Thanks!
I'm going to blow away my local copy of the v31 repo and start from scratch. I've had some issues in the past with distclean not getting everything and want to make sure I build the "correct" version.
comment:38 Changed 4 years ago by
Mark, I just finished testing and everything looks like it's working.
Thank you very very much for fixing all of the issues!!!
comment:39 Changed 4 years ago by
Resolution: | → fixed |
---|---|
Status: | infoneeded → closed |
Mythfrontend output