Jetson nano force custom screen resolution over HDMI

Hi, i am using jetson nano without X11 to run my Qt app on the eglfs platform with egl_kms_egldevice backend.
The application works fine on landscape mode, is there any way to set custom resolution to the HDMI output so that i can force it to run at 1080 * 1920 as potrait? or any way to rotate the HDMI output?

Hi,

It depends on whether your Qt application provides any API to rotate the screen through DRM KMS.

Thanks for the reply @WayneWWW,
Qt does support custom KMS/DRM configurations via a json file which is read by the Qt app via an environment variable.
Please see this link, in the Display Output (EGLFS with eglfs_kms backend) section
https://doc.qt.io/qt-5/embedded-linux.html#eglfs

It says to make a JSON file with the following parameters
{
“device”: “/dev/dri/card1”,
“hwcursor”: false,
“pbuffers”: true,
“outputs”: [
{
“name”: “VGA1”,
“mode”: “off”
},
{
“name”: “HDMI1”,
“mode”: “1024x768”
}
]
}

The problem is that there is no /dev/dri in jetson nano, do you have any idea what the default device should be?

Hi,

Please try below command and the device under /dev/dri should be generated.

$ sudo modprobe tegra-udrm modeset=1

Hi @WayneWWW,
I have tried the command you listed and /dev/dri succesfully popped up with card0 and renderD128
I then tried setting custom KMS/DRM configurations, setting device to card0
{
“device”: “/dev/dri/card0”,
“hwcursor”: false,
“pbuffers”: true,
“outputs”: [
{
“name”: “HDMI1”,
“mode”: “1080x1920”
}
]
}

but when i run the app it gets the following error and crashes

QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to ‘/tmp/runtime-root’
Could not open DRM (NV) device
Aborted (core dumped)

i have also tried using renderD128 as the device but still the same error pops up.

Is there any way in which i can set custom resolution by manually setting it up via any API exposed by DRM/KMS?

Could you share the Qt log in no error case?

Just wonder which device does your Qt open in your first try.

which log are you talking about?

when running the app without the passing the custom DRM/KMS config json, the app works fine.
these are the environment variables that are set.
export QT_QPA_EGLFS_HIDECURSOR=0
export QT_QPA_EGLFS_INTEGRATION=eglfs_kms_egldevice

after running the app, this is the output on the console:

Setting framebuffer size is only available with DRM atomic API
Unable to query physical screen size, defaulting to 100 dpi.
To override, set QT_QPA_EGLFS_PHYSICAL_WIDTH and QT_QPA_EGLFS_PHYSICAL_HEIGHT (in millimeters).

if i enable QT_DEBUG_PLUGINS=1, i get

QFactoryLoader::QFactoryLoader() checking directory path “/usr/local/Qt-5.13.2/plugins/platforms” …
QFactoryLoader::QFactoryLoader() looking at “/usr/local/Qt-5.13.2/plugins/platforms/libqeglfs.so”
Found metadata in lib /usr/local/Qt-5.13.2/plugins/platforms/libqeglfs.so, metadata=
{
“IID”: “org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3”,
“MetaData”: {
“Keys”: [
“eglfs”
]
},
“archreq”: 0,
“className”: “QEglFSIntegrationPlugin”,
“debug”: false,
“version”: 331008
}

Got keys from plugin meta data (“eglfs”)
QFactoryLoader::QFactoryLoader() looking at “/usr/local/Qt-5.13.2/plugins/platforms/libqlinuxfb.so”
Found metadata in lib /usr/local/Qt-5.13.2/plugins/platforms/libqlinuxfb.so, metadata=
{
“IID”: “org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3”,
“MetaData”: {
“Keys”: [
“linuxfb”
]
},
“archreq”: 0,
“className”: “QLinuxFbIntegrationPlugin”,
“debug”: false,
“version”: 331008
}

