[mythtv] fixes/31 branch created!

Mike Bibbings mike.bibbings at gmail.com
Thu Feb 20 18:38:13 UTC 2020


On 19/02/2020 18:28, Mark Kendall wrote:
> On Wed, 19 Feb 2020 at 16:59, Mike Bibbings <mike.bibbings at gmail.com> wrote:
>> Ran some tests on Pi2 and Pi4 master at commit 4e0da5033
>>
>> Using your recommended settings LiveTV and recorded playback are looking
>> good for both Pi2 and Pi4.
>>
>> On occasion Pi4 LiveTV shows MPEG-2 ffmpeg   Deint None instead of 2x
>> GLSL Onefield.
> I suspect I'm going to get a lot of reports of this :(
>
> The default behaviour is now to assume progressive material and only
> switch on deinterlacing when interlaced frames are seen.
>
> The main reason for the switch is that FFmpeg is very good these days
> at detecting the interlaced flags properly and there are fewer false
> positives this way.
>
> There appear to be a number of UK SD channels that have 'mixed'
> content. Whether they are genuinely progressive, interlaced or mixed,
> I'm not sure - but regardless, it often takes anything from a few
> seconds to a few minutes for deinterlacing to actually turn on.
>
> I'm not ruling out an issue with the deinterlacing/video profile code
> but I do see this behavour a lot on UK Freeview - without any obvious
> loss of quality.
>
>> mythfrontend started by QT_QPA_PLATFORM=eglfs mythfrontend at console.
>>
>> It looks like something in drm/fkms/kernel is reading edid from the
>> connected hdmi device and deciding to ignore settings for hdmi_group and
>> hdmi_mode in /boot/config.txt.
> You probably want this:-
>
> https://doc.qt.io/qt-5/embedded-linux.html#display-output
>
> and this line is probably key:-
>
> When mode is not defined, the system's preferred mode is chosen. The
> accepted values for mode are: off, current, preferred, skip,
> widthxheight, widthxheight at vrefresh, or a modeline string.
>
> In summary, you need to create a config file for Qt to read. That
> should get the correct mode at startup. If you enable video mode
> switching in mythtv settings, it should switch the refresh rate for
> you as well (if needed, not really an issue if you are just watching
> broadcast 50Hz content).
>
> I can't test right now - but fingers crossed that should do the trick:)
>
> regards
> Mark
> _______________________________________________

Hi Mark,

I have produced a script (a bit crude, but works)  to handle the 
resolution issue on Pi2/3/4 using a qt eglfs json override file as you 
suggested.

At present I create the json file in /home/pi/

The script assumes that user has set the required resolution in 
/boot/config.txt (hdmi_group and hdmi_mode).

The script can also be run from .bashrc thus allowing autostart of 
mythfrontend at boot.

It would be nice to get the script included in mythtv-light package, so 
a user does not have to download it from somewhere.

I need to create something similar for mythtv-setup is run locally on 
the Pi (when using Pi as a mythbackend), not required if running via SSH 
from another box.


Current script named run_mythfrontend.sh

#!/bin/bash

# script to run mythfrontend from version 31 on Raspberry Pi under 
Raspian Buster using EGLFS
# can be added to .bashrc to allow autostart of mythfrontend on boot

# Last Modified 20 February 2020

# Author Mike Bibbings

# check if running via SSH, if so skip running mythfrontend, it must 
only run locally.
SSH=$(printenv | grep SSH)
if [ -n "$SSH" ]; then
     exit 1
fi

#check mythfrontend has been installed, if not abort with message
MYTHFRONTEND=`which mythfrontend`
if [ -z "$MYTHFRONTEND" ]; then
     echo -e "mythfrontend not found - please install MythTV-Light package"
     echo -e "See 'https://www.mythtv.org/wiki/MythTV_Light'\n"
     exit 1
fi

echo "Starting MythTV Frontend -- this may take a few seconds -- Please 
wait"

# set perfomance mode, not sure if needed for Pi4, do it anyway
echo performance | sudo tee 
/sys/devices/system/cpu/cpu0/cpufreq/scaling_governor

#TODO check /boot/config for hdmi_group and hdmi_mode settings
#HDMI_MODE=$(grep '^hdmi_mode' /boot/config.txt)
#HDMI_GROUP=$(grep '^hdmi_group' /boot/config.txt)

# use tvservice -s for current settings.
# assumes User has setup required resolution.
# for resolutions greater than 1920x1080 at 60Hz
# hdmi_enable_4kp60=1 is required in /boot/config.txt for Pi4 (not 
applicable to Pi2/3)

CURRENT_REFRESH=$(tvservice -s|sed -n -e 's/^.*@ //p')
#get first 2 characters
CURRENT_REFRESH=${CURRENT_REFRESH:0:2}

CURRENT_RES=$(tvservice -s|sed -n -e 's/^.*], //p')
#strip out everything except resolution e.g. 1920x1080
CURRENT_RES=${CURRENT_RES%%[[:space:]]*}

RESOLUTION="$CURRENT_RES@$CURRENT_REFRESH"

# we need override file to force correct resolution.
# QT defaults to using EDID from connected hdmi device
# pi2/3 use /dev/dri/card0,  pi4 /dev/dri/card1
# find out which model of Pi we have

PI_MODEL=$(grep -ic 'Pi 4' /proc/device-tree/model)
if [ "$PI_MODEL" = 1 ]
then
       CARD="card1"
else
       CARD="card0"
fi

#file created everytime this script is run,avoids checking previous and 
current resolution everytime
bash -c "cat >/home/pi/pi_mythfrontend.json" <<ENDOFSCRIPTINPUT
{
     "device": "/dev/dri/${CARD}",
     "outputs": [
         { "name": "HDMI1", "mode": "${RESOLUTION}" }
     ]
}
ENDOFSCRIPTINPUT

#for QT debug add to command line QT_QPA_EGLFS_DEBUG=1 
QT_LOGGING_RULES=qt.qpa.*=true
QT_QPA_PLATFORM=eglfs 
QT_QPA_EGLFS_KMS_CONFIG=/home/pi/pi_mythfrontend.json mythfrontend 
--logpath /tmp
# fixup keyboard after exit from mythfrontend (bug in QT causes segment 
fault which kills keyboard input)
kbd_mode -u

exit 0





More information about the mythtv-dev mailing list