From e47a812240cd6439d1457bb8dd6629740ae7d7cf Mon Sep 17 00:00:00 2001 From: Christopher Michael Date: Wed, 7 Dec 2022 07:19:08 -0500 Subject: [PATCH] ecore_drm2: Add API to get screen size range --- src/lib/ecore_drm2/Ecore_Drm2.h | 2 ++ src/lib/ecore_drm2/ecore_drm2_device.c | 23 +++++++++++++++++++++++ 2 files changed, 25 insertions(+) diff --git a/src/lib/ecore_drm2/Ecore_Drm2.h b/src/lib/ecore_drm2/Ecore_Drm2.h index 3c1a15f6d5..d1c602b7cf 100644 --- a/src/lib/ecore_drm2/Ecore_Drm2.h +++ b/src/lib/ecore_drm2/Ecore_Drm2.h @@ -53,7 +53,9 @@ EAPI Ecore_Drm2_Device *ecore_drm2_device_open(const char *seat, unsigned int tt EAPI void ecore_drm2_device_close(Ecore_Drm2_Device *dev); EAPI void ecore_drm2_device_cursor_size_get(Ecore_Drm2_Device *dev, int *width, int *height); EAPI void ecore_drm2_device_preferred_depth_get(Ecore_Drm2_Device *dev, int *depth, int *bpp); +EAPI void ecore_drm2_device_screen_size_range_get(Ecore_Drm2_Device *dev, int *minw, int *minh, int *maxw, int *maxh); +/* XXX: These are 'test' APIs */ EAPI void ecore_drm2_display_mode_set(Ecore_Drm2_Display *disp, Ecore_Drm2_Display_Mode *mode, int x, int y); # endif diff --git a/src/lib/ecore_drm2/ecore_drm2_device.c b/src/lib/ecore_drm2/ecore_drm2_device.c index e74bffebc9..ae56d7ebdc 100644 --- a/src/lib/ecore_drm2/ecore_drm2_device.c +++ b/src/lib/ecore_drm2/ecore_drm2_device.c @@ -347,3 +347,26 @@ ecore_drm2_device_preferred_depth_get(Ecore_Drm2_Device *dev, int *depth, int *b if (bpp) *bpp = caps; } } + +EAPI void +ecore_drm2_device_screen_size_range_get(Ecore_Drm2_Device *dev, int *minw, int *minh, int *maxw, int *maxh) +{ + drmModeRes *res; + + if (minw) *minw = 0; + if (minh) *minh = 0; + if (maxw) *maxw = 0; + if (maxh) *maxh = 0; + + EINA_SAFETY_ON_NULL_RETURN(dev); + + res = sym_drmModeGetResources(dev->fd); + if (!res) return; + + if (minw) *minw = res->min_width; + if (minh) *minh = res->min_height; + if (maxw) *maxw = res->max_width; + if (maxh) *maxh = res->max_height; + + sym_drmModeFreeResources(res); +}