RPi4 how control individual HDMI ports while using kms

This forum is for topics dealing with problems with software specifically in the AArch64 repo.

RPi4 how control individual HDMI ports while using kms

Postby unformatted » Thu Feb 23, 2023 11:37 am

I'm running linux-rpi on RPi4 with kodi-rpi. HDMI 0 connects to my monitor, HDMI 1 connects to my audio system. Since the monitor consumes a lot of power and most of the time I'm only listening to music I want to power the monitor down using a script (keymap to remote).

While using fkms I can do that using the following:
$this->bbcode_second_pass_code('', '
[user@PC19 ~]$ tvservice -l
2 attached device(s), display ID's are :
Display Number 2, type HDMI 0
Display Number 7, type HDMI 1
vcgencmd display_power 0/1 2 > turns HDMI 0 off/on
vcgencmd display_power 0/1 7 > turns HDMI 1 off/on
')

While using kms this does not work:
$this->bbcode_second_pass_code('', '
[user@PC19 ~]$ tvservice -l
tvservice is not supported when using the vc4-kms-v3d driver.
Similar features are available with standard linux tools
such as modetest from libdrm-tests.
vcgencmd display_power 0/1 2 > returns display_power=-1
vcgencmd display_power 0/1 7 > returns display_power=-1
')

I understand that vcgencmd display_power controls the firmware display driver while kms uses the kernel driver. I've searched the raspberry pi forum but couldn't find any solution since most of the time raspberry OS is involved and I'm only using kodi standalone.

How can I control the individual HDMI ports while using kms?
unformatted
 
Posts: 120
Joined: Tue Mar 09, 2021 5:23 pm

Re: RPi4 how control individual HDMI ports while using kms

Postby robg » Thu Feb 23, 2023 2:03 pm

Just to get a clearer picture: What's wrong with the suggested tool (modetest from libdrm-tests)?
robg
 
Posts: 187
Joined: Tue Jan 05, 2021 8:22 am

Re: RPi4 how control individual HDMI ports while using kms

Postby unformatted » Thu Feb 23, 2023 4:31 pm

It's just that I have no idea how to use the modetest tool and I couldn't find any documentation.
unformatted
 
Posts: 120
Joined: Tue Mar 09, 2021 5:23 pm

Re: RPi4 how control individual HDMI ports while using kms

Postby robg » Thu Feb 23, 2023 7:13 pm

You're right, I did not find any substantial documentation either. I guess you have to work your way through the help output:
$this->bbcode_second_pass_code('', '$ modetest -h
usage: modetest [-acDdefMPpsCvrw]

Query options:

-c list connectors
-e list encoders
-f list framebuffers
-p list CRTCs and planes (pipes)

Test options:

-P <plane_id>@<crtc_id>:<w>x<h>[+<x>+<y>][*<scale>][@<format>] set a plane
-s <connector_id>[,<connector_id>][@<crtc_id>]:[#<mode index>]<mode>[-<vrefresh>][@<format>] set a mode
-C test hw cursor
-v test vsynced page flipping
-r set the preferred mode for all connectors
-w <obj_id>:<prop_name>:<value> set property
-a use atomic API
-F pattern1,pattern2 specify fill patterns

Generic options:

-d drop master after mode set
-M module use the given driver
-D device use the given device

Default is to dump all info.
')

I'm sure that any modetest-specific questions will be answered on the RPI forum (despite the fact that you are running ALARM.)
robg
 
Posts: 187
Joined: Tue Jan 05, 2021 8:22 am

Re: RPi4 how control individual HDMI ports while using kms

Postby unformatted » Sun Feb 26, 2023 11:58 am

modetest seems to be only for testing. You can use it as follows:
$this->bbcode_second_pass_code('', '
[user@PC19 ~]$ modetest -c (this will give you a long list of connected devices and settings)
..
Connectors:
id encoder status name size (mm) modes encoders
32 31 connected HDMI-A-1 450x250 18 31
modes:
index name refresh (Hz) hdisp hss hse htot vdisp vss vse vtot
#0 1600x900 59.98 1600 1648 1680 1760 900 903 908 926 97750 flags: phsync, nvsync; type: preferred, userdef, driver
#1 1280x1024 75.02 1280 1296 1440 1688 1024 1025 1028 1066 135000 flags: phsync, pvsync; type: driver
..
')
You can create a test pattern as follows:
$this->bbcode_second_pass_code('', '
[user@PC19 ~]$ modetest -M vc4 -s 32:#0
setting mode 1600x900-59.98Hz on connectors 32, crtc 96
failed to set mode: Permission denied
')
but you have to stop kodi first:
$this->bbcode_second_pass_code('', '
user@PC19 ~]$ sudo systemctl stop kodi.service
')
and then:
$this->bbcode_second_pass_code('', '
[user@PC19 ~]$ modetest -M vc4 -s 32:#0
setting mode 1600x900-59.98Hz on connectors 32, crtc 96
failed to set gamma: Function not implemented
')
which gives a nice test pattern at the given resolution (#0).

There seems to be no alternative for vcgencmd with kms but using kodi, the power save setting has the option of putting the display to sleep when idle after 5 mins or more and that works while using kms. So I posted on kodi forum https://forum.kodi.tv/showthread.php?tid=372237.
unformatted
 
Posts: 120
Joined: Tue Mar 09, 2021 5:23 pm


Return to ARMv8

Who is online

Users browsing this forum: No registered users and 2 guests