mirror of
https://github.com/lvgl/lvgl.git
synced 2026-08-17 09:42:19 +08:00
feat(drm)!: remove xf86drmMode.h from public header (#10138)
Arduino Lint / lint (push) Has been cancelled
Build Examples with C++ Compiler / build-examples (push) Has been cancelled
MicroPython CI / Build esp32 port (push) Has been cancelled
MicroPython CI / Build rp2 port (push) Has been cancelled
MicroPython CI / Build stm32 port (push) Has been cancelled
MicroPython CI / Build unix port (push) Has been cancelled
C/C++ CI / Build OPTIONS_16BIT - Ubuntu (push) Has been cancelled
C/C++ CI / Build OPTIONS_24BIT - Ubuntu (push) Has been cancelled
C/C++ CI / Build OPTIONS_FULL_32BIT - Ubuntu (push) Has been cancelled
C/C++ CI / Build OPTIONS_NORMAL_8BIT - Ubuntu (push) Has been cancelled
C/C++ CI / Build OPTIONS_SDL - Ubuntu (push) Has been cancelled
C/C++ CI / Build OPTIONS_16BIT - cl - Windows (push) Has been cancelled
C/C++ CI / Build OPTIONS_16BIT - gcc - Windows (push) Has been cancelled
C/C++ CI / Build OPTIONS_24BIT - cl - Windows (push) Has been cancelled
C/C++ CI / Build OPTIONS_24BIT - gcc - Windows (push) Has been cancelled
C/C++ CI / Build OPTIONS_FULL_32BIT - cl - Windows (push) Has been cancelled
C/C++ CI / Build OPTIONS_FULL_32BIT - gcc - Windows (push) Has been cancelled
C/C++ CI / Build ESP IDF ESP32S3 (push) Has been cancelled
C/C++ CI / Run tests with 32bit build (push) Has been cancelled
C/C++ CI / Run tests with 64bit build (push) Has been cancelled
BOM Check / bom-check (push) Has been cancelled
Verify that lv_conf_internal.h matches repository state / verify-conf-internal (push) Has been cancelled
Verify GDB constants are up-to-date / verify-gdb-consts (push) Has been cancelled
Verify the widget property name / verify-property-name (push) Has been cancelled
Verify code formatting / verify-formatting (push) Has been cancelled
Compare file templates with file names / template-check (push) Has been cancelled
Build Docs / build-and-deploy (push) Has been cancelled
Build .deb packages / build (push) Has been cancelled
Test API JSON generator / Test API JSON (push) Has been cancelled
Install LVGL using CMake / build-examples (private) (push) Has been cancelled
Install LVGL using CMake / build-examples (public) (push) Has been cancelled
Check Makefile / Build using Makefile (push) Has been cancelled
Check Makefile for UEFI / Build using Makefile for UEFI (push) Has been cancelled
Emulated Performance Test / ARM Emulated Benchmark - Script Check (scripts/perf/tests/benchmark_results_comment/test.sh) (push) Has been cancelled
Emulated Performance Test / ARM Emulated Benchmark - Script Check (scripts/perf/tests/filter_docker_logs/test.sh) (push) Has been cancelled
Emulated Performance Test / ARM Emulated Benchmark - Script Check (scripts/perf/tests/serialize_results/test.sh) (push) Has been cancelled
Emulated Performance Test / ARM Emulated Benchmark 32b - lv_conf_perf32b (push) Has been cancelled
Emulated Performance Test / ARM Emulated Benchmark 64b - lv_conf_perf64b (push) Has been cancelled
Emulated Performance Test / ARM Emulated Benchmark - Save PR Number (push) Has been cancelled
Performance Tests CI / Perf Tests OPTIONS_TEST_PERF_32B - Ubuntu (push) Has been cancelled
Performance Tests CI / Perf Tests OPTIONS_TEST_PERF_64B - Ubuntu (push) Has been cancelled
Port repo release update / run-release-branch-updater (push) Has been cancelled
Static Checks / Static Checks (push) Has been cancelled
Verify Font License / verify-font-license (push) Has been cancelled
Verify Kconfig / verify-kconfig (push) Has been cancelled
Hardware Performance Test / Hardware Performance Benchmark (push) Has been cancelled
Hardware Performance Test / HW Benchmark - Save PR Number (push) Has been cancelled
Arduino Lint / lint (push) Has been cancelled
Build Examples with C++ Compiler / build-examples (push) Has been cancelled
MicroPython CI / Build esp32 port (push) Has been cancelled
MicroPython CI / Build rp2 port (push) Has been cancelled
MicroPython CI / Build stm32 port (push) Has been cancelled
MicroPython CI / Build unix port (push) Has been cancelled
C/C++ CI / Build OPTIONS_16BIT - Ubuntu (push) Has been cancelled
C/C++ CI / Build OPTIONS_24BIT - Ubuntu (push) Has been cancelled
C/C++ CI / Build OPTIONS_FULL_32BIT - Ubuntu (push) Has been cancelled
C/C++ CI / Build OPTIONS_NORMAL_8BIT - Ubuntu (push) Has been cancelled
C/C++ CI / Build OPTIONS_SDL - Ubuntu (push) Has been cancelled
C/C++ CI / Build OPTIONS_16BIT - cl - Windows (push) Has been cancelled
C/C++ CI / Build OPTIONS_16BIT - gcc - Windows (push) Has been cancelled
C/C++ CI / Build OPTIONS_24BIT - cl - Windows (push) Has been cancelled
C/C++ CI / Build OPTIONS_24BIT - gcc - Windows (push) Has been cancelled
C/C++ CI / Build OPTIONS_FULL_32BIT - cl - Windows (push) Has been cancelled
C/C++ CI / Build OPTIONS_FULL_32BIT - gcc - Windows (push) Has been cancelled
C/C++ CI / Build ESP IDF ESP32S3 (push) Has been cancelled
C/C++ CI / Run tests with 32bit build (push) Has been cancelled
C/C++ CI / Run tests with 64bit build (push) Has been cancelled
BOM Check / bom-check (push) Has been cancelled
Verify that lv_conf_internal.h matches repository state / verify-conf-internal (push) Has been cancelled
Verify GDB constants are up-to-date / verify-gdb-consts (push) Has been cancelled
Verify the widget property name / verify-property-name (push) Has been cancelled
Verify code formatting / verify-formatting (push) Has been cancelled
Compare file templates with file names / template-check (push) Has been cancelled
Build Docs / build-and-deploy (push) Has been cancelled
Build .deb packages / build (push) Has been cancelled
Test API JSON generator / Test API JSON (push) Has been cancelled
Install LVGL using CMake / build-examples (private) (push) Has been cancelled
Install LVGL using CMake / build-examples (public) (push) Has been cancelled
Check Makefile / Build using Makefile (push) Has been cancelled
Check Makefile for UEFI / Build using Makefile for UEFI (push) Has been cancelled
Emulated Performance Test / ARM Emulated Benchmark - Script Check (scripts/perf/tests/benchmark_results_comment/test.sh) (push) Has been cancelled
Emulated Performance Test / ARM Emulated Benchmark - Script Check (scripts/perf/tests/filter_docker_logs/test.sh) (push) Has been cancelled
Emulated Performance Test / ARM Emulated Benchmark - Script Check (scripts/perf/tests/serialize_results/test.sh) (push) Has been cancelled
Emulated Performance Test / ARM Emulated Benchmark 32b - lv_conf_perf32b (push) Has been cancelled
Emulated Performance Test / ARM Emulated Benchmark 64b - lv_conf_perf64b (push) Has been cancelled
Emulated Performance Test / ARM Emulated Benchmark - Save PR Number (push) Has been cancelled
Performance Tests CI / Perf Tests OPTIONS_TEST_PERF_32B - Ubuntu (push) Has been cancelled
Performance Tests CI / Perf Tests OPTIONS_TEST_PERF_64B - Ubuntu (push) Has been cancelled
Port repo release update / run-release-branch-updater (push) Has been cancelled
Static Checks / Static Checks (push) Has been cancelled
Verify Font License / verify-font-license (push) Has been cancelled
Verify Kconfig / verify-kconfig (push) Has been cancelled
Hardware Performance Test / Hardware Performance Benchmark (push) Has been cancelled
Hardware Performance Test / HW Benchmark - Save PR Number (push) Has been cancelled
Replace direct drmModeModeInfo typedef with an opaque struct to avoid leaking the DRM header dependency to consumers. Add accessor functions for all mode properties and a get_raw escape hatch for direct DRM access. BREAKING CHANGE: lv_linux_drm_mode_t no longer aliases drmModeModeInfo. Code that accessed DRM fields directly must use the provided accessors: lv_linux_drm_mode_get_horizontal_resolution() lv_linux_drm_mode_get_vertical_resolution() lv_linux_drm_mode_get_refresh_rate() lv_linux_drm_mode_is_preferred() lv_linux_drm_mode_get_raw() for raw drmModeModeInfo access (requires xf86drmMode.h)
This commit is contained in:
@@ -7,8 +7,7 @@ if(LV_USE_FIND_PACKAGE_LIBDRM)
|
||||
find_package(libdrm QUIET)
|
||||
if(libdrm_FOUND)
|
||||
message(STATUS "lvgl: libdrm: found via find_package")
|
||||
# Link libdrm publicly since lvgl headers expose drm types
|
||||
target_link_libraries(lvgl PUBLIC libdrm::libdrm)
|
||||
target_link_libraries(lvgl PRIVATE libdrm::libdrm)
|
||||
return()
|
||||
endif()
|
||||
endif()
|
||||
@@ -18,7 +17,7 @@ if(LV_USE_PKG_CONFIG_LIBDRM AND PkgConfig_FOUND)
|
||||
if(LIBDRM_FOUND)
|
||||
message(STATUS "lvgl: libdrm: found via pkg-config")
|
||||
# Link libdrm publicly since lvgl headers expose drm types
|
||||
target_link_libraries(lvgl PUBLIC PkgConfig::LIBDRM)
|
||||
target_link_libraries(lvgl PRIVATE PkgConfig::LIBDRM)
|
||||
return()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
@@ -17,7 +17,6 @@ extern "C" {
|
||||
#include "../../display/lv_display.h"
|
||||
|
||||
#if LV_USE_LINUX_DRM
|
||||
#include <xf86drmMode.h>
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
@@ -27,7 +26,11 @@ extern "C" {
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
|
||||
typedef drmModeModeInfo lv_linux_drm_mode_t;
|
||||
/**
|
||||
* DRM display mode information.
|
||||
* Contains the essential display parameters for mode selection.
|
||||
*/
|
||||
typedef struct _lv_linux_drm_mode_t lv_linux_drm_mode_t;
|
||||
|
||||
/**
|
||||
* Callback function type for selecting a DRM display mode
|
||||
@@ -118,6 +121,14 @@ int32_t lv_linux_drm_mode_get_refresh_rate(const lv_linux_drm_mode_t * mode);
|
||||
*/
|
||||
bool lv_linux_drm_mode_is_preferred(const lv_linux_drm_mode_t * mode);
|
||||
|
||||
/**
|
||||
* Get the underlying DRM mode object.
|
||||
* @param mode pointer to the DRM mode object
|
||||
* @return pointer to the underlying drmModeModeInfo, or NULL if mode is invalid.
|
||||
* Requires including <xf86drmMode.h> to dereference.
|
||||
*/
|
||||
void * lv_linux_drm_mode_get_raw(const lv_linux_drm_mode_t * mode);
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
|
||||
#include <dirent.h>
|
||||
#include <xf86drmMode.h>
|
||||
#include "lv_linux_drm_private.h"
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
@@ -95,7 +96,7 @@ int32_t lv_linux_drm_mode_get_horizontal_resolution(const lv_linux_drm_mode_t *
|
||||
if(!mode) {
|
||||
return 0;
|
||||
}
|
||||
return mode->hdisplay;
|
||||
return mode->mode_info->hdisplay;
|
||||
}
|
||||
|
||||
int32_t lv_linux_drm_mode_get_vertical_resolution(const lv_linux_drm_mode_t * mode)
|
||||
@@ -103,7 +104,7 @@ int32_t lv_linux_drm_mode_get_vertical_resolution(const lv_linux_drm_mode_t * mo
|
||||
if(!mode) {
|
||||
return 0;
|
||||
}
|
||||
return mode->vdisplay;
|
||||
return mode->mode_info->vdisplay;
|
||||
}
|
||||
|
||||
int32_t lv_linux_drm_mode_get_refresh_rate(const lv_linux_drm_mode_t * mode)
|
||||
@@ -111,7 +112,7 @@ int32_t lv_linux_drm_mode_get_refresh_rate(const lv_linux_drm_mode_t * mode)
|
||||
if(!mode) {
|
||||
return 0;
|
||||
}
|
||||
return mode->vrefresh;
|
||||
return mode->mode_info->vrefresh;
|
||||
}
|
||||
|
||||
bool lv_linux_drm_mode_is_preferred(const lv_linux_drm_mode_t * mode)
|
||||
@@ -119,7 +120,15 @@ bool lv_linux_drm_mode_is_preferred(const lv_linux_drm_mode_t * mode)
|
||||
if(!mode) {
|
||||
return false;
|
||||
}
|
||||
return (mode->type & DRM_MODE_TYPE_PREFERRED) != 0;
|
||||
return (mode->mode_info->type & DRM_MODE_TYPE_PREFERRED) != 0;
|
||||
}
|
||||
|
||||
void * lv_linux_drm_mode_get_raw(const lv_linux_drm_mode_t * mode)
|
||||
{
|
||||
if(!mode) {
|
||||
return NULL;
|
||||
}
|
||||
return mode->mode_info;
|
||||
}
|
||||
|
||||
#endif /*LV_USE_LINUX_DRM*/
|
||||
|
||||
@@ -640,8 +640,17 @@ static drmModeModeInfo * drm_get_mode(lv_drm_ctx_t * ctx)
|
||||
{
|
||||
LV_ASSERT_NULL(ctx->drm_connector);
|
||||
if(ctx->mode_select_cb) {
|
||||
size_t mode_index = ctx->mode_select_cb(ctx->display, (lv_linux_drm_mode_t *)ctx->drm_connector->modes,
|
||||
(size_t)ctx->drm_connector->count_modes);
|
||||
lv_linux_drm_mode_t * modes = lv_malloc(sizeof(lv_linux_drm_mode_t) * ctx->drm_connector->count_modes);
|
||||
if(!modes) {
|
||||
LV_LOG_WARN("Failed to allocate memory for drm modes");
|
||||
return NULL;
|
||||
}
|
||||
for(int i = 0; i < ctx->drm_connector->count_modes; i++) {
|
||||
modes[i].mode_info = &ctx->drm_connector->modes[i];
|
||||
}
|
||||
size_t mode_index = ctx->mode_select_cb(ctx->display, modes, (size_t)ctx->drm_connector->count_modes);
|
||||
lv_free(modes);
|
||||
|
||||
if(mode_index >= (size_t)ctx->drm_connector->count_modes) {
|
||||
LV_LOG_ERROR("Failed to select drm mode. User select callback return an invalid mode index");
|
||||
return NULL;
|
||||
|
||||
@@ -20,6 +20,7 @@ extern "C" {
|
||||
#if LV_USE_LINUX_DRM && LV_LINUX_DRM_USE_EGL
|
||||
|
||||
#include <xf86drmMode.h>
|
||||
#include "lv_linux_drm_private.h"
|
||||
#include "../../opengles/lv_opengles_texture_private.h"
|
||||
#include "../../opengles/lv_opengles_egl.h"
|
||||
#include "../../opengles/lv_opengles_egl_private.h"
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
/**
|
||||
* @file lv_linux_drm_private.h
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef LV_LINUX_DRM_PRIVATE_H
|
||||
#define LV_LINUX_DRM_PRIVATE_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
|
||||
#include "../../../lvgl_public.h"
|
||||
|
||||
#if LV_USE_LINUX_DRM
|
||||
|
||||
#include <xf86drmMode.h>
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
|
||||
struct _lv_linux_drm_mode_t {
|
||||
drmModeModeInfo * mode_info;
|
||||
};
|
||||
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
#endif /*LV_USE_LINUX_DRM*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /*extern "C"*/
|
||||
#endif
|
||||
|
||||
#endif /*LV_LINUX_DRM_PRIVATE_H*/
|
||||
@@ -104,6 +104,7 @@ extern "C" {
|
||||
#include "draw/vg_lite/lv_vg_lite_pending.h"
|
||||
#include "draw/vg_lite/lv_vg_lite_stroke.h"
|
||||
#include "draw/vg_lite/lv_vg_lite_utils.h"
|
||||
#include "drivers/display/drm/lv_linux_drm_private.h"
|
||||
#include "drivers/display/drm/lv_linux_drm_egl_private.h"
|
||||
#include "drivers/display/ft81x/lv_ft81x_defines.h"
|
||||
#include "drivers/evdev/lv_evdev_private.h"
|
||||
|
||||
Reference in New Issue
Block a user