Got keys from plugin meta data (“linuxfb”)
QFactoryLoader::QFactoryLoader() looking at “/usr/local/Qt-5.13.2/plugins/platforms/libqminimal.so”
Found metadata in lib /usr/local/Qt-5.13.2/plugins/platforms/libqminimal.so, metadata=
{
“IID”: “org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3”,
“MetaData”: {
“Keys”: [
“minimal”
]
},
“archreq”: 0,
“className”: “QMinimalIntegrationPlugin”,
“debug”: false,
“version”: 331008
}

Got keys from plugin meta data (“minimal”)
QFactoryLoader::QFactoryLoader() looking at “/usr/local/Qt-5.13.2/plugins/platforms/libqminimalegl.so”
Found metadata in lib /usr/local/Qt-5.13.2/plugins/platforms/libqminimalegl.so, metadata=
{
“IID”: “org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3”,
“MetaData”: {
“Keys”: [
“minimalegl”
]
},
“archreq”: 0,
“className”: “QMinimalEglIntegrationPlugin”,
“debug”: false,
“version”: 331008
}

Got keys from plugin meta data (“minimalegl”)
QFactoryLoader::QFactoryLoader() looking at “/usr/local/Qt-5.13.2/plugins/platforms/libqoffscreen.so”
Found metadata in lib /usr/local/Qt-5.13.2/plugins/platforms/libqoffscreen.so, metadata=
{
“IID”: “org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3”,
“MetaData”: {
“Keys”: [
“offscreen”
]
},
“archreq”: 0,
“className”: “QOffscreenIntegrationPlugin”,
“debug”: false,
“version”: 331008
}

Got keys from plugin meta data (“offscreen”)
QFactoryLoader::QFactoryLoader() looking at “/usr/local/Qt-5.13.2/plugins/platforms/libqvnc.so”
Found metadata in lib /usr/local/Qt-5.13.2/plugins/platforms/libqvnc.so, metadata=
{
“IID”: “org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3”,
“MetaData”: {
“Keys”: [
“vnc”
]
},
“archreq”: 0,
“className”: “QVncIntegrationPlugin”,
“debug”: false,
“version”: 331008
}

Got keys from plugin meta data (“vnc”)
QFactoryLoader::QFactoryLoader() checking directory path “/home/maglash/jetson/platforms” …
loaded library “/usr/local/Qt-5.13.2/plugins/platforms/libqeglfs.so”
QFactoryLoader::QFactoryLoader() checking directory path “/usr/local/Qt-5.13.2/plugins/egldeviceintegrations” …
QFactoryLoader::QFactoryLoader() looking at “/usr/local/Qt-5.13.2/plugins/egldeviceintegrations/libqeglfs-emu-integration.so”
Found metadata in lib /usr/local/Qt-5.13.2/plugins/egldeviceintegrations/libqeglfs-emu-integration.so, metadata=
{
“IID”: “org.qt-project.qt.qpa.egl.QEglFSDeviceIntegrationFactoryInterface.5.5”,
“MetaData”: {
“Keys”: [
“eglfs_emu”
]
},
“archreq”: 0,
“className”: “QEglFSEmulatorIntegrationPlugin”,
“debug”: false,
“version”: 331008
}

Got keys from plugin meta data (“eglfs_emu”)
QFactoryLoader::QFactoryLoader() looking at “/usr/local/Qt-5.13.2/plugins/egldeviceintegrations/libqeglfs-kms-egldevice-integration.so”
Found metadata in lib /usr/local/Qt-5.13.2/plugins/egldeviceintegrations/libqeglfs-kms-egldevice-integration.so, metadata=
{
“IID”: “org.qt-project.qt.qpa.egl.QEglFSDeviceIntegrationFactoryInterface.5.5”,
“MetaData”: {
“Keys”: [
“eglfs_kms_egldevice”
]
},
“archreq”: 0,
“className”: “QEglFSKmsEglDeviceIntegrationPlugin”,
“debug”: false,
“version”: 331008
}

