ecore_drm2: Add API to return display info

NB: This is unfinished !! Need to support rotations
This commit is contained in:
Christopher Michael 2023-01-02 07:56:59 -05:00
parent 7b19fbe81c
commit f85f6f5ad2
2 changed files with 35 additions and 0 deletions

View File

@ -74,6 +74,7 @@ EAPI void ecore_drm2_display_mode_info_get(Ecore_Drm2_Display_Mode *mode, int *w
EAPI Eina_Bool ecore_drm2_display_primary_get(Ecore_Drm2_Display *disp);
EAPI void ecore_drm2_display_primary_set(Ecore_Drm2_Display *disp, Eina_Bool primary);
EAPI const Eina_List *ecore_drm2_displays_get(Ecore_Drm2_Device *dev);
EAPI void ecore_drm2_display_info_get(Ecore_Drm2_Display *disp, int *x, int *y, int *w, int *h, unsigned int *refresh);
/* 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);

View File

@ -693,3 +693,37 @@ ecore_drm2_displays_get(Ecore_Drm2_Device *dev)
EINA_SAFETY_ON_NULL_RETURN_VAL(dev, EINA_FALSE);
return dev->displays;
}
EAPI void
ecore_drm2_display_info_get(Ecore_Drm2_Display *disp, int *x, int *y, int *w, int *h, unsigned int *refresh)
{
if (x) *x = 0;
if (y) *y = 0;
if (w) *w = 0;
if (h) *h = 0;
if (refresh) *refresh = 0;
EINA_SAFETY_ON_NULL_RETURN(disp);
EINA_SAFETY_ON_TRUE_RETURN(!disp->current_mode);
if (x) *x = disp->x;
if (y) *y = disp->y;
/* FIXME !! */
/* switch (disp->rotation) */
/* { */
/* case ECORE_DRM2_ROTATION_90: */
/* case ECORE_DRM2_ROTATION_270: */
/* if (w) *w = disp->current_mode->height; */
/* if (h) *h = disp->current_mode->width; */
/* break; */
/* case ECORE_DRM2_ROTATION_NORMAL: */
/* case ECORE_DRM2_ROTATION_180: */
/* default: */
if (w) *w = disp->current_mode->width;
if (h) *h = disp->current_mode->height;
/* break; */
/* } */
if (refresh) *refresh = disp->current_mode->refresh;
}