lv_linux_drm.h
API reference for lv_linux_drm.h
Functions
lv_linux_drm_set_file
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.
lv_result_t lv_linux_drm_set_file(lv_display_t *disp, const char *file, int64_t connector_id)| Name | Type | Description |
|---|---|---|
disp | lv_display_t * | Pointer to the display object created with lv_linux_drm_create() |
file | const char * | Path to the DRM device file (e.g., "/dev/dri/card0") |
connector_id | int64_t | ID of the DRM connector to use, or -1 to auto-select the first available |
Returns: lv_result_t — LV_RESULT_OK if the initialization succeeded or LV_RESULT_INVALID if it failed
lv_linux_drm_set_mode_cb
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
void lv_linux_drm_set_mode_cb(lv_display_t *disp, lv_linux_drm_select_mode_cb_t callback)| Name | Type | Description |
|---|---|---|
disp | lv_display_t * | pointer to the display object |
callback | lv_linux_drm_select_mode_cb_t | function to be called when a display mode needs to be selected, or NULL to use the default mode selection behavior |
lv_linux_drm_mode_get_horizontal_resolution
Get the horizontal resolution of a DRM mode
int32_t lv_linux_drm_mode_get_horizontal_resolution(const lv_linux_drm_mode_t *mode)| Name | Type | Description |
|---|---|---|
mode | const lv_linux_drm_mode_t * | pointer to the DRM mode object |
Returns: int32_t — horizontal resolution in pixels, or 0 if mode is invalid
lv_linux_drm_mode_get_vertical_resolution
Get the vertical resolution of a DRM mode
int32_t lv_linux_drm_mode_get_vertical_resolution(const lv_linux_drm_mode_t *mode)| Name | Type | Description |
|---|---|---|
mode | const lv_linux_drm_mode_t * | pointer to the DRM mode object |
Returns: int32_t — vertical resolution in pixels, or 0 if mode is invalid
lv_linux_drm_mode_get_refresh_rate
Get the refresh rate of a DRM mode
int32_t lv_linux_drm_mode_get_refresh_rate(const lv_linux_drm_mode_t *mode)| Name | Type | Description |
|---|---|---|
mode | const lv_linux_drm_mode_t * | pointer to the DRM mode object |
Returns: int32_t — refresh rate in Hz, or 0 if mode is invalid
lv_linux_drm_mode_get_raw
Get the underlying DRM mode object.
void * lv_linux_drm_mode_get_raw(const lv_linux_drm_mode_t *mode)| Name | Type | Description |
|---|---|---|
mode | const lv_linux_drm_mode_t * | pointer to the DRM mode object |
Returns: void * — pointer to the underlying drmModeModeInfo, or NULL if mode is invalid. Requires including <xf86drmMode.h> to dereference.
lv_linux_drm_create
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.
lv_display_t * lv_linux_drm_create(void)Returns: lv_display_t * — Pointer to the created display object, or NULL on failure
lv_linux_drm_find_device_path
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().
char * lv_linux_drm_find_device_path(void)Returns: char * — Dynamically allocated string containing the device path (must be freed with lv_free()), or NULL if no suitable device is found
lv_linux_drm_mode_is_preferred
Check if a DRM mode is the preferred mode for the display
bool lv_linux_drm_mode_is_preferred(const lv_linux_drm_mode_t *mode)| Name | Type | Description |
|---|---|---|
mode | const lv_linux_drm_mode_t * | pointer to the DRM mode object |
Returns: bool — true if this is the preferred/native mode, false otherwise
Typedefs
lv_linux_drm_mode_t
typedef struct _lv_linux_drm_mode_t lv_linux_drm_mode_tDRM display mode information. Contains the essential display parameters for mode selection.
Used by 5 functions
lv_linux_drm_mode_get_horizontal_resolution— parammodelv_linux_drm_mode_get_vertical_resolution— parammodelv_linux_drm_mode_get_refresh_rate— parammodelv_linux_drm_mode_is_preferred— parammodelv_linux_drm_mode_get_raw— parammode
lv_linux_drm_select_mode_cb_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
Used by 1 function
lv_linux_drm_set_mode_cb— paramcallback
Dependencies
Last updated on