Kodi Community Forum
Linux How to automatically set xrandr Broadcast RGB upon starting and exiting KODI? - Printable Version

Kodi Community Forum (https://forum.kodi.tv)
+-- Forum: Support (https://forum.kodi.tv/forumdisplay.php?fid=33)
+--- Forum: General Support (https://forum.kodi.tv/forumdisplay.php?fid=111)
+---- Forum: Linux (https://forum.kodi.tv/forumdisplay.php?fid=52)
---- Thread: Linux How to automatically set xrandr Broadcast RGB upon starting and exiting KODI? (/showthread.php?tid=279014)



How to automatically set xrandr Broadcast RGB upon starting and exiting KODI? - qp9013625 - 2016-06-08

Hi,

anyone here who could explain how to automatically execute:

Code:
xrandr --output $OUTPUT --set "Broadcast RGB" "Full"

upon starting Kodi and automatically executing:

Code:
xrandr --output $OUTPUT --set "Broadcast RGB" "Limited 16:235"

upon exiting Kodi?

So that the the GPU outputs at full range when Kodi starts and switches back to limited range when Kodi exits.

Regards


RE: How to automatically execute xrandr upon starting and exiting Kodi? - fritsch - 2016-06-08

mafancyscripts.sh:

Code:
#!/bin/sh
xrandr -display :0 --output $OUTPUT --set "Broadcast RGB" "Full"
kodi
xrandr -display :0 --output $OUTPUT --set "Broadcast RGB" "Limited 16:235"

Edit: Obviously you need to define $OUTPUT which might be HDMI1 or HDMI2 or something similar.


RE: How to automatically set xrandr Broadcast RGB upon starting and exiting KODI? - qp9013625 - 2016-10-08

Couldn't this be added as an option to KODI, so that it could be adjusted from inside KODI?


RE: How to automatically set xrandr Broadcast RGB upon starting and exiting KODI? - qp9013625 - 2017-01-14

(2016-10-08, 20:32)qp9013625 Wrote: Couldn't this be added as an option to KODI, so that it could be adjusted from inside KODI?

Anyone?

Couldn't this be controlled directly from within KODI by adding an option for it? Or would this technically be impossible?


RE: How to automatically set xrandr Broadcast RGB upon starting and exiting KODI? - fritsch - 2017-01-14

Quite easy: write a very simple python script and add it to kodi. Or use autostart.py

See: HOW-TO:HelloWorld_addon (wiki) you can use the hooks to do something on quit and something after start and so on


RE: How to automatically set xrandr Broadcast RGB upon starting and exiting KODI? - qp9013625 - 2017-01-14

No, I mean an official option placed in the video output settings of KODI.


RE: How to automatically set xrandr Broadcast RGB upon starting and exiting KODI? - fritsch - 2017-01-14

There is no place in kodi for that. As it's obsolete and is only relevant for certain users, which can easily workaround that. It is Linux only, it is intel only, but also intel only when xf86-video-intel is in place, which is replaced by all major distributions with modesetting anways - just two days ago Fedora made the switch. And - as you know - it only works on X11. An application run on a desktop should not really reconfigure the xserver.


RE: How to automatically set xrandr Broadcast RGB upon starting and exiting KODI? - qp9013625 - 2017-01-14

(2017-01-14, 15:22)fritsch Wrote: but also intel only when xf86-video-intel is in place, which is replaced by all major distributions with modesetting anways - just two days ago Fedora made the switch.

You are obviously wrong... I am running xf86-video-modesetting and still can adjust "Broadcast RGB" via xrandr.

Of course it's also relevant for xf86-video-modesetting. The xf86-video-* drivers are just the DDX drivers.

Of course xf86-video-modesetting still uses the Intel kernel driver, so "xrandr --output OUTPUT --set "Broadcast RGB" "Full/Limited 16:235/Automatic" still works.

"Broadcast RGB" has nothing to do with the DDX.


RE: How to automatically set xrandr Broadcast RGB upon starting and exiting KODI? - fritsch - 2017-01-14

Jep - you are right.


RE: How to automatically set xrandr Broadcast RGB upon starting and exiting KODI? - qp9013625 - 2017-01-14

Yeah, and what you said regarding "Intel only" also might not be correct at all in the future, because an option to adjust the RGB range / color space is also being worked on for amdgpu / radeon, see:

https://bugs.freedesktop.org/show_bug.cgi?id=83226


RE: How to automatically set xrandr Broadcast RGB upon starting and exiting KODI? - fritsch - 2017-01-14

A lot of things that is true right now might not be correct in the future :-)


RE: How to automatically set xrandr Broadcast RGB upon starting and exiting KODI? - qp9013625 - 2017-01-14

Since you have commented in that thread yourself already, you should know that some of it already has landed upstream and there are also patches available already Wink.


RE: How to automatically set xrandr Broadcast RGB upon starting and exiting KODI? - fritsch - 2017-01-14

I know. I hessitate a bit adding stuff, that can be easily done via command line without any trouble. Distributions like LibreELEC have a systemd-service plus a kodi default settings policy in place that does these things automatically.

For a desktop: 2354154 (post) - and perhaps in half a year X11 is dropped from kodi completely? :-) and we go MIR route only? one does not know.

To make things short: I won't implement it as I see no need. But as this is free software, come up with a PR and it can be discussed obviously.


RE: How to automatically set xrandr Broadcast RGB upon starting and exiting KODI? - qp9013625 - 2017-01-14

(2017-01-14, 16:45)fritsch Wrote: I hessitate a bit adding stuff, that can be easily done via command line without any trouble.

Coming from the Weston discussion, it seems like there might actually be some kind of API that allows to adjust these "connector properties", so maybe KODI could simply make use of this API:

https://bugs.freedesktop.org/show_bug.cgi?id=99406
https://01.org/linuxgraphics/gfx-docs/drm/drm-kms-properties.html

?