lv_linux_drm.h¶
Typedefs
-
typedef drmModeModeInfo lv_linux_drm_mode_t¶
-
typedef size_t (*lv_linux_drm_select_mode_cb_t)(lv_display_t *disp, const lv_linux_drm_mode_t *modes, size_t mode_count)¶
Callback function type for selecting a DRM display mode
- Param disp:
pointer to the display object
- Param modes:
array of available DRM modes
- Param mode_count:
number of modes in the array
- Return:
index of the selected mode from the modes array
Functions
-
lv_display_t *lv_linux_drm_create(void)¶
Create a new Linux DRM display.
Creates and initializes a new LVGL display using the Linux DRM (Direct Rendering Manager) subsystem for hardware-accelerated graphics output.
- Returns:
Pointer to the created display object, or NULL on failure
-
void lv_linux_drm_set_file(lv_display_t *disp, const char *file, int64_t connector_id)¶
Configure the DRM device file and connector for a display.
Sets the DRM device file path and connector ID to use for the specified display. The DRM device file is typically located at /dev/dri/cardN where N is the card number. The connector ID specifies which physical output (HDMI, VGA, etc.) to use.
- Parameters:
disp – Pointer to the display object created with lv_linux_drm_create()
file – Path to the DRM device file (e.g., "/dev/dri/card0")
connector_id – ID of the DRM connector to use, or -1 to auto-select the first available
-
char *lv_linux_drm_find_device_path(void)¶
Automatically find a suitable DRM device path.
Scans the system for available DRM devices and returns the path to a suitable device file that can be used with lv_linux_drm_set_file().
- Returns:
Dynamically allocated string containing the device path (must be freed with lv_free()), or NULL if no suitable device is found
-
void lv_linux_drm_set_mode_cb(lv_display_t *disp, lv_linux_drm_select_mode_cb_t callback)¶
Set a callback function for custom DRM mode selection to override the default mode selection behavior
The default mode selection behavior is selecting the native mode
- Parameters:
disp – pointer to the display object
callback – function to be called when a display mode needs to be selected, or NULL to use the default mode selection behavior
-
int32_t lv_linux_drm_mode_get_horizontal_resolution(const lv_linux_drm_mode_t *mode)¶
Get the horizontal resolution of a DRM mode
- Parameters:
mode – pointer to the DRM mode object
- Returns:
horizontal resolution in pixels, or 0 if mode is invalid
-
int32_t lv_linux_drm_mode_get_vertical_resolution(const lv_linux_drm_mode_t *mode)¶
Get the vertical resolution of a DRM mode
- Parameters:
mode – pointer to the DRM mode object
- Returns:
vertical resolution in pixels, or 0 if mode is invalid
-
int32_t lv_linux_drm_mode_get_refresh_rate(const lv_linux_drm_mode_t *mode)¶
Get the refresh rate of a DRM mode
- Parameters:
mode – pointer to the DRM mode object
- Returns:
refresh rate in Hz, or 0 if mode is invalid
-
bool lv_linux_drm_mode_is_preferred(const lv_linux_drm_mode_t *mode)¶
Check if a DRM mode is the preferred mode for the display
- Parameters:
mode – pointer to the DRM mode object
- Returns:
true if this is the preferred/native mode, false otherwise