Got keys from plugin meta data (“eglfs_kms_egldevice”)
QFactoryLoader::QFactoryLoader() looking at “/usr/local/Qt-5.13.2/plugins/egldeviceintegrations/libqeglfs-x11-integration.so”
Found metadata in lib /usr/local/Qt-5.13.2/plugins/egldeviceintegrations/libqeglfs-x11-integration.so, metadata=
{
“IID”: “org.qt-project.qt.qpa.egl.QEglFSDeviceIntegrationFactoryInterface.5.5”,
“MetaData”: {
“Keys”: [
“eglfs_x11”
]
},
“archreq”: 0,
“className”: “QEglFSX11IntegrationPlugin”,
“debug”: false,
“version”: 331008
}

Got keys from plugin meta data (“eglfs_x11”)
QFactoryLoader::QFactoryLoader() checking directory path “/home/maglash/jetson/egldeviceintegrations” …
loaded library “/usr/local/Qt-5.13.2/plugins/egldeviceintegrations/libqeglfs-kms-egldevice-integration.so”
Setting framebuffer size is only available with DRM atomic API
QFactoryLoader::QFactoryLoader() checking directory path “/usr/local/Qt-5.13.2/plugins/imageformats” …
QFactoryLoader::QFactoryLoader() looking at “/usr/local/Qt-5.13.2/plugins/imageformats/libqgif.so”
Found metadata in lib /usr/local/Qt-5.13.2/plugins/imageformats/libqgif.so, metadata=
{
“IID”: “org.qt-project.Qt.QImageIOHandlerFactoryInterface”,
“MetaData”: {
“Keys”: [
“gif”
],
“MimeTypes”: [
“image/gif”
]
},
“archreq”: 0,
“className”: “QGifPlugin”,
“debug”: false,
“version”: 331008
}

Got keys from plugin meta data (“gif”)
QFactoryLoader::QFactoryLoader() looking at “/usr/local/Qt-5.13.2/plugins/imageformats/libqico.so”
Found metadata in lib /usr/local/Qt-5.13.2/plugins/imageformats/libqico.so, metadata=
{
“IID”: “org.qt-project.Qt.QImageIOHandlerFactoryInterface”,
“MetaData”: {
“Keys”: [
“ico”,
“cur”
],
“MimeTypes”: [
“image/vnd.microsoft.icon”,
“image/vnd.microsoft.icon”
]
},
“archreq”: 0,
“className”: “QICOPlugin”,
“debug”: false,
“version”: 331008
}

Got keys from plugin meta data (“ico”, “cur”)
QFactoryLoader::QFactoryLoader() looking at “/usr/local/Qt-5.13.2/plugins/imageformats/libqjpeg.so”
Found metadata in lib /usr/local/Qt-5.13.2/plugins/imageformats/libqjpeg.so, metadata=
{
“IID”: “org.qt-project.Qt.QImageIOHandlerFactoryInterface”,
“MetaData”: {
“Keys”: [
“jpg”,
“jpeg”
],
“MimeTypes”: [
“image/jpeg”,
“image/jpeg”
]
},
“archreq”: 0,
“className”: “QJpegPlugin”,
“debug”: false,
“version”: 331008
}

Got keys from plugin meta data (“jpg”, “jpeg”)
QFactoryLoader::QFactoryLoader() checking directory path “/home/maglash/jetson/imageformats” …
loaded library “/usr/local/Qt-5.13.2/plugins/imageformats/libqgif.so”
loaded library “/usr/local/Qt-5.13.2/plugins/imageformats/libqico.so”
loaded library “/usr/local/Qt-5.13.2/plugins/imageformats/libqjpeg.so”
Unable to query physical screen size, defaulting to 100 dpi.
To override, set QT_QPA_EGLFS_PHYSICAL_WIDTH and QT_QPA_EGLFS_PHYSICAL_HEIGHT (in millimeters).
Found metadata in lib /usr/local/Qt-5.13.2/qml/QtQuick.2/libqtquick2plugin.so, metadata=
{
“IID”: “org.qt-project.Qt.QQmlExtensionInterface/1.0”,
“archreq”: 0,
“className”: “QtQuick2Plugin”,
“debug”: false,
“uri”: [
“QtQuick.2”
],
“version”: 331008
}

