Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DietPi-Display | New tool to control console display modes and rotation (beta) #7390

Open
MichaIng opened this issue Feb 9, 2025 · 8 comments

Comments

@MichaIng
Copy link
Owner

MichaIng commented Feb 9, 2025

To allow controlling console display modes, rotation and more in a generic way on every modern hardware, we added a new script which uses the KMS/DRM sysfs and video kernel command-line parameter to do so. Both is not perfectly documented, and there are open questions and issues, hence for now it is in beta phase: https://github.com/MichaIng/DietPi/blob/dev/dietpi/dietpi-display

General video parameter documentation: https://docs.kernel.org/fb/modedb.html
We can further add reflection, refresh rate and margins, probably other options.

Also, we plan to shift most options from the dietpi-config display menu into this new script. The RPi camera module options will be probably moved elsewhere, some others are obsolete with the new kernel and will be removed. However, for now the dietpi-config menu remains untouched.

Issues/Questions:

  • /sys/class/drm/*/modes theoretically contains a list of supported modes. However, at least with my HDMI screen, if I select a smaller resolution, all larger resolutions (respectively all above in the list) are hidden. So changing back to a larger resolution only works when either resetting the settings (removing the kernel command-line parameter) in between, or setting it manually.
  • At first I though /sys/class/drm/*/modes is always shows the current mode at the top, but it does not. In above mentioned case, it just cut away all above modes. So the question is how to get the current mode without using further tools like fbset and similar.
  • At least on my NanoPi M6, Linux provides only a single framebuffer, even of the DSI display + HDMI screen are attached. Hence both screens shot the same console output, attached to the same console device tty. This seems to have the implication that displays cannot be rotated independently either. As fast as I use both screens, rotating the DSI LCD does not work anymore. This is restored once the HDMI display is disabled. Would be interesting to find out whether/how to enable multi-display functionality, with a dedicated framebuffer for a different tty on each screen. On Raspberry Pi 4 and 5 there should be two framebuffers possible, but I did not test this yet. In case, mapping console devices to DRM devices might be a nice feature to add.
@InnovoDeveloper
Copy link

InnovoDeveloper commented Feb 10, 2025

Just tried the dietpi-display (Just and FYI, I had to reboot after installing the update to get dietpi-display to work). Howerver i am getting this error. Not sure if I missed a step.

uname -r> 6.1.84-vendor-rk35xx

running the image from the vendor gives me a desktop on the attached panel.

[FAILED] No DRM device has been found │ │ │ │ A DRM device could not be found on your system. Please assure the display is properly attached and working, and your │ │ kernel supports DRM. │ │ │ │ <Ok>

@MichaIng
Copy link
Owner Author

@InnovoDeveloper which SBC is it? And you say attacked panel, so I guess no HDMI screen, but a DSI LCD or similar? It is possible that at least for this display, no KMS/DRM is used, and hence it cannot be controlled via dietpi-display and the respective APIs.

@InnovoDeveloper
Copy link

It's the NanoPi M6 with the case built in display. https://wiki.friendlyelec.com/wiki/index.php/NanoPi_M6

@MichaIng
Copy link
Owner Author

Oh that is interesting. On my NanoPi M6 with official case and LCD it works perfectly fine 🤔. I'll retry with a freshly flashed image, just to be sure.

@MichaIng
Copy link
Owner Author

Okay so I flashed our current NanoPi M6 Bookworm image. It has the DSI1 display enabled OOTB, which is the one used by the case, mine was delivered with. When running dietpi-display, it works OOTB:

┌──────────────────────────┤ DietPi-Display ├───────────────────────────┐
│ DietPi-Display is currently in beta status. Please report             │
│ issues/suggestions:                                                   │
│ - https://github.com/MichaIng/DietPi/issues/7390                      │
│                                                                       │
│ Select a display to change its mode and rotation                      │
│                                                                       │
│           LCDs     Toggle LCD drivers                                 │
│                    ●─ Configure detected displays ────────●           │
│           Display  [DSI-1] Select display                             │
│           Mode     [480x800] Change screen resolution mode            │
│           Rotation [0] Change screen rotation                         │
│           Reset    Reset settings for selected display                │
│           Toggle   [enabled] Enable or disable this display           │
│                                                                       │
│                                                                       │
│                  <Select>                  <Exit>                     │
│                                                                       │
└───────────────────────────────────────────────────────────────────────┘

But I found the issue now if you use a prior image without the DSI1 port enabled. The respective menu to toggle LCD displays was not shown in this case, as planned. I just fixed it: 48e061a

Can you try this version, please?

curl -sSfo /boot/dietpi/dietpi-display 'https://raw.githubusercontent.com/MichaIng/DietPi/48e061a/dietpi/dietpi-display'

@InnovoDeveloper
Copy link

this worked great. This system did start and 9.9 Master, then Dev, then back to Master then upgrade to 9.10. The above solved it.

@MichaIng MichaIng modified the milestones: v9.11, v9.12 Feb 23, 2025
@sweetmeats83
Copy link

I'm using the Raspberry Pi Touch Display 2. I can not get this to rotate to landscape.

@MichaIng
Copy link
Owner Author

@sweetmeats83
The display appears in dietpi-display, and you can set the rotation there, but after reboot it does not apply? Do you have another display attached and configured? I faced this issue when using multiple screens on the NanoPi M6 (DSI LCD + HDMI screen): both share the same framebuffer, hence cannot be configured separately. Not sure whether there is a way to have an individual framebuffer for each, attach them to Individual TTYs etc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants