[mythtv] NVidia Shield screen resolution

Mark Spieth mark at digivation.com.au
Thu Aug 2 22:26:32 UTC 2018


On 8/3/2018 2:50 AM, Peter Bennett wrote:
>
>
>
> 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 states
>
> /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.
Some more ideas...

1. In AndroidManifest.xml set android.app.auto_screen_scale_factor to true

2. https://stackoverflow.com/questions/42898179/android-ui-scale
set scale factor using the getPhysicalWidth or perhaps 
getDisplayMetrics(). May work.
OnCreate is in src/org/qtproject/qt5/android/bindings/QtActivity.java

We dont have a layout file so cant adapt this. my search terms are 
"android application ui scaling"

HTH but probably not
Mark




-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mythtv.org/pipermail/mythtv-dev/attachments/20180803/76fbb081/attachment.html>


More information about the mythtv-dev mailing list