[mythtv] NVidia Shield screen resolution

Peter Bennett pb.mythtv at gmail.com
Thu Aug 2 16:50:51 UTC 2018

On 08/01/2018 07:47 PM, Mark Spieth wrote:
> Another thing to try
> in qt src
> qtbase/src/android/jar/src/org/qtproject/qt5/android
> change all getMetrics calls to getRealMetrics in the java files.
> It may be possible to copy these to android-package-source tree but 
> not sure as they are in the jar directory not the java directory. 
> Should work though and then we can modify them as required without 
> patching qt. It would mean a diff/merge on updating qt though just in 
> case these change.
> The optimal change is to check for PAI or try except get realmetrics 
> and then use getmetrics as a fallback. However since the APIs we are 
> targeting, this is probably not necessary as getRealMetrics should be 
> available always.
> Mark
Hi Mark

Thanks for the suggestions. I still have no success.

getRealMetrics returns the exact same faulty result as getMetrics.

I found I can get the actual values from 
android.view.Display.Mode.getPhysicalWidth and getPhysicalHeight. Those 
return the real pixel size.

I changed the call to QtNative.setApplicationDisplayMetrics to use those 
real pixel sizes instead of the ones from getMetrics.

Everything looks fine in the log messages:

androidjnimain.cpp setDisplayMetrics wP=3840 hP=2160 dWP=3840 dHP=2160 
xdpi=213.000000 ydpi=213.000000 sD=2.000000 d=2.000000
qandroidplatformintegration.cpp setDefaultDisplayMetrics gw=3840 gh=2160 
sw=458 sh=258 scrW=3840 scrH=2160
androidjnimain.cpp createSurface x=0 y=0 w=100 h=30
androidjnimain.cpp setSurfaceGeometry x=0 y=0 w=3840 h=2160

HOWEVER, on the screen is now a hugely enlarged version of the top left 
hand corner of the MythTV GUI. MythTV is drawing it to the correct 4K 
size but QT and android have taken the picture and scaled it to twice 
the size.

The Android documentation of android.view.Display.Mode.getPhysicalWidth 

/Note that due to application UI scaling, the number of pixels made 
available to applications when the mode is active (as reported by 
Display.getHeight() may differ from the mode's actual resolution (as 
reported by this function).//
//For example, applications running on a 4K display may have their UI 
laid out and rendered in 1080p and then scaled up. Applications can take 
advantage of the extra resolution by rendering content through a 
SurfaceView using full size buffers.//
It seems to me that this is what we are doing, without success.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mythtv.org/pipermail/mythtv-dev/attachments/20180802/1869a238/attachment.html>

More information about the mythtv-dev mailing list