loaded library “/usr/local/Qt-5.13.2/qml/QtQuick.2/libqtquick2plugin.so”
Found metadata in lib /usr/local/Qt-5.13.2/qml/QtQuick/Window.2/libwindowplugin.so, metadata=
{
“IID”: “org.qt-project.Qt.QQmlExtensionInterface/1.0”,
“archreq”: 0,
“className”: “QtQuick2WindowPlugin”,
“debug”: false,
“uri”: [
“QtQuick.Window.2”
],
“version”: 331008
}

loaded library “/usr/local/Qt-5.13.2/qml/QtQuick/Window.2/libwindowplugin.so”
QFactoryLoader::QFactoryLoader() checking directory path “/usr/local/Qt-5.13.2/plugins/accessible” …
QFactoryLoader::QFactoryLoader() checking directory path “/home/maglash/jetson/accessible” …
QFactoryLoader::QFactoryLoader() checking directory path “/usr/local/Qt-5.13.2/plugins/accessiblebridge” …
QFactoryLoader::QFactoryLoader() checking directory path “/home/maglash/jetson/accessiblebridge” …

while researching over this issue i saw that one can set custom framebuffer size via fbset …
for example "fbset -fb /dev/fb0 -g 1920 1080 1920 1080 32 "
looking into it, will reply if i find something.

When you run Qt application, it should print some logs to tell you which device it is trying to open for DRM.

We need that log.

when i run my qt application, the only thing that gets printed is

Setting framebuffer size is only available with DRM atomic API
Unable to query physical screen size, defaulting to 100 dpi.
To override, set QT_QPA_EGLFS_PHYSICAL_WIDTH and QT_QPA_EGLFS_PHYSICAL_HEIGHT (in millimeters).

Is there any way to just rotate the display out over HDMI by 90 degrees?

hmmm, during my last test on Qt5, there should be a log to printed as below thread.

@WayneWWW
I was able to load custom DRM/KMS configurations using the following json file
{
“device”: “/dev/dri/card0”,
“outputs”: [
{
“name”: “HDMI1”,
“mode”: “1080x1920”
}
]
}
i removed the pbuffers:true line
this allowed QT to do custom KMS,
but now the issue is that my monitor doesn’t support the timing for the 1080*1920 xD
btw thank you very much for your help.

@WayneWWW
Well, just wanted to ask you something,
under X, we can use xrandr -o left to rotate the screen and this works with fine my monitor.
but the same could not be achieved by setting a custom resolution of 1080*1920 via KMS, my monitor displays a message saying incorrect timing parameters.
But as i am running my app over eglfs without X, using xrandr is not possible.
How does xrandr achieve this rotation?

Hi,

I think you misunderstand something. Sorry that I didn’t notice that in the beginning.

In brief, xrandr does not do the same thing as your Qt app.

When you write mode=1080x1920 in Qt, it is actually trying to search 1080x1920 mode in your monitor EDID, and it failed since there is no such mode.

This is actually same as you are trying to set 1080x1920 mode in xrandr, and xrandr will return error too.

What xrandr does is set the mode to 1920x1080 and use software configuration to make it rotate 90/270 degree. It is not really a 1080x1920 mode.

Our DRM lib should be able to support this too.
I just notice some variable that is available to do this in Qt. Sorry that I don’t have much experience in Qt so need you to try.

@WayneWWW Thanks for your response!
I now understand why setting manual mode of 1080x1920 doesn’t work, thanks.
I had already tried setting the environment variable QT_QPA_EGLFS_ROTATION=90 before asking on this forum and it didn’t work. That why i thought that there might be any other way of doing this via manual DRM/KMS mode setting.
I have posted a thread on QT forums related to this issue, if someone answers there i will update the solution here for people having this simillar issue in the future.
Thanks again for your help! @WayneWWW

@WayneWWW after a lot of research, I got to know that setting QT_QPA_EGLFS_ROTATION only works with QtWidgets and not with QML,
somewhat flimsy solution that i came up with is to transform the whole QML scene in software with the Transform QML type. Altough this works but it means that i also incur a performance penalty though with raw power of nano it isn’t much of a problem in less intense scenes.