[mythtv] NVidia Shield screen resolution
pb.mythtv at gmail.com
Fri Aug 3 17:00:53 UTC 2018
On 08/02/2018 06:26 PM, Mark Spieth wrote:
> 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
>>> 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.
>> 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
I tried QApplication::setAttribute(Qt::AA_DisableHighDpiScaling); (made
Also tried SurfaceHolder.setFixedSize() as suggested somewhere. Tried it
with different values. This produced bizarre results which made no sense
Also tried surface.setScaleX(); and surface.setScaleY(); Tried with
different values. More bizarre results.
Both setScale and setFixedSize are maintaining the doubling of the
pixels on the screen, and changing the size of my image within that
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the mythtv-dev