2021-08-16 01:03 AM
i‘m not using qt or other 3rd gui framweork, no weston, no x, just direct use drm api,i need switch off lcd after some time is not operated,i google it a while,It looks i need a complete desktop environment to do that,so i want know is any way to do that easily.
now i can simply switch off backlight to look like the lcd is off
2021-08-25 08:40 AM
Hi @Jzhua ,
I understand playing with backlight is a valid method but maybe not achieving best result in term of power consumption. ( https://wiki.st.com/stm32mpu/wiki/How_to_modify_the_panel_backlight )
I escalate your point to some expert. Keep you posted.
Olivier
2021-08-31 07:37 PM
Okay, I will continue to learn about the content
2021-08-31 11:23 PM
Hi @Jzhua ,
I found some help from expert :
We have implemented “atomic�? drm/kms drivers so dpms is managed thanks to the CRTC “active�? drm property (prop_active in the uapi, “ACTIVE�? with the libdrm).
In the modetest source code, you can find functions calls setting or resetting the “active�? value (https://github.com/grate-driver/libdrm/blob/master/tests/modetest/modetest.c#L1315
When the CRTC is not anymore in the active state, the panel disable() then unprepare() functions are called (see https://cgit.freedesktop.org/drm/drm-misc/tree/drivers/gpu/drm/panel/panel-orisetech-otm8009a.c#n246).
The “modetest�? command will show the CRTC “ACTIVE�? state current value.
More documentations :
https://elixir.bootlin.com/linux/v5.10.61/source/include/drm/drm_mode_config.h#L659
https://elixir.bootlin.com/linux/v5.10.61/source/drivers/gpu/drm/drm_crtc.c#L212
Hope it help
Olivier
2021-09-03 12:36 AM
i found a easy way to do that
void drm_blank(int blank)
{
if(lcd_drm && lcd_drm->main_monitor_crtc){
if(blank){
// disbale crtc
drmModeSetCrtc(lcd_drm->fd, lcd_drm->main_monitor_crtc->crtc_id,
0, // fb_id
0, 0, // x,y
NULL, // connectors
0, // connector_count
NULL); // mode
}else{
struct modeset_buf* buf = &lcd_drm->dev->bufs[lcd_drm->dev->front_buf];
// enable crtc
drmModeSetCrtc(lcd_drm->fd, lcd_drm->main_monitor_crtc->crtc_id,
buf->fb,
0, 0, // x,y
&lcd_drm->dev->conn,
1, // connector_count
&lcd_drm->dev->mode);
}
}
}